sdrangel/sdrbase/plugin/plugininterface.h

222 wiersze
6.3 KiB
C
Czysty Zwykły widok Historia

#ifndef INCLUDE_PLUGININTERFACE_H
#define INCLUDE_PLUGININTERFACE_H
#include <QtPlugin>
#include <QString>
#include "export.h"
2018-03-03 19:23:38 +00:00
struct SDRBASE_API PluginDescriptor {
// 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;
class DeviceUISet;
class PluginInstanceGUI;
class QWidget;
class DeviceSampleSource;
class DeviceSampleSink;
class DeviceSampleMIMO;
class BasebandSampleSink;
class BasebandSampleSource;
2019-05-09 15:27:12 +00:00
class ChannelAPI;
2018-03-03 19:23:38 +00:00
class SDRBASE_API PluginInterface {
public:
2016-10-13 20:23:43 +00:00
struct SamplingDevice
{
enum SamplingDeviceType
{
PhysicalDevice,
BuiltInDevice
};
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
StreamAny //!< May expose any number of input and/or output streams
};
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 ...)
QString serial; //!< The device serial number defined by the vendor or a fake one (SDRplay)
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
StreamType streamType; //!< This is the type of stream supported
int deviceNbItems; //!< Number of items (or streams) in the device. >1 for composite devices.
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
2016-10-13 20:23:43 +00:00
SamplingDevice(const QString& _displayedName,
2016-12-29 11:41:10 +00:00
const QString& _hardwareId,
const QString& _id,
const QString& _serial,
int _sequence,
SamplingDeviceType _type,
StreamType _streamType,
int _deviceNbItems,
int _deviceItemIndex) :
displayedName(_displayedName),
2016-12-29 11:41:10 +00:00
hardwareId(_hardwareId),
id(_id),
serial(_serial),
sequence(_sequence),
type(_type),
streamType(_streamType),
deviceNbItems(_deviceNbItems),
deviceItemIndex(_deviceItemIndex),
claimed(-1)
{ }
};
2016-10-13 20:23:43 +00:00
typedef QList<SamplingDevice> SamplingDevices;
virtual ~PluginInterface() { }
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
2016-10-13 21:42:08 +00:00
// channel Rx plugins
virtual PluginInstanceGUI* createRxChannelGUI(
DeviceUISet *deviceUISet,
BasebandSampleSink *rxChannel)
{
(void) deviceUISet;
(void) rxChannel;
return nullptr;
}
virtual BasebandSampleSink* createRxChannelBS(
2019-05-08 20:11:53 +00:00
DeviceAPI *deviceAPI)
{
(void) deviceAPI;
return nullptr;
}
2019-05-09 15:27:12 +00:00
virtual ChannelAPI* createRxChannelCS(
2019-05-08 20:11:53 +00:00
DeviceAPI *deviceAPI)
{
(void) deviceAPI;
return nullptr;
}
2017-12-17 22:15:42 +00:00
// channel Tx plugins
virtual PluginInstanceGUI* createTxChannelGUI(
DeviceUISet *deviceUISet,
BasebandSampleSource *txChannel)
{
(void) deviceUISet;
(void) txChannel;
return nullptr;
}
virtual BasebandSampleSource* createTxChannelBS(
2019-05-08 20:11:53 +00:00
DeviceAPI *deviceAPI)
{
(void) deviceAPI;
return nullptr;
}
2019-05-09 15:27:12 +00:00
virtual ChannelAPI* createTxChannelCS(
2019-05-08 20:11:53 +00:00
DeviceAPI *deviceAPI)
{
(void) deviceAPI;
return nullptr;
}
2017-12-17 22:15:42 +00:00
// device source plugins only
2016-10-13 20:23:43 +00:00
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
(void) sourceId;
(void) widget;
(void) deviceUISet;
return nullptr;
}
virtual DeviceSampleSource* createSampleSourcePluginInstanceInput( // creates the input "core"
const QString& sourceId,
2019-05-08 20:11:53 +00:00
DeviceAPI *deviceAPI)
{
(void) sourceId;
(void) deviceAPI;
return nullptr;
}
virtual void deleteSampleSourcePluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
// device sink plugins only
virtual SamplingDevices enumSampleSinks() { return SamplingDevices(); }
virtual PluginInstanceGUI* createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
(void) sinkId;
(void) widget;
(void) deviceUISet;
return nullptr;
}
virtual DeviceSampleSink* createSampleSinkPluginInstanceOutput( // creates the output "core"
const QString& sinkId,
2019-05-08 20:11:53 +00:00
DeviceAPI *deviceAPI)
{
(void) sinkId;
(void) deviceAPI;
return nullptr;
}
virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
// 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;
}
virtual DeviceSampleMIMO* createSampleMIMOPluginInstanceMIMO( // creates the MIMO "core"
const QString& mimoId,
DeviceAPI *deviceAPI)
{
(void) mimoId;
(void) deviceAPI;
return nullptr;
}
virtual void deleteSampleMIMOPluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleMIMOPluginInstanceMIMO(DeviceSampleMIMO *mimo);
};
2015-10-05 02:47:23 +00:00
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");
#endif // INCLUDE_PLUGININTERFACE_H