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

Multi device support: ensure there is only one instance of SDRdaemon and FileSource plugins

This commit is contained in:
f4exb 2016-05-22 21:56:07 +02:00
parent 3e4a163304
commit a32175eccb
3 changed files with 17 additions and 3 deletions

View File

@ -194,7 +194,7 @@ void MainWindow::addDevice()
ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr); ui->tabChannels->addTab(m_deviceUIs.back()->m_channelWindow, tabNameCStr);
bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(true); bool sampleSourceSignalsBlocked = m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()->blockSignals(true);
m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector()); m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelector(), dspDeviceEngineUID);
connect(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelectionConfirm(), SIGNAL(clicked(bool)), this, SLOT(on_sampleSource_confirmClicked(bool))); connect(m_deviceUIs.back()->m_samplingDeviceControl->getDeviceSelectionConfirm(), SIGNAL(clicked(bool)), this, SLOT(on_sampleSource_confirmClicked(bool)));

View File

@ -14,6 +14,9 @@
#include <QDebug> #include <QDebug>
const QString PluginManager::m_sdrDaemonDeviceTypeID = "sdrangel.samplesource.sdrdaemon";
const QString PluginManager::m_fileSourceDeviceTypeID = "sdrangel.samplesource.filesource";
PluginManager::PluginManager(MainWindow* mainWindow, QObject* parent) : PluginManager::PluginManager(MainWindow* mainWindow, QObject* parent) :
QObject(parent), QObject(parent),
m_pluginAPI(this, mainWindow), m_pluginAPI(this, mainWindow),
@ -81,12 +84,20 @@ void PluginManager::updateSampleSourceDevices()
} }
} }
void PluginManager::fillSampleSourceSelector(QComboBox* comboBox) void PluginManager::fillSampleSourceSelector(QComboBox* comboBox, uint deviceUID)
{ {
comboBox->clear(); comboBox->clear();
for(int i = 0; i < m_sampleSourceDevices.count(); i++) for(int i = 0; i < m_sampleSourceDevices.count(); i++)
{ {
// There can be only one instance of file source and SDRdaemon plugins
if ((m_sampleSourceDevices[i].m_sourceId == m_sdrDaemonDeviceTypeID) || (m_sampleSourceDevices[i].m_sourceId == m_fileSourceDeviceTypeID))
{
if (deviceUID != 0) {
continue;
}
}
comboBox->addItem(m_sampleSourceDevices[i].m_displayName, i); comboBox->addItem(m_sampleSourceDevices[i].m_displayName, i);
} }
} }

View File

@ -48,7 +48,7 @@ public:
PluginAPI::ChannelRegistrations *getChannelRegistrations() { return &m_channelRegistrations; } PluginAPI::ChannelRegistrations *getChannelRegistrations() { return &m_channelRegistrations; }
void updateSampleSourceDevices(); void updateSampleSourceDevices();
void fillSampleSourceSelector(QComboBox* comboBox); void fillSampleSourceSelector(QComboBox* comboBox, uint deviceUID);
int selectSampleSourceByIndex(int index, DeviceAPI *deviceAPI); int selectSampleSourceByIndex(int index, DeviceAPI *deviceAPI);
int selectFirstSampleSource(const QString& sourceId, DeviceAPI *deviceAPI); int selectFirstSampleSource(const QString& sourceId, DeviceAPI *deviceAPI);
@ -99,6 +99,9 @@ private:
SampleSourceRegistrations m_sampleSourceRegistrations; //!< Input source plugins (one per device kind) register here SampleSourceRegistrations m_sampleSourceRegistrations; //!< Input source plugins (one per device kind) register here
SampleSourceDevices m_sampleSourceDevices; //!< Instances of input sources present in the system SampleSourceDevices m_sampleSourceDevices; //!< Instances of input sources present in the system
static const QString m_sdrDaemonDeviceTypeID;
static const QString m_fileSourceDeviceTypeID;
// QString m_sampleSourceId; // QString m_sampleSourceId;
// QString m_sampleSourceSerial; // QString m_sampleSourceSerial;
// int m_sampleSourceSequence; // int m_sampleSourceSequence;