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 {
|
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;
|
2017-10-29 19:02:28 -04:00
|
|
|
class DeviceUISet;
|
2017-09-25 18:22:08 -04:00
|
|
|
class PluginInstanceGUI;
|
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-05-09 11:27:12 -04:00
|
|
|
class ChannelAPI;
|
2019-08-04 18:10:56 -04:00
|
|
|
class ChannelWebAPIAdapter;
|
2019-08-03 05:21:46 -04:00
|
|
|
class DeviceWebAPIAdapter;
|
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
|
|
|
|
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
|
|
|
|
2017-11-07 17:49:27 -05:00
|
|
|
virtual PluginInstanceGUI* 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
|
|
|
|
2019-08-01 15:27:31 -04:00
|
|
|
virtual BasebandSampleSink* createRxChannelBS(DeviceAPI *deviceAPI) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-11-08 02:31:00 -05:00
|
|
|
|
2019-08-01 15:27:31 -04:00
|
|
|
virtual ChannelAPI* createRxChannelCS(DeviceAPI *deviceAPI) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-12-17 17:15:42 -05:00
|
|
|
|
2017-11-08 02:31:00 -05:00
|
|
|
// channel Tx plugins
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2017-11-07 18:05:49 -05:00
|
|
|
virtual PluginInstanceGUI* 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
|
|
|
|
2019-08-01 15:27:31 -04:00
|
|
|
virtual BasebandSampleSource* createTxChannelBS(DeviceAPI *deviceAPI) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-11-08 02:31:00 -05:00
|
|
|
|
2019-08-01 15:27:31 -04:00
|
|
|
virtual ChannelAPI* createTxChannelCS(DeviceAPI *deviceAPI) const
|
2018-11-12 08:04:16 -05:00
|
|
|
{
|
|
|
|
(void) deviceAPI;
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-12-17 17:15:42 -05:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-12-17 17:15:42 -05:00
|
|
|
// device source plugins only
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2016-10-13 16:23:43 -04:00
|
|
|
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
|
2017-10-29 19:02:28 -04:00
|
|
|
|
|
|
|
virtual PluginInstanceGUI* 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-25 18:22:08 -04:00
|
|
|
virtual void deleteSampleSourcePluginInstanceGUI(PluginInstanceGUI *ui);
|
2017-09-16 04:45:08 -04:00
|
|
|
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
|
2016-10-14 12:47:19 -04:00
|
|
|
|
|
|
|
// device sink plugins only
|
2017-10-29 20:11:35 -04:00
|
|
|
|
2016-10-14 12:47:19 -04:00
|
|
|
virtual SamplingDevices enumSampleSinks() { return SamplingDevices(); }
|
2017-10-29 20:11:35 -04:00
|
|
|
|
|
|
|
virtual PluginInstanceGUI* 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-25 18:22:08 -04:00
|
|
|
virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceGUI *ui);
|
2017-09-16 05:34:25 -04:00
|
|
|
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
|
2019-05-18 00:30:37 -04:00
|
|
|
|
|
|
|
// device MIMO plugins only
|
|
|
|
|
|
|
|
virtual SamplingDevices enumSampleMIMO() { return SamplingDevices(); }
|
|
|
|
|
|
|
|
virtual PluginInstanceGUI* createSampleMIMOPluginInstanceGUI(
|
|
|
|
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 deleteSampleMIMOPluginInstanceGUI(PluginInstanceGUI *ui);
|
|
|
|
virtual void deleteSampleMIMOPluginInstanceMIMO(DeviceSampleMIMO *mimo);
|
|
|
|
|
2019-08-03 05:21:46 -04:00
|
|
|
// all devices
|
|
|
|
|
|
|
|
virtual DeviceWebAPIAdapter* createDeviceWebAPIAdapter() const {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-05-18 11:52:39 -04:00
|
|
|
};
|
|
|
|
|
2015-10-04 22:47:23 -04:00
|
|
|
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
#endif // INCLUDE_PLUGININTERFACE_H
|