From 2e473cc27c7a154378ec8974481c739c2e3b39b9 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 16 May 2016 10:05:09 +0200 Subject: [PATCH] Multi device support: channel plugin per device mechanism extended to all channel plugins --- plugins/channel/chanalyzer/chanalyzergui.cpp | 6 ++++-- plugins/channel/chanalyzer/chanalyzerplugin.cpp | 4 ++-- plugins/channel/demodam/amplugin.cpp | 2 +- plugins/channel/demodbfm/bfmdemodgui.cpp | 6 ++++-- plugins/channel/demodbfm/bfmplugin.cpp | 4 ++-- plugins/channel/demoddsd/dsddemodgui.cpp | 15 +++++++++------ plugins/channel/demoddsd/dsddemodgui.h | 6 ++++-- plugins/channel/demoddsd/dsddemodplugin.cpp | 13 +++++++------ plugins/channel/demoddsd/dsddemodplugin.h | 6 ++++-- plugins/channel/demodlora/lorademodgui.cpp | 15 +++++++++------ plugins/channel/demodlora/lorademodgui.h | 6 ++++-- plugins/channel/demodlora/loraplugin.cpp | 12 ++++++------ plugins/channel/demodlora/loraplugin.h | 6 ++++-- plugins/channel/demodnfm/nfmdemodgui.cpp | 15 +++++++++------ plugins/channel/demodnfm/nfmdemodgui.h | 6 ++++-- plugins/channel/demodnfm/nfmplugin.cpp | 12 ++++++------ plugins/channel/demodnfm/nfmplugin.h | 6 ++++-- plugins/channel/demodssb/ssbdemodgui.cpp | 15 +++++++++------ plugins/channel/demodssb/ssbdemodgui.h | 8 +++++--- plugins/channel/demodssb/ssbplugin.cpp | 13 +++++++------ plugins/channel/demodssb/ssbplugin.h | 6 ++++-- plugins/channel/demodwfm/wfmdemodgui.cpp | 15 +++++++++------ plugins/channel/demodwfm/wfmdemodgui.h | 6 ++++-- plugins/channel/demodwfm/wfmplugin.cpp | 12 ++++++------ plugins/channel/demodwfm/wfmplugin.h | 6 ++++-- plugins/channel/tcpsrc/tcpsrcgui.cpp | 15 +++++++++------ plugins/channel/tcpsrc/tcpsrcgui.h | 6 ++++-- plugins/channel/tcpsrc/tcpsrcplugin.cpp | 12 ++++++------ plugins/channel/tcpsrc/tcpsrcplugin.h | 6 ++++-- plugins/channel/udpsrc/udpsrcgui.cpp | 15 +++++++++------ plugins/channel/udpsrc/udpsrcgui.h | 6 ++++-- plugins/channel/udpsrc/udpsrcplugin.cpp | 12 ++++++------ plugins/channel/udpsrc/udpsrcplugin.h | 6 ++++-- 33 files changed, 177 insertions(+), 122 deletions(-) diff --git a/plugins/channel/chanalyzer/chanalyzergui.cpp b/plugins/channel/chanalyzer/chanalyzergui.cpp index 9784ba975..3699325ed 100644 --- a/plugins/channel/chanalyzer/chanalyzergui.cpp +++ b/plugins/channel/chanalyzer/chanalyzergui.cpp @@ -25,6 +25,7 @@ #include "gui/glspectrum.h" #include "gui/glscope.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingswidget.h" @@ -325,7 +326,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAP m_channelizer = new Channelizer(m_channelAnalyzer); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->deltaFrequency->setValueRange(7, 0U, 9999999U); @@ -347,7 +348,8 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAP m_channelMarker.setCenterFrequency(0); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); diff --git a/plugins/channel/chanalyzer/chanalyzerplugin.cpp b/plugins/channel/chanalyzer/chanalyzerplugin.cpp index ae2912a4f..1bb057e33 100644 --- a/plugins/channel/chanalyzer/chanalyzerplugin.cpp +++ b/plugins/channel/chanalyzer/chanalyzerplugin.cpp @@ -35,7 +35,7 @@ PluginGUI* ChannelAnalyzerPlugin::createChannel(const QString& channelName, Devi if(channelName == "org.f4exb.sdrangelove.channel.chanalyzer") { ChannelAnalyzerGUI* gui = ChannelAnalyzerGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("org.f4exb.sdrangelove.channel.chanalyzer", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; @@ -46,5 +46,5 @@ void ChannelAnalyzerPlugin::createInstanceChannelAnalyzer(DeviceAPI *deviceAPI) { ChannelAnalyzerGUI* gui = ChannelAnalyzerGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("org.f4exb.sdrangelove.channel.chanalyzer", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demodam/amplugin.cpp b/plugins/channel/demodam/amplugin.cpp index 3fc31f6a7..05ac443f1 100644 --- a/plugins/channel/demodam/amplugin.cpp +++ b/plugins/channel/demodam/amplugin.cpp @@ -48,5 +48,5 @@ void AMPlugin::createInstanceAM(DeviceAPI *deviceAPI) { AMDemodGUI* gui = AMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.am", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demodbfm/bfmdemodgui.cpp b/plugins/channel/demodbfm/bfmdemodgui.cpp index 0a178d0e4..79ed1a6c7 100644 --- a/plugins/channel/demodbfm/bfmdemodgui.cpp +++ b/plugins/channel/demodbfm/bfmdemodgui.cpp @@ -29,6 +29,7 @@ #include "dsp/spectrumvis.h" #include "gui/glspectrum.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingswidget.h" @@ -380,7 +381,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa m_channelizer = new Channelizer(m_bfmDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); ui->glSpectrum->setCenterFrequency(m_rate / 4); ui->glSpectrum->setSampleRate(m_rate / 2); @@ -397,7 +398,8 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa m_channelMarker.setCenterFrequency(0); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); diff --git a/plugins/channel/demodbfm/bfmplugin.cpp b/plugins/channel/demodbfm/bfmplugin.cpp index ac7bd849d..999f01ca7 100644 --- a/plugins/channel/demodbfm/bfmplugin.cpp +++ b/plugins/channel/demodbfm/bfmplugin.cpp @@ -54,7 +54,7 @@ PluginGUI* BFMPlugin::createChannel(const QString& channelName, DeviceAPI *devic if(channelName == "sdrangel.channel.bfm") { BFMDemodGUI* gui = BFMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.bfm", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return 0; @@ -65,5 +65,5 @@ void BFMPlugin::createInstanceBFM(DeviceAPI *deviceAPI) { BFMDemodGUI* gui = BFMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.bfm", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demoddsd/dsddemodgui.cpp b/plugins/channel/demoddsd/dsddemodgui.cpp index 512b90f92..afa09b448 100644 --- a/plugins/channel/demoddsd/dsddemodgui.cpp +++ b/plugins/channel/demoddsd/dsddemodgui.cpp @@ -24,6 +24,7 @@ #include "dsp/scopevis.h" #include "gui/glscope.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingswidget.h" @@ -33,9 +34,9 @@ #include "dsddemod.h" #include "dsddemodgui.h" -DSDDemodGUI* DSDDemodGUI::create(PluginAPI* pluginAPI) +DSDDemodGUI* DSDDemodGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - DSDDemodGUI* gui = new DSDDemodGUI(pluginAPI); + DSDDemodGUI* gui = new DSDDemodGUI(pluginAPI, deviceAPI); return gui; } @@ -243,10 +244,11 @@ void DSDDemodGUI::onMenuDoubleClicked() } } -DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : +DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::DSDDemodGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_channelMarker(this), m_basicSettingsShown(false), m_doApplySettings(true), @@ -276,7 +278,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelizer = new Channelizer(m_dsdDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); //m_channelMarker = new ChannelMarker(this); m_channelMarker.setColor(Qt::cyan); @@ -286,7 +288,8 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); @@ -296,7 +299,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : DSDDemodGUI::~DSDDemodGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_dsdDemod; diff --git a/plugins/channel/demoddsd/dsddemodgui.h b/plugins/channel/demoddsd/dsddemodgui.h index 61bb9093e..50f2d2ba0 100644 --- a/plugins/channel/demoddsd/dsddemodgui.h +++ b/plugins/channel/demoddsd/dsddemodgui.h @@ -25,6 +25,7 @@ #include "dsp/movingaverage.h" class PluginAPI; +class DeviceAPI; class ThreadedSampleSink; class Channelizer; @@ -39,7 +40,7 @@ class DSDDemodGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static DSDDemodGUI* create(PluginAPI* pluginAPI); + static DSDDemodGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -79,6 +80,7 @@ private: Ui::DSDDemodGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; ChannelMarker m_channelMarker; bool m_basicSettingsShown; bool m_doApplySettings; @@ -95,7 +97,7 @@ private: MovingAverage m_channelPowerDbAvg; int m_tickCount; - explicit DSDDemodGUI(PluginAPI* pluginAPI, QWidget* parent = NULL); + explicit DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~DSDDemodGUI(); void blockApplySettings(bool block); diff --git a/plugins/channel/demoddsd/dsddemodplugin.cpp b/plugins/channel/demoddsd/dsddemodplugin.cpp index bf77be4cb..a126a5fe2 100644 --- a/plugins/channel/demoddsd/dsddemodplugin.cpp +++ b/plugins/channel/demoddsd/dsddemodplugin.cpp @@ -17,6 +17,7 @@ #include #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "dsddemodplugin.h" #include "dsddemodgui.h" @@ -47,21 +48,21 @@ void DSDDemodPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("sdrangel.channel.dsddemod", this); } -PluginGUI* DSDDemodPlugin::createChannel(const QString& channelName) +PluginGUI* DSDDemodPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "sdrangel.channel.dsddemod") { - DSDDemodGUI* gui = DSDDemodGUI::create(m_pluginAPI); + DSDDemodGUI* gui = DSDDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.dsddemod", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; } } -void DSDDemodPlugin::createInstanceDSDDemod() +void DSDDemodPlugin::createInstanceDSDDemod(DeviceAPI *deviceAPI) { - DSDDemodGUI* gui = DSDDemodGUI::create(m_pluginAPI); + DSDDemodGUI* gui = DSDDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.dsddemod", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demoddsd/dsddemodplugin.h b/plugins/channel/demoddsd/dsddemodplugin.h index 1b8ef3103..0e02115c6 100644 --- a/plugins/channel/demoddsd/dsddemodplugin.h +++ b/plugins/channel/demoddsd/dsddemodplugin.h @@ -21,6 +21,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class DSDDemodPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -32,7 +34,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -40,7 +42,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceDSDDemod(); + void createInstanceDSDDemod(DeviceAPI *deviceAPI); }; #endif // INCLUDE_DSDDEMODLUGIN_H diff --git a/plugins/channel/demodlora/lorademodgui.cpp b/plugins/channel/demodlora/lorademodgui.cpp index bc1f42b4e..fa8256484 100644 --- a/plugins/channel/demodlora/lorademodgui.cpp +++ b/plugins/channel/demodlora/lorademodgui.cpp @@ -10,13 +10,14 @@ #include "dsp/spectrumvis.h" #include "gui/glspectrum.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "gui/basicchannelsettingswidget.h" #include "dsp/dspengine.h" -LoRaDemodGUI* LoRaDemodGUI::create(PluginAPI* pluginAPI) +LoRaDemodGUI* LoRaDemodGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - LoRaDemodGUI* gui = new LoRaDemodGUI(pluginAPI); + LoRaDemodGUI* gui = new LoRaDemodGUI(pluginAPI, deviceAPI); return gui; } @@ -146,10 +147,11 @@ void LoRaDemodGUI::onMenuDoubleClicked() } } -LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : +LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::LoRaDemodGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_channelMarker(this), m_basicSettingsShown(false), m_doApplySettings(true) @@ -163,7 +165,7 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_LoRaDemod = new LoRaDemod(m_spectrumVis); m_channelizer = new Channelizer(m_LoRaDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); ui->glSpectrum->setCenterFrequency(16000); ui->glSpectrum->setSampleRate(32000); @@ -178,7 +180,8 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelMarker.setCenterFrequency(0); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->spectrumGUI->setBuddies(m_channelizer->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); @@ -188,7 +191,7 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : LoRaDemodGUI::~LoRaDemodGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_LoRaDemod; diff --git a/plugins/channel/demodlora/lorademodgui.h b/plugins/channel/demodlora/lorademodgui.h index c3b1baf3d..b79d6574e 100644 --- a/plugins/channel/demodlora/lorademodgui.h +++ b/plugins/channel/demodlora/lorademodgui.h @@ -8,6 +8,7 @@ #define BANDWIDTHSTRING {7813,15625,20833,31250,62500} class PluginAPI; +class DeviceAPI; class ThreadedSampleSink; class Channelizer; class LoRaDemod; @@ -21,7 +22,7 @@ class LoRaDemodGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static LoRaDemodGUI* create(PluginAPI* pluginAPI); + static LoRaDemodGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -45,6 +46,7 @@ private slots: private: Ui::LoRaDemodGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; ChannelMarker m_channelMarker; bool m_basicSettingsShown; bool m_doApplySettings; @@ -54,7 +56,7 @@ private: LoRaDemod* m_LoRaDemod; SpectrumVis* m_spectrumVis; - explicit LoRaDemodGUI(PluginAPI* pluginAPI, QWidget* parent = NULL); + explicit LoRaDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~LoRaDemodGUI(); void blockApplySettings(bool block); diff --git a/plugins/channel/demodlora/loraplugin.cpp b/plugins/channel/demodlora/loraplugin.cpp index d86686460..795858b30 100644 --- a/plugins/channel/demodlora/loraplugin.cpp +++ b/plugins/channel/demodlora/loraplugin.cpp @@ -30,21 +30,21 @@ void LoRaPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("de.maintech.sdrangelove.channel.lora", this); } -PluginGUI* LoRaPlugin::createChannel(const QString& channelName) +PluginGUI* LoRaPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "de.maintech.sdrangelove.channel.lora") { - LoRaDemodGUI* gui = LoRaDemodGUI::create(m_pluginAPI); + LoRaDemodGUI* gui = LoRaDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.lora", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; } } -void LoRaPlugin::createInstanceLoRa() +void LoRaPlugin::createInstanceLoRa(DeviceAPI *deviceAPI) { - LoRaDemodGUI* gui = LoRaDemodGUI::create(m_pluginAPI); + LoRaDemodGUI* gui = LoRaDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.lora", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demodlora/loraplugin.h b/plugins/channel/demodlora/loraplugin.h index f63b6a1fe..843d8ce5a 100644 --- a/plugins/channel/demodlora/loraplugin.h +++ b/plugins/channel/demodlora/loraplugin.h @@ -4,6 +4,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class LoRaPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -15,7 +17,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -23,7 +25,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceLoRa(); + void createInstanceLoRa(DeviceAPI *deviceAPI); }; #endif // INCLUDE_LoRaPLUGIN_H diff --git a/plugins/channel/demodnfm/nfmdemodgui.cpp b/plugins/channel/demodnfm/nfmdemodgui.cpp index a3ff10667..440561916 100644 --- a/plugins/channel/demodnfm/nfmdemodgui.cpp +++ b/plugins/channel/demodnfm/nfmdemodgui.cpp @@ -8,6 +8,7 @@ #include "nfmdemod.h" #include "dsp/nullsink.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingswidget.h" @@ -22,9 +23,9 @@ const int NFMDemodGUI::m_fmDev[] = { // corresponding FM deviations }; const int NFMDemodGUI::m_nbRfBW = 9; -NFMDemodGUI* NFMDemodGUI::create(PluginAPI* pluginAPI) +NFMDemodGUI* NFMDemodGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - NFMDemodGUI* gui = new NFMDemodGUI(pluginAPI); + NFMDemodGUI* gui = new NFMDemodGUI(pluginAPI, deviceAPI); return gui; } @@ -247,10 +248,11 @@ void NFMDemodGUI::onMenuDoubleClicked() } } -NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : +NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::NFMDemodGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_channelMarker(this), m_basicSettingsShown(false), m_doApplySettings(true), @@ -289,7 +291,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelizer = new Channelizer(m_nfmDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); //m_channelMarker = new ChannelMarker(this); m_channelMarker.setColor(Qt::red); @@ -299,7 +301,8 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); applySettings(); } @@ -307,7 +310,7 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : NFMDemodGUI::~NFMDemodGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_nfmDemod; diff --git a/plugins/channel/demodnfm/nfmdemodgui.h b/plugins/channel/demodnfm/nfmdemodgui.h index d56cd1eda..19e8040fd 100644 --- a/plugins/channel/demodnfm/nfmdemodgui.h +++ b/plugins/channel/demodnfm/nfmdemodgui.h @@ -8,6 +8,7 @@ #include "dsp/movingaverage.h" class PluginAPI; +class DeviceAPI; class ThreadedSampleSink; class Channelizer; @@ -21,7 +22,7 @@ class NFMDemodGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static NFMDemodGUI* create(PluginAPI* pluginAPI); + static NFMDemodGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -55,6 +56,7 @@ private slots: private: Ui::NFMDemodGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; ChannelMarker m_channelMarker; bool m_basicSettingsShown; bool m_doApplySettings; @@ -71,7 +73,7 @@ private: static const int m_fmDev[]; static const int m_nbRfBW; - explicit NFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent = NULL); + explicit NFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~NFMDemodGUI(); void blockApplySettings(bool block); diff --git a/plugins/channel/demodnfm/nfmplugin.cpp b/plugins/channel/demodnfm/nfmplugin.cpp index fe4cb563a..438244e8d 100644 --- a/plugins/channel/demodnfm/nfmplugin.cpp +++ b/plugins/channel/demodnfm/nfmplugin.cpp @@ -30,21 +30,21 @@ void NFMPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("de.maintech.sdrangelove.channel.nfm", this); } -PluginGUI* NFMPlugin::createChannel(const QString& channelName) +PluginGUI* NFMPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "de.maintech.sdrangelove.channel.nfm") { - NFMDemodGUI* gui = NFMDemodGUI::create(m_pluginAPI); + NFMDemodGUI* gui = NFMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.nfm", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; } } -void NFMPlugin::createInstanceNFM() +void NFMPlugin::createInstanceNFM(DeviceAPI *deviceAPI) { - NFMDemodGUI* gui = NFMDemodGUI::create(m_pluginAPI); + NFMDemodGUI* gui = NFMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.nfm", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demodnfm/nfmplugin.h b/plugins/channel/demodnfm/nfmplugin.h index 0cd345b8f..3cf72b43a 100644 --- a/plugins/channel/demodnfm/nfmplugin.h +++ b/plugins/channel/demodnfm/nfmplugin.h @@ -4,6 +4,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class NFMPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -15,7 +17,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -23,7 +25,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceNFM(); + void createInstanceNFM(DeviceAPI *deviceAPI); }; #endif // INCLUDE_NFMPLUGIN_H diff --git a/plugins/channel/demodssb/ssbdemodgui.cpp b/plugins/channel/demodssb/ssbdemodgui.cpp index cb0ac565f..7dddba95b 100644 --- a/plugins/channel/demodssb/ssbdemodgui.cpp +++ b/plugins/channel/demodssb/ssbdemodgui.cpp @@ -10,15 +10,16 @@ #include "dsp/spectrumvis.h" #include "gui/glspectrum.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingswidget.h" #include "dsp/dspengine.h" #include "mainwindow.h" -SSBDemodGUI* SSBDemodGUI::create(PluginAPI* pluginAPI) +SSBDemodGUI* SSBDemodGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - SSBDemodGUI* gui = new SSBDemodGUI(pluginAPI); + SSBDemodGUI* gui = new SSBDemodGUI(pluginAPI, deviceAPI); return gui; } @@ -314,10 +315,11 @@ void SSBDemodGUI::onMenuDoubleClicked() } } -SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : +SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::SSBDemodGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_channelMarker(this), m_basicSettingsShown(false), m_doApplySettings(true), @@ -338,7 +340,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_ssbDemod = new SSBDemod(m_spectrumVis); m_channelizer = new Channelizer(m_ssbDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); @@ -358,7 +360,8 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelMarker.setCenterFrequency(0); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); @@ -369,7 +372,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : SSBDemodGUI::~SSBDemodGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_ssbDemod; diff --git a/plugins/channel/demodssb/ssbdemodgui.h b/plugins/channel/demodssb/ssbdemodgui.h index eacea145a..db4f69431 100644 --- a/plugins/channel/demodssb/ssbdemodgui.h +++ b/plugins/channel/demodssb/ssbdemodgui.h @@ -7,6 +7,7 @@ #include "dsp/movingaverage.h" class PluginAPI; +class DeviceAPI; class AudioFifo; class ThreadedSampleSink; @@ -22,7 +23,7 @@ class SSBDemodGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static SSBDemodGUI* create(PluginAPI* pluginAPI); + static SSBDemodGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -55,6 +56,7 @@ private slots: private: Ui::SSBDemodGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; ChannelMarker m_channelMarker; bool m_basicSettingsShown; bool m_doApplySettings; @@ -71,12 +73,12 @@ private: SSBDemod* m_ssbDemod; SpectrumVis* m_spectrumVis; - explicit SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent = NULL); + explicit SSBDemodGUI(PluginAPI* pluginAPI, DeviceAPI* deviceAPI, QWidget* parent = NULL); virtual ~SSBDemodGUI(); int getEffectiveLowCutoff(int lowCutoff); bool setNewRate(int spanLog2); - + void blockApplySettings(bool block); void applySettings(); diff --git a/plugins/channel/demodssb/ssbplugin.cpp b/plugins/channel/demodssb/ssbplugin.cpp index ee5fd2ff9..ed0efaad6 100644 --- a/plugins/channel/demodssb/ssbplugin.cpp +++ b/plugins/channel/demodssb/ssbplugin.cpp @@ -1,5 +1,6 @@ #include #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "ssbplugin.h" #include "ssbdemodgui.h" @@ -30,21 +31,21 @@ void SSBPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("de.maintech.sdrangelove.channel.ssb", this); } -PluginGUI* SSBPlugin::createChannel(const QString& channelName) +PluginGUI* SSBPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "de.maintech.sdrangelove.channel.ssb") { - SSBDemodGUI* gui = SSBDemodGUI::create(m_pluginAPI); + SSBDemodGUI* gui = SSBDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.ssb", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; } } -void SSBPlugin::createInstanceSSB() +void SSBPlugin::createInstanceSSB(DeviceAPI *deviceAPI) { - SSBDemodGUI* gui = SSBDemodGUI::create(m_pluginAPI); + SSBDemodGUI* gui = SSBDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.ssb", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demodssb/ssbplugin.h b/plugins/channel/demodssb/ssbplugin.h index 7686d7f19..a5df1dc66 100644 --- a/plugins/channel/demodssb/ssbplugin.h +++ b/plugins/channel/demodssb/ssbplugin.h @@ -4,6 +4,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class SSBPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -15,7 +17,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -23,7 +25,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceSSB(); + void createInstanceSSB(DeviceAPI *deviceAPI); }; #endif // INCLUDE_SSBPLUGIN_H diff --git a/plugins/channel/demodwfm/wfmdemodgui.cpp b/plugins/channel/demodwfm/wfmdemodgui.cpp index 55c50a763..3d6c7d453 100644 --- a/plugins/channel/demodwfm/wfmdemodgui.cpp +++ b/plugins/channel/demodwfm/wfmdemodgui.cpp @@ -6,6 +6,7 @@ #include "dsp/channelizer.h" #include "dsp/dspengine.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "util/simpleserializer.h" #include "util/db.h" #include "gui/basicchannelsettingswidget.h" @@ -28,9 +29,9 @@ int requiredBW(int rfBW) return 384000; } -WFMDemodGUI* WFMDemodGUI::create(PluginAPI* pluginAPI) +WFMDemodGUI* WFMDemodGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - WFMDemodGUI* gui = new WFMDemodGUI(pluginAPI); + WFMDemodGUI* gui = new WFMDemodGUI(pluginAPI, deviceAPI); return gui; } @@ -213,10 +214,11 @@ void WFMDemodGUI::onMenuDoubleClicked() } } -WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : +WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::WFMDemodGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_channelMarker(this), m_basicSettingsShown(false), m_channelPowerDbAvg(20,0) @@ -232,7 +234,7 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_wfmDemod = new WFMDemod(0); m_channelizer = new Channelizer(m_wfmDemod); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); @@ -242,7 +244,8 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelMarker.setCenterFrequency(0); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); applySettings(); } @@ -250,7 +253,7 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : WFMDemodGUI::~WFMDemodGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_wfmDemod; diff --git a/plugins/channel/demodwfm/wfmdemodgui.h b/plugins/channel/demodwfm/wfmdemodgui.h index dbe2302bf..e54f44edb 100644 --- a/plugins/channel/demodwfm/wfmdemodgui.h +++ b/plugins/channel/demodwfm/wfmdemodgui.h @@ -7,6 +7,7 @@ #include "dsp/movingaverage.h" class PluginAPI; +class DeviceAPI; class ThreadedSampleSink; class Channelizer; @@ -20,7 +21,7 @@ class WFMDemodGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static WFMDemodGUI* create(PluginAPI* pluginAPI); + static WFMDemodGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -49,6 +50,7 @@ private slots: private: Ui::WFMDemodGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; ChannelMarker m_channelMarker; bool m_basicSettingsShown; bool m_doApplySettings; @@ -60,7 +62,7 @@ private: static const int m_rfBW[]; - explicit WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent = NULL); + explicit WFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = NULL); virtual ~WFMDemodGUI(); void blockApplySettings(bool block); diff --git a/plugins/channel/demodwfm/wfmplugin.cpp b/plugins/channel/demodwfm/wfmplugin.cpp index c77c18a9e..69801d3a8 100644 --- a/plugins/channel/demodwfm/wfmplugin.cpp +++ b/plugins/channel/demodwfm/wfmplugin.cpp @@ -31,21 +31,21 @@ void WFMPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("de.maintech.sdrangelove.channel.wfm", this); } -PluginGUI* WFMPlugin::createChannel(const QString& channelName) +PluginGUI* WFMPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "de.maintech.sdrangelove.channel.wfm") { - WFMDemodGUI* gui = WFMDemodGUI::create(m_pluginAPI); + WFMDemodGUI* gui = WFMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.wfm", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; } } -void WFMPlugin::createInstanceWFM() +void WFMPlugin::createInstanceWFM(DeviceAPI *deviceAPI) { - WFMDemodGUI* gui = WFMDemodGUI::create(m_pluginAPI); + WFMDemodGUI* gui = WFMDemodGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("de.maintech.sdrangelove.channel.wfm", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/demodwfm/wfmplugin.h b/plugins/channel/demodwfm/wfmplugin.h index 189e72334..1e6501f0e 100644 --- a/plugins/channel/demodwfm/wfmplugin.h +++ b/plugins/channel/demodwfm/wfmplugin.h @@ -4,6 +4,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class WFMPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -15,7 +17,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -23,7 +25,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceWFM(); + void createInstanceWFM(DeviceAPI *deviceAPI); }; #endif // INCLUDE_WFMPLUGIN_H diff --git a/plugins/channel/tcpsrc/tcpsrcgui.cpp b/plugins/channel/tcpsrc/tcpsrcgui.cpp index 0bd40dcbe..8933027b5 100644 --- a/plugins/channel/tcpsrc/tcpsrcgui.cpp +++ b/plugins/channel/tcpsrc/tcpsrcgui.cpp @@ -1,5 +1,6 @@ #include "tcpsrcgui.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "tcpsrc.h" #include "dsp/threadedsamplesink.h" #include "dsp/channelizer.h" @@ -11,9 +12,9 @@ #include "ui_tcpsrcgui.h" #include "mainwindow.h" -TCPSrcGUI* TCPSrcGUI::create(PluginAPI* pluginAPI) +TCPSrcGUI* TCPSrcGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - TCPSrcGUI* gui = new TCPSrcGUI(pluginAPI); + TCPSrcGUI* gui = new TCPSrcGUI(pluginAPI, deviceAPI); return gui; } @@ -179,10 +180,11 @@ void TCPSrcGUI::tick() ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1)); } -TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : +TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::TCPSrcGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_tcpSrc(0), m_channelMarker(this), m_channelPowerDbAvg(40,0), @@ -199,7 +201,7 @@ TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : m_tcpSrc = new TCPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis); m_channelizer = new Channelizer(m_tcpSrc); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->deltaFrequency->setValueRange(7, 0U, 9999999U); @@ -219,7 +221,8 @@ TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelMarker.setColor(Qt::green); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); @@ -229,7 +232,7 @@ TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : TCPSrcGUI::~TCPSrcGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_tcpSrc; diff --git a/plugins/channel/tcpsrc/tcpsrcgui.h b/plugins/channel/tcpsrc/tcpsrcgui.h index 4d86158b0..327a13690 100644 --- a/plugins/channel/tcpsrc/tcpsrcgui.h +++ b/plugins/channel/tcpsrc/tcpsrcgui.h @@ -9,6 +9,7 @@ #include "tcpsrc.h" class PluginAPI; +class DeviceAPI; class ThreadedSampleSink; class Channelizer; class TCPSrc; @@ -22,7 +23,7 @@ class TCPSrcGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static TCPSrcGUI* create(PluginAPI* pluginAPI); + static TCPSrcGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -53,6 +54,7 @@ private slots: private: Ui::TCPSrcGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; TCPSrc* m_tcpSrc; ChannelMarker m_channelMarker; MovingAverage m_channelPowerDbAvg; @@ -71,7 +73,7 @@ private: Channelizer* m_channelizer; SpectrumVis* m_spectrumVis; - explicit TCPSrcGUI(PluginAPI* pluginAPI, QWidget* parent = 0); + explicit TCPSrcGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = 0); virtual ~TCPSrcGUI(); void blockApplySettings(bool block); diff --git a/plugins/channel/tcpsrc/tcpsrcplugin.cpp b/plugins/channel/tcpsrc/tcpsrcplugin.cpp index f01cca4b4..88d64b7ed 100644 --- a/plugins/channel/tcpsrc/tcpsrcplugin.cpp +++ b/plugins/channel/tcpsrc/tcpsrcplugin.cpp @@ -30,21 +30,21 @@ void TCPSrcPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("sdrangel.channel.tcpsrc", this); } -PluginGUI* TCPSrcPlugin::createChannel(const QString& channelName) +PluginGUI* TCPSrcPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "sdrangel.channel.tcpsrc") { - TCPSrcGUI* gui = TCPSrcGUI::create(m_pluginAPI); + TCPSrcGUI* gui = TCPSrcGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.tcpsrc", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return NULL; } } -void TCPSrcPlugin::createInstanceTCPSrc() +void TCPSrcPlugin::createInstanceTCPSrc(DeviceAPI *deviceAPI) { - TCPSrcGUI* gui = TCPSrcGUI::create(m_pluginAPI); + TCPSrcGUI* gui = TCPSrcGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.tcpsrc", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/tcpsrc/tcpsrcplugin.h b/plugins/channel/tcpsrc/tcpsrcplugin.h index 4f5d729b4..02138ad0d 100644 --- a/plugins/channel/tcpsrc/tcpsrcplugin.h +++ b/plugins/channel/tcpsrc/tcpsrcplugin.h @@ -4,6 +4,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class TCPSrcPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -15,7 +17,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -23,7 +25,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceTCPSrc(); + void createInstanceTCPSrc(DeviceAPI *deviceAPI); }; #endif // INCLUDE_TCPSRCPLUGIN_H diff --git a/plugins/channel/udpsrc/udpsrcgui.cpp b/plugins/channel/udpsrc/udpsrcgui.cpp index 33d91fc5d..427743429 100644 --- a/plugins/channel/udpsrc/udpsrcgui.cpp +++ b/plugins/channel/udpsrc/udpsrcgui.cpp @@ -18,6 +18,7 @@ #include "udpsrcgui.h" #include "plugin/pluginapi.h" +#include "device/deviceapi.h" #include "dsp/threadedsamplesink.h" #include "dsp/channelizer.h" #include "dsp/spectrumvis.h" @@ -29,9 +30,9 @@ #include "mainwindow.h" #include "udpsrc.h" -UDPSrcGUI* UDPSrcGUI::create(PluginAPI* pluginAPI) +UDPSrcGUI* UDPSrcGUI::create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI) { - UDPSrcGUI* gui = new UDPSrcGUI(pluginAPI); + UDPSrcGUI* gui = new UDPSrcGUI(pluginAPI, deviceAPI); return gui; } @@ -216,10 +217,11 @@ void UDPSrcGUI::tick() ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1)); } -UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : +UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent) : RollupWidget(parent), ui(new Ui::UDPSrcGUI), m_pluginAPI(pluginAPI), + m_deviceAPI(deviceAPI), m_udpSrc(0), m_channelMarker(this), m_channelPowerDbAvg(40,0), @@ -237,7 +239,7 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : m_udpSrc = new UDPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis); m_channelizer = new Channelizer(m_udpSrc); m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); - m_pluginAPI->addThreadedSink(m_threadedChannelizer); + m_deviceAPI->addThreadedSink(m_threadedChannelizer); ui->fmDeviation->setEnabled(false); @@ -259,7 +261,8 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : m_channelMarker.setColor(Qt::green); m_channelMarker.setVisible(true); connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged())); - m_pluginAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addChannelMarker(&m_channelMarker); + m_deviceAPI->addRollupWidget(this); ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum); @@ -270,7 +273,7 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) : UDPSrcGUI::~UDPSrcGUI() { m_pluginAPI->removeChannelInstance(this); - m_pluginAPI->removeThreadedSink(m_threadedChannelizer); + m_deviceAPI->removeThreadedSink(m_threadedChannelizer); delete m_threadedChannelizer; delete m_channelizer; delete m_udpSrc; diff --git a/plugins/channel/udpsrc/udpsrcgui.h b/plugins/channel/udpsrc/udpsrcgui.h index 7de8ebca1..41ee51c45 100644 --- a/plugins/channel/udpsrc/udpsrcgui.h +++ b/plugins/channel/udpsrc/udpsrcgui.h @@ -27,6 +27,7 @@ #include "udpsrc.h" class PluginAPI; +class DeviceAPI; class ThreadedSampleSink; class Channelizer; class UDPSrc; @@ -40,7 +41,7 @@ class UDPSrcGUI : public RollupWidget, public PluginGUI { Q_OBJECT public: - static UDPSrcGUI* create(PluginAPI* pluginAPI); + static UDPSrcGUI* create(PluginAPI* pluginAPI, DeviceAPI *deviceAPI); void destroy(); void setName(const QString& name); @@ -77,6 +78,7 @@ private slots: private: Ui::UDPSrcGUI* ui; PluginAPI* m_pluginAPI; + DeviceAPI* m_deviceAPI; UDPSrc* m_udpSrc; ChannelMarker m_channelMarker; MovingAverage m_channelPowerDbAvg; @@ -101,7 +103,7 @@ private: Channelizer* m_channelizer; SpectrumVis* m_spectrumVis; - explicit UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent = 0); + explicit UDPSrcGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* parent = 0); virtual ~UDPSrcGUI(); void blockApplySettings(bool block); diff --git a/plugins/channel/udpsrc/udpsrcplugin.cpp b/plugins/channel/udpsrc/udpsrcplugin.cpp index 003d213b2..c91f90724 100644 --- a/plugins/channel/udpsrc/udpsrcplugin.cpp +++ b/plugins/channel/udpsrc/udpsrcplugin.cpp @@ -49,21 +49,21 @@ void UDPSrcPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerChannel("sdrangel.channel.udpsrc", this); } -PluginGUI* UDPSrcPlugin::createChannel(const QString& channelName) +PluginGUI* UDPSrcPlugin::createChannel(const QString& channelName, DeviceAPI *deviceAPI) { if(channelName == "sdrangel.channel.udpsrc") { - UDPSrcGUI* gui = UDPSrcGUI::create(m_pluginAPI); + UDPSrcGUI* gui = UDPSrcGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); return gui; } else { return 0; } } -void UDPSrcPlugin::createInstanceUDPSrc() +void UDPSrcPlugin::createInstanceUDPSrc(DeviceAPI *deviceAPI) { - UDPSrcGUI* gui = UDPSrcGUI::create(m_pluginAPI); + UDPSrcGUI* gui = UDPSrcGUI::create(m_pluginAPI, deviceAPI); m_pluginAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui); - m_pluginAPI->addChannelRollup(gui); +// m_pluginAPI->addChannelRollup(gui); } diff --git a/plugins/channel/udpsrc/udpsrcplugin.h b/plugins/channel/udpsrc/udpsrcplugin.h index 74116a394..1973987fa 100644 --- a/plugins/channel/udpsrc/udpsrcplugin.h +++ b/plugins/channel/udpsrc/udpsrcplugin.h @@ -21,6 +21,8 @@ #include #include "plugin/plugininterface.h" +class DeviceAPI; + class UDPSrcPlugin : public QObject, PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) @@ -32,7 +34,7 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); - PluginGUI* createChannel(const QString& channelName); + PluginGUI* createChannel(const QString& channelName, DeviceAPI *deviceAPI); private: static const PluginDescriptor m_pluginDescriptor; @@ -40,7 +42,7 @@ private: PluginAPI* m_pluginAPI; private slots: - void createInstanceUDPSrc(); + void createInstanceUDPSrc(DeviceAPI *deviceAPI); }; #endif // INCLUDE_UDPSRCPLUGIN_H