1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00
sdrangel/sdrbase/plugin/pluginapi.h
Jon Beniston 49cb082c7e Add rigctrl plugin.
plugins/misc/rigctrl - Add rigctrl plugin.
sdrbase/plugin/pluginapi.h/.cpp - Add misc plugin registration.
sdrbase/plugin/pluginmanager.h/.cpp - Add misc plugin registration.
sdrbase/plugin/plugininterface.h/.cpp - Add top level UI and global settings serialization callbacks.
sdrbase/settings/mainsettings.h/cpp - Allow plugins to save global settings in main settings file.
sdrgui/mainwindow.cpp - Load settings after plugins are loaded, to allow plugin settings to be loaded and saved.
sdrsrv/maincore.cpp - Support loading/saving of plugin settings.
2020-09-08 15:47:20 +01:00

94 lines
2.8 KiB
C++

#ifndef INCLUDE_PLUGINAPI_H
#define INCLUDE_PLUGINAPI_H
#include <QObject>
#include <QList>
#include "export.h"
#include "plugin/plugininterface.h"
class QString;
class PluginManager;
class MessageQueue;
class PluginInstanceGUI;
class SDRBASE_API PluginAPI : public QObject {
Q_OBJECT
public:
struct SamplingDeviceRegistration //!< This is the device registration
{
QString m_deviceHardwareId;
QString m_deviceId;
PluginInterface* m_plugin;
SamplingDeviceRegistration(const QString& hardwareId, const QString& deviceId, PluginInterface* plugin) :
m_deviceHardwareId(hardwareId),
m_deviceId(deviceId),
m_plugin(plugin)
{ }
};
typedef QList<SamplingDeviceRegistration> SamplingDeviceRegistrations;
struct ChannelRegistration
{
QString m_channelIdURI; //!< Channel type ID in URI form
QString m_channelId; //!< Channel type ID in short form from object name
PluginInterface* m_plugin;
ChannelRegistration(const QString& channelIdURI, const QString& channelId, PluginInterface* plugin) :
m_channelIdURI(channelIdURI),
m_channelId(channelId),
m_plugin(plugin)
{ }
};
typedef QList<ChannelRegistration> ChannelRegistrations;
struct MiscPluginRegistration
{
QString m_id;
PluginInterface* m_plugin;
MiscPluginRegistration(const QString& id, PluginInterface* plugin) :
m_id(id),
m_plugin(plugin)
{ }
};
typedef QList<MiscPluginRegistration> MiscPluginRegistrations;
// Rx Channel stuff
void registerRxChannel(const QString& channelIdURI, const QString& channelId, PluginInterface* plugin);
ChannelRegistrations *getRxChannelRegistrations();
// Tx Channel stuff
void registerTxChannel(const QString& channelIdURI, const QString& channelId, PluginInterface* plugin);
ChannelRegistrations *getTxChannelRegistrations();
// MIMO Channel stuff
void registerMIMOChannel(const QString& channelIdURI, const QString& channelId, PluginInterface* plugin);
ChannelRegistrations *getMIMOChannelRegistrations();
// Sample Source stuff
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
// Sample Sink stuff
void registerSampleSink(const QString& sinkName, PluginInterface* plugin);
// Sample MIMO stuff
void registerSampleMIMO(const QString& sinkName, PluginInterface* plugin);
// Access to top-level GUI and main settings. id should be unique among plugins.
void registerMiscPlugin(const QString& id, PluginInterface* plugin);
protected:
PluginManager* m_pluginManager;
PluginAPI(PluginManager* pluginManager);
~PluginAPI();
friend class PluginManager;
};
#endif // INCLUDE_PLUGINAPI_H