diff --git a/plugins/samplesource/fcdproplus/fcdproplusgui.cpp b/plugins/samplesource/fcdproplus/fcdproplusgui.cpp index 87af8db2d..aed9efbeb 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusgui.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusgui.cpp @@ -94,6 +94,7 @@ void FCDProPlusGui::resetToDefaults() { m_settings.resetToDefaults(); displaySettings(); + m_forceSettings = true; sendSettings(); } @@ -129,7 +130,13 @@ bool FCDProPlusGui::handleMessage(const Message& message) if (FCDProPlusInput::MsgConfigureFCDProPlus::match(message)) { const FCDProPlusInput::MsgConfigureFCDProPlus& cfg = (FCDProPlusInput::MsgConfigureFCDProPlus&) message; - m_settings = cfg.getSettings(); + + if (cfg.getForce()) { + m_settings = cfg.getSettings(); + } else { + m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings()); + } + blockApplySettings(true); displaySettings(); blockApplySettings(false); @@ -236,6 +243,7 @@ void FCDProPlusGui::sendSettings() void FCDProPlusGui::on_centerFrequency_changed(quint64 value) { m_settings.m_centerFrequency = value * 1000; + m_settingsKeys.append("centerFrequency"); sendSettings(); } @@ -246,6 +254,7 @@ void FCDProPlusGui::on_decim_currentIndexChanged(int index) } m_settings.m_log2Decim = index; + m_settingsKeys.append("log2Decim"); sendSettings(); } @@ -253,12 +262,15 @@ void FCDProPlusGui::on_fcPos_currentIndexChanged(int index) { if (index == 0) { m_settings.m_fcPos = FCDProPlusSettings::FC_POS_INFRA; + m_settingsKeys.append("fcPos"); sendSettings(); } else if (index == 1) { m_settings.m_fcPos = FCDProPlusSettings::FC_POS_SUPRA; + m_settingsKeys.append("fcPos"); sendSettings(); } else if (index == 2) { m_settings.m_fcPos = FCDProPlusSettings::FC_POS_CENTER; + m_settingsKeys.append("fcPos"); sendSettings(); } } @@ -266,20 +278,23 @@ void FCDProPlusGui::on_fcPos_currentIndexChanged(int index) void FCDProPlusGui::on_dcOffset_toggled(bool checked) { m_settings.m_dcBlock = checked; + m_settingsKeys.append("dcBlock"); sendSettings(); } void FCDProPlusGui::on_iqImbalance_toggled(bool checked) { m_settings.m_iqImbalance = checked; + m_settingsKeys.append("iqImbalance"); sendSettings(); } void FCDProPlusGui::updateHardware() { - FCDProPlusInput::MsgConfigureFCDProPlus* message = FCDProPlusInput::MsgConfigureFCDProPlus::create(m_settings, m_forceSettings); + FCDProPlusInput::MsgConfigureFCDProPlus* message = FCDProPlusInput::MsgConfigureFCDProPlus::create(m_settings, m_settingsKeys, m_forceSettings); m_sampleSource->getInputMessageQueue()->push(message); m_forceSettings = false; + m_settingsKeys.clear(); m_updateTimer.stop(); } @@ -315,30 +330,35 @@ void FCDProPlusGui::updateStatus() void FCDProPlusGui::on_checkBoxG_stateChanged(int state) { m_settings.m_lnaGain = (state == Qt::Checked); + m_settingsKeys.append("lnaGain"); sendSettings(); } void FCDProPlusGui::on_checkBoxB_stateChanged(int state) { m_settings.m_biasT = (state == Qt::Checked); + m_settingsKeys.append("biasT"); sendSettings(); } void FCDProPlusGui::on_mixGain_stateChanged(int state) { m_settings.m_mixGain = (state == Qt::Checked); + m_settingsKeys.append("mixGain"); sendSettings(); } void FCDProPlusGui::on_filterIF_currentIndexChanged(int index) { m_settings.m_ifFilterIndex = index; + m_settingsKeys.append("ifFilterIndex"); sendSettings(); } void FCDProPlusGui::on_filterRF_currentIndexChanged(int index) { m_settings.m_rfFilterIndex = index; + m_settingsKeys.append("rfFilterIndex"); sendSettings(); } @@ -346,6 +366,7 @@ void FCDProPlusGui::on_ifGain_valueChanged(int value) { m_settings.m_ifGain = value; displaySettings(); + m_settingsKeys.append("ifGain"); sendSettings(); } @@ -353,6 +374,7 @@ void FCDProPlusGui::on_ppm_valueChanged(int value) { m_settings.m_LOppmTenths = value; displaySettings(); + m_settingsKeys.append("LOppmTenths"); sendSettings(); } @@ -370,6 +392,10 @@ void FCDProPlusGui::on_transverter_clicked() qDebug("FCDProPlusGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off"); updateFrequencyLimits(); m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000; + m_settingsKeys.append("transverterMode"); + m_settingsKeys.append("transverterDeltaFrequency"); + m_settingsKeys.append("iqOrder"); + m_settingsKeys.append("centerFrequency"); sendSettings(); } @@ -390,6 +416,10 @@ void FCDProPlusGui::openDeviceSettingsDialog(const QPoint& p) m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex(); + m_settingsKeys.append("useReverseAPI"); + m_settingsKeys.append("reverseAPIAddress"); + m_settingsKeys.append("reverseAPIPort"); + m_settingsKeys.append("reverseAPIDeviceIndex"); sendSettings(); } diff --git a/plugins/samplesource/fcdproplus/fcdproplusgui.h b/plugins/samplesource/fcdproplus/fcdproplusgui.h index 9cbae0f75..a0226de56 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusgui.h +++ b/plugins/samplesource/fcdproplus/fcdproplusgui.h @@ -51,6 +51,7 @@ private: bool m_doApplySettings; bool m_forceSettings; FCDProPlusSettings m_settings; + QList m_settingsKeys; QTimer m_updateTimer; QTimer m_statusTimer; std::vector m_gains; diff --git a/plugins/samplesource/fcdproplus/fcdproplusinput.cpp b/plugins/samplesource/fcdproplus/fcdproplusinput.cpp index de4d80fd4..a77bb1401 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusinput.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusinput.cpp @@ -111,7 +111,7 @@ bool FCDProPlusInput::openDevice() void FCDProPlusInput::init() { - applySettings(m_settings, true); + applySettings(m_settings, QList(), true); } bool FCDProPlusInput::start() @@ -148,7 +148,7 @@ bool FCDProPlusInput::start() m_FCDThread->startWork(); // mutexLocker.unlock(); - applySettings(m_settings, true); + applySettings(m_settings, QList(), true); qDebug("FCDProPlusInput::started"); m_running = true; @@ -227,12 +227,12 @@ bool FCDProPlusInput::deserialize(const QByteArray& data) success = false; } - MsgConfigureFCDProPlus* message = MsgConfigureFCDProPlus::create(m_settings, true); + MsgConfigureFCDProPlus* message = MsgConfigureFCDProPlus::create(m_settings, QList(), true); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureFCDProPlus* messageToGUI = MsgConfigureFCDProPlus::create(m_settings, true); + MsgConfigureFCDProPlus* messageToGUI = MsgConfigureFCDProPlus::create(m_settings, QList(), true); m_guiMessageQueue->push(messageToGUI); } @@ -259,12 +259,12 @@ void FCDProPlusInput::setCenterFrequency(qint64 centerFrequency) FCDProPlusSettings settings = m_settings; settings.m_centerFrequency = centerFrequency; - MsgConfigureFCDProPlus* message = MsgConfigureFCDProPlus::create(settings, false); + MsgConfigureFCDProPlus* message = MsgConfigureFCDProPlus::create(settings, QList{"centerFrequency"}, false); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureFCDProPlus* messageToGUI = MsgConfigureFCDProPlus::create(settings, false); + MsgConfigureFCDProPlus* messageToGUI = MsgConfigureFCDProPlus::create(settings, QList{"centerFrequency"}, false); m_guiMessageQueue->push(messageToGUI); } } @@ -275,7 +275,7 @@ bool FCDProPlusInput::handleMessage(const Message& message) { qDebug() << "FCDProPlusInput::handleMessage: MsgConfigureFCD"; MsgConfigureFCDProPlus& conf = (MsgConfigureFCDProPlus&) message; - applySettings(conf.getSettings(), conf.getForce()); + applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce()); return true; } else if (MsgStartStop::match(message)) @@ -285,8 +285,7 @@ bool FCDProPlusInput::handleMessage(const Message& message) if (cmd.getStartStop()) { - if (m_deviceAPI->initDeviceEngine()) - { + if (m_deviceAPI->initDeviceEngine()) { m_deviceAPI->startDeviceEngine(); } } @@ -307,30 +306,17 @@ bool FCDProPlusInput::handleMessage(const Message& message) } } -void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool force) +void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, const QList& settingsKeys, bool force) { + qDebug() << "FCDProPlusInput::applySettings: force: " << force << settings.getDebugString(settingsKeys, force); bool forwardChange = false; - QList reverseAPIKeys; - if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) { - reverseAPIKeys.append("centerFrequency"); - } - if (force || (m_settings.m_transverterMode != settings.m_transverterMode)) { - reverseAPIKeys.append("transverterMode"); - } - if (force || (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)) { - reverseAPIKeys.append("transverterDeltaFrequency"); - } - if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) { - reverseAPIKeys.append("LOppmTenths"); - } - - if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) - || (m_settings.m_LOppmTenths != settings.m_LOppmTenths) - || (m_settings.m_fcPos != settings.m_fcPos) - || (m_settings.m_log2Decim != settings.m_log2Decim) - || (m_settings.m_transverterMode != settings.m_transverterMode) - || (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)) + if (force || settingsKeys.contains("centerFrequency") + || settingsKeys.contains("LOppmTenths") + || settingsKeys.contains("fcPos") + || settingsKeys.contains("log2Decim") + || settingsKeys.contains("transverterMode") + || settingsKeys.contains("transverterDeltaFrequency")) { qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency( settings.m_centerFrequency, @@ -353,9 +339,8 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for m_settings.m_centerFrequency = settings.m_centerFrequency; } - if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) + if (settingsKeys.contains("log2Decim") || force) { - reverseAPIKeys.append("log2Decim"); forwardChange = true; if (m_FCDThread) @@ -365,10 +350,8 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for } } - if ((m_settings.m_fcPos != settings.m_fcPos) || force) + if (settingsKeys.contains("fcPos") || force) { - reverseAPIKeys.append("fcPos"); - if (m_FCDThread) { m_FCDThread->setFcPos((int) settings.m_fcPos); } @@ -376,10 +359,8 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for qDebug() << "FCDProPlusInput::applySettings: set fc pos (enum) to " << (int) settings.m_fcPos; } - if ((m_settings.m_iqOrder != settings.m_iqOrder) || force) + if (settingsKeys.contains("iqOrder") || force) { - reverseAPIKeys.append("iqOrder"); - if (m_FCDThread) { m_FCDThread->setIQOrder((int) settings.m_iqOrder); } @@ -387,82 +368,72 @@ void FCDProPlusInput::applySettings(const FCDProPlusSettings& settings, bool for qDebug() << "FCDProPlusInput::applySettings: set IQ order to %s" << (settings.m_iqOrder ? "IQ" : "QI"); } - if ((m_settings.m_lnaGain != settings.m_lnaGain) || force) + if (settingsKeys.contains("lnaGain") || force) { - reverseAPIKeys.append("lnaGain"); - if (m_dev != 0) { set_lna_gain(settings.m_lnaGain); } } - if ((m_settings.m_biasT != settings.m_biasT) || force) + if (settingsKeys.contains("biasT") || force) { - reverseAPIKeys.append("biasT"); - if (m_dev != 0) { set_bias_t(settings.m_biasT); } } - if ((m_settings.m_mixGain != settings.m_mixGain) || force) + if (settingsKeys.contains("mixGain") || force) { - reverseAPIKeys.append("mixGain"); - if (m_dev != 0) { set_mixer_gain(settings.m_mixGain); } } - if ((m_settings.m_ifGain != settings.m_ifGain) || force) + if (settingsKeys.contains("ifGain") || force) { - reverseAPIKeys.append("ifGain"); - if (m_dev != 0) { set_if_gain(settings.m_ifGain); } } - if ((m_settings.m_ifFilterIndex != settings.m_ifFilterIndex) || force) + if (settingsKeys.contains("ifFilterIndex") || force) { - reverseAPIKeys.append("ifFilterIndex"); - if (m_dev != 0) { set_if_filter(settings.m_ifFilterIndex); } } - if ((m_settings.m_rfFilterIndex != settings.m_rfFilterIndex) || force) + if (settingsKeys.contains("rfFilterIndex") || force) { - reverseAPIKeys.append("rfFilterIndex"); - if (m_dev != 0) { set_rf_filter(settings.m_rfFilterIndex); } } - if ((m_settings.m_dcBlock != settings.m_dcBlock) || force) + if (settingsKeys.contains("dcBlock") || force) { - reverseAPIKeys.append("dcBlock"); m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqImbalance); } - if ((m_settings.m_iqImbalance != settings.m_iqImbalance) || force) + if (settingsKeys.contains("iqImbalance") || force) { - reverseAPIKeys.append("iqImbalance"); m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqImbalance); } - if (settings.m_useReverseAPI) + if (settingsKeys.contains("useReverseAPI")) { - bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) || - (m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) || - (m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) || - (m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex); - webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force); + bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) || + settingsKeys.contains("reverseAPIAddress") || + settingsKeys.contains("reverseAPIPort") || + settingsKeys.contains("reverseAPIDeviceIndex"); + webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force); } - m_settings = settings; + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } if (forwardChange) { @@ -504,30 +475,26 @@ void FCDProPlusInput::set_mixer_gain(bool on) void FCDProPlusInput::set_if_gain(int gain) { - if (gain < 0) - { + if (gain < 0) { return; } quint8 cmd_value = gain; - if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_IF_GAIN, &cmd_value, 1) != FCD_MODE_APP) - { + if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_IF_GAIN, &cmd_value, 1) != FCD_MODE_APP) { qWarning() << "FCDProPlusInput::set_if_gain: failed to set at " << cmd_value; } } void FCDProPlusInput::set_if_filter(int filterIndex) { - if ((filterIndex < 0) || (filterIndex >= FCDProPlusConstants::fcdproplus_if_filter_nb_values())) - { + if ((filterIndex < 0) || (filterIndex >= FCDProPlusConstants::fcdproplus_if_filter_nb_values())) { return; } quint8 cmd_value = FCDProPlusConstants::if_filters[filterIndex].value; - if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_IF_FILTER, &cmd_value, 1) != FCD_MODE_APP) - { + if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_IF_FILTER, &cmd_value, 1) != FCD_MODE_APP) { qWarning() << "FCDProPlusInput::set_if_filter: failed to set at " << cmd_value; } } @@ -535,15 +502,13 @@ void FCDProPlusInput::set_if_filter(int filterIndex) void FCDProPlusInput::set_rf_filter(int filterIndex) { - if ((filterIndex < 0) || (filterIndex >= FCDProPlusConstants::fcdproplus_rf_filter_nb_values())) - { + if ((filterIndex < 0) || (filterIndex >= FCDProPlusConstants::fcdproplus_rf_filter_nb_values())) { return; } quint8 cmd_value = FCDProPlusConstants::rf_filters[filterIndex].value; - if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_RF_FILTER, &cmd_value, 1) != FCD_MODE_APP) - { + if (fcdAppSetParam(m_dev, FCDPROPLUS_HID_CMD_SET_RF_FILTER, &cmd_value, 1) != FCD_MODE_APP) { qWarning() << "FCDProPlusInput::set_rf_filter: failed to set at " << cmd_value; } } @@ -597,12 +562,12 @@ int FCDProPlusInput::webapiSettingsPutPatch( FCDProPlusSettings settings = m_settings; webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response); - MsgConfigureFCDProPlus *msg = MsgConfigureFCDProPlus::create(settings, force); + MsgConfigureFCDProPlus *msg = MsgConfigureFCDProPlus::create(settings, deviceSettingsKeys, force); m_inputMessageQueue.push(msg); if (m_guiMessageQueue) // forward to GUI if any { - MsgConfigureFCDProPlus *msgToGUI = MsgConfigureFCDProPlus::create(settings, force); + MsgConfigureFCDProPlus *msgToGUI = MsgConfigureFCDProPlus::create(settings, deviceSettingsKeys, force); m_guiMessageQueue->push(msgToGUI); } @@ -708,7 +673,7 @@ void FCDProPlusInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response.getFcdProPlusSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); } -void FCDProPlusInput::webapiReverseSendSettings(QList& deviceSettingsKeys, const FCDProPlusSettings& settings, bool force) +void FCDProPlusInput::webapiReverseSendSettings(const QList& deviceSettingsKeys, const FCDProPlusSettings& settings, bool force) { SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); swgDeviceSettings->setDirection(0); // single Rx diff --git a/plugins/samplesource/fcdproplus/fcdproplusinput.h b/plugins/samplesource/fcdproplus/fcdproplusinput.h index fa7c742cf..034069435 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusinput.h +++ b/plugins/samplesource/fcdproplus/fcdproplusinput.h @@ -49,20 +49,23 @@ public: public: const FCDProPlusSettings& getSettings() const { return m_settings; } + const QList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureFCDProPlus* create(const FCDProPlusSettings& settings, bool force) + static MsgConfigureFCDProPlus* create(const FCDProPlusSettings& settings, const QList& settingsKeys, bool force) { - return new MsgConfigureFCDProPlus(settings, force); + return new MsgConfigureFCDProPlus(settings, settingsKeys, force); } private: FCDProPlusSettings m_settings; + QList m_settingsKeys; bool m_force; - MsgConfigureFCDProPlus(const FCDProPlusSettings& settings, bool force) : + MsgConfigureFCDProPlus(const FCDProPlusSettings& settings, const QList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -159,8 +162,8 @@ private: void closeDevice(); bool openFCDAudio(const char *filename); void closeFCDAudio(); - void applySettings(const FCDProPlusSettings& settings, bool force); - void webapiReverseSendSettings(QList& deviceSettingsKeys, const FCDProPlusSettings& settings, bool force); + void applySettings(const FCDProPlusSettings& settings, const QList& settingsKeys, bool force); + void webapiReverseSendSettings(const QList& deviceSettingsKeys, const FCDProPlusSettings& settings, bool force); void webapiReverseSendStartStop(bool start); private slots: diff --git a/plugins/samplesource/fcdproplus/fcdproplussettings.cpp b/plugins/samplesource/fcdproplus/fcdproplussettings.cpp index aaa302934..6515bb6a9 100644 --- a/plugins/samplesource/fcdproplus/fcdproplussettings.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplussettings.cpp @@ -126,3 +126,137 @@ bool FCDProPlusSettings::deserialize(const QByteArray& data) } } +void FCDProPlusSettings::applySettings(const QStringList& settingsKeys, const FCDProPlusSettings& settings) +{ + if (settingsKeys.contains("centerFrequency")) { + m_centerFrequency = settings.m_centerFrequency; + } + if (settingsKeys.contains("rangeLow")) { + m_rangeLow = settings.m_rangeLow; + } + if (settingsKeys.contains("lnaGain")) { + m_lnaGain = settings.m_lnaGain; + } + if (settingsKeys.contains("biasT")) { + m_biasT = settings.m_biasT; + } + if (settingsKeys.contains("ifGain")) { + m_ifGain = settings.m_ifGain; + } + if (settingsKeys.contains("mixGain")) { + m_mixGain = settings.m_mixGain; + } + if (settingsKeys.contains("rfFilterIndex")) { + m_rfFilterIndex = settings.m_rfFilterIndex; + } + if (settingsKeys.contains("ifFilterIndex")) { + m_ifFilterIndex = settings.m_ifFilterIndex; + } + if (settingsKeys.contains("LOppmTenths")) { + m_LOppmTenths = settings.m_LOppmTenths; + } + if (settingsKeys.contains("log2Decim")) { + m_log2Decim = settings.m_log2Decim; + } + if (settingsKeys.contains("fcPos")) { + m_fcPos = settings.m_fcPos; + } + if (settingsKeys.contains("dcBlock")) { + m_dcBlock = settings.m_dcBlock; + } + if (settingsKeys.contains("iqImbalance")) { + m_iqImbalance = settings.m_iqImbalance; + } + if (settingsKeys.contains("centerFrequency")) { + m_centerFrequency = settings.m_centerFrequency; + } + if (settingsKeys.contains("transverterMode")) { + m_transverterMode = settings.m_transverterMode; + } + if (settingsKeys.contains("transverterDeltaFrequency")) { + m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency; + } + if (settingsKeys.contains("iqOrder")) { + m_iqOrder = settings.m_iqOrder; + } + if (settingsKeys.contains("useReverseAPI")) { + m_useReverseAPI = settings.m_useReverseAPI; + } + 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; + } +} + +QString FCDProPlusSettings::getDebugString(const QStringList& settingsKeys, bool force) const +{ + std::ostringstream ostr; + + if (settingsKeys.contains("centerFrequency") || force) { + ostr << " m_centerFrequency: " << m_centerFrequency; + } + if (settingsKeys.contains("rangeLow") || force) { + ostr << " m_rangeLow: " << m_rangeLow; + } + if (settingsKeys.contains("lnaGain") || force) { + ostr << " m_lnaGain: " << m_lnaGain; + } + if (settingsKeys.contains("biasT") || force) { + ostr << " m_biasT: " << m_biasT; + } + if (settingsKeys.contains("ifGain") || force) { + ostr << " m_ifGain: " << m_ifGain; + } + if (settingsKeys.contains("mixGain") || force) { + ostr << " m_mixGain: " << m_mixGain; + } + if (settingsKeys.contains("rfFilterIndex") || force) { + ostr << " m_rfFilterIndex: " << m_rfFilterIndex; + } + if (settingsKeys.contains("ifFilterIndex") || force) { + ostr << " m_ifFilterIndex: " << m_ifFilterIndex; + } + if (settingsKeys.contains("LOppmTenths") || force) { + ostr << " m_LOppmTenths: " << m_LOppmTenths; + } + if (settingsKeys.contains("log2Decim") || force) { + ostr << " m_log2Decim: " << m_log2Decim; + } + if (settingsKeys.contains("fcPos") || force) { + ostr << " m_fcPos: " << m_fcPos; + } + if (settingsKeys.contains("dcBlock") || force) { + ostr << " m_dcBlock: " << m_dcBlock; + } + if (settingsKeys.contains("iqImbalance") || force) { + ostr << " m_iqImbalance: " << m_iqImbalance; + } + if (settingsKeys.contains("transverterMode") || force) { + ostr << " m_transverterMode: " << m_transverterMode; + } + if (settingsKeys.contains("transverterDeltaFrequency") || force) { + ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency; + } + if (settingsKeys.contains("iqOrder") || force) { + ostr << " m_iqOrder: " << m_iqOrder; + } + if (settingsKeys.contains("useReverseAPI") || force) { + ostr << " m_useReverseAPI: " << m_useReverseAPI; + } + if (settingsKeys.contains("reverseAPIAddress") || force) { + ostr << " m_reverseAPIAddress: " << m_reverseAPIAddress.toStdString(); + } + if (settingsKeys.contains("reverseAPIPort") || force) { + ostr << " m_reverseAPIPort: " << m_reverseAPIPort; + } + if (settingsKeys.contains("reverseAPIDeviceIndex") || force) { + ostr << " m_reverseAPIDeviceIndex: " << m_reverseAPIDeviceIndex; + } + + return QString(ostr.str().c_str()); +} diff --git a/plugins/samplesource/fcdproplus/fcdproplussettings.h b/plugins/samplesource/fcdproplus/fcdproplussettings.h index ed5bf7401..9886bb0b9 100644 --- a/plugins/samplesource/fcdproplus/fcdproplussettings.h +++ b/plugins/samplesource/fcdproplus/fcdproplussettings.h @@ -52,6 +52,8 @@ struct FCDProPlusSettings { void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); + void applySettings(const QStringList& settingsKeys, const FCDProPlusSettings& settings); + QString getDebugString(const QStringList& settingsKeys, bool force=false) const; }; #endif /* _FCDPROPLUS_FCDPROPLUSSETTINGS_H_ */