From a4007b762ef0fc92b0171a1dff6ccf43a514933a Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 2 Aug 2019 00:29:58 +0200 Subject: [PATCH] REST API: config: (6): config preset channel Rx adapters --- plugins/channelrx/demodam/amdemodplugin.cpp | 2 +- plugins/channelrx/demodbfm/CMakeLists.txt | 6 +- .../demodbfm/bfmdemodwebapiadapter.cpp | 51 +++++++++++++++ .../demodbfm/bfmdemodwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/demodbfm/bfmplugin.cpp | 8 ++- plugins/channelrx/demodbfm/bfmplugin.h | 1 + plugins/channelrx/demoddsd/CMakeLists.txt | 2 + plugins/channelrx/demoddsd/dsddemodplugin.cpp | 8 ++- plugins/channelrx/demoddsd/dsddemodplugin.h | 1 + .../demoddsd/dsddemodwebapiadapter.cpp | 51 +++++++++++++++ .../demoddsd/dsddemodwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/demodfreedv/CMakeLists.txt | 6 +- .../demodfreedv/freedvdemodwebapiadapter.cpp | 51 +++++++++++++++ .../demodfreedv/freedvdemodwebapiadapter.h | 65 +++++++++++++++++++ .../channelrx/demodfreedv/freedvplugin.cpp | 7 +- plugins/channelrx/demodfreedv/freedvplugin.h | 1 + plugins/channelrx/demodnfm/CMakeLists.txt | 6 +- .../demodnfm/nfmdemodwebapiadapter.cpp | 51 +++++++++++++++ .../demodnfm/nfmdemodwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/demodnfm/nfmplugin.cpp | 8 ++- plugins/channelrx/demodnfm/nfmplugin.h | 1 + plugins/channelrx/demodssb/CMakeLists.txt | 6 +- .../demodssb/ssbdemodwebapiadapter.cpp | 51 +++++++++++++++ .../demodssb/ssbdemodwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/demodssb/ssbplugin.cpp | 8 ++- plugins/channelrx/demodssb/ssbplugin.h | 1 + plugins/channelrx/demodwfm/CMakeLists.txt | 6 +- .../demodwfm/wfmdemodwebapiadapter.cpp | 51 +++++++++++++++ .../demodwfm/wfmdemodwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/demodwfm/wfmplugin.cpp | 8 ++- plugins/channelrx/demodwfm/wfmplugin.h | 1 + plugins/channelrx/freqtracker/CMakeLists.txt | 6 +- .../freqtracker/freqtrackerplugin.cpp | 7 +- .../channelrx/freqtracker/freqtrackerplugin.h | 1 + .../freqtracker/freqtrackerwebapiadapter.cpp | 51 +++++++++++++++ .../freqtracker/freqtrackerwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/localsink/CMakeLists.txt | 4 +- .../channelrx/localsink/localsinkplugin.cpp | 9 ++- plugins/channelrx/localsink/localsinkplugin.h | 1 + .../localsink/localsinkwebapiadapter.cpp | 51 +++++++++++++++ .../localsink/localsinkwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/remotesink/CMakeLists.txt | 6 +- .../channelrx/remotesink/remotesinkplugin.cpp | 11 ++-- .../channelrx/remotesink/remotesinkplugin.h | 1 + .../remotesink/remotesinkwebapiadapter.cpp | 51 +++++++++++++++ .../remotesink/remotesinkwebapiadapter.h | 65 +++++++++++++++++++ plugins/channelrx/udpsink/CMakeLists.txt | 6 +- plugins/channelrx/udpsink/udpsinkplugin.cpp | 7 +- plugins/channelrx/udpsink/udpsinkplugin.h | 1 + .../udpsink/udpsinkwebapiadapter.cpp | 51 +++++++++++++++ .../channelrx/udpsink/udpsinkwebapiadapter.h | 65 +++++++++++++++++++ 51 files changed, 1276 insertions(+), 31 deletions(-) create mode 100644 plugins/channelrx/demodbfm/bfmdemodwebapiadapter.cpp create mode 100644 plugins/channelrx/demodbfm/bfmdemodwebapiadapter.h create mode 100644 plugins/channelrx/demoddsd/dsddemodwebapiadapter.cpp create mode 100644 plugins/channelrx/demoddsd/dsddemodwebapiadapter.h create mode 100644 plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.cpp create mode 100644 plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.h create mode 100644 plugins/channelrx/demodnfm/nfmdemodwebapiadapter.cpp create mode 100644 plugins/channelrx/demodnfm/nfmdemodwebapiadapter.h create mode 100644 plugins/channelrx/demodssb/ssbdemodwebapiadapter.cpp create mode 100644 plugins/channelrx/demodssb/ssbdemodwebapiadapter.h create mode 100644 plugins/channelrx/demodwfm/wfmdemodwebapiadapter.cpp create mode 100644 plugins/channelrx/demodwfm/wfmdemodwebapiadapter.h create mode 100644 plugins/channelrx/freqtracker/freqtrackerwebapiadapter.cpp create mode 100644 plugins/channelrx/freqtracker/freqtrackerwebapiadapter.h create mode 100644 plugins/channelrx/localsink/localsinkwebapiadapter.cpp create mode 100644 plugins/channelrx/localsink/localsinkwebapiadapter.h create mode 100644 plugins/channelrx/remotesink/remotesinkwebapiadapter.cpp create mode 100644 plugins/channelrx/remotesink/remotesinkwebapiadapter.h create mode 100644 plugins/channelrx/udpsink/udpsinkwebapiadapter.cpp create mode 100644 plugins/channelrx/udpsink/udpsinkwebapiadapter.h diff --git a/plugins/channelrx/demodam/amdemodplugin.cpp b/plugins/channelrx/demodam/amdemodplugin.cpp index ea9738682..15d5311a8 100644 --- a/plugins/channelrx/demodam/amdemodplugin.cpp +++ b/plugins/channelrx/demodam/amdemodplugin.cpp @@ -10,7 +10,7 @@ const PluginDescriptor AMDemodPlugin::m_pluginDescriptor = { QString("AM Demodulator"), - QString("4.5.2"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelrx/demodbfm/CMakeLists.txt b/plugins/channelrx/demodbfm/CMakeLists.txt index a61c61c2e..6b0bd9e93 100644 --- a/plugins/channelrx/demodbfm/CMakeLists.txt +++ b/plugins/channelrx/demodbfm/CMakeLists.txt @@ -2,7 +2,8 @@ project(bfm) set(bfm_SOURCES bfmdemod.cpp - bfmdemodsettings.cpp + bfmdemodsettings.cpp + bfmdemodwebapiadapter.cpp bfmplugin.cpp rdsdemod.cpp rdsdecoder.cpp @@ -12,7 +13,8 @@ set(bfm_SOURCES set(bfm_HEADERS bfmdemod.h - bfmdemodsettings.h + bfmdemodsettings.h + bfmdemodwebapiadapter.h bfmplugin.h rdsdemod.h rdsdecoder.h diff --git a/plugins/channelrx/demodbfm/bfmdemodwebapiadapter.cpp b/plugins/channelrx/demodbfm/bfmdemodwebapiadapter.cpp new file mode 100644 index 000000000..59c5dd3be --- /dev/null +++ b/plugins/channelrx/demodbfm/bfmdemodwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "bfmdemod.h" +#include "bfmdemodwebapiadapter.h" + +BFMDemodWebAPIAdapter::BFMDemodWebAPIAdapter() : + ChannelAPI(BFMDemod::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +BFMDemodWebAPIAdapter::~BFMDemodWebAPIAdapter() +{} + +int BFMDemodWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings()); + response.getBfmDemodSettings()->init(); + BFMDemod::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int BFMDemodWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + BFMDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/demodbfm/bfmdemodwebapiadapter.h b/plugins/channelrx/demodbfm/bfmdemodwebapiadapter.h new file mode 100644 index 000000000..e8319d12c --- /dev/null +++ b/plugins/channelrx/demodbfm/bfmdemodwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_BFMDEMOD_WEBAPIADAPTER_H +#define INCLUDE_BFMDEMOD_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "bfmdemodsettings.h" + +/** + * Standalone API adapter only for the settings + */ +class BFMDemodWebAPIAdapter : public ChannelAPI { +public: + BFMDemodWebAPIAdapter(); + virtual ~BFMDemodWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + BFMDemodSettings m_settings; +}; + +#endif // INCLUDE_BFMDEMOD_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodbfm/bfmplugin.cpp b/plugins/channelrx/demodbfm/bfmplugin.cpp index 6df7093e0..73e0f92dc 100644 --- a/plugins/channelrx/demodbfm/bfmplugin.cpp +++ b/plugins/channelrx/demodbfm/bfmplugin.cpp @@ -25,10 +25,12 @@ #include "bfmdemodgui.h" #endif #include "bfmdemod.h" +#include "bfmdemodwebapiadapter.h" +#include "bfmplugin.h" const PluginDescriptor BFMPlugin::m_pluginDescriptor = { QString("Broadcast FM Demodulator"), - QString("4.5.2"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -78,3 +80,7 @@ ChannelAPI* BFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new BFMDemod(deviceAPI); } +ChannelAPI* BFMPlugin::createChannelWebAPIAdapter() const +{ + return new BFMDemodWebAPIAdapter(); +} diff --git a/plugins/channelrx/demodbfm/bfmplugin.h b/plugins/channelrx/demodbfm/bfmplugin.h index 46f3bb628..c1af86ad6 100644 --- a/plugins/channelrx/demodbfm/bfmplugin.h +++ b/plugins/channelrx/demodbfm/bfmplugin.h @@ -38,6 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demoddsd/CMakeLists.txt b/plugins/channelrx/demoddsd/CMakeLists.txt index deae1950d..6e9bfd903 100644 --- a/plugins/channelrx/demoddsd/CMakeLists.txt +++ b/plugins/channelrx/demoddsd/CMakeLists.txt @@ -5,6 +5,7 @@ set(dsddemod_SOURCES dsddemodplugin.cpp dsddemodbaudrates.cpp dsddemodsettings.cpp + dsddemodwebapiadapter.cpp dsddecoder.cpp ) @@ -13,6 +14,7 @@ set(dsddemod_HEADERS dsddemodplugin.h dsddemodbaudrates.h dsddemodsettings.h + dsddemodwebapiadapter.h dsddecoder.h ) diff --git a/plugins/channelrx/demoddsd/dsddemodplugin.cpp b/plugins/channelrx/demoddsd/dsddemodplugin.cpp index 57b87471d..0b7190492 100644 --- a/plugins/channelrx/demoddsd/dsddemodplugin.cpp +++ b/plugins/channelrx/demoddsd/dsddemodplugin.cpp @@ -24,10 +24,12 @@ #include "dsddemodgui.h" #endif #include "dsddemod.h" +#include "dsddemodwebapiadapter.h" +#include "dsddemodplugin.h" const PluginDescriptor DSDDemodPlugin::m_pluginDescriptor = { QString("DSD Demodulator"), - QString("4.5.6"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -77,3 +79,7 @@ ChannelAPI* DSDDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new DSDDemod(deviceAPI); } +ChannelAPI* DSDDemodPlugin::createChannelWebAPIAdapter() const +{ + return new DSDDemodWebAPIAdapter(); +} diff --git a/plugins/channelrx/demoddsd/dsddemodplugin.h b/plugins/channelrx/demoddsd/dsddemodplugin.h index 46da1394e..00dd536ae 100644 --- a/plugins/channelrx/demoddsd/dsddemodplugin.h +++ b/plugins/channelrx/demoddsd/dsddemodplugin.h @@ -39,6 +39,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demoddsd/dsddemodwebapiadapter.cpp b/plugins/channelrx/demoddsd/dsddemodwebapiadapter.cpp new file mode 100644 index 000000000..847784c3c --- /dev/null +++ b/plugins/channelrx/demoddsd/dsddemodwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "dsddemod.h" +#include "dsddemodwebapiadapter.h" + +DSDDemodWebAPIAdapter::DSDDemodWebAPIAdapter() : + ChannelAPI(DSDDemod::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +DSDDemodWebAPIAdapter::~DSDDemodWebAPIAdapter() +{} + +int DSDDemodWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings()); + response.getDsdDemodSettings()->init(); + DSDDemod::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int DSDDemodWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + DSDDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/demoddsd/dsddemodwebapiadapter.h b/plugins/channelrx/demoddsd/dsddemodwebapiadapter.h new file mode 100644 index 000000000..747d55a8d --- /dev/null +++ b/plugins/channelrx/demoddsd/dsddemodwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_DSDDEMOD_WEBAPIADAPTER_H +#define INCLUDE_DSDDEMOD_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "dsddemodsettings.h" + +/** + * Standalone API adapter only for the settings + */ +class DSDDemodWebAPIAdapter : public ChannelAPI { +public: + DSDDemodWebAPIAdapter(); + virtual ~DSDDemodWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + DSDDemodSettings m_settings; +}; + +#endif // INCLUDE_DSDDEMOD_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodfreedv/CMakeLists.txt b/plugins/channelrx/demodfreedv/CMakeLists.txt index 4b756f313..e11d3cb67 100644 --- a/plugins/channelrx/demodfreedv/CMakeLists.txt +++ b/plugins/channelrx/demodfreedv/CMakeLists.txt @@ -2,13 +2,15 @@ project(demodfreedv) set(freedv_SOURCES freedvdemod.cpp - freedvdemodsettings.cpp + freedvdemodsettings.cpp + freedvdemodwebapiadapter.cpp freedvplugin.cpp ) set(freedv_HEADERS freedvdemod.h - freedvdemodsettings.h + freedvdemodsettings.h + freedvdemodwebapiadapter.h freedvplugin.h ) diff --git a/plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.cpp b/plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.cpp new file mode 100644 index 000000000..e92549f4a --- /dev/null +++ b/plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "freedvdemod.h" +#include "freedvdemodwebapiadapter.h" + +FreeDVDemodWebAPIAdapter::FreeDVDemodWebAPIAdapter() : + ChannelAPI(FreeDVDemod::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +FreeDVDemodWebAPIAdapter::~FreeDVDemodWebAPIAdapter() +{} + +int FreeDVDemodWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setFreeDvDemodSettings(new SWGSDRangel::SWGFreeDVDemodSettings()); + response.getFreeDvDemodSettings()->init(); + FreeDVDemod::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int FreeDVDemodWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + FreeDVDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.h b/plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.h new file mode 100644 index 000000000..9c54f562d --- /dev/null +++ b/plugins/channelrx/demodfreedv/freedvdemodwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_FREEDVDEMOD_WEBAPIADAPTER_H +#define INCLUDE_FREEDVDEMOD_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "freedvdemodsettings.h" + +/** + * Standalone API adapter only for the settings + */ +class FreeDVDemodWebAPIAdapter : public ChannelAPI { +public: + FreeDVDemodWebAPIAdapter(); + virtual ~FreeDVDemodWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + FreeDVDemodSettings m_settings; +}; + +#endif // INCLUDE_FREEDVDEMOD_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodfreedv/freedvplugin.cpp b/plugins/channelrx/demodfreedv/freedvplugin.cpp index 18de40874..cf3e4d70d 100644 --- a/plugins/channelrx/demodfreedv/freedvplugin.cpp +++ b/plugins/channelrx/demodfreedv/freedvplugin.cpp @@ -22,11 +22,12 @@ #include "freedvdemodgui.h" #endif #include "freedvdemod.h" +#include "freedvdemodwebapiadapter.h" #include "freedvplugin.h" const PluginDescriptor FreeDVPlugin::m_pluginDescriptor = { QString("FreeDV Demodulator"), - QString("4.5.5"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -76,3 +77,7 @@ ChannelAPI* FreeDVPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new FreeDVDemod(deviceAPI); } +ChannelAPI* FreeDVPlugin::createChannelWebAPIAdapter() const +{ + return new FreeDVDemodWebAPIAdapter(); +} diff --git a/plugins/channelrx/demodfreedv/freedvplugin.h b/plugins/channelrx/demodfreedv/freedvplugin.h index c7f744d69..b830bcde9 100644 --- a/plugins/channelrx/demodfreedv/freedvplugin.h +++ b/plugins/channelrx/demodfreedv/freedvplugin.h @@ -38,6 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodnfm/CMakeLists.txt b/plugins/channelrx/demodnfm/CMakeLists.txt index 3b237bb20..7ab2e4dd3 100644 --- a/plugins/channelrx/demodnfm/CMakeLists.txt +++ b/plugins/channelrx/demodnfm/CMakeLists.txt @@ -2,13 +2,15 @@ project(nfm) set(nfm_SOURCES nfmdemod.cpp - nfmdemodsettings.cpp + nfmdemodsettings.cpp + nfmdemodwebapiadapter.cpp nfmplugin.cpp ) set(nfm_HEADERS nfmdemod.h - nfmdemodsettings.h + nfmdemodsettings.h + nfmdemodwebapiadapter.h nfmplugin.h ) diff --git a/plugins/channelrx/demodnfm/nfmdemodwebapiadapter.cpp b/plugins/channelrx/demodnfm/nfmdemodwebapiadapter.cpp new file mode 100644 index 000000000..3b64df534 --- /dev/null +++ b/plugins/channelrx/demodnfm/nfmdemodwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "nfmdemod.h" +#include "nfmdemodwebapiadapter.h" + +NFMDemodWebAPIAdapter::NFMDemodWebAPIAdapter() : + ChannelAPI(NFMDemod::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +NFMDemodWebAPIAdapter::~NFMDemodWebAPIAdapter() +{} + +int NFMDemodWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setNfmDemodSettings(new SWGSDRangel::SWGNFMDemodSettings()); + response.getNfmDemodSettings()->init(); + NFMDemod::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int NFMDemodWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + NFMDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/demodnfm/nfmdemodwebapiadapter.h b/plugins/channelrx/demodnfm/nfmdemodwebapiadapter.h new file mode 100644 index 000000000..121a35067 --- /dev/null +++ b/plugins/channelrx/demodnfm/nfmdemodwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_NFMDEMOD_WEBAPIADAPTER_H +#define INCLUDE_NFMDEMOD_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "nfmdemodsettings.h" + +/** + * Standalone API adapter only for the settings + */ +class NFMDemodWebAPIAdapter : public ChannelAPI { +public: + NFMDemodWebAPIAdapter(); + virtual ~NFMDemodWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + NFMDemodSettings m_settings; +}; + +#endif // INCLUDE_NFMDEMOD_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodnfm/nfmplugin.cpp b/plugins/channelrx/demodnfm/nfmplugin.cpp index 025c6c216..b62ad0ad3 100644 --- a/plugins/channelrx/demodnfm/nfmplugin.cpp +++ b/plugins/channelrx/demodnfm/nfmplugin.cpp @@ -6,10 +6,12 @@ #include "nfmdemodgui.h" #endif #include "nfmdemod.h" +#include "nfmdemodwebapiadapter.h" +#include "nfmplugin.h" const PluginDescriptor NFMPlugin::m_pluginDescriptor = { QString("NFM Demodulator"), - QString("4.5.2"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -59,3 +61,7 @@ ChannelAPI* NFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new NFMDemod(deviceAPI); } +ChannelAPI* NFMPlugin::createChannelWebAPIAdapter() const +{ + return new NFMDemodWebAPIAdapter(); +} diff --git a/plugins/channelrx/demodnfm/nfmplugin.h b/plugins/channelrx/demodnfm/nfmplugin.h index 4f6d4ab9f..2e711d057 100644 --- a/plugins/channelrx/demodnfm/nfmplugin.h +++ b/plugins/channelrx/demodnfm/nfmplugin.h @@ -21,6 +21,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodssb/CMakeLists.txt b/plugins/channelrx/demodssb/CMakeLists.txt index c4971d7b8..6853cec95 100644 --- a/plugins/channelrx/demodssb/CMakeLists.txt +++ b/plugins/channelrx/demodssb/CMakeLists.txt @@ -2,13 +2,15 @@ project(ssb) set(ssb_SOURCES ssbdemod.cpp - ssbdemodsettings.cpp + ssbdemodsettings.cpp + ssbdemodwebapiadapter.cpp ssbplugin.cpp ) set(ssb_HEADERS ssbdemod.h - ssbdemodsettings.h + ssbdemodsettings.h + ssbdemodwebapiadapter.h ssbplugin.h ) diff --git a/plugins/channelrx/demodssb/ssbdemodwebapiadapter.cpp b/plugins/channelrx/demodssb/ssbdemodwebapiadapter.cpp new file mode 100644 index 000000000..405d5fb63 --- /dev/null +++ b/plugins/channelrx/demodssb/ssbdemodwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "ssbdemod.h" +#include "ssbdemodwebapiadapter.h" + +SSBDemodWebAPIAdapter::SSBDemodWebAPIAdapter() : + ChannelAPI(SSBDemod::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +SSBDemodWebAPIAdapter::~SSBDemodWebAPIAdapter() +{} + +int SSBDemodWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setSsbDemodSettings(new SWGSDRangel::SWGSSBDemodSettings()); + response.getSsbDemodSettings()->init(); + SSBDemod::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int SSBDemodWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + SSBDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/demodssb/ssbdemodwebapiadapter.h b/plugins/channelrx/demodssb/ssbdemodwebapiadapter.h new file mode 100644 index 000000000..399bd8b5a --- /dev/null +++ b/plugins/channelrx/demodssb/ssbdemodwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_SSBDEMOD_WEBAPIADAPTER_H +#define INCLUDE_SSBDEMOD_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "ssbdemodsettings.h" + +/** + * Standalone API adapter only for the settings + */ +class SSBDemodWebAPIAdapter : public ChannelAPI { +public: + SSBDemodWebAPIAdapter(); + virtual ~SSBDemodWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + SSBDemodSettings m_settings; +}; + +#endif // INCLUDE_SSBDEMOD_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodssb/ssbplugin.cpp b/plugins/channelrx/demodssb/ssbplugin.cpp index d04e1a863..139e1355c 100644 --- a/plugins/channelrx/demodssb/ssbplugin.cpp +++ b/plugins/channelrx/demodssb/ssbplugin.cpp @@ -6,10 +6,12 @@ #include "ssbdemodgui.h" #endif #include "ssbdemod.h" +#include "ssbdemodwebapiadapter.h" +#include "ssbplugin.h" const PluginDescriptor SSBPlugin::m_pluginDescriptor = { QString("SSB Demodulator"), - QString("4.10.0"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -59,3 +61,7 @@ ChannelAPI* SSBPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new SSBDemod(deviceAPI); } +ChannelAPI* SSBPlugin::createChannelWebAPIAdapter() const +{ + return new SSBDemodWebAPIAdapter(); +} diff --git a/plugins/channelrx/demodssb/ssbplugin.h b/plugins/channelrx/demodssb/ssbplugin.h index ba7318272..10024fe46 100644 --- a/plugins/channelrx/demodssb/ssbplugin.h +++ b/plugins/channelrx/demodssb/ssbplugin.h @@ -21,6 +21,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodwfm/CMakeLists.txt b/plugins/channelrx/demodwfm/CMakeLists.txt index 175225a3e..57e04f202 100644 --- a/plugins/channelrx/demodwfm/CMakeLists.txt +++ b/plugins/channelrx/demodwfm/CMakeLists.txt @@ -2,13 +2,15 @@ project(wfm) set(wfm_SOURCES wfmdemod.cpp - wfmdemodsettings.cpp + wfmdemodsettings.cpp + wfmdemodwebapiadapter.cpp wfmplugin.cpp ) set(wfm_HEADERS wfmdemod.h - wfmdemodsettings.h + wfmdemodsettings.h + wfmdemodwebapiadapter.h wfmplugin.h ) diff --git a/plugins/channelrx/demodwfm/wfmdemodwebapiadapter.cpp b/plugins/channelrx/demodwfm/wfmdemodwebapiadapter.cpp new file mode 100644 index 000000000..b3a0b86f5 --- /dev/null +++ b/plugins/channelrx/demodwfm/wfmdemodwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "wfmdemod.h" +#include "wfmdemodwebapiadapter.h" + +WFMDemodWebAPIAdapter::WFMDemodWebAPIAdapter() : + ChannelAPI(WFMDemod::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +WFMDemodWebAPIAdapter::~WFMDemodWebAPIAdapter() +{} + +int WFMDemodWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setWfmDemodSettings(new SWGSDRangel::SWGWFMDemodSettings()); + response.getWfmDemodSettings()->init(); + WFMDemod::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int WFMDemodWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + WFMDemod::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/demodwfm/wfmdemodwebapiadapter.h b/plugins/channelrx/demodwfm/wfmdemodwebapiadapter.h new file mode 100644 index 000000000..46542c016 --- /dev/null +++ b/plugins/channelrx/demodwfm/wfmdemodwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_WFMDEMOD_WEBAPIADAPTER_H +#define INCLUDE_WFMDEMOD_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "wfmdemodsettings.h" + +/** + * Standalone API adapter only for the settings + */ +class WFMDemodWebAPIAdapter : public ChannelAPI { +public: + WFMDemodWebAPIAdapter(); + virtual ~WFMDemodWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + WFMDemodSettings m_settings; +}; + +#endif // INCLUDE_WFMDEMOD_WEBAPIADAPTER_H diff --git a/plugins/channelrx/demodwfm/wfmplugin.cpp b/plugins/channelrx/demodwfm/wfmplugin.cpp index fda96cf97..b130da2c7 100644 --- a/plugins/channelrx/demodwfm/wfmplugin.cpp +++ b/plugins/channelrx/demodwfm/wfmplugin.cpp @@ -7,10 +7,12 @@ #include "wfmdemodgui.h" #endif #include "wfmdemod.h" +#include "wfmdemodwebapiadapter.h" +#include "wfmplugin.h" const PluginDescriptor WFMPlugin::m_pluginDescriptor = { QString("WFM Demodulator"), - QString("4.9.1"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -60,3 +62,7 @@ ChannelAPI* WFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new WFMDemod(deviceAPI); } +ChannelAPI* WFMPlugin::createChannelWebAPIAdapter() const +{ + return new WFMDemodWebAPIAdapter(); +} diff --git a/plugins/channelrx/demodwfm/wfmplugin.h b/plugins/channelrx/demodwfm/wfmplugin.h index 38d6d028b..aff6a7ce1 100644 --- a/plugins/channelrx/demodwfm/wfmplugin.h +++ b/plugins/channelrx/demodwfm/wfmplugin.h @@ -21,6 +21,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/freqtracker/CMakeLists.txt b/plugins/channelrx/freqtracker/CMakeLists.txt index bd0e3512e..453e501e8 100644 --- a/plugins/channelrx/freqtracker/CMakeLists.txt +++ b/plugins/channelrx/freqtracker/CMakeLists.txt @@ -2,13 +2,15 @@ project(freqtracker) set(freqtracker_SOURCES freqtracker.cpp - freqtrackersettings.cpp + freqtrackersettings.cpp + freqtrackerwebapiadapter.cpp freqtrackerplugin.cpp ) set(freqtracker_HEADERS freqtracker.h - freqtrackersettings.h + freqtrackersettings.h + freqtrackerwebapiadapter.h freqtrackerplugin.h ) diff --git a/plugins/channelrx/freqtracker/freqtrackerplugin.cpp b/plugins/channelrx/freqtracker/freqtrackerplugin.cpp index a40ca191b..09cfe70c0 100644 --- a/plugins/channelrx/freqtracker/freqtrackerplugin.cpp +++ b/plugins/channelrx/freqtracker/freqtrackerplugin.cpp @@ -22,11 +22,12 @@ #include "freqtrackergui.h" #endif #include "freqtracker.h" +#include "freqtrackerwebapiadapter.h" #include "freqtrackerplugin.h" const PluginDescriptor FreqTrackerPlugin::m_pluginDescriptor = { QString("Frequency Tracker"), - QString("4.7.0"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -76,3 +77,7 @@ ChannelAPI* FreqTrackerPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new FreqTracker(deviceAPI); } +ChannelAPI* FreqTrackerPlugin::createChannelWebAPIAdapter() const +{ + return new FreqTrackerWebAPIAdapter(); +} diff --git a/plugins/channelrx/freqtracker/freqtrackerplugin.h b/plugins/channelrx/freqtracker/freqtrackerplugin.h index b6eb7f57d..ef4301455 100644 --- a/plugins/channelrx/freqtracker/freqtrackerplugin.h +++ b/plugins/channelrx/freqtracker/freqtrackerplugin.h @@ -38,6 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/freqtracker/freqtrackerwebapiadapter.cpp b/plugins/channelrx/freqtracker/freqtrackerwebapiadapter.cpp new file mode 100644 index 000000000..de5678274 --- /dev/null +++ b/plugins/channelrx/freqtracker/freqtrackerwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "freqtracker.h" +#include "freqtrackerwebapiadapter.h" + +FreqTrackerWebAPIAdapter::FreqTrackerWebAPIAdapter() : + ChannelAPI(FreqTracker::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +FreqTrackerWebAPIAdapter::~FreqTrackerWebAPIAdapter() +{} + +int FreqTrackerWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setFreqTrackerSettings(new SWGSDRangel::SWGFreqTrackerSettings()); + response.getFreqTrackerSettings()->init(); + FreqTracker::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int FreqTrackerWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + FreqTracker::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/freqtracker/freqtrackerwebapiadapter.h b/plugins/channelrx/freqtracker/freqtrackerwebapiadapter.h new file mode 100644 index 000000000..1da874f0e --- /dev/null +++ b/plugins/channelrx/freqtracker/freqtrackerwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_FREQTRACKER_WEBAPIADAPTER_H +#define INCLUDE_FREQTRACKER_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "freqtrackersettings.h" + +/** + * Standalone API adapter only for the settings + */ +class FreqTrackerWebAPIAdapter : public ChannelAPI { +public: + FreqTrackerWebAPIAdapter(); + virtual ~FreqTrackerWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + FreqTrackerSettings m_settings; +}; + +#endif // INCLUDE_FREQTRACKER_WEBAPIADAPTER_H diff --git a/plugins/channelrx/localsink/CMakeLists.txt b/plugins/channelrx/localsink/CMakeLists.txt index 38db1ec07..4ab92d520 100644 --- a/plugins/channelrx/localsink/CMakeLists.txt +++ b/plugins/channelrx/localsink/CMakeLists.txt @@ -3,13 +3,15 @@ project(localsink) set(localsink_SOURCES localsink.cpp localsinksettings.cpp + localsinkwebapiadapter.cpp localsinkthread.cpp localsinkplugin.cpp ) set(localsink_HEADERS localsink.h - localsinksettings.h + localsinksettings.h + localsinkwebapiadapter.h localsinkthread.h localsinkplugin.h ) diff --git a/plugins/channelrx/localsink/localsinkplugin.cpp b/plugins/channelrx/localsink/localsinkplugin.cpp index adf031d38..01cf9e408 100644 --- a/plugins/channelrx/localsink/localsinkplugin.cpp +++ b/plugins/channelrx/localsink/localsinkplugin.cpp @@ -24,10 +24,12 @@ #include "localsinkgui.h" #endif #include "localsink.h" +#include "localsinkwebapiadapter.h" +#include "localsinkplugin.h" const PluginDescriptor LocalSinkPlugin::m_pluginDescriptor = { QString("Local channel sink"), - QString("4.6.0"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -76,3 +78,8 @@ ChannelAPI* LocalSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const { return new LocalSink(deviceAPI); } + +ChannelAPI* LocalSinkPlugin::createChannelWebAPIAdapter() const +{ + return new LocalSinkWebAPIAdapter(); +} diff --git a/plugins/channelrx/localsink/localsinkplugin.h b/plugins/channelrx/localsink/localsinkplugin.h index 926752f29..81b579aa5 100644 --- a/plugins/channelrx/localsink/localsinkplugin.h +++ b/plugins/channelrx/localsink/localsinkplugin.h @@ -39,6 +39,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/localsink/localsinkwebapiadapter.cpp b/plugins/channelrx/localsink/localsinkwebapiadapter.cpp new file mode 100644 index 000000000..cd7043f03 --- /dev/null +++ b/plugins/channelrx/localsink/localsinkwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "localsink.h" +#include "localsinkwebapiadapter.h" + +LocalSinkWebAPIAdapter::LocalSinkWebAPIAdapter() : + ChannelAPI(LocalSink::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +LocalSinkWebAPIAdapter::~LocalSinkWebAPIAdapter() +{} + +int LocalSinkWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setLocalSinkSettings(new SWGSDRangel::SWGLocalSinkSettings()); + response.getLocalSinkSettings()->init(); + LocalSink::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int LocalSinkWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + LocalSink::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/localsink/localsinkwebapiadapter.h b/plugins/channelrx/localsink/localsinkwebapiadapter.h new file mode 100644 index 000000000..b8f619046 --- /dev/null +++ b/plugins/channelrx/localsink/localsinkwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_LOCALSINK_WEBAPIADAPTER_H +#define INCLUDE_LOCALSINK_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "localsinksettings.h" + +/** + * Standalone API adapter only for the settings + */ +class LocalSinkWebAPIAdapter : public ChannelAPI { +public: + LocalSinkWebAPIAdapter(); + virtual ~LocalSinkWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + LocalSinkSettings m_settings; +}; + +#endif // INCLUDE_LOCALSINK_WEBAPIADAPTER_H diff --git a/plugins/channelrx/remotesink/CMakeLists.txt b/plugins/channelrx/remotesink/CMakeLists.txt index 98e5ba82b..dcb42329d 100644 --- a/plugins/channelrx/remotesink/CMakeLists.txt +++ b/plugins/channelrx/remotesink/CMakeLists.txt @@ -11,14 +11,16 @@ endif() set(remotesink_SOURCES remotesink.cpp - remotesinksettings.cpp + remotesinksettings.cpp + remotesinkwebapiadapter.cpp remotesinkthread.cpp remotesinkplugin.cpp ) set(remotesink_HEADERS remotesink.h - remotesinksettings.h + remotesinksettings.h + remotesinkwebapiadapter.h remotesinkthread.h remotesinkplugin.h ) diff --git a/plugins/channelrx/remotesink/remotesinkplugin.cpp b/plugins/channelrx/remotesink/remotesinkplugin.cpp index 8c4be73cd..101c4bb90 100644 --- a/plugins/channelrx/remotesink/remotesinkplugin.cpp +++ b/plugins/channelrx/remotesink/remotesinkplugin.cpp @@ -24,10 +24,12 @@ #include "remotesinkgui.h" #endif #include "remotesink.h" +#include "remotesinkwebapiadapter.h" +#include "remotesinkplugin.h" const PluginDescriptor RemoteSinkPlugin::m_pluginDescriptor = { QString("Remote channel sink"), - QString("4.5.6"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -77,6 +79,7 @@ ChannelAPI* RemoteSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new RemoteSink(deviceAPI); } - - - +ChannelAPI* RemoteSinkPlugin::createChannelWebAPIAdapter() const +{ + return new RemoteSinkWebAPIAdapter(); +} diff --git a/plugins/channelrx/remotesink/remotesinkplugin.h b/plugins/channelrx/remotesink/remotesinkplugin.h index 2fb44b673..4e71514f8 100644 --- a/plugins/channelrx/remotesink/remotesinkplugin.h +++ b/plugins/channelrx/remotesink/remotesinkplugin.h @@ -39,6 +39,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/remotesink/remotesinkwebapiadapter.cpp b/plugins/channelrx/remotesink/remotesinkwebapiadapter.cpp new file mode 100644 index 000000000..41d55b389 --- /dev/null +++ b/plugins/channelrx/remotesink/remotesinkwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "remotesink.h" +#include "remotesinkwebapiadapter.h" + +RemoteSinkWebAPIAdapter::RemoteSinkWebAPIAdapter() : + ChannelAPI(RemoteSink::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +RemoteSinkWebAPIAdapter::~RemoteSinkWebAPIAdapter() +{} + +int RemoteSinkWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setRemoteSinkSettings(new SWGSDRangel::SWGRemoteSinkSettings()); + response.getRemoteSinkSettings()->init(); + RemoteSink::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int RemoteSinkWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + RemoteSink::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/remotesink/remotesinkwebapiadapter.h b/plugins/channelrx/remotesink/remotesinkwebapiadapter.h new file mode 100644 index 000000000..b4e870d29 --- /dev/null +++ b/plugins/channelrx/remotesink/remotesinkwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_REMOTESINK_WEBAPIADAPTER_H +#define INCLUDE_REMOTESINK_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "remotesinksettings.h" + +/** + * Standalone API adapter only for the settings + */ +class RemoteSinkWebAPIAdapter : public ChannelAPI { +public: + RemoteSinkWebAPIAdapter(); + virtual ~RemoteSinkWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + RemoteSinkSettings m_settings; +}; + +#endif // INCLUDE_REMOTESINK_WEBAPIADAPTER_H diff --git a/plugins/channelrx/udpsink/CMakeLists.txt b/plugins/channelrx/udpsink/CMakeLists.txt index 9ca3f29a1..924fc2a8d 100644 --- a/plugins/channelrx/udpsink/CMakeLists.txt +++ b/plugins/channelrx/udpsink/CMakeLists.txt @@ -3,13 +3,15 @@ project(udpsink) set(udpsink_SOURCES udpsink.cpp udpsinkplugin.cpp - udpsinksettings.cpp + udpsinksettings.cpp + udpsinkwebapiadapter.cpp ) set(udpsink_HEADERS udpsink.h udpsinkplugin.h - udpsinksettings.h + udpsinksettings.h + udpsinkwebapiadapter.h ) include_directories( diff --git a/plugins/channelrx/udpsink/udpsinkplugin.cpp b/plugins/channelrx/udpsink/udpsinkplugin.cpp index c13f3783d..02e597b7d 100644 --- a/plugins/channelrx/udpsink/udpsinkplugin.cpp +++ b/plugins/channelrx/udpsink/udpsinkplugin.cpp @@ -23,11 +23,12 @@ #include "udpsinkgui.h" #endif #include "udpsink.h" +#include "udpsinkwebapiadapter.h" #include "udpsinkplugin.h" const PluginDescriptor UDPSinkPlugin::m_pluginDescriptor = { QString("UDP Channel Sink"), - QString("4.5.2"), + QString("4.11.6"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -77,3 +78,7 @@ ChannelAPI* UDPSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const return new UDPSink(deviceAPI); } +ChannelAPI* UDPSinkPlugin::createChannelWebAPIAdapter() const +{ + return new UDPSinkWebAPIAdapter(); +} diff --git a/plugins/channelrx/udpsink/udpsinkplugin.h b/plugins/channelrx/udpsink/udpsinkplugin.h index 8164014e3..4172b8547 100644 --- a/plugins/channelrx/udpsink/udpsinkplugin.h +++ b/plugins/channelrx/udpsink/udpsinkplugin.h @@ -39,6 +39,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; + virtual ChannelAPI* createChannelWebAPIAdapter() const; private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/udpsink/udpsinkwebapiadapter.cpp b/plugins/channelrx/udpsink/udpsinkwebapiadapter.cpp new file mode 100644 index 000000000..ed22bf2f4 --- /dev/null +++ b/plugins/channelrx/udpsink/udpsinkwebapiadapter.cpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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 "udpsink.h" +#include "udpsinkwebapiadapter.h" + +UDPSinkWebAPIAdapter::UDPSinkWebAPIAdapter() : + ChannelAPI(UDPSink::m_channelIdURI, ChannelAPI::StreamSingleSink) +{} + +UDPSinkWebAPIAdapter::~UDPSinkWebAPIAdapter() +{} + +int UDPSinkWebAPIAdapter::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setUdpSinkSettings(new SWGSDRangel::SWGUDPSinkSettings()); + response.getUdpSinkSettings()->init(); + UDPSink::webapiFormatChannelSettings(response, m_settings); + + return 200; +} + +int UDPSinkWebAPIAdapter::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) +{ + (void) errorMessage; + UDPSink::webapiUpdateChannelSettings(m_settings, channelSettingsKeys, response); + + return 200; +} diff --git a/plugins/channelrx/udpsink/udpsinkwebapiadapter.h b/plugins/channelrx/udpsink/udpsinkwebapiadapter.h new file mode 100644 index 000000000..2d7098374 --- /dev/null +++ b/plugins/channelrx/udpsink/udpsinkwebapiadapter.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////// +// 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_UDPSINK_WEBAPIADAPTER_H +#define INCLUDE_UDPSINK_WEBAPIADAPTER_H + +#include "channel/channelapi.h" +#include "udpsinksettings.h" + +/** + * Standalone API adapter only for the settings + */ +class UDPSinkWebAPIAdapter : public ChannelAPI { +public: + UDPSinkWebAPIAdapter(); + virtual ~UDPSinkWebAPIAdapter(); + + // unused pure virtual methods + virtual void destroy() {} + virtual void getIdentifier(QString& id) {} + virtual void getTitle(QString& title) {} + virtual qint64 getCenterFrequency() const { return 0; } + virtual int getNbSinkStreams() const { return 1; } + virtual int getNbSourceStreams() const { return 0; } + + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const + { + (void) streamIndex; + (void) sinkElseSource; + return 0; + } + + // virtual methods actually implemented + virtual QByteArray serialize() const { return m_settings.serialize(); } + virtual bool deserialize(const QByteArray& data) { 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); + +private: + UDPSinkSettings m_settings; +}; + +#endif // INCLUDE_UDPSINK_WEBAPIADAPTER_H