1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Plugins device enumeration optimization

This commit is contained in:
f4exb 2019-09-17 00:34:11 +02:00
parent b7e5e2bbc5
commit e9bbf0b266
64 changed files with 1377 additions and 480 deletions

View File

@ -35,8 +35,8 @@ const char *fcd_traits<ProPlus>::displayedName = "FunCube Dongle Pro+";
const char *fcd_traits<Pro>::pluginDisplayedName = "FunCube Pro Input";
const char *fcd_traits<ProPlus>::pluginDisplayedName = "FunCube Pro+ Input";
const char *fcd_traits<Pro>::pluginVersion = "4.11.6";
const char *fcd_traits<ProPlus>::pluginVersion = "4.11.6";
const char *fcd_traits<Pro>::pluginVersion = "4.11.10";
const char *fcd_traits<ProPlus>::pluginVersion = "4.11.10";
const int64_t fcd_traits<Pro>::loLowLimitFreq = 64000000L;
const int64_t fcd_traits<ProPlus>::loLowLimitFreq = 150000L;

View File

@ -30,7 +30,7 @@
const PluginDescriptor TestMIPlugin::m_pluginDescriptor = {
QString("Test Multiple Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,44 @@ void TestMIPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleMIMO(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices TestMIPlugin::enumSampleMIMO()
void TestMIPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"TestMI", // Displayable name
m_hardwareID, // Hardware ID
QString::null, // Serial
0, // Sequence
2, // Number of Rx streams
0 // Number of Tx streams
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices TestMIPlugin::enumSampleMIMO(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"TestMI",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamMIMO,
1,
0));
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
"TestMI",
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamMIMO,
1, // MIMO is always considered as a single device
0));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleMIMO();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleMIMO(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleMIMOPluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor Bladerf1OutputPlugin::m_pluginDescriptor = {
QString("BladeRF1 Output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,9 +56,12 @@ void Bladerf1OutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks()
void Bladerf1OutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
struct bladerf_devinfo *devinfo = 0;
int count = bladerf_get_device_list(&devinfo);
@ -73,12 +76,12 @@ PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks()
if (status == BLADERF_ERR_NODEV)
{
qCritical("BladerfOutputPlugin::enumSampleSinks: No device at index %d", i);
qCritical("BladerfOutputPlugin::enumOriginDevices: No device at index %d", i);
continue;
}
else if (status != 0)
{
qCritical("BladerfOutputPlugin::enumSampleSinks: Failed to open device at index %d", i);
qCritical("BladerfOutputPlugin::enumOriginDevices: Failed to open device at index %d", i);
continue;
}
@ -86,18 +89,16 @@ PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks()
if (strcmp(boardName, "bladerf1") == 0)
{
QString displayedName(QString("BladeRF1[%1] %2").arg(devinfo[i].instance).arg(devinfo[i].serial));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(devinfo[i].serial),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0));
QString displayableName(QString("BladeRF1[%1] %2").arg(devinfo[i].instance).arg(devinfo[i].serial));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
QString(devinfo[i].serial),
i, // Sequence
1, // Has 1 Rx known by construction
1 // Has 1 Tx known by construction
));
}
bladerf_close(dev);
@ -106,6 +107,31 @@ PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks()
bladerf_free_device_list(devinfo); // Valgrind memcheck
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks(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::StreamSingleTx,
1, // Nb of Tx streams
0 // Stream index
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,

View File

@ -31,7 +31,7 @@
const PluginDescriptor BladeRF2OutputPlugin::m_pluginDescriptor = {
QString("BladeRF2 Output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,9 +56,12 @@ void BladeRF2OutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices BladeRF2OutputPlugin::enumSampleSinks()
void BladeRF2OutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
struct bladerf_devinfo *devinfo = 0;
int count = bladerf_get_device_list(&devinfo);
@ -73,12 +76,12 @@ PluginInterface::SamplingDevices BladeRF2OutputPlugin::enumSampleSinks()
if (status == BLADERF_ERR_NODEV)
{
qCritical("Bladerf2OutputPlugin::enumSampleSinks: No device at index %d", i);
qCritical("Bladerf2OutputPlugin::enumOriginDevices: No device at index %d", i);
continue;
}
else if (status != 0)
{
qCritical("Bladerf2OutputPlugin::enumSampleSinks: Failed to open device at index %d", i);
qCritical("Bladerf2OutputPlugin::enumOriginDevices: Failed to open device at index %d", i);
continue;
}
@ -86,22 +89,19 @@ PluginInterface::SamplingDevices BladeRF2OutputPlugin::enumSampleSinks()
if (strcmp(boardName, "bladerf2") == 0)
{
unsigned int nbRxChannels = bladerf_get_channel_count(dev, BLADERF_RX);
unsigned int nbTxChannels = bladerf_get_channel_count(dev, BLADERF_TX);
// make the stream index a placeholder for future arg() hence the arg("%1")
QString displayableName(QString("BladeRF2[%1:%2] %3").arg(devinfo[i].instance).arg("%1").arg(devinfo[i].serial));
for (unsigned int j = 0; j < nbTxChannels; j++)
{
qDebug("Blderf2InputPlugin::enumSampleSinks: device #%d (%s) channel %u", i, devinfo[i].serial, j);
QString displayedName(QString("BladeRF2[%1:%2] %3").arg(devinfo[i].instance).arg(j).arg(devinfo[i].serial));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(devinfo[i].serial),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
nbTxChannels,
j));
}
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
QString(devinfo[i].serial),
i, // Sequence
nbRxChannels,
nbTxChannels
));
}
bladerf_close(dev);
@ -110,6 +110,35 @@ PluginInterface::SamplingDevices BladeRF2OutputPlugin::enumSampleSinks()
bladerf_free_device_list(devinfo); // Valgrind memcheck
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices BladeRF2OutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
for (int j = 0; j < it->nbTxStreams; j++)
{
QString displayedName(it->displayableName.arg(j));
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
it->nbTxStreams,
j
));
}
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,

View File

