2014-05-18 16:52:39 +01:00
# ifndef INCLUDE_PLUGININTERFACE_H
# define INCLUDE_PLUGININTERFACE_H
# include <QtPlugin>
# include <QString>
2018-03-03 20:23:38 +01:00
# include "util/export.h"
struct SDRBASE_API PluginDescriptor {
2014-05-18 16:52:39 +01:00
// general plugin description
const QString displayedName ;
const QString version ;
const QString copyright ;
const QString website ;
bool licenseIsGPL ;
const QString sourceCodeURL ;
} ;
class PluginAPI ;
2016-10-11 01:17:55 +02:00
class DeviceSourceAPI ;
2017-10-30 00:02:28 +01:00
class DeviceUISet ;
2016-10-14 18:47:19 +02:00
class DeviceSinkAPI ;
2017-09-26 00:22:08 +02:00
class PluginInstanceGUI ;
2016-05-17 03:41:01 +02:00
class QWidget ;
2017-09-14 08:49:31 +02:00
class DeviceSampleSource ;
class DeviceSampleSink ;
2017-11-08 08:31:00 +01:00
class BasebandSampleSink ;
class BasebandSampleSource ;
2017-12-17 23:15:42 +01:00
class ChannelSinkAPI ;
class ChannelSourceAPI ;
2014-05-18 16:52:39 +01:00
2018-03-03 20:23:38 +01:00
class SDRBASE_API PluginInterface {
2014-05-18 16:52:39 +01:00
public :
2016-10-13 22:23:43 +02:00
struct SamplingDevice
2015-09-30 06:57:40 +02:00
{
2017-11-01 20:06:33 +01:00
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 ...)
2017-11-02 09:17:38 +01:00
QString serial ; //!< The device serial number defined by the vendor or a fake one (SDRplay)
2017-11-01 20:06:33 +01: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
bool rxElseTx ; //!< This is the Rx part else the Tx part of the device
2017-11-19 01:05:16 +01:00
int deviceNbItems ; //!< Number of items (or streams) in the device. >1 for composite devices.
2017-11-01 20:06:33 +01: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 06:57:40 +02:00
2016-10-13 22:23:43 +02:00
SamplingDevice ( const QString & _displayedName ,
2016-12-29 12:41:10 +01:00
const QString & _hardwareId ,
2015-09-30 06:57:40 +02:00
const QString & _id ,
const QString & _serial ,
2017-11-01 10:37:00 +01:00
int _sequence ,
2017-11-01 20:06:33 +01:00
SamplingDeviceType _type ,
2017-11-01 10:37:00 +01:00
bool _rxElseTx ,
2017-11-19 01:05:16 +01:00
int _deviceNbItems ,
2017-11-01 10:37:00 +01:00
int _deviceItemIndex ) :
2014-05-18 16:52:39 +01:00
displayedName ( _displayedName ) ,
2016-12-29 12:41:10 +01:00
hardwareId ( _hardwareId ) ,
2015-09-30 06:57:40 +02:00
id ( _id ) ,
serial ( _serial ) ,
2017-11-01 10:37:00 +01:00
sequence ( _sequence ) ,
2017-11-01 20:06:33 +01:00
type ( _type ) ,
2017-11-01 10:37:00 +01:00
rxElseTx ( _rxElseTx ) ,
2017-11-19 01:05:16 +01:00
deviceNbItems ( _deviceNbItems ) ,
2017-11-01 10:37:00 +01:00
deviceItemIndex ( _deviceItemIndex ) ,
claimed ( - 1 )
2014-05-18 16:52:39 +01:00
{ }
} ;
2016-10-13 22:23:43 +02:00
typedef QList < SamplingDevice > SamplingDevices ;
2014-05-18 16:52:39 +01:00
virtual ~ PluginInterface ( ) { } ;
virtual const PluginDescriptor & getPluginDescriptor ( ) const = 0 ;
virtual void initPlugin ( PluginAPI * pluginAPI ) = 0 ;
2016-10-13 23:42:08 +02:00
// channel Rx plugins
2017-10-30 01:11:35 +01:00
2017-11-07 23:49:27 +01:00
virtual PluginInstanceGUI * createRxChannelGUI (
2017-11-09 01:03:05 +01:00
DeviceUISet * deviceUISet __attribute__ ( ( unused ) ) ,
BasebandSampleSink * rxChannel __attribute__ ( ( unused ) ) )
2017-10-31 00:07:55 +01:00
{ return 0 ; }
2014-05-18 16:52:39 +01:00
2017-12-23 09:54:42 +01:00
virtual BasebandSampleSink * createRxChannelBS (
2017-11-08 08:31:00 +01:00
DeviceSourceAPI * deviceAPI __attribute__ ( ( unused ) ) )
{ return 0 ; }
2017-12-23 09:54:42 +01:00
virtual ChannelSinkAPI * createRxChannelCS (
2017-12-17 23:15:42 +01:00
DeviceSourceAPI * deviceAPI __attribute__ ( ( unused ) ) )
2017-12-23 05:56:40 +01:00
{ return 0 ; }
2017-12-17 23:15:42 +01:00
2017-11-08 08:31:00 +01:00
// channel Tx plugins
2017-10-30 01:11:35 +01:00
2017-11-08 00:05:49 +01:00
virtual PluginInstanceGUI * createTxChannelGUI (
2017-11-08 22:54:58 +01:00
DeviceUISet * deviceUISet __attribute__ ( ( unused ) ) ,
BasebandSampleSource * txChannel __attribute__ ( ( unused ) ) )
2017-11-01 00:00:03 +01:00
{ return 0 ; }
2016-10-14 18:47:19 +02:00
2017-12-23 09:54:42 +01:00
virtual BasebandSampleSource * createTxChannelBS (
2017-11-08 08:31:00 +01:00
DeviceSinkAPI * deviceAPI __attribute__ ( ( unused ) ) )
{ return 0 ; }
2017-12-23 09:54:42 +01:00
virtual ChannelSourceAPI * createTxChannelCS (
2017-12-23 05:56:40 +01:00
DeviceSinkAPI * deviceAPI __attribute__ ( ( unused ) ) )
{ return 0 ; }
2017-12-17 23:15:42 +01:00
// device source plugins only
2017-10-30 01:11:35 +01:00
2016-10-13 22:23:43 +02:00
virtual SamplingDevices enumSampleSources ( ) { return SamplingDevices ( ) ; }
2017-10-30 00:02:28 +01:00
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI (
const QString & sourceId __attribute__ ( ( unused ) ) ,
QWidget * * widget __attribute__ ( ( unused ) ) ,
DeviceUISet * deviceUISet __attribute__ ( ( unused ) ) )
{ return 0 ; }
2017-09-14 08:49:31 +02:00
virtual DeviceSampleSource * createSampleSourcePluginInstanceInput ( const QString & sourceId __attribute__ ( ( unused ) ) , DeviceSourceAPI * deviceAPI __attribute__ ( ( unused ) ) ) { return 0 ; } // creates the input "core"
2017-09-26 00:22:08 +02:00
virtual void deleteSampleSourcePluginInstanceGUI ( PluginInstanceGUI * ui ) ;
2017-09-16 10:45:08 +02:00
virtual void deleteSampleSourcePluginInstanceInput ( DeviceSampleSource * source ) ;
2016-10-14 18:47:19 +02:00
// device sink plugins only
2017-10-30 01:11:35 +01:00
2016-10-14 18:47:19 +02:00
virtual SamplingDevices enumSampleSinks ( ) { return SamplingDevices ( ) ; }
2017-10-30 01:11:35 +01:00
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"
2017-09-26 00:22:08 +02:00
virtual void deleteSampleSinkPluginInstanceGUI ( PluginInstanceGUI * ui ) ;
2017-09-16 11:34:25 +02:00
virtual void deleteSampleSinkPluginInstanceOutput ( DeviceSampleSink * sink ) ;
2014-05-18 16:52:39 +01:00
} ;
2015-10-05 04:47:23 +02:00
Q_DECLARE_INTERFACE ( PluginInterface , " SDRangel.PluginInterface/0.1 " ) ;
2014-05-18 16:52:39 +01:00
# endif // INCLUDE_PLUGININTERFACE_H