Store device category (type) in the SamplingDevice structure

pull/127/head
f4exb 2017-11-01 20:06:33 +01:00
rodzic aea8de22a1
commit 9a055c643b
27 zmienionych plików z 49 dodań i 38 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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();

Wyświetl plik

@ -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);
}

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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));
}

Wyświetl plik

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