@ -29,7 +29,7 @@
const PluginDescriptor FileSinkPlugin::m_pluginDescriptor = {
QString("File sink output"),
QString("4.2.1"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -54,20 +54,45 @@ void FileSinkPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks()
void FileSinkPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"FileSink",
m_hardwareID,
QString::null,
0, // Sequence
0, // nb Rx
1 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"FileSink",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0));
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::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0
));
}
}
return result;
}

View File

@ -37,7 +37,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor HackRFOutputPlugin::m_pluginDescriptor = {
QString("HackRF Output"),
QString("4.11.8"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,9 +56,12 @@ void HackRFOutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
void HackRFOutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
hackrf_device *hackrf_ptr;
read_partid_serialno_t read_partid_serialno;
@ -70,13 +73,13 @@ PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
if (rc == HACKRF_SUCCESS)
{
qDebug("HackRFOutputPlugin::enumSampleSinks: try to enumerate HackRF device #%d", i);
qDebug("HackRFOutputPlugin::enumOriginDevices: try to enumerate HackRF device #%d", i);
rc = (hackrf_error) hackrf_board_partid_serialno_read(hackrf_ptr, &read_partid_serialno);
if (rc != HACKRF_SUCCESS)
{
qDebug("HackRFOutputPlugin::enumSampleSinks: failed to read serial no: %s", hackrf_error_name(rc));
qDebug("HackRFOutputPlugin::enumOriginDevices: failed to read serial no: %s", hackrf_error_name(rc));
hackrf_close(hackrf_ptr);
continue; // next
}
@ -88,27 +91,51 @@ PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
//uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
QString displayedName(QString("HackRF[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
serial_str,
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0));
originDevices.append(OriginDevice(
displayedName,
m_hardwareID,
serial_str,
i,
1,
1
));
qDebug("HackRFOutputPlugin::enumSampleSinks: enumerated HackRF device #%d", i);
qDebug("HackRFOutputPlugin::enumOriginDevices: enumerated HackRF device #%d", i);
hackrf_close(hackrf_ptr);
}
else
{
qDebug("HackRFOutputPlugin::enumSampleSinks: failed to enumerate HackRF device #%d: %s", i, hackrf_error_name(rc));
qDebug("HackRFOutputPlugin::enumOriginDevices: failed to enumerate HackRF device #%d: %s", i, hackrf_error_name(rc));
}
}
hackrf_device_list_free(hackrf_devices);
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks(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::StreamSingleTx,
1,
0
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -35,7 +35,7 @@
const PluginDescriptor LimeSDROutputPlugin::m_pluginDescriptor = {
QString("LimeSDR Output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -60,25 +60,29 @@ void LimeSDROutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks()
void LimeSDROutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
lms_info_str_t* deviceList;
int nbDevices;
SamplingDevices result;
if ((nbDevices = LMS_GetDeviceList(0)) <= 0)
{
qDebug("LimeSDROutputPlugin::enumSampleSources: Could not find any LimeSDR device");
return result; // empty result
qDebug("LimeSDROutputPlugin::enumOriginDevices: Could not find any LimeSDR device");
return; // do nothing
}
deviceList = new lms_info_str_t[nbDevices];
if (LMS_GetDeviceList(deviceList) < 0)
{
qDebug("LimeSDROutputPlugin::enumSampleSources: Could not obtain LimeSDR devices information");
qDebug("LimeSDROutputPlugin::enumOriginDevices: Could not obtain LimeSDR devices information");
delete[] deviceList;
return result; // empty result
return; // do nothing
}
else
{
@ -91,24 +95,51 @@ PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks()
limeSDRParams.open(deviceList[i]);
limeSDRParams.close();
for (unsigned int j = 0; j < limeSDRParams.m_nbTxChannels; j++)
{
qDebug("LimeSDROutputPlugin::enumSampleSources: device #%d channel %u: %s", i, j, (char *) deviceList[i]);
QString displayedName(QString("LimeSDR[%1:%2] %3").arg(i).arg(j).arg(serial.c_str()));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(deviceList[i]),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
limeSDRParams.m_nbTxChannels,
j));
}
QString displayedName(QString("LimeSDR[%1:%2] %3").arg(i).arg("%1").arg(serial.c_str()));
originDevices.append(OriginDevice(
displayedName,
m_hardwareID,
QString(deviceList[i]),
i,
limeSDRParams.m_nbRxChannels,
limeSDRParams.m_nbTxChannels
));
}
}
delete[] deviceList;
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
for (unsigned int j = 0; j < it->nbTxStreams; j++)
{
qDebug("LimeSDROutputPlugin::enumSampleSinks: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
QString displayedName(it->displayableName.arg(j));
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
it->nbTxStreams,
j
));
}
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor LocalOutputPlugin::m_pluginDescriptor = {
QString("Local device output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,45 @@ void LocalOutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices LocalOutputPlugin::enumSampleSinks()
void LocalOutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"LocalOutput",
m_hardwareID,
QString::null,
0, // Sequence
0, // nb Rx
1 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices LocalOutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"LocalOutput",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0));
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::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor PlutoSDROutputPlugin::m_pluginDescriptor = {
QString("PlutoSDR Output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,33 +56,61 @@ void PlutoSDROutputPlugin::initPlugin(PluginAPI* pluginAPI)
DevicePlutoSDR::instance(); // create singleton
}
PluginInterface::SamplingDevices PlutoSDROutputPlugin::enumSampleSinks()
void PlutoSDROutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
DevicePlutoSDR::instance().scan();
std::vector<std::string> serials;
DevicePlutoSDR::instance().getSerials(serials);
std::vector<std::string>::const_iterator it = serials.begin();
int i;
SamplingDevices result;
for (i = 0; it != serials.end(); ++it, ++i)
{
QString serial_str = QString::fromLocal8Bit(it->c_str());
QString displayedName(QString("PlutoSDR[%1] %2").arg(i).arg(serial_str));
QString displayableName(QString("PlutoSDR[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
serial_str,
i, // sequence
1, // Nb Rx
1 // Nb Tx
));
qDebug("PlutoSDROutputPlugin::enumOriginDevices: enumerated PlutoSDR device #%d", i);
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices PlutoSDROutputPlugin::enumSampleSinks(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,
serial_str,
i,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0));
qDebug("PlutoSDROutputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i);
}
0
));
qDebug("PlutoSDROutputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", it->sequence);
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor RemoteOutputPlugin::m_pluginDescriptor = {
QString("Remote device output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,45 @@ void RemoteOutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices RemoteOutputPlugin::enumSampleSinks()
void RemoteOutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"RemoteOutput",
m_hardwareID,
QString::null,
0, // Sequence
0, // nb Rx
1 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices RemoteOutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"RemoteOutput",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0));
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::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
1,
0
));
}
}
return result;
}

