1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Tx ph.1: plugins (1)

This commit is contained in:
f4exb 2016-10-13 22:23:43 +02:00
parent 9303a63931
commit 94e479bb75
34 changed files with 154 additions and 157 deletions

View File

@ -29,7 +29,7 @@ void ChannelAnalyzerPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register demodulator
m_pluginAPI->registerChannel(ChannelAnalyzerGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(ChannelAnalyzerGUI::m_channelID, this);
}
PluginGUI* ChannelAnalyzerPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -30,7 +30,7 @@ void AMPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register AM demodulator
m_pluginAPI->registerChannel(AMDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(AMDemodGUI::m_channelID, this);
}
PluginGUI* AMPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -46,7 +46,7 @@ void BFMPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register BFM demodulator
m_pluginAPI->registerChannel(BFMDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(BFMDemodGUI::m_channelID, this);
}
PluginGUI* BFMPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -46,7 +46,7 @@ void DSDDemodPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register DSD demodulator
m_pluginAPI->registerChannel(DSDDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(DSDDemodGUI::m_channelID, this);
}
PluginGUI* DSDDemodPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -29,7 +29,7 @@ void LoRaPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register demodulator
m_pluginAPI->registerChannel(LoRaDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(LoRaDemodGUI::m_channelID, this);
}
PluginGUI* LoRaPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -29,7 +29,7 @@ void NFMPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register NFM demodulator
m_pluginAPI->registerChannel(NFMDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(NFMDemodGUI::m_channelID, this);
}
PluginGUI* NFMPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -29,7 +29,7 @@ void SSBPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register demodulator
m_pluginAPI->registerChannel(SSBDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(SSBDemodGUI::m_channelID, this);
}
PluginGUI* SSBPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -29,7 +29,7 @@ void WFMPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register WFM demodulator
m_pluginAPI->registerChannel(WFMDemodGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(WFMDemodGUI::m_channelID, this);
}
PluginGUI* WFMPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -29,7 +29,7 @@ void TCPSrcPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register TCP Channel Source
m_pluginAPI->registerChannel(TCPSrcGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(TCPSrcGUI::m_channelID, this);
}
PluginGUI* TCPSrcPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -46,7 +46,7 @@ void UDPSrcPlugin::initPlugin(PluginAPI* pluginAPI)
m_pluginAPI = pluginAPI;
// register TCP Channel Source
m_pluginAPI->registerChannel(UDPSrcGUI::m_channelID, this);
m_pluginAPI->registerRxChannel(UDPSrcGUI::m_channelID, this);
}
PluginGUI* UDPSrcPlugin::createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)

View File

@ -51,9 +51,9 @@ void AirspyPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices AirspyPlugin::enumSampleSources()
PluginInterface::SamplingDevices AirspyPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
airspy_read_partid_serialno_t read_partid_serialno;
struct airspy_device *devinfo;
uint32_t serial_msb = 0;
@ -94,7 +94,7 @@ PluginInterface::SampleSourceDevices AirspyPlugin::enumSampleSources()
uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
QString displayedName(QString("Airspy[%1] %2").arg(i).arg(serial_str));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
m_deviceTypeID,
serial_str,
i));

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -49,9 +49,9 @@ void BlderfPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices BlderfPlugin::enumSampleSources()
PluginInterface::SamplingDevices BlderfPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
struct bladerf_devinfo *devinfo = 0;
int count = bladerf_get_device_list(&devinfo);
@ -60,7 +60,7 @@ PluginInterface::SampleSourceDevices BlderfPlugin::enumSampleSources()
{
QString displayedName(QString("BladeRF[%1] %2").arg(devinfo[i].instance).arg(devinfo[i].serial));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
m_deviceTypeID,
QString(devinfo[i].serial),
i));

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -51,9 +51,9 @@ void FCDProPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(fcd_traits<Pro>::interfaceIID, this);
}
PluginInterface::SampleSourceDevices FCDProPlugin::enumSampleSources()
PluginInterface::SamplingDevices FCDProPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
int i = 0;
struct hid_device_info *device_info = hid_enumerate(fcd_traits<Pro>::vendorId, fcd_traits<Pro>::productId);
@ -63,7 +63,7 @@ PluginInterface::SampleSourceDevices FCDProPlugin::enumSampleSources()
QString serialNumber = QString::fromWCharArray(device_info->serial_number);
QString displayedName(QString("%1[%2] %3").arg(fcd_traits<Pro>::displayedName).arg(i).arg(serialNumber));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
fcd_traits<Pro>::interfaceIID,
serialNumber,
i));

