diff --git a/plugins/samplesource/testsource/testsourcegui.cpp b/plugins/samplesource/testsource/testsourcegui.cpp index a3f453e1b..0cfb4e202 100644 --- a/plugins/samplesource/testsource/testsourcegui.cpp +++ b/plugins/samplesource/testsource/testsourcegui.cpp @@ -95,6 +95,7 @@ void TestSourceGui::resetToDefaults() { m_settings.resetToDefaults(); displaySettings(); + m_forceSettings = true; sendSettings(); } @@ -105,12 +106,15 @@ QByteArray TestSourceGui::serialize() const bool TestSourceGui::deserialize(const QByteArray& data) { - if(m_settings.deserialize(data)) { + if (m_settings.deserialize(data)) + { displaySettings(); m_forceSettings = true; sendSettings(); return true; - } else { + } + else + { resetToDefaults(); return false; } @@ -134,6 +138,7 @@ void TestSourceGui::on_startStop_toggled(bool checked) void TestSourceGui::on_centerFrequency_changed(quint64 value) { m_settings.m_centerFrequency = value * 1000; + m_settingsKeys.append("centerFrequency"); sendSettings(); } @@ -144,12 +149,14 @@ void TestSourceGui::on_autoCorr_currentIndexChanged(int index) } m_settings.m_autoCorrOptions = (TestSourceSettings::AutoCorrOptions) index; + m_settingsKeys.append("autoCorrOptions"); sendSettings(); } void TestSourceGui::on_frequencyShift_changed(qint64 value) { m_settings.m_frequencyShift = value; + m_settingsKeys.append("frequencyShift"); sendSettings(); } @@ -160,6 +167,7 @@ void TestSourceGui::on_decimation_currentIndexChanged(int index) } m_settings.m_log2Decim = index; + m_settingsKeys.append("log2Decim"); sendSettings(); } @@ -170,6 +178,7 @@ void TestSourceGui::on_fcPos_currentIndexChanged(int index) } m_settings.m_fcPos = (TestSourceSettings::fcPos_t) index; + m_settingsKeys.append("fcPos"); sendSettings(); } @@ -178,6 +187,8 @@ void TestSourceGui::on_sampleRate_changed(quint64 value) updateFrequencyShiftLimit(); m_settings.m_frequencyShift = ui->frequencyShift->getValueNew(); m_settings.m_sampleRate = value; + m_settingsKeys.append("frequencyShift"); + m_settingsKeys.append("sampleRate"); sendSettings(); } @@ -192,6 +203,8 @@ void TestSourceGui::on_sampleSize_currentIndexChanged(int index) displayAmplitude(); m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); m_settings.m_sampleSizeIndex = index; + m_settingsKeys.append("amplitudeBits"); + m_settingsKeys.append("sampleSizeIndex"); sendSettings(); } @@ -201,6 +214,7 @@ void TestSourceGui::on_amplitudeCoarse_valueChanged(int value) updateAmpFineLimit(); displayAmplitude(); m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); + m_settingsKeys.append("amplitudeBits"); sendSettings(); } @@ -209,6 +223,7 @@ void TestSourceGui::on_amplitudeFine_valueChanged(int value) (void) value; displayAmplitude(); m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); + m_settingsKeys.append("amplitudeBits"); sendSettings(); } @@ -219,6 +234,7 @@ void TestSourceGui::on_modulation_currentIndexChanged(int index) } m_settings.m_modulation = (TestSourceSettings::Modulation) index; + m_settingsKeys.append("modulation"); sendSettings(); } @@ -226,6 +242,7 @@ void TestSourceGui::on_modulationFrequency_valueChanged(int value) { m_settings.m_modulationTone = value; ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_modulationTone / 100.0, 0, 'f', 2)); + m_settingsKeys.append("modulationTone"); sendSettings(); } @@ -233,6 +250,7 @@ void TestSourceGui::on_amModulation_valueChanged(int value) { m_settings.m_amModulation = value; ui->amModulationText->setText(QString("%1").arg(m_settings.m_amModulation)); + m_settingsKeys.append("amModulation"); sendSettings(); } @@ -240,6 +258,7 @@ void TestSourceGui::on_fmDeviation_valueChanged(int value) { m_settings.m_fmDeviation = value; ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_fmDeviation / 10.0, 0, 'f', 1)); + m_settingsKeys.append("fmDeviation"); sendSettings(); } @@ -247,6 +266,7 @@ void TestSourceGui::on_dcBias_valueChanged(int value) { ui->dcBiasText->setText(QString(tr("%1 %").arg(value))); m_settings.m_dcFactor = value / 100.0f; + m_settingsKeys.append("dcFactor"); sendSettings(); } @@ -254,6 +274,7 @@ void TestSourceGui::on_iBias_valueChanged(int value) { ui->iBiasText->setText(QString(tr("%1 %").arg(value))); m_settings.m_iFactor = value / 100.0f; + m_settingsKeys.append("iFactor"); sendSettings(); } @@ -261,6 +282,7 @@ void TestSourceGui::on_qBias_valueChanged(int value) { ui->qBiasText->setText(QString(tr("%1 %").arg(value))); m_settings.m_qFactor = value / 100.0f; + m_settingsKeys.append("qFactor"); sendSettings(); } @@ -268,6 +290,7 @@ void TestSourceGui::on_phaseImbalance_valueChanged(int value) { ui->phaseImbalanceText->setText(QString(tr("%1 %").arg(value))); m_settings.m_phaseImbalance = value / 100.0f; + m_settingsKeys.append("phaseImbalance"); sendSettings(); } @@ -391,7 +414,7 @@ void TestSourceGui::displaySettings() void TestSourceGui::sendSettings() { - if(!m_updateTimer.isActive()) { + if (!m_updateTimer.isActive()) { m_updateTimer.start(100); } } @@ -400,9 +423,10 @@ void TestSourceGui::updateHardware() { if (m_doApplySettings) { - TestSourceInput::MsgConfigureTestSource* message = TestSourceInput::MsgConfigureTestSource::create(m_settings, m_forceSettings); + TestSourceInput::MsgConfigureTestSource* message = TestSourceInput::MsgConfigureTestSource::create(m_settings, m_settingsKeys, m_forceSettings); m_sampleSource->getInputMessageQueue()->push(message); m_forceSettings = false; + m_settingsKeys.clear(); m_updateTimer.stop(); } } @@ -442,7 +466,13 @@ bool TestSourceGui::handleMessage(const Message& message) { qDebug("TestSourceGui::handleMessage: MsgConfigureTestSource"); const TestSourceInput::MsgConfigureTestSource& cfg = (TestSourceInput::MsgConfigureTestSource&) message; - m_settings = cfg.getSettings(); + + if (cfg.getForce()) { + m_settings = cfg.getSettings(); + } else { + m_settings.applySettings(cfg.getSettingsKeys(), cfg.getSettings()); + } + displaySettings(); return true; } diff --git a/plugins/samplesource/testsource/testsourcegui.h b/plugins/samplesource/testsource/testsourcegui.h index ead209b5d..90bf61e60 100644 --- a/plugins/samplesource/testsource/testsourcegui.h +++ b/plugins/samplesource/testsource/testsourcegui.h @@ -53,6 +53,7 @@ private: Ui::TestSourceGui* ui; TestSourceSettings m_settings; + QList m_settingsKeys; QTimer m_updateTimer; QTimer m_statusTimer; bool m_doApplySettings; diff --git a/plugins/samplesource/testsource/testsourceinput.cpp b/plugins/samplesource/testsource/testsourceinput.cpp index 6bd7cbc61..e4b2f44fc 100644 --- a/plugins/samplesource/testsource/testsourceinput.cpp +++ b/plugins/samplesource/testsource/testsourceinput.cpp @@ -80,7 +80,7 @@ void TestSourceInput::destroy() void TestSourceInput::init() { - applySettings(m_settings, true); + applySettings(m_settings, QList(), true); } bool TestSourceInput::start() @@ -111,7 +111,7 @@ bool TestSourceInput::start() mutexLocker.unlock(); - applySettings(m_settings, true); + applySettings(m_settings, QList(), true); return true; } @@ -146,12 +146,12 @@ bool TestSourceInput::deserialize(const QByteArray& data) success = false; } - MsgConfigureTestSource* message = MsgConfigureTestSource::create(m_settings, true); + MsgConfigureTestSource* message = MsgConfigureTestSource::create(m_settings, QList(), true); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureTestSource* messageToGUI = MsgConfigureTestSource::create(m_settings, true); + MsgConfigureTestSource* messageToGUI = MsgConfigureTestSource::create(m_settings, QList(), true); m_guiMessageQueue->push(messageToGUI); } @@ -178,12 +178,12 @@ void TestSourceInput::setCenterFrequency(qint64 centerFrequency) TestSourceSettings settings = m_settings; settings.m_centerFrequency = centerFrequency; - MsgConfigureTestSource* message = MsgConfigureTestSource::create(settings, false); + MsgConfigureTestSource* message = MsgConfigureTestSource::create(settings, QList{"centerFrequency"}, false); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureTestSource* messageToGUI = MsgConfigureTestSource::create(settings, false); + MsgConfigureTestSource* messageToGUI = MsgConfigureTestSource::create(settings, QList{"centerFrequency"}, false); m_guiMessageQueue->push(messageToGUI); } } @@ -195,7 +195,7 @@ bool TestSourceInput::handleMessage(const Message& message) MsgConfigureTestSource& conf = (MsgConfigureTestSource&) message; qDebug() << "TestSourceInput::handleMessage: MsgConfigureTestSource"; - bool success = applySettings(conf.getSettings(), conf.getForce()); + bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce()); if (!success) { @@ -233,14 +233,12 @@ bool TestSourceInput::handleMessage(const Message& message) } } -bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool force) +bool TestSourceInput::applySettings(const TestSourceSettings& settings, const QList& settingsKeys, bool force) { - QList reverseAPIKeys; + qDebug() << "TestSourceInput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force); - if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force) + if (settingsKeys.contains("autoCorrOptions") || force) { - reverseAPIKeys.append("autoCorrOptions"); - switch(settings.m_autoCorrOptions) { case TestSourceSettings::AutoCorrDC: @@ -256,10 +254,8 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for } } - if ((m_settings.m_sampleRate != settings.m_sampleRate) || force) + if (settingsKeys.contains("sampleRate") || force) { - reverseAPIKeys.append("sampleRate"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setSamplerate(settings.m_sampleRate); @@ -267,10 +263,8 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for } } - if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) + if (settingsKeys.contains("log2Decim") || force) { - reverseAPIKeys.append("log2Decim"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setLog2Decimation(settings.m_log2Decim); @@ -278,16 +272,12 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for } } - if ((m_settings.m_centerFrequency != settings.m_centerFrequency) - || (m_settings.m_fcPos != settings.m_fcPos) - || (m_settings.m_frequencyShift != settings.m_frequencyShift) - || (m_settings.m_sampleRate != settings.m_sampleRate) - || (m_settings.m_log2Decim != settings.m_log2Decim) || force) + if (settingsKeys.contains("centerFrequency") + || settingsKeys.contains("fcPos") + || settingsKeys.contains("frequencyShift") + || settingsKeys.contains("sampleRate") + || settingsKeys.contains("log2Decim") || force) { - reverseAPIKeys.append("centerFrequency"); - reverseAPIKeys.append("fcPos"); - reverseAPIKeys.append("frequencyShift"); - qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency( settings.m_centerFrequency, 0, // no transverter mode @@ -322,83 +312,71 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for } } - if ((m_settings.m_amplitudeBits != settings.m_amplitudeBits) || force) + if (settingsKeys.contains("amplitudeBits") || force) { - reverseAPIKeys.append("amplitudeBits"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setAmplitudeBits(settings.m_amplitudeBits); } } - if ((m_settings.m_dcFactor != settings.m_dcFactor) || force) + if (settingsKeys.contains("dcFactor") || force) { - reverseAPIKeys.append("dcFactor"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setDCFactor(settings.m_dcFactor); } } - if ((m_settings.m_iFactor != settings.m_iFactor) || force) + if (settingsKeys.contains("iFactor") || force) { - reverseAPIKeys.append("iFactor"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setIFactor(settings.m_iFactor); } } - if ((m_settings.m_qFactor != settings.m_qFactor) || force) + if (settingsKeys.contains("qFactor") || force) { - reverseAPIKeys.append("qFactor"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setQFactor(settings.m_qFactor); } } - if ((m_settings.m_phaseImbalance != settings.m_phaseImbalance) || force) + if (settingsKeys.contains("phaseImbalance") || force) { - reverseAPIKeys.append("phaseImbalance"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setPhaseImbalance(settings.m_phaseImbalance); } } - if ((m_settings.m_sampleSizeIndex != settings.m_sampleSizeIndex) || force) + if (settingsKeys.contains("sampleSizeIndex") || force) { - reverseAPIKeys.append("sampleSizeIndex"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setBitSize(settings.m_sampleSizeIndex); } } - if ((m_settings.m_sampleRate != settings.m_sampleRate) - || (m_settings.m_centerFrequency != settings.m_centerFrequency) - || (m_settings.m_log2Decim != settings.m_log2Decim) - || (m_settings.m_fcPos != settings.m_fcPos) || force) + // if ((m_settings.m_sampleRate != settings.m_sampleRate) + // || (m_settings.m_centerFrequency != settings.m_centerFrequency) + // || (m_settings.m_log2Decim != settings.m_log2Decim) + // || (m_settings.m_fcPos != settings.m_fcPos) || force) + if (settingsKeys.contains("sampleRate") + || settingsKeys.contains("centerFrequency") + || settingsKeys.contains("log2Decim") + || settingsKeys.contains("fcPos") || force) { int sampleRate = settings.m_sampleRate/(1<getDeviceEngineInputMessageQueue()->push(notif); } - if ((m_settings.m_modulationTone != settings.m_modulationTone) || force) + if (settingsKeys.contains("modulationTone") || force) { - reverseAPIKeys.append("modulationTone"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setToneFrequency(settings.m_modulationTone * 10); } } - if ((m_settings.m_modulation != settings.m_modulation) || force) + if (settingsKeys.contains("modulation") || force) { - reverseAPIKeys.append("modulation"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setModulation(settings.m_modulation); @@ -413,35 +391,35 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for } } - if ((m_settings.m_amModulation != settings.m_amModulation) || force) + if (settingsKeys.contains("amModulation") || force) { - reverseAPIKeys.append("amModulation"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setAMModulation(settings.m_amModulation / 100.0f); } } - if ((m_settings.m_fmDeviation != settings.m_fmDeviation) || force) + if (settingsKeys.contains("fmDeviation") || force) { - reverseAPIKeys.append("fmDeviation"); - if (m_testSourceWorker != 0) { m_testSourceWorker->setFMDeviation(settings.m_fmDeviation * 100.0f); } } - if (settings.m_useReverseAPI) + if (settingsKeys.contains("useReverseAPI")) { - qDebug("TestSourceInput::applySettings: call webapiReverseSendSettings"); - 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); + } + + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); } - m_settings = settings; return true; } @@ -494,12 +472,12 @@ int TestSourceInput::webapiSettingsPutPatch( TestSourceSettings settings = m_settings; webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response); - MsgConfigureTestSource *msg = MsgConfigureTestSource::create(settings, force); + MsgConfigureTestSource *msg = MsgConfigureTestSource::create(settings, deviceSettingsKeys, force); m_inputMessageQueue.push(msg); if (m_guiMessageQueue) // forward to GUI if any { - MsgConfigureTestSource *msgToGUI = MsgConfigureTestSource::create(settings, force); + MsgConfigureTestSource *msgToGUI = MsgConfigureTestSource::create(settings, deviceSettingsKeys, force); m_guiMessageQueue->push(msgToGUI); } @@ -613,7 +591,7 @@ void TestSourceInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response.getTestSourceSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); } -void TestSourceInput::webapiReverseSendSettings(QList& deviceSettingsKeys, const TestSourceSettings& settings, bool force) +void TestSourceInput::webapiReverseSendSettings(const QList& deviceSettingsKeys, const TestSourceSettings& settings, bool force) { SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); swgDeviceSettings->setDirection(0); // single Rx diff --git a/plugins/samplesource/testsource/testsourceinput.h b/plugins/samplesource/testsource/testsourceinput.h index ad5c75bed..638a972fb 100644 --- a/plugins/samplesource/testsource/testsourceinput.h +++ b/plugins/samplesource/testsource/testsourceinput.h @@ -40,20 +40,22 @@ public: public: const TestSourceSettings& getSettings() const { return m_settings; } + const QList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureTestSource* create(const TestSourceSettings& settings, bool force) - { - return new MsgConfigureTestSource(settings, force); + static MsgConfigureTestSource* create(const TestSourceSettings& settings, const QList& settingsKeys, bool force) { + return new MsgConfigureTestSource(settings, settingsKeys, force); } private: TestSourceSettings m_settings; + QList m_settingsKeys; bool m_force; - MsgConfigureTestSource(const TestSourceSettings& settings, bool force) : + MsgConfigureTestSource(const TestSourceSettings& settings, const QList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -137,8 +139,8 @@ private: QNetworkAccessManager *m_networkManager; QNetworkRequest m_networkRequest; - bool applySettings(const TestSourceSettings& settings, bool force); - void webapiReverseSendSettings(QList& deviceSettingsKeys, const TestSourceSettings& settings, bool force); + bool applySettings(const TestSourceSettings& settings, const QList& settingsKeys, bool force); + void webapiReverseSendSettings(const QList& deviceSettingsKeys, const TestSourceSettings& settings, bool force); void webapiReverseSendStartStop(bool start); private slots: diff --git a/plugins/samplesource/testsource/testsourcesettings.cpp b/plugins/samplesource/testsource/testsourcesettings.cpp index b94d7e044..f32a19973 100644 --- a/plugins/samplesource/testsource/testsourcesettings.cpp +++ b/plugins/samplesource/testsource/testsourcesettings.cpp @@ -143,8 +143,134 @@ bool TestSourceSettings::deserialize(const QByteArray& data) } } +void TestSourceSettings::applySettings(const QStringList& settingsKeys, const TestSourceSettings& settings) +{ + if (settingsKeys.contains("centerFrequency")) { + m_centerFrequency = settings.m_centerFrequency; + } + if (settingsKeys.contains("frequencyShift")) { + m_frequencyShift = settings.m_frequencyShift; + } + if (settingsKeys.contains("sampleRate")) { + m_sampleRate = settings.m_sampleRate; + } + if (settingsKeys.contains("log2Decim")) { + m_log2Decim = settings.m_log2Decim; + } + if (settingsKeys.contains("fcPos")) { + m_fcPos = settings.m_fcPos; + } + if (settingsKeys.contains("sampleSizeIndex")) { + m_sampleSizeIndex = settings.m_sampleSizeIndex; + } + if (settingsKeys.contains("amplitudeBits")) { + m_amplitudeBits = settings.m_amplitudeBits; + } + if (settingsKeys.contains("autoCorrOptions")) { + m_autoCorrOptions = settings.m_autoCorrOptions; + } + if (settingsKeys.contains("modulation")) { + m_modulation = settings.m_modulation; + } + if (settingsKeys.contains("modulationTone")) { + m_modulationTone = settings.m_modulationTone; + } + if (settingsKeys.contains("amModulation")) { + m_amModulation = settings.m_amModulation; + } + if (settingsKeys.contains("fmDeviation")) { + m_fmDeviation = settings.m_fmDeviation; + } + if (settingsKeys.contains("dcFactor")) { + m_dcFactor = settings.m_dcFactor; + } + if (settingsKeys.contains("iFactor")) { + m_iFactor = settings.m_iFactor; + } + if (settingsKeys.contains("qFactor")) { + m_qFactor = settings.m_qFactor; + } + if (settingsKeys.contains("phaseImbalance")) { + m_phaseImbalance = settings.m_phaseImbalance; + } + 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 TestSourceSettings::getDebugString(const QStringList& settingsKeys, bool force) const +{ + std::ostringstream ostr; + if (settingsKeys.contains("centerFrequency") || force) { + ostr << " m_centerFrequency: " << m_centerFrequency; + } + if (settingsKeys.contains("frequencyShift") || force) { + ostr << " m_frequencyShift: " << m_frequencyShift; + } + if (settingsKeys.contains("sampleRate") || force) { + ostr << " m_sampleRate: " << m_sampleRate; + } + if (settingsKeys.contains("log2Decim") || force) { + ostr << " m_log2Decim: " << m_log2Decim; + } + if (settingsKeys.contains("fcPos") || force) { + ostr << " m_fcPos: " << m_fcPos; + } + if (settingsKeys.contains("sampleSizeIndex") || force) { + ostr << " m_sampleSizeIndex: " << m_sampleSizeIndex; + } + if (settingsKeys.contains("amplitudeBits") || force) { + ostr << " m_amplitudeBits: " << m_amplitudeBits; + } + if (settingsKeys.contains("autoCorrOptions") || force) { + ostr << " m_autoCorrOptions: " << m_autoCorrOptions; + } + if (settingsKeys.contains("modulation") || force) { + ostr << " m_modulation: " << m_modulation; + } + if (settingsKeys.contains("modulationTone") || force) { + ostr << " m_modulationTone: " << m_modulationTone; + } + if (settingsKeys.contains("amModulation") || force) { + ostr << " m_amModulation: " << m_amModulation; + } + if (settingsKeys.contains("fmDeviation") || force) { + ostr << " m_fmDeviation: " << m_fmDeviation; + } + if (settingsKeys.contains("dcFactor") || force) { + ostr << " m_dcFactor: " << m_dcFactor; + } + if (settingsKeys.contains("iFactor") || force) { + ostr << " m_iFactor: " << m_iFactor; + } + if (settingsKeys.contains("qFactor") || force) { + ostr << " m_qFactor: " << m_qFactor; + } + if (settingsKeys.contains("phaseImbalance") || force) { + ostr << " m_phaseImbalance: " << m_phaseImbalance; + } + 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/testsource/testsourcesettings.h b/plugins/samplesource/testsource/testsourcesettings.h index e7529d51a..7f01cdef4 100644 --- a/plugins/samplesource/testsource/testsourcesettings.h +++ b/plugins/samplesource/testsource/testsourcesettings.h @@ -69,6 +69,8 @@ struct TestSourceSettings { void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); + void applySettings(const QStringList& settingsKeys, const TestSourceSettings& settings); + QString getDebugString(const QStringList& settingsKeys, bool force=false) const; };