diff --git a/plugins/channelrx/demoddatv/CMakeLists.txt b/plugins/channelrx/demoddatv/CMakeLists.txt
index 29e0efb90..da2f475cc 100644
--- a/plugins/channelrx/demoddatv/CMakeLists.txt
+++ b/plugins/channelrx/demoddatv/CMakeLists.txt
@@ -6,6 +6,7 @@ set(datv_SOURCES
datvdemodgui.cpp
datvdemodplugin.cpp
datvdemodsettings.cpp
+ datvdemodwebapiadapter.cpp
datvideostream.cpp
datvudpstream.cpp
datvideorender.cpp
@@ -14,7 +15,6 @@ set(datv_SOURCES
leansdr/framework.cpp
leansdr/math.cpp
leansdr/sdr.cpp
-
datvdemodgui.ui
)
@@ -23,6 +23,7 @@ set(datv_HEADERS
datvdemodgui.h
datvdemodplugin.h
datvdemodsettings.h
+ datvdemodwebapiadapter.h
datvideostream.h
datvudpstream.h
datvideorender.h
@@ -42,6 +43,7 @@ include_directories(
${AVUTIL_INCLUDE_DIRS}
${SWSCALE_INCLUDE_DIRS}
${SWRESAMPLE_INCLUDE_DIRS}
+ ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
)
add_library(demoddatv SHARED
diff --git a/plugins/channelrx/demoddatv/datvdemodgui.ui b/plugins/channelrx/demoddatv/datvdemodgui.ui
index 1f3af1fc6..10bd25ba5 100644
--- a/plugins/channelrx/demoddatv/datvdemodgui.ui
+++ b/plugins/channelrx/demoddatv/datvdemodgui.ui
@@ -581,7 +581,7 @@
Symbol rate
- 100000
+ 1000
1024000000
diff --git a/plugins/channelrx/demoddatv/datvdemodplugin.cpp b/plugins/channelrx/demoddatv/datvdemodplugin.cpp
index 55c90941b..5071ceac2 100644
--- a/plugins/channelrx/demoddatv/datvdemodplugin.cpp
+++ b/plugins/channelrx/demoddatv/datvdemodplugin.cpp
@@ -24,11 +24,12 @@
#include "datvdemodgui.h"
#include "datvdemodplugin.h"
+#include "datvdemodwebapiadapter.h"
const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor =
{
QString("DATV Demodulator"),
- QString("4.11.4"),
+ QString("4.11.6"),
QString("(c) F4HKW for SDRAngel using LeanSDR framework (c) F4DAV"),
QString("https://github.com/f4exb/sdrangel"),
true,
@@ -70,3 +71,8 @@ ChannelAPI* DATVDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const
{
return new DATVDemod(deviceAPI);
}
+
+ChannelWebAPIAdapter* DATVDemodPlugin::createChannelWebAPIAdapter() const
+{
+ return new DATVDemodWebAPIAdapter();
+}
diff --git a/plugins/channelrx/demoddatv/datvdemodplugin.h b/plugins/channelrx/demoddatv/datvdemodplugin.h
index f1a1b785d..15213bf9e 100644
--- a/plugins/channelrx/demoddatv/datvdemodplugin.h
+++ b/plugins/channelrx/demoddatv/datvdemodplugin.h
@@ -41,7 +41,7 @@ public:
virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const;
virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const;
virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const;
-
+ virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const;
private:
static const PluginDescriptor m_ptrPluginDescriptor;
diff --git a/plugins/channelrx/demoddatv/datvdemodwebapiadapter.cpp b/plugins/channelrx/demoddatv/datvdemodwebapiadapter.cpp
new file mode 100644
index 000000000..c8927b555
--- /dev/null
+++ b/plugins/channelrx/demoddatv/datvdemodwebapiadapter.cpp
@@ -0,0 +1,153 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#include "SWGChannelSettings.h"
+#include "datvdemodwebapiadapter.h"
+
+DATVDemodWebAPIAdapter::DATVDemodWebAPIAdapter()
+{}
+
+DATVDemodWebAPIAdapter::~DATVDemodWebAPIAdapter()
+{}
+
+int DATVDemodWebAPIAdapter::webapiSettingsGet(
+ SWGSDRangel::SWGChannelSettings& response,
+ QString& errorMessage)
+{
+ (void) errorMessage;
+ response.setDatvDemodSettings(new SWGSDRangel::SWGDATVDemodSettings());
+ response.getDatvDemodSettings()->init();
+ webapiFormatChannelSettings(response, m_settings);
+ return 200;
+}
+
+int DATVDemodWebAPIAdapter::webapiSettingsPutPatch(
+ bool force,
+ const QStringList& channelSettingsKeys,
+ SWGSDRangel::SWGChannelSettings& response,
+ QString& errorMessage)
+{
+ (void) force;
+ (void) errorMessage;
+ webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response);
+ return 200;
+}
+
+void DATVDemodWebAPIAdapter::webapiFormatChannelSettings(
+ SWGSDRangel::SWGChannelSettings& response,
+ const DATVDemodSettings& settings)
+{
+ response.getDatvDemodSettings()->setAllowDrift(settings.m_allowDrift ? 1 : 0);
+ response.getDatvDemodSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
+ response.getDatvDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
+ response.getDatvDemodSettings()->setAudioVolume(settings.m_audioVolume);
+ response.getDatvDemodSettings()->setCenterFrequency(settings.m_centerFrequency);
+ response.getDatvDemodSettings()->setExcursion(settings.m_excursion);
+ response.getDatvDemodSettings()->setFastLock(settings.m_fastLock ? 1 : 0);
+ response.getDatvDemodSettings()->setFec((int) settings.m_fec);
+ response.getDatvDemodSettings()->setFilter((int) settings.m_filter);
+ response.getDatvDemodSettings()->setHardMetric(settings.m_hardMetric ? 1 : 0);
+ response.getDatvDemodSettings()->setModulation((int) settings.m_modulation);
+ response.getDatvDemodSettings()->setNotchFilters(settings.m_notchFilters);
+ response.getDatvDemodSettings()->setRfBandwidth(settings.m_rfBandwidth);
+ response.getDatvDemodSettings()->setRgbColor(settings.m_rgbColor);
+ response.getDatvDemodSettings()->setRollOff(settings.m_rollOff);
+ response.getDatvDemodSettings()->setStandard((int) settings.m_standard);
+ response.getDatvDemodSettings()->setSymbolRate(settings.m_symbolRate);
+ response.getDatvDemodSettings()->setTitle(new QString(settings.m_title));
+ response.getDatvDemodSettings()->setUdpTs(settings.m_udpTS ? 1 : 0);
+ response.getDatvDemodSettings()->setUdpTsAddress(new QString(settings.m_udpTSAddress));
+ response.getDatvDemodSettings()->setUdpTsPort(settings.m_udpTSPort);
+ response.getDatvDemodSettings()->setVideoMute(settings.m_videoMute ? 1 : 0);
+ response.getDatvDemodSettings()->setViterbi(settings.m_viterbi ? 1 : 0);
+}
+
+void DATVDemodWebAPIAdapter::webapiUpdateChannelSettings(
+ DATVDemodSettings& settings,
+ const QStringList& channelSettingsKeys,
+ SWGSDRangel::SWGChannelSettings& response)
+{
+ if (channelSettingsKeys.contains("allowDrift")) {
+ settings.m_allowDrift = response.getDatvDemodSettings()->getAllowDrift() != 0;
+ }
+ if (channelSettingsKeys.contains("audioDeviceName")) {
+ settings.m_audioDeviceName = *response.getDatvDemodSettings()->getAudioDeviceName();
+ }
+ if (channelSettingsKeys.contains("audioMute")) {
+ settings.m_audioMute = response.getDatvDemodSettings()->getAudioMute() != 0;
+ }
+ if (channelSettingsKeys.contains("audioVolume")) {
+ settings.m_audioVolume = response.getDatvDemodSettings()->getAudioVolume();
+ }
+ if (channelSettingsKeys.contains("centerFrequency")) {
+ settings.m_centerFrequency = response.getDatvDemodSettings()->getCenterFrequency();
+ }
+ if (channelSettingsKeys.contains("excursion")) {
+ settings.m_excursion = response.getDatvDemodSettings()->getExcursion();
+ }
+ if (channelSettingsKeys.contains("fastLock")) {
+ settings.m_fastLock = response.getDatvDemodSettings()->getFastLock() != 0;
+ }
+ if (channelSettingsKeys.contains("fec")) {
+ settings.m_fec = (DATVDemodSettings::DATVCodeRate) response.getDatvDemodSettings()->getFec();
+ }
+ if (channelSettingsKeys.contains("filter")) {
+ settings.m_filter = (DATVDemodSettings::dvb_sampler) response.getDatvDemodSettings()->getFilter();
+ }
+ if (channelSettingsKeys.contains("hardMetric")) {
+ settings.m_hardMetric = response.getDatvDemodSettings()->getHardMetric() != 0;
+ }
+ if (channelSettingsKeys.contains("modulation")) {
+ settings.m_modulation = (DATVDemodSettings::DATVModulation) response.getDatvDemodSettings()->getModulation();
+ }
+ if (channelSettingsKeys.contains("notchFilters")) {
+ settings.m_notchFilters = response.getDatvDemodSettings()->getNotchFilters();
+ }
+ if (channelSettingsKeys.contains("rfBandwidth")) {
+ settings.m_rfBandwidth = response.getDatvDemodSettings()->getRfBandwidth();
+ }
+ if (channelSettingsKeys.contains("rgbColor")) {
+ settings.m_rgbColor = response.getDatvDemodSettings()->getRgbColor();
+ }
+ if (channelSettingsKeys.contains("rollOff")) {
+ settings.m_rollOff = response.getDatvDemodSettings()->getRollOff();
+ }
+ if (channelSettingsKeys.contains("standard")) {
+ settings.m_standard = (DATVDemodSettings::dvb_version) response.getDatvDemodSettings()->getStandard();
+ }
+ if (channelSettingsKeys.contains("symbolRate")) {
+ settings.m_symbolRate = response.getDatvDemodSettings()->getSymbolRate();
+ }
+ if (channelSettingsKeys.contains("title")) {
+ settings.m_title = *response.getDatvDemodSettings()->getTitle();
+ }
+ if (channelSettingsKeys.contains("udpTS")) {
+ settings.m_udpTS = response.getDatvDemodSettings()->getUdpTs() != 0;
+ }
+ if (channelSettingsKeys.contains("udpTSAddress")) {
+ settings.m_udpTSAddress = *response.getDatvDemodSettings()->getUdpTsAddress();
+ }
+ if (channelSettingsKeys.contains("udpTSPort")) {
+ settings.m_udpTSPort = response.getDatvDemodSettings()->getUdpTsPort();
+ }
+ if (channelSettingsKeys.contains("videoMute")) {
+ settings.m_videoMute = response.getDatvDemodSettings()->getVideoMute() != 0;
+ }
+ if (channelSettingsKeys.contains("viterbi")) {
+ settings.m_viterbi = response.getDatvDemodSettings()->getViterbi() != 0;
+ }
+}
diff --git a/plugins/channelrx/demoddatv/datvdemodwebapiadapter.h b/plugins/channelrx/demoddatv/datvdemodwebapiadapter.h
new file mode 100644
index 000000000..ee2f5edc5
--- /dev/null
+++ b/plugins/channelrx/demoddatv/datvdemodwebapiadapter.h
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDE_DEMODDATV_WEBAPIADAPTER_H
+#define INCLUDE_DEMODDATV_WEBAPIADAPTER_H
+
+#include "channel/channelwebapiadapter.h"
+#include "datvdemodsettings.h"
+
+/**
+ * Standalone API adapter only for the settings
+ */
+class DATVDemodWebAPIAdapter : public ChannelWebAPIAdapter {
+public:
+ DATVDemodWebAPIAdapter();
+ virtual ~DATVDemodWebAPIAdapter();
+
+ virtual QByteArray serialize() const { return m_settings.serialize(); }
+ virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); }
+
+ virtual int webapiSettingsGet(
+ SWGSDRangel::SWGChannelSettings& response,
+ QString& errorMessage);
+
+ virtual int webapiSettingsPutPatch(
+ bool force,
+ const QStringList& channelSettingsKeys,
+ SWGSDRangel::SWGChannelSettings& response,
+ QString& errorMessage);
+
+ static void webapiFormatChannelSettings(
+ SWGSDRangel::SWGChannelSettings& response,
+ const DATVDemodSettings& settings);
+
+ static void webapiUpdateChannelSettings(
+ DATVDemodSettings& settings,
+ const QStringList& channelSettingsKeys,
+ SWGSDRangel::SWGChannelSettings& response);
+
+private:
+ DATVDemodSettings m_settings;
+};
+
+#endif // INCLUDE_DEMODDATV_WEBAPIADAPTER_H
diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp
index 7b50fbc65..068b492c0 100644
--- a/sdrbase/webapi/webapirequestmapper.cpp
+++ b/sdrbase/webapi/webapirequestmapper.cpp
@@ -56,6 +56,7 @@ const QMap WebAPIRequestMapper::m_channelURIToSettingsKey = {
{"sdrangel.channel.chanalyzer", "ChannelAnalyzerSettings"},
{"sdrangel.channel.chanalyzerng", "ChannelAnalyzerSettings"}, // remap
{"sdrangel.channel.demodatv", "ATVDemodSettings"},
+ {"sdrangel.channel.demoddatv", "DATVDemodSettings"},
{"sdrangel.channel.dsddemod", "DSDDemodSettings"},
{"sdrangel.channeltx.filesrc", "FileSourceSettings"},
{"sdrangel.channel.freedvdemod", "FreeDVDemodSettings"},
@@ -122,6 +123,7 @@ const QMap WebAPIRequestMapper::m_channelTypeToSettingsKey = {
{"ATVMod", "ATVModSettings"},
{"BFMDemod", "BFMDemodSettings"},
{"ChannelAnalyzer", "ChannelAnalyzerSettings"},
+ {"DATVDemod", "DATVDemodSettings"},
{"DSDDemod", "DSDDemodSettings"},
{"FileSource", "FileSourceSettings"},
{"FreeDVDemod", "FreeDVDemodSettings"},
@@ -2450,6 +2452,11 @@ bool WebAPIRequestMapper::getChannel(
{
processChannelAnalyzerSettings(channelSettings, settingsJsonObject, channelSettingsKeys);
}
+ else if (channelSettingsKey == "DATVDemodSettings")
+ {
+ channelSettings->setDatvDemodSettings(new SWGSDRangel::SWGDATVDemodSettings());
+ channelSettings->getDatvDemodSettings()->fromJsonObject(settingsJsonObject);
+ }
else if (channelSettingsKey == "DSDDemodSettings")
{
channelSettings->setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings());