diff --git a/plugins/channelmimo/interferometer/interferometer.cpp b/plugins/channelmimo/interferometer/interferometer.cpp index aa56461ba..9d90933e6 100644 --- a/plugins/channelmimo/interferometer/interferometer.cpp +++ b/plugins/channelmimo/interferometer/interferometer.cpp @@ -28,6 +28,9 @@ #include "device/deviceapi.h" #include "dsp/hbfilterchainconverter.h" #include "dsp/dspcommands.h" +#include "dsp/dspdevicesourceengine.h" +#include "dsp/devicesamplesource.h" +#include "device/deviceset.h" #include "maincore.h" #include "interferometerbaseband.h" @@ -35,6 +38,7 @@ MESSAGE_CLASS_DEFINITION(Interferometer::MsgConfigureInterferometer, Message) MESSAGE_CLASS_DEFINITION(Interferometer::MsgBasebandNotification, Message) +MESSAGE_CLASS_DEFINITION(Interferometer::MsgReportDevices, Message) const char* const Interferometer::m_channelIdURI = "sdrangel.channel.interferometer"; const char* const Interferometer::m_channelId = "Interferometer"; @@ -63,6 +67,20 @@ Interferometer::Interferometer(DeviceAPI *deviceAPI) : this, &Interferometer::networkManagerFinished ); + // Update device list when devices are added or removed + QObject::connect( + MainCore::instance(), + &MainCore::deviceSetAdded, + this, + &Interferometer::updateDeviceSetList + ); + QObject::connect( + MainCore::instance(), + &MainCore::deviceSetRemoved, + this, + &Interferometer::updateDeviceSetList + ); + updateDeviceSetList(); startSinks(); } @@ -155,62 +173,30 @@ void Interferometer::pull(SampleVector::iterator& begin, unsigned int nbSamples, (void) sourceIndex; } -void Interferometer::applySettings(const InterferometerSettings& settings, bool force) +void Interferometer::applySettings(const InterferometerSettings& settings, const QList& settingsKeys, bool force) { - qDebug() << "Interferometer::applySettings: " - << "m_correlationType: " << settings.m_correlationType - << "m_filterChainHash: " << settings.m_filterChainHash - << "m_log2Decim: " << settings.m_log2Decim - << "m_phase: " << settings.m_phase - << "m_gain: " << settings.m_gain / 10.0 - << "m_useReverseAPI: " << settings.m_useReverseAPI - << "m_reverseAPIAddress: " << settings.m_reverseAPIAddress - << "m_reverseAPIPort: " << settings.m_reverseAPIPort - << "m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex - << "m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex - << "m_title: " << settings.m_title; + qDebug() << "LocalSink::applySettings:" << settings.getDebugString(settingsKeys, force) << "force: " << force; - QList reverseAPIKeys; - - if ((m_settings.m_correlationType != settings.m_correlationType) || force) { - reverseAPIKeys.append("correlationType"); - } - if ((m_settings.m_filterChainHash != settings.m_filterChainHash) || force) { - reverseAPIKeys.append("filterChainHash"); - } - if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) { - reverseAPIKeys.append("log2Decim"); - } - if ((m_settings.m_phase != settings.m_phase) || force) { - reverseAPIKeys.append("phase"); - } - if ((m_settings.m_phase != settings.m_gain) || force) { - reverseAPIKeys.append("gain"); - } - if ((m_settings.m_title != settings.m_title) || force) { - reverseAPIKeys.append("title"); - } - - if (m_running && ((m_settings.m_log2Decim != settings.m_log2Decim) - || (m_settings.m_filterChainHash != settings.m_filterChainHash) || force)) + if (m_running && (settingsKeys.contains("log2Decim") + || settingsKeys.contains("filterChainHash") || force)) { InterferometerBaseband::MsgConfigureChannelizer *msg = InterferometerBaseband::MsgConfigureChannelizer::create( settings.m_log2Decim, settings.m_filterChainHash); m_basebandSink->getInputMessageQueue()->push(msg); } - if (m_running && ((m_settings.m_correlationType != settings.m_correlationType) || force)) + if (m_running && ((settingsKeys.contains("correlationType")) || force)) { InterferometerBaseband::MsgConfigureCorrelation *msg = InterferometerBaseband::MsgConfigureCorrelation::create( settings.m_correlationType); m_basebandSink->getInputMessageQueue()->push(msg); } - if (m_running && ((m_settings.m_phase != settings.m_phase) || force)) { + if (m_running && ((settingsKeys.contains("phase")) || force)) { m_basebandSink->setPhase(settings.m_phase); } - if (m_running && ((m_settings.m_gain != settings.m_gain) || force)) { + if (m_running && ((settingsKeys.contains("gain")) || force)) { m_basebandSink->setGain(settings.m_gain); } @@ -218,10 +204,24 @@ void Interferometer::applySettings(const InterferometerSettings& settings, bool MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes); if (pipes.size() > 0) { - sendChannelSettings(pipes, reverseAPIKeys, settings, force); + sendChannelSettings(pipes, settingsKeys, settings, force); } - m_settings = settings; + if (settings.m_useReverseAPI) + { + bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) || + settingsKeys.contains("reverseAPIAddress") || + settingsKeys.contains("reverseAPIPort") || + settingsKeys.contains("reverseAPIFeatureSetIndex") || + settingsKeys.contains("reverseAPIFeatureIndex"); + webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force); + } + + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } } void Interferometer::handleInputMessages() @@ -243,7 +243,7 @@ bool Interferometer::handleMessage(const Message& cmd) { MsgConfigureInterferometer& cfg = (MsgConfigureInterferometer&) cmd; qDebug() << "Interferometer::handleMessage: MsgConfigureInterferometer"; - applySettings(cfg.getSettings(), cfg.getForce()); + applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); return true; } else if (DSPMIMOSignalNotification::match(cmd)) @@ -298,14 +298,14 @@ bool Interferometer::deserialize(const QByteArray& data) (void) data; if (m_settings.deserialize(data)) { - MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(m_settings, true); + MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(m_settings, QList(), true); m_inputMessageQueue.push(msg); return true; } else { m_settings.resetToDefaults(); - MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(m_settings, true); + MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(m_settings, QList(), true); m_inputMessageQueue.push(msg); return false; } @@ -338,6 +338,70 @@ void Interferometer::applyChannelSettings(uint32_t log2Decim, uint32_t filterCha m_basebandSink->getInputMessageQueue()->push(msg); } +void Interferometer::updateDeviceSetList() +{ + MainCore *mainCore = MainCore::instance(); + std::vector& deviceSets = mainCore->getDeviceSets(); + std::vector::const_iterator it = deviceSets.begin(); + + m_localInputDeviceIndexes.clear(); + unsigned int deviceIndex = 0; + + for (; it != deviceSets.end(); ++it, deviceIndex++) + { + DSPDeviceSourceEngine *deviceSourceEngine = (*it)->m_deviceSourceEngine; + + if (deviceSourceEngine) + { + DeviceSampleSource *deviceSource = deviceSourceEngine->getSource(); + + if (deviceSource->getDeviceDescription() == "LocalInput") { + m_localInputDeviceIndexes.append(deviceIndex); + } + } + } + + if (m_guiMessageQueue) + { + MsgReportDevices *msg = MsgReportDevices::create(); + msg->getDeviceSetIndexes() = m_localInputDeviceIndexes; + m_guiMessageQueue->push(msg); + } + + InterferometerSettings settings = m_settings; + int newIndexInList; + + if (it != deviceSets.begin()) + { + if (m_settings.m_localDeviceIndex < 0) { + newIndexInList = 0; + } else if (m_settings.m_localDeviceIndex >= m_localInputDeviceIndexes.size()) { + newIndexInList = m_localInputDeviceIndexes.size() - 1; + } else { + newIndexInList = m_settings.m_localDeviceIndex; + } + } + else + { + newIndexInList = -1; + } + + if (newIndexInList < 0) { + settings.m_localDeviceIndex = -1; // means no device + } else { + settings.m_localDeviceIndex = m_localInputDeviceIndexes[newIndexInList]; + } + + qDebug("LocalSink::updateDeviceSetLists: new device index: %d device: %d", newIndexInList, settings.m_localDeviceIndex); + applySettings(settings, QList{"localDeviceIndex"}); + + if (m_guiMessageQueue) + { + MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(m_settings, QList{"localDeviceIndex"}, false); + m_guiMessageQueue->push(msg); + } +} + int Interferometer::webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage) @@ -368,12 +432,12 @@ int Interferometer::webapiSettingsPutPatch( InterferometerSettings settings = m_settings; webapiUpdateChannelSettings(settings, channelSettingsKeys, response); - MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(settings, force); + MsgConfigureInterferometer *msg = MsgConfigureInterferometer::create(settings, channelSettingsKeys, force); m_inputMessageQueue.push(msg); if (getMessageQueueToGUI()) // forward to GUI if any { - MsgConfigureInterferometer *msgToGUI = MsgConfigureInterferometer::create(settings, force); + MsgConfigureInterferometer *msgToGUI = MsgConfigureInterferometer::create(settings, channelSettingsKeys, force); getMessageQueueToGUI()->push(msgToGUI); } @@ -521,7 +585,7 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings } } -void Interferometer::webapiReverseSendSettings(QList& channelSettingsKeys, const InterferometerSettings& settings, bool force) +void Interferometer::webapiReverseSendSettings(const QList& channelSettingsKeys, const InterferometerSettings& settings, bool force) { SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); @@ -548,7 +612,7 @@ void Interferometer::webapiReverseSendSettings(QList& channelSettingsKe void Interferometer::sendChannelSettings( const QList& pipes, - QList& channelSettingsKeys, + const QList& channelSettingsKeys, const InterferometerSettings& settings, bool force) { @@ -572,7 +636,7 @@ void Interferometer::sendChannelSettings( } void Interferometer::webapiFormatChannelSettings( - QList& channelSettingsKeys, + const QList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings *swgChannelSettings, const InterferometerSettings& settings, bool force @@ -606,18 +670,18 @@ void Interferometer::webapiFormatChannelSettings( swgInterferometerSettings->setFilterChainHash(settings.m_filterChainHash); } - if (settings.m_spectrumGUI) + if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrumConfig") || force)) { - if (channelSettingsKeys.contains("spectrumConfig") || force) { - settings.m_spectrumGUI->formatTo(swgInterferometerSettings->getSpectrumConfig()); - } + SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); + settings.m_spectrumGUI->formatTo(swgGLSpectrum); + swgInterferometerSettings->setSpectrumConfig(swgGLSpectrum); } - if (settings.m_scopeGUI) + if (settings.m_scopeGUI && (channelSettingsKeys.contains("scopeConfig") || force)) { - if (channelSettingsKeys.contains("scopeConfig") || force) { - settings.m_scopeGUI->formatTo(swgInterferometerSettings->getScopeConfig()); - } + SWGSDRangel::SWGGLScope *swgGLScope = new SWGSDRangel::SWGGLScope(); + settings.m_scopeGUI->formatTo(swgGLScope); + swgInterferometerSettings->setScopeConfig(swgGLScope); } if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force)) diff --git a/plugins/channelmimo/interferometer/interferometer.h b/plugins/channelmimo/interferometer/interferometer.h index 0eed37d8a..63738aa3f 100644 --- a/plugins/channelmimo/interferometer/interferometer.h +++ b/plugins/channelmimo/interferometer/interferometer.h @@ -45,20 +45,23 @@ public: public: const InterferometerSettings& getSettings() const { return m_settings; } + const QList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureInterferometer* create(const InterferometerSettings& settings, bool force) + static MsgConfigureInterferometer* create(const InterferometerSettings& settings, const QList& settingsKeys, bool force) { - return new MsgConfigureInterferometer(settings, force); + return new MsgConfigureInterferometer(settings, settingsKeys, force); } private: InterferometerSettings m_settings; + QList m_settingsKeys; bool m_force; - MsgConfigureInterferometer(const InterferometerSettings& settings, bool force) : + MsgConfigureInterferometer(const InterferometerSettings& settings, const QList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -86,6 +89,24 @@ public: qint64 m_centerFrequency; }; + class MsgReportDevices : public Message { + MESSAGE_CLASS_DECLARATION + + public: + QList& getDeviceSetIndexes() { return m_deviceSetIndexes; } + + static MsgReportDevices* create() { + return new MsgReportDevices(); + } + + private: + QList m_deviceSetIndexes; + + MsgReportDevices() : + Message() + { } + }; + Interferometer(DeviceAPI *deviceAPI); virtual ~Interferometer(); virtual void destroy() { delete this; } @@ -128,6 +149,7 @@ public: SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } ScopeVis *getScopeVis() { return &m_scopeSink; } void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash); + const QList& getDeviceSetList() { return m_localInputDeviceIndexes; } virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, @@ -174,19 +196,22 @@ private: uint32_t m_deviceSampleRate; int m_count0, m_count1; + QList m_localInputDeviceIndexes; + virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed - void applySettings(const InterferometerSettings& settings, bool force = false); + void applySettings(const InterferometerSettings& settings, const QList& settingsKeys, bool force = false); static void validateFilterChainHash(InterferometerSettings& settings); void calculateFrequencyOffset(); - void webapiReverseSendSettings(QList& channelSettingsKeys, const InterferometerSettings& settings, bool force); + void updateDeviceSetList(); + void webapiReverseSendSettings(const QList& channelSettingsKeys, const InterferometerSettings& settings, bool force); void sendChannelSettings( const QList& pipes, - QList& channelSettingsKeys, + const QList& channelSettingsKeys, const InterferometerSettings& settings, bool force ); void webapiFormatChannelSettings( - QList& channelSettingsKeys, + const QList& channelSettingsKeys, SWGSDRangel::SWGChannelSettings *swgChannelSettings, const InterferometerSettings& settings, bool force diff --git a/plugins/channelmimo/interferometer/interferometergui.cpp b/plugins/channelmimo/interferometer/interferometergui.cpp index faff6c994..ec467d1e7 100644 --- a/plugins/channelmimo/interferometer/interferometergui.cpp +++ b/plugins/channelmimo/interferometer/interferometergui.cpp @@ -86,14 +86,26 @@ bool InterferometerGUI::handleMessage(const Message& message) } else if (Interferometer::MsgConfigureInterferometer::match(message)) { - const Interferometer::MsgConfigureInterferometer& notif = (const Interferometer::MsgConfigureInterferometer&) message; - m_settings = notif.getSettings(); + const Interferometer::MsgConfigureInterferometer& cfg = (const Interferometer::MsgConfigureInterferometer&) message; + + if (cfg.getForce()) { + m_settings = cfg.getSettings(); + } else { + m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings()); + } + ui->scopeGUI->updateSettings(); ui->spectrumGUI->updateSettings(); m_channelMarker.updateSettings(static_cast(m_settings.m_channelMarker)); displaySettings(); return true; } + else if (Interferometer::MsgReportDevices::match(message)) + { + Interferometer::MsgReportDevices& report = (Interferometer::MsgReportDevices&) message; + updateDeviceSetList(report.getDeviceSetIndexes()); + return true; + } else { return false; @@ -165,6 +177,7 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); + updateDeviceSetList(m_interferometer->getDeviceSetList()); displaySettings(); makeUIConnections(); displayRateAndShift(); @@ -188,9 +201,11 @@ void InterferometerGUI::applySettings(bool force) { setTitleColor(m_channelMarker.getColor()); - Interferometer::MsgConfigureInterferometer* message = Interferometer::MsgConfigureInterferometer::create(m_settings, force); + Interferometer::MsgConfigureInterferometer* message = Interferometer::MsgConfigureInterferometer::create(m_settings, m_settingsKeys, force); m_interferometer->getInputMessageQueue()->push(message); } + + m_settingsKeys.clear(); } void InterferometerGUI::displaySettings() @@ -294,27 +309,53 @@ void InterferometerGUI::onMenuDialogCalled(const QPoint &p) setTitle(m_channelMarker.getTitle()); setTitleColor(m_settings.m_rgbColor); + m_settingsKeys.append("title"); + m_settingsKeys.append("rgbColor"); + m_settingsKeys.append("useReverseAPI"); + m_settingsKeys.append("reverseAPIAddress"); + m_settingsKeys.append("reverseAPIPort"); + m_settingsKeys.append("reverseAPIFeatureSetIndex"); + m_settingsKeys.append("reverseAPIFeatureIndex"); + applySettings(); } resetContextMenuType(); } +void InterferometerGUI::updateDeviceSetList(const QList& deviceSetIndexes) +{ + QList::const_iterator it = deviceSetIndexes.begin(); + + ui->localDevice->blockSignals(true); + + ui->localDevice->clear(); + + for (; it != deviceSetIndexes.end(); ++it) { + ui->localDevice->addItem(QString("R%1").arg(*it), *it); + } + + ui->localDevice->blockSignals(false); +} + void InterferometerGUI::on_decimationFactor_currentIndexChanged(int index) { m_settings.m_log2Decim = index; + m_settingsKeys.append("log2Decim"); applyDecimation(); } void InterferometerGUI::on_position_valueChanged(int value) { m_settings.m_filterChainHash = value; + m_settingsKeys.append("filterChainHash"); applyPosition(); } void InterferometerGUI::on_phaseCorrection_valueChanged(int value) { m_settings.m_phase = value; + m_settingsKeys.append("phase"); ui->phaseCorrectionText->setText(tr("%1").arg(value)); applySettings(); } @@ -322,6 +363,7 @@ void InterferometerGUI::on_phaseCorrection_valueChanged(int value) void InterferometerGUI::on_gain_valueChanged(int value) { m_settings.m_gain = value; + m_settingsKeys.append("gain"); ui->gainText->setText(QString("%1").arg(m_settings.m_gain / 10.0, 0, 'f', 1)); applySettings(); } @@ -341,6 +383,7 @@ void InterferometerGUI::on_gainLabel_clicked() void InterferometerGUI::on_correlationType_currentIndexChanged(int index) { m_settings.m_correlationType = (InterferometerSettings::CorrelationType) index; + m_settingsKeys.append("correlationType"); applySettings(); } @@ -355,6 +398,7 @@ void InterferometerGUI::applyDecimation() ui->position->setMaximum(maxHash-1); ui->position->setValue(m_settings.m_filterChainHash); m_settings.m_filterChainHash = ui->position->value(); + m_settingsKeys.append("filterChainHash"); applyPosition(); } diff --git a/plugins/channelmimo/interferometer/interferometergui.h b/plugins/channelmimo/interferometer/interferometergui.h index 0662d8e71..d95072148 100644 --- a/plugins/channelmimo/interferometer/interferometergui.h +++ b/plugins/channelmimo/interferometer/interferometergui.h @@ -70,6 +70,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; InterferometerSettings m_settings; + QList m_settingsKeys; int m_sampleRate; qint64 m_centerFrequency; double m_shiftFrequencyFactor; //!< Channel frequency shift factor @@ -93,6 +94,7 @@ private: bool handleMessage(const Message& message); void makeUIConnections(); void updateAbsoluteCenterFrequency(); + void updateDeviceSetList(const QList& deviceSetIndexes); void leaveEvent(QEvent*); void enterEvent(EnterEventType*); diff --git a/plugins/channelmimo/interferometer/interferometergui.ui b/plugins/channelmimo/interferometer/interferometergui.ui index f9e9927a0..3d0b1107b 100644 --- a/plugins/channelmimo/interferometer/interferometergui.ui +++ b/plugins/channelmimo/interferometer/interferometergui.ui @@ -416,6 +416,60 @@ + + + + Qt::Vertical + + + + + + + Device + + + + + + + + 50 + 0 + + + + + 50 + 16777215 + + + + Local input device deviceset index + + + + + + + + 24 + 24 + + + + Start/Stop sending IQ to local input device + + + + + + + :/play.png + :/pause.png:/play.png + + + @@ -588,6 +642,11 @@
gui/glscopegui.h
1 + + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
ClickableLabel QLabel diff --git a/plugins/channelmimo/interferometer/interferometersettings.cpp b/plugins/channelmimo/interferometer/interferometersettings.cpp index 0102d2957..68bd6e9de 100644 --- a/plugins/channelmimo/interferometer/interferometersettings.cpp +++ b/plugins/channelmimo/interferometer/interferometersettings.cpp @@ -41,6 +41,7 @@ void InterferometerSettings::resetToDefaults() m_filterChainHash = 0; m_phase = 0; m_gain = 0; + m_localDeviceIndex = -1; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; m_reverseAPIDeviceIndex = 0; @@ -68,6 +69,7 @@ QByteArray InterferometerSettings::serialize() const s.writeBlob(14, m_geometryBytes); s.writeBool(15, m_hidden); s.writeS32(16, m_gain); + s.writeS32(17, m_localDeviceIndex); if (m_spectrumGUI) { s.writeBlob(20, m_spectrumGUI->serialize()); @@ -128,6 +130,7 @@ bool InterferometerSettings::deserialize(const QByteArray& data) d.readBlob(14, &m_geometryBytes); d.readBool(15, &m_hidden, false); d.readS32(16, &m_gain, 0); + d.readS32(17, &m_localDeviceIndex, -1); if (m_spectrumGUI) { @@ -161,3 +164,99 @@ bool InterferometerSettings::deserialize(const QByteArray& data) return false; } } + +void InterferometerSettings::applySettings(const QStringList& settingsKeys, const InterferometerSettings& settings) +{ + if (settingsKeys.contains("correlationType")) { + m_correlationType = settings.m_correlationType; + } + if (settingsKeys.contains("rgbColor")) { + m_rgbColor = settings.m_rgbColor; + } + if (settingsKeys.contains("title")) { + m_title = settings.m_title; + } + if (settingsKeys.contains("log2Decim")) { + m_log2Decim = settings.m_log2Decim; + } + if (settingsKeys.contains("filterChainHash")) { + m_filterChainHash = settings.m_filterChainHash; + } + if (settingsKeys.contains("phase")) { + m_phase = settings.m_phase; + } + if (settingsKeys.contains("gain")) { + m_gain = settings.m_gain; + } + if (settingsKeys.contains("localDeviceIndex")) { + m_localDeviceIndex = settings.m_localDeviceIndex; + } + if (settingsKeys.contains("reverseAPIAddress")) { + m_reverseAPIAddress = settings.m_reverseAPIAddress; + } + if (settingsKeys.contains("reverseAPIPort")) { + m_reverseAPIPort = settings.m_reverseAPIPort; + } + if (settingsKeys.contains("reverseAPIDeviceIndex")) { + m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex; + } + if (settingsKeys.contains("reverseAPIChannelIndex")) { + m_reverseAPIChannelIndex = settings.m_reverseAPIChannelIndex; + } + if (settingsKeys.contains("workspaceIndex")) { + m_workspaceIndex = settings.m_workspaceIndex; + } + if (settingsKeys.contains("hidden")) { + m_hidden = settings.m_hidden; + } +} + +QString InterferometerSettings::getDebugString(const QStringList& settingsKeys, bool force) const +{ + std::ostringstream ostr; + + if (settingsKeys.contains("correlationType")) { + ostr << " m_correlationType: " << m_correlationType; + } + if (settingsKeys.contains("rgbColor")) { + ostr << " m_rgbColor: " << m_rgbColor; + } + if (settingsKeys.contains("title")) { + ostr << " m_title: " << m_title.toStdString(); + } + if (settingsKeys.contains("log2Decim")) { + ostr << " m_log2Decim: " << m_log2Decim; + } + if (settingsKeys.contains("filterChainHash")) { + ostr << " m_filterChainHash: " << m_filterChainHash; + } + if (settingsKeys.contains("phase")) { + ostr << " m_phase: " << m_phase; + } + if (settingsKeys.contains("gain")) { + ostr << " m_gain: " << m_gain; + } + if (settingsKeys.contains("localDeviceIndex")) { + ostr << " m_localDeviceIndex: " << m_localDeviceIndex; + } + if (settingsKeys.contains("reverseAPIAddress")) { + ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString(); + } + if (settingsKeys.contains("reverseAPIPort")) { + ostr << " m_reverseAPIPort: " << m_reverseAPIPort; + } + if (settingsKeys.contains("reverseAPIDeviceIndex")) { + ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex; + } + if (settingsKeys.contains("reverseAPIChannelIndex")) { + ostr << " m_reverseAPIChannelIndex: " << m_reverseAPIChannelIndex; + } + if (settingsKeys.contains("workspaceIndex")) { + ostr << " m_workspaceIndex: " << m_workspaceIndex; + } + if (settingsKeys.contains("hidden")) { + ostr << " m_hidden: " << m_hidden; + } + + return QString(ostr.str().c_str()); +} diff --git a/plugins/channelmimo/interferometer/interferometersettings.h b/plugins/channelmimo/interferometer/interferometersettings.h index 5df39261e..68b8789de 100644 --- a/plugins/channelmimo/interferometer/interferometersettings.h +++ b/plugins/channelmimo/interferometer/interferometersettings.h @@ -47,6 +47,7 @@ struct InterferometerSettings uint32_t m_filterChainHash; int m_phase; int m_gain; + int m_localDeviceIndex; bool m_useReverseAPI; QString m_reverseAPIAddress; uint16_t m_reverseAPIPort; @@ -69,6 +70,8 @@ struct InterferometerSettings void setScopeGUI(Serializable *scopeGUI) { m_scopeGUI = scopeGUI; } QByteArray serialize() const; bool deserialize(const QByteArray& data); + void applySettings(const QStringList& settingsKeys, const InterferometerSettings& settings); + QString getDebugString(const QStringList& settingsKeys, bool force=false) const; }; #endif // INCLUDE_INTERFEROMETERSETTINGS_H