1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-04 06:07:49 -04:00

Store device category (type) in the SamplingDevice structure

This commit is contained in:
f4exb 2017-11-01 20:06:33 +01:00
parent aea8de22a1
commit 9a055c643b
27 changed files with 49 additions and 38 deletions

View File

@ -67,6 +67,7 @@ PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks()
m_deviceTypeID, m_deviceTypeID,
QString(devinfo[i].serial), QString(devinfo[i].serial),
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
false, false,
0)); 0));
} }

View File

@ -64,6 +64,7 @@ PluginInterface::SamplingDevices FileSinkPlugin::enumSampleSinks()
m_deviceTypeID, m_deviceTypeID,
QString::null, QString::null,
i, i,
PluginInterface::SamplingDevice::BuiltInDevice,
false, false,
0)); 0));
} }

View File

@ -98,6 +98,7 @@ PluginInterface::SamplingDevices HackRFOutputPlugin::enumSampleSinks()
m_deviceTypeID, m_deviceTypeID,
serial_str, serial_str,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
false, false,
0)); 0));

View File

@ -96,6 +96,7 @@ PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks()
m_deviceTypeID, m_deviceTypeID,
QString(deviceList[i]), QString(deviceList[i]),
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
false, false,
j)); j));
} }

View File

@ -74,6 +74,7 @@ PluginInterface::SamplingDevices PlutoSDROutputPlugin::enumSampleSinks()
m_deviceTypeID, m_deviceTypeID,
serial_str, serial_str,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
false, false,
0)); 0));

View File

@ -65,6 +65,7 @@ PluginInterface::SamplingDevices SDRdaemonSinkPlugin::enumSampleSinks()
m_deviceTypeID, m_deviceTypeID,
QString::null, QString::null,
i, i,
PluginInterface::SamplingDevice::BuiltInDevice,
false, false,
0)); 0));
} }

View File

@ -100,6 +100,7 @@ PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
serial_str, serial_str,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));

View File

@ -68,6 +68,7 @@ PluginInterface::SamplingDevices BlderfInputPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
QString(devinfo[i].serial), QString(devinfo[i].serial),
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));
} }

View File

@ -66,6 +66,7 @@ PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources()
fcd_traits<Pro>::interfaceIID, fcd_traits<Pro>::interfaceIID,
serialNumber, serialNumber,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));

View File

@ -68,6 +68,7 @@ PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources()
fcd_traits<ProPlus>::interfaceIID, fcd_traits<ProPlus>::interfaceIID,
serialNumber, serialNumber,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));

View File

@ -64,6 +64,7 @@ PluginInterface::SamplingDevices FileSourcePlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
QString::null, QString::null,
i, i,
PluginInterface::SamplingDevice::BuiltInDevice,
true, true,
0)); 0));
} }

View File

@ -99,6 +99,7 @@ PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
serial_str, serial_str,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));

View File

@ -96,6 +96,7 @@ PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
QString(deviceList[i]), QString(deviceList[i]),
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
j)); j));
} }

View File

@ -74,6 +74,7 @@ PluginInterface::SamplingDevices PlutoSDRInputPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
serial_str, serial_str,
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));

View File

@ -58,6 +58,7 @@ PluginInterface::SamplingDevices RTLSDRPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
QString(serial), QString(serial),
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));
} }

View File

@ -65,6 +65,7 @@ PluginInterface::SamplingDevices SDRdaemonSourcePlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
QString::null, QString::null,
i, i,
PluginInterface::SamplingDevice::BuiltInDevice,
true, true,
0)); 0));
} }

View File

@ -78,6 +78,7 @@ PluginInterface::SamplingDevices SDRPlayPlugin::enumSampleSources()
m_deviceTypeID, m_deviceTypeID,
QString(serial), QString(serial),
i, i,
PluginInterface::SamplingDevice::PhysicalDevice,
true, true,
0)); 0));
} }

View File

