mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
git clone git://git.osmocom.org/sdrangelove.git
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#ifndef INCLUDE_PLUGINAPI_H
|
||||
#define INCLUDE_PLUGINAPI_H
|
||||
|
||||
#include <QObject>
|
||||
#include "util/export.h"
|
||||
|
||||
class QDockWidget;
|
||||
class QAction;
|
||||
|
||||
class PluginManager;
|
||||
class PluginInterface;
|
||||
class SampleSource;
|
||||
class SampleSink;
|
||||
class DSPEngine;
|
||||
class AudioFifo;
|
||||
class MessageQueue;
|
||||
class MainWindow;
|
||||
class ChannelMarker;
|
||||
class PluginGUI;
|
||||
|
||||
class SDRANGELOVE_API PluginAPI : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// MainWindow access
|
||||
QDockWidget* createMainWindowDock(Qt::DockWidgetArea dockWidgetArea, const QString& title);
|
||||
MessageQueue* getMainWindowMessageQueue();
|
||||
void setInputGUI(QWidget* inputGUI);
|
||||
|
||||
// Channel stuff
|
||||
void registerChannel(const QString& channelName, PluginInterface* plugin, QAction* action);
|
||||
void registerChannelInstance(const QString& channelName, PluginGUI* pluginGUI);
|
||||
void addChannelRollup(QWidget* pluginGUI);
|
||||
void removeChannelInstance(PluginGUI* pluginGUI);
|
||||
|
||||
void addChannelMarker(ChannelMarker* channelMarker);
|
||||
void removeChannelMarker(ChannelMarker* channelMarker);
|
||||
|
||||
// DSPEngine access
|
||||
void setSampleSource(SampleSource* sampleSource);
|
||||
void addSampleSink(SampleSink* sampleSink);
|
||||
void removeSampleSink(SampleSink* sampleSink);
|
||||
MessageQueue* getDSPEngineMessageQueue();
|
||||
void addAudioSource(AudioFifo* audioFifo);
|
||||
void removeAudioSource(AudioFifo* audioFifo);
|
||||
|
||||
// Sample Source stuff
|
||||
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
|
||||
|
||||
protected:
|
||||
PluginManager* m_pluginManager;
|
||||
MainWindow* m_mainWindow;
|
||||
DSPEngine* m_dspEngine;
|
||||
|
||||
PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow, DSPEngine* dspEngine);
|
||||
|
||||
friend class PluginManager;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PLUGINAPI_H
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef INCLUDE_PLUGINGUI_H
|
||||
#define INCLUDE_PLUGINGUI_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "util/export.h"
|
||||
|
||||
class Message;
|
||||
|
||||
class SDRANGELOVE_API PluginGUI {
|
||||
public:
|
||||
PluginGUI() { };
|
||||
virtual void destroy() = 0;
|
||||
|
||||
virtual void setName(const QString& name) = 0;
|
||||
|
||||
virtual void resetToDefaults() = 0;
|
||||
|
||||
virtual QByteArray serializeGeneral() const;
|
||||
virtual bool deserializeGeneral(const QByteArray& data);
|
||||
virtual quint64 getCenterFrequency() const;
|
||||
|
||||
virtual QByteArray serialize() const = 0;
|
||||
virtual bool deserialize(const QByteArray& data) = 0;
|
||||
|
||||
virtual bool handleMessage(Message* message) = 0;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PLUGINGUI_H
|
||||
@@ -0,0 +1,48 @@
|
||||
#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 PluginGUI;
|
||||
|
||||
class PluginInterface {
|
||||
public:
|
||||
struct SampleSourceDevice {
|
||||
QString displayedName;
|
||||
QString name;
|
||||
QByteArray address;
|
||||
|
||||
SampleSourceDevice(const QString& _displayedName, const QString& _name, const QByteArray& _address) :
|
||||
displayedName(_displayedName),
|
||||
name(_name),
|
||||
address(_address)
|
||||
{ }
|
||||
};
|
||||
typedef QList<SampleSourceDevice> SampleSourceDevices;
|
||||
|
||||
virtual ~PluginInterface() { };
|
||||
|
||||
virtual const PluginDescriptor& getPluginDescriptor() const = 0;
|
||||
virtual void initPlugin(PluginAPI* pluginAPI) = 0;
|
||||
|
||||
virtual PluginGUI* createChannel(const QString& channelName) { return NULL; }
|
||||
|
||||
virtual SampleSourceDevices enumSampleSources() { return SampleSourceDevices(); }
|
||||
virtual PluginGUI* createSampleSource(const QString& sourceName, const QByteArray& address) { return NULL; }
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(PluginInterface, "de.maintech.SDRangelove.PluginInterface/0.1");
|
||||
|
||||
#endif // INCLUDE_PLUGININTERFACE_H
|
||||
Reference in New Issue
Block a user