mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-05 19:18:38 -04:00
New preset design: fix missing bits in HackRF and Filesource plugin classes
This commit is contained in:
parent
49763934ea
commit
2309c89859
@ -31,6 +31,8 @@ const PluginDescriptor FileSourcePlugin::m_pluginDescriptor = {
|
||||
QString("https://github.com/f4exb/sdrangel")
|
||||
};
|
||||
|
||||
const QString FileSourcePlugin::m_deviceTypeID = FILESOURCE_DEVICE_TYPE_ID;
|
||||
|
||||
FileSourcePlugin::FileSourcePlugin(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
@ -44,7 +46,7 @@ const PluginDescriptor& FileSourcePlugin::getPluginDescriptor() const
|
||||
void FileSourcePlugin::initPlugin(PluginAPI* pluginAPI)
|
||||
{
|
||||
m_pluginAPI = pluginAPI;
|
||||
m_pluginAPI->registerSampleSource("org.osmocom.sdr.samplesource.filesource", this);
|
||||
m_pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
||||
}
|
||||
|
||||
PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources()
|
||||
@ -55,12 +57,9 @@ PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources()
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QString displayedName(QString("FileSource #%1 choose file").arg(i));
|
||||
SimpleSerializer s(1);
|
||||
s.writeS32(1, i);
|
||||
s.writeString(2, "");
|
||||
|
||||
result.append(SampleSourceDevice(displayedName,
|
||||
"org.osmocom.sdr.samplesource.filesource",
|
||||
m_deviceTypeID,
|
||||
QString::null,
|
||||
i));
|
||||
}
|
||||
@ -70,11 +69,14 @@ PluginInterface::SampleSourceDevices FileSourcePlugin::enumSampleSources()
|
||||
|
||||
PluginGUI* FileSourcePlugin::createSampleSourcePluginGUI(const QString& sourceId)
|
||||
{
|
||||
if(sourceId == "org.osmocom.sdr.samplesource.filesource") {
|
||||
if(sourceId == m_deviceTypeID)
|
||||
{
|
||||
FileSourceGui* gui = new FileSourceGui(m_pluginAPI);
|
||||
m_pluginAPI->setInputGUI(gui);
|
||||
return gui;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,12 @@
|
||||
#include <QObject>
|
||||
#include "plugin/plugininterface.h"
|
||||
|
||||
#define FILESOURCE_DEVICE_TYPE_ID "sdrangel.samplesource.filesource"
|
||||
|
||||
class FileSourcePlugin : public QObject, public PluginInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.filesource")
|
||||
Q_PLUGIN_METADATA(IID FILESOURCE_DEVICE_TYPE_ID)
|
||||
|
||||
public:
|
||||
explicit FileSourcePlugin(QObject* parent = NULL);
|
||||
@ -34,6 +36,8 @@ public:
|
||||
virtual SampleSourceDevices enumSampleSources();
|
||||
virtual PluginGUI* createSampleSourcePluginGUI(const QString& sourceId);
|
||||
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
private:
|
||||
static const PluginDescriptor m_pluginDescriptor;
|
||||
|
||||
|
@ -94,10 +94,6 @@ PluginInterface::SampleSourceDevices HackRFPlugin::enumSampleSources()
|
||||
QString serial_str = QString::number(serial_msb, 16) + QString::number(serial_lsb, 16);
|
||||
uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
|
||||
QString displayedName(QString("HackRF #%1 0x%2").arg(i).arg(serial_str));
|
||||
SimpleSerializer s(1);
|
||||
s.writeS32(1, i);
|
||||
s.writeString(2, serial_str);
|
||||
s.writeU64(3, serial_num);
|
||||
|
||||
result.append(SampleSourceDevice(displayedName, m_deviceTypeID,
|
||||
serial_str,
|
||||
|
Loading…
Reference in New Issue
Block a user