@ -27,20 +27,28 @@ class PluginInterface {
public: public:
struct SamplingDevice struct SamplingDevice
{ {
QString displayedName; //!< The human readable name enum SamplingDeviceType
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 ...) PhysicalDevice,
QString serial; //!< The device serial number BuiltInDevice
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 QString displayedName; //!< The human readable name
int claimed; //!< This is the device set index if claimed else -1 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
SamplingDeviceType type; //!< The sampling device type for behavior information
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, SamplingDevice(const QString& _displayedName,
const QString& _hardwareId, const QString& _hardwareId,
const QString& _id, const QString& _id,
const QString& _serial, const QString& _serial,
int _sequence, int _sequence,
SamplingDeviceType _type,
bool _rxElseTx, bool _rxElseTx,
int _deviceItemIndex) : int _deviceItemIndex) :
displayedName(_displayedName), displayedName(_displayedName),
@ -48,6 +56,7 @@ public:
id(_id), id(_id),
serial(_serial), serial(_serial),
sequence(_sequence), sequence(_sequence),
type(_type),
rxElseTx(_rxElseTx), rxElseTx(_rxElseTx),
deviceItemIndex(_deviceItemIndex), deviceItemIndex(_deviceItemIndex),
claimed(-1) claimed(-1)

View File

@ -32,7 +32,7 @@
#include "deviceuiset.h" #include "deviceuiset.h"
DeviceUISet::DeviceUISet(QTimer& timer) DeviceUISet::DeviceUISet(int tabIndex, QTimer& timer)
{ {
m_spectrum = new GLSpectrum; m_spectrum = new GLSpectrum;
m_spectrumVis = new SpectrumVis(m_spectrum); m_spectrumVis = new SpectrumVis(m_spectrum);
@ -40,11 +40,12 @@ DeviceUISet::DeviceUISet(QTimer& timer)
m_spectrumGUI = new GLSpectrumGUI; m_spectrumGUI = new GLSpectrumGUI;
m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum); m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow; m_channelWindow = new ChannelWindow;
m_samplingDeviceControl = new SamplingDeviceControl; m_samplingDeviceControl = new SamplingDeviceControl(tabIndex);
m_deviceSourceEngine = 0; m_deviceSourceEngine = 0;
m_deviceSourceAPI = 0; m_deviceSourceAPI = 0;
m_deviceSinkEngine = 0; m_deviceSinkEngine = 0;
m_deviceSinkAPI = 0; m_deviceSinkAPI = 0;
m_deviceTabIndex = tabIndex;
// m_spectrum needs to have its font to be set since it cannot be inherited from the main window // m_spectrum needs to have its font to be set since it cannot be inherited from the main window
QFont font; QFont font;

View File

@ -45,7 +45,7 @@ struct DeviceUISet
DeviceSinkAPI *m_deviceSinkAPI; DeviceSinkAPI *m_deviceSinkAPI;
QByteArray m_mainWindowState; QByteArray m_mainWindowState;
DeviceUISet(QTimer& timer); DeviceUISet(int tabIndex, QTimer& timer);
~DeviceUISet(); ~DeviceUISet();
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter
@ -86,6 +86,7 @@ private:
ChannelInstanceRegistrations m_rxChannelInstanceRegistrations; ChannelInstanceRegistrations m_rxChannelInstanceRegistrations;
ChannelInstanceRegistrations m_txChannelInstanceRegistrations; ChannelInstanceRegistrations m_txChannelInstanceRegistrations;
int m_deviceTabIndex;
void renameRxChannelInstances(); void renameRxChannelInstances();
void renameTxChannelInstances(); void renameTxChannelInstances();

View File

@ -20,10 +20,11 @@
#include "ui_samplingdevicecontrol.h" #include "ui_samplingdevicecontrol.h"
SamplingDeviceControl::SamplingDeviceControl(QWidget* parent) : SamplingDeviceControl::SamplingDeviceControl(int tabIndex, QWidget* parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::SamplingDeviceControl), ui(new Ui::SamplingDeviceControl),
m_pluginManager(0) m_pluginManager(0),
m_deviceTabIndex(tabIndex)
{ {
ui->setupUi(this); ui->setupUi(this);
} }

View File

@ -37,7 +37,7 @@ class SDRANGEL_API SamplingDeviceControl : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit SamplingDeviceControl(QWidget* parent = NULL); explicit SamplingDeviceControl(int tabIndex, QWidget* parent = 0);
~SamplingDeviceControl(); ~SamplingDeviceControl();
void setPluginManager(PluginManager *pluginManager) { m_pluginManager = pluginManager; } void setPluginManager(PluginManager *pluginManager) { m_pluginManager = pluginManager; }
@ -49,6 +49,7 @@ public:
private: private:
Ui::SamplingDeviceControl* ui; Ui::SamplingDeviceControl* ui;
PluginManager *m_pluginManager; PluginManager *m_pluginManager;
int m_deviceTabIndex;
}; };

