1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#ifndef INCLUDE_PLUGININTERFACE_H
#define INCLUDE_PLUGININTERFACE_H
#include <QtPlugin>
#include <QString>
struct PluginDescriptor {
// general plugin description
const QString displayedName;
const QString version;
const QString copyright;
const QString website;
bool licenseIsGPL;
const QString sourceCodeURL;
};
class PluginAPI;
class DeviceSourceAPI;
class DeviceUISet;
class DeviceSinkAPI;
class PluginInstanceGUI;
class QWidget;
class DeviceSampleSource;
class DeviceSampleSink;
class PluginInterface {
public:
struct SamplingDevice
{
enum SamplingDeviceType
{
PhysicalDevice,
BuiltInDevice
};
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
bool rxElseTx; //!< This is the Rx part else the Tx part of the device
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
SamplingDevice(const QString& _displayedName,
const QString& _hardwareId,
const QString& _id,
const QString& _serial,
int _sequence,
SamplingDeviceType _type,
bool _rxElseTx,
int _deviceItemIndex) :
displayedName(_displayedName),
hardwareId(_hardwareId),
id(_id),
serial(_serial),
sequence(_sequence),
type(_type),
rxElseTx(_rxElseTx),
deviceItemIndex(_deviceItemIndex),
claimed(-1)
{ }
};
typedef QList<SamplingDevice> SamplingDevices;
virtual ~PluginInterface() { };
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
// channel Rx plugins
virtual PluginInstanceGUI* createRxChannelGUI(
const QString& channelName __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)) )
{ return 0; }
// channel Tx plugins
virtual PluginInstanceGUI* createTxChannel(
const QString& channelName __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)) )
{ return 0; }
// device source plugins only
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
virtual PluginInstanceGUI* createSampleSourcePluginInstanceGUI(
const QString& sourceId __attribute__((unused)),
QWidget **widget __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)))
{ return 0; }
virtual DeviceSampleSource* createSampleSourcePluginInstanceInput(const QString& sourceId __attribute__((unused)), DeviceSourceAPI *deviceAPI __attribute__((unused))) { return 0; } // creates the input "core"
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 __attribute__((unused)),
QWidget **widget __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)))
{ return 0; }
virtual DeviceSampleSink* createSampleSinkPluginInstanceOutput(const QString& sinkId __attribute__((unused)), DeviceSinkAPI *deviceAPI __attribute__((unused))) { return 0; } // creates the output "core"
virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
};
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");
#endif // INCLUDE_PLUGININTERFACE_H
|