1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05: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,
QString(devinfo[i].serial),
i,
PluginInterface::SamplingDevice::PhysicalDevice,
false,
0));
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,20 +27,28 @@ class PluginInterface {
public:
struct SamplingDevice
{
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
enum SamplingDeviceType
{
PhysicalDevice,
BuiltInDevice
};
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
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,
const QString& _hardwareId,
const QString& _id,
const QString& _serial,
int _sequence,
SamplingDeviceType _type,
bool _rxElseTx,
int _deviceItemIndex) :
displayedName(_displayedName),
@ -48,6 +56,7 @@ public:
id(_id),
serial(_serial),
sequence(_sequence),
type(_type),
rxElseTx(_rxElseTx),
deviceItemIndex(_deviceItemIndex),
claimed(-1)

View File

@ -32,7 +32,7 @@
#include "deviceuiset.h"
DeviceUISet::DeviceUISet(QTimer& timer)
DeviceUISet::DeviceUISet(int tabIndex, QTimer& timer)
{
m_spectrum = new GLSpectrum;
m_spectrumVis = new SpectrumVis(m_spectrum);
@ -40,11 +40,12 @@ DeviceUISet::DeviceUISet(QTimer& timer)
m_spectrumGUI = new GLSpectrumGUI;
m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow;
m_samplingDeviceControl = new SamplingDeviceControl;
m_samplingDeviceControl = new SamplingDeviceControl(tabIndex);
m_deviceSourceEngine = 0;
m_deviceSourceAPI = 0;
m_deviceSinkEngine = 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
QFont font;

View File

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

View File

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

View File

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

View File

@ -204,10 +204,10 @@ void MainWindow::addSourceDevice()
char uidCStr[16];
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;
int deviceTabIndex = m_deviceUIs.size()-1;
char tabNameCStr[16];
sprintf(tabNameCStr, "R%d", deviceTabIndex);
@ -267,11 +267,11 @@ void MainWindow::addSinkDevice()
char uidCStr[16];
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_deviceSinkEngine = dspDeviceSinkEngine;
int deviceTabIndex = m_deviceUIs.size()-1;
char tabNameCStr[16];
sprintf(tabNameCStr, "T%d", deviceTabIndex);

View File

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

View File

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

View File

@ -643,12 +643,3 @@ void PluginManager::createTxChannelInstance(int channelPluginIndex, 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 listTxChannels(QList<QString>& list);
bool isBuiltInDevice(QString& deviceTypeID);
private:
struct SamplingDeviceRegistration //!< This is the channel registration
{