mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-01 21:54:55 -04:00
Plugins device enumeration optimization
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
const PluginDescriptor SDRPlayPlugin::m_pluginDescriptor = {
|
||||
QString("SDRPlay RSP1 Input"),
|
||||
QString("4.11.6"),
|
||||
QString("4.11.10"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
@@ -55,9 +55,12 @@ void SDRPlayPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||
pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
||||
}
|
||||
|
||||
PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources()
|
||||
void SDRPlayPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
|
||||
{
|
||||
SamplingDevices result;
|
||||
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
|
||||
return;
|
||||
}
|
||||
|
||||
int count = mirisdr_get_device_count();
|
||||
|
||||
char vendor[256];
|
||||
@@ -76,20 +79,45 @@ PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources()
|
||||
}
|
||||
|
||||
qDebug("SDRPlayPlugin::enumSampleSources: found %s:%s (%s)", vendor, product, serial);
|
||||
QString displayedName(QString("SDRPlay[%1] %2").arg(i).arg(serial));
|
||||
QString displayableName(QString("SDRPlay[%1] %2").arg(i).arg(serial));
|
||||
|
||||
result.append(SamplingDevice(displayedName,
|
||||
m_hardwareID,
|
||||
m_deviceTypeID,
|
||||
QString(serial),
|
||||
i,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
PluginInterface::SamplingDevice::StreamSingleRx,
|
||||
1,
|
||||
0));
|
||||
originDevices.append(OriginDevice(
|
||||
displayableName,
|
||||
m_hardwareID,
|
||||
serial,
|
||||
i, // sequence
|
||||
1, // Nb Rx
|
||||
0 // Nb Tx
|
||||
));
|
||||
}
|
||||
|
||||
return result;
|
||||
listedHwIds.append(m_hardwareID);
|
||||
}
|
||||
|
||||
PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources(const OriginDevices& originDevices)
|
||||
{
|
||||
SamplingDevices result;
|
||||
|
||||
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
|
||||
{
|
||||
if (it->hardwareId == m_hardwareID)
|
||||
{
|
||||
result.append(SamplingDevice(
|
||||
it->displayableName,
|
||||
it->hardwareId,
|
||||
m_deviceTypeID,
|
||||
it->serial,
|
||||
it->sequence,
|
||||
PluginInterface::SamplingDevice::PhysicalDevice,
|
||||
PluginInterface::SamplingDevice::StreamSingleRx,
|
||||
1,
|
||||
0
|
||||
));
|
||||
qDebug("SDRPlayPlugin::enumSampleSources: enumerated SDRPlay RSP1 device #%d", it->sequence);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
|
||||
Reference in New Issue
Block a user