From efe921ffe7e2aefe6f9f49cd05f5a50206022fbe Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 3 Jul 2017 23:29:06 +0200 Subject: [PATCH] LimeSDR output: optimize get device info by checking buddy leadership in the GUI --- .../limesdroutput/limesdroutput.cpp | 57 +++++++++---------- .../limesdroutput/limesdroutputgui.cpp | 8 ++- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/plugins/samplesink/limesdroutput/limesdroutput.cpp b/plugins/samplesink/limesdroutput/limesdroutput.cpp index b077ddcda..ef7c1c7bc 100644 --- a/plugins/samplesink/limesdroutput/limesdroutput.cpp +++ b/plugins/samplesink/limesdroutput/limesdroutput.cpp @@ -432,42 +432,39 @@ bool LimeSDROutput::handleMessage(const Message& message) } else if (MsgGetDeviceInfo::match(message)) { - if (m_deviceAPI->isBuddyLeader()) + double temp = 0.0; + + if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) == 0)) { - double temp = 0.0; + //qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: temperature: %f", temp); + } + else + { + qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); + } - if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) == 0)) - { - qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: temperature: %f", temp); - } - else - { - qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get temperature"); - } + // send to oneself + DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); + m_deviceAPI->getDeviceOutputMessageQueue()->push(report); - // send to oneself + // send to source buddies + const std::vector& sourceBuddies = m_deviceAPI->getSourceBuddies(); + std::vector::const_iterator itSource = sourceBuddies.begin(); + + for (; itSource != sourceBuddies.end(); ++itSource) + { DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); - m_deviceAPI->getDeviceOutputMessageQueue()->push(report); + (*itSource)->getDeviceOutputMessageQueue()->push(report); + } - // send to source buddies - const std::vector& sourceBuddies = m_deviceAPI->getSourceBuddies(); - std::vector::const_iterator itSource = sourceBuddies.begin(); + // send to sink buddies + const std::vector& sinkBuddies = m_deviceAPI->getSinkBuddies(); + std::vector::const_iterator itSink = sinkBuddies.begin(); - for (; itSource != sourceBuddies.end(); ++itSource) - { - DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); - (*itSource)->getDeviceOutputMessageQueue()->push(report); - } - - // send to sink buddies - const std::vector& sinkBuddies = m_deviceAPI->getSinkBuddies(); - std::vector::const_iterator itSink = sinkBuddies.begin(); - - for (; itSink != sinkBuddies.end(); ++itSink) - { - DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); - (*itSink)->getDeviceOutputMessageQueue()->push(report); - } + for (; itSink != sinkBuddies.end(); ++itSink) + { + DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp); + (*itSink)->getDeviceOutputMessageQueue()->push(report); } return true; diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp index 348eebbce..937a93b42 100644 --- a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp +++ b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp @@ -342,8 +342,12 @@ void LimeSDROutputGUI::updateStatus() } else { - LimeSDROutput::MsgGetDeviceInfo* message = LimeSDROutput::MsgGetDeviceInfo::create(); - m_sampleSink->getInputMessageQueue()->push(message); + if (m_deviceAPI->isBuddyLeader()) + { + LimeSDROutput::MsgGetDeviceInfo* message = LimeSDROutput::MsgGetDeviceInfo::create(); + m_sampleSink->getInputMessageQueue()->push(message); + } + m_deviceStatusCounter = 0; } }