View File

@ -19,7 +19,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -51,9 +51,9 @@ void FCDProPlusPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(fcd_traits<ProPlus>::interfaceIID, this);
}
PluginInterface::SampleSourceDevices FCDProPlusPlugin::enumSampleSources()
PluginInterface::SamplingDevices FCDProPlusPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
int i = 0;
struct hid_device_info *device_info = hid_enumerate(fcd_traits<ProPlus>::vendorId, fcd_traits<ProPlus>::productId);
@ -63,7 +63,7 @@ PluginInterface::SampleSourceDevices FCDProPlusPlugin::enumSampleSources()
QString serialNumber = QString::fromWCharArray(device_info->serial_number);
QString displayedName(QString("%1[%2] %3").arg(fcd_traits<ProPlus>::displayedName).arg(i).arg(serialNumber));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
fcd_traits<ProPlus>::interfaceIID,
serialNumber,
i));

View File

@ -19,7 +19,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -49,16 +49,16 @@ void FileSourcePlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources()
PluginInterface::SamplingDevices FileSourcePlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
int count = 1;
for(int i = 0; i < count; i++)
{
QString displayedName(QString("FileSource[%1]").arg(i));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
m_deviceTypeID,
QString::null,
i));

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -52,7 +52,7 @@ void HackRFPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources()
PluginInterface::SamplingDevices HackRFPlugin::enumSampleSources()
{
hackrf_error rc = (hackrf_error) hackrf_init();
@ -61,7 +61,7 @@ PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources()
qCritical("HackRFPlugin::SampleSourceDevices: failed to initiate HackRF library: %s", hackrf_error_name(rc));
}
SampleSourceDevices result;
SamplingDevices result;
hackrf_device_list_t *hackrf_devices = hackrf_device_list();
hackrf_device *hackrf_ptr;
read_partid_serialno_t read_partid_serialno;
@ -91,7 +91,7 @@ PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources()
uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
QString displayedName(QString("HackRF[%1] %2").arg(i).arg(serial_str));
result.append(SampleSourceDevice(displayedName, m_deviceTypeID,
result.append(SamplingDevice(displayedName, m_deviceTypeID,
serial_str,
i));

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -35,9 +35,9 @@ void RTLSDRPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices RTLSDRPlugin::enumSampleSources()
PluginInterface::SamplingDevices RTLSDRPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
int count = rtlsdr_get_device_count();
char vendor[256];
char product[256];
@ -52,7 +52,7 @@ PluginInterface::SampleSourceDevices RTLSDRPlugin::enumSampleSources()
continue;
QString displayedName(QString("RTL-SDR[%1] %2").arg(i).arg(serial));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
m_deviceTypeID,
QString(serial),
i));

View File

