LimeSDR: set buddy configuration from the source or sink and not from the GUI

This commit is contained in:
f4exb 2017-09-18 01:05:08 +02:00
parent d59d2a2372
commit b5a7a65d85
6 changed files with 74 additions and 90 deletions

View File

@ -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)

View File

@ -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

View File

@ -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))

View File

@ -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)

View File

@ -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

View File

@ -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))