From a5e9f251efa393c75e792781c481e6c21476669b Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 9 May 2019 17:27:12 +0200 Subject: [PATCH] Single channel API --- plugins/channelrx/chanalyzer/chanalyzer.cpp | 2 +- plugins/channelrx/chanalyzer/chanalyzer.h | 14 ++- .../channelrx/chanalyzer/chanalyzerplugin.cpp | 2 +- .../channelrx/chanalyzer/chanalyzerplugin.h | 2 +- plugins/channelrx/demodam/amdemod.cpp | 2 +- plugins/channelrx/demodam/amdemod.h | 14 ++- plugins/channelrx/demodam/amdemodplugin.cpp | 2 +- plugins/channelrx/demodam/amdemodplugin.h | 2 +- plugins/channelrx/demodatv/atvdemod.cpp | 2 +- plugins/channelrx/demodatv/atvdemod.h | 14 ++- plugins/channelrx/demodatv/atvdemodplugin.cpp | 2 +- plugins/channelrx/demodatv/atvdemodplugin.h | 2 +- plugins/channelrx/demodbfm/bfmdemod.cpp | 2 +- plugins/channelrx/demodbfm/bfmdemod.h | 14 ++- plugins/channelrx/demodbfm/bfmplugin.cpp | 2 +- plugins/channelrx/demodbfm/bfmplugin.h | 2 +- plugins/channelrx/demoddatv/datvdemod.cpp | 2 +- plugins/channelrx/demoddatv/datvdemod.h | 14 ++- .../channelrx/demoddatv/datvdemodplugin.cpp | 2 +- plugins/channelrx/demoddatv/datvdemodplugin.h | 2 +- plugins/channelrx/demoddsd/dsddemod.cpp | 2 +- plugins/channelrx/demoddsd/dsddemod.h | 14 ++- plugins/channelrx/demoddsd/dsddemodplugin.cpp | 2 +- plugins/channelrx/demoddsd/dsddemodplugin.h | 2 +- plugins/channelrx/demodfreedv/freedvdemod.cpp | 2 +- plugins/channelrx/demodfreedv/freedvdemod.h | 14 ++- .../channelrx/demodfreedv/freedvplugin.cpp | 2 +- plugins/channelrx/demodfreedv/freedvplugin.h | 2 +- plugins/channelrx/demodlora/lorademod.cpp | 2 +- plugins/channelrx/demodlora/lorademod.h | 14 ++- plugins/channelrx/demodlora/loraplugin.cpp | 2 +- plugins/channelrx/demodlora/loraplugin.h | 2 +- plugins/channelrx/demodnfm/nfmdemod.cpp | 2 +- plugins/channelrx/demodnfm/nfmdemod.h | 14 ++- plugins/channelrx/demodnfm/nfmplugin.cpp | 2 +- plugins/channelrx/demodnfm/nfmplugin.h | 2 +- plugins/channelrx/demodssb/ssbdemod.cpp | 2 +- plugins/channelrx/demodssb/ssbdemod.h | 14 ++- plugins/channelrx/demodssb/ssbplugin.cpp | 2 +- plugins/channelrx/demodssb/ssbplugin.h | 2 +- plugins/channelrx/demodwfm/wfmdemod.cpp | 2 +- plugins/channelrx/demodwfm/wfmdemod.h | 14 ++- plugins/channelrx/demodwfm/wfmplugin.cpp | 2 +- plugins/channelrx/demodwfm/wfmplugin.h | 2 +- plugins/channelrx/freqtracker/freqtracker.cpp | 2 +- plugins/channelrx/freqtracker/freqtracker.h | 14 ++- .../freqtracker/freqtrackerplugin.cpp | 2 +- .../channelrx/freqtracker/freqtrackerplugin.h | 2 +- plugins/channelrx/localsink/localsink.cpp | 6 +- plugins/channelrx/localsink/localsink.h | 14 ++- .../channelrx/localsink/localsinkplugin.cpp | 2 +- plugins/channelrx/localsink/localsinkplugin.h | 2 +- plugins/channelrx/remotesink/remotesink.cpp | 2 +- plugins/channelrx/remotesink/remotesink.h | 14 ++- .../channelrx/remotesink/remotesinkplugin.cpp | 2 +- .../channelrx/remotesink/remotesinkplugin.h | 2 +- plugins/channelrx/udpsink/udpsink.cpp | 2 +- plugins/channelrx/udpsink/udpsink.h | 14 ++- plugins/channelrx/udpsink/udpsinkplugin.cpp | 2 +- plugins/channelrx/udpsink/udpsinkplugin.h | 2 +- plugins/channeltx/modam/ammod.cpp | 2 +- plugins/channeltx/modam/ammod.h | 14 ++- plugins/channeltx/modam/ammodplugin.cpp | 2 +- plugins/channeltx/modam/ammodplugin.h | 2 +- plugins/channeltx/modatv/atvmod.cpp | 2 +- plugins/channeltx/modatv/atvmod.h | 14 ++- plugins/channeltx/modatv/atvmodplugin.cpp | 2 +- plugins/channeltx/modatv/atvmodplugin.h | 2 +- plugins/channeltx/modfreedv/freedvmod.cpp | 2 +- plugins/channeltx/modfreedv/freedvmod.h | 14 ++- .../channeltx/modfreedv/freedvmodplugin.cpp | 2 +- plugins/channeltx/modfreedv/freedvmodplugin.h | 2 +- plugins/channeltx/modnfm/nfmmod.cpp | 2 +- plugins/channeltx/modnfm/nfmmod.h | 14 ++- plugins/channeltx/modnfm/nfmmodplugin.cpp | 2 +- plugins/channeltx/modnfm/nfmmodplugin.h | 2 +- plugins/channeltx/modssb/ssbmod.cpp | 2 +- plugins/channeltx/modssb/ssbmod.h | 14 ++- plugins/channeltx/modssb/ssbmodplugin.cpp | 2 +- plugins/channeltx/modssb/ssbmodplugin.h | 2 +- plugins/channeltx/modwfm/wfmmod.cpp | 2 +- plugins/channeltx/modwfm/wfmmod.h | 14 ++- plugins/channeltx/modwfm/wfmmodplugin.cpp | 2 +- plugins/channeltx/modwfm/wfmmodplugin.h | 2 +- .../channeltx/remotesource/remotesource.cpp | 2 +- plugins/channeltx/remotesource/remotesource.h | 21 +++- .../remotesource/remotesourceplugin.cpp | 2 +- .../remotesource/remotesourceplugin.h | 2 +- plugins/channeltx/udpsource/udpsource.cpp | 2 +- plugins/channeltx/udpsource/udpsource.h | 14 ++- .../channeltx/udpsource/udpsourceplugin.cpp | 2 +- plugins/channeltx/udpsource/udpsourceplugin.h | 2 +- sdrbase/CMakeLists.txt | 10 +- sdrbase/channel/channelapi.cpp | 29 +++++ sdrbase/channel/channelapi.h | 116 ++++++++++++++++++ sdrbase/device/deviceapi.cpp | 29 +++-- sdrbase/device/deviceapi.h | 19 ++- sdrbase/plugin/plugininterface.h | 7 +- sdrbase/sdrbase.pro | 8 +- sdrgui/webapi/webapiadaptergui.cpp | 23 ++-- sdrsrv/device/deviceset.cpp | 41 +++++-- sdrsrv/device/deviceset.h | 31 ++--- sdrsrv/webapi/webapiadaptersrv.cpp | 23 ++-- 103 files changed, 600 insertions(+), 207 deletions(-) create mode 100644 sdrbase/channel/channelapi.cpp create mode 100644 sdrbase/channel/channelapi.h diff --git a/plugins/channelrx/chanalyzer/chanalyzer.cpp b/plugins/channelrx/chanalyzer/chanalyzer.cpp index 8517d8d23..6fd3b66fa 100644 --- a/plugins/channelrx/chanalyzer/chanalyzer.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzer.cpp @@ -33,7 +33,7 @@ const QString ChannelAnalyzer::m_channelIdURI = "sdrangel.channel.chanalyzer"; const QString ChannelAnalyzer::m_channelId = "ChannelAnalyzer"; ChannelAnalyzer::ChannelAnalyzer(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_sampleSink(0), m_settingsMutex(QMutex::Recursive) diff --git a/plugins/channelrx/chanalyzer/chanalyzer.h b/plugins/channelrx/chanalyzer/chanalyzer.h index 4470d007e..f90bd6295 100644 --- a/plugins/channelrx/chanalyzer/chanalyzer.h +++ b/plugins/channelrx/chanalyzer/chanalyzer.h @@ -22,7 +22,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/interpolator.h" #include "dsp/ncof.h" #include "dsp/fftcorr.h" @@ -41,7 +41,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class ChannelAnalyzer : public BasebandSampleSink, public ChannelSinkAPI { +class ChannelAnalyzer : public BasebandSampleSink, public ChannelAPI { public: class MsgConfigureChannelAnalyzer : public Message { MESSAGE_CLASS_DECLARATION @@ -144,6 +144,16 @@ public: virtual QByteArray serialize() const { return QByteArray(); } virtual bool deserialize(const QByteArray& data) { (void) data; return false; } + 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 m_settings.m_frequency; + } + static const QString m_channelIdURI; static const QString m_channelId; diff --git a/plugins/channelrx/chanalyzer/chanalyzerplugin.cpp b/plugins/channelrx/chanalyzer/chanalyzerplugin.cpp index bddea090f..8ef33224f 100644 --- a/plugins/channelrx/chanalyzer/chanalyzerplugin.cpp +++ b/plugins/channelrx/chanalyzer/chanalyzerplugin.cpp @@ -60,7 +60,7 @@ BasebandSampleSink* ChannelAnalyzerPlugin::createRxChannelBS(DeviceAPI *deviceAP return new ChannelAnalyzer(deviceAPI); } -ChannelSinkAPI* ChannelAnalyzerPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* ChannelAnalyzerPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new ChannelAnalyzer(deviceAPI); } diff --git a/plugins/channelrx/chanalyzer/chanalyzerplugin.h b/plugins/channelrx/chanalyzer/chanalyzerplugin.h index 4234d3ac5..d6c13707c 100644 --- a/plugins/channelrx/chanalyzer/chanalyzerplugin.h +++ b/plugins/channelrx/chanalyzer/chanalyzerplugin.h @@ -38,7 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodam/amdemod.cpp b/plugins/channelrx/demodam/amdemod.cpp index 7bb417e75..18ab637e1 100644 --- a/plugins/channelrx/demodam/amdemod.cpp +++ b/plugins/channelrx/demodam/amdemod.cpp @@ -49,7 +49,7 @@ const QString AMDemod::m_channelId = "AMDemod"; const int AMDemod::m_udpBlockSize = 512; AMDemod::AMDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_inputSampleRate(48000), m_inputFrequencyOffset(0), diff --git a/plugins/channelrx/demodam/amdemod.h b/plugins/channelrx/demodam/amdemod.h index a217742c6..7abf39f22 100644 --- a/plugins/channelrx/demodam/amdemod.h +++ b/plugins/channelrx/demodam/amdemod.h @@ -24,7 +24,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/interpolator.h" #include "util/movingaverage.h" @@ -45,7 +45,7 @@ class DownChannelizer; class ThreadedBasebandSampleSink; class fftfilt; -class AMDemod : public BasebandSampleSink, public ChannelSinkAPI { +class AMDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureAMDemod : public Message { @@ -110,6 +110,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channelrx/demodam/amdemodplugin.cpp b/plugins/channelrx/demodam/amdemodplugin.cpp index 8c3248198..f3e285ccb 100644 --- a/plugins/channelrx/demodam/amdemodplugin.cpp +++ b/plugins/channelrx/demodam/amdemodplugin.cpp @@ -54,7 +54,7 @@ BasebandSampleSink* AMDemodPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new AMDemod(deviceAPI); } -ChannelSinkAPI* AMDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* AMDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new AMDemod(deviceAPI); } diff --git a/plugins/channelrx/demodam/amdemodplugin.h b/plugins/channelrx/demodam/amdemodplugin.h index a21c7f9fc..5d2cbe9d9 100644 --- a/plugins/channelrx/demodam/amdemodplugin.h +++ b/plugins/channelrx/demodam/amdemodplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index 618612691..c8839910b 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -40,7 +40,7 @@ const QString ATVDemod::m_channelId = "ATVDemod"; const int ATVDemod::m_ssbFftLen = 1024; ATVDemod::ATVDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_scopeSink(0), m_registeredTVScreen(0), diff --git a/plugins/channelrx/demodatv/atvdemod.h b/plugins/channelrx/demodatv/atvdemod.h index 7e4db2eee..37b527611 100644 --- a/plugins/channelrx/demodatv/atvdemod.h +++ b/plugins/channelrx/demodatv/atvdemod.h @@ -24,7 +24,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/devicesamplesource.h" #include "dsp/dspcommands.h" #include "dsp/downchannelizer.h" @@ -44,7 +44,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class ATVDemod : public BasebandSampleSink, public ChannelSinkAPI +class ATVDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT @@ -233,6 +233,16 @@ public: virtual QByteArray serialize() const { return QByteArray(); } virtual bool deserialize(const QByteArray& data) { (void) data; return false; } + 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 m_rfRunning.m_intFrequencyOffset; + } + void setTVScreen(TVScreen *objScreen); //!< set by the GUI int getSampleRate(); int getEffectiveSampleRate(); diff --git a/plugins/channelrx/demodatv/atvdemodplugin.cpp b/plugins/channelrx/demodatv/atvdemodplugin.cpp index b457df02c..74c1451a0 100644 --- a/plugins/channelrx/demodatv/atvdemodplugin.cpp +++ b/plugins/channelrx/demodatv/atvdemodplugin.cpp @@ -65,7 +65,7 @@ BasebandSampleSink* ATVDemodPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new ATVDemod(deviceAPI); } -ChannelSinkAPI* ATVDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* ATVDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new ATVDemod(deviceAPI); } diff --git a/plugins/channelrx/demodatv/atvdemodplugin.h b/plugins/channelrx/demodatv/atvdemodplugin.h index afa89eaeb..55ef3bdb8 100644 --- a/plugins/channelrx/demodatv/atvdemodplugin.h +++ b/plugins/channelrx/demodatv/atvdemodplugin.h @@ -39,7 +39,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_ptrPluginDescriptor; diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index ecaa1605b..77364e19a 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -53,7 +53,7 @@ const Real BFMDemod::default_deemphasis = 50.0; // 50 us const int BFMDemod::m_udpBlockSize = 512; BFMDemod::BFMDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_inputSampleRate(384000), m_inputFrequencyOffset(0), diff --git a/plugins/channelrx/demodbfm/bfmdemod.h b/plugins/channelrx/demodbfm/bfmdemod.h index 48f9bb80b..c367fc957 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.h +++ b/plugins/channelrx/demodbfm/bfmdemod.h @@ -25,7 +25,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/interpolator.h" #include "dsp/lowpass.h" @@ -52,7 +52,7 @@ namespace SWGSDRangel { class SWGRDSReport; } -class BFMDemod : public BasebandSampleSink, public ChannelSinkAPI { +class BFMDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureBFMDemod : public Message { @@ -139,6 +139,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + double getMagSq() const { return m_magsq; } bool getPilotLock() const { return m_pilotPLL.locked(); } diff --git a/plugins/channelrx/demodbfm/bfmplugin.cpp b/plugins/channelrx/demodbfm/bfmplugin.cpp index 1200bbf3a..a2e993c40 100644 --- a/plugins/channelrx/demodbfm/bfmplugin.cpp +++ b/plugins/channelrx/demodbfm/bfmplugin.cpp @@ -73,7 +73,7 @@ BasebandSampleSink* BFMPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new BFMDemod(deviceAPI); } -ChannelSinkAPI* BFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* BFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new BFMDemod(deviceAPI); } diff --git a/plugins/channelrx/demodbfm/bfmplugin.h b/plugins/channelrx/demodbfm/bfmplugin.h index 984a81fa7..ffa974ed2 100644 --- a/plugins/channelrx/demodbfm/bfmplugin.h +++ b/plugins/channelrx/demodbfm/bfmplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demoddatv/datvdemod.cpp b/plugins/channelrx/demoddatv/datvdemod.cpp index 36cfe4817..13e7be2a8 100644 --- a/plugins/channelrx/demoddatv/datvdemod.cpp +++ b/plugins/channelrx/demoddatv/datvdemod.cpp @@ -37,7 +37,7 @@ MESSAGE_CLASS_DEFINITION(DATVDemod::MsgConfigureDATVDemod, Message) MESSAGE_CLASS_DEFINITION(DATVDemod::MsgConfigureChannelizer, Message) DATVDemod::DATVDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_blnNeedConfigUpdate(false), m_deviceAPI(deviceAPI), m_objRegisteredTVScreen(0), diff --git a/plugins/channelrx/demoddatv/datvdemod.h b/plugins/channelrx/demoddatv/datvdemod.h index 842d0ed04..fa07d30db 100644 --- a/plugins/channelrx/demoddatv/datvdemod.h +++ b/plugins/channelrx/demoddatv/datvdemod.h @@ -44,7 +44,7 @@ class DownChannelizer; #include "datvideorender.h" #include "datvdemodsettings.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/basebandsamplesink.h" #include "dsp/devicesamplesource.h" #include "dsp/dspcommands.h" @@ -123,7 +123,7 @@ struct config } }; -class DATVDemod : public BasebandSampleSink, public ChannelSinkAPI +class DATVDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT @@ -145,6 +145,16 @@ public: virtual void stop(); virtual bool handleMessage(const Message& cmd); + 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 m_settings.m_centerFrequency; + } + bool SetTVScreen(TVScreen *objScreen); DATVideostream * SetVideoRender(DATVideoRender *objScreen); bool audioActive(); diff --git a/plugins/channelrx/demoddatv/datvdemodplugin.cpp b/plugins/channelrx/demoddatv/datvdemodplugin.cpp index 7d8f72624..f752d3c25 100644 --- a/plugins/channelrx/demoddatv/datvdemodplugin.cpp +++ b/plugins/channelrx/demoddatv/datvdemodplugin.cpp @@ -66,7 +66,7 @@ BasebandSampleSink* DATVDemodPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new DATVDemod(deviceAPI); } -ChannelSinkAPI* DATVDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* DATVDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new DATVDemod(deviceAPI); } diff --git a/plugins/channelrx/demoddatv/datvdemodplugin.h b/plugins/channelrx/demoddatv/datvdemodplugin.h index c6019f9c6..76ac1fd17 100644 --- a/plugins/channelrx/demoddatv/datvdemodplugin.h +++ b/plugins/channelrx/demoddatv/datvdemodplugin.h @@ -40,7 +40,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: diff --git a/plugins/channelrx/demoddsd/dsddemod.cpp b/plugins/channelrx/demoddsd/dsddemod.cpp index 46ef1b7f8..c62d43fad 100644 --- a/plugins/channelrx/demoddsd/dsddemod.cpp +++ b/plugins/channelrx/demoddsd/dsddemod.cpp @@ -52,7 +52,7 @@ const QString DSDDemod::m_channelId = "DSDDemod"; const int DSDDemod::m_udpBlockSize = 512; DSDDemod::DSDDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_inputSampleRate(48000), m_inputFrequencyOffset(0), diff --git a/plugins/channelrx/demoddsd/dsddemod.h b/plugins/channelrx/demoddsd/dsddemod.h index 2fb94698b..037e09d26 100644 --- a/plugins/channelrx/demoddsd/dsddemod.h +++ b/plugins/channelrx/demoddsd/dsddemod.h @@ -25,7 +25,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/phasediscri.h" #include "dsp/nco.h" #include "dsp/interpolator.h" @@ -47,7 +47,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class DSDDemod : public BasebandSampleSink, public ChannelSinkAPI { +class DSDDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureDSDDemod : public Message { @@ -115,6 +115,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + double getMagSq() { return m_magsq; } bool getSquelchOpen() const { return m_squelchOpen; } diff --git a/plugins/channelrx/demoddsd/dsddemodplugin.cpp b/plugins/channelrx/demoddsd/dsddemodplugin.cpp index 68cc52b31..d421183dd 100644 --- a/plugins/channelrx/demoddsd/dsddemodplugin.cpp +++ b/plugins/channelrx/demoddsd/dsddemodplugin.cpp @@ -72,7 +72,7 @@ BasebandSampleSink* DSDDemodPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new DSDDemod(deviceAPI); } -ChannelSinkAPI* DSDDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* DSDDemodPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new DSDDemod(deviceAPI); } diff --git a/plugins/channelrx/demoddsd/dsddemodplugin.h b/plugins/channelrx/demoddsd/dsddemodplugin.h index 5722b9ca7..f922ab0db 100644 --- a/plugins/channelrx/demoddsd/dsddemodplugin.h +++ b/plugins/channelrx/demoddsd/dsddemodplugin.h @@ -38,7 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index 2a2188f38..01f9bf3cd 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -145,7 +145,7 @@ void FreeDVDemod::LevelRMS::accumulate(float level) } FreeDVDemod::FreeDVDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_hiCutoff(6000), m_lowCutoff(0), diff --git a/plugins/channelrx/demodfreedv/freedvdemod.h b/plugins/channelrx/demodfreedv/freedvdemod.h index e0cbc8e9c..50352af96 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.h +++ b/plugins/channelrx/demodfreedv/freedvdemod.h @@ -24,7 +24,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" #include "dsp/fftfilt.h" @@ -49,7 +49,7 @@ namespace FreeDV { struct freedv; } -class FreeDVDemod : public BasebandSampleSink, public ChannelSinkAPI { +class FreeDVDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureFreeDVDemod : public Message { @@ -143,6 +143,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + uint32_t getAudioSampleRate() const { return m_audioSampleRate; } uint32_t getModemSampleRate() const { return m_modemSampleRate; } double getMagSq() const { return m_magsq; } diff --git a/plugins/channelrx/demodfreedv/freedvplugin.cpp b/plugins/channelrx/demodfreedv/freedvplugin.cpp index 6c8d3d956..f965e8948 100644 --- a/plugins/channelrx/demodfreedv/freedvplugin.cpp +++ b/plugins/channelrx/demodfreedv/freedvplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSink* FreeDVPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new FreeDVDemod(deviceAPI); } -ChannelSinkAPI* FreeDVPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* FreeDVPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new FreeDVDemod(deviceAPI); } diff --git a/plugins/channelrx/demodfreedv/freedvplugin.h b/plugins/channelrx/demodfreedv/freedvplugin.h index 0babf3ece..cbe151b6b 100644 --- a/plugins/channelrx/demodfreedv/freedvplugin.h +++ b/plugins/channelrx/demodfreedv/freedvplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodlora/lorademod.cpp b/plugins/channelrx/demodlora/lorademod.cpp index 43e73c8de..ecd1f3723 100644 --- a/plugins/channelrx/demodlora/lorademod.cpp +++ b/plugins/channelrx/demodlora/lorademod.cpp @@ -37,7 +37,7 @@ const QString LoRaDemod::m_channelIdURI = "sdrangel.channel.lorademod"; const QString LoRaDemod::m_channelId = "LoRaDemod"; LoRaDemod::LoRaDemod(DeviceAPI* deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_sampleSink(0), m_settingsMutex(QMutex::Recursive) diff --git a/plugins/channelrx/demodlora/lorademod.h b/plugins/channelrx/demodlora/lorademod.h index df1fadf1d..60f12d9d6 100644 --- a/plugins/channelrx/demodlora/lorademod.h +++ b/plugins/channelrx/demodlora/lorademod.h @@ -23,7 +23,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/interpolator.h" #include "util/message.h" @@ -41,7 +41,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class LoRaDemod : public BasebandSampleSink, public ChannelSinkAPI { +class LoRaDemod : public BasebandSampleSink, public ChannelAPI { public: class MsgConfigureLoRaDemod : public Message { MESSAGE_CLASS_DECLARATION @@ -106,6 +106,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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; + } + static const QString m_channelIdURI; static const QString m_channelId; diff --git a/plugins/channelrx/demodlora/loraplugin.cpp b/plugins/channelrx/demodlora/loraplugin.cpp index b8e27f874..1dff2079e 100644 --- a/plugins/channelrx/demodlora/loraplugin.cpp +++ b/plugins/channelrx/demodlora/loraplugin.cpp @@ -43,7 +43,7 @@ BasebandSampleSink* LoRaPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new LoRaDemod(deviceAPI); } -ChannelSinkAPI* LoRaPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* LoRaPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new LoRaDemod(deviceAPI); } diff --git a/plugins/channelrx/demodlora/loraplugin.h b/plugins/channelrx/demodlora/loraplugin.h index 791092632..cdca99c66 100644 --- a/plugins/channelrx/demodlora/loraplugin.h +++ b/plugins/channelrx/demodlora/loraplugin.h @@ -20,7 +20,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index 42444726b..dc5518277 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -53,7 +53,7 @@ static const double afSqTones_lowrate[2] = {1000.0, 3500.0}; const int NFMDemod::m_udpBlockSize = 512; NFMDemod::NFMDemod(DeviceAPI *devieAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(devieAPI), m_inputSampleRate(48000), m_inputFrequencyOffset(0), diff --git a/plugins/channelrx/demodnfm/nfmdemod.h b/plugins/channelrx/demodnfm/nfmdemod.h index 1c268a277..a4510edb1 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.h +++ b/plugins/channelrx/demodnfm/nfmdemod.h @@ -25,7 +25,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/phasediscri.h" #include "dsp/nco.h" #include "dsp/interpolator.h" @@ -47,7 +47,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class NFMDemod : public BasebandSampleSink, public ChannelSinkAPI { +class NFMDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureNFMDemod : public Message { @@ -132,6 +132,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channelrx/demodnfm/nfmplugin.cpp b/plugins/channelrx/demodnfm/nfmplugin.cpp index 80c2afbaf..3f6f3291f 100644 --- a/plugins/channelrx/demodnfm/nfmplugin.cpp +++ b/plugins/channelrx/demodnfm/nfmplugin.cpp @@ -54,7 +54,7 @@ BasebandSampleSink* NFMPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new NFMDemod(deviceAPI); } -ChannelSinkAPI* NFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* NFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new NFMDemod(deviceAPI); } diff --git a/plugins/channelrx/demodnfm/nfmplugin.h b/plugins/channelrx/demodnfm/nfmplugin.h index ca1e7d519..e013dd4df 100644 --- a/plugins/channelrx/demodnfm/nfmplugin.h +++ b/plugins/channelrx/demodnfm/nfmplugin.h @@ -20,7 +20,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodssb/ssbdemod.cpp b/plugins/channelrx/demodssb/ssbdemod.cpp index 212f091e9..b76a6dd79 100644 --- a/plugins/channelrx/demodssb/ssbdemod.cpp +++ b/plugins/channelrx/demodssb/ssbdemod.cpp @@ -49,7 +49,7 @@ const QString SSBDemod::m_channelIdURI = "sdrangel.channel.ssbdemod"; const QString SSBDemod::m_channelId = "SSBDemod"; SSBDemod::SSBDemod(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_audioBinaual(false), m_audioFlipChannels(false), diff --git a/plugins/channelrx/demodssb/ssbdemod.h b/plugins/channelrx/demodssb/ssbdemod.h index e286ff67c..873051c2f 100644 --- a/plugins/channelrx/demodssb/ssbdemod.h +++ b/plugins/channelrx/demodssb/ssbdemod.h @@ -25,7 +25,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" #include "dsp/fftfilt.h" @@ -45,7 +45,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class SSBDemod : public BasebandSampleSink, public ChannelSinkAPI { +class SSBDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureSSBDemod : public Message { @@ -126,6 +126,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + uint32_t getAudioSampleRate() const { return m_audioSampleRate; } double getMagSq() const { return m_magsq; } bool getAudioActive() const { return m_audioActive; } diff --git a/plugins/channelrx/demodssb/ssbplugin.cpp b/plugins/channelrx/demodssb/ssbplugin.cpp index 35fea2b06..7698bdc38 100644 --- a/plugins/channelrx/demodssb/ssbplugin.cpp +++ b/plugins/channelrx/demodssb/ssbplugin.cpp @@ -54,7 +54,7 @@ BasebandSampleSink* SSBPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new SSBDemod(deviceAPI); } -ChannelSinkAPI* SSBPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* SSBPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new SSBDemod(deviceAPI); } diff --git a/plugins/channelrx/demodssb/ssbplugin.h b/plugins/channelrx/demodssb/ssbplugin.h index 95056fc73..4d83bd1fc 100644 --- a/plugins/channelrx/demodssb/ssbplugin.h +++ b/plugins/channelrx/demodssb/ssbplugin.h @@ -20,7 +20,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/demodwfm/wfmdemod.cpp b/plugins/channelrx/demodwfm/wfmdemod.cpp index b7e9c278e..72b656861 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.cpp +++ b/plugins/channelrx/demodwfm/wfmdemod.cpp @@ -49,7 +49,7 @@ const QString WFMDemod::m_channelId = "WFMDemod"; const int WFMDemod::m_udpBlockSize = 512; WFMDemod::WFMDemod(DeviceAPI* deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_inputSampleRate(384000), m_inputFrequencyOffset(0), diff --git a/plugins/channelrx/demodwfm/wfmdemod.h b/plugins/channelrx/demodwfm/wfmdemod.h index ec03d12c4..dc36bb849 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.h +++ b/plugins/channelrx/demodwfm/wfmdemod.h @@ -25,7 +25,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/interpolator.h" #include "dsp/lowpass.h" @@ -45,7 +45,7 @@ class ThreadedBasebandSampleSink; class DownChannelizer; class DeviceAPI; -class WFMDemod : public BasebandSampleSink, public ChannelSinkAPI { +class WFMDemod : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureWFMDemod : public Message { @@ -110,6 +110,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + double getMagSq() const { return m_movingAverage.asDouble(); } bool getSquelchOpen() const { return m_squelchOpen; } diff --git a/plugins/channelrx/demodwfm/wfmplugin.cpp b/plugins/channelrx/demodwfm/wfmplugin.cpp index d105c3b91..6cc994f53 100644 --- a/plugins/channelrx/demodwfm/wfmplugin.cpp +++ b/plugins/channelrx/demodwfm/wfmplugin.cpp @@ -55,7 +55,7 @@ BasebandSampleSink* WFMPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new WFMDemod(deviceAPI); } -ChannelSinkAPI* WFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* WFMPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new WFMDemod(deviceAPI); } diff --git a/plugins/channelrx/demodwfm/wfmplugin.h b/plugins/channelrx/demodwfm/wfmplugin.h index 6da793627..44e818c29 100644 --- a/plugins/channelrx/demodwfm/wfmplugin.h +++ b/plugins/channelrx/demodwfm/wfmplugin.h @@ -20,7 +20,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/freqtracker/freqtracker.cpp b/plugins/channelrx/freqtracker/freqtracker.cpp index ed67e6f51..ff47abf57 100644 --- a/plugins/channelrx/freqtracker/freqtracker.cpp +++ b/plugins/channelrx/freqtracker/freqtracker.cpp @@ -51,7 +51,7 @@ const QString FreqTracker::m_channelId = "FreqTracker"; const int FreqTracker::m_udpBlockSize = 512; FreqTracker::FreqTracker(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_deviceSampleRate(48000), m_inputSampleRate(48000), diff --git a/plugins/channelrx/freqtracker/freqtracker.h b/plugins/channelrx/freqtracker/freqtracker.h index 7936ded96..fa625998c 100644 --- a/plugins/channelrx/freqtracker/freqtracker.h +++ b/plugins/channelrx/freqtracker/freqtracker.h @@ -24,7 +24,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" #include "util/movingaverage.h" @@ -46,7 +46,7 @@ class ThreadedBasebandSampleSink; class QTimer; class fftfilt; -class FreqTracker : public BasebandSampleSink, public ChannelSinkAPI { +class FreqTracker : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureFreqTracker : public Message { @@ -133,6 +133,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channelrx/freqtracker/freqtrackerplugin.cpp b/plugins/channelrx/freqtracker/freqtrackerplugin.cpp index 2b4c13582..195a62ff1 100644 --- a/plugins/channelrx/freqtracker/freqtrackerplugin.cpp +++ b/plugins/channelrx/freqtracker/freqtrackerplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSink* FreqTrackerPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new FreqTracker(deviceAPI); } -ChannelSinkAPI* FreqTrackerPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* FreqTrackerPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new FreqTracker(deviceAPI); } diff --git a/plugins/channelrx/freqtracker/freqtrackerplugin.h b/plugins/channelrx/freqtracker/freqtrackerplugin.h index f440bca3b..e738b5c4f 100644 --- a/plugins/channelrx/freqtracker/freqtrackerplugin.h +++ b/plugins/channelrx/freqtracker/freqtrackerplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/localsink/localsink.cpp b/plugins/channelrx/localsink/localsink.cpp index 10b031c2d..909ada32e 100644 --- a/plugins/channelrx/localsink/localsink.cpp +++ b/plugins/channelrx/localsink/localsink.cpp @@ -46,7 +46,7 @@ const QString LocalSink::m_channelIdURI = "sdrangel.channel.localsink"; const QString LocalSink::m_channelId = "LocalSink"; LocalSink::LocalSink(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_running(false), m_sinkThread(0), @@ -250,9 +250,9 @@ DeviceSampleSource *LocalSink::getLocalDevice(uint32_t index) if (deviceSource->getDeviceDescription() == "LocalInput") { - if (!getDeviceSourceAPI()) { + if (!getDeviceAPI()) { qDebug("LocalSink::getLocalDevice: the parent device is unset"); - } else if (getDeviceSourceAPI()->getDeviceUID() == deviceSourceEngine->getUID()) { + } else if (getDeviceAPI()->getDeviceUID() == deviceSourceEngine->getUID()) { qDebug("LocalSink::getLocalDevice: source device at index %u is the parent device", index); } else { return deviceSource; diff --git a/plugins/channelrx/localsink/localsink.h b/plugins/channelrx/localsink/localsink.h index 0bb4c2651..e49f7ca1e 100644 --- a/plugins/channelrx/localsink/localsink.h +++ b/plugins/channelrx/localsink/localsink.h @@ -23,7 +23,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "localsinksettings.h" class DeviceAPI; @@ -34,7 +34,7 @@ class LocalSinkThread; class QNetworkAccessManager; class QNetworkReply; -class LocalSink : public BasebandSampleSink, public ChannelSinkAPI { +class LocalSink : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureLocalSink : public Message { @@ -119,6 +119,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_frequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channelrx/localsink/localsinkplugin.cpp b/plugins/channelrx/localsink/localsinkplugin.cpp index 5e87c8676..861e5d1e0 100644 --- a/plugins/channelrx/localsink/localsinkplugin.cpp +++ b/plugins/channelrx/localsink/localsinkplugin.cpp @@ -72,7 +72,7 @@ BasebandSampleSink* LocalSinkPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new LocalSink(deviceAPI); } -ChannelSinkAPI* LocalSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* LocalSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new LocalSink(deviceAPI); } diff --git a/plugins/channelrx/localsink/localsinkplugin.h b/plugins/channelrx/localsink/localsinkplugin.h index 9d4b400f5..1f0ca72eb 100644 --- a/plugins/channelrx/localsink/localsinkplugin.h +++ b/plugins/channelrx/localsink/localsinkplugin.h @@ -38,7 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/remotesink/remotesink.cpp b/plugins/channelrx/remotesink/remotesink.cpp index 99e1cc8c2..63cba4814 100644 --- a/plugins/channelrx/remotesink/remotesink.cpp +++ b/plugins/channelrx/remotesink/remotesink.cpp @@ -51,7 +51,7 @@ const QString RemoteSink::m_channelIdURI = "sdrangel.channel.remotesink"; const QString RemoteSink::m_channelId = "RemoteSink"; RemoteSink::RemoteSink(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_running(false), m_sinkThread(0), diff --git a/plugins/channelrx/remotesink/remotesink.h b/plugins/channelrx/remotesink/remotesink.h index ac34f4ad7..66c11e701 100644 --- a/plugins/channelrx/remotesink/remotesink.h +++ b/plugins/channelrx/remotesink/remotesink.h @@ -30,7 +30,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "remotesinksettings.h" class QNetworkAccessManager; @@ -40,7 +40,7 @@ class ThreadedBasebandSampleSink; class DownChannelizer; class RemoteSinkThread; -class RemoteSink : public BasebandSampleSink, public ChannelSinkAPI { +class RemoteSink : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: class MsgConfigureRemoteSink : public Message { @@ -125,6 +125,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_frequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channelrx/remotesink/remotesinkplugin.cpp b/plugins/channelrx/remotesink/remotesinkplugin.cpp index a7bb927a7..2ed2f4016 100644 --- a/plugins/channelrx/remotesink/remotesinkplugin.cpp +++ b/plugins/channelrx/remotesink/remotesinkplugin.cpp @@ -72,7 +72,7 @@ BasebandSampleSink* RemoteSinkPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new RemoteSink(deviceAPI); } -ChannelSinkAPI* RemoteSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* RemoteSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new RemoteSink(deviceAPI); } diff --git a/plugins/channelrx/remotesink/remotesinkplugin.h b/plugins/channelrx/remotesink/remotesinkplugin.h index a18516caf..700cc170f 100644 --- a/plugins/channelrx/remotesink/remotesinkplugin.h +++ b/plugins/channelrx/remotesink/remotesinkplugin.h @@ -38,7 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channelrx/udpsink/udpsink.cpp b/plugins/channelrx/udpsink/udpsink.cpp index ae0e763f3..123f86d20 100644 --- a/plugins/channelrx/udpsink/udpsink.cpp +++ b/plugins/channelrx/udpsink/udpsink.cpp @@ -46,7 +46,7 @@ const QString UDPSink::m_channelIdURI = "sdrangel.channel.udpsink"; const QString UDPSink::m_channelId = "UDPSink"; UDPSink::UDPSink(DeviceAPI *deviceAPI) : - ChannelSinkAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), m_deviceAPI(deviceAPI), m_inputSampleRate(48000), m_inputFrequencyOffset(0), diff --git a/plugins/channelrx/udpsink/udpsink.h b/plugins/channelrx/udpsink/udpsink.h index 9abb8b7a0..0923f4219 100644 --- a/plugins/channelrx/udpsink/udpsink.h +++ b/plugins/channelrx/udpsink/udpsink.h @@ -24,7 +24,7 @@ #include #include "dsp/basebandsamplesink.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/fftfilt.h" #include "dsp/interpolator.h" @@ -45,7 +45,7 @@ class DeviceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class UDPSink : public BasebandSampleSink, public ChannelSinkAPI { +class UDPSink : public BasebandSampleSink, public ChannelAPI { Q_OBJECT public: @@ -118,6 +118,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channelrx/udpsink/udpsinkplugin.cpp b/plugins/channelrx/udpsink/udpsinkplugin.cpp index 4fb5a8991..a836885e6 100644 --- a/plugins/channelrx/udpsink/udpsinkplugin.cpp +++ b/plugins/channelrx/udpsink/udpsinkplugin.cpp @@ -72,7 +72,7 @@ BasebandSampleSink* UDPSinkPlugin::createRxChannelBS(DeviceAPI *deviceAPI) return new UDPSink(deviceAPI); } -ChannelSinkAPI* UDPSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* UDPSinkPlugin::createRxChannelCS(DeviceAPI *deviceAPI) { return new UDPSink(deviceAPI); } diff --git a/plugins/channelrx/udpsink/udpsinkplugin.h b/plugins/channelrx/udpsink/udpsinkplugin.h index b268f8ac0..39c224707 100644 --- a/plugins/channelrx/udpsink/udpsinkplugin.h +++ b/plugins/channelrx/udpsink/udpsinkplugin.h @@ -38,7 +38,7 @@ public: virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSinkAPI* createRxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modam/ammod.cpp b/plugins/channeltx/modam/ammod.cpp index cd2e7c556..a44e0a09a 100644 --- a/plugins/channeltx/modam/ammod.cpp +++ b/plugins/channeltx/modam/ammod.cpp @@ -51,7 +51,7 @@ const QString AMMod::m_channelId ="AMMod"; const int AMMod::m_levelNbSamples = 480; // every 10ms AMMod::AMMod(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_basebandSampleRate(48000), m_outputSampleRate(48000), diff --git a/plugins/channeltx/modam/ammod.h b/plugins/channeltx/modam/ammod.h index 7e605e56d..6eef57e9e 100644 --- a/plugins/channeltx/modam/ammod.h +++ b/plugins/channeltx/modam/ammod.h @@ -26,7 +26,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" @@ -44,7 +44,7 @@ class ThreadedBasebandSampleSource; class UpChannelizer; class DeviceAPI; -class AMMod : public BasebandSampleSource, public ChannelSourceAPI { +class AMMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -218,6 +218,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/modam/ammodplugin.cpp b/plugins/channeltx/modam/ammodplugin.cpp index eea93a08f..715d5f8f7 100644 --- a/plugins/channeltx/modam/ammodplugin.cpp +++ b/plugins/channeltx/modam/ammodplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* AMModPlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new AMMod(deviceAPI); } -ChannelSourceAPI* AMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* AMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new AMMod(deviceAPI); } diff --git a/plugins/channeltx/modam/ammodplugin.h b/plugins/channeltx/modam/ammodplugin.h index bf2a201f8..6abd57b46 100644 --- a/plugins/channeltx/modam/ammodplugin.h +++ b/plugins/channeltx/modam/ammodplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index f22432f9e..a317a7c40 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -59,7 +59,7 @@ const int ATVMod::m_cameraFPSTestNbFrames = 100; const int ATVMod::m_ssbFftLen = 1024; ATVMod::ATVMod(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_outputSampleRate(1000000), m_inputFrequencyOffset(0), diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index d296b1e63..8b28f455b 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -30,7 +30,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/interpolator.h" #include "util/movingaverage.h" @@ -45,7 +45,7 @@ class DeviceAPI; class ThreadedBasebandSampleSource; class UpChannelizer; -class ATVMod : public BasebandSampleSource, public ChannelSourceAPI { +class ATVMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -371,6 +371,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/modatv/atvmodplugin.cpp b/plugins/channeltx/modatv/atvmodplugin.cpp index bcfbe2c39..8bec85526 100644 --- a/plugins/channeltx/modatv/atvmodplugin.cpp +++ b/plugins/channeltx/modatv/atvmodplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* ATVModPlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new ATVMod(deviceAPI); } -ChannelSourceAPI* ATVModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* ATVModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new ATVMod(deviceAPI); } diff --git a/plugins/channeltx/modatv/atvmodplugin.h b/plugins/channeltx/modatv/atvmodplugin.h index 7494ca2b5..8d24de5a1 100644 --- a/plugins/channeltx/modatv/atvmodplugin.h +++ b/plugins/channeltx/modatv/atvmodplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modfreedv/freedvmod.cpp b/plugins/channeltx/modfreedv/freedvmod.cpp index 166c9541e..12104fc8b 100644 --- a/plugins/channeltx/modfreedv/freedvmod.cpp +++ b/plugins/channeltx/modfreedv/freedvmod.cpp @@ -55,7 +55,7 @@ const int FreeDVMod::m_levelNbSamples = 80; // every 10ms const int FreeDVMod::m_ssbFftLen = 1024; FreeDVMod::FreeDVMod(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_basebandSampleRate(48000), m_outputSampleRate(48000), diff --git a/plugins/channeltx/modfreedv/freedvmod.h b/plugins/channeltx/modfreedv/freedvmod.h index ce6dff71d..0a113e598 100644 --- a/plugins/channeltx/modfreedv/freedvmod.h +++ b/plugins/channeltx/modfreedv/freedvmod.h @@ -26,7 +26,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/basebandsamplesink.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" @@ -50,7 +50,7 @@ namespace FreeDV { struct freedv; } -class FreeDVMod : public BasebandSampleSource, public ChannelSourceAPI { +class FreeDVMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -226,6 +226,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/modfreedv/freedvmodplugin.cpp b/plugins/channeltx/modfreedv/freedvmodplugin.cpp index ec39208bd..b19fca180 100644 --- a/plugins/channeltx/modfreedv/freedvmodplugin.cpp +++ b/plugins/channeltx/modfreedv/freedvmodplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* FreeDVModPlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new FreeDVMod(deviceAPI); } -ChannelSourceAPI* FreeDVModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* FreeDVModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new FreeDVMod(deviceAPI); } diff --git a/plugins/channeltx/modfreedv/freedvmodplugin.h b/plugins/channeltx/modfreedv/freedvmodplugin.h index 227a7c20f..9a7659bd8 100644 --- a/plugins/channeltx/modfreedv/freedvmodplugin.h +++ b/plugins/channeltx/modfreedv/freedvmodplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index d7c7f73f5..99ae22255 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -53,7 +53,7 @@ const QString NFMMod::m_channelId = "NFMMod"; const int NFMMod::m_levelNbSamples = 480; // every 10ms NFMMod::NFMMod(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_basebandSampleRate(48000), m_outputSampleRate(48000), diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index 073381431..495211e98 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -26,7 +26,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" @@ -46,7 +46,7 @@ class UpChannelizer; class QNetworkAccessManager; class QNetworkReply; -class NFMMod : public BasebandSampleSource, public ChannelSourceAPI { +class NFMMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -220,6 +220,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/modnfm/nfmmodplugin.cpp b/plugins/channeltx/modnfm/nfmmodplugin.cpp index f95c823a5..1c30dc6c6 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.cpp +++ b/plugins/channeltx/modnfm/nfmmodplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* NFMModPlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new NFMMod(deviceAPI); } -ChannelSourceAPI* NFMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* NFMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new NFMMod(deviceAPI); } diff --git a/plugins/channeltx/modnfm/nfmmodplugin.h b/plugins/channeltx/modnfm/nfmmodplugin.h index ffb0327a9..acea9b75c 100644 --- a/plugins/channeltx/modnfm/nfmmodplugin.h +++ b/plugins/channeltx/modnfm/nfmmodplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 72eb4dcc3..5a231091a 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -53,7 +53,7 @@ const int SSBMod::m_levelNbSamples = 480; // every 10ms const int SSBMod::m_ssbFftLen = 1024; SSBMod::SSBMod(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_basebandSampleRate(48000), m_outputSampleRate(48000), diff --git a/plugins/channeltx/modssb/ssbmod.h b/plugins/channeltx/modssb/ssbmod.h index 236f6afce..5dd12b494 100644 --- a/plugins/channeltx/modssb/ssbmod.h +++ b/plugins/channeltx/modssb/ssbmod.h @@ -26,7 +26,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/basebandsamplesink.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" @@ -45,7 +45,7 @@ class DeviceAPI; class ThreadedBasebandSampleSource; class UpChannelizer; -class SSBMod : public BasebandSampleSource, public ChannelSourceAPI { +class SSBMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -221,6 +221,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/modssb/ssbmodplugin.cpp b/plugins/channeltx/modssb/ssbmodplugin.cpp index 2f01ff67d..49c0a5913 100644 --- a/plugins/channeltx/modssb/ssbmodplugin.cpp +++ b/plugins/channeltx/modssb/ssbmodplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* SSBModPlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new SSBMod(deviceAPI); } -ChannelSourceAPI* SSBModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* SSBModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new SSBMod(deviceAPI); } diff --git a/plugins/channeltx/modssb/ssbmodplugin.h b/plugins/channeltx/modssb/ssbmodplugin.h index c7f4fe109..208e9fb76 100644 --- a/plugins/channeltx/modssb/ssbmodplugin.h +++ b/plugins/channeltx/modssb/ssbmodplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index 644992906..f1408bbb2 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -53,7 +53,7 @@ const int WFMMod::m_levelNbSamples = 480; // every 10ms const int WFMMod::m_rfFilterFFTLength = 1024; WFMMod::WFMMod(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_basebandSampleRate(384000), m_outputSampleRate(384000), diff --git a/plugins/channeltx/modwfm/wfmmod.h b/plugins/channeltx/modwfm/wfmmod.h index ffaff69e9..c01d80cc1 100644 --- a/plugins/channeltx/modwfm/wfmmod.h +++ b/plugins/channeltx/modwfm/wfmmod.h @@ -26,7 +26,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/nco.h" #include "dsp/ncof.h" #include "dsp/interpolator.h" @@ -45,7 +45,7 @@ class DeviceAPI; class ThreadedBasebandSampleSource; class UpChannelizer; -class WFMMod : public BasebandSampleSource, public ChannelSourceAPI { +class WFMMod : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -219,6 +219,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/modwfm/wfmmodplugin.cpp b/plugins/channeltx/modwfm/wfmmodplugin.cpp index bd4326cf6..ca3a65b01 100644 --- a/plugins/channeltx/modwfm/wfmmodplugin.cpp +++ b/plugins/channeltx/modwfm/wfmmodplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* WFMModPlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new WFMMod(deviceAPI); } -ChannelSourceAPI* WFMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* WFMModPlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new WFMMod(deviceAPI); } diff --git a/plugins/channeltx/modwfm/wfmmodplugin.h b/plugins/channeltx/modwfm/wfmmodplugin.h index 606bd598d..5dce75274 100644 --- a/plugins/channeltx/modwfm/wfmmodplugin.h +++ b/plugins/channeltx/modwfm/wfmmodplugin.h @@ -36,7 +36,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/remotesource/remotesource.cpp b/plugins/channeltx/remotesource/remotesource.cpp index b8ef81d31..4409d12aa 100644 --- a/plugins/channeltx/remotesource/remotesource.cpp +++ b/plugins/channeltx/remotesource/remotesource.cpp @@ -47,7 +47,7 @@ const QString RemoteSource::m_channelIdURI = "sdrangel.channeltx.remotesource"; const QString RemoteSource::m_channelId ="RemoteSource"; RemoteSource::RemoteSource(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_sourceThread(0), m_running(false), diff --git a/plugins/channeltx/remotesource/remotesource.h b/plugins/channeltx/remotesource/remotesource.h index 6b8b9e066..62679e126 100644 --- a/plugins/channeltx/remotesource/remotesource.h +++ b/plugins/channeltx/remotesource/remotesource.h @@ -18,16 +18,17 @@ #ifndef PLUGINS_CHANNELTX_REMOTESRC_REMOTESRC_H_ #define PLUGINS_CHANNELTX_REMOTESRC_REMOTESRC_H_ -#include -#include -#include +#include "channel/remotedatablock.h" +#include "channel/remotedataqueue.h" +#include "channel/remotedatareadqueue.h" + #include #include #include "cm256cc/cm256.h" #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "util/message.h" #include "../remotesource/remotesourcesettings.h" @@ -40,7 +41,7 @@ class RemoteDataBlock; class QNetworkAccessManager; class QNetworkReply; -class RemoteSource : public BasebandSampleSource, public ChannelSourceAPI { +class RemoteSource : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -195,6 +196,16 @@ public: virtual void getTitle(QString& title) { title = m_settings.m_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 QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); diff --git a/plugins/channeltx/remotesource/remotesourceplugin.cpp b/plugins/channeltx/remotesource/remotesourceplugin.cpp index 8d1eaa45e..d9a5ef059 100644 --- a/plugins/channeltx/remotesource/remotesourceplugin.cpp +++ b/plugins/channeltx/remotesource/remotesourceplugin.cpp @@ -71,7 +71,7 @@ BasebandSampleSource* RemoteSourcePlugin::createTxChannelBS(DeviceAPI *deviceAPI return new RemoteSource(deviceAPI); } -ChannelSourceAPI* RemoteSourcePlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* RemoteSourcePlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new RemoteSource(deviceAPI); } diff --git a/plugins/channeltx/remotesource/remotesourceplugin.h b/plugins/channeltx/remotesource/remotesourceplugin.h index 6685f4d37..10569e6dc 100644 --- a/plugins/channeltx/remotesource/remotesourceplugin.h +++ b/plugins/channeltx/remotesource/remotesourceplugin.h @@ -37,7 +37,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/plugins/channeltx/udpsource/udpsource.cpp b/plugins/channeltx/udpsource/udpsource.cpp index ce776f320..3b513797f 100644 --- a/plugins/channeltx/udpsource/udpsource.cpp +++ b/plugins/channeltx/udpsource/udpsource.cpp @@ -42,7 +42,7 @@ const QString UDPSource::m_channelIdURI = "sdrangel.channeltx.udpsource"; const QString UDPSource::m_channelId = "UDPSource"; UDPSource::UDPSource(DeviceAPI *deviceAPI) : - ChannelSourceAPI(m_channelIdURI), + ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), m_deviceAPI(deviceAPI), m_basebandSampleRate(48000), m_outputSampleRate(48000), diff --git a/plugins/channeltx/udpsource/udpsource.h b/plugins/channeltx/udpsource/udpsource.h index 12f06c72d..784753cd5 100644 --- a/plugins/channeltx/udpsource/udpsource.h +++ b/plugins/channeltx/udpsource/udpsource.h @@ -22,7 +22,7 @@ #include #include "dsp/basebandsamplesource.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "dsp/basebandsamplesink.h" #include "dsp/interpolator.h" #include "dsp/movingaverage.h" @@ -39,7 +39,7 @@ class DeviceAPI; class ThreadedBasebandSampleSource; class UpChannelizer; -class UDPSource : public BasebandSampleSource, public ChannelSourceAPI { +class UDPSource : public BasebandSampleSource, public ChannelAPI { Q_OBJECT public: @@ -108,6 +108,16 @@ public: virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); + 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 m_settings.m_inputFrequencyOffset; + } + virtual int webapiSettingsGet( SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); diff --git a/plugins/channeltx/udpsource/udpsourceplugin.cpp b/plugins/channeltx/udpsource/udpsourceplugin.cpp index 8a227e16c..94475424f 100644 --- a/plugins/channeltx/udpsource/udpsourceplugin.cpp +++ b/plugins/channeltx/udpsource/udpsourceplugin.cpp @@ -73,7 +73,7 @@ BasebandSampleSource* UDPSourcePlugin::createTxChannelBS(DeviceAPI *deviceAPI) return new UDPSource(deviceAPI); } -ChannelSourceAPI* UDPSourcePlugin::createTxChannelCS(DeviceAPI *deviceAPI) +ChannelAPI* UDPSourcePlugin::createTxChannelCS(DeviceAPI *deviceAPI) { return new UDPSource(deviceAPI); } diff --git a/plugins/channeltx/udpsource/udpsourceplugin.h b/plugins/channeltx/udpsource/udpsourceplugin.h index aab8641b1..ca26b1607 100644 --- a/plugins/channeltx/udpsource/udpsourceplugin.h +++ b/plugins/channeltx/udpsource/udpsourceplugin.h @@ -38,7 +38,7 @@ public: virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel); virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI); - virtual ChannelSourceAPI* createTxChannelCS(DeviceAPI *deviceAPI); + virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; diff --git a/sdrbase/CMakeLists.txt b/sdrbase/CMakeLists.txt index 297d6b010..7df3db634 100644 --- a/sdrbase/CMakeLists.txt +++ b/sdrbase/CMakeLists.txt @@ -15,8 +15,9 @@ set(sdrbase_SOURCES audio/audionetsink.cpp audio/audioresampler.cpp - channel/channelsinkapi.cpp - channel/channelsourceapi.cpp + channel/channelapi.cpp + # channel/channelsinkapi.cpp + # channel/channelsourceapi.cpp channel/remotedataqueue.cpp channel/remotedatareadqueue.cpp @@ -113,8 +114,9 @@ set(sdrbase_HEADERS audio/audionetsink.h audio/audioresampler.h - channel/channelsinkapi.h - channel/channelsourceapi.h + channel/channelapi.h + # channel/channelsinkapi.h + # channel/channelsourceapi.h channel/remotedataqueue.h channel/remotedatareadqueue.h channel/remotedatablock.h diff --git a/sdrbase/channel/channelapi.cpp b/sdrbase/channel/channelapi.cpp new file mode 100644 index 000000000..416c331f9 --- /dev/null +++ b/sdrbase/channel/channelapi.cpp @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2019 Edouard Griffiths, F4EXB // +// // +// API for Rx channels // +// // +// 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 "util/uid.h" +#include "channelapi.h" + +ChannelAPI::ChannelAPI(const QString& name, StreamType streamType) : + m_name(name), + m_streamType(streamType), + m_indexInDeviceSet(-1), + m_deviceAPI(0), + m_uid(UidCalculator::getNewObjectId()) +{ } \ No newline at end of file diff --git a/sdrbase/channel/channelapi.h b/sdrbase/channel/channelapi.h new file mode 100644 index 000000000..e776b75b2 --- /dev/null +++ b/sdrbase/channel/channelapi.h @@ -0,0 +1,116 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2019 Edouard Griffiths, F4EXB // +// // +// API for Rx channels // +// // +// 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 SDRBASE_CHANNEL_CHANNELAPI_H_ +#define SDRBASE_CHANNEL_CHANNELAPI_H_ + +#include +#include +#include + +#include "export.h" + +class DeviceAPI; + +namespace SWGSDRangel +{ + class SWGChannelSettings; + class SWGChannelReport; +} + +class SDRBASE_API ChannelAPI { +public: + enum StreamType //!< This is the same enum as in PluginInterface + { + StreamSingleSink, //!< Exposes a single sink stream (input, Rx) + StreamSingleSource, //!< Exposes a single source stream (output, Tx) + StreamAny //!< May expose any number of sink and/or source streams + }; + + ChannelAPI(const QString& name, StreamType streamType); + virtual ~ChannelAPI() {} + virtual void destroy() = 0; + + virtual void getIdentifier(QString& id) = 0; + virtual void getTitle(QString& title) = 0; + virtual void setName(const QString& name) { m_name = name; } + virtual const QString& getName() const { return m_name; } + virtual qint64 getCenterFrequency() const = 0; //!< Applies to a default stream + + virtual QByteArray serialize() const = 0; + virtual bool deserialize(const QByteArray& data) = 0; + + virtual int webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) + { + (void) response; + errorMessage = "Not implemented"; return 501; + } + + virtual int webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage) + { + (void) force; + (void) channelSettingsKeys; + (void) response; + errorMessage = "Not implemented"; return 501; + } + + virtual int webapiReportGet( + SWGSDRangel::SWGChannelReport& response, + QString& errorMessage) + { + (void) response; + errorMessage = "Not implemented"; return 501; + } + + int getIndexInDeviceSet() const { return m_indexInDeviceSet; } + void setIndexInDeviceSet(int indexInDeviceSet) { m_indexInDeviceSet = indexInDeviceSet; } + int getDeviceSetIndex() const { return m_deviceSetIndex; } + void setDeviceSetIndex(int deviceSetIndex) { m_deviceSetIndex = deviceSetIndex; } + DeviceAPI *getDeviceAPI() { return m_deviceAPI; } + void setDeviceAPI(DeviceAPI *deviceAPI) { m_deviceAPI = deviceAPI; } + uint64_t getUID() const { return m_uid; } + + // MIMO support + StreamType getStreamType() const { return m_streamType; } + virtual int getNbSinkStreams() const = 0; + virtual int getNbSourceStreams() const = 0; + virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const = 0; + + +private: + StreamType m_streamType; + /** Unique identifier in a device set used for sorting. Used when there is no GUI. + * In GUI version it is supported by GUI object name accessed through PluginInstanceGUI. + */ + QString m_name; + + int m_indexInDeviceSet; + int m_deviceSetIndex; + DeviceAPI *m_deviceAPI; + uint64_t m_uid; +}; + + +#endif // SDRBASE_CHANNEL_CHANNELAPI_H_ \ No newline at end of file diff --git a/sdrbase/device/deviceapi.cpp b/sdrbase/device/deviceapi.cpp index f5f505c2f..5f79b0436 100644 --- a/sdrbase/device/deviceapi.cpp +++ b/sdrbase/device/deviceapi.cpp @@ -23,8 +23,7 @@ #include "dsp/devicesamplesource.h" #include "dsp/devicesamplesink.h" #include "settings/preset.h" -#include "channel/channelsinkapi.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "deviceapi.h" @@ -107,14 +106,17 @@ void DeviceAPI::removeChannelSource(ThreadedBasebandSampleSource* source, int st } } -void DeviceAPI::addChannelSinkAPI(ChannelSinkAPI* channelAPI) +void DeviceAPI::addChannelSinkAPI(ChannelAPI* channelAPI, int streamIndex) { + (void) streamIndex; m_channelSinkAPIs.append(channelAPI); renumerateChannels(); } -void DeviceAPI::removeChannelSinkAPI(ChannelSinkAPI* channelAPI) +void DeviceAPI::removeChannelSinkAPI(ChannelAPI* channelAPI, int streamIndex) { + (void) streamIndex; + if (m_channelSinkAPIs.removeOne(channelAPI)) { renumerateChannels(); } @@ -122,14 +124,17 @@ void DeviceAPI::removeChannelSinkAPI(ChannelSinkAPI* channelAPI) channelAPI->setIndexInDeviceSet(-1); } -void DeviceAPI::addChannelSourceAPI(ChannelSourceAPI* channelAPI) +void DeviceAPI::addChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex) { + (void) streamIndex; m_channelSourceAPIs.append(channelAPI); renumerateChannels(); } -void DeviceAPI::removeChannelSourceAPI(ChannelSourceAPI* channelAPI) +void DeviceAPI::removeChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex) { + (void) streamIndex; + if (m_channelSourceAPIs.removeOne(channelAPI)) { renumerateChannels(); } @@ -356,8 +361,10 @@ void DeviceAPI::getDeviceEngineStateStr(QString& state) } } -ChannelSinkAPI *DeviceAPI::getChanelSinkAPIAt(int index) +ChannelAPI *DeviceAPI::getChanelSinkAPIAt(int index, int streamIndex) { + (void) streamIndex; + if (m_streamType == StreamSingleRx) { if (index < m_channelSinkAPIs.size()) { @@ -372,8 +379,10 @@ ChannelSinkAPI *DeviceAPI::getChanelSinkAPIAt(int index) } } -ChannelSourceAPI *DeviceAPI::getChanelSourceAPIAt(int index) +ChannelAPI *DeviceAPI::getChanelSourceAPIAt(int index, int streamIndex) { + (void) streamIndex; + if (m_streamType == StreamSingleTx) { if (index < m_channelSourceAPIs.size()) { @@ -688,7 +697,7 @@ void DeviceAPI::renumerateChannels() { m_channelSinkAPIs.at(i)->setIndexInDeviceSet(i); m_channelSinkAPIs.at(i)->setDeviceSetIndex(m_deviceTabIndex); - //m_channelSinkAPIs.at(i)->setDeviceSourceAPI(this); // FIXME: use generic DeviceAPI in ChannelSinkAPI + m_channelSinkAPIs.at(i)->setDeviceAPI(this); } } else if (m_streamType == StreamSingleTx) @@ -697,7 +706,7 @@ void DeviceAPI::renumerateChannels() { m_channelSourceAPIs.at(i)->setIndexInDeviceSet(i); m_channelSourceAPIs.at(i)->setDeviceSetIndex(m_deviceTabIndex); - //m_channelSourceAPIs.at(i)->setDeviceSinkAPI(this); // FIXME: use generic DeviceAPI in ChannelSourceAPI + m_channelSourceAPIs.at(i)->setDeviceAPI(this); } } } \ No newline at end of file diff --git a/sdrbase/device/deviceapi.h b/sdrbase/device/deviceapi.h index ee67b520a..2c801a5ab 100644 --- a/sdrbase/device/deviceapi.h +++ b/sdrbase/device/deviceapi.h @@ -27,8 +27,7 @@ class BasebandSampleSink; class ThreadedBasebandSampleSink; class ThreadedBasebandSampleSource; -class ChannelSinkAPI; -class ChannelSourceAPI; +class ChannelAPI; class DeviceSampleSink; class DeviceSampleSource; class MessageQueue; @@ -72,10 +71,10 @@ public: void addChannelSource(ThreadedBasebandSampleSource* sink, int streamIndex = 0); //!< Add a channel source (Tx) void removeChannelSource(ThreadedBasebandSampleSource* sink, int streamIndex = 0); //!< Remove a channel source (Tx) - void addChannelSinkAPI(ChannelSinkAPI* channelAPI); - void removeChannelSinkAPI(ChannelSinkAPI* channelAPI); - void addChannelSourceAPI(ChannelSourceAPI* channelAPI); - void removeChannelSourceAPI(ChannelSourceAPI* channelAPI); + void addChannelSinkAPI(ChannelAPI* channelAPI, int streamIndex = 0); + void removeChannelSinkAPI(ChannelAPI* channelAPI, int streamIndex = 0); + void addChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex = 0); + void removeChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex = 0); void setSampleSource(DeviceSampleSource* source); //!< Set the device sample source (single Rx) void setSampleSink(DeviceSampleSink* sink); //!< Set the device sample sink (single Tx) @@ -149,8 +148,8 @@ public: void getDeviceEngineStateStr(QString& state); - ChannelSinkAPI *getChanelSinkAPIAt(int index); - ChannelSourceAPI *getChanelSourceAPIAt(int index); + ChannelAPI *getChanelSinkAPIAt(int index, int streamIndex = 0); + ChannelAPI *getChanelSourceAPIAt(int index, int streamIndex = 0); int getNbSourceChannels() const { return m_channelSourceAPIs.size(); } int getNbSinkChannels() const { return m_channelSinkAPIs.size(); } @@ -205,12 +204,12 @@ protected: // Single Rx (i.e. source) DSPDeviceSourceEngine *m_deviceSourceEngine; - QList m_channelSinkAPIs; + QList m_channelSinkAPIs; // Single Tx (i.e. sink) DSPDeviceSinkEngine *m_deviceSinkEngine; - QList m_channelSourceAPIs; + QList m_channelSourceAPIs; private: void renumerateChannels(); diff --git a/sdrbase/plugin/plugininterface.h b/sdrbase/plugin/plugininterface.h index ea94e5a11..352ce42f5 100644 --- a/sdrbase/plugin/plugininterface.h +++ b/sdrbase/plugin/plugininterface.h @@ -25,8 +25,7 @@ class DeviceSampleSource; class DeviceSampleSink; class BasebandSampleSink; class BasebandSampleSource; -class ChannelSinkAPI; -class ChannelSourceAPI; +class ChannelAPI; class SDRBASE_API PluginInterface { public: @@ -102,7 +101,7 @@ public: return nullptr; } - virtual ChannelSinkAPI* createRxChannelCS( + virtual ChannelAPI* createRxChannelCS( DeviceAPI *deviceAPI) { (void) deviceAPI; @@ -127,7 +126,7 @@ public: return nullptr; } - virtual ChannelSourceAPI* createTxChannelCS( + virtual ChannelAPI* createTxChannelCS( DeviceAPI *deviceAPI) { (void) deviceAPI; diff --git a/sdrbase/sdrbase.pro b/sdrbase/sdrbase.pro index e035567d0..a105edab1 100644 --- a/sdrbase/sdrbase.pro +++ b/sdrbase/sdrbase.pro @@ -65,8 +65,8 @@ SOURCES += audio/audiodevicemanager.cpp\ audio/audioinput.cpp\ audio/audionetsink.cpp\ audio/audioresampler.cpp\ - channel/channelsinkapi.cpp\ - channel/channelsourceapi.cpp\ +# channel/channelsinkapi.cpp\ +# channel/channelsourceapi.cpp\ channel/remotedataqueue.cpp\ channel/remotedatareadqueue.cpp\ commands/command.cpp\ @@ -149,8 +149,8 @@ HEADERS += audio/audiodevicemanager.h\ audio/audioinput.h\ audio/audionetsink.h\ audio/audioresampler.h\ - channel/channelsinkapi.h\ - channel/channelsourceapi.h\ +# channel/channelsinkapi.h\ +# channel/channelsourceapi.h\ channel/remotedataqueue.h\ channel/remotedatareadqueue.h\ channel/remotedatablock.h\ diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index c6c68743b..1e1256c16 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -34,8 +34,7 @@ #include "dsp/dspengine.h" #include "plugin/pluginapi.h" #include "plugin/pluginmanager.h" -#include "channel/channelsinkapi.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "SWGInstanceSummaryResponse.h" #include "SWGInstanceDevicesResponse.h" @@ -1528,7 +1527,7 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet( if (deviceSet->m_deviceSourceEngine) // Single Rx { - ChannelSinkAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); if (channelAPI == 0) { @@ -1545,7 +1544,7 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet( } else if (deviceSet->m_deviceSinkEngine) // Single Tx { - ChannelSourceAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); if (channelAPI == 0) { @@ -1588,7 +1587,7 @@ int WebAPIAdapterGUI::devicesetChannelReportGet( if (deviceSet->m_deviceSourceEngine) // Single Rx { - ChannelSinkAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); if (channelAPI == 0) { @@ -1605,7 +1604,7 @@ int WebAPIAdapterGUI::devicesetChannelReportGet( } else if (deviceSet->m_deviceSinkEngine) // Single Tx { - ChannelSourceAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); if (channelAPI == 0) { @@ -1649,7 +1648,7 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch( if (deviceSet->m_deviceSourceEngine) // Single Rx { - ChannelSinkAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); if (channelAPI == 0) { @@ -1677,7 +1676,7 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch( } else if (deviceSet->m_deviceSinkEngine) // Single Tx { - ChannelSourceAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); if (channelAPI == 0) { @@ -1767,7 +1766,7 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSourceAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i); + ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); @@ -1799,7 +1798,7 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSinkAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i); + ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); @@ -1824,7 +1823,7 @@ void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSourceAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i); + ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); @@ -1850,7 +1849,7 @@ void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSinkAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i); + ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); diff --git a/sdrsrv/device/deviceset.cpp b/sdrsrv/device/deviceset.cpp index cbd3376cb..efb45a21b 100644 --- a/sdrsrv/device/deviceset.cpp +++ b/sdrsrv/device/deviceset.cpp @@ -20,13 +20,34 @@ #include "plugin/pluginapi.h" #include "plugin/plugininterface.h" #include "settings/preset.h" -#include "channel/channelsinkapi.h" -#include "channel/channelsourceapi.h" +#include "channel/channelapi.h" #include "settings/preset.h" #include "deviceset.h" +DeviceSet::ChannelInstanceRegistration::ChannelInstanceRegistration(const QString& channelName, ChannelAPI* channelAPI) : + m_channelName(channelName), + m_channelSinkAPI(channelAPI), + m_channelSourceAPI(0) +{ + if (channelAPI->getStreamType() == ChannelAPI::StreamSingleSink) + { + m_channelSinkAPI = channelAPI; + m_channelSourceAPI = nullptr; + } + else if (channelAPI->getStreamType() == ChannelAPI::StreamSingleSource) + { + m_channelSinkAPI = nullptr; + m_channelSourceAPI = channelAPI; + } + else + { + m_channelSinkAPI = nullptr; + m_channelSourceAPI = nullptr; + } +} + DeviceSet::DeviceSet(int tabIndex) { m_deviceSourceEngine = 0; @@ -39,19 +60,19 @@ DeviceSet::~DeviceSet() { } -void DeviceSet::registerRxChannelInstance(const QString& channelName, ChannelSinkAPI* channelAPI) +void DeviceSet::registerRxChannelInstance(const QString& channelName, ChannelAPI* channelAPI) { m_rxChannelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI)); renameRxChannelInstances(); } -void DeviceSet::registerTxChannelInstance(const QString& channelName, ChannelSourceAPI* channelAPI) +void DeviceSet::registerTxChannelInstance(const QString& channelName, ChannelAPI* channelAPI) { m_txChannelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI)); renameTxChannelInstances(); } -void DeviceSet::removeRxChannelInstance(ChannelSinkAPI* channelAPI) +void DeviceSet::removeRxChannelInstance(ChannelAPI* channelAPI) { for(ChannelInstanceRegistrations::iterator it = m_rxChannelInstanceRegistrations.begin(); it != m_rxChannelInstanceRegistrations.end(); ++it) { @@ -65,7 +86,7 @@ void DeviceSet::removeRxChannelInstance(ChannelSinkAPI* channelAPI) renameRxChannelInstances(); } -void DeviceSet::removeTxChannelInstance(ChannelSourceAPI* channelAPI) +void DeviceSet::removeTxChannelInstance(ChannelAPI* channelAPI) { for(ChannelInstanceRegistrations::iterator it = m_txChannelInstanceRegistrations.begin(); it != m_txChannelInstanceRegistrations.end(); ++it) { @@ -120,7 +141,7 @@ void DeviceSet::deleteTxChannel(int channelIndex) void DeviceSet::addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI) { PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getRxChannelRegistrations(); // Available channel plugins - ChannelSinkAPI *rxChannel =(*channelRegistrations)[selectedChannelIndex].m_plugin->createRxChannelCS(m_deviceAPI); + ChannelAPI *rxChannel =(*channelRegistrations)[selectedChannelIndex].m_plugin->createRxChannelCS(m_deviceAPI); ChannelInstanceRegistration reg = ChannelInstanceRegistration(rxChannel->getName(), rxChannel); m_rxChannelInstanceRegistrations.append(reg); qDebug("DeviceSet::addRxChannel: %s", qPrintable(rxChannel->getName())); @@ -129,7 +150,7 @@ void DeviceSet::addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI) void DeviceSet::addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI) { PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getTxChannelRegistrations(); // Available channel plugins - ChannelSourceAPI *txChannel = (*channelRegistrations)[selectedChannelIndex].m_plugin->createTxChannelCS(m_deviceAPI); + ChannelAPI *txChannel = (*channelRegistrations)[selectedChannelIndex].m_plugin->createTxChannelCS(m_deviceAPI); ChannelInstanceRegistration reg = ChannelInstanceRegistration(txChannel->getName(), txChannel); m_txChannelInstanceRegistrations.append(reg); qDebug("DeviceSet::addTxChannel: %s", qPrintable(txChannel->getName())); @@ -183,7 +204,7 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI qDebug("DeviceSet::loadChannelSettings: creating new channel [%s] from config [%s]", qPrintable((*channelRegistrations)[i].m_channelIdURI), qPrintable(channelConfig.m_channelIdURI)); - ChannelSinkAPI *rxChannel = (*channelRegistrations)[i].m_plugin->createRxChannelCS(m_deviceAPI); + ChannelAPI *rxChannel = (*channelRegistrations)[i].m_plugin->createRxChannelCS(m_deviceAPI); reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannel); m_rxChannelInstanceRegistrations.append(reg); break; @@ -279,7 +300,7 @@ void DeviceSet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginAPI if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) { qDebug("DeviceSet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI)); - ChannelSourceAPI *txChannel = (*channelRegistrations)[i].m_plugin->createTxChannelCS(m_deviceAPI); + ChannelAPI *txChannel = (*channelRegistrations)[i].m_plugin->createTxChannelCS(m_deviceAPI); reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, txChannel); m_txChannelInstanceRegistrations.append(reg); break; diff --git a/sdrsrv/device/deviceset.h b/sdrsrv/device/deviceset.h index 829a84148..fcee0d7db 100644 --- a/sdrsrv/device/deviceset.h +++ b/sdrsrv/device/deviceset.h @@ -24,8 +24,7 @@ class DSPDeviceSourceEngine; class DeviceAPI; class DSPDeviceSinkEngine; class PluginAPI; -class ChannelSinkAPI; -class ChannelSourceAPI; +class ChannelAPI; class Preset; class DeviceSet @@ -44,10 +43,10 @@ public: void addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI); void deleteRxChannel(int channelIndex); void deleteTxChannel(int channelIndex); - void registerRxChannelInstance(const QString& channelName, ChannelSinkAPI* channelAPI); - void registerTxChannelInstance(const QString& channelName, ChannelSourceAPI* channelAPI); - void removeRxChannelInstance(ChannelSinkAPI* channelAPI); - void removeTxChannelInstance(ChannelSourceAPI* channelAPI); + void registerRxChannelInstance(const QString& channelName, ChannelAPI* channelAPI); + void registerTxChannelInstance(const QString& channelName, ChannelAPI* channelAPI); + void removeRxChannelInstance(ChannelAPI* channelAPI); + void removeTxChannelInstance(ChannelAPI* channelAPI); void freeRxChannels(); void freeTxChannels(); void loadRxChannelSettings(const Preset* preset, PluginAPI *pluginAPI); @@ -59,26 +58,16 @@ private: struct ChannelInstanceRegistration { QString m_channelName; - ChannelSinkAPI *m_channelSinkAPI; - ChannelSourceAPI *m_channelSourceAPI; + ChannelAPI *m_channelSinkAPI; + ChannelAPI *m_channelSourceAPI; ChannelInstanceRegistration() : m_channelName(), - m_channelSinkAPI(0), - m_channelSourceAPI(0) + m_channelSinkAPI(nullptr), + m_channelSourceAPI(nullptr) { } - ChannelInstanceRegistration(const QString& channelName, ChannelSinkAPI* channelAPI) : - m_channelName(channelName), - m_channelSinkAPI(channelAPI), - m_channelSourceAPI(0) - { } - - ChannelInstanceRegistration(const QString& channelName, ChannelSourceAPI* channelAPI) : - m_channelName(channelName), - m_channelSinkAPI(0), - m_channelSourceAPI(channelAPI) - { } + ChannelInstanceRegistration(const QString& channelName, ChannelAPI* channelAPI); bool operator<(const ChannelInstanceRegistration& other) const; }; diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index d34855986..b3635b7c4 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -54,8 +54,7 @@ #include "dsp/dspdevicesourceengine.h" #include "dsp/dspdevicesinkengine.h" #include "dsp/dspengine.h" -#include "channel/channelsourceapi.h" -#include "channel/channelsinkapi.h" +#include "channel/channelapi.h" #include "plugin/pluginapi.h" #include "plugin/pluginmanager.h" #include "webapiadaptersrv.h" @@ -1615,7 +1614,7 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet( if (deviceSet->m_deviceSourceEngine) // Single Rx { - ChannelSinkAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); if (channelAPI == 0) { @@ -1632,7 +1631,7 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet( } else if (deviceSet->m_deviceSinkEngine) // Single Tx { - ChannelSourceAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); if (channelAPI == 0) { @@ -1674,7 +1673,7 @@ int WebAPIAdapterSrv::devicesetChannelReportGet( if (deviceSet->m_deviceSourceEngine) // Single Rx { - ChannelSinkAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); if (channelAPI == 0) { @@ -1691,7 +1690,7 @@ int WebAPIAdapterSrv::devicesetChannelReportGet( } else if (deviceSet->m_deviceSinkEngine) // Single Tx { - ChannelSourceAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); if (channelAPI == 0) { @@ -1735,7 +1734,7 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch( if (deviceSet->m_deviceSourceEngine) // Rx { - ChannelSinkAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSinkAPIAt(channelIndex); if (channelAPI == 0) { @@ -1763,7 +1762,7 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch( } else if (deviceSet->m_deviceSinkEngine) // Tx { - ChannelSourceAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); + ChannelAPI *channelAPI = deviceSet->m_deviceAPI->getChanelSourceAPIAt(channelIndex); if (channelAPI == 0) { @@ -1848,7 +1847,7 @@ void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, con { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSourceAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i); + ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); @@ -1880,7 +1879,7 @@ void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, con { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSinkAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i); + ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); @@ -1905,7 +1904,7 @@ void WebAPIAdapterSrv::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSourceAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i); + ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID()); @@ -1931,7 +1930,7 @@ void WebAPIAdapterSrv::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel { channels->append(new SWGSDRangel::SWGChannel); channels->back()->init(); - ChannelSinkAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i); + ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i); channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setUid(channel->getUID());