diff --git a/plugins/samplesink/hackrfoutput/hackrfoutput.cpp b/plugins/samplesink/hackrfoutput/hackrfoutput.cpp index c1c2d194a..9a060456f 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutput.cpp +++ b/plugins/samplesink/hackrfoutput/hackrfoutput.cpp @@ -125,7 +125,7 @@ bool HackRFOutput::openDevice() void HackRFOutput::init() { - applySettings(m_settings, true); + applySettings(m_settings, QList(), true); } bool HackRFOutput::start() @@ -142,7 +142,7 @@ bool HackRFOutput::start() // mutexLocker.unlock(); - applySettings(m_settings, true); + applySettings(m_settings, QList(), true); m_hackRFThread->setLog2Interpolation(m_settings.m_log2Interp); m_hackRFThread->setFcPos((int) m_settings.m_fcPos); @@ -202,12 +202,12 @@ bool HackRFOutput::deserialize(const QByteArray& data) success = false; } - MsgConfigureHackRF* message = MsgConfigureHackRF::create(m_settings, true); + MsgConfigureHackRF* message = MsgConfigureHackRF::create(m_settings, QList(), true); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(m_settings, true); + MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(m_settings, QList(), true); m_guiMessageQueue->push(messageToGUI); } @@ -235,12 +235,12 @@ void HackRFOutput::setCenterFrequency(qint64 centerFrequency) HackRFOutputSettings settings = m_settings; settings.m_centerFrequency = centerFrequency; - MsgConfigureHackRF* message = MsgConfigureHackRF::create(settings, false); + MsgConfigureHackRF* message = MsgConfigureHackRF::create(settings, QList{"centerFrequency"}, false); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(settings, false); + MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(settings, QList{"centerFrequency"}, false); m_guiMessageQueue->push(messageToGUI); } } @@ -252,10 +252,9 @@ bool HackRFOutput::handleMessage(const Message& message) MsgConfigureHackRF& conf = (MsgConfigureHackRF&) message; qDebug() << "HackRFOutput::handleMessage: MsgConfigureHackRF"; - bool success = applySettings(conf.getSettings(), conf.getForce()); + bool success = applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce()); - if (!success) - { + if (!success) { qDebug("HackRFOutput::handleMessage: MsgConfigureHackRF: config error"); } @@ -268,8 +267,7 @@ bool HackRFOutput::handleMessage(const Message& message) if (cmd.getStartStop()) { - if (m_deviceAPI->initDeviceEngine()) - { + if (m_deviceAPI->initDeviceEngine()) { m_deviceAPI->startDeviceEngine(); } } @@ -299,7 +297,7 @@ bool HackRFOutput::handleMessage(const Message& message) if (m_guiMessageQueue) { - MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(settings, false); + MsgConfigureHackRF* messageToGUI = MsgConfigureHackRF::create(settings, QList{"centerFrequency"}, false); m_guiMessageQueue->push(messageToGUI); } @@ -334,38 +332,20 @@ void HackRFOutput::setDeviceCenterFrequency(quint64 freq_hz, int loPpmTenths) } } -bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool force) +bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, const QList& settingsKeys, bool force) { // QMutexLocker mutexLocker(&m_mutex); + qDebug() << "HackRFOutput::applySettings: force:" << force << settings.getDebugString(settingsKeys, force); bool forwardChange = false; bool suspendThread = false; bool threadWasRunning = false; hackrf_error rc; - QList reverseAPIKeys; - qDebug() << "HackRFOutput::applySettings" - << " m_centerFrequency: " << settings.m_centerFrequency - << " m_LOppmTenths: " << settings.m_LOppmTenths - << " m_bandwidth: " << settings.m_bandwidth - << " m_devSampleRate: " << settings.m_devSampleRate - << " m_log2Interp: " << settings.m_log2Interp - << " m_fcPos: " << settings.m_fcPos - << " m_biasT: " << settings.m_biasT - << " m_lnaExt: " << settings.m_lnaExt - << " m_vgaGain: " << settings.m_vgaGain - << " m_useReverseAPI: " << settings.m_useReverseAPI - << " m_reverseAPIAddress: " << settings.m_reverseAPIAddress - << " m_reverseAPIPort: " << settings.m_reverseAPIPort - << " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex - << " force: " << force; - - if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) { - reverseAPIKeys.append("devSampleRate"); - } - - if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || - (m_settings.m_log2Interp != settings.m_log2Interp) || force) + // if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || + // (m_settings.m_log2Interp != settings.m_log2Interp) || force) + if (settingsKeys.contains("devSampleRate") || + settingsKeys.contains("log2Interp") || force) { suspendThread = true; } @@ -382,7 +362,8 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force) + if (settingsKeys.contains("devSampleRate") || + settingsKeys.contains("log2Interp") || force) { forwardChange = true; unsigned int fifoRate = std::max( @@ -391,7 +372,7 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc m_sampleSourceFifo.resize(SampleSourceFifo::getSizePolicy(fifoRate)); } - if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force) + if (settingsKeys.contains("devSampleRate") || force) { if (m_dev != 0) { @@ -411,10 +392,8 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if ((m_settings.m_log2Interp != settings.m_log2Interp) || force) + if (settingsKeys.contains("log2Interp") || force) { - reverseAPIKeys.append("log2Interp"); - if (m_hackRFThread != 0) { m_hackRFThread->setLog2Interpolation(settings.m_log2Interp); @@ -422,29 +401,13 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) { - reverseAPIKeys.append("centerFrequency"); - } - if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) { - reverseAPIKeys.append("LOppmTenths"); - } - if ((m_settings.m_fcPos != settings.m_fcPos) || force) { - reverseAPIKeys.append("fcPos"); - } - if ((m_settings.m_transverterMode != settings.m_transverterMode) || force) { - reverseAPIKeys.append("transverterMode"); - } - if ((m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || force) { - reverseAPIKeys.append("transverterDeltaFrequency"); - } - - if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || - (m_settings.m_devSampleRate != settings.m_devSampleRate) || - (m_settings.m_log2Interp != settings.m_log2Interp) || - (m_settings.m_fcPos != settings.m_fcPos) || - (m_settings.m_transverterMode != settings.m_transverterMode) || - (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency) || - (m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) + if (settingsKeys.contains("centerFrequency") || + settingsKeys.contains("devSampleRate") || + settingsKeys.contains("log2Interp") || + settingsKeys.contains("fcPos") || + settingsKeys.contains("transverterMode") || + settingsKeys.contains("transverterDeltaFrequency") || + settingsKeys.contains("LOppmTenths") || force) { qint64 deviceCenterFrequency = DeviceSampleSink::calculateDeviceCenterFrequency( settings.m_centerFrequency, @@ -465,17 +428,15 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc forwardChange = true; } - if ((m_settings.m_fcPos != settings.m_fcPos) || force) + if (settingsKeys.contains("fcPos") || force) { if (m_hackRFThread != 0) { m_hackRFThread->setFcPos((int) settings.m_fcPos); } } - if ((m_settings.m_vgaGain != settings.m_vgaGain) || force) + if (settingsKeys.contains("vgaGain") || force) { - reverseAPIKeys.append("vgaGain"); - if (m_dev != 0) { rc = (hackrf_error) hackrf_set_txvga_gain(m_dev, settings.m_vgaGain); @@ -488,10 +449,8 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if ((m_settings.m_bandwidth != settings.m_bandwidth) || force) + if (settingsKeys.contains("bandwidth") || force) { - reverseAPIKeys.append("bandwidth"); - if (m_dev != 0) { uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(settings.m_bandwidth + 1); // +1 so the round down to lower than yields desired bandwidth @@ -505,10 +464,8 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if ((m_settings.m_biasT != settings.m_biasT) || force) + if (settingsKeys.contains("biasT") || force) { - reverseAPIKeys.append("biasT"); - if (m_dev != 0) { rc = (hackrf_error) hackrf_set_antenna_enable(m_dev, (settings.m_biasT ? 1 : 0)); @@ -521,10 +478,8 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if ((m_settings.m_lnaExt != settings.m_lnaExt) || force) + if (settingsKeys.contains("lnaExt") || force) { - reverseAPIKeys.append("lnaExt"); - if (m_dev != 0) { rc = (hackrf_error) hackrf_set_amp_enable(m_dev, (settings.m_lnaExt ? 1 : 0)); @@ -537,21 +492,24 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc } } - if (threadWasRunning) - { + if (threadWasRunning) { m_hackRFThread->startWork(); } - 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) { @@ -584,12 +542,12 @@ int HackRFOutput::webapiSettingsPutPatch( HackRFOutputSettings settings = m_settings; webapiUpdateDeviceSettings(settings, deviceSettingsKeys, response); - MsgConfigureHackRF *msg = MsgConfigureHackRF::create(settings, force); + MsgConfigureHackRF *msg = MsgConfigureHackRF::create(settings, deviceSettingsKeys, force); m_inputMessageQueue.push(msg); if (m_guiMessageQueue) // forward to GUI if any { - MsgConfigureHackRF *msgToGUI = MsgConfigureHackRF::create(settings, force); + MsgConfigureHackRF *msgToGUI = MsgConfigureHackRF::create(settings, deviceSettingsKeys, force); m_guiMessageQueue->push(msgToGUI); } @@ -706,7 +664,7 @@ int HackRFOutput::webapiRun( return 200; } -void HackRFOutput::webapiReverseSendSettings(QList& deviceSettingsKeys, const HackRFOutputSettings& settings, bool force) +void HackRFOutput::webapiReverseSendSettings(const QList& deviceSettingsKeys, const HackRFOutputSettings& settings, bool force) { SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); swgDeviceSettings->setDirection(1); // single Tx diff --git a/plugins/samplesink/hackrfoutput/hackrfoutput.h b/plugins/samplesink/hackrfoutput/hackrfoutput.h index be5a0902a..62e65f429 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutput.h +++ b/plugins/samplesink/hackrfoutput/hackrfoutput.h @@ -41,20 +41,22 @@ public: public: const HackRFOutputSettings& getSettings() const { return m_settings; } + const QList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureHackRF* create(const HackRFOutputSettings& settings, bool force) - { - return new MsgConfigureHackRF(settings, force); + static MsgConfigureHackRF* create(const HackRFOutputSettings& settings, const QList& settingsKeys, bool force) { + return new MsgConfigureHackRF(settings, settingsKeys, force); } private: HackRFOutputSettings m_settings; + QList m_settingsKeys; bool m_force; - MsgConfigureHackRF(const HackRFOutputSettings& settings, bool force) : + MsgConfigureHackRF(const HackRFOutputSettings& settings, const QList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -157,10 +159,10 @@ private: bool openDevice(); void closeDevice(); - bool applySettings(const HackRFOutputSettings& settings, bool force); + bool applySettings(const HackRFOutputSettings& settings, const QList& settingsKeys, bool force); // hackrf_device *open_hackrf_from_sequence(int sequence); void setDeviceCenterFrequency(quint64 freq_hz, int loPpmTenths); - void webapiReverseSendSettings(QList& deviceSettingsKeys, const HackRFOutputSettings& settings, bool force); + void webapiReverseSendSettings(const QList& deviceSettingsKeys, const HackRFOutputSettings& settings, bool force); void webapiReverseSendStartStop(bool start); private slots: diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp b/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp index ea8cd8931..6de54ec15 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp +++ b/plugins/samplesink/hackrfoutput/hackrfoutputgui.cpp @@ -88,6 +88,7 @@ void HackRFOutputGui::resetToDefaults() { m_settings.resetToDefaults(); displaySettings(); + m_forceSettings = true; sendSettings(); } @@ -129,7 +130,13 @@ bool HackRFOutputGui::handleMessage(const Message& message) if (HackRFOutput::MsgConfigureHackRF::match(message)) { const HackRFOutput::MsgConfigureHackRF& cfg = (HackRFOutput::MsgConfigureHackRF&) 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); @@ -306,19 +313,22 @@ void HackRFOutputGui::displayBandwidths() void HackRFOutputGui::sendSettings() { - if(!m_updateTimer.isActive()) + if (!m_updateTimer.isActive()) { m_updateTimer.start(100); + } } void HackRFOutputGui::on_centerFrequency_changed(quint64 value) { m_settings.m_centerFrequency = value * 1000; + m_settingsKeys.append("centerFrequency"); sendSettings(); } void HackRFOutputGui::on_sampleRate_changed(quint64 value) { m_settings.m_devSampleRate = value; + m_settingsKeys.append("devSampleRate"); if (!m_sampleRateMode) { m_settings.m_devSampleRate <<= m_settings.m_log2Interp; @@ -332,6 +342,7 @@ void HackRFOutputGui::on_LOppm_valueChanged(int value) { m_settings.m_LOppmTenths = value; ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); + m_settingsKeys.append("LOppmTenths"); sendSettings(); } @@ -339,18 +350,21 @@ void HackRFOutputGui::on_bbFilter_currentIndexChanged(int index) { int newBandwidth = HackRFBandwidths::getBandwidth(index); m_settings.m_bandwidth = newBandwidth * 1000; + m_settingsKeys.append("bandwidth"); sendSettings(); } void HackRFOutputGui::on_biasT_stateChanged(int state) { m_settings.m_biasT = (state == Qt::Checked); + m_settingsKeys.append("biasT"); sendSettings(); } void HackRFOutputGui::on_lnaExt_stateChanged(int state) { m_settings.m_lnaExt = (state == Qt::Checked); + m_settingsKeys.append("lnaExt"); sendSettings(); } @@ -363,6 +377,8 @@ void HackRFOutputGui::on_interp_currentIndexChanged(int index) m_settings.m_log2Interp = index; displaySampleRate(); m_settings.m_devSampleRate = ui->sampleRate->getValueNew(); + m_settingsKeys.append("log2Interp"); + m_settingsKeys.append("devSampleRate"); if (!m_sampleRateMode) { m_settings.m_devSampleRate <<= m_settings.m_log2Interp; @@ -374,6 +390,7 @@ void HackRFOutputGui::on_interp_currentIndexChanged(int index) void HackRFOutputGui::on_fcPos_currentIndexChanged(int index) { m_settings.m_fcPos = (HackRFOutputSettings::fcPos_t) (index < 0 ? 0 : index > 2 ? 2 : index); + m_settingsKeys.append("fcPos"); displayFcTooltip(); sendSettings(); } @@ -385,6 +402,7 @@ void HackRFOutputGui::on_txvga_valueChanged(int value) ui->txvgaGainText->setText(tr("%1dB").arg(value)); m_settings.m_vgaGain = value; + m_settingsKeys.append("vgaGain"); sendSettings(); } @@ -410,6 +428,9 @@ void HackRFOutputGui::on_transverter_clicked() qDebug("HackRFOutputGui::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("centerFrequency"); sendSettings(); } @@ -418,9 +439,10 @@ void HackRFOutputGui::updateHardware() if (m_doApplySettings) { qDebug() << "HackRFOutputGui::updateHardware"; - HackRFOutput::MsgConfigureHackRF* message = HackRFOutput::MsgConfigureHackRF::create(m_settings, m_forceSettings); + HackRFOutput::MsgConfigureHackRF* message = HackRFOutput::MsgConfigureHackRF::create(m_settings, m_settingsKeys, m_forceSettings); m_deviceSampleSink->getInputMessageQueue()->push(message); m_forceSettings = false; + m_settingsKeys.clear(); m_updateTimer.stop(); } } @@ -472,6 +494,10 @@ void HackRFOutputGui::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/samplesink/hackrfoutput/hackrfoutputgui.h b/plugins/samplesink/hackrfoutput/hackrfoutputgui.h index 0541ff791..a39da9401 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputgui.h +++ b/plugins/samplesink/hackrfoutput/hackrfoutputgui.h @@ -64,6 +64,7 @@ private: bool m_forceSettings; HackRFOutputSettings m_settings; + QList m_settingsKeys; bool m_sampleRateMode; //!< true: device, false: base band sample rate update mode QTimer m_updateTimer; QTimer m_statusTimer; diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputsettings.cpp b/plugins/samplesink/hackrfoutput/hackrfoutputsettings.cpp index e876d4c66..36b4c69af 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputsettings.cpp +++ b/plugins/samplesink/hackrfoutput/hackrfoutputsettings.cpp @@ -114,3 +114,105 @@ bool HackRFOutputSettings::deserialize(const QByteArray& data) return false; } } + +void HackRFOutputSettings::applySettings(const QStringList& settingsKeys, const HackRFOutputSettings& settings) +{ + if (settingsKeys.contains("centerFrequency")) { + m_centerFrequency = settings.m_centerFrequency; + } + if (settingsKeys.contains("LOppmTenths")) { + m_LOppmTenths = settings.m_LOppmTenths; + } + if (settingsKeys.contains("biasT")) { + m_biasT = settings.m_biasT; + } + if (settingsKeys.contains("log2Interp")) { + m_log2Interp = settings.m_log2Interp; + } + if (settingsKeys.contains("fcPos")) { + m_fcPos = settings.m_fcPos; + } + if (settingsKeys.contains("lnaExt")) { + m_lnaExt = settings.m_lnaExt; + } + if (settingsKeys.contains("vgaGain")) { + m_vgaGain = settings.m_vgaGain; + } + if (settingsKeys.contains("bandwidth")) { + m_bandwidth = settings.m_bandwidth; + } + if (settingsKeys.contains("devSampleRate")) { + m_devSampleRate = settings.m_devSampleRate; + } + if (settingsKeys.contains("transverterMode")) { + m_transverterMode = settings.m_transverterMode; + } + if (settingsKeys.contains("transverterDeltaFrequency")) { + m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency; + } + 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 HackRFOutputSettings::getDebugString(const QStringList& settingsKeys, bool force) const +{ + std::ostringstream ostr; + + if (settingsKeys.contains("centerFrequency") || force) { + ostr << " m_centerFrequency: " << m_centerFrequency; + } + if (settingsKeys.contains("LOppmTenths") || force) { + ostr << " m_LOppmTenths: " << m_LOppmTenths; + } + if (settingsKeys.contains("biasT") || force) { + ostr << " m_biasT: " << m_biasT; + } + if (settingsKeys.contains("log2Interp") || force) { + ostr << " m_log2Interp: " << m_log2Interp; + } + if (settingsKeys.contains("fcPos") || force) { + ostr << " m_fcPos: " << m_fcPos; + } + if (settingsKeys.contains("lnaExt") || force) { + ostr << " m_lnaExt: " << m_lnaExt; + } + if (settingsKeys.contains("vgaGain") || force) { + ostr << " m_vgaGain: " << m_vgaGain; + } + if (settingsKeys.contains("bandwidth") || force) { + ostr << " m_bandwidth: " << m_bandwidth; + } + if (settingsKeys.contains("devSampleRate") || force) { + ostr << " m_devSampleRate: " << m_devSampleRate; + } + if (settingsKeys.contains("transverterMode") || force) { + ostr << " m_transverterMode: " << m_transverterMode; + } + if (settingsKeys.contains("transverterDeltaFrequency") || force) { + ostr << " m_transverterDeltaFrequency: " << m_transverterDeltaFrequency; + } + 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/samplesink/hackrfoutput/hackrfoutputsettings.h b/plugins/samplesink/hackrfoutput/hackrfoutputsettings.h index 25ffe4c54..0ae494467 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputsettings.h +++ b/plugins/samplesink/hackrfoutput/hackrfoutputsettings.h @@ -48,6 +48,8 @@ struct HackRFOutputSettings { void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); + void applySettings(const QStringList& settingsKeys, const HackRFOutputSettings& settings); + QString getDebugString(const QStringList& settingsKeys, bool force=false) const; }; #endif /* _HACKRF_HACKRFOUTPUTSETTINGS_H_ */