View File

@ -37,7 +37,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -32,7 +32,7 @@
const PluginDescriptor SoapySDROutputPlugin::m_pluginDescriptor = {
QString("SoapySDR Output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -57,33 +57,62 @@ void SoapySDROutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices SoapySDROutputPlugin::enumSampleSinks()
void SoapySDROutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
DeviceSoapySDR& deviceSoapySDR = DeviceSoapySDR::instance();
const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& devicesEnumeration = deviceSoapySDR.getDevicesEnumeration();
qDebug("SoapySDROutputPlugin::enumSampleSinks: %lu SoapySDR devices. Enumerate these with Tx channel(s):", devicesEnumeration.size());
qDebug("SoapySDROutputPlugin::enumOriginDevices: %lu SoapySDR devices", devicesEnumeration.size());
std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>::const_iterator it = devicesEnumeration.begin();
for (int idev = 0; it != devicesEnumeration.end(); ++it, idev++)
{
unsigned int nbTxChannels = it->m_nbTx;
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg("%1").arg(it->m_label));
QString serial(QString("%1-%2").arg(it->m_driverName).arg(it->m_sequence));
for (unsigned int ichan = 0; ichan < nbTxChannels; ichan++)
originDevices.append(OriginDevice(
displayedName,
m_hardwareID,
serial,
idev, // Sequence
it->m_nbRx, // nb Rx
it->m_nbTx // nb Tx
));
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices SoapySDROutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg(ichan).arg(it->m_label));
QString serial(QString("%1-%2").arg(it->m_driverName).arg(it->m_sequence));
qDebug("SoapySDROutputPlugin::enumSampleSinks: device #%d (%s) serial %s channel %u",
idev, it->m_label.toStdString().c_str(), serial.toStdString().c_str(), ichan);
result.append(SamplingDevice(displayedName,
m_hardwareID,
unsigned int nbTxChannels = it->nbTxStreams;
for (unsigned int ichan = 0; ichan < nbTxChannels; ichan++)
{
QString displayedName(it->displayableName.arg(ichan));
qDebug("SoapySDROutputPlugin::enumSampleSinks: device #%d serial %s channel %u",
it->sequence, it->serial.toStdString().c_str(), ichan);
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
serial,
idev,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
nbTxChannels,
ichan));
ichan
));
}
}
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,

View File

@ -35,7 +35,7 @@
const PluginDescriptor XTRXOutputPlugin::m_pluginDescriptor = {
QString("XTRX Output"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -60,29 +60,61 @@ void XTRXOutputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices XTRXOutputPlugin::enumSampleSinks()
void XTRXOutputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
xtrx_device_info_t devs[32];
int res = xtrx_discovery(devs, 32);
int i;
for (i = 0; i < res; i++) {
for (i = 0; i < res; i++)
{
DeviceXTRXParams XTRXParams;
for (unsigned int j = 0; j < XTRXParams.m_nbTxChannels; j++)
QString displayableName(QString("XTRX[%1:%2] %3").arg(i).arg("%1").arg(devs[i].uniqname));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
QString(devs[i].uniqname),
i,
XTRXParams.m_nbRxChannels,
XTRXParams.m_nbTxChannels
));
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices XTRXOutputPlugin::enumSampleSinks(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
qDebug("XTRXInputPlugin::enumSampleSinks: device #%d channel %u: %s", i, j, devs[i].uniqname);
QString displayedName(QString("XTRX[%1:%2] %3").arg(i).arg(j).arg(devs[i].uniqname));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(devs[i].uniqname),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
XTRXParams.m_nbTxChannels,
j));
for (unsigned int j = 0; j < it->nbTxStreams; j++)
{
qDebug("XTRXInputPlugin::enumSampleSinks: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
QString displayedName(it->displayableName.arg(j));
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleTx,
it->nbTxStreams,
j
));
}
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSinks();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,

View File

