From b5a7a65d8514280725c6af9ca4d82e21b8f71835 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 18 Sep 2017 01:05:08 +0200 Subject: [PATCH] LimeSDR: set buddy configuration from the source or sink and not from the GUI --- .../limesdroutput/limesdroutput.cpp | 56 ++++++++++++------- .../samplesink/limesdroutput/limesdroutput.h | 20 ------- .../limesdroutput/limesdroutputgui.cpp | 6 -- .../limesdrinput/limesdrinput.cpp | 56 ++++++++++++------- .../samplesource/limesdrinput/limesdrinput.h | 20 ------- .../limesdrinput/limesdrinputgui.cpp | 6 -- 6 files changed, 74 insertions(+), 90 deletions(-) diff --git a/plugins/samplesink/limesdroutput/limesdroutput.cpp b/plugins/samplesink/limesdroutput/limesdroutput.cpp index 04570b97f..210bb1bc5 100644 --- a/plugins/samplesink/limesdroutput/limesdroutput.cpp +++ b/plugins/samplesink/limesdroutput/limesdroutput.cpp @@ -31,7 +31,6 @@ MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgConfigureLimeSDR, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetStreamInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgGetDeviceInfo, Message) -MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgSetReferenceConfig, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportLimeSDRToBuddy, Message) MESSAGE_CLASS_DEFINITION(LimeSDROutput::MsgReportStreamInfo, Message) @@ -412,13 +411,20 @@ bool LimeSDROutput::handleMessage(const Message& message) return true; } - else if (MsgSetReferenceConfig::match(message)) + else if (MsgReportLimeSDRToBuddy::match(message)) { - MsgSetReferenceConfig& conf = (MsgSetReferenceConfig&) message; - qDebug() << "LimeSDROutput::handleMessage: MsgSetReferenceConfig"; - m_settings = conf.getSettings(); - m_deviceShared.m_ncoFrequency = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; // for buddies - m_deviceShared.m_centerFrequency = m_settings.m_centerFrequency; // for buddies + MsgReportLimeSDRToBuddy& conf = (MsgReportLimeSDRToBuddy&) message; + m_settings.m_centerFrequency = conf.getCenterFrequency(); + m_settings.m_devSampleRate = conf.getSampleRate(); + m_settings.m_log2HardInterp = conf.getLog2HardInterp(); + + return true; + } + else if (DeviceLimeSDRShared::MsgCrossReportToBuddy::match(message)) + { + DeviceLimeSDRShared::MsgCrossReportToBuddy& conf = (DeviceLimeSDRShared::MsgCrossReportToBuddy&) message; + m_settings.m_devSampleRate = conf.getSampleRate(); + return true; } else if (MsgGetStreamInfo::match(message)) @@ -918,14 +924,18 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo m_settings.m_centerFrequency + buddyNCOFreq); // do not change center frequency (*itSink)->getDeviceEngineInputMessageQueue()->push(notif); + MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( + m_settings.m_centerFrequency, + m_settings.m_devSampleRate, + m_settings.m_log2HardInterp); + if ((*itSink)->getSampleSinkGUIMessageQueue()) { - MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( - m_settings.m_centerFrequency, - m_settings.m_devSampleRate, - m_settings.m_log2HardInterp); - (*itSink)->getSampleSinkGUIMessageQueue()->push(report); + MsgReportLimeSDRToBuddy *reportToGUI = new MsgReportLimeSDRToBuddy(*report); + (*itSink)->getSampleSinkGUIMessageQueue()->push(reportToGUI); } + + (*itSink)->getSampleSinkInputMessageQueue()->push(report); } // send to source buddies @@ -943,11 +953,15 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo buddyCenterFreq + buddyNCOFreq); (*itSource)->getDeviceEngineInputMessageQueue()->push(notif); + DeviceLimeSDRShared::MsgCrossReportToBuddy *report = DeviceLimeSDRShared::MsgCrossReportToBuddy::create(m_settings.m_devSampleRate); + if ((*itSource)->getSampleSourceGUIMessageQueue()) { - DeviceLimeSDRShared::MsgCrossReportToBuddy *report = DeviceLimeSDRShared::MsgCrossReportToBuddy::create(m_settings.m_devSampleRate); - (*itSource)->getSampleSourceGUIMessageQueue()->push(report); + DeviceLimeSDRShared::MsgCrossReportToBuddy *reportToGUI = new DeviceLimeSDRShared::MsgCrossReportToBuddy(*report); + (*itSource)->getSampleSourceGUIMessageQueue()->push(reportToGUI); } + + (*itSource)->getSampleSourceInputMessageQueue()->push(report); } } else if (forwardChangeTxDSP) @@ -973,14 +987,18 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, buddyCenterFreq + buddyNCOFreq); // do not change center frequency (*itSink)->getDeviceEngineInputMessageQueue()->push(notif); + MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( + m_settings.m_centerFrequency, + m_settings.m_devSampleRate, + m_settings.m_log2HardInterp); + if ((*itSink)->getSampleSinkGUIMessageQueue()) { - MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( - m_settings.m_centerFrequency, - m_settings.m_devSampleRate, - m_settings.m_log2HardInterp); - (*itSink)->getSampleSinkGUIMessageQueue()->push(report); + MsgReportLimeSDRToBuddy *reportToGUI = new MsgReportLimeSDRToBuddy(*report); + (*itSink)->getSampleSinkGUIMessageQueue()->push(reportToGUI); } + + (*itSink)->getSampleSinkInputMessageQueue()->push(report); } } else if (forwardChangeOwnDSP) diff --git a/plugins/samplesink/limesdroutput/limesdroutput.h b/plugins/samplesink/limesdroutput/limesdroutput.h index 7f66412f2..9f2e9baca 100644 --- a/plugins/samplesink/limesdroutput/limesdroutput.h +++ b/plugins/samplesink/limesdroutput/limesdroutput.h @@ -51,26 +51,6 @@ public: { } }; - class MsgSetReferenceConfig : public Message { - MESSAGE_CLASS_DECLARATION - - public: - const LimeSDROutputSettings& getSettings() const { return m_settings; } - - static MsgSetReferenceConfig* create(const LimeSDROutputSettings& settings) - { - return new MsgSetReferenceConfig(settings); - } - - private: - LimeSDROutputSettings m_settings; - - MsgSetReferenceConfig(const LimeSDROutputSettings& settings) : - Message(), - m_settings(settings) - { } - }; - class MsgGetStreamInfo : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp index 1caa37a59..2da2a5553 100644 --- a/plugins/samplesink/limesdroutput/limesdroutputgui.cpp +++ b/plugins/samplesink/limesdroutput/limesdroutputgui.cpp @@ -152,9 +152,6 @@ bool LimeSDROutputGUI::handleMessage(const Message& message) displaySettings(); blockApplySettings(false); - LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings); - m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device - return true; } else if (DeviceLimeSDRShared::MsgCrossReportToBuddy::match(message)) @@ -166,9 +163,6 @@ bool LimeSDROutputGUI::handleMessage(const Message& message) displaySettings(); blockApplySettings(false); - LimeSDROutput::MsgSetReferenceConfig* conf = LimeSDROutput::MsgSetReferenceConfig::create(m_settings); - m_sampleSink->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device - return true; } else if (LimeSDROutput::MsgReportStreamInfo::match(message)) diff --git a/plugins/samplesource/limesdrinput/limesdrinput.cpp b/plugins/samplesource/limesdrinput/limesdrinput.cpp index 5d4c2b585..05fa93346 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinput.cpp @@ -33,7 +33,6 @@ MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgConfigureLimeSDR, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetStreamInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetDeviceInfo, Message) -MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgSetReferenceConfig, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportLimeSDRToBuddy, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportStreamInfo, Message) MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgFileRecord, Message) @@ -410,13 +409,20 @@ bool LimeSDRInput::handleMessage(const Message& message) return true; } - else if (MsgSetReferenceConfig::match(message)) + else if (MsgReportLimeSDRToBuddy::match(message)) { - MsgSetReferenceConfig& conf = (MsgSetReferenceConfig&) message; - qDebug() << "LimeSDRInput::handleMessage: MsgSetReferenceConfig"; - m_settings = conf.getSettings(); - m_deviceShared.m_ncoFrequency = m_settings.m_ncoEnable ? m_settings.m_ncoFrequency : 0; // for buddies - m_deviceShared.m_centerFrequency = m_settings.m_centerFrequency; // for buddies + MsgReportLimeSDRToBuddy& conf = (MsgReportLimeSDRToBuddy&) message; + m_settings.m_centerFrequency = conf.getCenterFrequency(); + m_settings.m_devSampleRate = conf.getSampleRate(); + m_settings.m_log2HardDecim = conf.getLog2HardDecim(); + + return true; + } + else if (DeviceLimeSDRShared::MsgCrossReportToBuddy::match(message)) + { + DeviceLimeSDRShared::MsgCrossReportToBuddy& conf = (DeviceLimeSDRShared::MsgCrossReportToBuddy&) message; + m_settings.m_devSampleRate = conf.getSampleRate(); + return true; } else if (MsgGetStreamInfo::match(message)) @@ -1080,14 +1086,18 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc m_settings.m_centerFrequency + buddyNCOFreq); (*itSource)->getDeviceEngineInputMessageQueue()->push(notif); + MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( + m_settings.m_centerFrequency, + m_settings.m_devSampleRate, + m_settings.m_log2HardDecim); + if ((*itSource)->getSampleSourceGUIMessageQueue()) { - MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( - m_settings.m_centerFrequency, - m_settings.m_devSampleRate, - m_settings.m_log2HardDecim); - (*itSource)->getSampleSourceGUIMessageQueue()->push(report); + MsgReportLimeSDRToBuddy *reportToGUI = new MsgReportLimeSDRToBuddy(*report); + (*itSource)->getSampleSourceGUIMessageQueue()->push(reportToGUI); } + + (*itSource)->getSampleSourceInputMessageQueue()->push(report); } // send to sink buddies @@ -1105,11 +1115,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc buddyCenterFreq + buddyNCOFreq); // do not change center frequency (*itSink)->getDeviceEngineInputMessageQueue()->push(notif); + DeviceLimeSDRShared::MsgCrossReportToBuddy *report = DeviceLimeSDRShared::MsgCrossReportToBuddy::create(m_settings.m_devSampleRate); + if ((*itSink)->getSampleSinkGUIMessageQueue()) { - DeviceLimeSDRShared::MsgCrossReportToBuddy *report = DeviceLimeSDRShared::MsgCrossReportToBuddy::create(m_settings.m_devSampleRate); - (*itSink)->getSampleSinkGUIMessageQueue()->push(report); + DeviceLimeSDRShared::MsgCrossReportToBuddy *reportToGUI = new DeviceLimeSDRShared::MsgCrossReportToBuddy(*report); + (*itSink)->getSampleSinkGUIMessageQueue()->push(reportToGUI); } + + (*itSink)->getSampleSinkInputMessageQueue()->push(report); } } else if (forwardChangeRxDSP) @@ -1134,14 +1148,18 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency + buddyNCOFreq); (*itSource)->getDeviceEngineInputMessageQueue()->push(notif); + MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( + m_settings.m_centerFrequency, + m_settings.m_devSampleRate, + m_settings.m_log2HardDecim); + if ((*itSource)->getSampleSourceGUIMessageQueue()) { - MsgReportLimeSDRToBuddy *report = MsgReportLimeSDRToBuddy::create( - m_settings.m_centerFrequency, - m_settings.m_devSampleRate, - m_settings.m_log2HardDecim); - (*itSource)->getSampleSourceGUIMessageQueue()->push(report); + MsgReportLimeSDRToBuddy *reportToGUI = new MsgReportLimeSDRToBuddy(*report); + (*itSource)->getSampleSourceGUIMessageQueue()->push(reportToGUI); } + + (*itSource)->getSampleSourceInputMessageQueue()->push(report); } } else if (forwardChangeOwnDSP) diff --git a/plugins/samplesource/limesdrinput/limesdrinput.h b/plugins/samplesource/limesdrinput/limesdrinput.h index ef6a133df..1b0b96143 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.h +++ b/plugins/samplesource/limesdrinput/limesdrinput.h @@ -52,26 +52,6 @@ public: { } }; - class MsgSetReferenceConfig : public Message { - MESSAGE_CLASS_DECLARATION - - public: - const LimeSDRInputSettings& getSettings() const { return m_settings; } - - static MsgSetReferenceConfig* create(const LimeSDRInputSettings& settings) - { - return new MsgSetReferenceConfig(settings); - } - - private: - LimeSDRInputSettings m_settings; - - MsgSetReferenceConfig(const LimeSDRInputSettings& settings) : - Message(), - m_settings(settings) - { } - }; - class MsgGetStreamInfo : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp index 7bcf83245..72dc85295 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp @@ -151,9 +151,6 @@ bool LimeSDRInputGUI::handleMessage(const Message& message) displaySettings(); blockApplySettings(false); - LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings); - m_sampleSource->getInputMessageQueue()->push(conf); // TODO: remove from here should be done device to device - return true; } else if (DeviceLimeSDRShared::MsgCrossReportToBuddy::match(message)) @@ -165,9 +162,6 @@ bool LimeSDRInputGUI::handleMessage(const Message& message) displaySettings(); blockApplySettings(false); - LimeSDRInput::MsgSetReferenceConfig* conf = LimeSDRInput::MsgSetReferenceConfig::create(m_settings); - m_sampleSource->getInputMessageQueue()->push(conf); - return true; } else if (LimeSDRInput::MsgReportStreamInfo::match(message))