1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Plugin interface: simplify createTxChannelGUI

This commit is contained in:
f4exb 2017-12-23 10:38:45 +01:00
parent 31aacc9571
commit d79ef49112
15 changed files with 27 additions and 66 deletions

View File

@ -50,15 +50,9 @@ void AMModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI->registerTxChannel(AMMod::m_channelIdURI, AMMod::m_channelId, this);
}
PluginInstanceGUI* AMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
PluginInstanceGUI* AMModPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
{
if(channelName == AMMod::m_channelIdURI)
{
AMModGUI* gui = AMModGUI::create(m_pluginAPI, deviceUISet, txChannel);
return gui;
} else {
return 0;
}
return AMModGUI::create(m_pluginAPI, deviceUISet, txChannel);
}
BasebandSampleSource* AMModPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)

View File

@ -34,7 +34,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);

View File

@ -50,15 +50,9 @@ void ATVModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI->registerTxChannel(ATVMod::m_channelIdURI, ATVMod::m_channelId, this);
}
PluginInstanceGUI* ATVModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
PluginInstanceGUI* ATVModPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
{
if(channelName == ATVMod::m_channelIdURI)
{
ATVModGUI* gui = ATVModGUI::create(m_pluginAPI, deviceUISet, txChannel);
return gui;
} else {
return 0;
}
return ATVModGUI::create(m_pluginAPI, deviceUISet, txChannel);
}
BasebandSampleSource* ATVModPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)

View File

@ -34,7 +34,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);

View File

@ -51,22 +51,15 @@ void NFMModPlugin::initPlugin(PluginAPI* pluginAPI)
#ifdef SERVER_MODE
PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(
const QString& channelName __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)),
BasebandSampleSource *txChannel __attribute__((unused)))
{
return 0;
}
#else
PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
PluginInstanceGUI* NFMModPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
{
if(channelName == NFMMod::m_channelIdURI)
{
NFMModGUI* gui = NFMModGUI::create(m_pluginAPI, deviceUISet, txChannel);
return gui;
} else {
return 0;
}
return NFMModGUI::create(m_pluginAPI, deviceUISet, txChannel);
}
#endif

View File

@ -34,7 +34,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel);
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *rxChannel);
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);

View File

@ -50,15 +50,9 @@ void SSBModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI->registerTxChannel(SSBMod::m_channelIdURI, SSBMod::m_channelId, this);
}
PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
PluginInstanceGUI* SSBModPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
{
if(channelName == SSBMod::m_channelIdURI)
{
SSBModGUI* gui = SSBModGUI::create(m_pluginAPI, deviceUISet, txChannel);
return gui;
} else {
return 0;
}
return SSBModGUI::create(m_pluginAPI, deviceUISet, txChannel);
}
BasebandSampleSource* SSBModPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)

View File

@ -34,7 +34,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);

View File

@ -50,15 +50,9 @@ void WFMModPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI->registerTxChannel(WFMMod::m_channelIdURI, WFMMod::m_channelId, this);
}
PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
PluginInstanceGUI* WFMModPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
{
if(channelName == WFMMod::m_channelIdURI)
{
WFMModGUI* gui = WFMModGUI::create(m_pluginAPI, deviceUISet, txChannel);
return gui;
} else {
return 0;
}
return WFMModGUI::create(m_pluginAPI, deviceUISet, txChannel);
}
BasebandSampleSource* WFMModPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)

View File

@ -33,7 +33,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);

View File

@ -50,17 +50,9 @@ void UDPSinkPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI->registerTxChannel(UDPSink::m_channelIdURI, UDPSink::m_channelId, this);
}
PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
PluginInstanceGUI* UDPSinkPlugin::createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
{
if(channelName == UDPSink::m_channelIdURI)
{
UDPSinkGUI* gui = UDPSinkGUI::create(m_pluginAPI, deviceUISet, txChannel);
// deviceAPI->registerChannelInstance("sdrangel.channel.udpsrc", gui);
// m_pluginAPI->addChannelRollup(gui);
return gui;
} else {
return 0;
}
return UDPSinkGUI::create(m_pluginAPI, deviceUISet, txChannel);
}
BasebandSampleSource* UDPSinkPlugin::createTxChannelBS(DeviceSinkAPI *deviceAPI)

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual PluginInstanceGUI* createTxChannelGUI(const QString& channelName, DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual PluginInstanceGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel);
virtual BasebandSampleSource* createTxChannelBS(DeviceSinkAPI *deviceAPI);
virtual ChannelSourceAPI* createTxChannelCS(DeviceSinkAPI *deviceAPI);

View File

@ -94,7 +94,6 @@ public:
// channel Tx plugins
virtual PluginInstanceGUI* createTxChannelGUI(
const QString& channelName __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)),
BasebandSampleSource *txChannel __attribute__((unused)))
{ return 0; }

View File

@ -194,6 +194,6 @@ void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceUISet
{
PluginInterface *pluginInterface = m_txChannelRegistrations[channelPluginIndex].m_plugin;
BasebandSampleSource *txChannel = pluginInterface->createTxChannelBS(deviceAPI);
pluginInterface->createTxChannelGUI(m_txChannelRegistrations[channelPluginIndex].m_channelIdURI, deviceUISet, txChannel);
pluginInterface->createTxChannelGUI(deviceUISet, txChannel);
}
}

View File

@ -176,10 +176,10 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
{
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI));
BasebandSampleSink *rxChannel
= (*channelRegistrations)[i].m_plugin->createRxChannelBS(m_deviceSourceAPI);
PluginInstanceGUI *rxChannelGUI
= (*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel);
BasebandSampleSink *rxChannel =
(*channelRegistrations)[i].m_plugin->createRxChannelBS(m_deviceSourceAPI);
PluginInstanceGUI *rxChannelGUI =
(*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel);
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannelGUI);
break;
}
@ -274,9 +274,10 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
{
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI));
BasebandSampleSource *txChannel = (*channelRegistrations)[i].m_plugin->createTxChannelBS(m_deviceSinkAPI);
PluginInstanceGUI *txChannelGUI = (*channelRegistrations)[i].m_plugin->createTxChannelGUI(
channelConfig.m_channelIdURI, this, txChannel);
BasebandSampleSource *txChannel =
(*channelRegistrations)[i].m_plugin->createTxChannelBS(m_deviceSinkAPI);
PluginInstanceGUI *txChannelGUI =
(*channelRegistrations)[i].m_plugin->createTxChannelGUI(this, txChannel);
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, txChannelGUI);
break;
}