Multi device support: code cleanup in plugin manager and API

pull/6/head
f4exb 2016-05-16 10:35:36 +02:00
rodzic 8503b29805
commit 2893d7bb06
7 zmienionych plików z 6 dodań i 202 usunięć

Wyświetl plik

@ -361,7 +361,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAP
ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
{
m_pluginAPI->removeChannelInstance(this);
m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
delete m_channelAnalyzer;

Wyświetl plik

@ -244,7 +244,7 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pare
AMDemodGUI::~AMDemodGUI()
{
m_pluginAPI->removeChannelInstance(this);
m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
delete m_amDemod;

Wyświetl plik

@ -416,7 +416,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa
BFMDemodGUI::~BFMDemodGUI()
{
m_pluginAPI->removeChannelInstance(this);
m_pluginAPI->removeThreadedSink(m_threadedChannelizer);
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
delete m_threadedChannelizer;
delete m_channelizer;
delete m_bfmDemod;

Wyświetl plik

@ -3,17 +3,6 @@
#include "plugin/pluginmanager.h"
#include "mainwindow.h"
// This was used in Tetra demod plugin which is not part of the build anymore
//QDockWidget* PluginAPI::createMainWindowDock(Qt::DockWidgetArea dockWidgetArea, const QString& title)
//{
// QDockWidget* dock = new QDockWidget(title, m_mainWindow);
// dock->setAllowedAreas(Qt::AllDockWidgetAreas);
// dock->setAttribute(Qt::WA_DeleteOnClose);
// m_mainWindow->addDockWidget(dockWidgetArea, dock);
// m_mainWindow->addViewAction(dock->toggleViewAction());
// return dock;
//}
MessageQueue* PluginAPI::getMainWindowMessageQueue()
{
return m_mainWindow->getInputMessageQueue();
@ -34,106 +23,16 @@ void PluginAPI::registerChannelInstance(const QString& channelName, PluginGUI* p
m_pluginManager->registerChannelInstance(channelName, pluginGUI);
}
void PluginAPI::addChannelRollup(QWidget* pluginGUI)
{
m_pluginManager->addChannelRollup(pluginGUI);
}
void PluginAPI::removeChannelInstance(PluginGUI* pluginGUI)
{
m_pluginManager->removeChannelInstance(pluginGUI);
}
void PluginAPI::addChannelMarker(ChannelMarker* channelMarker)
{
m_pluginManager->addChannelMarker(channelMarker);
}
void PluginAPI::removeChannelMarker(ChannelMarker* channelMarker)
{
m_pluginManager->removeChannelMarker(channelMarker);
}
void PluginAPI::registerSampleSource(const QString& sourceName, PluginInterface* plugin)
{
m_pluginManager->registerSampleSource(sourceName, plugin);
}
//void PluginAPI::addSink(SampleSink* sink)
//{
// m_pluginManager->addSink(sink);
//}
//void PluginAPI::removeSink(SampleSink* sink)
//{
// m_pluginManager->removeSink(sink);
//}
void PluginAPI::addThreadedSink(ThreadedSampleSink* sink)
{
m_pluginManager->addThreadedSink(sink);
}
void PluginAPI::removeThreadedSink(ThreadedSampleSink* sink)
{
m_pluginManager->removeThreadedSink(sink);
}
//void PluginAPI::setSource(SampleSource* source)
//{
// m_pluginManager->setSource(source);
//}
//bool PluginAPI::initAcquisition()
//{
// return m_pluginManager->initAcquisition();
//}
//
//bool PluginAPI::startAcquisition()
//{
// return m_pluginManager->startAcquisition();
//}
//
//void PluginAPI::stopAcquistion()
//{
// m_pluginManager->stopAcquistion();
//}
//DSPDeviceEngine::State PluginAPI::state() const
//{
// return m_pluginManager->state();
//}
//
//QString PluginAPI::errorMessage()
//{
// return m_pluginManager->errorMessage();
//}
//uint PluginAPI::getDeviceUID() const
//{
// return m_pluginManager->getDeviceUID();
//}
//MessageQueue *PluginAPI::getDeviceInputMessageQueue()
//{
// return m_pluginManager->getDeviceInputMessageQueue();
//}
//
//MessageQueue *PluginAPI::getDeviceOutputMessageQueue()
//{
// return m_pluginManager->getDeviceOutputMessageQueue();
//}
//void PluginAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
//{
// m_pluginManager->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
//}
//GLSpectrum *PluginAPI::getSpectrum()
//{
// return m_pluginManager->getSpectrum();
//}
PluginAPI::PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow) :
QObject(mainWindow),
m_pluginManager(pluginManager),

Wyświetl plik

@ -3,21 +3,13 @@
#include <QObject>
#include "util/export.h"
#include "dsp/dspdeviceengine.h"
class QString;
class PluginManager;
class PluginInterface;
class SampleSource;
class SampleSink;
class DSPEngine;
class AudioFifo;
class MessageQueue;
class MainWindow;
class ChannelMarker;
class ThreadedSampleSink;
class GLSpectrum;
class MessageQueue;
class PluginGUI;
class SDRANGEL_API PluginAPI : public QObject {
@ -31,33 +23,11 @@ public:
// Channel stuff
void registerChannel(const QString& channelName, PluginInterface* plugin);
void registerChannelInstance(const QString& channelName, PluginGUI* pluginGUI);
void addChannelRollup(QWidget* pluginGUI);
void removeChannelInstance(PluginGUI* pluginGUI);
void addChannelMarker(ChannelMarker* channelMarker);
void removeChannelMarker(ChannelMarker* channelMarker);
// Sample Source stuff
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
// Device engine stuff
// void addSink(SampleSink* sink); //!< Add a sample sink to device engine
// void removeSink(SampleSink* sink); //!< Remove a sample sink from device engine
void addThreadedSink(ThreadedSampleSink* sink); //!< Add a sample sink that will run on its own thread to device engine
void removeThreadedSink(ThreadedSampleSink* sink); //!< Remove a sample sink that runs on its own thread from device engine
// void setSource(SampleSource* source); //!< Set device engine sample source type
// bool initAcquisition(); //!< Initialize device engine acquisition sequence
// bool startAcquisition(); //!< Start device engine acquisition sequence
// void stopAcquistion(); //!< Stop device engine acquisition sequence
// DSPDeviceEngine::State state() const; //!< device engine state
// QString errorMessage(); //!< Return the current device engine error message
// uint getDeviceUID() const; //!< Return the current device engine unique ID
// MessageQueue *getDeviceInputMessageQueue();
// MessageQueue *getDeviceOutputMessageQueue();
// void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
// GLSpectrum *getSpectrum();
// R/O access to main window
const MainWindow* getMainWindow() const { return m_mainWindow; }

Wyświetl plik

@ -7,9 +7,9 @@
#include "plugin/plugingui.h"
#include "settings/preset.h"
#include "mainwindow.h"
#include "dsp/dspdeviceengine.h"
#include "dsp/samplesource.h"
#include "gui/glspectrum.h"
#include "dsp/dspdeviceengine.h"
#include "util/message.h"
#include <QDebug>
@ -85,47 +85,12 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
}
void PluginManager::addChannelRollup(QWidget* widget)
{
m_mainWindow->addChannelRollup(m_deviceTabIndex, widget);
}
void PluginManager::addChannelMarker(ChannelMarker* channelMarker)
{
m_spectrum->addChannelMarker(channelMarker);
}
void PluginManager::removeChannelMarker(ChannelMarker* channelMarker)
{
m_spectrum->removeChannelMarker(channelMarker);
}
void PluginManager::setInputGUI(QWidget* gui, const QString& sourceDisplayName)
{
//m_mainWindow->setInputGUI(gui);
m_mainWindow->setInputGUI(m_deviceTabIndex, gui, sourceDisplayName);
}
//void PluginManager::addSink(SampleSink* sink)
//{
// m_dspDeviceEngine->addSink(sink);
//}
//void PluginManager::removeSink(SampleSink* sink)
//{
// m_dspDeviceEngine->removeSink(sink);
//}
void PluginManager::addThreadedSink(ThreadedSampleSink* sink)
{
m_dspDeviceEngine->addThreadedSink(sink);
}
void PluginManager::removeThreadedSink(ThreadedSampleSink* sink)
{
m_dspDeviceEngine->removeThreadedSink(sink);
}
void PluginManager::loadSettings(const Preset* preset, DeviceAPI *deviceAPI)
{
fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));

Wyświetl plik

@ -7,19 +7,14 @@
#include "plugin/pluginapi.h"
#include "util/export.h"
class QAction;
class QComboBox;
class QPluginLoader;
class Preset;
class MainWindow;
class SampleSource;
class Message;
class MessageQueue;
class DSPDeviceEngine;
class GLSpectrum;
class SampleSink;
class ThreadedSampleSink;
class ChannelMarker;
class DeviceAPI;
class SDRANGEL_API PluginManager : public QObject {
@ -53,33 +48,8 @@ public:
void removeChannelInstance(PluginGUI* pluginGUI);
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
void addChannelRollup(QWidget* widget);
void addChannelMarker(ChannelMarker* channelMarker);
void removeChannelMarker(ChannelMarker* channelMarker);
void setInputGUI(QWidget* gui, const QString& sourceDisplayName);
// void addSink(SampleSink* sink);
// void removeSink(SampleSink* sink);
void addThreadedSink(ThreadedSampleSink* sink);
void removeThreadedSink(ThreadedSampleSink* sink);
// void setSource(SampleSource* source) { m_dspDeviceEngine->setSource(source); }; //!< Set device engine sample source type
// bool initAcquisition() { return m_dspDeviceEngine->initAcquisition(); } //!< Initialize device engine acquisition sequence
// bool startAcquisition() { return m_dspDeviceEngine->startAcquisition(); } //!< Start device engine acquisition sequence
// void stopAcquistion() { m_dspDeviceEngine->stopAcquistion(); } //!< Stop device engine acquisition sequence
// DSPDeviceEngine::State state() const { return m_dspDeviceEngine->state(); }
// QString errorMessage() { return m_dspDeviceEngine->errorMessage(); } //!< Return the current device engine error message
// uint getDeviceUID() const { return m_dspDeviceEngine->getUID(); } //!< Return the current device engine unique ID
// MessageQueue *getDeviceInputMessageQueue() { return m_dspDeviceEngine->getInputMessageQueue(); }
// MessageQueue *getDeviceOutputMessageQueue() { return m_dspDeviceEngine->getOutputMessageQueue(); }
// void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection) //!< Configure current device engine DSP corrections
// {
// m_dspDeviceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
// }
// GLSpectrum *getSpectrum() { return m_spectrum; }
void loadSettings(const Preset* preset, DeviceAPI *deviceAPI);
void loadSourceSettings(const Preset* preset);
void saveSettings(Preset* preset);