1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

MIMO: add channels

This commit is contained in:
f4exb 2019-05-18 15:40:00 +02:00
parent 75ee688ac2
commit f220927704
3 changed files with 35 additions and 1 deletions

View File

@ -48,6 +48,9 @@ DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer)
m_deviceAPI = 0;
m_deviceSinkEngine = 0;
m_deviceTabIndex = tabIndex;
m_nbAvailableRxChannels = 0; // updated at enumeration for UI selector
m_nbAvailableTxChannels = 0; // updated at enumeration for UI selector
m_nbAvailableMIMOChannels = 0; // updated at enumeration for UI selector
// m_spectrum needs to have its font to be set since it cannot be inherited from the main window
QFont font;

View File

@ -73,6 +73,14 @@ public:
void loadTxChannelSettings(const Preset* preset, PluginAPI *pluginAPI);
void saveTxChannelSettings(Preset* preset);
// These are the number of channel types available for selection
void setNumberOfAvailableRxChannels(int number) { m_nbAvailableRxChannels = number; }
void setNumberOfAvailableTxChannels(int number) { m_nbAvailableTxChannels = number; }
void setNumberOfAvailableMIMOChannels(int number) { m_nbAvailableMIMOChannels = number; }
int getNumberOfAvailableRxChannels() const { return m_nbAvailableRxChannels; }
int getNumberOfAvailableTxChannels() const { return m_nbAvailableTxChannels; }
int getNumberOfAvailableMIMOChannels() const { return m_nbAvailableMIMOChannels; }
private:
struct ChannelInstanceRegistration
{
@ -97,6 +105,9 @@ private:
ChannelInstanceRegistrations m_rxChannelInstanceRegistrations;
ChannelInstanceRegistrations m_txChannelInstanceRegistrations;
int m_deviceTabIndex;
int m_nbAvailableRxChannels; //!< Number of Rx channels available for selection
int m_nbAvailableTxChannels; //!< Number of Tx channels available for selection
int m_nbAvailableMIMOChannels; //!< Number of MIMO channels available for selection
void renameRxChannelInstances();
void renameTxChannelInstances();

View File

@ -222,6 +222,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
}
m_mimoEnabled = parser.getMIMOSupport();
m_apiAdapter = new WebAPIAdapterGUI(*this);
m_requestMapper = new WebAPIRequestMapper(this);
m_requestMapper->setAdapter(m_apiAdapter);
@ -283,6 +284,7 @@ void MainWindow::addSourceDevice(int deviceIndex)
m_pluginManager->listRxChannels(channelNames);
QStringList channelNamesList(channelNames);
m_deviceUIs.back()->m_samplingDeviceControl->getChannelSelector()->addItems(channelNamesList);
m_deviceUIs.back()->setNumberOfAvailableRxChannels(channelNamesList.size());
connect(m_deviceUIs.back()->m_samplingDeviceControl->getAddChannelButton(), SIGNAL(clicked(bool)), this, SLOT(channelAddClicked(bool)));
@ -357,6 +359,7 @@ void MainWindow::addSinkDevice()
m_pluginManager->listTxChannels(channelNames);
QStringList channelNamesList(channelNames);
m_deviceUIs.back()->m_samplingDeviceControl->getChannelSelector()->addItems(channelNamesList);
m_deviceUIs.back()->setNumberOfAvailableTxChannels(channelNamesList.size());
connect(m_deviceUIs.back()->m_samplingDeviceControl->getAddChannelButton(), SIGNAL(clicked(bool)), this, SLOT(channelAddClicked(bool)));
@ -430,12 +433,13 @@ void MainWindow::addMIMODevice()
m_pluginManager->listRxChannels(rxChannelNames);
QStringList rxChannelNamesList(rxChannelNames);
channelSelector->addItems(rxChannelNamesList);
channelSelector->insertSeparator(channelSelector->count());
m_deviceUIs.back()->setNumberOfAvailableRxChannels(rxChannelNamesList.size());
// Add Tx channels
QList<QString> txChannelNames;
m_pluginManager->listTxChannels(txChannelNames);
QStringList txChannelNamesList(txChannelNames);
channelSelector->addItems(txChannelNamesList);
m_deviceUIs.back()->setNumberOfAvailableTxChannels(txChannelNamesList.size());
// TODO: add MIMO channels
connect(m_deviceUIs.back()->m_samplingDeviceControl->getAddChannelButton(), SIGNAL(clicked(bool)), this, SLOT(channelAddClicked(bool)));
@ -1873,6 +1877,22 @@ void MainWindow::channelAddClicked(bool checked)
m_pluginManager->createTxChannelInstance(
deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI, deviceUI->m_deviceAPI);
}
else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range
{
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
int nbTxChannels = deviceUI->getNumberOfAvailableTxChannels();
int selectedIndex = deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex();
qDebug("MainWindow::channelAddClicked: MIMO: tab: %d nbRx: %d nbTx: %d selected: %d",
currentSourceTabIndex, nbRxChannels, nbTxChannels, selectedIndex);
if (selectedIndex < nbRxChannels) {
m_pluginManager->createRxChannelInstance(
selectedIndex, deviceUI, deviceUI->m_deviceAPI);
} else if (selectedIndex < nbRxChannels + nbTxChannels) {
m_pluginManager->createTxChannelInstance(
selectedIndex - nbRxChannels, deviceUI, deviceUI->m_deviceAPI);
}
}
}
}