View File

@ -204,10 +204,10 @@ void MainWindow::addSourceDevice()
char uidCStr[16]; char uidCStr[16];
sprintf(uidCStr, "UID:%d", dspDeviceSourceEngineUID); sprintf(uidCStr, "UID:%d", dspDeviceSourceEngineUID);
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer)); int deviceTabIndex = m_deviceUIs.size();
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_masterTimer));
m_deviceUIs.back()->m_deviceSourceEngine = dspDeviceSourceEngine; m_deviceUIs.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
int deviceTabIndex = m_deviceUIs.size()-1;
char tabNameCStr[16]; char tabNameCStr[16];
sprintf(tabNameCStr, "R%d", deviceTabIndex); sprintf(tabNameCStr, "R%d", deviceTabIndex);
@ -267,11 +267,11 @@ void MainWindow::addSinkDevice()
char uidCStr[16]; char uidCStr[16];
sprintf(uidCStr, "UID:%d", dspDeviceSinkEngineUID); sprintf(uidCStr, "UID:%d", dspDeviceSinkEngineUID);
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer)); int deviceTabIndex = m_deviceUIs.size();
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, m_masterTimer));
m_deviceUIs.back()->m_deviceSourceEngine = 0; m_deviceUIs.back()->m_deviceSourceEngine = 0;
m_deviceUIs.back()->m_deviceSinkEngine = dspDeviceSinkEngine; m_deviceUIs.back()->m_deviceSinkEngine = dspDeviceSinkEngine;
int deviceTabIndex = m_deviceUIs.size()-1;
char tabNameCStr[16]; char tabNameCStr[16];
sprintf(tabNameCStr, "T%d", deviceTabIndex); sprintf(tabNameCStr, "T%d", deviceTabIndex);

View File

@ -31,11 +31,6 @@ PluginAPI::ChannelRegistrations *PluginAPI::getTxChannelRegistrations()
return m_pluginManager->getTxChannelRegistrations(); return m_pluginManager->getTxChannelRegistrations();
} }
bool PluginAPI::isBuiltInDevice(QString& deviceTypeID)
{
return m_pluginManager->isBuiltInDevice(deviceTypeID);
}
PluginAPI::PluginAPI(PluginManager* pluginManager) : PluginAPI::PluginAPI(PluginManager* pluginManager) :
m_pluginManager(pluginManager) m_pluginManager(pluginManager)
{ {

View File

@ -5,11 +5,11 @@
#include <QList> #include <QList>
#include "util/export.h" #include "util/export.h"
#include "plugin/plugininterface.h"
class QString; class QString;
class PluginManager; class PluginManager;
class PluginInterface;
class MessageQueue; class MessageQueue;
class PluginInstanceGUI; class PluginInstanceGUI;
@ -43,9 +43,6 @@ public:
// Sample Sink stuff // Sample Sink stuff
void registerSampleSink(const QString& sinkName, PluginInterface* plugin); void registerSampleSink(const QString& sinkName, PluginInterface* plugin);
// Categories enquiry
bool isBuiltInDevice(QString& deviceTypeID);
protected: protected:
PluginManager* m_pluginManager; PluginManager* m_pluginManager;

View File

@ -643,12 +643,3 @@ void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceUISet
pluginInterface->createTxChannel(m_txChannelRegistrations[channelPluginIndex].m_channelId, deviceUISet); pluginInterface->createTxChannel(m_txChannelRegistrations[channelPluginIndex].m_channelId, deviceUISet);
} }
} }
bool PluginManager::isBuiltInDevice(QString& deviceTypeID)
{
return ((deviceTypeID == m_fileSourceDeviceTypeID) ||
(deviceTypeID == m_fileSinkDeviceTypeID) ||
(deviceTypeID == m_sdrDaemonSourceDeviceTypeID) ||
(deviceTypeID == m_sdrDaemonSinkDeviceTypeID));
}

View File

@ -79,8 +79,6 @@ public:
void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet); void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet);
void listTxChannels(QList<QString>& list); void listTxChannels(QList<QString>& list);
bool isBuiltInDevice(QString& deviceTypeID);
private: private:
struct SamplingDeviceRegistration //!< This is the channel registration struct SamplingDeviceRegistration //!< This is the channel registration
{ {