mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-07 11:25:22 -04:00
Methods to determine if a device is buit in or physical
This commit is contained in:
parent
66b06dcd08
commit
462eb90f66
@ -45,6 +45,7 @@ set(sdrbase_SOURCES
|
|||||||
|
|
||||||
device/devicesourceapi.cpp
|
device/devicesourceapi.cpp
|
||||||
device/devicesinkapi.cpp
|
device/devicesinkapi.cpp
|
||||||
|
# device/deviceenumerator.cpp
|
||||||
|
|
||||||
settings/preferences.cpp
|
settings/preferences.cpp
|
||||||
settings/preset.cpp
|
settings/preset.cpp
|
||||||
@ -124,6 +125,7 @@ set(sdrbase_HEADERS
|
|||||||
|
|
||||||
device/devicesourceapi.h
|
device/devicesourceapi.h
|
||||||
device/devicesinkapi.h
|
device/devicesinkapi.h
|
||||||
|
# device/deviceenumerator.h
|
||||||
|
|
||||||
plugin/plugininstancegui.h
|
plugin/plugininstancegui.h
|
||||||
plugin/plugininterface.h
|
plugin/plugininterface.h
|
||||||
|
@ -51,6 +51,7 @@ SOURCES += audio/audiodeviceinfo.cpp\
|
|||||||
audio/audioinput.cpp\
|
audio/audioinput.cpp\
|
||||||
device/devicesourceapi.cpp\
|
device/devicesourceapi.cpp\
|
||||||
device/devicesinkapi.cpp\
|
device/devicesinkapi.cpp\
|
||||||
|
device/deviceenumerator.cpp\
|
||||||
dsp/afsquelch.cpp\
|
dsp/afsquelch.cpp\
|
||||||
dsp/agc.cpp\
|
dsp/agc.cpp\
|
||||||
dsp/downchannelizer.cpp\
|
dsp/downchannelizer.cpp\
|
||||||
@ -107,6 +108,7 @@ HEADERS += audio/audiodeviceinfo.h\
|
|||||||
audio/audioinput.h\
|
audio/audioinput.h\
|
||||||
device/devicesourceapi.h\
|
device/devicesourceapi.h\
|
||||||
device/devicesinkapi.h\
|
device/devicesinkapi.h\
|
||||||
|
device/deviceenumerator.h\
|
||||||
dsp/afsquelch.h\
|
dsp/afsquelch.h\
|
||||||
dsp/downchannelizer.h\
|
dsp/downchannelizer.h\
|
||||||
dsp/upchannelizer.h\
|
dsp/upchannelizer.h\
|
||||||
|
@ -172,7 +172,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < channelRegistrations->count(); i++)
|
for(int i = 0; i < channelRegistrations->count(); i++)
|
||||||
{
|
{
|
||||||
if((*channelRegistrations)[i].m_channelName == channelConfig.m_channel)
|
if((*channelRegistrations)[i].m_channelId == channelConfig.m_channel)
|
||||||
{
|
{
|
||||||
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
||||||
reg = ChannelInstanceRegistration(
|
reg = ChannelInstanceRegistration(
|
||||||
@ -270,7 +270,7 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < channelRegistrations->count(); i++)
|
for(int i = 0; i < channelRegistrations->count(); i++)
|
||||||
{
|
{
|
||||||
if((*channelRegistrations)[i].m_channelName == channelConfig.m_channel)
|
if((*channelRegistrations)[i].m_channelId == channelConfig.m_channel)
|
||||||
{
|
{
|
||||||
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
||||||
reg = ChannelInstanceRegistration(channelConfig.m_channel, (*channelRegistrations)[i].m_plugin->createTxChannel(channelConfig.m_channel, this));
|
reg = ChannelInstanceRegistration(channelConfig.m_channel, (*channelRegistrations)[i].m_plugin->createTxChannel(channelConfig.m_channel, this));
|
||||||
|
@ -31,6 +31,10 @@ 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)
|
||||||
|
@ -19,10 +19,10 @@ class SDRANGEL_API PluginAPI : public QObject {
|
|||||||
public:
|
public:
|
||||||
struct ChannelRegistration
|
struct ChannelRegistration
|
||||||
{
|
{
|
||||||
QString m_channelName;
|
QString m_channelId; //!< Channel or device type ID
|
||||||
PluginInterface* m_plugin;
|
PluginInterface* m_plugin;
|
||||||
ChannelRegistration(const QString& channelName, PluginInterface* plugin) :
|
ChannelRegistration(const QString& channelId, PluginInterface* plugin) :
|
||||||
m_channelName(channelName),
|
m_channelId(channelId),
|
||||||
m_plugin(plugin)
|
m_plugin(plugin)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -43,6 +43,9 @@ 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;
|
||||||
|
|
||||||
|
@ -31,10 +31,14 @@
|
|||||||
|
|
||||||
#include "plugin/pluginmanager.h"
|
#include "plugin/pluginmanager.h"
|
||||||
|
|
||||||
const QString PluginManager::m_sdrDaemonHardwareID = "SDRdaemonSource";
|
const QString PluginManager::m_sdrDaemonSourceHardwareID = "SDRdaemonSource";
|
||||||
const QString PluginManager::m_sdrDaemonDeviceTypeID = "sdrangel.samplesource.sdrdaemonsource";
|
const QString PluginManager::m_sdrDaemonSourceDeviceTypeID = "sdrangel.samplesource.sdrdaemonsource";
|
||||||
const QString PluginManager::m_fileSourceHardwareID = "FileSource";
|
const QString PluginManager::m_fileSourceHardwareID = "FileSource";
|
||||||
const QString PluginManager::m_fileSourceDeviceTypeID = "sdrangel.samplesource.filesource";
|
const QString PluginManager::m_fileSourceDeviceTypeID = "sdrangel.samplesource.filesource";
|
||||||
|
|
||||||
|
const QString PluginManager::m_sdrDaemonSinkHardwareID = "SDRdaemonSink";
|
||||||
|
const QString PluginManager::m_sdrDaemonSinkDeviceTypeID = "sdrangel.samplesink.sdrdaemonsink";
|
||||||
|
const QString PluginManager::m_fileSinkHardwareID = "FileSink";
|
||||||
const QString PluginManager::m_fileSinkDeviceTypeID = "sdrangel.samplesink.filesink";
|
const QString PluginManager::m_fileSinkDeviceTypeID = "sdrangel.samplesink.filesink";
|
||||||
|
|
||||||
PluginManager::PluginManager(QObject* parent) :
|
PluginManager::PluginManager(QObject* parent) :
|
||||||
@ -172,7 +176,7 @@ void PluginManager::duplicateLocalSampleSourceDevices(uint deviceUID)
|
|||||||
|
|
||||||
for(int i = 0; i < m_sampleSourceDevices.count(); ++i)
|
for(int i = 0; i < m_sampleSourceDevices.count(); ++i)
|
||||||
{
|
{
|
||||||
if (m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonDeviceTypeID) // SDRdaemon
|
if (m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonSourceDeviceTypeID) // SDRdaemon
|
||||||
{
|
{
|
||||||
if (m_sampleSourceDevices[i].m_deviceSequence == 0) { // reference to device 0
|
if (m_sampleSourceDevices[i].m_deviceSequence == 0) { // reference to device 0
|
||||||
sdrDaemonSSD0 = &m_sampleSourceDevices[i];
|
sdrDaemonSSD0 = &m_sampleSourceDevices[i];
|
||||||
@ -265,7 +269,7 @@ void PluginManager::fillSampleSourceSelector(QComboBox* comboBox, uint deviceUID
|
|||||||
for(int i = 0; i < m_sampleSourceDevices.count(); i++)
|
for(int i = 0; i < m_sampleSourceDevices.count(); i++)
|
||||||
{
|
{
|
||||||
// For "local" devices show only ones that concern this device set
|
// For "local" devices show only ones that concern this device set
|
||||||
if ((m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonDeviceTypeID)
|
if ((m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonSourceDeviceTypeID)
|
||||||
|| (m_sampleSourceDevices[i].m_deviceId == m_fileSourceDeviceTypeID))
|
|| (m_sampleSourceDevices[i].m_deviceId == m_fileSourceDeviceTypeID))
|
||||||
{
|
{
|
||||||
if (deviceUID != m_sampleSourceDevices[i].m_deviceSequence) {
|
if (deviceUID != m_sampleSourceDevices[i].m_deviceSequence) {
|
||||||
@ -627,7 +631,7 @@ void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet
|
|||||||
if (channelPluginIndex < m_rxChannelRegistrations.size())
|
if (channelPluginIndex < m_rxChannelRegistrations.size())
|
||||||
{
|
{
|
||||||
PluginInterface *pluginInterface = m_rxChannelRegistrations[channelPluginIndex].m_plugin;
|
PluginInterface *pluginInterface = m_rxChannelRegistrations[channelPluginIndex].m_plugin;
|
||||||
pluginInterface->createRxChannel(m_rxChannelRegistrations[channelPluginIndex].m_channelName, deviceUISet);
|
pluginInterface->createRxChannel(m_rxChannelRegistrations[channelPluginIndex].m_channelId, deviceUISet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,6 +640,15 @@ void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceUISet
|
|||||||
if (channelPluginIndex < m_txChannelRegistrations.size())
|
if (channelPluginIndex < m_txChannelRegistrations.size())
|
||||||
{
|
{
|
||||||
PluginInterface *pluginInterface = m_txChannelRegistrations[channelPluginIndex].m_plugin;
|
PluginInterface *pluginInterface = m_txChannelRegistrations[channelPluginIndex].m_plugin;
|
||||||
pluginInterface->createTxChannel(m_txChannelRegistrations[channelPluginIndex].m_channelName, 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -79,8 +79,11 @@ 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 {
|
struct SamplingDeviceRegistration //!< This is the channel registration
|
||||||
|
{
|
||||||
QString m_deviceId;
|
QString m_deviceId;
|
||||||
PluginInterface* m_plugin;
|
PluginInterface* m_plugin;
|
||||||
SamplingDeviceRegistration(const QString& deviceId, PluginInterface* plugin) :
|
SamplingDeviceRegistration(const QString& deviceId, PluginInterface* plugin) :
|
||||||
@ -91,7 +94,7 @@ private:
|
|||||||
|
|
||||||
typedef QList<SamplingDeviceRegistration> SamplingDeviceRegistrations;
|
typedef QList<SamplingDeviceRegistration> SamplingDeviceRegistrations;
|
||||||
|
|
||||||
struct SamplingDevice {
|
struct SamplingDevice { //!< This is the device registration
|
||||||
PluginInterface* m_plugin;
|
PluginInterface* m_plugin;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
QString m_hadrwareId;
|
QString m_hadrwareId;
|
||||||
@ -128,12 +131,15 @@ private:
|
|||||||
SamplingDevices m_sampleSinkDevices; //!< Instances of output sinks present in the system
|
SamplingDevices m_sampleSinkDevices; //!< Instances of output sinks present in the system
|
||||||
|
|
||||||
// "Local" sample source device IDs
|
// "Local" sample source device IDs
|
||||||
static const QString m_sdrDaemonHardwareID; //!< SDRdaemon hardware ID
|
static const QString m_sdrDaemonSourceHardwareID; //!< SDRdaemon source hardware ID
|
||||||
static const QString m_sdrDaemonDeviceTypeID; //!< SDRdaemon source plugin ID
|
static const QString m_sdrDaemonSourceDeviceTypeID; //!< SDRdaemon source plugin ID
|
||||||
static const QString m_fileSourceHardwareID; //!< FileSource source hardware ID
|
static const QString m_fileSourceHardwareID; //!< FileSource source hardware ID
|
||||||
static const QString m_fileSourceDeviceTypeID; //!< FileSource source plugin ID
|
static const QString m_fileSourceDeviceTypeID; //!< FileSource source plugin ID
|
||||||
|
|
||||||
// "Local" sample sink device IDs
|
// "Local" sample sink device IDs
|
||||||
|
static const QString m_sdrDaemonSinkHardwareID; //!< SDRdaemon source hardware ID
|
||||||
|
static const QString m_sdrDaemonSinkDeviceTypeID; //!< SDRdaemon source plugin ID
|
||||||
|
static const QString m_fileSinkHardwareID; //!< FileSource source hardware ID
|
||||||
static const QString m_fileSinkDeviceTypeID; //!< FileSink sink plugin ID
|
static const QString m_fileSinkDeviceTypeID; //!< FileSink sink plugin ID
|
||||||
|
|
||||||
void loadPlugins(const QDir& dir);
|
void loadPlugins(const QDir& dir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user