@ -33,7 +33,7 @@ const int AirspyPlugin::m_maxDevices = 32;
const PluginDescriptor AirspyPlugin::m_pluginDescriptor = {
QString("Airspy Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -58,9 +58,12 @@ void AirspyPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
void AirspyPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
airspy_read_partid_serialno_t read_partid_serialno;
struct airspy_device *devinfo;
uint32_t serial_msb = 0;
@ -72,7 +75,7 @@ PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
if (rc != AIRSPY_SUCCESS)
{
qCritical("AirspyPlugin::enumSampleSources: failed to initiate Airspy library: %s", airspy_error_name(rc));
qCritical("AirspyPlugin::enumOriginDevices: failed to initiate Airspy library: %s", airspy_error_name(rc));
}
for (i=0; i < m_maxDevices; i++)
@ -81,13 +84,13 @@ PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
if (rc == AIRSPY_SUCCESS)
{
qDebug("AirspyPlugin::enumSampleSources: try to enumerate Airspy device #%d", i);
qDebug("AirspyPlugin::enumOriginDevices: try to enumerate Airspy device #%d", i);
rc = (airspy_error) airspy_board_partid_serialno_read(devinfo, &read_partid_serialno);
if (rc != AIRSPY_SUCCESS)
{
qDebug("AirspyPlugin::enumSampleSources: failed to read serial no: %s", airspy_error_name(rc));
qDebug("AirspyPlugin::enumOriginDevices: failed to read serial no: %s", airspy_error_name(rc));
airspy_close(devinfo);
continue; // next
}
@ -99,32 +102,57 @@ PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
QString serial_str = QString::number(serial_msb, 16) + QString::number(serial_lsb, 16);
//uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
QString displayedName(QString("Airspy[%1] %2").arg(i).arg(serial_str));
QString displayableName(QString("Airspy[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
serial_str,
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
serial_str,
i,
1,
0
));
qDebug("AirspyPlugin::enumSampleSources: enumerated Airspy device #%d", i);
qDebug("AirspyPlugin::enumOriginDevices: enumerated Airspy device #%d", i);
}
airspy_close(devinfo);
}
else
{
qDebug("AirspyPlugin::enumSampleSources: enumerated %d Airspy devices %s", i, airspy_error_name(rc));
qDebug("AirspyPlugin::enumOriginDevices: enumerated %d Airspy devices %s", i, airspy_error_name(rc));
break; // finished
}
}
rc = (airspy_error) airspy_exit();
qDebug("AirspyPlugin::enumSampleSources: airspy_exit: %s", airspy_error_name(rc));
qDebug("AirspyPlugin::enumOriginDevices: airspy_exit: %s", airspy_error_name(rc));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices AirspyPlugin::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,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
qDebug("AirspyPlugin::enumSampleSources: enumerated Airspy device #%d", it->sequence);
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = {
QString("AirspyHF Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -57,9 +57,12 @@ void AirspyHFPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices AirspyHFPlugin::enumSampleSources()
void AirspyHFPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
int nbDevices;
uint64_t deviceSerials[m_maxDevices];
@ -67,7 +70,7 @@ PluginInterface::SamplingDevices AirspyHFPlugin::enumSampleSources()
if (nbDevices < 0)
{
qCritical("AirspyHFPlugin::enumSampleSources: failed to list Airspy HF devices");
qCritical("AirspyHFPlugin::enumOriginDevices: failed to list Airspy HF devices");
}
for (int i = 0; i < nbDevices; i++)
@ -75,27 +78,52 @@ PluginInterface::SamplingDevices AirspyHFPlugin::enumSampleSources()
if (deviceSerials[i])
{
QString serial_str = QString::number(deviceSerials[i], 16);
QString displayedName(QString("AirspyHF[%1] %2").arg(i).arg(serial_str));
QString displayableName(QString("AirspyHF[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
serial_str,
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
serial_str,
i,
1,
0
));
qDebug("AirspyHFPlugin::enumSampleSources: enumerated Airspy HF device #%d", i);
qDebug("AirspyHFPlugin::enumOriginDevices: enumerated Airspy HF device #%d", i);
}
else
{
qDebug("AirspyHFPlugin::enumSampleSources: finished to enumerate Airspy HF. %d devices found", i);
qDebug("AirspyHFPlugin::enumOriginDevices: finished to enumerate Airspy HF. %d devices found", i);
break; // finished
}
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices AirspyHFPlugin::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,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
qDebug("AirspyHFPlugin::enumSampleSources: enumerated Airspy HF device #%d", it->sequence);
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor Blderf1InputPlugin::m_pluginDescriptor = {
QString("BladeRF1 Input"),
QString("4.5.4"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,11 +56,13 @@ void Blderf1InputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices Blderf1InputPlugin::enumSampleSources()
void Blderf1InputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
struct bladerf_devinfo *devinfo = nullptr;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
struct bladerf_devinfo *devinfo = nullptr;
int count = bladerf_get_device_list(&devinfo);
if (devinfo)
@ -86,17 +88,16 @@ PluginInterface::SamplingDevices Blderf1InputPlugin::enumSampleSources()
if (strcmp(boardName, "bladerf1") == 0)
{
QString displayedName(QString("BladeRF1[%1] %2").arg(devinfo[i].instance).arg(devinfo[i].serial));
QString displayableName(QString("BladeRF1[%1] %2").arg(devinfo[i].instance).arg(devinfo[i].serial));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(devinfo[i].serial),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
devinfo[i].serial,
i,
1, // nb Rx
1 // nb Tx
));
}
bladerf_close(dev);
@ -105,6 +106,30 @@ PluginInterface::SamplingDevices Blderf1InputPlugin::enumSampleSources()
bladerf_free_device_list(devinfo); // Valgrind memcheck
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices Blderf1InputPlugin::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,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
}
}
return result;
}

View File

@ -38,7 +38,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor Blderf2InputPlugin::m_pluginDescriptor = {
QString("BladeRF2 Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,9 +56,12 @@ void Blderf2InputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices Blderf2InputPlugin::enumSampleSources()
void Blderf2InputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
struct bladerf_devinfo *devinfo = 0;
int count = bladerf_get_device_list(&devinfo);
@ -73,12 +76,12 @@ PluginInterface::SamplingDevices Blderf2InputPlugin::enumSampleSources()
if (status == BLADERF_ERR_NODEV)
{
qCritical("Blderf2InputPlugin::enumSampleSources: No device at index %d", i);
qCritical("Blderf2InputPlugin::enumOriginDevices: No device at index %d", i);
continue;
}
else if (status != 0)
{
qCritical("Blderf2InputPlugin::enumSampleSources: Failed to open device at index %d", i);
qCritical("Blderf2InputPlugin::enumOriginDevices: Failed to open device at index %d", i);
continue;
}
@ -87,21 +90,18 @@ PluginInterface::SamplingDevices Blderf2InputPlugin::enumSampleSources()
if (strcmp(boardName, "bladerf2") == 0)
{
unsigned int nbRxChannels = bladerf_get_channel_count(dev, BLADERF_RX);
unsigned int nbTxChannels = bladerf_get_channel_count(dev, BLADERF_TX);
qDebug("Blderf2InputPlugin::enumOriginDevices: device #%d (%s)", i, devinfo[i].serial);
QString displayableName(QString("BladeRF2[%1:%2] %3").arg(devinfo[i].instance).arg("%1").arg(devinfo[i].serial));
for (unsigned int j = 0; j < nbRxChannels; j++)
{
qDebug("Blderf2InputPlugin::enumSampleSources: device #%d (%s) channel %u", i, devinfo[i].serial, j);
QString displayedName(QString("BladeRF2[%1:%2] %3").arg(devinfo[i].instance).arg(j).arg(devinfo[i].serial));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(devinfo[i].serial),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
nbRxChannels,
j));
}
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
devinfo[i].serial,
i,
2, // nb Rx
2 // nb Tx
));
}
bladerf_close(dev);
@ -110,6 +110,33 @@ PluginInterface::SamplingDevices Blderf2InputPlugin::enumSampleSources()
bladerf_free_device_list(devinfo); // Valgrind memcheck
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices Blderf2InputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
for (int j=0; j < it->nbRxStreams; j++)
{
result.append(SamplingDevice(
it->displayableName,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
it->nbRxStreams,
j));
}
}
}
return result;
}

