From b8568feb470331fb0c33c1b1a58808231e5aed67 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 1 Oct 2020 23:23:39 +0200 Subject: [PATCH] Replace separate create channel methods (BS and CS): Lora Demod --- plugins/channelrx/demodlora/loraplugin.cpp | 27 +++++++++++++--------- plugins/channelrx/demodlora/loraplugin.h | 3 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/plugins/channelrx/demodlora/loraplugin.cpp b/plugins/channelrx/demodlora/loraplugin.cpp index e6dff5526..9ad2c3652 100644 --- a/plugins/channelrx/demodlora/loraplugin.cpp +++ b/plugins/channelrx/demodlora/loraplugin.cpp @@ -34,18 +34,23 @@ void LoRaPlugin::initPlugin(PluginAPI* pluginAPI) m_pluginAPI->registerRxChannel(LoRaDemod::m_channelIdURI, LoRaDemod::m_channelId, this); } +void LoRaPlugin::createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const +{ + if (bs || cs) + { + LoRaDemod *instance = new LoRaDemod(deviceAPI); + + if (bs) { + *bs = instance; + } + + if (cs) { + *cs = instance; + } + } +} + PluginInstanceGUI* LoRaPlugin::createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const { return LoRaDemodGUI::create(m_pluginAPI, deviceUISet, rxChannel); } - -BasebandSampleSink* LoRaPlugin::createRxChannelBS(DeviceAPI *deviceAPI) const -{ - return new LoRaDemod(deviceAPI); -} - -ChannelAPI* LoRaPlugin::createRxChannelCS(DeviceAPI *deviceAPI) const -{ - return new LoRaDemod(deviceAPI); -} - diff --git a/plugins/channelrx/demodlora/loraplugin.h b/plugins/channelrx/demodlora/loraplugin.h index 88b8d7705..90f408fe5 100644 --- a/plugins/channelrx/demodlora/loraplugin.h +++ b/plugins/channelrx/demodlora/loraplugin.h @@ -18,9 +18,8 @@ public: const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); + virtual void createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const; virtual PluginInstanceGUI* createRxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) const; - virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const; - virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const; private: static const PluginDescriptor m_pluginDescriptor;