2014-05-18 11:52:39 -04:00
|
|
|
#ifndef INCLUDE_PLUGININTERFACE_H
|
|
|
|
#define INCLUDE_PLUGININTERFACE_H
|
|
|
|
|
|
|
|
#include <QtPlugin>
|
|
|
|
#include <QString>
|
|
|
|
|
2018-03-20 08:49:21 -04:00
|
|
|
#include "export.h"
|
2018-03-03 14:23:38 -05:00
|
|
|
|
|
|
|
struct SDRBASE_API PluginDescriptor {
|
2019-12-15 19:03:47 -05:00
|
|
|
const QString hardwareId;
|
2014-05-18 11:52:39 -04: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 16:11:53 -04:00
|
|
|
class DeviceAPI;
|
2020-10-01 16:47:30 -04:00
|
|
|
class DeviceSet;
|
2017-10-29 19:02:28 -04:00
|
|
|
class DeviceUISet;
|
2020-09-19 19:06:34 -04:00
|
|
|
class FeatureUISet;
|
|
|
|
class WebAPIAdapterInterface;
|
2020-10-05 13:23:13 -04:00
|
|
|
class DeviceGUI;
|
2016-05-16 21:41:01 -04:00
|
|
|
class QWidget;
|
2017-09-14 02:49:31 -04:00
|
|
|
class DeviceSampleSource;
|
|
|
|
class DeviceSampleSink;
|
2019-05-18 00:30:37 -04:00
|
|
|
class DeviceSampleMIMO;
|
2017-11-08 02:31:00 -05:00
|
|
|
class BasebandSampleSink;
|
|
|
|
class BasebandSampleSource;
|
2019-09-03 01:59:14 -04:00
|
|
|
class MIMOChannel;
|
2019-05-09 11:27:12 -04:00
|
|
|
class ChannelAPI;
|
2020-10-04 00:16:15 -04:00
|
|
|
class ChannelGUI;
|
2019-08-04 18:10:56 -04:00
|
|
|
class ChannelWebAPIAdapter;
|
2019-08-03 05:21:46 -04:00
|
|
|
class DeviceWebAPIAdapter;
|
2020-09-23 23:38:05 -04:00
|
|
|
class FeatureWebAPIAdapter;
|
2020-09-19 19:06:34 -04:00
|
|
|
class Feature;
|
2020-10-03 17:55:24 -04:00
|
|
|
class FeatureGUI;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2018-03-03 14:23:38 -05:00
|
|
|
class SDRBASE_API PluginInterface {
|
2014-05-18 11:52:39 -04:00
|
|
|
public:
|
2016-10-13 16:23:43 -04:00
|
|
|
struct SamplingDevice
|
2015-09-30 00:57:40 -04:00
|
|
|
{
|
2017-11-01 15:06:33 -04:00
|
|
|
enum SamplingDeviceType
|
|
|
|
{
|
|
|
|
PhysicalDevice,
|
|
|
|
BuiltInDevice
|
|
|
|
};
|
|
|
|
|
2019-05-07 12:58:20 -04: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 10:31:15 -04:00
|
|
|
StreamMIMO //!< May expose any number of input and/or output streams
|
2019-05-07 12:58:20 -04:00
|
|
|
};
|
|
|
|
|
2017-11-01 15:06:33 -04: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 04:17:38 -04:00
|
|
|
QString serial; //!< The device serial number defined by the vendor or a fake one (SDRplay)
|
2017-11-01 15:06:33 -04: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 12:58:20 -04:00
|
|
|
StreamType streamType; //!< This is the type of stream supported
|
2017-11-18 19:05:16 -05:00
|
|
|
int deviceNbItems; //!< Number of items (or streams) in the device. >1 for composite devices.
|
2017-11-01 15:06:33 -04: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 00:57:40 -04:00
|
|
|
|
2016-10-13 16:23:43 -04:00
|
|
|
SamplingDevice(const QString& _displayedName,
|
2016-12-29 06:41:10 -05:00
|
|
|
const QString& _hardwareId,
|
2015-09-30 00:57:40 -04:00
|
|
|
const QString& _id,
|
|
|
|
const QString& _serial,
|
2017-11-01 05:37:00 -04:00
|
|
|
int _sequence,
|
2017-11-01 15:06:33 -04:00
|
|
|
SamplingDeviceType _type,
|
2019-05-07 12:58:20 -04:00
|
|
|
StreamType _streamType,
|
2017-11-18 19:05:16 -05:00
|
|
|
int _deviceNbItems,
|
2017-11-01 05:37:00 -04:00
|
|
|
int _deviceItemIndex) :
|
2014-05-18 11:52:39 -04:00
|
|
|
displayedName(_displayedName),
|
2016-12-29 06:41:10 -05:00
|
|
|
hardwareId(_hardwareId),
|
2015-09-30 00:57:40 -04:00
|
|
|
id(_id),
|
|
|
|
serial(_serial),
|
2017-11-01 05:37:00 -04:00
|
|
|
sequence(_sequence),
|
2017-11-01 15:06:33 -04:00
|
|
|
type(_type),
|
2019-05-07 12:58:20 -04:00
|
|
|
streamType(_streamType),
|
2017-11-18 19:05:16 -05:00
|
|
|
deviceNbItems(_deviceNbItems),
|
2017-11-01 05:37:00 -04:00
|
|
|
deviceItemIndex(_deviceItemIndex),
|
|
|
|
claimed(-1)
|
2014-05-18 11:52:39 -04:00
|
|
|
{ }
|
|
|
|
};
|
2016-10-13 16:23:43 -04:00
|
|
|
typedef QList<SamplingDevice> SamplingDevices;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2019-09-16 18:34:11 -04: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 08:04:16 -05:00
|
|
|
virtual ~PluginInterface() { }
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
|
|
|
|
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
|
|
|
|
|
2016-10-13 17:42:08 -04:00
|
|
|
// channel Rx plugins
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2020-10-01 16:47:30 -04:00
|
|
|
virtual void createRxChannel(DeviceAPI *deviceAPI, BasebandSampleSink **bs, ChannelAPI **cs) const
|
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
|
|
|
(void) bs;
|
|
|
|
(void) cs;
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:16:15 -04:00
|
|
|
virtual ChannelGUI* createRxChannelGUI(
|
2018-11-12 08:04:16 -05:00
|
|
|
DeviceUISet *deviceUISet,
|
2019-08-01 15:27:31 -04:00
|
|
|
BasebandSampleSink *rxChannel) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceUISet;
|
|
|
|
(void) rxChannel;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2020-10-01 16:47:30 -04:00
|
|
|
// channel Tx plugins
|
2017-11-08 02:31:00 -05:00
|
|
|
|
2020-10-01 16:47:30 -04:00
|
|
|
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
2020-10-01 16:47:30 -04:00
|
|
|
(void) bs;
|
|
|
|
(void) cs;
|
2018-11-12 08:04:16 -05:00
|
|
|
}
|
2017-12-17 17:15:42 -05:00
|
|
|
|
2020-10-04 00:16:15 -04:00
|
|
|
virtual ChannelGUI* createTxChannelGUI(
|
2018-11-12 08:04:16 -05:00
|
|
|
DeviceUISet *deviceUISet,
|
2019-08-01 15:27:31 -04:00
|
|
|
BasebandSampleSource *txChannel) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceUISet;
|
|
|
|
(void) txChannel;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-10-14 12:47:19 -04:00
|
|
|
|
2020-10-01 16:47:30 -04:00
|
|
|
// channel MIMO plugins
|
2017-11-08 02:31:00 -05:00
|
|
|
|
2020-10-01 16:47:30 -04:00
|
|
|
virtual void createMIMOChannel(DeviceAPI *deviceAPI, MIMOChannel **bs, ChannelAPI **cs) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
2020-10-01 16:47:30 -04:00
|
|
|
(void) bs;
|
|
|
|
(void) cs;
|
2018-11-12 08:04:16 -05:00
|
|
|
}
|
2017-12-17 17:15:42 -05:00
|
|
|
|
2020-10-04 00:16:15 -04:00
|
|
|
virtual ChannelGUI* createMIMOChannelGUI(
|
2019-09-02 12:36:56 -04:00
|
|
|
DeviceUISet *deviceUISet,
|
2019-09-03 01:59:14 -04:00
|
|
|
MIMOChannel *mimoChannel) const
|
2019-09-02 12:36:56 -04:00
|
|
|
{
|
|
|
|
(void) deviceUISet;
|
|
|
|
(void) mimoChannel;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-08-01 12:50:21 -04:00
|
|
|
// any channel
|
|
|
|
|
2019-08-04 18:10:56 -04:00
|
|
|
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const
|
2019-08-01 12:50:21 -04:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2020-09-23 23:38:05 -04:00
|
|
|
// any feature
|
|
|
|
|
|
|
|
virtual FeatureWebAPIAdapter* createFeatureWebAPIAdapter() const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-09-16 18:34:11 -04:00
|
|
|
// any device
|
|
|
|
|
|
|
|
virtual void enumOriginDevices(QStringList& listedHwIds, OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) listedHwIds;
|
|
|
|
(void) originDevices;
|
|
|
|
}
|
|
|
|
|
2019-12-15 19:03:47 -05:00
|
|
|
virtual SamplingDevice::SamplingDeviceType getSamplingDeviceType() const {
|
|
|
|
return SamplingDevice::SamplingDeviceType::PhysicalDevice;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual QString getDeviceTypeId() const {
|
|
|
|
return QString("");
|
|
|
|
}
|
|
|
|
|
2017-12-17 17:15:42 -05:00
|
|
|
// device source plugins only
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2019-09-16 18:34:11 -04:00
|
|
|
virtual SamplingDevices enumSampleSources(const OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) originDevices;
|
|
|
|
return SamplingDevices();
|
|
|
|
}
|
2017-10-29 19:02:28 -04:00
|
|
|
|
2020-10-05 13:23:13 -04:00
|
|
|
virtual DeviceGUI* createSampleSourcePluginInstanceGUI(
|
2018-11-12 08:04:16 -05:00
|
|
|
const QString& sourceId,
|
|
|
|
QWidget **widget,
|
|
|
|
DeviceUISet *deviceUISet)
|
|
|
|
{
|
|
|
|
(void) sourceId;
|
|
|
|
(void) widget;
|
|
|
|
(void) deviceUISet;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-05-19 04:28:50 -04:00
|
|
|
virtual DeviceSampleSource* createSampleSourcePluginInstance( // creates the input "core"
|
2018-11-12 08:04:16 -05:00
|
|
|
const QString& sourceId,
|
2019-05-08 16:11:53 -04:00
|
|
|
DeviceAPI *deviceAPI)
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) sourceId;
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-09-16 04:45:08 -04:00
|
|
|
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
|
2016-10-14 12:47:19 -04:00
|
|
|
|
2019-12-15 19:03:47 -05:00
|
|
|
virtual int getDefaultRxNbItems() const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-10-14 12:47:19 -04:00
|
|
|
// device sink plugins only
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2019-09-16 18:34:11 -04:00
|
|
|
virtual SamplingDevices enumSampleSinks(const OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) originDevices;
|
|
|
|
return SamplingDevices();
|
|
|
|
}
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2020-10-05 13:23:13 -04:00
|
|
|
virtual DeviceGUI* createSampleSinkPluginInstanceGUI(
|
2018-11-12 08:04:16 -05:00
|
|
|
const QString& sinkId,
|
|
|
|
QWidget **widget,
|
|
|
|
DeviceUISet *deviceUISet)
|
|
|
|
{
|
|
|
|
(void) sinkId;
|
|
|
|
(void) widget;
|
|
|
|
(void) deviceUISet;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-05-19 04:28:50 -04:00
|
|
|
virtual DeviceSampleSink* createSampleSinkPluginInstance( // creates the output "core"
|
2018-11-12 08:04:16 -05:00
|
|
|
const QString& sinkId,
|
2019-05-08 16:11:53 -04:00
|
|
|
DeviceAPI *deviceAPI)
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) sinkId;
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2017-09-16 05:34:25 -04:00
|
|
|
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
|
2019-05-18 00:30:37 -04:00
|
|
|
|
2019-12-15 19:03:47 -05:00
|
|
|
virtual int getDefaultTxNbItems() const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2019-05-18 00:30:37 -04:00
|
|
|
// device MIMO plugins only
|
|
|
|
|
2019-09-16 18:34:11 -04:00
|
|
|
virtual SamplingDevices enumSampleMIMO(const OriginDevices& originDevices)
|
|
|
|
{
|
|
|
|
(void) originDevices;
|
|
|
|
return SamplingDevices();
|
|
|
|
}
|
2019-05-18 00:30:37 -04:00
|
|
|
|
2020-10-05 13:23:13 -04:00
|
|
|
virtual DeviceGUI* createSampleMIMOPluginInstanceGUI(
|
2019-05-18 00:30:37 -04:00
|
|
|
const QString& mimoId,
|
|
|
|
QWidget **widget,
|
|
|
|
DeviceUISet *deviceUISet)
|
|
|
|
{
|
|
|
|
(void) mimoId;
|
|
|
|
(void) widget;
|
|
|
|
(void) deviceUISet;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-05-19 04:28:50 -04:00
|
|
|
virtual DeviceSampleMIMO* createSampleMIMOPluginInstance( // creates the MIMO "core"
|
2019-05-18 00:30:37 -04:00
|
|
|
const QString& mimoId,
|
|
|
|
DeviceAPI *deviceAPI)
|
|
|
|
{
|
|
|
|
(void) mimoId;
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void deleteSampleMIMOPluginInstanceMIMO(DeviceSampleMIMO *mimo);
|
|
|
|
|
2020-09-08 10:47:20 -04:00
|
|
|
// Callback to allow plugin to add elements to top-level GUI (such as menu items)
|
2020-09-09 20:43:28 -04:00
|
|
|
virtual bool createTopLevelGUI()
|
2020-09-08 10:47:20 -04: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)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-03 05:21:46 -04:00
|
|
|
// all devices
|
|
|
|
|
|
|
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2020-09-19 19:06:34 -04:00
|
|
|
|
|
|
|
// Features
|
|
|
|
|
2020-10-03 17:55:24 -04:00
|
|
|
virtual FeatureGUI* createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const
|
2020-09-19 19:06:34 -04:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual Feature* createFeature(WebAPIAdapterInterface *webAPIAdapterInterface) const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-05-18 11:52:39 -04:00
|
|
|
};
|
|
|
|
|
2019-11-01 17:22:18 -04:00
|
|
|
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1")
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
#endif // INCLUDE_PLUGININTERFACE_H
|