mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -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)
|
void DeviceSet::addRxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||||
{
|
{
|
||||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getRxChannelRegistrations(); // Available channel plugins
|
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);
|
ChannelInstanceRegistration reg = ChannelInstanceRegistration(rxChannel->getName(), rxChannel);
|
||||||
m_channelInstanceRegistrations.append(reg);
|
m_channelInstanceRegistrations.append(reg);
|
||||||
qDebug("DeviceSet::addRxChannel: %s", qPrintable(rxChannel->getName()));
|
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)
|
void DeviceSet::addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||||
{
|
{
|
||||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getTxChannelRegistrations(); // Available channel plugins
|
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);
|
ChannelInstanceRegistration reg = ChannelInstanceRegistration(txChannel->getName(), txChannel);
|
||||||
m_channelInstanceRegistrations.append(reg);
|
m_channelInstanceRegistrations.append(reg);
|
||||||
qDebug("DeviceSet::addTxChannel: %s", qPrintable(txChannel->getName()));
|
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)
|
void DeviceSet::addMIMOChannel(int selectedChannelIndex, PluginAPI *pluginAPI)
|
||||||
{
|
{
|
||||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getMIMOChannelRegistrations(); // Available channel plugins
|
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);
|
ChannelInstanceRegistration reg = ChannelInstanceRegistration(mimoChannel->getName(), mimoChannel);
|
||||||
m_channelInstanceRegistrations.append(reg);
|
m_channelInstanceRegistrations.append(reg);
|
||||||
qDebug("DeviceSet::addMIMOChannel: %s", qPrintable(mimoChannel->getName()));
|
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]",
|
qDebug("DeviceSet::loadChannelSettings: creating new channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.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);
|
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannel);
|
||||||
m_channelInstanceRegistrations.append(reg);
|
m_channelInstanceRegistrations.append(reg);
|
||||||
break;
|
break;
|
||||||
@ -234,7 +238,8 @@ void DeviceSet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginAPI
|
|||||||
if ((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
|
if ((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI)
|
||||||
{
|
{
|
||||||
qDebug("DeviceSet::loadTxChannelSettings: creating new channel [%s]", qPrintable(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);
|
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, txChannel);
|
||||||
m_channelInstanceRegistrations.append(reg);
|
m_channelInstanceRegistrations.append(reg);
|
||||||
break;
|
break;
|
||||||
@ -331,7 +336,8 @@ void DeviceSet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
qDebug("DeviceSet::loadMIMOChannelSettings: creating new channel [%s] from config [%s]",
|
qDebug("DeviceSet::loadMIMOChannelSettings: creating new channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.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);
|
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, mimoChannel);
|
||||||
m_channelInstanceRegistrations.append(reg);
|
m_channelInstanceRegistrations.append(reg);
|
||||||
break;
|
break;
|
||||||
|
@ -19,6 +19,7 @@ struct SDRBASE_API PluginDescriptor {
|
|||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceAPI;
|
class DeviceAPI;
|
||||||
|
class DeviceSet;
|
||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
class FeatureUISet;
|
class FeatureUISet;
|
||||||
class WebAPIAdapterInterface;
|
class WebAPIAdapterInterface;
|
||||||
@ -125,6 +126,13 @@ public:
|
|||||||
|
|
||||||
// channel Rx plugins
|
// channel Rx plugins
|
||||||
|
|
||||||
|
virtual void createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const
|
||||||
|
{
|
||||||
|
(void) deviceAPI;
|
||||||
|
(void) bs;
|
||||||
|
(void) cs;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginInstanceGUI* createRxChannelGUI(
|
virtual PluginInstanceGUI* createRxChannelGUI(
|
||||||
DeviceUISet *deviceUISet,
|
DeviceUISet *deviceUISet,
|
||||||
BasebandSampleSink *rxChannel) const
|
BasebandSampleSink *rxChannel) const
|
||||||
@ -134,20 +142,15 @@ public:
|
|||||||
return nullptr;
|
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
|
// channel Tx plugins
|
||||||
|
|
||||||
|
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const
|
||||||
|
{
|
||||||
|
(void) deviceAPI;
|
||||||
|
(void) bs;
|
||||||
|
(void) cs;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginInstanceGUI* createTxChannelGUI(
|
virtual PluginInstanceGUI* createTxChannelGUI(
|
||||||
DeviceUISet *deviceUISet,
|
DeviceUISet *deviceUISet,
|
||||||
BasebandSampleSource *txChannel) const
|
BasebandSampleSource *txChannel) const
|
||||||
@ -157,20 +160,15 @@ public:
|
|||||||
return nullptr;
|
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
|
// channel MIMO plugins
|
||||||
|
|
||||||
|
virtual void createMIMOChannel(DeviceAPI *deviceAPI, MIMOChannel **bs, ChannelAPI **cs) const
|
||||||
|
{
|
||||||
|
(void) deviceAPI;
|
||||||
|
(void) bs;
|
||||||
|
(void) cs;
|
||||||
|
}
|
||||||
|
|
||||||
virtual PluginInstanceGUI* createMIMOChannelGUI(
|
virtual PluginInstanceGUI* createMIMOChannelGUI(
|
||||||
DeviceUISet *deviceUISet,
|
DeviceUISet *deviceUISet,
|
||||||
MIMOChannel *mimoChannel) const
|
MIMOChannel *mimoChannel) const
|
||||||
@ -180,18 +178,6 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual MIMOChannel* createMIMOChannelBS(DeviceAPI *deviceAPI) const
|
|
||||||
{
|
|
||||||
(void) deviceAPI;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ChannelAPI* createMIMOChannelCS(DeviceAPI *deviceAPI) const
|
|
||||||
{
|
|
||||||
(void) deviceAPI;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// any channel
|
// any channel
|
||||||
|
|
||||||
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const
|
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]",
|
qDebug("DeviceUISet::loadRxChannelSettings: creating new channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
BasebandSampleSink *rxChannel =
|
BasebandSampleSink *rxChannel;
|
||||||
(*channelRegistrations)[i].m_plugin->createRxChannelBS(m_deviceAPI);
|
(*channelRegistrations)[i].m_plugin->createRxChannel(m_deviceAPI, &rxChannel, nullptr);
|
||||||
PluginInstanceGUI *rxChannelGUI =
|
PluginInstanceGUI *rxChannelGUI =
|
||||||
(*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel);
|
(*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel);
|
||||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannelGUI, 0);
|
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]",
|
qDebug("DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
BasebandSampleSource *txChannel =
|
BasebandSampleSource *txChannel;
|
||||||
(*channelRegistrations)[i].m_plugin->createTxChannelBS(m_deviceAPI);
|
(*channelRegistrations)[i].m_plugin->createTxChannel(m_deviceAPI, &txChannel, nullptr);
|
||||||
PluginInstanceGUI *txChannelGUI =
|
PluginInstanceGUI *txChannelGUI =
|
||||||
(*channelRegistrations)[i].m_plugin->createTxChannelGUI(this, txChannel);
|
(*channelRegistrations)[i].m_plugin->createTxChannelGUI(this, txChannel);
|
||||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, txChannelGUI, 1);
|
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]",
|
qDebug("DeviceUISet::loadMIMOChannelSettings: creating new channel [%s] from config [%s]",
|
||||||
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
qPrintable((*channelRegistrations)[i].m_channelIdURI),
|
||||||
qPrintable(channelConfig.m_channelIdURI));
|
qPrintable(channelConfig.m_channelIdURI));
|
||||||
MIMOChannel *mimoChannel =
|
MIMOChannel *mimoChannel;
|
||||||
(*channelRegistrations)[i].m_plugin->createMIMOChannelBS(m_deviceAPI);
|
(*channelRegistrations)[i].m_plugin->createMIMOChannel(m_deviceAPI, &mimoChannel, nullptr);
|
||||||
PluginInstanceGUI *mimoChannelGUI =
|
PluginInstanceGUI *mimoChannelGUI =
|
||||||
(*channelRegistrations)[i].m_plugin->createMIMOChannelGUI(this, mimoChannel);
|
(*channelRegistrations)[i].m_plugin->createMIMOChannelGUI(this, mimoChannel);
|
||||||
reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, mimoChannelGUI, 2);
|
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
|
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
|
||||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
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);
|
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||||
}
|
}
|
||||||
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
||||||
{
|
{
|
||||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
||||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
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);
|
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||||
}
|
}
|
||||||
else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range
|
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
|
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
|
||||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
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);
|
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||||
}
|
}
|
||||||
else if (channelIndex < nbRxChannels + nbTxChannels)
|
else if (channelIndex < nbRxChannels + nbTxChannels)
|
||||||
{
|
{
|
||||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
||||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex - nbRxChannels].m_plugin;
|
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);
|
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user