1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 16:38:37 -05:00
sdrangel/sdrbase/plugin/plugininterface.h

78 lines
2.9 KiB
C
Raw Normal View History

#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 DeviceSinkAPI;
class PluginInstanceUI;
class QWidget;
class DeviceSampleSource;
class DeviceSampleSink;
class PluginInterface {
public:
2016-10-13 16:23:43 -04:00
struct SamplingDevice
{
QString displayedName;
2016-12-29 06:41:10 -05:00
QString hardwareId;
QString id;
QString serial;
int sequence;
2016-10-13 16:23:43 -04:00
SamplingDevice(const QString& _displayedName,
2016-12-29 06:41:10 -05:00
const QString& _hardwareId,
const QString& _id,
const QString& _serial,
int _sequence) :
displayedName(_displayedName),
2016-12-29 06:41:10 -05:00
hardwareId(_hardwareId),
id(_id),
serial(_serial),
sequence(_sequence)
{ }
};
2016-10-13 16:23:43 -04:00
typedef QList<SamplingDevice> SamplingDevices;
virtual ~PluginInterface() { };
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
2016-10-13 17:42:08 -04:00
// channel Rx plugins
virtual PluginInstanceUI* createRxChannel(const QString& channelName __attribute__((unused)), DeviceSourceAPI *deviceAPI __attribute__((unused)) ) { return 0; }
// channel Tx plugins
virtual PluginInstanceUI* createTxChannel(const QString& channelName __attribute__((unused)), DeviceSinkAPI *deviceAPI __attribute__((unused)) ) { return 0; }
// device source plugins only
2016-10-13 16:23:43 -04:00
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
virtual PluginInstanceUI* createSampleSourcePluginInstanceGUI(const QString& sourceId __attribute__((unused)), QWidget **widget __attribute__((unused)), DeviceSourceAPI *deviceAPI __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(PluginInstanceUI *ui);
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
// device sink plugins only
virtual SamplingDevices enumSampleSinks() { return SamplingDevices(); }
virtual PluginInstanceUI* createSampleSinkPluginInstanceGUI(const QString& sinkId __attribute__((unused)), QWidget **widget __attribute__((unused)), DeviceSinkAPI *deviceAPI __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(PluginInstanceUI *ui);
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
};
2015-10-04 22:47:23 -04:00
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");
#endif // INCLUDE_PLUGININTERFACE_H