From 66b06dcd08d174e2dcbc212783d3b60aee72c7eb Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 1 Nov 2017 10:37:00 +0100 Subject: [PATCH] Added Rx/Tx indicator, channel index and claiming device set index to the SamplingDevice struct used for device enumeration --- .../bladerfoutput/bladerfoutputplugin.cpp | 4 +++- .../samplesink/filesink/filesinkplugin.cpp | 4 +++- .../hackrfoutput/hackrfoutputplugin.cpp | 4 +++- .../limesdroutput/limesdroutputplugin.cpp | 24 +++++++++++++------ .../plutosdroutput/plutosdroutputplugin.cpp | 4 +++- .../sdrdaemonsink/sdrdaemonsinkplugin.cpp | 4 +++- plugins/samplesource/airspy/airspyplugin.cpp | 4 +++- .../bladerfinput/bladerfinputplugin.cpp | 4 +++- plugins/samplesource/fcdpro/fcdproplugin.cpp | 4 +++- .../fcdproplus/fcdproplusplugin.cpp | 4 +++- .../filesource/filesourceplugin.cpp | 4 +++- .../hackrfinput/hackrfinputplugin.cpp | 4 +++- .../limesdrinput/limesdrinputplugin.cpp | 23 ++++++++++++------ .../plutosdrinput/plutosdrinputplugin.cpp | 4 +++- plugins/samplesource/rtlsdr/rtlsdrplugin.cpp | 4 +++- .../sdrdaemonsource/sdrdaemonsourceplugin.cpp | 4 +++- .../samplesource/sdrplay/sdrplayplugin.cpp | 4 +++- sdrbase/plugin/plugininterface.h | 22 +++++++++++------ 18 files changed, 93 insertions(+), 36 deletions(-) diff --git a/plugins/samplesink/bladerfoutput/bladerfoutputplugin.cpp b/plugins/samplesink/bladerfoutput/bladerfoutputplugin.cpp index dddeac766..5c8faf1eb 100644 --- a/plugins/samplesink/bladerfoutput/bladerfoutputplugin.cpp +++ b/plugins/samplesink/bladerfoutput/bladerfoutputplugin.cpp @@ -66,7 +66,9 @@ PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks() m_hardwareID, m_deviceTypeID, QString(devinfo[i].serial), - i)); + i, + false, + 0)); } if (devinfo) diff --git a/plugins/samplesink/filesink/filesinkplugin.cpp b/plugins/samplesink/filesink/filesinkplugin.cpp index afa70a6cd..f7d7eeb7d 100644 --- a/plugins/samplesink/filesink/filesinkplugin.cpp +++ b/plugins/samplesink/filesink/filesinkplugin.cpp @@ -63,7 +63,9 @@ PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks() m_hardwareID, m_deviceTypeID, QString::null, - i)); + i, + false, + 0)); } return result; diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputplugin.cpp b/plugins/samplesink/hackrfoutput/hackrfoutputplugin.cpp index b2325ab69..2e5a789cb 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputplugin.cpp +++ b/plugins/samplesink/hackrfoutput/hackrfoutputplugin.cpp @@ -97,7 +97,9 @@ PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks() m_hardwareID, m_deviceTypeID, serial_str, - i)); + i, + false, + 0)); qDebug("HackRFOutputPlugin::enumSampleSinks: enumerated HackRF device #%d", i); diff --git a/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp b/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp index e06f0f032..19365da88 100644 --- a/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp +++ b/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp @@ -24,6 +24,7 @@ #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "device/devicesinkapi.h" +#include "limesdr/devicelimesdrparam.h" #include "limesdroutputgui.h" #include "limesdroutputplugin.h" @@ -82,13 +83,22 @@ PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks() std::string serial("N/D"); findSerial((const char *) deviceList[i], serial); - qDebug("LimeSDROutputPlugin::enumSampleSources: device #%d: %s", i, (char *) deviceList[i]); - QString displayedName(QString("LimeSDR[%1] %2").arg(i).arg(serial.c_str())); - result.append(SamplingDevice(displayedName, - m_hardwareID, - m_deviceTypeID, - QString(deviceList[i]), - i)); + DeviceLimeSDRParams limeSDRParams; + 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, + false, + j)); + } } } diff --git a/plugins/samplesink/plutosdroutput/plutosdroutputplugin.cpp b/plugins/samplesink/plutosdroutput/plutosdroutputplugin.cpp index d360745f7..38ed57e88 100644 --- a/plugins/samplesink/plutosdroutput/plutosdroutputplugin.cpp +++ b/plugins/samplesink/plutosdroutput/plutosdroutputplugin.cpp @@ -73,7 +73,9 @@ PluginInterface::SamplingDevices PlutoSDROutputPlugin::enumSampleSinks() m_hardwareID, m_deviceTypeID, serial_str, - i)); + i, + false, + 0)); qDebug("PlutoSDROutputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i); } diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkplugin.cpp b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkplugin.cpp index bd206e01f..1727ab44e 100644 --- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkplugin.cpp +++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkplugin.cpp @@ -64,7 +64,9 @@ PluginInterface::SamplingDevices SDRdaemonSinkPlugin::enumSampleSinks() m_hardwareID, m_deviceTypeID, QString::null, - i)); + i, + false, + 0)); } return result; diff --git a/plugins/samplesource/airspy/airspyplugin.cpp b/plugins/samplesource/airspy/airspyplugin.cpp index 50ab53496..563159d03 100644 --- a/plugins/samplesource/airspy/airspyplugin.cpp +++ b/plugins/samplesource/airspy/airspyplugin.cpp @@ -99,7 +99,9 @@ PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, serial_str, - i)); + i, + true, + 0)); qDebug("AirspyPlugin::enumSampleSources: enumerated Airspy device #%d", i); } diff --git a/plugins/samplesource/bladerfinput/bladerfinputplugin.cpp b/plugins/samplesource/bladerfinput/bladerfinputplugin.cpp index a39bbe668..609939f78 100644 --- a/plugins/samplesource/bladerfinput/bladerfinputplugin.cpp +++ b/plugins/samplesource/bladerfinput/bladerfinputplugin.cpp @@ -67,7 +67,9 @@ PluginInterface::SamplingDevices BlderfInputPlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, QString(devinfo[i].serial), - i)); + i, + true, + 0)); } if (devinfo) diff --git a/plugins/samplesource/fcdpro/fcdproplugin.cpp b/plugins/samplesource/fcdpro/fcdproplugin.cpp index f2a52049b..8b4437d2a 100644 --- a/plugins/samplesource/fcdpro/fcdproplugin.cpp +++ b/plugins/samplesource/fcdpro/fcdproplugin.cpp @@ -65,7 +65,9 @@ PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources() fcd_traits::hardwareID, fcd_traits::interfaceIID, serialNumber, - i)); + i, + true, + 0)); device_info = device_info->next; i++; diff --git a/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp b/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp index 4f3a075ef..d37a0c4ae 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusplugin.cpp @@ -67,7 +67,9 @@ PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources() fcd_traits::hardwareID, fcd_traits::interfaceIID, serialNumber, - i)); + i, + true, + 0)); device_info = device_info->next; i++; diff --git a/plugins/samplesource/filesource/filesourceplugin.cpp b/plugins/samplesource/filesource/filesourceplugin.cpp index 21c871f66..ea5a4d4bd 100644 --- a/plugins/samplesource/filesource/filesourceplugin.cpp +++ b/plugins/samplesource/filesource/filesourceplugin.cpp @@ -63,7 +63,9 @@ PluginInterface::SamplingDevices FileSourcePlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, QString::null, - i)); + i, + true, + 0)); } return result; diff --git a/plugins/samplesource/hackrfinput/hackrfinputplugin.cpp b/plugins/samplesource/hackrfinput/hackrfinputplugin.cpp index 1a8cca807..84f497484 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputplugin.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinputplugin.cpp @@ -98,7 +98,9 @@ PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, serial_str, - i)); + i, + true, + 0)); qDebug("HackRFPlugin::enumSampleSources: enumerated HackRF device #%d", i); diff --git a/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp b/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp index 130a6cb88..5d6299a92 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp @@ -83,13 +83,22 @@ PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources() std::string serial("N/D"); findSerial((const char *) deviceList[i], serial); - qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d: %s", i, (char *) deviceList[i]); - QString displayedName(QString("LimeSDR[%1] %2").arg(i).arg(serial.c_str())); - result.append(SamplingDevice(displayedName, - m_hardwareID, - m_deviceTypeID, - QString(deviceList[i]), - i)); + DeviceLimeSDRParams limeSDRParams; + 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, + true, + j)); + } } } diff --git a/plugins/samplesource/plutosdrinput/plutosdrinputplugin.cpp b/plugins/samplesource/plutosdrinput/plutosdrinputplugin.cpp index 5441fdc2f..8533dab38 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinputplugin.cpp +++ b/plugins/samplesource/plutosdrinput/plutosdrinputplugin.cpp @@ -73,7 +73,9 @@ PluginInterface::SamplingDevices PlutoSDRInputPlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, serial_str, - i)); + i, + true, + 0)); qDebug("PlutoSDRInputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i); } diff --git a/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp b/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp index aefe207f9..a1b125f9e 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrplugin.cpp @@ -57,7 +57,9 @@ PluginInterface::SamplingDevices RTLSDRPlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, QString(serial), - i)); + i, + true, + 0)); } return result; } diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceplugin.cpp b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceplugin.cpp index abecda134..e579bb852 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceplugin.cpp +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceplugin.cpp @@ -64,7 +64,9 @@ PluginInterface::SamplingDevices SDRdaemonSourcePlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, QString::null, - i)); + i, + true, + 0)); } return result; diff --git a/plugins/samplesource/sdrplay/sdrplayplugin.cpp b/plugins/samplesource/sdrplay/sdrplayplugin.cpp index cda7c23d1..49b59f36b 100644 --- a/plugins/samplesource/sdrplay/sdrplayplugin.cpp +++ b/plugins/samplesource/sdrplay/sdrplayplugin.cpp @@ -77,7 +77,9 @@ PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources() m_hardwareID, m_deviceTypeID, QString(serial), - i)); + i, + true, + 0)); } return result; diff --git a/sdrbase/plugin/plugininterface.h b/sdrbase/plugin/plugininterface.h index 666f2e2df..fecb4aacd 100644 --- a/sdrbase/plugin/plugininterface.h +++ b/sdrbase/plugin/plugininterface.h @@ -27,22 +27,30 @@ class PluginInterface { public: struct SamplingDevice { - QString displayedName; - QString hardwareId; - QString id; - QString serial; - int sequence; + QString displayedName; //!< The human readable name + QString hardwareId; //!< The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...) + QString id; //!< The internal plugin ID corresponding to the device (i.e. for HackRF input, for HackRF output ...) + QString serial; //!< The device serial number + int sequence; //!< The device sequence. >0 when more than one device of the same type is connected + bool rxElseTx; //!< This is the Rx part else the Tx part of the device + int deviceItemIndex; //!< For composite devices this is the Rx or Tx stream index. -1 if not initialized + int claimed; //!< This is the device set index if claimed else -1 SamplingDevice(const QString& _displayedName, const QString& _hardwareId, const QString& _id, const QString& _serial, - int _sequence) : + int _sequence, + bool _rxElseTx, + int _deviceItemIndex) : displayedName(_displayedName), hardwareId(_hardwareId), id(_id), serial(_serial), - sequence(_sequence) + sequence(_sequence), + rxElseTx(_rxElseTx), + deviceItemIndex(_deviceItemIndex), + claimed(-1) { } }; typedef QList SamplingDevices;