diff --git a/plugins/channelrx/demodadsb/adsbdemod.cpp b/plugins/channelrx/demodadsb/adsbdemod.cpp index ef23daeff..96089730f 100644 --- a/plugins/channelrx/demodadsb/adsbdemod.cpp +++ b/plugins/channelrx/demodadsb/adsbdemod.cpp @@ -71,7 +71,7 @@ ADSBDemod::ADSBDemod(DeviceAPI *devieAPI) : m_worker = new ADSBDemodWorker(); m_basebandSink->setMessageQueueToWorker(m_worker->getInputMessageQueue()); - applySettings(m_settings, true); + applySettings(m_settings, QStringList(), true); m_deviceAPI->addChannelSink(this); m_deviceAPI->addChannelSinkAPI(this); @@ -147,7 +147,7 @@ void ADSBDemod::start() m_basebandSink->startWork(); m_thread->start(); - ADSBDemodWorker::MsgConfigureADSBDemodWorker *msg = ADSBDemodWorker::MsgConfigureADSBDemodWorker::create(m_settings, true); + ADSBDemodWorker::MsgConfigureADSBDemodWorker *msg = ADSBDemodWorker::MsgConfigureADSBDemodWorker::create(m_settings, QStringList(), true); m_worker->getInputMessageQueue()->push(msg); } @@ -169,7 +169,7 @@ bool ADSBDemod::handleMessage(const Message& cmd) MsgConfigureADSBDemod& cfg = (MsgConfigureADSBDemod&) cmd; qDebug() << "ADSBDemod::handleMessage: MsgConfigureADSBDemod"; - applySettings(cfg.getSettings(), cfg.getForce()); + applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); return true; } @@ -200,112 +200,12 @@ bool ADSBDemod::handleMessage(const Message& cmd) } } -void ADSBDemod::applySettings(const ADSBDemodSettings& settings, bool force) +void ADSBDemod::applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { qDebug() << "ADSBDemod::applySettings:" - << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset - << " m_rfBandwidth: " << settings.m_rfBandwidth - << " m_streamIndex: " << settings.m_streamIndex - << " 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 + << settings.getDebugString(settingsKeys, force) << " force: " << force; - QList reverseAPIKeys; - - if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) { - reverseAPIKeys.append("inputFrequencyOffset"); - } - if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) { - reverseAPIKeys.append("rfBandwidth"); - } - if ((settings.m_correlationThreshold != m_settings.m_correlationThreshold) || force) { - reverseAPIKeys.append("correlationThreshold"); - } - if ((settings.m_samplesPerBit != m_settings.m_samplesPerBit) || force) { - reverseAPIKeys.append("samplesPerBit"); - } - if ((settings.m_correlateFullPreamble != m_settings.m_correlateFullPreamble) || force) { - reverseAPIKeys.append("correlateFullPreamble"); - } - if ((settings.m_demodModeS != m_settings.m_demodModeS) || force) { - reverseAPIKeys.append("demodModeS"); - } - if ((settings.m_interpolatorPhaseSteps != m_settings.m_interpolatorPhaseSteps) || force) { - reverseAPIKeys.append("interpolatorPhaseSteps"); - } - if ((settings.m_interpolatorTapsPerPhase != m_settings.m_interpolatorTapsPerPhase) || force) { - reverseAPIKeys.append("interpolatorTapsPerPhase"); - } - if ((settings.m_removeTimeout != m_settings.m_removeTimeout) || force) { - reverseAPIKeys.append("removeTimeout"); - } - if ((settings.m_feedEnabled != m_settings.m_feedEnabled) || force) { - reverseAPIKeys.append("feedEnabled"); - } - if ((settings.m_exportClientEnabled != m_settings.m_exportClientEnabled) || force) { - reverseAPIKeys.append("exportClientEnabled"); - } - if ((settings.m_exportClientHost != m_settings.m_exportClientHost) || force) { - reverseAPIKeys.append("exportClientHost"); - } - if ((settings.m_exportClientPort != m_settings.m_exportClientPort) || force) { - reverseAPIKeys.append("exportClientPort"); - } - if ((settings.m_exportClientFormat != m_settings.m_exportClientFormat) || force) { - reverseAPIKeys.append("exportClientFormat"); - } - if ((settings.m_exportServerEnabled != m_settings.m_exportServerEnabled) || force) { - reverseAPIKeys.append("exportServerEnabled"); - } - if ((settings.m_exportServerPort != m_settings.m_exportServerPort) || force) { - reverseAPIKeys.append("exportServerPort"); - } - if ((settings.m_importEnabled != m_settings.m_importEnabled) || force) { - reverseAPIKeys.append("importEnabled"); - } - if ((settings.m_importHost != m_settings.m_importHost) || force) { - reverseAPIKeys.append("importHost"); - } - if ((settings.m_importUsername != m_settings.m_importUsername) || force) { - reverseAPIKeys.append("importUsername"); - } - if ((settings.m_importPassword != m_settings.m_importPassword) || force) { - reverseAPIKeys.append("importPassword"); - } - if ((settings.m_importParameters != m_settings.m_importParameters) || force) { - reverseAPIKeys.append("importParameters"); - } - if ((settings.m_importPeriod != m_settings.m_importPeriod) || force) { - reverseAPIKeys.append("importPeriod"); - } - if ((settings.m_importMinLatitude != m_settings.m_importMinLatitude) || force) { - reverseAPIKeys.append("importMinLatitude"); - } - if ((settings.m_importMaxLatitude != m_settings.m_importMaxLatitude) || force) { - reverseAPIKeys.append("importMaxLatitude"); - } - if ((settings.m_importMinLongitude != m_settings.m_importMinLongitude) || force) { - reverseAPIKeys.append("importMinLongitude"); - } - if ((settings.m_importMaxLongitude != m_settings.m_importMaxLongitude) || force) { - reverseAPIKeys.append("importMaxLongitude"); - } - if ((settings.m_logFilename != m_settings.m_logFilename) || force) { - reverseAPIKeys.append("logFilename"); - } - if ((settings.m_logEnabled != m_settings.m_logEnabled) || force) { - reverseAPIKeys.append("logEnabled"); - } - if ((settings.m_title != m_settings.m_title) || force) { - reverseAPIKeys.append("title"); - } - if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) { - reverseAPIKeys.append("rfBandwidth"); - } - if (m_settings.m_streamIndex != settings.m_streamIndex) { if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only @@ -317,38 +217,40 @@ void ADSBDemod::applySettings(const ADSBDemodSettings& settings, bool force) m_settings.m_streamIndex = settings.m_streamIndex; // make sure ChannelAPI::getStreamIndex() is consistent emit streamIndexChanged(settings.m_streamIndex); } - - reverseAPIKeys.append("streamIndex"); } - ADSBDemodBaseband::MsgConfigureADSBDemodBaseband *msg = ADSBDemodBaseband::MsgConfigureADSBDemodBaseband::create(settings, force); + ADSBDemodBaseband::MsgConfigureADSBDemodBaseband *msg = ADSBDemodBaseband::MsgConfigureADSBDemodBaseband::create(settings, settingsKeys, force); m_basebandSink->getInputMessageQueue()->push(msg); - ADSBDemodWorker::MsgConfigureADSBDemodWorker *workerMsg = ADSBDemodWorker::MsgConfigureADSBDemodWorker::create(settings, force); + ADSBDemodWorker::MsgConfigureADSBDemodWorker *workerMsg = ADSBDemodWorker::MsgConfigureADSBDemodWorker::create(settings, settingsKeys, force); m_worker->getInputMessageQueue()->push(workerMsg); if (settings.m_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) || - (m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex); - webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force); + bool fullUpdate = (settingsKeys.contains("useReverseAPI") && settings.m_useReverseAPI) || + settingsKeys.contains("reverseAPIAddress") || + settingsKeys.contains("reverseAPIPort") || + settingsKeys.contains("reverseAPIDeviceIndex") || + settingsKeys.contains("reverseAPIChannelIndex"); + webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force); } - m_settings = settings; + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } } void ADSBDemod::setCenterFrequency(qint64 frequency) { ADSBDemodSettings settings = m_settings; settings.m_inputFrequencyOffset = frequency; - applySettings(settings); + applySettings(settings, {"inputFrequencyOffset"}, false); if (m_guiMessageQueue) // forward to GUI if any { - MsgConfigureADSBDemod *msgToGUI = MsgConfigureADSBDemod::create(settings, false); + MsgConfigureADSBDemod *msgToGUI = MsgConfigureADSBDemod::create(settings, {"inputFrequencyOffset"}, false); m_guiMessageQueue->push(msgToGUI); } } @@ -368,7 +270,7 @@ bool ADSBDemod::deserialize(const QByteArray& data) success = false; } - MsgConfigureADSBDemod *msg = MsgConfigureADSBDemod::create(m_settings, true); + MsgConfigureADSBDemod *msg = MsgConfigureADSBDemod::create(m_settings, QStringList(), true); m_inputMessageQueue.push(msg); return success; @@ -404,12 +306,12 @@ int ADSBDemod::webapiSettingsPutPatch( ADSBDemodSettings settings = m_settings; webapiUpdateChannelSettings(settings, channelSettingsKeys, response); - MsgConfigureADSBDemod *msg = MsgConfigureADSBDemod::create(settings, force); + MsgConfigureADSBDemod *msg = MsgConfigureADSBDemod::create(settings, channelSettingsKeys, force); m_inputMessageQueue.push(msg); if (m_guiMessageQueue) // forward to GUI if any { - MsgConfigureADSBDemod *msgToGUI = MsgConfigureADSBDemod::create(settings, force); + MsgConfigureADSBDemod *msgToGUI = MsgConfigureADSBDemod::create(settings, channelSettingsKeys, force); m_guiMessageQueue->push(msgToGUI); } @@ -661,7 +563,7 @@ void ADSBDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& respons } } -void ADSBDemod::webapiReverseSendSettings(QList& channelSettingsKeys, const ADSBDemodSettings& settings, bool force) +void ADSBDemod::webapiReverseSendSettings(const QList& channelSettingsKeys, const ADSBDemodSettings& settings, bool force) { SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); swgChannelSettings->setDirection(0); // single sink (Rx) diff --git a/plugins/channelrx/demodadsb/adsbdemod.h b/plugins/channelrx/demodadsb/adsbdemod.h index aa514e784..41b82030f 100644 --- a/plugins/channelrx/demodadsb/adsbdemod.h +++ b/plugins/channelrx/demodadsb/adsbdemod.h @@ -20,8 +20,6 @@ #ifndef INCLUDE_ADSBDEMOD_H #define INCLUDE_ADSBDEMOD_H -#include - #include #include "dsp/basebandsamplesink.h" @@ -44,20 +42,23 @@ public: public: const ADSBDemodSettings& getSettings() const { return m_settings; } + const QStringList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureADSBDemod* create(const ADSBDemodSettings& settings, bool force) + static MsgConfigureADSBDemod* create(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { - return new MsgConfigureADSBDemod(settings, force); + return new MsgConfigureADSBDemod(settings, settingsKeys, force); } private: ADSBDemodSettings m_settings; + QStringList m_settingsKeys; bool m_force; - MsgConfigureADSBDemod(const ADSBDemodSettings& settings, bool force) : + MsgConfigureADSBDemod(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -184,9 +185,9 @@ private: QNetworkRequest m_networkRequest; virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed - void applySettings(const ADSBDemodSettings& settings, bool force = false); + void applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force = false); void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); - void webapiReverseSendSettings(QList& channelSettingsKeys, const ADSBDemodSettings& settings, bool force); + void webapiReverseSendSettings(const QList& channelSettingsKeys, const ADSBDemodSettings& settings, bool force); private slots: void networkManagerFinished(QNetworkReply *reply); diff --git a/plugins/channelrx/demodadsb/adsbdemodbaseband.cpp b/plugins/channelrx/demodadsb/adsbdemodbaseband.cpp index 0db76f974..cc586310f 100644 --- a/plugins/channelrx/demodadsb/adsbdemodbaseband.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodbaseband.cpp @@ -117,7 +117,7 @@ bool ADSBDemodBaseband::handleMessage(const Message& cmd) MsgConfigureADSBDemodBaseband& cfg = (MsgConfigureADSBDemodBaseband&) cmd; qDebug() << "ADSBDemodBaseband::handleMessage: MsgConfigureADSBDemodBaseband"; - applySettings(cfg.getSettings(), cfg.getForce()); + applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); return true; } @@ -138,19 +138,24 @@ bool ADSBDemodBaseband::handleMessage(const Message& cmd) } } -void ADSBDemodBaseband::applySettings(const ADSBDemodSettings& settings, bool force) +void ADSBDemodBaseband::applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { - if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) - || (settings.m_samplesPerBit != m_settings.m_samplesPerBit) || force) + if ( (settingsKeys.contains("inputFrequencyOffset") && (settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset)) + || (settingsKeys.contains("samplesPerBit") && (settings.m_samplesPerBit != m_settings.m_samplesPerBit)) + || force) { int requestedRate = ADS_B_BITS_PER_SECOND * settings.m_samplesPerBit; m_channelizer->setChannelization(requestedRate, settings.m_inputFrequencyOffset); m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset()); } - m_sink.applySettings(settings, force); + m_sink.applySettings(settings, settingsKeys, force); - m_settings = settings; + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } } int ADSBDemodBaseband::getChannelSampleRate() const diff --git a/plugins/channelrx/demodadsb/adsbdemodbaseband.h b/plugins/channelrx/demodadsb/adsbdemodbaseband.h index d54c027b0..bdc63c5f1 100644 --- a/plugins/channelrx/demodadsb/adsbdemodbaseband.h +++ b/plugins/channelrx/demodadsb/adsbdemodbaseband.h @@ -39,20 +39,23 @@ public: public: const ADSBDemodSettings& getSettings() const { return m_settings; } + const QStringList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureADSBDemodBaseband* create(const ADSBDemodSettings& settings, bool force) + static MsgConfigureADSBDemodBaseband* create(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { - return new MsgConfigureADSBDemodBaseband(settings, force); + return new MsgConfigureADSBDemodBaseband(settings, settingsKeys, force); } private: ADSBDemodSettings m_settings; + QStringList m_settingsKeys; bool m_force; - MsgConfigureADSBDemodBaseband(const ADSBDemodSettings& settings, bool force) : + MsgConfigureADSBDemodBaseband(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -80,7 +83,7 @@ private: QRecursiveMutex m_mutex; bool handleMessage(const Message& cmd); - void applySettings(const ADSBDemodSettings& settings, bool force = false); + void applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force = false); private slots: void handleInputMessages(); diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp index 06653e7b4..44129f423 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp @@ -82,35 +82,124 @@ ADSBDemodDisplayDialog::~ADSBDemodDisplayDialog() void ADSBDemodDisplayDialog::accept() { - m_settings->m_removeTimeout = ui->timeout->value(); - m_settings->m_aircraftMinZoom = ui->aircraftMinZoom->value(); - m_settings->m_airportRange = ui->airportRange->value(); - m_settings->m_airportMinimumSize = (ADSBDemodSettings::AirportType)ui->airportSize->currentIndex(); - m_settings->m_displayHeliports = ui->heliports->isChecked(); - m_settings->m_siUnits = ui->units->currentIndex() == 0 ? false : true; - m_settings->m_displayDemodStats = ui->displayStats->isChecked(); - m_settings->m_autoResizeTableColumns = ui->autoResizeTableColumns->isChecked(); - m_settings->m_aviationstackAPIKey = ui->aviationstackAPIKey->text(); - m_settings->m_checkWXAPIKey = ui->checkWXAPIKey->text(); - m_settings->m_airspaces = QStringList(); + if (m_settings->m_removeTimeout != ui->timeout->value()) + { + m_settings->m_removeTimeout = ui->timeout->value(); + m_settingsKeys.append("removeTimeout"); + } + if (m_settings->m_aircraftMinZoom != ui->aircraftMinZoom->value()) + { + m_settings->m_aircraftMinZoom = ui->aircraftMinZoom->value(); + m_settingsKeys.append("aircraftMinZoom"); + } + if (m_settings->m_airportRange != ui->airportRange->value()) + { + m_settings->m_airportRange = ui->airportRange->value(); + m_settingsKeys.append("airportRange"); + } + if (m_settings->m_airportMinimumSize != (ADSBDemodSettings::AirportType)ui->airportSize->currentIndex()) + { + m_settings->m_airportMinimumSize = (ADSBDemodSettings::AirportType)ui->airportSize->currentIndex(); + m_settingsKeys.append("airportMinimumSize"); + } + if (m_settings->m_displayHeliports != ui->heliports->isChecked()) + { + m_settings->m_displayHeliports = ui->heliports->isChecked(); + m_settingsKeys.append("displayHeliports"); + } + if (m_settings->m_siUnits != ui->units->currentIndex() == 0 ? false : true) + { + m_settings->m_siUnits = ui->units->currentIndex() == 0 ? false : true; + m_settingsKeys.append("siUnits"); + } + if (m_settings->m_displayDemodStats != ui->displayStats->isChecked()) + { + m_settings->m_displayDemodStats = ui->displayStats->isChecked(); + m_settingsKeys.append("displayDemodStats"); + } + if (m_settings->m_autoResizeTableColumns != ui->autoResizeTableColumns->isChecked()) + { + m_settings->m_autoResizeTableColumns = ui->autoResizeTableColumns->isChecked(); + m_settingsKeys.append("autoResizeTableColumns"); + } + if (m_settings->m_aviationstackAPIKey != ui->aviationstackAPIKey->text()) + { + m_settings->m_aviationstackAPIKey = ui->aviationstackAPIKey->text(); + m_settingsKeys.append("aviationstackAPIKey"); + } + if (m_settings->m_checkWXAPIKey != ui->checkWXAPIKey->text()) + { + m_settings->m_checkWXAPIKey = ui->checkWXAPIKey->text(); + m_settingsKeys.append("checkWXAPIKey"); + } + QStringList airspaces; for (int i = 0; i < ui->airspaces->count(); i++) { QListWidgetItem *item = ui->airspaces->item(i); if (item->checkState() == Qt::Checked) { - m_settings->m_airspaces.append(item->text()); + airspaces.append(item->text()); } } - m_settings->m_airspaceRange = ui->airspaceRange->value(); - m_settings->m_mapProvider = ui->mapProvider->currentText(); - m_settings->m_mapType = (ADSBDemodSettings::MapType)ui->mapType->currentIndex(); - m_settings->m_displayNavAids = ui->navAids->isChecked(); - m_settings->m_atcCallsigns = ui->atcCallsigns->isChecked(); - m_settings->m_displayPhotos = ui->photos->isChecked(); - m_settings->m_verboseModelMatching = ui->verboseModelMatching->isChecked(); - m_settings->m_airfieldElevation = ui->airfieldElevation->value(); - m_settings->m_transitionAlt = ui->transitionAltitude->value(); - m_settings->m_tableFontName = m_fontName; - m_settings->m_tableFontSize = m_fontSize; + if (m_settings->m_airspaces != airspaces) + { + m_settings->m_airspaces = airspaces; + m_settingsKeys.append("airspaces"); + } + if (m_settings->m_airspaceRange != ui->airspaceRange->value()) + { + m_settings->m_airspaceRange = ui->airspaceRange->value(); + m_settingsKeys.append("airspaceRange"); + } + if (m_settings->m_mapProvider != ui->mapProvider->currentText()) + { + m_settings->m_mapProvider = ui->mapProvider->currentText(); + m_settingsKeys.append("mapProvider"); + } + if (m_settings->m_mapType != (ADSBDemodSettings::MapType)ui->mapType->currentIndex()) + { + m_settings->m_mapType = (ADSBDemodSettings::MapType)ui->mapType->currentIndex(); + m_settingsKeys.append("mapType"); + } + if (m_settings->m_displayNavAids != ui->navAids->isChecked()) + { + m_settings->m_displayNavAids = ui->navAids->isChecked(); + m_settingsKeys.append("displayNavAids"); + } + if (m_settings->m_atcCallsigns != ui->atcCallsigns->isChecked()) + { + m_settings->m_atcCallsigns = ui->atcCallsigns->isChecked(); + m_settingsKeys.append("atcCallsigns"); + } + if (m_settings->m_displayPhotos != ui->photos->isChecked()) + { + m_settings->m_displayPhotos = ui->photos->isChecked(); + m_settingsKeys.append("displayPhotos"); + } + if (m_settings->m_verboseModelMatching != ui->verboseModelMatching->isChecked()) + { + m_settings->m_verboseModelMatching = ui->verboseModelMatching->isChecked(); + m_settingsKeys.append("verboseModelMatching"); + } + if (m_settings->m_airfieldElevation != ui->airfieldElevation->value()) + { + m_settings->m_airfieldElevation = ui->airfieldElevation->value(); + m_settingsKeys.append("airfieldElevation"); + } + if (m_settings->m_transitionAlt != ui->transitionAltitude->value()) + { + m_settings->m_transitionAlt = ui->transitionAltitude->value(); + m_settingsKeys.append("transitionAlt"); + } + if (m_settings->m_tableFontName != m_fontName) + { + m_settings->m_tableFontName = m_fontName; + m_settingsKeys.append("tableFontName"); + } + if (m_settings->m_tableFontSize != m_fontSize) + { + m_settings->m_tableFontSize = m_fontSize; + m_settingsKeys.append("tableFontSize"); + } QDialog::accept(); } diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h index d83b6bc70..fbb461fca 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h @@ -28,6 +28,8 @@ public: explicit ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWidget* parent = 0); ~ADSBDemodDisplayDialog(); + const QStringList& getSettingsKeys() const { return m_settingsKeys; }; + private slots: void accept(); void on_font_clicked(); @@ -35,6 +37,7 @@ private slots: private: Ui::ADSBDemodDisplayDialog* ui; ADSBDemodSettings *m_settings; + QStringList m_settingsKeys; QString m_fontName; int m_fontSize; }; diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index 2db523921..aab087585 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -146,8 +146,8 @@ void ADSBDemodGUI::destroy() void ADSBDemodGUI::resetToDefaults() { m_settings.resetToDefaults(); - displaySettings(); - applySettings(); + displaySettings(QStringList(), true); + applyAllSettings(); } QByteArray ADSBDemodGUI::serialize() const @@ -160,8 +160,8 @@ bool ADSBDemodGUI::deserialize(const QByteArray& data) if(m_settings.deserialize(data)) { updateChannelList(); - displaySettings(); - applySettings(true); + displaySettings(QStringList(), true); + applyAllSettings(); return true; } else @@ -3471,10 +3471,19 @@ bool ADSBDemodGUI::handleMessage(const Message& message) { qDebug("ADSBDemodGUI::handleMessage: ADSBDemod::MsgConfigureADSBDemod"); const ADSBDemod::MsgConfigureADSBDemod& cfg = (ADSBDemod::MsgConfigureADSBDemod&) message; - m_settings = cfg.getSettings(); + const ADSBDemodSettings settings = cfg.getSettings(); + const QStringList settingsKeys = cfg.getSettingsKeys(); + bool force = cfg.getForce(); + + if (force) { + m_settings = cfg.getSettings(); + } else { + m_settings.applySettings(settingsKeys, settings); + } + blockApplySettings(true); m_channelMarker.updateSettings(static_cast(m_settings.m_channelMarker)); - displaySettings(); + displaySettings(settingsKeys, force); blockApplySettings(false); return true; } @@ -3499,7 +3508,7 @@ void ADSBDemodGUI::channelMarkerChangedByCursor() { ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); - applySettings(); + applySetting("inputFrequencyOffset"); } void ADSBDemodGUI::channelMarkerHighlightedByCursor() @@ -3512,7 +3521,7 @@ void ADSBDemodGUI::on_deltaFrequency_changed(qint64 value) m_channelMarker.setCenterFrequency(value); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); updateAbsoluteCenterFrequency(); - applySettings(); + applySetting("inputFrequencyOffset"); } void ADSBDemodGUI::on_rfBW_valueChanged(int value) @@ -3521,7 +3530,7 @@ void ADSBDemodGUI::on_rfBW_valueChanged(int value) ui->rfBWText->setText(QString("%1M").arg(bw / 1000000.0, 0, 'f', 1)); m_channelMarker.setBandwidth(bw); m_settings.m_rfBandwidth = bw; - applySettings(); + applySetting("rfBandwidth"); } void ADSBDemodGUI::on_threshold_valueChanged(int value) @@ -3529,14 +3538,14 @@ void ADSBDemodGUI::on_threshold_valueChanged(int value) Real thresholddB = ((Real)value)/10.0f; ui->thresholdText->setText(QString("%1").arg(thresholddB, 0, 'f', 1)); m_settings.m_correlationThreshold = thresholddB; - applySettings(); + applySetting("correlationThreshold"); } void ADSBDemodGUI::on_phaseSteps_valueChanged(int value) { ui->phaseStepsText->setText(QString("%1").arg(value)); m_settings.m_interpolatorPhaseSteps = value; - applySettings(); + applySetting("interpolatorPhaseSteps"); } void ADSBDemodGUI::on_tapsPerPhase_valueChanged(int value) @@ -3544,14 +3553,14 @@ void ADSBDemodGUI::on_tapsPerPhase_valueChanged(int value) Real tapsPerPhase = ((Real)value)/10.0f; ui->tapsPerPhaseText->setText(QString("%1").arg(tapsPerPhase, 0, 'f', 1)); m_settings.m_interpolatorTapsPerPhase = tapsPerPhase; - applySettings(); + applySetting("interpolatorTapsPerPhase"); } void ADSBDemodGUI::on_feed_clicked(bool checked) { m_settings.m_feedEnabled = checked; // Don't disable host/port - so they can be entered before connecting - applySettings(); + applySetting("feedEnabled"); applyImportSettings(); } @@ -3561,7 +3570,7 @@ void ADSBDemodGUI::on_notifications_clicked() if (dialog.exec() == QDialog::Accepted) { enableSpeechIfNeeded(); - applySettings(); + applySetting("notificationSettings"); } } @@ -3829,19 +3838,19 @@ QAction *ADSBDemodGUI::createCheckableItem(QString &text, int idx, bool checked) void ADSBDemodGUI::on_spb_currentIndexChanged(int value) { m_settings.m_samplesPerBit = (value + 1) * 2; - applySettings(); + applySetting("samplesPerBi"); } void ADSBDemodGUI::on_correlateFullPreamble_clicked(bool checked) { m_settings.m_correlateFullPreamble = checked; - applySettings(); + applySetting("correlateFullPreamble"); } void ADSBDemodGUI::on_demodModeS_clicked(bool checked) { m_settings.m_demodModeS = checked; - applySettings(); + applySetting("demodModeS"); } void ADSBDemodGUI::on_getOSNDB_clicked() @@ -3897,7 +3906,7 @@ void ADSBDemodGUI::on_atcLabels_clicked(bool checked) { m_settings.m_atcLabels = checked; m_aircraftModel.setSettings(&m_settings); - applySettings(); + applySetting("atcLabels"); } QString ADSBDemodGUI::getDataDir() @@ -3914,7 +3923,7 @@ void ADSBDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) (void) rollDown; getRollupContents()->saveState(m_rollupState); - applySettings(); + applySetting("rollupState"); } void ADSBDemodGUI::onMenuDialogCalled(const QPoint &p) @@ -3951,6 +3960,16 @@ void ADSBDemodGUI::onMenuDialogCalled(const QPoint &p) setTitle(m_channelMarker.getTitle()); setTitleColor(m_settings.m_rgbColor); + QStringList settingsKeys({ + "rgbColor", + "title", + "useReverseAPI", + "reverseAPIAddress", + "reverseAPIPort", + "reverseAPIDeviceIndex", + "reverseAPIChannelIndex" + }); + if (m_deviceUISet->m_deviceMIMOEngine) { m_settings.m_streamIndex = dialog.getSelectedStreamIndex(); @@ -3959,7 +3978,7 @@ void ADSBDemodGUI::onMenuDialogCalled(const QPoint &p) updateIndexLabel(); } - applySettings(); + applySettings(settingsKeys); } resetContextMenuType(); @@ -4000,7 +4019,7 @@ void ADSBDemodGUI::on_amDemod_currentIndexChanged(int index) if (index >= 0) { m_settings.m_amDemod = ui->amDemod->currentText(); - applySettings(); + applySetting("amDemod"); } } @@ -4687,7 +4706,24 @@ void ADSBDemodGUI::feedSelect(const QPoint& p) if (dialog.exec() == QDialog::Accepted) { - applySettings(); + applySettings({ + "exportClientEnabled", + "exportClientHost", + "exportClientPort", + "exportClientFormat", + "exportServerEnabled", + "exportServerPort", + "importEnabled", + "importHost", + "importUsername", + "importPassword", + "importParameters", + "importPeriod", + "importMinLatitude", + "importMaxLatitude", + "importMinLongitude", + "importMaxLongitude" + }); applyImportSettings(); } } @@ -4704,8 +4740,8 @@ void ADSBDemodGUI::on_displaySettings_clicked() if (unitsChanged) { m_aircraftModel.allAircraftUpdated(); } - displaySettings(); - applySettings(); + displaySettings(dialog.getSettingsKeys(), false); + applySettings(dialog.getSettingsKeys()); } } @@ -5055,9 +5091,9 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb connect(MainCore::instance(), &MainCore::channelRemoved, this, &ADSBDemodGUI::updateChannelList); updateChannelList(); - displaySettings(); + displaySettings(QStringList(), true); makeUIConnections(); - applySettings(true); + applyAllSettings(); connect(&m_importTimer, &QTimer::timeout, this, &ADSBDemodGUI::import); m_networkManager = new QNetworkAccessManager(); @@ -5111,18 +5147,30 @@ ADSBDemodGUI::~ADSBDemodGUI() delete m_networkManager; } -void ADSBDemodGUI::applySettings(bool force) +void ADSBDemodGUI::applySetting(const QString& settingsKey) { + applySettings({settingsKey}); +} + +void ADSBDemodGUI::applySettings(const QStringList& settingsKeys, bool force) +{ + m_settingsKeys.append(settingsKeys); if (m_doApplySettings) { qDebug() << "ADSBDemodGUI::applySettings"; - ADSBDemod::MsgConfigureADSBDemod* message = ADSBDemod::MsgConfigureADSBDemod::create(m_settings, force); + ADSBDemod::MsgConfigureADSBDemod* message = ADSBDemod::MsgConfigureADSBDemod::create(m_settings, m_settingsKeys, force); m_adsbDemod->getInputMessageQueue()->push(message); } } -void ADSBDemodGUI::displaySettings() +void ADSBDemodGUI::applyAllSettings() +{ + applySettings(QStringList(), true); +} + +// All settings are valid - we just use settingsKeys here to avoid updating things that are slow to update +void ADSBDemodGUI::displaySettings(const QStringList& settingsKeys, bool force) { m_channelMarker.blockSignals(true); m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); @@ -5175,74 +5223,104 @@ void ADSBDemodGUI::displaySettings() updateIndexLabel(); - QFont font(m_settings.m_tableFontName, m_settings.m_tableFontSize); - ui->adsbData->setFont(font); + if (settingsKeys.contains("tableFontName") || settingsKeys.contains("tableFontSize") || force) + { + QFont font(m_settings.m_tableFontName, m_settings.m_tableFontSize); + ui->adsbData->setFont(font); + } // Set units in column headers - if (m_settings.m_siUnits) + if (settingsKeys.contains("siUnits") || force) { - ui->adsbData->horizontalHeaderItem(ADSB_COL_ALTITUDE)->setText("Alt (m)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_VERTICALRATE)->setText("VR (m/s)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_SEL_ALTITUDE)->setText("Sel Alt (m)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_GROUND_SPEED)->setText("GS (kph)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_TRUE_AIRSPEED)->setText("TAS (kph)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_INDICATED_AIRSPEED)->setText("IAS (kph)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_HEADWIND)->setText("H Wnd (kph)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_WIND_SPEED)->setText("Wnd (kph)"); - } - else - { - ui->adsbData->horizontalHeaderItem(ADSB_COL_ALTITUDE)->setText("Alt (ft)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_VERTICALRATE)->setText("VR (ft/m)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_SEL_ALTITUDE)->setText("Sel Alt (ft)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_GROUND_SPEED)->setText("GS (kn)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_TRUE_AIRSPEED)->setText("TAS (kn)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_INDICATED_AIRSPEED)->setText("IAS (kn)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_HEADWIND)->setText("H Wnd (kn)"); - ui->adsbData->horizontalHeaderItem(ADSB_COL_WIND_SPEED)->setText("Wnd (kn)"); + if (m_settings.m_siUnits) + { + ui->adsbData->horizontalHeaderItem(ADSB_COL_ALTITUDE)->setText("Alt (m)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_VERTICALRATE)->setText("VR (m/s)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_SEL_ALTITUDE)->setText("Sel Alt (m)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_GROUND_SPEED)->setText("GS (kph)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_TRUE_AIRSPEED)->setText("TAS (kph)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_INDICATED_AIRSPEED)->setText("IAS (kph)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_HEADWIND)->setText("H Wnd (kph)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_WIND_SPEED)->setText("Wnd (kph)"); + } + else + { + ui->adsbData->horizontalHeaderItem(ADSB_COL_ALTITUDE)->setText("Alt (ft)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_VERTICALRATE)->setText("VR (ft/m)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_SEL_ALTITUDE)->setText("Sel Alt (ft)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_GROUND_SPEED)->setText("GS (kn)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_TRUE_AIRSPEED)->setText("TAS (kn)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_INDICATED_AIRSPEED)->setText("IAS (kn)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_HEADWIND)->setText("H Wnd (kn)"); + ui->adsbData->horizontalHeaderItem(ADSB_COL_WIND_SPEED)->setText("Wnd (kn)"); + } } // Order and size columns - QHeaderView *header = ui->adsbData->horizontalHeader(); - for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) + if (settingsKeys.contains("columnSizes") || settingsKeys.contains("columnIndexes") || force) { - bool hidden = m_settings.m_columnSizes[i] == 0; - header->setSectionHidden(i, hidden); - menu->actions().at(i)->setChecked(!hidden); - if (m_settings.m_columnSizes[i] > 0) - ui->adsbData->setColumnWidth(i, m_settings.m_columnSizes[i]); - header->moveSection(header->visualIndex(i), m_settings.m_columnIndexes[i]); + QHeaderView* header = ui->adsbData->horizontalHeader(); + for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) + { + bool hidden = m_settings.m_columnSizes[i] == 0; + header->setSectionHidden(i, hidden); + menu->actions().at(i)->setChecked(!hidden); + if (m_settings.m_columnSizes[i] > 0) + ui->adsbData->setColumnWidth(i, m_settings.m_columnSizes[i]); + header->moveSection(header->visualIndex(i), m_settings.m_columnIndexes[i]); + } } // Only update airports on map if settings have changed if ((m_airportInfo != nullptr) - && ((m_settings.m_airportRange != m_currentAirportRange) - || (m_settings.m_airportMinimumSize != m_currentAirportMinimumSize) - || (m_settings.m_displayHeliports != m_currentDisplayHeliports))) + && (((settingsKeys.contains("airportRange") || force) && (m_settings.m_airportRange != m_currentAirportRange)) + || ((settingsKeys.contains("airportMinimumSize") || force) && (m_settings.m_airportMinimumSize != m_currentAirportMinimumSize)) + || ((settingsKeys.contains("displayHeliports") || force) && (m_settings.m_displayHeliports != m_currentDisplayHeliports)))) { updateAirports(); + } - updateAirspaces(); - updateNavAids(); + if (settingsKeys.contains("airspaces") || force) { + updateAirspaces(); + } + if (settingsKeys.contains("displayNavAids") || settingsKeys.contains("airspaceRange") || force) { + updateNavAids(); + } if (!m_settings.m_displayDemodStats) ui->stats->setText(""); - initFlightInformation(); - initAviationWeather(); + if (settingsKeys.contains("aviationstackAPIKey") || force) { + initFlightInformation(); + } + if (settingsKeys.contains("checkWXAPIKey") || force) { + initAviationWeather(); + } - applyImportSettings(); + if (settingsKeys.contains("importPeriod") + || settingsKeys.contains("feedEnabled") + || settingsKeys.contains("importEnabled") + || force) { + applyImportSettings(); + } getRollupContents()->restoreState(m_rollupState); blockApplySettings(false); enableSpeechIfNeeded(); + + if (settingsKeys.contains("mapProvider") + || settingsKeys.contains("aircraftMinZoom") + || settingsKeys.contains("mapType") + || force) + { #ifdef __EMSCRIPTEN__ - // FIXME: If we don't have this delay, tile server requests get deleted - QTimer::singleShot(250, [this] { - applyMapSettings(); - }); + // FIXME: If we don't have this delay, tile server requests get deleted + QTimer::singleShot(250, [this] { + applyMapSettings(); + }); #else - applyMapSettings(); + applyMapSettings(); #endif + } } void ADSBDemodGUI::leaveEvent(QEvent* event) @@ -5536,7 +5614,7 @@ void ADSBDemodGUI::photoClicked() void ADSBDemodGUI::on_logEnable_clicked(bool checked) { m_settings.m_logEnabled = checked; - applySettings(); + applySetting("logEnabled"); } void ADSBDemodGUI::on_logFilename_clicked() @@ -5551,7 +5629,7 @@ void ADSBDemodGUI::on_logFilename_clicked() { m_settings.m_logFilename = fileNames[0]; ui->logFilename->setToolTip(QString(".csv log filename: %1").arg(m_settings.m_logFilename)); - applySettings(); + applySetting("logFilename"); } } } diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.h b/plugins/channelrx/demodadsb/adsbdemodgui.h index 89793713e..9957f3c57 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.h +++ b/plugins/channelrx/demodadsb/adsbdemodgui.h @@ -811,7 +811,7 @@ public: { m_aircraftRegExp.optimize(); } - + virtual ~ModelMatch() = default; virtual bool match(const QString &aircraft, const QString &manufacturer, QString &model) @@ -911,6 +911,7 @@ private: ChannelMarker m_channelMarker; RollupState m_rollupState; ADSBDemodSettings m_settings; + QStringList m_settingsKeys; qint64 m_deviceCenterFrequency; int m_basebandSampleRate; bool m_basicSettingsShown; @@ -981,8 +982,10 @@ private: virtual ~ADSBDemodGUI(); void blockApplySettings(bool block); - void applySettings(bool force = false); - void displaySettings(); + void applySetting(const QString& settingsKey); + void applySettings(const QStringList& settingsKeys, bool force = false); + void applyAllSettings(); + void displaySettings(const QStringList& settingsKeys, bool force); bool handleMessage(const Message& message); void makeUIConnections(); void updateAbsoluteCenterFrequency(); diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp index e7dfa9ac2..c8aac3be6 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp @@ -401,3 +401,375 @@ void ADSBDemodSettings::NotificationSettings::updateRegularExpression() qDebug() << "ADSBDemod: Regular expression is not valid: " << m_regExp; } } + +void ADSBDemodSettings::applySettings(const QStringList& settingsKeys, const ADSBDemodSettings& settings) +{ + if (settingsKeys.contains("inputFrequencyOffset")) { + m_inputFrequencyOffset = settings.m_inputFrequencyOffset; + } + if (settingsKeys.contains("rfBandwidth")) { + m_rfBandwidth = settings.m_rfBandwidth; + } + if (settingsKeys.contains("correlationThreshold")) { + m_correlationThreshold = settings.m_correlationThreshold; + } + if (settingsKeys.contains("samplesPerBit")) { + m_samplesPerBit = settings.m_samplesPerBit; + } + if (settingsKeys.contains("removeTimeout")) { + m_removeTimeout = settings.m_removeTimeout; + } + if (settingsKeys.contains("feedEnabled")) { + m_feedEnabled = settings.m_feedEnabled; + } + if (settingsKeys.contains("exportClientEnabled")) { + m_exportClientEnabled = settings.m_exportClientEnabled; + } + if (settingsKeys.contains("exportClientHost")) { + m_exportClientHost = settings.m_exportClientHost; + } + if (settingsKeys.contains("exportClientPort")) { + m_exportClientPort = settings.m_exportClientPort; + } + if (settingsKeys.contains("exportClientFormat")) { + m_exportClientFormat = settings.m_exportClientFormat; + } + if (settingsKeys.contains("exportServerEnabled")) { + m_exportServerEnabled = settings.m_exportServerEnabled; + } + if (settingsKeys.contains("exportServerPort")) { + m_exportServerPort = settings.m_exportServerPort; + } + if (settingsKeys.contains("importEnabled")) { + m_importEnabled = settings.m_importEnabled; + } + if (settingsKeys.contains("importHost")) { + m_importHost = settings.m_importHost; + } + if (settingsKeys.contains("importUsername")) { + m_importUsername = settings.m_importUsername; + } + if (settingsKeys.contains("importPassword")) { + m_importPassword = settings.m_importPassword; + } + if (settingsKeys.contains("importParameters")) { + m_importParameters = settings.m_importParameters; + } + if (settingsKeys.contains("importPeriod")) { + m_importPeriod = settings.m_importPeriod; + } + if (settingsKeys.contains("importMinLatitude")) { + m_importMinLatitude = settings.m_importMinLatitude; + } + if (settingsKeys.contains("importMaxLatitude")) { + m_importMaxLatitude = settings.m_importMaxLatitude; + } + if (settingsKeys.contains("importMinLongitude")) { + m_importMinLongitude = settings.m_importMinLongitude; + } + if (settingsKeys.contains("importMaxLongitude")) { + m_importMaxLongitude = settings.m_importMaxLongitude; + } + if (settingsKeys.contains("rgbColor")) { + m_rgbColor = settings.m_rgbColor; + } + if (settingsKeys.contains("title")) { + m_title = settings.m_title; + } + 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; + } + if (settingsKeys.contains("columnIndexes")) { + std::copy(std::begin(settings.m_columnIndexes), std::end(settings.m_columnIndexes), std::begin(m_columnIndexes)); + } + if (settingsKeys.contains("columnSizes")) { + std::copy(std::begin(settings.m_columnSizes), std::end(settings.m_columnIndexes), std::begin(m_columnSizes)); + } + if (settingsKeys.contains("airportRange")) { + m_airportRange = settings.m_airportRange; + } + if (settingsKeys.contains("airportMinimumSize")) { + m_airportMinimumSize = settings.m_airportMinimumSize; + } + if (settingsKeys.contains("displayHeliports")) { + m_displayHeliports = settings.m_displayHeliports; + } + if (settingsKeys.contains("flightPaths")) { + m_flightPaths = settings.m_flightPaths; + } + if (settingsKeys.contains("allFlightPaths")) { + m_allFlightPaths = settings.m_allFlightPaths; + } + if (settingsKeys.contains("siUnits")) { + m_siUnits = settings.m_siUnits; + } + if (settingsKeys.contains("tableFontName")) { + m_tableFontName = settings.m_tableFontName; + } + if (settingsKeys.contains("tableFontSize")) { + m_tableFontSize = settings.m_tableFontSize; + } + if (settingsKeys.contains("displayDemodStats")) { + m_displayDemodStats = settings.m_displayDemodStats; + } + if (settingsKeys.contains("correlateFullPreamble")) { + m_correlateFullPreamble = settings.m_correlateFullPreamble; + } + if (settingsKeys.contains("demodModeS")) { + m_demodModeS = settings.m_demodModeS; + } + if (settingsKeys.contains("amDemod")) { + m_amDemod = settings.m_amDemod; + } + if (settingsKeys.contains("autoResizeTableColumns")) { + m_autoResizeTableColumns = settings.m_autoResizeTableColumns; + } + if (settingsKeys.contains("interpolatorPhaseSteps")) { + m_interpolatorPhaseSteps = settings.m_interpolatorPhaseSteps; + } + if (settingsKeys.contains("interpolatorTapsPerPhase")) { + m_interpolatorTapsPerPhase = settings.m_interpolatorTapsPerPhase; + } + if (settingsKeys.contains("notificationSettings")) { + m_notificationSettings = settings.m_notificationSettings; + } + if (settingsKeys.contains("aviationstackAPIKey")) { + m_aviationstackAPIKey = settings.m_aviationstackAPIKey; + } + if (settingsKeys.contains("checkWXAPIKey")) { + m_checkWXAPIKey = settings.m_checkWXAPIKey; + } + if (settingsKeys.contains("logFilename")) { + m_logFilename = settings.m_logFilename; + } + if (settingsKeys.contains("logEnabled")) { + m_logEnabled = settings.m_logEnabled; + } + if (settingsKeys.contains("airspaces")) { + m_airspaces = settings.m_airspaces; + } + if (settingsKeys.contains("airspaceRange")) { + m_airspaceRange = settings.m_airspaceRange; + } + if (settingsKeys.contains("mapProvider")) { + m_mapProvider = settings.m_mapProvider; + } + if (settingsKeys.contains("mapType")) { + m_mapType = settings.m_mapType; + } + if (settingsKeys.contains("displayNavAids")) { + m_displayNavAids = settings.m_displayNavAids; + } + if (settingsKeys.contains("displayPhotos")) { + m_displayPhotos = settings.m_displayPhotos; + } + if (settingsKeys.contains("verboseModelMatching")) { + m_verboseModelMatching = settings.m_verboseModelMatching; + } + if (settingsKeys.contains("airfieldElevation")) { + m_airfieldElevation = settings.m_airfieldElevation; + } + if (settingsKeys.contains("aircraftMinZoom")) { + m_aircraftMinZoom = settings.m_aircraftMinZoom; + } + if (settingsKeys.contains("atcLabels")) { + m_atcLabels = settings.m_atcLabels; + } + if (settingsKeys.contains("atcCallsigns")) { + m_atcCallsigns = settings.m_atcCallsigns; + } + if (settingsKeys.contains("transitionAlt")) { + m_transitionAlt = settings.m_transitionAlt; + } +} + +QString ADSBDemodSettings::getDebugString(const QStringList& settingsKeys, bool force) const +{ + std::ostringstream ostr; + + if (settingsKeys.contains("inputFrequencyOffset") || force) { + ostr << " m_inputFrequencyOffset: " << m_inputFrequencyOffset; + } + if (settingsKeys.contains("rfBandwidth") || force) { + ostr << " m_rfBandwidth: " << m_rfBandwidth; + } + if (settingsKeys.contains("correlationThreshold") || force) { + ostr << " m_correlationThreshold: " << m_correlationThreshold; + } + if (settingsKeys.contains("samplesPerBit") || force) { + ostr << " m_samplesPerBit: " << m_samplesPerBit; + } + if (settingsKeys.contains("removeTimeout") || force) { + ostr << " m_removeTimeout: " << m_removeTimeout; + } + if (settingsKeys.contains("feedEnabled") || force) { + ostr << " m_feedEnabled: " << m_feedEnabled; + } + if (settingsKeys.contains("exportClientEnabled") || force) { + ostr << " m_exportClientEnabled: " << m_exportClientEnabled; + } + if (settingsKeys.contains("exportClientHost") || force) { + ostr << " m_exportClientHost: " << m_exportClientHost.toStdString(); + } + if (settingsKeys.contains("exportClientPort") || force) { + ostr << " m_exportClientPort: " << m_exportClientPort; + } + if (settingsKeys.contains("exportClientFormat") || force) { + ostr << " m_exportClientFormat: " << m_exportClientFormat; + } + if (settingsKeys.contains("exportServerEnabled") || force) { + ostr << " m_exportServerEnabled: " << m_exportServerEnabled; + } + if (settingsKeys.contains("exportServerPort") || force) { + ostr << " m_exportServerPort: " << m_exportServerPort; + } + if (settingsKeys.contains("importEnabled") || force) { + ostr << " m_importEnabled: " << m_importEnabled; + } + if (settingsKeys.contains("importHost") || force) { + ostr << " m_importHost: " << m_importHost.toStdString(); + } + if (settingsKeys.contains("importUsername") || force) { + ostr << " m_importUsername: " << m_importUsername.toStdString(); + } + if (settingsKeys.contains("importPassword") || force) { + ostr << " m_importPassword: " << m_importPassword.toStdString(); + } + if (settingsKeys.contains("importParameters") || force) { + ostr << " m_importParameters: " << m_importParameters.toStdString(); + } + if (settingsKeys.contains("importPeriod") || force) { + ostr << " m_importPeriod: " << m_importPeriod; + } + if (settingsKeys.contains("importMinLatitude") || force) { + ostr << " m_importMinLatitude: " << m_importMinLatitude.toStdString(); + } + if (settingsKeys.contains("importMaxLatitude") || force) { + ostr << " m_importMaxLatitude: " << m_importMaxLatitude.toStdString(); + } + if (settingsKeys.contains("importMinLongitude") || force) { + ostr << " m_importMinLongitude: " << m_importMinLongitude.toStdString(); + } + if (settingsKeys.contains("importMaxLongitude") || force) { + ostr << " m_importMaxLongitude: " << m_importMaxLongitude.toStdString(); + } + if (settingsKeys.contains("title") || force) { + ostr << " m_title: " << m_title.toStdString(); + } + 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; + } + if (settingsKeys.contains("airportRange") || force) { + ostr << " m_airportRange: " << m_airportRange; + } + if (settingsKeys.contains("airportMinimumSize") || force) { + ostr << " m_airportMinimumSize: " << m_airportMinimumSize; + } + if (settingsKeys.contains("displayHeliports") || force) { + ostr << " m_displayHeliports: " << m_displayHeliports; + } + if (settingsKeys.contains("flightPaths") || force) { + ostr << " m_flightPaths: " << m_flightPaths; + } + if (settingsKeys.contains("allFlightPaths") || force) { + ostr << " m_allFlightPaths: " << m_allFlightPaths; + } + if (settingsKeys.contains("siUnits") || force) { + ostr << " m_siUnits: " << m_siUnits; + } + if (settingsKeys.contains("tableFontName") || force) { + ostr << " m_tableFontName: " << m_tableFontName.toStdString(); + } + if (settingsKeys.contains("tableFontSize") || force) { + ostr << " m_tableFontSize: " << m_tableFontSize; + } + if (settingsKeys.contains("displayDemodStats") || force) { + ostr << " m_displayDemodStats: " << m_displayDemodStats; + } + if (settingsKeys.contains("correlateFullPreamble") || force) { + ostr << " m_correlateFullPreamble: " << m_correlateFullPreamble; + } + if (settingsKeys.contains("demodModeS") || force) { + ostr << " m_demodModeS: " << m_demodModeS; + } + if (settingsKeys.contains("amDemod") || force) { + ostr << " m_amDemod: " << m_amDemod.toStdString(); + } + if (settingsKeys.contains("autoResizeTableColumns") || force) { + ostr << " m_autoResizeTableColumns: " << m_autoResizeTableColumns; + } + if (settingsKeys.contains("interpolatorPhaseSteps") || force) { + ostr << " m_interpolatorPhaseSteps: " << m_interpolatorPhaseSteps; + } + if (settingsKeys.contains("notificationSettings") || force) { + //ostr << " m_notificationSettings: " << m_notificationSettings.join(",").toStdString(); + } + if (settingsKeys.contains("aviationstackAPIKey") || force) { + ostr << " m_aviationstackAPIKey: " << m_aviationstackAPIKey.toStdString(); + } + if (settingsKeys.contains("checkWXAPIKey") || force) { + ostr << " m_checkWXAPIKey: " << m_checkWXAPIKey.toStdString(); + } + if (settingsKeys.contains("logFilename") || force) { + ostr << " m_logFilename: " << m_logFilename.toStdString(); + } + if (settingsKeys.contains("logEnabled") || force) { + ostr << " m_logEnabled: " << m_logEnabled; + } + if (settingsKeys.contains("airspaces") || force) { + ostr << " m_airspaces: " << m_airspaces.join(",").toStdString(); + } + if (settingsKeys.contains("airspaceRange") || force) { + ostr << " m_airspaceRange: " << m_airspaceRange; + } + if (settingsKeys.contains("mapProvider") || force) { + ostr << " m_mapProvider: " << m_mapProvider.toStdString(); + } + if (settingsKeys.contains("mapType") || force) { + ostr << " m_mapType: " << m_mapType; + } + if (settingsKeys.contains("displayNavAids") || force) { + ostr << " m_displayNavAids: " << m_displayNavAids; + } + if (settingsKeys.contains("displayPhotos") || force) { + ostr << " m_displayPhotos: " << m_displayPhotos; + } + if (settingsKeys.contains("verboseModelMatching") || force) { + ostr << " m_verboseModelMatching: " << m_verboseModelMatching; + } + if (settingsKeys.contains("airfieldElevation") || force) { + ostr << " m_airfieldElevation: " << m_airfieldElevation; + } + if (settingsKeys.contains("aircraftMinZoom") || force) { + ostr << " m_aircraftMinZoom: " << m_aircraftMinZoom; + } + if (settingsKeys.contains("atcLabels") || force) { + ostr << " m_atcLabels: " << m_atcLabels; + } + if (settingsKeys.contains("atcCallsigns") || force) { + ostr << " m_atcCallsigns: " << m_atcCallsigns; + } + if (settingsKeys.contains("transitionAlt") || force) { + ostr << " m_transitionAlt: " << m_transitionAlt; + } + + return QString(ostr.str().c_str()); +} diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.h b/plugins/channelrx/demodadsb/adsbdemodsettings.h index 5187ea3da..b7909d816 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.h +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.h @@ -201,6 +201,8 @@ struct ADSBDemodSettings bool deserialize(const QByteArray& data); QByteArray serializeNotificationSettings(QList notificationSettings) const; void deserializeNotificationSettings(const QByteArray& data, QList& notificationSettings); + void applySettings(const QStringList& settingsKeys, const ADSBDemodSettings& settings); + QString getDebugString(const QStringList& settingsKeys, bool force = false) const; }; #endif /* PLUGINS_CHANNELRX_DEMODADSB_ADSBDEMODSETTINGS_H_ */ diff --git a/plugins/channelrx/demodadsb/adsbdemodsink.cpp b/plugins/channelrx/demodadsb/adsbdemodsink.cpp index 6b9da6eae..e4792392d 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsink.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsink.cpp @@ -37,7 +37,7 @@ ADSBDemodSink::ADSBDemodSink() : m_magsqCount(0), m_messageQueueToGUI(nullptr) { - applySettings(m_settings, true); + applySettings(m_settings, QStringList(), true); applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true); for (int i = 0; i < m_buffers; i++) m_bufferWrite[i].release(1); @@ -247,7 +247,7 @@ void ADSBDemodSink::applyChannelSettings(int channelSampleRate, int channelFrequ m_channelFrequencyOffset = channelFrequencyOffset; } -void ADSBDemodSink::applySettings(const ADSBDemodSettings& settings, bool force) +void ADSBDemodSink::applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { qDebug() << "ADSBDemodSink::applySettings:" << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset @@ -258,26 +258,30 @@ void ADSBDemodSink::applySettings(const ADSBDemodSettings& settings, bool force) << " m_samplesPerBit: " << settings.m_samplesPerBit << " force: " << force; - if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) - || (settings.m_samplesPerBit != m_settings.m_samplesPerBit) - || (settings.m_interpolatorPhaseSteps != m_settings.m_interpolatorPhaseSteps) - || (settings.m_interpolatorTapsPerPhase != m_settings.m_interpolatorTapsPerPhase) + if ((settingsKeys.contains("rfBandwidth") && (settings.m_rfBandwidth != m_settings.m_rfBandwidth)) + || (settingsKeys.contains("samplesPerBit") && (settings.m_samplesPerBit != m_settings.m_samplesPerBit)) + || (settingsKeys.contains("interpolatorPhaseSteps") && (settings.m_interpolatorPhaseSteps != m_settings.m_interpolatorPhaseSteps)) + || (settingsKeys.contains("interpolatorTapsPerPhase") && (settings.m_interpolatorTapsPerPhase != m_settings.m_interpolatorTapsPerPhase)) || force) { m_interpolator.create(m_settings.m_interpolatorPhaseSteps, m_channelSampleRate, settings.m_rfBandwidth / 2.2, m_settings.m_interpolatorTapsPerPhase); m_interpolatorDistanceRemain = 0; - m_interpolatorDistance = (Real) m_channelSampleRate / (Real) (ADS_B_BITS_PER_SECOND * settings.m_samplesPerBit); + m_interpolatorDistance = (Real) m_channelSampleRate / (Real) (ADS_B_BITS_PER_SECOND * settings.m_samplesPerBit); } - if ((settings.m_samplesPerBit != m_settings.m_samplesPerBit) || force) + if ((settingsKeys.contains("samplesPerBit") && (settings.m_samplesPerBit != m_settings.m_samplesPerBit)) || force) { init(settings.m_samplesPerBit); } // Forward to worker ADSBDemodSinkWorker::MsgConfigureADSBDemodSinkWorker *msg = ADSBDemodSinkWorker::MsgConfigureADSBDemodSinkWorker::create( - settings, force); + settings, settingsKeys, force); m_worker.getInputMessageQueue()->push(msg); - m_settings = settings; + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } } diff --git a/plugins/channelrx/demodadsb/adsbdemodsink.h b/plugins/channelrx/demodadsb/adsbdemodsink.h index 82f28db01..163a857ee 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsink.h +++ b/plugins/channelrx/demodadsb/adsbdemodsink.h @@ -55,7 +55,7 @@ public: } void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false); - void applySettings(const ADSBDemodSettings& settings, bool force = false); + void applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force = false); void setMessageQueueToGUI(MessageQueue *messageQueue) { m_messageQueueToGUI = messageQueue; } void setMessageQueueToWorker(MessageQueue *messageQueue) { m_messageQueueToWorker = messageQueue; } void startWorker(); diff --git a/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp b/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp index 4a6060a76..1157eb743 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp @@ -357,22 +357,30 @@ void ADSBDemodSinkWorker::handleInputMessages() MsgConfigureADSBDemodSinkWorker* cfg = (MsgConfigureADSBDemodSinkWorker*)message; ADSBDemodSettings settings = cfg->getSettings(); + QStringList settingsKeys = cfg->getSettingsKeys(); bool force = cfg->getForce(); - if (settings.m_correlateFullPreamble) { - m_correlationScale = 3.0; - } else { - m_correlationScale = 2.0; + if (settingsKeys.contains("correlateFullPreamble") || force) + { + if (settings.m_correlateFullPreamble) { + m_correlationScale = 3.0; + } else { + m_correlationScale = 2.0; + } } - if ((m_settings.m_correlationThreshold != settings.m_correlationThreshold) || force) + if ((settingsKeys.contains("correlationThreshold") && (m_settings.m_correlationThreshold != settings.m_correlationThreshold)) || force) { m_correlationThresholdLinear = CalcDb::powerFromdB(settings.m_correlationThreshold); m_correlationThresholdLinear /= m_correlationScale; qDebug() << "m_correlationThresholdLinear: " << m_correlationThresholdLinear; } - m_settings = settings; + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } delete message; } } diff --git a/plugins/channelrx/demodadsb/adsbdemodsinkworker.h b/plugins/channelrx/demodadsb/adsbdemodsinkworker.h index 4c907040f..4c2170243 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsinkworker.h +++ b/plugins/channelrx/demodadsb/adsbdemodsinkworker.h @@ -40,20 +40,23 @@ public: public: const ADSBDemodSettings& getSettings() const { return m_settings; } + const QStringList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureADSBDemodSinkWorker* create(const ADSBDemodSettings& settings, bool force) + static MsgConfigureADSBDemodSinkWorker* create(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { - return new MsgConfigureADSBDemodSinkWorker(settings, force); + return new MsgConfigureADSBDemodSinkWorker(settings, settingsKeys, force); } private: ADSBDemodSettings m_settings; + QStringList m_settingsKeys; bool m_force; - MsgConfigureADSBDemodSinkWorker(const ADSBDemodSettings& settings, bool force) : + MsgConfigureADSBDemodSinkWorker(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; diff --git a/plugins/channelrx/demodadsb/adsbdemodworker.cpp b/plugins/channelrx/demodadsb/adsbdemodworker.cpp index 5feb986a7..9df02e160 100644 --- a/plugins/channelrx/demodadsb/adsbdemodworker.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodworker.cpp @@ -150,7 +150,7 @@ bool ADSBDemodWorker::handleMessage(const Message& message) QMutexLocker mutexLocker(&m_mutex); MsgConfigureADSBDemodWorker& cfg = (MsgConfigureADSBDemodWorker&) message; - applySettings(cfg.getSettings(), cfg.getForce()); + applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); return true; } else if (ADSBDemodReport::MsgReportADSB::match(message)) @@ -165,7 +165,7 @@ bool ADSBDemodWorker::handleMessage(const Message& message) } } -void ADSBDemodWorker::applySettings(const ADSBDemodSettings& settings, bool force) +void ADSBDemodWorker::applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { qDebug() << "ADSBDemodWorker::applySettings:" << " m_feedEnabled: " << settings.m_feedEnabled @@ -179,10 +179,10 @@ void ADSBDemodWorker::applySettings(const ADSBDemodSettings& settings, bool forc << " m_logFilename: " << settings.m_logFilename << " force: " << force; - if ((settings.m_feedEnabled != m_settings.m_feedEnabled) - || (settings.m_exportClientEnabled != m_settings.m_exportClientEnabled) - || (settings.m_exportClientHost != m_settings.m_exportClientHost) - || (settings.m_exportClientPort != m_settings.m_exportClientPort) + if ((settingsKeys.contains("feedEnabled") && (settings.m_feedEnabled != m_settings.m_feedEnabled)) + || (settingsKeys.contains("exportClientEnabled") && (settings.m_exportClientEnabled != m_settings.m_exportClientEnabled)) + || (settingsKeys.contains("exportClientHost") && (settings.m_exportClientHost != m_settings.m_exportClientHost)) + || (settingsKeys.contains("exportClientPort") && (settings.m_exportClientPort != m_settings.m_exportClientPort)) || force) { // Close any existing connection @@ -195,9 +195,9 @@ void ADSBDemodWorker::applySettings(const ADSBDemodSettings& settings, bool forc } } - if ((settings.m_feedEnabled != m_settings.m_feedEnabled) - || (settings.m_exportServerEnabled != m_settings.m_exportServerEnabled) - || (settings.m_exportServerPort != m_settings.m_exportServerPort) + if ((settingsKeys.contains("feedEnabled") && (settings.m_feedEnabled != m_settings.m_feedEnabled)) + || (settingsKeys.contains("exportServerEnabled") && (settings.m_exportServerEnabled != m_settings.m_exportServerEnabled)) + || (settingsKeys.contains("exportServerPort") && (settings.m_exportServerPort != m_settings.m_exportServerPort)) || force) { if (m_beastServer.isListening()) { @@ -208,8 +208,8 @@ void ADSBDemodWorker::applySettings(const ADSBDemodSettings& settings, bool forc } } - if ((settings.m_logEnabled != m_settings.m_logEnabled) - || (settings.m_logFilename != m_settings.m_logFilename) + if ((settingsKeys.contains("logEnabled") && (settings.m_logEnabled != m_settings.m_logEnabled)) + || (settingsKeys.contains("logFilename") && (settings.m_logFilename != m_settings.m_logFilename)) || force) { if (m_logFile.isOpen()) @@ -238,7 +238,11 @@ void ADSBDemodWorker::applySettings(const ADSBDemodSettings& settings, bool forc } } - m_settings = settings; + if (force) { + m_settings = settings; + } else { + m_settings.applySettings(settingsKeys, settings); + } } void ADSBDemodWorker::connected() diff --git a/plugins/channelrx/demodadsb/adsbdemodworker.h b/plugins/channelrx/demodadsb/adsbdemodworker.h index 16a96e8e5..0f04240be 100644 --- a/plugins/channelrx/demodadsb/adsbdemodworker.h +++ b/plugins/channelrx/demodadsb/adsbdemodworker.h @@ -61,20 +61,23 @@ public: public: const ADSBDemodSettings& getSettings() const { return m_settings; } + const QStringList& getSettingsKeys() const { return m_settingsKeys; } bool getForce() const { return m_force; } - static MsgConfigureADSBDemodWorker* create(const ADSBDemodSettings& settings, bool force) + static MsgConfigureADSBDemodWorker* create(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) { - return new MsgConfigureADSBDemodWorker(settings, force); + return new MsgConfigureADSBDemodWorker(settings, settingsKeys, force); } private: ADSBDemodSettings m_settings; + QStringList m_settingsKeys; bool m_force; - MsgConfigureADSBDemodWorker(const ADSBDemodSettings& settings, bool force) : + MsgConfigureADSBDemodWorker(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) : Message(), m_settings(settings), + m_settingsKeys(settingsKeys), m_force(force) { } }; @@ -101,7 +104,7 @@ private: ADSBBeastServer m_beastServer; bool handleMessage(const Message& cmd); - void applySettings(const ADSBDemodSettings& settings, bool force = false); + void applySettings(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force = false); void send(const char *data, int length); char *escape(char *p, char c); void handleADSB(QByteArray data, const QDateTime dateTime, float correlation);