1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -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);
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)));

View File

@ -14,6 +14,9 @@
#include <QDebug>
const QString PluginManager::m_sdrDaemonDeviceTypeID = "sdrangel.samplesource.sdrdaemon";
const QString PluginManager::m_fileSourceDeviceTypeID = "sdrangel.samplesource.filesource";
PluginManager::PluginManager(MainWindow* mainWindow, QObject* parent) :
QObject(parent),
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();
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);
}
}

View File

@ -48,7 +48,7 @@ public:
PluginAPI::ChannelRegistrations *getChannelRegistrations() { return &m_channelRegistrations; }
void updateSampleSourceDevices();
void fillSampleSourceSelector(QComboBox* comboBox);
void fillSampleSourceSelector(QComboBox* comboBox, uint deviceUID);
int selectSampleSourceByIndex(int index, 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
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_sampleSourceSerial;
// int m_sampleSourceSequence;