View File

@ -38,7 +38,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -52,9 +52,11 @@ void FCDProPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(fcd_traits<Pro>::interfaceIID, this);
}
PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources()
void FCDProPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(fcd_traits<Pro>::hardwareID)) { // check if it was done
return;
}
int i = 0;
struct hid_device_info *device_info = hid_enumerate(fcd_traits<Pro>::vendorId, fcd_traits<Pro>::productId);
@ -62,22 +64,45 @@ PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources()
while (device_info != 0)
{
QString serialNumber = QString::fromWCharArray(device_info->serial_number);
QString displayedName(QString("%1[%2] %3").arg(fcd_traits<Pro>::displayedName).arg(i).arg(serialNumber));
QString displayableName(QString("%1[%2] %3").arg(fcd_traits<Pro>::displayedName).arg(i).arg(serialNumber));
result.append(SamplingDevice(displayedName,
fcd_traits<Pro>::hardwareID,
fcd_traits<Pro>::interfaceIID,
serialNumber,
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
originDevices.append(OriginDevice(
displayableName,
fcd_traits<Pro>::hardwareID,
serialNumber,
i,
1, // nb Rx
0 // nb Tx
));
device_info = device_info->next;
i++;
}
listedHwIds.append(fcd_traits<Pro>::hardwareID);
}
PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == fcd_traits<Pro>::hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
fcd_traits<Pro>::hardwareID,
fcd_traits<Pro>::interfaceIID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
}
}
return result;
}

View File

@ -19,7 +19,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -54,9 +54,11 @@ void FCDProPlusPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(fcd_traits<ProPlus>::interfaceIID, this);
}
PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources()
void FCDProPlusPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(fcd_traits<ProPlus>::hardwareID)) { // check if it was done
return;
}
int i = 0;
struct hid_device_info *device_info = hid_enumerate(fcd_traits<ProPlus>::vendorId, fcd_traits<ProPlus>::productId);
@ -64,22 +66,46 @@ PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources()
while (device_info != 0)
{
QString serialNumber = QString::fromWCharArray(device_info->serial_number);
QString displayedName(QString("%1[%2] %3").arg(fcd_traits<ProPlus>::displayedName).arg(i).arg(serialNumber));
QString displayableName(QString("%1[%2] %3").arg(fcd_traits<ProPlus>::displayedName).arg(i).arg(serialNumber));
result.append(SamplingDevice(displayedName,
fcd_traits<ProPlus>::hardwareID,
fcd_traits<ProPlus>::interfaceIID,
serialNumber,
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
originDevices.append(OriginDevice(
displayableName,
fcd_traits<Pro>::hardwareID,
serialNumber,
i,
1, // nb Rx
0 // nb Tx
));
device_info = device_info->next;
i++;
}
listedHwIds.append(fcd_traits<ProPlus>::hardwareID);
}
PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == fcd_traits<ProPlus>::hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
fcd_traits<ProPlus>::hardwareID,
fcd_traits<ProPlus>::interfaceIID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
}
}
return result;
}

View File

