From 764fc99e402f479c777de1c9ea695729a28b74b0 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 1 Jul 2019 02:26:18 +0200 Subject: [PATCH] Frequency tracker: fixed REST API --- plugins/channelrx/freqtracker/freqtracker.cpp | 12 +++++++++++- sdrbase/webapi/webapirequestmapper.cpp | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/freqtracker/freqtracker.cpp b/plugins/channelrx/freqtracker/freqtracker.cpp index 417561f94..fe139c613 100644 --- a/plugins/channelrx/freqtracker/freqtracker.cpp +++ b/plugins/channelrx/freqtracker/freqtracker.cpp @@ -594,6 +594,9 @@ int FreqTracker::webapiSettingsPutPatch( if (channelSettingsKeys.contains("rrcRolloff")) { settings.m_rrcRolloff = response.getFreqTrackerSettings()->getRrcRolloff(); } + if (channelSettingsKeys.contains("squelchGate")) { + settings.m_squelchGate = response.getFreqTrackerSettings()->getSquelchGate(); + } if (channelSettingsKeys.contains("useReverseAPI")) { settings.m_useReverseAPI = response.getAmDemodSettings()->getUseReverseApi() != 0; } @@ -640,8 +643,9 @@ void FreqTracker::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r { response.getFreqTrackerSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); response.getFreqTrackerSettings()->setRfBandwidth(settings.m_rfBandwidth); - response.getFreqTrackerSettings()->setRgbColor(settings.m_rgbColor); + response.getFreqTrackerSettings()->setLog2Decim(settings.m_log2Decim); response.getFreqTrackerSettings()->setSquelch(settings.m_squelch); + response.getFreqTrackerSettings()->setRgbColor(settings.m_rgbColor); if (response.getFreqTrackerSettings()->getTitle()) { *response.getFreqTrackerSettings()->getTitle() = settings.m_title; @@ -649,7 +653,13 @@ void FreqTracker::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r response.getFreqTrackerSettings()->setTitle(new QString(settings.m_title)); } + response.getFreqTrackerSettings()->setAlphaEma(m_settings.m_alphaEMA); + response.getFreqTrackerSettings()->setTracking(m_settings.m_tracking ? 1 : 0); response.getFreqTrackerSettings()->setTrackerType((int) m_settings.m_trackerType); + response.getFreqTrackerSettings()->setPllPskOrder(m_settings.m_pllPskOrder); + response.getFreqTrackerSettings()->setRrc(m_settings.m_rrc ? 1 : 0); + response.getFreqTrackerSettings()->setRrcRolloff(m_settings.m_rrcRolloff); + response.getFreqTrackerSettings()->setSquelchGate(m_settings.m_squelchGate); response.getFreqTrackerSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); if (response.getFreqTrackerSettings()->getReverseApiAddress()) { diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index dcfcef89b..1c3b679e6 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -2352,6 +2352,20 @@ bool WebAPIRequestMapper::validateChannelSettings( return false; } } + else if (*channelType == "FreqTracker") + { + if (channelSettings.getDirection() == 0) + { + QJsonObject freqTrackerSettingsJsonObject = jsonObject["FreqTrackerSettings"].toObject(); + channelSettingsKeys = freqTrackerSettingsJsonObject.keys(); + channelSettings.setFreqTrackerSettings(new SWGSDRangel::SWGFreqTrackerSettings()); + channelSettings.getFreqTrackerSettings()->fromJsonObject(freqTrackerSettingsJsonObject); + return true; + } + else { + return false; + } + } else if (*channelType == "NFMDemod") { if (channelSettings.getDirection() == 0)