2014-05-18 15:52:39 +00:00
|
|
|
#ifndef INCLUDE_PLUGININTERFACE_H
|
|
|
|
#define INCLUDE_PLUGININTERFACE_H
|
|
|
|
|
|
|
|
#include <QtPlugin>
|
|
|
|
#include <QString>
|
|
|
|
|
2018-03-20 12:49:21 +00:00
|
|
|
#include "export.h"
|
2018-03-03 19:23:38 +00:00
|
|
|
|
|
|
|
struct SDRBASE_API PluginDescriptor {
|
2019-12-16 00:03:47 +00:00
|
|
|
const QString hardwareId;
|
2014-05-18 15:52:39 +00:00
|
|
|
// general plugin description
|
|
|
|
const QString displayedName;
|
|
|
|
const QString version;
|
|
|
|
const QString copyright;
|
|
|
|
const QString website;
|
|
|
|
bool licenseIsGPL;
|
|
|
|
const QString sourceCodeURL;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PluginAPI;
|
2019-05-08 20:11:53 +00:00
|
|
|
class DeviceAPI;
|
2020-10-01 20:47:30 +00:00
|
|
|
class DeviceSet;
|
2017-10-29 23:02:28 +00:00
|
|
|
class DeviceUISet;
|
2020-09-19 23:06:34 +00:00
|
|
|
class FeatureUISet;
|
|
|
|
class WebAPIAdapterInterface;
|
2020-10-05 17:23:13 +00:00
|
|
|
class DeviceGUI;
|
2016-05-17 01:41:01 +00:00
|
|
|
class QWidget;
|
2017-09-14 06:49:31 +00:00
|
|
|
class DeviceSampleSource;
|
|
|
|
class DeviceSampleSink;
|
2019-05-18 04:30:37 +00:00
|
|
|
class DeviceSampleMIMO;
|
2017-11-08 07:31:00 +00:00
|
|
|
class BasebandSampleSink;
|
|
|
|
class BasebandSampleSource;
|
2019-09-03 05:59:14 +00:00
|
|
|
class MIMOChannel;
|
2019-05-09 15:27:12 +00:00
|
|
|
class ChannelAPI;
|
2020-10-04 04:16:15 +00:00
|
|
|
class ChannelGUI;
|
2019-08-04 22:10:56 +00:00
|
|
|
class ChannelWebAPIAdapter;
|
2019-08-03 09:21:46 +00:00
|
|
|
class DeviceWebAPIAdapter;
|
2020-09-24 03:38:05 +00:00
|
|
|
class FeatureWebAPIAdapter;
|
2020-09-19 23:06:34 +00:00
|
|
|
class Feature;
|
2020-10-03 21:55:24 +00:00
|
|
|
class FeatureGUI;
|
2014-05-18 15:52:39 +00:00
|
|
|
|
2018-03-03 19:23:38 +00:00
|
|
|
class SDRBASE_API PluginInterface {
|
2014-05-18 15:52:39 +00:00
|
|
|
public:
|
2016-10-13 20:23:43 +00:00
|
|
|
struct SamplingDevice
|
2015-09-30 04:57:40 +00:00
|
|
|
{
|
2017-11-01 19:06:33 +00:00
|
|
|
enum SamplingDeviceType
|
|
|
|
{
|
|
|
|
PhysicalDevice,
|
|
|
|
BuiltInDevice
|
|
|
|
};
|
|
|
|
|
2019-05-07 16:58:20 +00:00
|
|
|
enum StreamType
|
|
|
|
{
|
|
|
|
StreamSingleRx, //!< Exposes a single input stream that can be one of the streams of a physical device
|
|
|
|
StreamSingleTx, //!< Exposes a single output stream that can be one of the streams of a physical device
|
2019-05-20 14:31:15 +00:00
|
|
|
StreamMIMO //!< May expose any number of input and/or output streams
|
2019-05-07 16:58:20 +00:00
|
|
|
};
|
|
|
|
|
2017-11-01 19:06:33 +00:00
|
|
|
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 ...)
|
2017-11-02 08:17:38 +00:00
|
|
|
QString serial; //!< The device serial number defined by the vendor or a fake one (SDRplay)
|
2017-11-01 19:06:33 +00:00
|
|
|
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
|
2019-05-07 16:58:20 +00:00
|
|
|
StreamType streamType; //!< This is the type of stream supported
|
2017-11-19 00:05:16 +00:00
|
|
|
int deviceNbItems; //!< Number of items (or streams) in the device. >1 for composite devices.
|
2017-11-01 19:06:33 +00:00
|
|
|
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
|
2015-09-30 04:57:40 +00:00
|
|
|
|
2016-10-13 20:23:43 +00:00
|
|
|
SamplingDevice(const QString& _displayedName,
|
2016-12-29 11:41:10 +00:00
|
|
|
const QString& _hardwareId,
|
2015-09-30 04:57:40 +00:00
|
|
|
const QString& _id,
|
|
|
|
const QString& _serial,
|
2017-11-01 09:37:00 +00:00
|
|
|
int _sequence,
|
2017-11-01 19:06:33 +00:00
|
|
|
SamplingDeviceType _type,
|
2019-05-07 16:58:20 +00:00
|
|
|
StreamType _streamType,
|
2017-11-19 00:05:16 +00:00
|
|
|
int _deviceNbItems,
|
2017-11-01 09:37:00 +00:00
|
|
|
int _deviceItemIndex) :
|
2014-05-18 15:52:39 +00:00
|
|
|
displayedName(_displayedName),
|
2016-12-29 11:41:10 +00:00
|
|
|
hardwareId(_hardwareId),
|
2015-09-30 04:57:40 +00:00
|
|
|
id(_id),
|
|
|
|
serial(_serial),
|
2017-11-01 09:37:00 +00:00
|
|
|
sequence(_sequence),
|
2017-11-01 19:06:33 +00:00
|
|
|
type(_type),
|
2019-05-07 16:58:20 +00:00
|
|
|
streamType(_streamType),
|
2017-11-19 00:05:16 +00:00
|
|
|
deviceNbItems(_deviceNbItems),
|
2017-11-01 09:37:00 +00:00
|
|
|
deviceItemIndex(_deviceItemIndex),
|
|
|
|
claimed(-1)
|
2014-05-18 15:52:39 +00:00
|
|
|
{ }
|
|
|
|
};
|
2016-10-13 20:23:43 +00:00
|
|
|
typedef QList<SamplingDevice> SamplingDevices;
|
2014-05-18 15:52:39 +00:00
|
|
|
|
2019-09-16 22:34:11 +00:00
|
|
|
/** This is the device from which the sampling devices are derived. For physical devices this represents
|
|
|
|
* a single physical unit (a LimeSDR, HackRF, BladeRF, RTL-SDR dongle, ...) that is enumerated once and
|
|
|
|
* reported in the system so that the "sampling devices" used in the system can be registered
|
|
|
|
*/
|
|
|
|
struct OriginDevice
|
|
|
|
{
|
|
|
|
QString displayableName; //!< A human readable name
|
|
|
|
QString hardwareId; //!< The internal id that identifies the type of hardware (i.e. HackRF, BladeRF, ...)
|
|
|
|
QString serial; //!< The device serial number defined by the vendor or a fake one (SDRplay)
|
|
|
|
int sequence; //!< The device sequence in order of enumeration
|
|
|
|
int nbRxStreams; //!< Number of receiver streams
|
|
|
|
int nbTxStreams; //!< Number of transmitter streams
|
|
|
|
|
|
|
|
OriginDevice(
|
|
|
|
const QString& _displayableName,
|
|
|
|
const QString& _hardwareId,
|
|
|
|
const QString& _serial,
|
|
|
|
int _sequence,
|
|
|
|
int _nbRxStreams,
|
|
|
|
int _nbTxStreams
|
|
|
|
) :
|
|
|
|
displayableName(_displayableName),
|
|
|
|
hardwareId(_hardwareId),
|
|
|
|
serial(_serial),
|
|
|
|
sequence(_sequence),
|
|
|
|
nbRxStreams(_nbRxStreams),
|
|
|
|
nbTxStreams(_nbTxStreams)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
typedef QList<OriginDevice> OriginDevices;
|
|
|
|
|
2018-11-12 13:04:16 +00:00
|
|
|
virtual ~PluginInterface() { }
|
2014-05-18 15:52:39 +00:00
|
|
|
|
|
|
|
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
|
|
|
|
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
|
|
|
|
|
2016-10-13 21:42:08 +00:00
|
|
|
// channel Rx plugins
|
2017-10-30 00:11:35 +00:00
|
|
|
|
2020-10-01 20:47:30 +00:00
|
|
|
virtual void createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const
|
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
|
|
|
(void) bs;
|
|
|
|
(void) cs;
|
|
|
|
}
|
|
|
|
|
2020-10-04 04:16:15 +00:00
|
|
|
virtual ChannelGUI* createRxChannelGUI(
|
2018-11-12 13:04:16 +00:00
|
|
|
DeviceUISet *deviceUISet,
|
2019-08-01 19:27:31 +00:00
|
|
|
BasebandSampleSink *rxChannel) const
|
2018-11-12 13:04:16 +00:00
|
|
|
{
|
|
|
|
(void) deviceUISet;
|
|
|
|
(void) rxChannel;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-05-18 15:52:39 +00:00
|
|
|
|
2020-10-01 20:47:30 +00:00
|
|
|
// channel Tx plugins
|
2017-11-08 07:31:00 +00:00
|
|
|
|
2020-10-01 20:47:30 +00:00
|
|
|
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const
|
2018-11-12 13:04:16 +00:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
2020-10-01 20:47:30 +00:00
|
|
|
(void) bs;
|
|
|
|
(void) cs;
|
2018-11-12 13:04:16 +00:00
|
|
|
}
|
2017-12-17 22:15:42 +00:00
|
|
|
|
2020-10-04 04:16:15 +00:00
|
|
|
virtual ChannelGUI* createTxChannelGUI(
|
2018-11-12 13:04:16 +00:00
|
|
|
DeviceUISet *deviceUISet,
|
2019-08-01 19:27:31 +00:00
|
|
|
BasebandSampleSource *txChannel) const
|
2018-11-12 13:04:16 +00:00
|
|
|
{
|
|
|
|
(void) deviceUISet;
|
|
|
|
(void) txChannel;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-10-14 16:47:19 +00:00
|
|
|
|
2020-10-01 20:47:30 +00:00
|
|
|
// channel MIMO plugins
|
2017-11-08 07:31:00 +00:00
|
|
|
|
2020-10-01 20:47:30 +00:00
|
|
|
virtual void createMIMOChannel(DeviceAPI *deviceAPI, MIMOChannel **bs, ChannelAPI **cs) const
|
2018-11-12 13:04:16 +00:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
2020-10-01 20:47:30 +00:00
|
|
|
(void) bs;
|
|
|
|
(void) cs;
|
2018-11-12 13:04:16 +00:00
|
|
|
}
|
2017-12-17 22:15:42 +00:00
|
|
|
|
2020-10-04 04:16:15 +00:00
|
|
|
virtual ChannelGUI* createMIMOChannelGUI(
|
2019-09-02 16:36:56 +00:00
|
|
|
DeviceUISet *deviceUISet,
|
2019-09-03 05:59:14 +00:00
|
|
|
MIMOChannel *mimoChannel) const
|
2019-09-02 16:36:56 +00:00
|
|
|
{
|
|
|
|
(void) deviceUISet;
|
|
|
|
(void) mimoChannel;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-08-01 16:50:21 +00:00
|
|
|
// any channel
|
|
|
|
|
2019-08-04 22:10:56 +00:00
|
|
|
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const
|
2019-08-01 16:50:21 +00:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2020-09-24 03:38:05 +00:00
|
|
|
// any feature
|
|
|
|
|
|
|
|
virtual FeatureWebAPIAdapter* createFeatureWebAPIAdapter() const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-09-16 22:34:11 +00:00
|
|
|
// any device
|
|
|
|
|
|
|
|
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) listedHwIds;
|
|
|
|
(void) originDevices;
|
|
|
|
}
|
|
|
|
|
2019-12-16 00:03:47 +00:00
|
|
|
virtual SamplingDevice::SamplingDeviceType getSamplingDeviceType() const {
|
|
|
|
return SamplingDevice::SamplingDeviceType::PhysicalDevice;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual QString getDeviceTypeId() const {
|
|
|
|
return QString("");
|
|
|
|
}
|
|
|
|
|
2017-12-17 22:15:42 +00:00
|
|
|
// device source plugins only
|
2017-10-30 00:11:35 +00:00
|
|
|
|
2019-09-16 22:34:11 +00:00
|
|
|
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) originDevices;
|
|
|
|
return SamplingDevices();
|
|
|
|
}
|
2017-10-29 23:02:28 +00:00
|
|
|
|
2020-10-05 17:23:13 +00:00
|
|
|
virtual DeviceGUI* createSampleSourcePluginInstanceGUI(
|
2018-11-12 13:04:16 +00:00
|
|
|
const QString& sourceId,
|
|
|
|
QWidget **widget,
|
|
|
|
DeviceUISet *deviceUISet)
|
|
|
|
{
|
|
|
|
(void) sourceId;
|
|
|
|
(void) widget;
|
|
|
|
(void) deviceUISet;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-05-19 08:28:50 +00:00
|
|
|
virtual DeviceSampleSource* createSampleSourcePluginInstance( // creates the input "core"
|
2018-11-12 13:04:16 +00:00
|
|
|
const QString& sourceId,
|
2019-05-08 20:11:53 +00:00
|
|
|
DeviceAPI *deviceAPI)
|
2018-11-12 13:04:16 +00:00
|
|
|
{
|
|
|
|
(void) sourceId;
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-09-16 08:45:08 +00:00
|
|
|
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
|
2016-10-14 16:47:19 +00:00
|
|
|
|
2019-12-16 00:03:47 +00:00
|
|
|
virtual int getDefaultRxNbItems() const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-10-14 16:47:19 +00:00
|
|
|
// device sink plugins only
|
2017-10-30 00:11:35 +00:00
|
|
|
|
2019-09-16 22:34:11 +00:00
|
|
|
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) originDevices;
|
|
|
|
return SamplingDevices();
|
|
|
|
}
|
2017-10-30 00:11:35 +00:00
|
|
|
|
2020-10-05 17:23:13 +00:00
|
|
|
virtual DeviceGUI* createSampleSinkPluginInstanceGUI(
|
2018-11-12 13:04:16 +00:00
|
|
|
const QString& sinkId,
|
|
|
|
QWidget **widget,
|
|
|
|
DeviceUISet *deviceUISet)
|
|
|
|
{
|
|
|
|
(void) sinkId;
|
|
|
|
(void) widget;
|
|
|
|
(void) deviceUISet;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-05-19 08:28:50 +00:00
|
|
|
virtual DeviceSampleSink* createSampleSinkPluginInstance( // creates the output "core"
|
2018-11-12 13:04:16 +00:00
|
|
|
const QString& sinkId,
|
2019-05-08 20:11:53 +00:00
|
|
|
DeviceAPI *deviceAPI)
|
2018-11-12 13:04:16 +00:00
|
|
|
{
|
|
|
|
(void) sinkId;
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-10-30 00:11:35 +00:00
|
|
|
|
2017-09-16 09:34:25 +00:00
|
|
|
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
|
2019-05-18 04:30:37 +00:00
|
|
|
|
2019-12-16 00:03:47 +00:00
|
|
|
virtual int getDefaultTxNbItems() const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2019-05-18 04:30:37 +00:00
|
|
|
// device MIMO plugins only
|
|
|
|
|
2019-09-16 22:34:11 +00:00
|
|
|
virtual SamplingDevices enumSampleMIMO(const OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) originDevices;
|
|
|
|
return SamplingDevices();
|
|
|
|
}
|
2019-05-18 04:30:37 +00:00
|
|
|
|
2020-10-05 17:23:13 +00:00
|
|
|
virtual DeviceGUI* createSampleMIMOPluginInstanceGUI(
|
2019-05-18 04:30:37 +00:00
|
|
|
const QString& mimoId,
|
|
|
|
QWidget **widget,
|
|
|
|
DeviceUISet *deviceUISet)
|
|
|
|
{
|
|
|
|
(void) mimoId;
|
|
|
|
(void) widget;
|
|
|
|
(void) deviceUISet;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-05-19 08:28:50 +00:00
|
|
|
virtual DeviceSampleMIMO* createSampleMIMOPluginInstance( // creates the MIMO "core"
|
2019-05-18 04:30:37 +00:00
|
|
|
const QString& mimoId,
|
|
|
|
DeviceAPI *deviceAPI)
|
|
|
|
{
|
|
|
|
(void) mimoId;
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void deleteSampleMIMOPluginInstanceMIMO(DeviceSampleMIMO *mimo);
|
|
|
|
|
2021-05-02 11:06:10 +00:00
|
|
|
virtual int getDefaultMIMONbItems() const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-09-08 14:47:20 +00:00
|
|
|
// Callback to allow plugin to add elements to top-level GUI (such as menu items)
|
2020-09-10 00:43:28 +00:00
|
|
|
virtual bool createTopLevelGUI()
|
2020-09-08 14:47:20 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Serialise global plugin settings (i.e. settings that are not per-instance)
|
|
|
|
virtual QByteArray serializeGlobalSettings() const
|
|
|
|
{
|
|
|
|
QByteArray empty;
|
|
|
|
return empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool deserializeGlobalSettings(const QByteArray& data)
|
|
|
|
{
|
2020-11-14 10:13:32 +00:00
|
|
|
(void) data;
|
2020-09-08 14:47:20 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-03 09:21:46 +00:00
|
|
|
// all devices
|
|
|
|
|
|
|
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2020-09-19 23:06:34 +00:00
|
|
|
|
|
|
|
// Features
|
|
|
|
|
2020-10-03 21:55:24 +00:00
|
|
|
virtual FeatureGUI* createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const
|
2020-09-19 23:06:34 +00:00
|
|
|
{
|
2020-11-14 10:13:32 +00:00
|
|
|
(void) featureUISet;
|
|
|
|
(void) feature;
|
2020-09-19 23:06:34 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual Feature* createFeature(WebAPIAdapterInterface *webAPIAdapterInterface) const
|
|
|
|
{
|
2020-11-14 10:13:32 +00:00
|
|
|
(void) webAPIAdapterInterface;
|
2020-09-19 23:06:34 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
2014-05-18 15:52:39 +00:00
|
|
|
};
|
|
|
|
|
2019-11-01 21:22:18 +00:00
|
|
|
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1")
|
2014-05-18 15:52:39 +00:00
|
|
|
|
|
|
|
#endif // INCLUDE_PLUGININTERFACE_H
|