@ -19,7 +19,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor FileInputPlugin::m_pluginDescriptor = {
QString("File device input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,45 @@ void FileInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices FileInputPlugin::enumSampleSources()
void FileInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"FileInput",
m_hardwareID,
QString::null,
0,
1, // nb Rx
0 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices FileInputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"FileInput",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -32,7 +32,7 @@
const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
QString("HackRF Input"),
QString("4.11.8"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -57,17 +57,12 @@ void HackRFInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
void HackRFInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
DeviceHackRF::instance();
// hackrf_error rc = (hackrf_error) hackrf_init();
//
// if (rc != HACKRF_SUCCESS)
// {
// qCritical("HackRFPlugin::SampleSourceDevices: failed to initiate HackRF library: %s", hackrf_error_name(rc));
// }
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
SamplingDevices result;
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
hackrf_device *hackrf_ptr;
read_partid_serialno_t read_partid_serialno;
@ -79,13 +74,13 @@ PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
if (rc == HACKRF_SUCCESS)
{
qDebug("HackRFPlugin::enumSampleSources: try to enumerate HackRF device #%d", i);
qDebug("HackRFInputPlugin::enumOriginDevices: try to enumerate HackRF device #%d", i);
rc = (hackrf_error) hackrf_board_partid_serialno_read(hackrf_ptr, &read_partid_serialno);
if (rc != HACKRF_SUCCESS)
{
qDebug("HackRFPlugin::enumSampleSources: failed to read serial no: %s", hackrf_error_name(rc));
qDebug("HackRFInputPlugin::enumOriginDevices: failed to read serial no: %s", hackrf_error_name(rc));
hackrf_close(hackrf_ptr);
continue; // next
}
@ -97,29 +92,50 @@ PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
//uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
QString displayedName(QString("HackRF[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
serial_str,
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
originDevices.append(OriginDevice(
displayedName,
m_hardwareID,
serial_str,
i,
1,
1
));
qDebug("HackRFPlugin::enumSampleSources: enumerated HackRF device #%d", i);
qDebug("HackRFInputPlugin::enumOriginDevices: enumerated HackRF device #%d", i);
hackrf_close(hackrf_ptr);
}
else
{
qDebug("HackRFPlugin::enumSampleSources: failed to enumerate HackRF device #%d: %s", i, hackrf_error_name(rc));
qDebug("HackRFOutputPlugin::enumOriginDevices: failed to enumerate HackRF device #%d: %s", i, hackrf_error_name(rc));
}
}
hackrf_device_list_free(hackrf_devices);
// rc = (hackrf_error) hackrf_exit();
// qDebug("HackRFPlugin::enumSampleSources: hackrf_exit: %s", hackrf_error_name(rc));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices HackRFInputPlugin::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
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor KiwiSDRPlugin::m_pluginDescriptor = {
QString("KiwiSDR input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Vort (c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,20 +56,45 @@ void KiwiSDRPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices KiwiSDRPlugin::enumSampleSources()
void KiwiSDRPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"KiwiSDR",
m_hardwareID,
QString::null,
0,
1, // nb Rx
0 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices KiwiSDRPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"KiwiSDR",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
}
}
return result;
}

View File

@ -37,7 +37,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -34,7 +34,7 @@
const PluginDescriptor LimeSDRInputPlugin::m_pluginDescriptor = {
QString("LimeSDR Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -59,25 +59,29 @@ void LimeSDRInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources()
void LimeSDRInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
lms_info_str_t* deviceList;
int nbDevices;
SamplingDevices result;
if ((nbDevices = LMS_GetDeviceList(0)) <= 0)
{
qDebug("LimeSDRInputPlugin::enumSampleSources: Could not find any LimeSDR device");
return result; // empty result
qDebug("LimeSDRInputPlugin::enumOriginDevices: Could not find any LimeSDR device");
return; // do nothing
}
deviceList = new lms_info_str_t[nbDevices];
if (LMS_GetDeviceList(deviceList) < 0)
{
qDebug("LimeSDRInputPlugin::enumSampleSources: Could not obtain LimeSDR devices information");
qDebug("LimeSDRInputPlugin::enumOriginDevices: Could not obtain LimeSDR devices information");
delete[] deviceList;
return result; // empty result
return; // do nothing
}
else
{
@ -90,24 +94,51 @@ PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources()
limeSDRParams.open(deviceList[i]);
limeSDRParams.close();
for (unsigned int j = 0; j < limeSDRParams.m_nbRxChannels; j++)
{
qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d channel %u: %s", i, j, (char *) deviceList[i]);
QString displayedName(QString("LimeSDR[%1:%2] %3").arg(i).arg(j).arg(serial.c_str()));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(deviceList[i]),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
limeSDRParams.m_nbRxChannels,
j));
}
QString displayedName(QString("LimeSDR[%1:%2] %3").arg(i).arg("%1").arg(serial.c_str()));
originDevices.append(OriginDevice(
displayedName,
m_hardwareID,
QString(deviceList[i]),
i,
limeSDRParams.m_nbRxChannels,
limeSDRParams.m_nbTxChannels
));
}
}
delete[] deviceList;
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
for (unsigned int j = 0; j < it->nbRxStreams; j++)
{
qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
QString displayedName(it->displayableName.arg(j));
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
it->nbRxStreams,
j
));
}
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor LocalInputPlugin::m_pluginDescriptor = {
QString("Local device input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,45 @@ void LocalInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices LocalInputPlugin::enumSampleSources()
void LocalInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"LocalInput",
m_hardwareID,
QString::null,
0,
1, // nb Rx
0 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices LocalInputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"LocalInput",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -32,7 +32,7 @@
const PluginDescriptor PerseusPlugin::m_pluginDescriptor = {
QString("Perseus Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -58,33 +58,61 @@ void PerseusPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices PerseusPlugin::enumSampleSources()
void PerseusPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
DevicePerseus::instance().scan();
std::vector<std::string> serials;
DevicePerseus::instance().getSerials(serials);
std::vector<std::string>::const_iterator it = serials.begin();
int i;
SamplingDevices result;
for (i = 0; it != serials.end(); ++it, ++i)
{
QString serial_str = QString::fromLocal8Bit(it->c_str());
QString displayedName(QString("Perseus[%1] %2").arg(i).arg(serial_str));
QString displayableName(QString("Perseus[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
serial_str,
i, // sequence
1, // Nb Rx
0 // Nb Tx
));
qDebug("PerseusPlugin::enumOriginDevices: enumerated Perseus device #%d", i);
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices PerseusPlugin::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,
serial_str,
i,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
qDebug("PerseusPlugin::enumSampleSources: enumerated Perseus device #%d", i);
}
0
));
qDebug("PerseusPlugin::enumSampleSources: enumerated Perseus device #%d", it->sequence);
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -32,7 +32,7 @@ class DeviceAPI;
const PluginDescriptor PlutoSDRInputPlugin::m_pluginDescriptor = {
QString("PlutoSDR Input"),
QString("4.11.3"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -58,33 +58,61 @@ void PlutoSDRInputPlugin::initPlugin(PluginAPI* pluginAPI)
DevicePlutoSDR::instance(); // create singleton
}
PluginInterface::SamplingDevices PlutoSDRInputPlugin::enumSampleSources()
void PlutoSDRInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
DevicePlutoSDR::instance().scan();
std::vector<std::string> serials;
DevicePlutoSDR::instance().getSerials(serials);
std::vector<std::string>::const_iterator it = serials.begin();
int i;
SamplingDevices result;
for (i = 0; it != serials.end(); ++it, ++i)
{
QString serial_str = QString::fromLocal8Bit(it->c_str());
QString displayedName(QString("PlutoSDR[%1] %2").arg(i).arg(serial_str));
QString displayableName(QString("PlutoSDR[%1] %2").arg(i).arg(serial_str));
result.append(SamplingDevice(displayedName,
m_hardwareID,
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
serial_str,
i, // sequence
1, // Nb Rx
1 // Nb Tx
));
qDebug("PlutoSDRInputPlugin::enumOriginDevices: enumerated PlutoSDR device #%d", i);
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices PlutoSDRInputPlugin::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,
serial_str,
i,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
qDebug("PlutoSDRInputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i);
}
0
));
qDebug("PlutoSDRInputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", it->sequence);
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor RemoteInputPlugin::m_pluginDescriptor = {
QString("Remote device input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,45 @@ void RemoteInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices RemoteInputPlugin::enumSampleSources()
void RemoteInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"RemoteInput",
m_hardwareID,
QString::null,
0,
1, // nb Rx
0 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices RemoteInputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"RemoteInput",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -14,7 +14,7 @@
const PluginDescriptor RTLSDRPlugin::m_pluginDescriptor = {
QString("RTL-SDR Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -39,33 +39,63 @@ void RTLSDRPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices RTLSDRPlugin::enumSampleSources()
void RTLSDRPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
int count = rtlsdr_get_device_count();
char vendor[256];
char product[256];
char serial[256];
for(int i = 0; i < count; i++) {
for(int i = 0; i < count; i++)
{
vendor[0] = '\0';
product[0] = '\0';
serial[0] = '\0';
if(rtlsdr_get_device_usb_strings((uint32_t)i, vendor, product, serial) != 0)
continue;
QString displayedName(QString("RTL-SDR[%1] %2").arg(i).arg(serial));
QString displayableName(QString("RTL-SDR[%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
));
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices RTLSDRPlugin::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("RTLSDRPlugin::enumSampleSources: enumerated RTL-SDR device #%d", it->sequence);
}
}
return result;
}

View File

@ -19,7 +19,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -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

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -31,7 +31,7 @@
const PluginDescriptor SoapySDRInputPlugin::m_pluginDescriptor = {
QString("SoapySDR Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -56,33 +56,66 @@ void SoapySDRInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices SoapySDRInputPlugin::enumSampleSources()
void SoapySDRInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
DeviceSoapySDR& deviceSoapySDR = DeviceSoapySDR::instance();
const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& devicesEnumeration = deviceSoapySDR.getDevicesEnumeration();
qDebug("SoapySDRInputPlugin::enumSampleSources: %lu SoapySDR devices. Enumerate these with Rx channel(s):", devicesEnumeration.size());
qDebug("SoapySDRInputPlugin::enumOriginDevices: %lu SoapySDR devices", devicesEnumeration.size());
std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>::const_iterator it = devicesEnumeration.begin();
for (int idev = 0; it != devicesEnumeration.end(); ++it, idev++)
{
unsigned int nbRxChannels = it->m_nbRx;
unsigned int nbTxChannels = it->m_nbTx;
QString displayableName(QString("SoapySDR[%1:%2] %3").arg(idev).arg("%1").arg(it->m_label));
QString serial(QString("%1-%2").arg(it->m_driverName).arg(it->m_sequence));
qDebug("SoapySDRInputPlugin::enumOriginDevices: device #%d (%s) serial %s",
idev, it->m_label.toStdString().c_str(), serial.toStdString().c_str());
for (unsigned int ichan = 0; ichan < nbRxChannels; ichan++)
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
serial,
idev, // sequence
nbRxChannels, // Nb Rx
nbTxChannels // Nb Tx
));
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices SoapySDRInputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
QString displayedName(QString("SoapySDR[%1:%2] %3").arg(idev).arg(ichan).arg(it->m_label));
QString serial(QString("%1-%2").arg(it->m_driverName).arg(it->m_sequence));
qDebug("SoapySDRInputPlugin::enumSampleSources: device #%d (%s) serial %s channel %u",
idev, it->m_label.toStdString().c_str(), serial.toStdString().c_str(), ichan);
result.append(SamplingDevice(displayedName,
m_hardwareID,
unsigned int nbRxChannels = it->nbRxStreams;
for (unsigned int ichan = 0; ichan < nbRxChannels; ichan++)
{
QString displayedName(it->displayableName.arg(ichan));
qDebug("SoapySDRInputPlugin::enumSampleSources: device #%d serial %s channel %u",
it->sequence, it->serial.toStdString().c_str(), ichan);
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
serial,
idev,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
nbRxChannels,
ichan));
ichan
));
}
}
}

View File

@ -38,7 +38,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -30,7 +30,7 @@
const PluginDescriptor TestSourcePlugin::m_pluginDescriptor = {
QString("Test Source input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -55,20 +55,45 @@ void TestSourcePlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices TestSourcePlugin::enumSampleSources()
void TestSourcePlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
originDevices.append(OriginDevice(
"TestSource",
m_hardwareID,
QString::null,
0,
1, // nb Rx
0 // nb Tx
));
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices TestSourcePlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
result.append(SamplingDevice(
"TestSource",
m_hardwareID,
m_deviceTypeID,
QString::null,
0,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0));
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
result.append(SamplingDevice(
it->displayableName,
m_hardwareID,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::BuiltInDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
1,
0
));
}
}
return result;
}

View File

@ -36,7 +36,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -36,7 +36,7 @@
const PluginDescriptor XTRXInputPlugin::m_pluginDescriptor = {
QString("XTRX Input"),
QString("4.11.6"),
QString("4.11.10"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
@ -61,29 +61,61 @@ void XTRXInputPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices XTRXInputPlugin::enumSampleSources()
void XTRXInputPlugin::enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
SamplingDevices result;
if (listedHwIds.contains(m_hardwareID)) { // check if it was done
return;
}
xtrx_device_info_t devs[32];
int res = xtrx_discovery(devs, 32);
int i;
for (i = 0; i < res; i++) {
for (i = 0; i < res; i++)
{
DeviceXTRXParams XTRXParams;
for (unsigned int j = 0; j < XTRXParams.m_nbRxChannels; j++)
QString displayableName(QString("XTRX[%1:%2] %3").arg(i).arg("%1").arg(devs[i].uniqname));
originDevices.append(OriginDevice(
displayableName,
m_hardwareID,
QString(devs[i].uniqname),
i,
XTRXParams.m_nbRxChannels,
XTRXParams.m_nbTxChannels
));
}
listedHwIds.append(m_hardwareID);
}
PluginInterface::SamplingDevices XTRXInputPlugin::enumSampleSources(const OriginDevices& originDevices)
{
SamplingDevices result;
for (OriginDevices::const_iterator it = originDevices.begin(); it != originDevices.end(); ++it)
{
if (it->hardwareId == m_hardwareID)
{
qDebug("XTRXInputPlugin::enumSampleSources: device #%d channel %u: %s", i, j, devs[i].uniqname);
QString displayedName(QString("XTRX[%1:%2] %3").arg(i).arg(j).arg(devs[i].uniqname));
result.append(SamplingDevice(displayedName,
m_hardwareID,
m_deviceTypeID,
QString(devs[i].uniqname),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
XTRXParams.m_nbRxChannels,
j));
for (unsigned int j = 0; j < it->nbRxStreams; j++)
{
qDebug("XTRXInputPlugin::enumSampleSources: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
QString displayedName(it->displayableName.arg(j));
result.append(SamplingDevice(
displayedName,
it->hardwareId,
m_deviceTypeID,
it->serial,
it->sequence,
PluginInterface::SamplingDevice::PhysicalDevice,
PluginInterface::SamplingDevice::StreamSingleRx,
it->nbRxStreams,
j
));
}
}
}
return result;
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017, 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2017, 2019 Edouard Griffiths, F4EXB //
// Copyright (C) 2017 Sergey Kostanbaev, Fairwaves Inc. //
// //
// This program is free software; you can redistribute it and/or modify //
@ -37,7 +37,8 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SamplingDevices enumSampleSources();
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices);
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices);
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,

View File

@ -41,7 +41,8 @@ void DeviceEnumerator::enumerateRxDevices(PluginManager *pluginManager)
for (int i = 0; i < rxDeviceRegistrations.count(); i++)
{
qDebug("DeviceEnumerator::enumerateRxDevices: %s", qPrintable(rxDeviceRegistrations[i].m_deviceId));
PluginInterface::SamplingDevices samplingDevices = rxDeviceRegistrations[i].m_plugin->enumSampleSources();
rxDeviceRegistrations[i].m_plugin->enumOriginDevices(m_originDevicesHwIds, m_originDevices);
PluginInterface::SamplingDevices samplingDevices = rxDeviceRegistrations[i].m_plugin->enumSampleSources(m_originDevices);
for (int j = 0; j < samplingDevices.count(); j++)
{
@ -66,7 +67,8 @@ void DeviceEnumerator::enumerateTxDevices(PluginManager *pluginManager)
for (int i = 0; i < txDeviceRegistrations.count(); i++)
{
qDebug("DeviceEnumerator::enumerateTxDevices: %s", qPrintable(txDeviceRegistrations[i].m_deviceId));
PluginInterface::SamplingDevices samplingDevices = txDeviceRegistrations[i].m_plugin->enumSampleSinks();
txDeviceRegistrations[i].m_plugin->enumOriginDevices(m_originDevicesHwIds, m_originDevices);
PluginInterface::SamplingDevices samplingDevices = txDeviceRegistrations[i].m_plugin->enumSampleSinks(m_originDevices);
for (int j = 0; j < samplingDevices.count(); j++)
{
@ -91,7 +93,8 @@ void DeviceEnumerator::enumerateMIMODevices(PluginManager *pluginManager)
for (int i = 0; i < mimoDeviceRegistrations.count(); i++)
{
qDebug("DeviceEnumerator::enumerateMIMODevices: %s", qPrintable(mimoDeviceRegistrations[i].m_deviceId));
PluginInterface::SamplingDevices samplingDevices = mimoDeviceRegistrations[i].m_plugin->enumSampleMIMO();
mimoDeviceRegistrations[i].m_plugin->enumOriginDevices(m_originDevicesHwIds, m_originDevices);
PluginInterface::SamplingDevices samplingDevices = mimoDeviceRegistrations[i].m_plugin->enumSampleMIMO(m_originDevices);
for (int j = 0; j < samplingDevices.count(); j++)
{

View File

@ -80,6 +80,8 @@ private:
DevicesEnumeration m_rxEnumeration;
DevicesEnumeration m_txEnumeration;
DevicesEnumeration m_mimoEnumeration;
PluginInterface::OriginDevices m_originDevices;
QStringList m_originDevicesHwIds;
};
#endif /* SDRBASE_DEVICE_DEVICEENUMERATOR_H_ */

View File

@ -82,6 +82,37 @@ public:
};
typedef QList<SamplingDevice> SamplingDevices;
/** This is the device from which the sampling devices are derived. For physical devices this represents
* a single physical unit (a LimeSDR, HackRF, BladeRF, RTL-SDR dongle, ...) that is enumerated once and
* reported in the system so that the "sampling devices" used in the system can be registered
*/
struct OriginDevice
{
QString displayableName; //!< A human readable name
QString hardwareId; //!< The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
QString serial; //!< The device serial number defined by the vendor or a fake one (SDRplay)
int sequence; //!< The device sequence in order of enumeration
int nbRxStreams; //!< Number of receiver streams
int nbTxStreams; //!< Number of transmitter streams
OriginDevice(
const QString& _displayableName,
const QString& _hardwareId,
const QString& _serial,
int _sequence,
int _nbRxStreams,
int _nbTxStreams
) :
displayableName(_displayableName),
hardwareId(_hardwareId),
serial(_serial),
sequence(_sequence),
nbRxStreams(_nbRxStreams),
nbTxStreams(_nbTxStreams)
{}
};
typedef QList<OriginDevice> OriginDevices;
virtual ~PluginInterface() { }
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
@ -163,9 +194,21 @@ public:
return nullptr;
}
// any device
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
{
(void) listedHwIds;
(void) originDevices;
}
// device source plugins only
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices)
{
(void) originDevices;
return SamplingDevices();
}
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
@ -191,7 +234,11 @@ public:
// device sink plugins only
virtual SamplingDevices enumSampleSinks() { return SamplingDevices(); }
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices)
{
(void) originDevices;
return SamplingDevices();
}
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
@ -218,7 +265,11 @@ public:
// device MIMO plugins only
virtual SamplingDevices enumSampleMIMO() { return SamplingDevices(); }
virtual SamplingDevices enumSampleMIMO(const OriginDevices& originDevices)
{
(void) originDevices;
return SamplingDevices();
}
virtual PluginInstanceGUI* createSampleMIMOPluginInstanceGUI(
const QString& mimoId,