1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Removed PluginInstanceGUI reference in DeviceAPI

This commit is contained in:
f4exb 2020-10-03 06:58:57 +02:00
parent efaba0fa67
commit 315c64c8c7
5 changed files with 29 additions and 82 deletions

View File

@ -15,7 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "plugin/plugininstancegui.h"
#include "plugin/plugininterface.h"
#include "dsp/dspdevicesourceengine.h"
#include "dsp/dspdevicesinkengine.h"
@ -45,7 +44,6 @@ DeviceAPI::DeviceAPI(
m_pluginInterface(nullptr),
m_masterTimer(DSPEngine::instance()->getMasterTimer()),
m_samplingDeviceSequence(0),
m_samplingDevicePluginInstanceUI(0),
m_buddySharedPtr(nullptr),
m_isBuddyLeader(false),
m_deviceSourceEngine(deviceSourceEngine),
@ -352,11 +350,6 @@ void DeviceAPI::setSamplingDevicePluginInterface(PluginInterface *iface)
m_pluginInterface = iface;
}
void DeviceAPI::setSamplingDevicePluginInstanceGUI(PluginInstanceGUI *gui)
{
m_samplingDevicePluginInstanceUI = gui;
}
void DeviceAPI::getDeviceEngineStateStr(QString& state, int subsystemIndex)
{
if (m_deviceSourceEngine)
@ -479,11 +472,7 @@ void DeviceAPI::loadSamplingDeviceSettings(const Preset* preset)
qDebug("DeviceAPI::loadSamplingDeviceSettings: deserializing source %s[%d]: %s",
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
if (m_samplingDevicePluginInstanceUI != 0) // GUI flavor
{
m_samplingDevicePluginInstanceUI->deserialize(*sourceConfig);
}
else if (m_deviceSourceEngine->getSource() != 0) // Server flavor
if (m_deviceSourceEngine->getSource() != 0) // Server flavor
{
m_deviceSourceEngine->getSource()->deserialize(*sourceConfig);
}
@ -499,11 +488,7 @@ void DeviceAPI::loadSamplingDeviceSettings(const Preset* preset)
}
// set center frequency anyway
if (m_samplingDevicePluginInstanceUI != 0) // GUI flavor
{
m_samplingDevicePluginInstanceUI->setCenterFrequency(centerFrequency);
}
else if (m_deviceSourceEngine->getSource() != 0) // Server flavor
if (m_deviceSourceEngine->getSource() != 0) // Server flavor
{
m_deviceSourceEngine->getSource()->setCenterFrequency(centerFrequency);
}
@ -525,12 +510,7 @@ void DeviceAPI::loadSamplingDeviceSettings(const Preset* preset)
qDebug("DeviceAPI::loadSamplingDeviceSettings: deserializing sink %s[%d]: %s",
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
if (m_samplingDevicePluginInstanceUI != 0) // GUI flavor
{
m_samplingDevicePluginInstanceUI->deserialize(*sinkConfig);
m_samplingDevicePluginInstanceUI->setCenterFrequency(centerFrequency);
}
else if (m_deviceSinkEngine->getSink() != 0) // Server flavor
if (m_deviceSinkEngine->getSink() != 0) // Server flavor
{
m_deviceSinkEngine->getSink()->deserialize(*sinkConfig);
m_deviceSinkEngine->getSink()->setCenterFrequency(centerFrequency);
@ -559,12 +539,7 @@ void DeviceAPI::loadSamplingDeviceSettings(const Preset* preset)
qDebug("DeviceAPI::loadSamplingDeviceSettings: deserializing MIMO %s[%d]: %s",
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
if (m_samplingDevicePluginInstanceUI != 0) // GUI flavor
{
m_samplingDevicePluginInstanceUI->deserialize(*mimoConfig);
m_samplingDevicePluginInstanceUI->setCenterFrequency(centerFrequency);
}
else if (m_deviceSinkEngine->getSink() != 0) // Server flavor
if (m_deviceSinkEngine->getSink() != 0) // Server flavor
{
m_deviceSinkEngine->getSink()->deserialize(*mimoConfig);
m_deviceSinkEngine->getSink()->setCenterFrequency(centerFrequency);
@ -593,12 +568,7 @@ void DeviceAPI::saveSamplingDeviceSettings(Preset* preset)
qDebug("DeviceAPI::saveSamplingDeviceSettings: serializing source %s[%d]: %s",
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
if (m_samplingDevicePluginInstanceUI) // GUI flavor
{
preset->addOrUpdateDeviceConfig(m_samplingDeviceId, m_samplingDeviceSerial, m_samplingDeviceSequence, m_samplingDevicePluginInstanceUI->serialize());
preset->setCenterFrequency(m_samplingDevicePluginInstanceUI->getCenterFrequency());
}
else if (m_deviceSourceEngine->getSource()) // Server flavor
if (m_deviceSourceEngine->getSource()) // Server flavor
{
preset->addOrUpdateDeviceConfig(m_samplingDeviceId, m_samplingDeviceSerial, m_samplingDeviceSequence, m_deviceSourceEngine->getSource()->serialize());
preset->setCenterFrequency(m_deviceSourceEngine->getSource()->getCenterFrequency());
@ -613,12 +583,7 @@ void DeviceAPI::saveSamplingDeviceSettings(Preset* preset)
qDebug("DeviceAPI::saveSamplingDeviceSettings: serializing sink %s[%d]: %s",
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
if (m_samplingDevicePluginInstanceUI) // GUI flavor
{
preset->addOrUpdateDeviceConfig(m_samplingDeviceId, m_samplingDeviceSerial, m_samplingDeviceSequence, m_deviceSinkEngine->getSink()->serialize());
preset->setCenterFrequency(m_deviceSinkEngine->getSink()->getCenterFrequency());
}
else if (m_deviceSinkEngine->getSink()) // Server flavor
if (m_deviceSinkEngine->getSink()) // Server flavor
{
preset->addOrUpdateDeviceConfig(m_samplingDeviceId, m_samplingDeviceSerial, m_samplingDeviceSequence, m_deviceSinkEngine->getSink()->serialize());
preset->setCenterFrequency(m_deviceSinkEngine->getSink()->getCenterFrequency());
@ -633,12 +598,7 @@ void DeviceAPI::saveSamplingDeviceSettings(Preset* preset)
qDebug("DeviceAPI::saveSamplingDeviceSettings: serializing MIMO %s[%d]: %s",
qPrintable(m_samplingDeviceId), m_samplingDeviceSequence, qPrintable(m_samplingDeviceSerial));
if (m_samplingDevicePluginInstanceUI) // GUI flavor
{
preset->addOrUpdateDeviceConfig(m_samplingDeviceId, m_samplingDeviceSerial, m_samplingDeviceSequence, m_deviceMIMOEngine->getMIMO()->serialize());
preset->setCenterFrequency(m_deviceMIMOEngine->getMIMO()->getMIMOCenterFrequency());
}
else if (m_deviceMIMOEngine->getMIMO()) // Server flavor
if (m_deviceMIMOEngine->getMIMO()) // Server flavor
{
preset->addOrUpdateDeviceConfig(m_samplingDeviceId, m_samplingDeviceSerial, m_samplingDeviceSequence, m_deviceMIMOEngine->getMIMO()->serialize());
preset->setCenterFrequency(m_deviceMIMOEngine->getMIMO()->getMIMOCenterFrequency());

View File

@ -33,7 +33,6 @@ class DeviceSampleSource;
class DeviceSampleMIMO;
class MessageQueue;
class PluginInterface;
class PluginInstanceGUI;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
class DSPDeviceMIMOEngine;
@ -110,7 +109,6 @@ public:
void setSamplingDeviceSequence(int sequence) { m_samplingDeviceSequence = sequence; }
void setHardwareUserArguments(const QString& userArguments) { m_hardwareUserArguments = userArguments; }
void setSamplingDevicePluginInterface(PluginInterface *iface);
void setSamplingDevicePluginInstanceGUI(PluginInstanceGUI *gui);
const QString& getHardwareId() const { return m_hardwareId; }
const QString& getSamplingDeviceId() const { return m_samplingDeviceId; }
@ -127,8 +125,6 @@ public:
int getDeviceSetIndex() const { return m_deviceTabIndex; }
PluginInterface *getPluginInterface() { return m_pluginInterface; }
PluginInstanceGUI *getSamplingDevicePluginInstanceGUI() { return m_samplingDevicePluginInstanceUI; }
void getDeviceEngineStateStr(QString& state, int subsystemIndex = 0);
ChannelAPI *getChanelSinkAPIAt(int index);
@ -185,7 +181,6 @@ protected:
QString m_samplingDeviceDisplayName; //!< The human readable name identifying this instance
uint32_t m_samplingDeviceSequence; //!< The device sequence. >0 when more than one device of the same type is connected
QString m_hardwareUserArguments; //!< User given arguments to be used at hardware level i.e. for the hardware device and device sequence
PluginInstanceGUI* m_samplingDevicePluginInstanceUI;
// Buddies (single Rx or single Tx)

View File

@ -54,6 +54,7 @@ DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer)
m_spectrumGUI->setBuddies(m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow;
m_deviceAPI = nullptr;
m_deviceGUI = nullptr;
m_deviceSourceEngine = nullptr;
m_deviceSinkEngine = nullptr;
m_deviceMIMOEngine = nullptr;

View File

@ -45,6 +45,7 @@ public:
GLSpectrumGUI *m_spectrumGUI;
ChannelWindow *m_channelWindow;
DeviceAPI *m_deviceAPI;
PluginInstanceGUI *m_deviceGUI;
DSPDeviceSourceEngine *m_deviceSourceEngine;
DSPDeviceSinkEngine *m_deviceSinkEngine;
DSPDeviceMIMOEngine *m_deviceMIMOEngine;

View File

@ -359,9 +359,7 @@ void MainWindow::addSourceDevice(int deviceIndex)
ui->inputViewDock->setSelectedDeviceIndex(deviceTabIndex, deviceIndex);
// delete previous plugin GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
DeviceSampleSource *source = m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceId(), m_deviceUIs.back()->m_deviceAPI);
@ -372,7 +370,7 @@ void MainWindow::addSourceDevice(int deviceIndex)
&gui,
m_deviceUIs.back());
m_deviceUIs.back()->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginGUI);
m_deviceUIs.back()->m_deviceGUI = pluginGUI;
m_deviceUIs.back()->m_deviceAPI->getSampleSource()->init();
setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceDisplayName());
}
@ -431,19 +429,18 @@ void MainWindow::addSinkDevice()
ui->inputViewDock->setSelectedDeviceIndex(deviceTabIndex, fileSinkDeviceIndex);
// delete previous plugin GUI if it exists
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
DeviceSampleSink *sink = m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceId(), m_deviceUIs.back()->m_deviceAPI);
m_deviceUIs.back()->m_deviceAPI->setSampleSink(sink);
QWidget *gui;
PluginInstanceGUI *pluginUI = m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
PluginInstanceGUI *pluginGUI = m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceId(),
&gui,
m_deviceUIs.back());
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginUI);
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
m_deviceUIs.back()->m_deviceGUI = pluginGUI;
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->init();
setDeviceGUI(deviceTabIndex, gui, m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceDisplayName(), 1);
}
@ -463,8 +460,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and input object
m_deviceUIs.back()->freeChannels(); // destroys the channel instances
m_deviceUIs.back()->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(0); // have source stop sending messages to the GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceAPI->getSampleSource());
@ -503,8 +499,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and output object
m_deviceUIs.back()->freeChannels();
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
m_deviceUIs.back()->m_deviceAPI->getSampleSink());
@ -544,8 +539,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and output object
m_deviceUIs.back()->freeChannels();
m_deviceUIs.back()->m_deviceAPI->getSampleMIMO()->setMessageQueueToGUI(nullptr); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceGUI(
m_deviceUIs.back()->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceMIMO(
m_deviceUIs.back()->m_deviceAPI->getSampleMIMO());
@ -1712,11 +1706,9 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex)
// deletes old UI and input object
deviceUI->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(nullptr); // have source stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceGUI);
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
deviceUI->m_deviceAPI->getSampleSource());
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(deviceUI->m_deviceAPI->getSampleSource());
deviceUI->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(newDeviceIndex);
@ -1791,12 +1783,12 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex)
deviceUI->m_deviceAPI->getSamplingDeviceId(), deviceUI->m_deviceAPI);
deviceUI->m_deviceAPI->setSampleSource(source);
QWidget *gui;
PluginInstanceGUI *pluginUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
PluginInstanceGUI *pluginGUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDeviceId(),
&gui,
deviceUI);
deviceUI->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginUI);
deviceUI->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
deviceUI->m_deviceGUI = pluginGUI;
setDeviceGUI(tabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName());
deviceUI->m_deviceAPI->getSampleSource()->init();
@ -1821,11 +1813,9 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex)
// deletes old UI and output object
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDevicePluginInstanceGUI());
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceGUI);
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
deviceUI->m_deviceAPI->getSampleSink());
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(deviceUI->m_deviceAPI->getSampleSink());
deviceUI->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(newDeviceIndex);
@ -1898,12 +1888,12 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex)
deviceUI->m_deviceAPI->getSamplingDeviceId(), deviceUI->m_deviceAPI);
deviceUI->m_deviceAPI->setSampleSink(sink);
QWidget *gui;
PluginInstanceGUI *pluginUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
PluginInstanceGUI *pluginGUI = deviceUI->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstanceGUI(
deviceUI->m_deviceAPI->getSamplingDeviceId(),
&gui,
deviceUI);
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(pluginUI->getInputMessageQueue());
deviceUI->m_deviceAPI->setSamplingDevicePluginInstanceGUI(pluginUI);
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(pluginGUI->getInputMessageQueue());
deviceUI->m_deviceGUI = pluginGUI;
setDeviceGUI(tabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName(), 1);
deviceUI->m_deviceAPI->getSampleSink()->init();