@ -19,7 +19,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -49,16 +49,16 @@ void SDRdaemonPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices SDRdaemonPlugin::enumSampleSources()
PluginInterface::SamplingDevices SDRdaemonPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
int count = 1;
for(int i = 0; i < count; i++)
{
QString displayedName(QString("SDRdaemon[%1]").arg(i));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
m_deviceTypeID,
QString::null,
i));

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -51,16 +51,16 @@ void SDRdaemonFECPlugin::initPlugin(PluginAPI* pluginAPI)
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SampleSourceDevices SDRdaemonFECPlugin::enumSampleSources()
PluginInterface::SamplingDevices SDRdaemonFECPlugin::enumSampleSources()
{
SampleSourceDevices result;
SamplingDevices result;
int count = 1;
for(int i = 0; i < count; i++)
{
QString displayedName(QString("SDRdaemonFEC[%1]").arg(i));
result.append(SampleSourceDevice(displayedName,
result.append(SamplingDevice(displayedName,
m_deviceTypeID,
QString::null,
i));

View File

@ -35,7 +35,7 @@ public:
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
virtual SampleSourceDevices enumSampleSources();
virtual SamplingDevices enumSampleSources();
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI);
static const QString m_deviceTypeID;

View File

@ -252,7 +252,7 @@ void DeviceSourceAPI::loadChannelSettings(const Preset *preset, PluginAPI *plugi
qDebug("DeviceAPI::loadChannelSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
// Available channel plugins
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getChannelRegistrations();
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getRxChannelRegistrations();
// copy currently open channels and clear list
ChannelInstanceRegistrations openChannels = m_channelInstanceRegistrations;
@ -267,11 +267,11 @@ void DeviceSourceAPI::loadChannelSettings(const Preset *preset, PluginAPI *plugi
for(int i = 0; i < openChannels.count(); i++)
{
qDebug("PluginManager::loadSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelName), qPrintable(channelConfig.m_channel));
qDebug("DeviceSourceAPI::loadChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelName), qPrintable(channelConfig.m_channel));
if(openChannels[i].m_channelName == channelConfig.m_channel)
{
qDebug("PluginManager::loadSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName));
qDebug("DeviceSourceAPI::loadChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName));
reg = openChannels.takeAt(i);
m_channelInstanceRegistrations.append(reg);
break;
@ -286,7 +286,7 @@ void DeviceSourceAPI::loadChannelSettings(const Preset *preset, PluginAPI *plugi
{
if((*channelRegistrations)[i].m_channelName == channelConfig.m_channel)
{
qDebug("PluginManager::loadSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
qDebug("DeviceSourceAPI::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
reg = ChannelInstanceRegistration(channelConfig.m_channel, (*channelRegistrations)[i].m_plugin->createChannel(channelConfig.m_channel, this));
break;
}
@ -295,7 +295,7 @@ void DeviceSourceAPI::loadChannelSettings(const Preset *preset, PluginAPI *plugi
if(reg.m_gui != NULL)
{
qDebug("PluginManager::loadSettings: deserializing channel [%s]", qPrintable(channelConfig.m_channel));
qDebug("DeviceSourceAPI::loadChannelSettings: deserializing channel [%s]", qPrintable(channelConfig.m_channel));
reg.m_gui->deserialize(channelConfig.m_config);
}
}
@ -303,7 +303,7 @@ void DeviceSourceAPI::loadChannelSettings(const Preset *preset, PluginAPI *plugi
// everything, that is still "available" is not needed anymore
for(int i = 0; i < openChannels.count(); i++)
{
qDebug("PluginManager::loadSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelName));
qDebug("DeviceSourceAPI::loadChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelName));
openChannels[i].m_gui->destroy();
}

View File

@ -8,9 +8,9 @@ MessageQueue* PluginAPI::getMainWindowMessageQueue()
return m_mainWindow->getInputMessageQueue();
}
void PluginAPI::registerChannel(const QString& channelName, PluginInterface* plugin)
void PluginAPI::registerRxChannel(const QString& channelName, PluginInterface* plugin)
{
m_pluginManager->registerChannel(channelName, plugin);
m_pluginManager->registerRxChannel(channelName, plugin);
}
void PluginAPI::registerSampleSource(const QString& sourceName, PluginInterface* plugin)
@ -18,9 +18,9 @@ void PluginAPI::registerSampleSource(const QString& sourceName, PluginInterface*
m_pluginManager->registerSampleSource(sourceName, plugin);
}
PluginAPI::ChannelRegistrations *PluginAPI::getChannelRegistrations()
PluginAPI::ChannelRegistrations *PluginAPI::getRxChannelRegistrations()
{
return m_pluginManager->getChannelRegistrations();
return m_pluginManager->getRxChannelRegistrations();
}

View File

@ -34,8 +34,8 @@ public:
MessageQueue* getMainWindowMessageQueue();
// Channel stuff
void registerChannel(const QString& channelName, PluginInterface* plugin);
ChannelRegistrations *getChannelRegistrations();
void registerRxChannel(const QString& channelName, PluginInterface* plugin);
ChannelRegistrations *getRxChannelRegistrations();
// Sample Source stuff
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);

View File

@ -21,14 +21,14 @@ class QWidget;
class PluginInterface {
public:
struct SampleSourceDevice
struct SamplingDevice
{
QString displayedName;
QString id;
QString serial;
int sequence;
SampleSourceDevice(const QString& _displayedName,
SamplingDevice(const QString& _displayedName,
const QString& _id,
const QString& _serial,
int _sequence) :
@ -38,16 +38,18 @@ public:
sequence(_sequence)
{ }
};
typedef QList<SampleSourceDevice> SampleSourceDevices;
typedef QList<SamplingDevice> SamplingDevices;
virtual ~PluginInterface() { };
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
// channel plugins
virtual PluginGUI* createChannel(const QString& channelName, DeviceSourceAPI *deviceAPI) { return 0; }
virtual SampleSourceDevices enumSampleSources() { return SampleSourceDevices(); }
// device plugins only
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI)
{
return 0;

View File

@ -52,9 +52,9 @@ void PluginManager::loadPlugins()
updateSampleSourceDevices();
}
void PluginManager::registerChannel(const QString& channelName, PluginInterface* plugin)
void PluginManager::registerRxChannel(const QString& channelName, PluginInterface* plugin)
{
m_channelRegistrations.append(PluginAPI::ChannelRegistration(channelName, plugin));
m_rxChannelRegistrations.append(PluginAPI::ChannelRegistration(channelName, plugin));
}
void PluginManager::registerSampleSource(const QString& sourceName, PluginInterface* plugin)
@ -63,7 +63,7 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
<< plugin->getPluginDescriptor().displayedName.toStdString().c_str()
<< " with source name " << sourceName.toStdString().c_str();
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
m_sampleSourceRegistrations.append(SamplingDeviceRegistration(sourceName, plugin));
}
void PluginManager::updateSampleSourceDevices()
@ -72,11 +72,11 @@ void PluginManager::updateSampleSourceDevices()
for(int i = 0; i < m_sampleSourceRegistrations.count(); ++i)
{
PluginInterface::SampleSourceDevices ssd = m_sampleSourceRegistrations[i].m_plugin->enumSampleSources();
PluginInterface::SamplingDevices ssd = m_sampleSourceRegistrations[i].m_plugin->enumSampleSources();
for(int j = 0; j < ssd.count(); ++j)
{
m_sampleSourceDevices.append(SampleSourceDevice(m_sampleSourceRegistrations[i].m_plugin,
m_sampleSourceDevices.append(SamplingDevice(m_sampleSourceRegistrations[i].m_plugin,
ssd[j].displayedName,
ssd[j].id,
ssd[j].serial,
@ -91,39 +91,39 @@ void PluginManager::duplicateLocalSampleSourceDevices(uint deviceUID)
return;
}
SampleSourceDevice *sdrDaemonSSD0 = 0;
SampleSourceDevice *sdrDaemonFECSSD0 = 0;
SampleSourceDevice *fileSourceSSD0 = 0;
SamplingDevice *sdrDaemonSSD0 = 0;
SamplingDevice *sdrDaemonFECSSD0 = 0;
SamplingDevice *fileSourceSSD0 = 0;
bool duplicateSDRDaemon = true;
bool duplicateSDRDaemonFEC = true;
bool duplicateFileSource = true;
for(int i = 0; i < m_sampleSourceDevices.count(); ++i)
{
if (m_sampleSourceDevices[i].m_sourceId == m_sdrDaemonDeviceTypeID) // SDRdaemon
if (m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonDeviceTypeID) // SDRdaemon
{
if (m_sampleSourceDevices[i].m_sourceSequence == 0) { // reference to device 0
if (m_sampleSourceDevices[i].m_deviceSequence == 0) { // reference to device 0
sdrDaemonSSD0 = &m_sampleSourceDevices[i];
}
else if (m_sampleSourceDevices[i].m_sourceSequence == deviceUID) { // already there
else if (m_sampleSourceDevices[i].m_deviceSequence == deviceUID) { // already there
duplicateSDRDaemon = false;
}
}
else if (m_sampleSourceDevices[i].m_sourceId == m_sdrDaemonFECDeviceTypeID) // SDRdaemon with FEC
else if (m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonFECDeviceTypeID) // SDRdaemon with FEC
{
if (m_sampleSourceDevices[i].m_sourceSequence == 0) { // reference to device 0
if (m_sampleSourceDevices[i].m_deviceSequence == 0) { // reference to device 0
sdrDaemonFECSSD0 = &m_sampleSourceDevices[i];
}
else if (m_sampleSourceDevices[i].m_sourceSequence == deviceUID) { // already there
else if (m_sampleSourceDevices[i].m_deviceSequence == deviceUID) { // already there
duplicateSDRDaemonFEC = false;
}
}
else if (m_sampleSourceDevices[i].m_sourceId == m_fileSourceDeviceTypeID) // File Source
else if (m_sampleSourceDevices[i].m_deviceId == m_fileSourceDeviceTypeID) // File Source
{
if (m_sampleSourceDevices[i].m_sourceSequence == 0) { // reference to device 0
if (m_sampleSourceDevices[i].m_deviceSequence == 0) { // reference to device 0
fileSourceSSD0 = &m_sampleSourceDevices[i];
}
else if (m_sampleSourceDevices[i].m_sourceSequence == deviceUID) { // already there
else if (m_sampleSourceDevices[i].m_deviceSequence == deviceUID) { // already there
duplicateFileSource = false;
}
}
@ -132,11 +132,11 @@ void PluginManager::duplicateLocalSampleSourceDevices(uint deviceUID)
if (sdrDaemonSSD0 && duplicateSDRDaemon) // append item for a new instance
{
m_sampleSourceDevices.append(
SampleSourceDevice(
SamplingDevice(
sdrDaemonSSD0->m_plugin,
QString("SDRdaemon[%1]").arg(deviceUID),
sdrDaemonSSD0->m_sourceId,
sdrDaemonSSD0->m_sourceSerial,
sdrDaemonSSD0->m_deviceId,
sdrDaemonSSD0->m_deviceSerial,
deviceUID
)
);
@ -145,11 +145,11 @@ void PluginManager::duplicateLocalSampleSourceDevices(uint deviceUID)
if (sdrDaemonFECSSD0 && duplicateSDRDaemonFEC) // append item for a new instance
{
m_sampleSourceDevices.append(
SampleSourceDevice(
SamplingDevice(
sdrDaemonFECSSD0->m_plugin,
QString("SDRdaemonFEC[%1]").arg(deviceUID),
sdrDaemonFECSSD0->m_sourceId,
sdrDaemonFECSSD0->m_sourceSerial,
sdrDaemonFECSSD0->m_deviceId,
sdrDaemonFECSSD0->m_deviceSerial,
deviceUID
)
);
@ -158,11 +158,11 @@ void PluginManager::duplicateLocalSampleSourceDevices(uint deviceUID)
if (fileSourceSSD0 && duplicateFileSource) // append item for a new instance
{
m_sampleSourceDevices.append(
SampleSourceDevice(
SamplingDevice(
fileSourceSSD0->m_plugin,
QString("FileSource[%1]").arg(deviceUID),
fileSourceSSD0->m_sourceId,
fileSourceSSD0->m_sourceSerial,
fileSourceSSD0->m_deviceId,
fileSourceSSD0->m_deviceSerial,
deviceUID
)
);
@ -176,11 +176,11 @@ void PluginManager::fillSampleSourceSelector(QComboBox* comboBox, uint deviceUID
for(int i = 0; i < m_sampleSourceDevices.count(); i++)
{
// For "local" devices show only ones that concern this device set
if ((m_sampleSourceDevices[i].m_sourceId == m_sdrDaemonDeviceTypeID)
|| (m_sampleSourceDevices[i].m_sourceId == m_sdrDaemonFECDeviceTypeID)
|| (m_sampleSourceDevices[i].m_sourceId == m_fileSourceDeviceTypeID))
if ((m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonDeviceTypeID)
|| (m_sampleSourceDevices[i].m_deviceId == m_sdrDaemonFECDeviceTypeID)
|| (m_sampleSourceDevices[i].m_deviceId == m_fileSourceDeviceTypeID))
{
if (deviceUID != m_sampleSourceDevices[i].m_sourceSequence) {
if (deviceUID != m_sampleSourceDevices[i].m_deviceSequence) {
continue;
}
}
@ -209,20 +209,20 @@ int PluginManager::selectSampleSourceByIndex(int index, DeviceSourceAPI *deviceA
}
qDebug() << "PluginManager::selectSampleSourceByIndex: m_sampleSource at index " << index
<< " id: " << m_sampleSourceDevices[index].m_sourceId.toStdString().c_str()
<< " ser: " << m_sampleSourceDevices[index].m_sourceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceDevices[index].m_sourceSequence;
<< " id: " << m_sampleSourceDevices[index].m_deviceId.toStdString().c_str()
<< " ser: " << m_sampleSourceDevices[index].m_deviceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceDevices[index].m_deviceSequence;
deviceAPI->stopAcquisition();
deviceAPI->setSampleSourcePluginGUI(0); // this effectively destroys the previous GUI if it exists
QWidget *gui;
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceDevices[index].m_sourceId, &gui, deviceAPI);
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceDevices[index].m_deviceId, &gui, deviceAPI);
// m_sampleSourcePluginGUI = pluginGUI;
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_sourceSequence);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_sourceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_sourceSerial);
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_deviceSequence);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_deviceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_deviceSerial);
deviceAPI->setSampleSourcePluginGUI(pluginGUI);
deviceAPI->setInputGUI(gui, m_sampleSourceDevices[index].m_displayName);
@ -237,9 +237,9 @@ int PluginManager::selectFirstSampleSource(const QString& sourceId, DeviceSource
for (int i = 0; i < m_sampleSourceDevices.count(); i++)
{
qDebug("*** %s vs %s", qPrintable(m_sampleSourceDevices[i].m_sourceId), qPrintable(sourceId));
qDebug("*** %s vs %s", qPrintable(m_sampleSourceDevices[i].m_deviceId), qPrintable(sourceId));
if(m_sampleSourceDevices[i].m_sourceId == sourceId)
if(m_sampleSourceDevices[i].m_deviceId == sourceId)
{
index = i;
break;
@ -259,20 +259,20 @@ int PluginManager::selectFirstSampleSource(const QString& sourceId, DeviceSource
}
qDebug() << "PluginManager::selectFirstSampleSource: m_sampleSource at index " << index
<< " id: " << m_sampleSourceDevices[index].m_sourceId.toStdString().c_str()
<< " ser: " << m_sampleSourceDevices[index].m_sourceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceDevices[index].m_sourceSequence;
<< " id: " << m_sampleSourceDevices[index].m_deviceId.toStdString().c_str()
<< " ser: " << m_sampleSourceDevices[index].m_deviceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceDevices[index].m_deviceSequence;
deviceAPI->stopAcquisition();
deviceAPI->setSampleSourcePluginGUI(0); // this effectively destroys the previous GUI if it exists
QWidget *gui;
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceDevices[index].m_sourceId, &gui, deviceAPI);
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceDevices[index].m_deviceId, &gui, deviceAPI);
// m_sampleSourcePluginGUI = pluginGUI;
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_sourceSequence);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_sourceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_sourceSerial);
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_deviceSequence);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_deviceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_deviceSerial);
deviceAPI->setSampleSourcePluginGUI(pluginGUI);
deviceAPI->setInputGUI(gui, m_sampleSourceDevices[index].m_displayName);
@ -289,17 +289,17 @@ int PluginManager::selectSampleSourceBySerialOrSequence(const QString& sourceId,
for (int i = 0; i < m_sampleSourceDevices.count(); i++)
{
if (m_sampleSourceDevices[i].m_sourceId == sourceId)
if (m_sampleSourceDevices[i].m_deviceId == sourceId)
{
index_firstOfKind = i;
if (m_sampleSourceDevices[i].m_sourceSerial == sourceSerial)
if (m_sampleSourceDevices[i].m_deviceSerial == sourceSerial)
{
index = i; // exact match
break;
}
if (m_sampleSourceDevices[i].m_sourceSequence == sourceSequence)
if (m_sampleSourceDevices[i].m_deviceSequence == sourceSequence)
{
index_matchingSequence = i;
}
@ -333,20 +333,20 @@ int PluginManager::selectSampleSourceBySerialOrSequence(const QString& sourceId,
}
qDebug() << "PluginManager::selectSampleSourceBySequence: m_sampleSource at index " << index
<< " id: " << m_sampleSourceDevices[index].m_sourceId.toStdString().c_str()
<< " ser: " << m_sampleSourceDevices[index].m_sourceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceDevices[index].m_sourceSequence;
<< " id: " << m_sampleSourceDevices[index].m_deviceId.toStdString().c_str()
<< " ser: " << m_sampleSourceDevices[index].m_deviceSerial.toStdString().c_str()
<< " seq: " << m_sampleSourceDevices[index].m_deviceSequence;
deviceAPI->stopAcquisition();
deviceAPI->setSampleSourcePluginGUI(0); // this effectively destroys the previous GUI if it exists
QWidget *gui;
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceDevices[index].m_sourceId, &gui, deviceAPI);
PluginGUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginGUI(m_sampleSourceDevices[index].m_deviceId, &gui, deviceAPI);
// m_sampleSourcePluginGUI = pluginGUI;
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_sourceSequence);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_sourceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_sourceSerial);
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_deviceSequence);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_deviceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_deviceSerial);
deviceAPI->setSampleSourcePluginGUI(pluginGUI);
deviceAPI->setInputGUI(gui, m_sampleSourceDevices[index].m_displayName);
@ -355,23 +355,23 @@ int PluginManager::selectSampleSourceBySerialOrSequence(const QString& sourceId,
void PluginManager::selectSampleSourceByDevice(void *devicePtr, DeviceSourceAPI *deviceAPI)
{
SampleSourceDevice *sampleSourceDevice = (SampleSourceDevice *) devicePtr;
SamplingDevice *sampleSourceDevice = (SamplingDevice *) devicePtr;
qDebug() << "PluginManager::selectSampleSourceByDevice: "
<< " id: " << sampleSourceDevice->m_sourceId.toStdString().c_str()
<< " ser: " << sampleSourceDevice->m_sourceSerial.toStdString().c_str()
<< " seq: " << sampleSourceDevice->m_sourceSequence;
<< " id: " << sampleSourceDevice->m_deviceId.toStdString().c_str()
<< " ser: " << sampleSourceDevice->m_deviceSerial.toStdString().c_str()
<< " seq: " << sampleSourceDevice->m_deviceSequence;
deviceAPI->stopAcquisition();
deviceAPI->setSampleSourcePluginGUI(0); // this effectively destroys the previous GUI if it exists
QWidget *gui;
PluginGUI *pluginGUI = sampleSourceDevice->m_plugin->createSampleSourcePluginGUI(sampleSourceDevice->m_sourceId, &gui, deviceAPI);
PluginGUI *pluginGUI = sampleSourceDevice->m_plugin->createSampleSourcePluginGUI(sampleSourceDevice->m_deviceId, &gui, deviceAPI);
// m_sampleSourcePluginGUI = pluginGUI;
deviceAPI->setSampleSourceSequence(sampleSourceDevice->m_sourceSequence);
deviceAPI->setSampleSourceId(sampleSourceDevice->m_sourceId);
deviceAPI->setSampleSourceSerial(sampleSourceDevice->m_sourceSerial);
deviceAPI->setSampleSourceSequence(sampleSourceDevice->m_deviceSequence);
deviceAPI->setSampleSourceId(sampleSourceDevice->m_deviceId);
deviceAPI->setSampleSourceSerial(sampleSourceDevice->m_deviceSerial);
deviceAPI->setSampleSourcePluginGUI(pluginGUI);
deviceAPI->setInputGUI(gui, sampleSourceDevice->m_displayName);
}
@ -421,7 +421,7 @@ void PluginManager::loadPlugins(const QDir& dir)
void PluginManager::populateChannelComboBox(QComboBox *channels)
{
for(PluginAPI::ChannelRegistrations::iterator it = m_channelRegistrations.begin(); it != m_channelRegistrations.end(); ++it)
for(PluginAPI::ChannelRegistrations::iterator it = m_rxChannelRegistrations.begin(); it != m_rxChannelRegistrations.end(); ++it)
{
const PluginDescriptor& pluginDescipror = it->m_plugin->getPluginDescriptor();
channels->addItem(pluginDescipror.displayedName);
@ -430,9 +430,9 @@ void PluginManager::populateChannelComboBox(QComboBox *channels)
void PluginManager::createChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI)
{
if (channelPluginIndex < m_channelRegistrations.size())
if (channelPluginIndex < m_rxChannelRegistrations.size())
{
PluginInterface *pluginInterface = m_channelRegistrations[channelPluginIndex].m_plugin;
pluginInterface->createChannel(m_channelRegistrations[channelPluginIndex].m_channelName, deviceAPI);
PluginInterface *pluginInterface = m_rxChannelRegistrations[channelPluginIndex].m_plugin;
pluginInterface->createChannel(m_rxChannelRegistrations[channelPluginIndex].m_channelName, deviceAPI);
}
}

View File

@ -41,10 +41,10 @@ public:
const Plugins& getPlugins() const { return m_plugins; }
// Callbacks from the plugins
void registerChannel(const QString& channelName, PluginInterface* plugin);
void registerRxChannel(const QString& channelName, PluginInterface* plugin);
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
PluginAPI::ChannelRegistrations *getChannelRegistrations() { return &m_channelRegistrations; }
PluginAPI::ChannelRegistrations *getRxChannelRegistrations() { return &m_rxChannelRegistrations; }
void updateSampleSourceDevices();
void duplicateLocalSampleSourceDevices(uint deviceUID);
@ -59,57 +59,52 @@ public:
void createChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI);
private:
struct SampleSourceRegistration {
QString m_sourceId;
struct SamplingDeviceRegistration {
QString m_deviceId;
PluginInterface* m_plugin;
SampleSourceRegistration(const QString& sourceId, PluginInterface* plugin) :
m_sourceId(sourceId),
SamplingDeviceRegistration(const QString& deviceId, PluginInterface* plugin) :
m_deviceId(deviceId),
m_plugin(plugin)
{ }
};
typedef QList<SampleSourceRegistration> SampleSourceRegistrations;
typedef QList<SamplingDeviceRegistration> SamplingDeviceRegistrations;
struct SampleSourceDevice {
struct SamplingDevice {
PluginInterface* m_plugin;
QString m_displayName;
QString m_sourceId;
QString m_sourceSerial;
int m_sourceSequence;
QString m_deviceId;
QString m_deviceSerial;
int m_deviceSequence;
SampleSourceDevice(PluginInterface* plugin,
SamplingDevice(PluginInterface* plugin,
const QString& displayName,
const QString& sourceId,
const QString& sourceSerial,
int sourceSequence) :
const QString& deviceId,
const QString& deviceSerial,
int deviceSequence) :
m_plugin(plugin),
m_displayName(displayName),
m_sourceId(sourceId),
m_sourceSerial(sourceSerial),
m_sourceSequence(sourceSequence)
m_deviceId(deviceId),
m_deviceSerial(deviceSerial),
m_deviceSequence(deviceSequence)
{ }
};
typedef QList<SampleSourceDevice> SampleSourceDevices;
typedef QList<SamplingDevice> SamplingDevices;
PluginAPI m_pluginAPI;
MainWindow* m_mainWindow;
Plugins m_plugins;
PluginAPI::ChannelRegistrations m_channelRegistrations; //!< Channel plugins register here
SampleSourceRegistrations m_sampleSourceRegistrations; //!< Input source plugins (one per device kind) register here
SampleSourceDevices m_sampleSourceDevices; //!< Instances of input sources present in the system
PluginAPI::ChannelRegistrations m_rxChannelRegistrations; //!< Channel plugins register here
SamplingDeviceRegistrations m_sampleSourceRegistrations; //!< Input source plugins (one per device kind) register here
SamplingDevices m_sampleSourceDevices; //!< Instances of input sources present in the system
// "Local" sample source device IDs
static const QString m_sdrDaemonDeviceTypeID; //!< SDRdaemon source plugin ID
static const QString m_sdrDaemonFECDeviceTypeID; //!< SDRdaemon with FEC source plugin ID
static const QString m_fileSourceDeviceTypeID; //!< FileSource source plugin ID
// QString m_sampleSourceId;
// QString m_sampleSourceSerial;
// int m_sampleSourceSequence;
// PluginGUI* m_sampleSourcePluginGUI;
void loadPlugins(const QDir& dir);
friend class MainWindow;