1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-24 11:04:10 -04:00

Add GUI to device set outside plugin

This commit is contained in:
f4exb
2020-10-03 03:09:36 +02:00
parent b8568feb47
commit 7a0f15acaf
5 changed files with 41 additions and 28 deletions
+16 -8
View File
@@ -1922,17 +1922,21 @@ void MainWindow::channelAddClicked(int channelIndex)
{
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
ChannelAPI *channelAPI;
BasebandSampleSink *rxChannel;
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, nullptr);
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI);
PluginInstanceGUI *gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
deviceUI->registerRxChannelInstance(gui->getName(), channelAPI, gui);
}
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
{
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
ChannelAPI *channelAPI;
BasebandSampleSource *txChannel;
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, nullptr);
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI);
PluginInstanceGUI *gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel);
deviceUI->registerTxChannelInstance(gui->getName(), channelAPI, gui);
}
else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range
{
@@ -1945,17 +1949,21 @@ void MainWindow::channelAddClicked(int channelIndex)
{
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
ChannelAPI *channelAPI;
BasebandSampleSink *rxChannel;
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, nullptr);
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI);
PluginInstanceGUI *gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
deviceUI->registerRxChannelInstance(gui->getName(), channelAPI, gui);
}
else if (channelIndex < nbRxChannels + nbTxChannels)
{
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex - nbRxChannels].m_plugin;
ChannelAPI *channelAPI;
BasebandSampleSource *txChannel;
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, nullptr);
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI);
PluginInstanceGUI *gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel);
deviceUI->registerTxChannelInstance(gui->getName(), channelAPI, gui);
}
}
}