mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
Replace separate create channel methods (BS and CS) by a single one combining both interfaces
This commit is contained in:
parent
dc31bd8c48
commit
77955d4dba
@ -70,7 +70,8 @@ void DeviceSet::deleteChannel(int channelIndex)
|
||||
void DeviceSet::addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getRxChannelRegistrations(); // Available channel plugins
|
||||
ChannelAPI *rxChannel =(*channelRegistrations)[selectedChannelIndex].m_plugin->createRxChannelCS(m_deviceAPI);
|
||||
ChannelAPI *rxChannel;
|
||||
(*channelRegistrations)[selectedChannelIndex].m_plugin->createRxChannel(m_deviceAPI, nullptr, &rxChannel);
|
||||
ChannelInstanceRegistration reg = ChannelInstanceRegistration(rxChannel->getName(), rxChannel);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
qDebug("DeviceSet::addRxChannel: %s", qPrintable(rxChannel->getName()));
|
||||
@ -79,7 +80,8 @@ void DeviceSet::addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||
void DeviceSet::addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getTxChannelRegistrations(); // Available channel plugins
|
||||
ChannelAPI *txChannel = (*channelRegistrations)[selectedChannelIndex].m_plugin->createTxChannelCS(m_deviceAPI);
|
||||
ChannelAPI *txChannel;
|
||||
(*channelRegistrations)[selectedChannelIndex].m_plugin->createTxChannel(m_deviceAPI, nullptr, &txChannel);
|
||||
ChannelInstanceRegistration reg = ChannelInstanceRegistration(txChannel->getName(), txChannel);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
qDebug("DeviceSet::addTxChannel: %s", qPrintable(txChannel->getName()));
|
||||
@ -88,7 +90,8 @@ void DeviceSet::addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||
void DeviceSet::addMIMOChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getMIMOChannelRegistrations(); // Available channel plugins
|
||||
ChannelAPI *mimoChannel = (*channelRegistrations)[selectedChannelIndex].m_plugin->createMIMOChannelCS(m_deviceAPI);
|
||||
ChannelAPI *mimoChannel;
|
||||
(*channelRegistrations)[selectedChannelIndex].m_plugin->createMIMOChannel(m_deviceAPI, nullptr, &mimoChannel);
|
||||
ChannelInstanceRegistration reg = ChannelInstanceRegistration(mimoChannel->getName(), mimoChannel);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
qDebug("DeviceSet::addMIMOChannel: %s", qPrintable(mimoChannel->getName()));
|
||||
@ -142,7 +145,8 @@ 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));
|
||||
ChannelAPI *rxChannel = (*channelRegistrations)[i].m_plugin->createRxChannelCS(m_deviceAPI);
|
||||
ChannelAPI *rxChannel;
|
||||
(*channelRegistrations)[i].m_plugin->createRxChannel(m_deviceAPI, nullptr, &rxChannel);
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannel);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
break;
|
||||
@ -234,7 +238,8 @@ void DeviceSet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginAPI
|
||||
if ((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
|
||||
{
|
||||
qDebug("DeviceSet::loadTxChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI));
|
||||
ChannelAPI *txChannel = (*channelRegistrations)[i].m_plugin->createTxChannelCS(m_deviceAPI);
|
||||
ChannelAPI *txChannel;
|
||||
(*channelRegistrations)[i].m_plugin->createTxChannel(m_deviceAPI, nullptr, &txChannel);
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, txChannel);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
break;
|
||||
@ -331,7 +336,8 @@ void DeviceSet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
qDebug("DeviceSet::loadMIMOChannelSettings: creating new channel [%s] from config [%s]",
|
||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||
qPrintable(channelConfig.m_channelIdURI));
|
||||
ChannelAPI *mimoChannel = (*channelRegistrations)[i].m_plugin->createMIMOChannelCS(m_deviceAPI);
|
||||
ChannelAPI *mimoChannel;
|
||||
(*channelRegistrations)[i].m_plugin->createMIMOChannel(m_deviceAPI, nullptr, &mimoChannel);
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, mimoChannel);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
break;
|
||||
|
@ -19,6 +19,7 @@ struct SDRBASE_API PluginDescriptor {
|
||||
|
||||
class PluginAPI;
|
||||
class DeviceAPI;
|
||||
class DeviceSet;
|
||||
class DeviceUISet;
|
||||
class FeatureUISet;
|
||||
class WebAPIAdapterInterface;
|
||||
@ -125,6 +126,13 @@ public:
|
||||
|
||||
// channel Rx plugins
|
||||
|
||||
virtual void createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
(void) bs;
|
||||
(void) cs;
|
||||
}
|
||||
|
||||
virtual PluginInstanceGUI* createRxChannelGUI(
|
||||
DeviceUISet *deviceUISet,
|
||||
BasebandSampleSink *rxChannel) const
|
||||
@ -134,20 +142,15 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// channel Tx plugins
|
||||
|
||||
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
(void) bs;
|
||||
(void) cs;
|
||||
}
|
||||
|
||||
virtual PluginInstanceGUI* createTxChannelGUI(
|
||||
DeviceUISet *deviceUISet,
|
||||
BasebandSampleSource *txChannel) const
|
||||
@ -157,20 +160,15 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// channel MIMO plugins
|
||||
|
||||
virtual void createMIMOChannel(DeviceAPI *deviceAPI, MIMOChannel **bs, ChannelAPI **cs) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
(void) bs;
|
||||
(void) cs;
|
||||
}
|
||||
|
||||
virtual PluginInstanceGUI* createMIMOChannelGUI(
|
||||
DeviceUISet *deviceUISet,
|
||||
MIMOChannel *mimoChannel) const
|
||||
@ -180,18 +178,6 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual MIMOChannel* createMIMOChannelBS(DeviceAPI *deviceAPI) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual ChannelAPI* createMIMOChannelCS(DeviceAPI *deviceAPI) const
|
||||
{
|
||||
(void) deviceAPI;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// any channel
|
||||
|
||||
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const
|
||||
|
@ -208,8 +208,8 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
qDebug("DeviceUISet::loadRxChannelSettings: creating new channel [%s] from config [%s]",
|
||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||
qPrintable(channelConfig.m_channelIdURI));
|
||||
BasebandSampleSink *rxChannel =
|
||||
(*channelRegistrations)[i].m_plugin->createRxChannelBS(m_deviceAPI);
|
||||
BasebandSampleSink *rxChannel;
|
||||
(*channelRegistrations)[i].m_plugin->createRxChannel(m_deviceAPI, &rxChannel, nullptr);
|
||||
PluginInstanceGUI *rxChannelGUI =
|
||||
(*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel);
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannelGUI, 0);
|
||||
@ -285,8 +285,8 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
qDebug("DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s]",
|
||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||
qPrintable(channelConfig.m_channelIdURI));
|
||||
BasebandSampleSource *txChannel =
|
||||
(*channelRegistrations)[i].m_plugin->createTxChannelBS(m_deviceAPI);
|
||||
BasebandSampleSource *txChannel;
|
||||
(*channelRegistrations)[i].m_plugin->createTxChannel(m_deviceAPI, &txChannel, nullptr);
|
||||
PluginInstanceGUI *txChannelGUI =
|
||||
(*channelRegistrations)[i].m_plugin->createTxChannelGUI(this, txChannel);
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, txChannelGUI, 1);
|
||||
@ -364,8 +364,8 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
||||
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new channel [%s] from config [%s]",
|
||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||
qPrintable(channelConfig.m_channelIdURI));
|
||||
MIMOChannel *mimoChannel =
|
||||
(*channelRegistrations)[i].m_plugin->createMIMOChannelBS(m_deviceAPI);
|
||||
MIMOChannel *mimoChannel;
|
||||
(*channelRegistrations)[i].m_plugin->createMIMOChannel(m_deviceAPI, &mimoChannel, nullptr);
|
||||
PluginInstanceGUI *mimoChannelGUI =
|
||||
(*channelRegistrations)[i].m_plugin->createMIMOChannelGUI(this, mimoChannel);
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, mimoChannelGUI, 2);
|
||||
|
@ -1922,14 +1922,16 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
||||
BasebandSampleSink *rxChannel = pluginInterface->createRxChannelBS(deviceUI->m_deviceAPI);
|
||||
BasebandSampleSink *rxChannel;
|
||||
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, nullptr);
|
||||
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||
}
|
||||
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
||||
BasebandSampleSource *txChannel = pluginInterface->createTxChannelBS(deviceUI->m_deviceAPI);
|
||||
BasebandSampleSource *txChannel;
|
||||
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, nullptr);
|
||||
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||
}
|
||||
else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range
|
||||
@ -1943,14 +1945,16 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
||||
BasebandSampleSink *rxChannel = pluginInterface->createRxChannelBS(deviceUI->m_deviceAPI);
|
||||
BasebandSampleSink *rxChannel;
|
||||
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, nullptr);
|
||||
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||
}
|
||||
else if (channelIndex < nbRxChannels + nbTxChannels)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex - nbRxChannels].m_plugin;
|
||||
BasebandSampleSource *txChannel = pluginInterface->createTxChannelBS(deviceUI->m_deviceAPI);
|
||||
BasebandSampleSource *txChannel;
|
||||
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, nullptr);
|
||||
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user