mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-13 06:58:35 -04:00
Tx ph.1: added DeviceSinkAPI implementation (1)
This commit is contained in:
parent
af08f1d851
commit
067a0910c4
@ -174,6 +174,7 @@ set(sdrbase_SOURCES
|
||||
#sdrbase/util/spinlock.cpp
|
||||
|
||||
sdrbase/device/devicesourceapi.cpp
|
||||
sdrbase/device/devicesinkapi.cpp
|
||||
)
|
||||
|
||||
set(sdrbase_HEADERS
|
||||
@ -274,6 +275,7 @@ set(sdrbase_HEADERS
|
||||
#sdrbase/util/spinlock.h
|
||||
|
||||
sdrbase/device/devicesourceapi.h
|
||||
sdrbase/device/devicesinkapi.h
|
||||
)
|
||||
|
||||
set(sdrbase_SOURCES
|
||||
|
345
sdrbase/device/devicesinkapi.cpp
Normal file
345
sdrbase/device/devicesinkapi.cpp
Normal file
@ -0,0 +1,345 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "plugin/plugingui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "plugin/plugininterface.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "gui/channelwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include "settings/preset.h"
|
||||
|
||||
DeviceSinkAPI::DeviceSinkAPI(MainWindow *mainWindow,
|
||||
int deviceTabIndex,
|
||||
DSPDeviceSinkEngine *deviceSinkEngine,
|
||||
GLSpectrum *glSpectrum,
|
||||
ChannelWindow *channelWindow) :
|
||||
m_mainWindow(mainWindow),
|
||||
m_deviceTabIndex(deviceTabIndex),
|
||||
m_deviceSinkEngine(deviceSinkEngine),
|
||||
m_spectrum(glSpectrum),
|
||||
m_channelWindow(channelWindow),
|
||||
m_sampleSinkSequence(0),
|
||||
m_sampleSinkPluginGUI(0)
|
||||
{
|
||||
}
|
||||
|
||||
DeviceSinkAPI::~DeviceSinkAPI()
|
||||
{
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::addSink(BasebandSampleSink *sink)
|
||||
{
|
||||
m_deviceSinkEngine->addSink(sink);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::removeSink(BasebandSampleSink* sink)
|
||||
{
|
||||
m_deviceSinkEngine->removeSink(sink);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::addSource(BasebandSampleSource *source)
|
||||
{
|
||||
m_deviceSinkEngine->addSource(source);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::removeSource(BasebandSampleSource* source)
|
||||
{
|
||||
m_deviceSinkEngine->removeSource(source);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::addThreadedSource(ThreadedBasebandSampleSource* source)
|
||||
{
|
||||
m_deviceSinkEngine->addThreadedSource(source);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::removeThreadedSource(ThreadedBasebandSampleSource* source)
|
||||
{
|
||||
m_deviceSinkEngine->removeThreadedSource(source);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSink(DeviceSampleSink* sink)
|
||||
{
|
||||
m_deviceSinkEngine->setSink(sink);
|
||||
}
|
||||
|
||||
bool DeviceSinkAPI::initGeneration()
|
||||
{
|
||||
return m_deviceSinkEngine->initGeneration();
|
||||
}
|
||||
|
||||
bool DeviceSinkAPI::startGeneration()
|
||||
{
|
||||
return m_deviceSinkEngine->startGeneration();
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::stopGeneration()
|
||||
{
|
||||
m_deviceSinkEngine->stopGeneration();
|
||||
}
|
||||
DSPDeviceSinkEngine::State DeviceSinkAPI::state() const
|
||||
{
|
||||
return m_deviceSinkEngine->state();
|
||||
}
|
||||
|
||||
QString DeviceSinkAPI::errorMessage()
|
||||
{
|
||||
return m_deviceSinkEngine->errorMessage();
|
||||
}
|
||||
|
||||
uint DeviceSinkAPI::getDeviceUID() const
|
||||
{
|
||||
return m_deviceSinkEngine->getUID();
|
||||
}
|
||||
|
||||
MessageQueue *DeviceSinkAPI::getDeviceInputMessageQueue()
|
||||
{
|
||||
return m_deviceSinkEngine->getInputMessageQueue();
|
||||
}
|
||||
|
||||
MessageQueue *DeviceSinkAPI::getDeviceOutputMessageQueue()
|
||||
{
|
||||
return m_deviceSinkEngine->getOutputMessageQueue();
|
||||
}
|
||||
|
||||
GLSpectrum *DeviceSinkAPI::getSpectrum()
|
||||
{
|
||||
return m_spectrum;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::addChannelMarker(ChannelMarker* channelMarker)
|
||||
{
|
||||
m_spectrum->addChannelMarker(channelMarker);
|
||||
}
|
||||
|
||||
ChannelWindow *DeviceSinkAPI::getChannelWindow()
|
||||
{
|
||||
return m_channelWindow;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::addRollupWidget(QWidget *widget)
|
||||
{
|
||||
m_channelWindow->addRollupWidget(widget);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setOutputGUI(QWidget* outputGUI, const QString& sinkDisplayName)
|
||||
{
|
||||
m_mainWindow->setDeviceGUI(m_deviceTabIndex, outputGUI, sinkDisplayName, false);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSampleSinkId(const QString& id)
|
||||
{
|
||||
m_sampleSinkId = id;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSampleSinkSerial(const QString& serial)
|
||||
{
|
||||
m_sampleSinkSerial = serial;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSampleSinkSequence(int sequence)
|
||||
{
|
||||
m_sampleSinkSequence = sequence;
|
||||
m_deviceSinkEngine->setSinkSequence(sequence);
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::setSampleSinkPluginGUI(PluginGUI *gui)
|
||||
{
|
||||
if (m_sampleSinkPluginGUI != 0)
|
||||
{
|
||||
m_sampleSinkPluginGUI->destroy();
|
||||
m_sampleSinkId.clear();
|
||||
}
|
||||
|
||||
m_sampleSinkPluginGUI = gui;
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::registerChannelInstance(const QString& channelName, PluginGUI* pluginGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, pluginGUI));
|
||||
renameChannelInstances();
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::removeChannelInstance(PluginGUI* pluginGUI)
|
||||
{
|
||||
for(ChannelInstanceRegistrations::iterator it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if(it->m_gui == pluginGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
renameChannelInstances();
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::renameChannelInstances()
|
||||
{
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
m_channelInstanceRegistrations[i].m_gui->setName(QString("%1:%2").arg(m_channelInstanceRegistrations[i].m_channelName).arg(i));
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::freeAll()
|
||||
{
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::freeAll: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy();
|
||||
}
|
||||
|
||||
|
||||
if(m_sampleSinkPluginGUI != 0)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::freeAll: destroying m_sampleSourcePluginGUI");
|
||||
m_deviceSinkEngine->setSink(0);
|
||||
m_sampleSinkPluginGUI->destroy();
|
||||
m_sampleSinkPluginGUI = 0;
|
||||
m_sampleSinkId.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::loadSinkSettings(const Preset* preset)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::loadSinkSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
|
||||
if(m_sampleSinkPluginGUI != 0)
|
||||
{
|
||||
// TODO: is "source" limiting to source devices?
|
||||
const QByteArray* sourceConfig = preset->findBestSourceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence);
|
||||
|
||||
if (sourceConfig != 0)
|
||||
{
|
||||
qDebug() << "DeviceSinkAPI::loadSinkSettings: deserializing sink " << qPrintable(m_sampleSinkId);
|
||||
m_sampleSinkPluginGUI->deserialize(*sourceConfig);
|
||||
}
|
||||
|
||||
qint64 centerFrequency = preset->getCenterFrequency();
|
||||
m_sampleSinkPluginGUI->setCenterFrequency(centerFrequency);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::saveSinkSettings(Preset* preset)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::saveSinkSettings");
|
||||
|
||||
if(m_sampleSinkPluginGUI != NULL)
|
||||
{
|
||||
// TODO: is "source" limiting to source devices?
|
||||
preset->addOrUpdateSourceConfig(m_sampleSinkId, m_sampleSinkSerial, m_sampleSinkSequence, m_sampleSinkPluginGUI->serialize());
|
||||
preset->setCenterFrequency(m_sampleSinkPluginGUI->getCenterFrequency());
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::loadChannelSettings(const Preset *preset, PluginAPI *pluginAPI)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::loadChannelSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
|
||||
// Available channel plugins
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getRxChannelRegistrations();
|
||||
|
||||
// copy currently open channels and clear list
|
||||
ChannelInstanceRegistrations openChannels = m_channelInstanceRegistrations;
|
||||
m_channelInstanceRegistrations.clear();
|
||||
|
||||
for(int i = 0; i < preset->getChannelCount(); i++)
|
||||
{
|
||||
const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(i);
|
||||
ChannelInstanceRegistration reg;
|
||||
|
||||
// if we have one instance available already, use it
|
||||
|
||||
for(int i = 0; i < openChannels.count(); i++)
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelName), qPrintable(channelConfig.m_channel));
|
||||
|
||||
if(openChannels[i].m_channelName == channelConfig.m_channel)
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName));
|
||||
reg = openChannels.takeAt(i);
|
||||
m_channelInstanceRegistrations.append(reg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we haven't one already, create one
|
||||
|
||||
if(reg.m_gui == NULL)
|
||||
{
|
||||
for(int i = 0; i < channelRegistrations->count(); i++)
|
||||
{
|
||||
if((*channelRegistrations)[i].m_channelName == channelConfig.m_channel)
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
||||
reg = ChannelInstanceRegistration(channelConfig.m_channel, (*channelRegistrations)[i].m_plugin->createTxChannel(channelConfig.m_channel, this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(reg.m_gui != NULL)
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadChannelSettings: deserializing channel [%s]", qPrintable(channelConfig.m_channel));
|
||||
reg.m_gui->deserialize(channelConfig.m_config);
|
||||
}
|
||||
}
|
||||
|
||||
// everything, that is still "available" is not needed anymore
|
||||
for(int i = 0; i < openChannels.count(); i++)
|
||||
{
|
||||
qDebug("DeviceSourceAPI::loadChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelName));
|
||||
openChannels[i].m_gui->destroy();
|
||||
}
|
||||
|
||||
renameChannelInstances();
|
||||
}
|
||||
|
||||
void DeviceSinkAPI::saveChannelSettings(Preset *preset)
|
||||
{
|
||||
qDebug("DeviceSinkAPI::saveChannelSettings");
|
||||
|
||||
qSort(m_channelInstanceRegistrations.begin(), m_channelInstanceRegistrations.end()); // sort by increasing delta frequency and type
|
||||
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_gui->serialize());
|
||||
}
|
||||
}
|
||||
|
||||
// sort by increasing delta frequency and type (i.e. name)
|
||||
bool DeviceSinkAPI::ChannelInstanceRegistration::operator<(const ChannelInstanceRegistration& other) const
|
||||
{
|
||||
if (m_gui && other.m_gui)
|
||||
{
|
||||
if (m_gui->getCenterFrequency() == other.m_gui->getCenterFrequency())
|
||||
{
|
||||
return m_gui->getName() < other.m_gui->getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_gui->getCenterFrequency() < other.m_gui->getCenterFrequency();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include "dsp/dspdevicesinkengine.h" // TODO: TBD
|
||||
#include "dsp/dspdevicesinkengine.h"
|
||||
#include "util/export.h"
|
||||
|
||||
class MainWindow;
|
||||
@ -41,6 +41,8 @@ class SDRANGEL_API DeviceSinkAPI : public QObject {
|
||||
|
||||
public:
|
||||
// Device engine stuff
|
||||
void addSink(BasebandSampleSink* sink); //!< Add a sample sink to device engine (spectrum vis)
|
||||
void removeSink(BasebandSampleSink* sink); //!< Remove a sample sink from device engine (spectrum vis)
|
||||
void addSource(BasebandSampleSource* source); //!< Add a baseband sample source to device engine
|
||||
void removeSource(BasebandSampleSource* sink); //!< Remove a baseband sample source from device engine
|
||||
void addThreadedSource(ThreadedBasebandSampleSource* sink); //!< Add a baseband sample source that will run on its own thread to device engine
|
||||
@ -101,7 +103,7 @@ protected:
|
||||
|
||||
DeviceSinkAPI(MainWindow *mainWindow,
|
||||
int deviceTabIndex,
|
||||
DSPDeviceSourceEngine *deviceEngine,
|
||||
DSPDeviceSinkEngine *deviceEngine,
|
||||
GLSpectrum *glSpectrum,
|
||||
ChannelWindow *channelWindow);
|
||||
~DeviceSinkAPI();
|
||||
@ -110,7 +112,7 @@ protected:
|
||||
|
||||
MainWindow *m_mainWindow;
|
||||
int m_deviceTabIndex;
|
||||
DSPDeviceSinkEngine *m_deviceEngine;
|
||||
DSPDeviceSinkEngine *m_deviceSinkEngine;
|
||||
GLSpectrum *m_spectrum;
|
||||
ChannelWindow *m_channelWindow;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <device/devicesourceapi.h>
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "plugin/plugingui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "plugin/plugininterface.h"
|
||||
@ -25,12 +25,12 @@
|
||||
|
||||
DeviceSourceAPI::DeviceSourceAPI(MainWindow *mainWindow,
|
||||
int deviceTabIndex,
|
||||
DSPDeviceSourceEngine *deviceEngine,
|
||||
DSPDeviceSourceEngine *deviceSourceEngine,
|
||||
GLSpectrum *glSpectrum,
|
||||
ChannelWindow *channelWindow) :
|
||||
m_mainWindow(mainWindow),
|
||||
m_deviceTabIndex(deviceTabIndex),
|
||||
m_deviceEngine(deviceEngine),
|
||||
m_deviceSourceEngine(deviceSourceEngine),
|
||||
m_spectrum(glSpectrum),
|
||||
m_channelWindow(channelWindow),
|
||||
m_sampleSourceSequence(0),
|
||||
@ -44,72 +44,72 @@ DeviceSourceAPI::~DeviceSourceAPI()
|
||||
|
||||
void DeviceSourceAPI::addSink(BasebandSampleSink *sink)
|
||||
{
|
||||
m_deviceEngine->addSink(sink);
|
||||
m_deviceSourceEngine->addSink(sink);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::removeSink(BasebandSampleSink* sink)
|
||||
{
|
||||
m_deviceEngine->removeSink(sink);
|
||||
m_deviceSourceEngine->removeSink(sink);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::addThreadedSink(ThreadedBasebandSampleSink* sink)
|
||||
{
|
||||
m_deviceEngine->addThreadedSink(sink);
|
||||
m_deviceSourceEngine->addThreadedSink(sink);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::removeThreadedSink(ThreadedBasebandSampleSink* sink)
|
||||
{
|
||||
m_deviceEngine->removeThreadedSink(sink);
|
||||
m_deviceSourceEngine->removeThreadedSink(sink);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::setSource(DeviceSampleSource* source)
|
||||
{
|
||||
m_deviceEngine->setSource(source);
|
||||
m_deviceSourceEngine->setSource(source);
|
||||
}
|
||||
|
||||
bool DeviceSourceAPI::initAcquisition()
|
||||
{
|
||||
return m_deviceEngine->initAcquisition();
|
||||
return m_deviceSourceEngine->initAcquisition();
|
||||
}
|
||||
|
||||
bool DeviceSourceAPI::startAcquisition()
|
||||
{
|
||||
return m_deviceEngine->startAcquisition();
|
||||
return m_deviceSourceEngine->startAcquisition();
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::stopAcquisition()
|
||||
{
|
||||
m_deviceEngine->stopAcquistion();
|
||||
m_deviceSourceEngine->stopAcquistion();
|
||||
}
|
||||
|
||||
DSPDeviceSourceEngine::State DeviceSourceAPI::state() const
|
||||
{
|
||||
return m_deviceEngine->state();
|
||||
return m_deviceSourceEngine->state();
|
||||
}
|
||||
|
||||
QString DeviceSourceAPI::errorMessage()
|
||||
{
|
||||
return m_deviceEngine->errorMessage();
|
||||
return m_deviceSourceEngine->errorMessage();
|
||||
}
|
||||
|
||||
uint DeviceSourceAPI::getDeviceUID() const
|
||||
{
|
||||
return m_deviceEngine->getUID();
|
||||
return m_deviceSourceEngine->getUID();
|
||||
}
|
||||
|
||||
MessageQueue *DeviceSourceAPI::getDeviceInputMessageQueue()
|
||||
{
|
||||
return m_deviceEngine->getInputMessageQueue();
|
||||
return m_deviceSourceEngine->getInputMessageQueue();
|
||||
}
|
||||
|
||||
MessageQueue *DeviceSourceAPI::getDeviceOutputMessageQueue()
|
||||
{
|
||||
return m_deviceEngine->getOutputMessageQueue();
|
||||
return m_deviceSourceEngine->getOutputMessageQueue();
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
|
||||
{
|
||||
m_deviceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
|
||||
m_deviceSourceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
|
||||
}
|
||||
|
||||
GLSpectrum *DeviceSourceAPI::getSpectrum()
|
||||
@ -134,7 +134,7 @@ void DeviceSourceAPI::addRollupWidget(QWidget *widget)
|
||||
|
||||
void DeviceSourceAPI::setInputGUI(QWidget* inputGUI, const QString& sourceDisplayName)
|
||||
{
|
||||
m_mainWindow->setInputGUI(m_deviceTabIndex, inputGUI, sourceDisplayName);
|
||||
m_mainWindow->setDeviceGUI(m_deviceTabIndex, inputGUI, sourceDisplayName);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::setSampleSourceId(const QString& id)
|
||||
@ -150,7 +150,7 @@ void DeviceSourceAPI::setSampleSourceSerial(const QString& serial)
|
||||
void DeviceSourceAPI::setSampleSourceSequence(int sequence)
|
||||
{
|
||||
m_sampleSourceSequence = sequence;
|
||||
m_deviceEngine->setSourceSequence(sequence);
|
||||
m_deviceSourceEngine->setSourceSequence(sequence);
|
||||
}
|
||||
|
||||
void DeviceSourceAPI::setSampleSourcePluginGUI(PluginGUI *gui)
|
||||
@ -202,15 +202,15 @@ void DeviceSourceAPI::freeAll()
|
||||
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceAPI::freeAll: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
|
||||
qDebug("DeviceSourceAPI::freeAll: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy();
|
||||
}
|
||||
|
||||
|
||||
if(m_sampleSourcePluginGUI != 0)
|
||||
{
|
||||
qDebug("DeviceAPI::freeAll: destroying m_sampleSourcePluginGUI");
|
||||
m_deviceEngine->setSource(0);
|
||||
qDebug("DeviceSourceAPI::freeAll: destroying m_sampleSourcePluginGUI");
|
||||
m_deviceSourceEngine->setSource(0);
|
||||
m_sampleSourcePluginGUI->destroy();
|
||||
m_sampleSourcePluginGUI = 0;
|
||||
m_sampleSourceId.clear();
|
||||
|
@ -104,7 +104,7 @@ protected:
|
||||
|
||||
DeviceSourceAPI(MainWindow *mainWindow,
|
||||
int deviceTabIndex,
|
||||
DSPDeviceSourceEngine *deviceEngine,
|
||||
DSPDeviceSourceEngine *deviceSourceEngine,
|
||||
GLSpectrum *glSpectrum,
|
||||
ChannelWindow *channelWindow);
|
||||
~DeviceSourceAPI();
|
||||
@ -113,7 +113,7 @@ protected:
|
||||
|
||||
MainWindow *m_mainWindow;
|
||||
int m_deviceTabIndex;
|
||||
DSPDeviceSourceEngine *m_deviceEngine;
|
||||
DSPDeviceSourceEngine *m_deviceSourceEngine;
|
||||
GLSpectrum *m_spectrum;
|
||||
ChannelWindow *m_channelWindow;
|
||||
|
||||
|
@ -257,27 +257,35 @@ void MainWindow::addViewAction(QAction* action)
|
||||
ui->menu_Window->addAction(action);
|
||||
}
|
||||
|
||||
void MainWindow::setInputGUI(int deviceTabIndex, QWidget* gui, const QString& sourceDisplayName)
|
||||
void MainWindow::setDeviceGUI(int deviceTabIndex, QWidget* gui, const QString& deviceDisplayName, bool sourceDevice)
|
||||
{
|
||||
char tabNameCStr[16];
|
||||
sprintf(tabNameCStr, "R%d", deviceTabIndex);
|
||||
|
||||
qDebug("MainWindow::setInputGUI: insert tab at %d", deviceTabIndex);
|
||||
|
||||
if (deviceTabIndex < m_deviceWidgetTabs.size())
|
||||
if (sourceDevice)
|
||||
{
|
||||
m_deviceWidgetTabs[deviceTabIndex] = {gui, sourceDisplayName, QString(tabNameCStr)};
|
||||
sprintf(tabNameCStr, "R%d", deviceTabIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceWidgetTabs.append({gui, sourceDisplayName, QString(tabNameCStr)});
|
||||
sprintf(tabNameCStr, "T%d", deviceTabIndex);
|
||||
}
|
||||
|
||||
qDebug("MainWindow::setDeviceGUI: insert %s tab at %d", sourceDevice ? "Rx" : "Tx", deviceTabIndex);
|
||||
|
||||
if (deviceTabIndex < m_deviceWidgetTabs.size())
|
||||
{
|
||||
m_deviceWidgetTabs[deviceTabIndex] = {gui, deviceDisplayName, QString(tabNameCStr)};
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceWidgetTabs.append({gui, deviceDisplayName, QString(tabNameCStr)});
|
||||
}
|
||||
|
||||
ui->tabInputsView->clear();
|
||||
|
||||
for (int i = 0; i < m_deviceWidgetTabs.size(); i++)
|
||||
{
|
||||
qDebug("MainWindow::setInputGUI: adding tab for %s", m_deviceWidgetTabs[i].displayName.toStdString().c_str());
|
||||
qDebug("MainWindow::setDeviceGUI: adding tab for %s", m_deviceWidgetTabs[i].displayName.toStdString().c_str());
|
||||
ui->tabInputsView->addTab(m_deviceWidgetTabs[i].gui, m_deviceWidgetTabs[i].tabName);
|
||||
ui->tabInputsView->setTabToolTip(i, m_deviceWidgetTabs[i].displayName);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
void addViewAction(QAction* action);
|
||||
|
||||
void addChannelRollup(int deviceTabIndex, QWidget* widget);
|
||||
void setInputGUI(int deviceTabIndex, QWidget* gui, const QString& sourceDisplayName);
|
||||
void setDeviceGUI(int deviceTabIndex, QWidget* gui, const QString& deviceDisplayName, bool sourceDevice = true);
|
||||
|
||||
const QTimer& getMasterTimer() const { return m_masterTimer; }
|
||||
const MainSettings& getMainSettings() const { return m_settings; }
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
virtual PluginGUI* createRxChannel(const QString& channelName, DeviceSourceAPI *deviceAPI) { return 0; }
|
||||
|
||||
// channel Tx plugins
|
||||
virtual PluginGUI* createTxChannel(const QString& channelName, DeviceSourceAPI *deviceAPI) { return 0; }
|
||||
virtual PluginGUI* createTxChannel(const QString& channelName, DeviceSinkAPI *deviceAPI) { return 0; }
|
||||
|
||||
// device source plugins only
|
||||
virtual SamplingDevices enumSampleSources() { return SamplingDevices(); }
|
||||
|
@ -31,6 +31,7 @@ SOURCES += mainwindow.cpp\
|
||||
audio/audiofifo.cpp\
|
||||
audio/audiooutput.cpp\
|
||||
device/devicesourceapi.cpp\
|
||||
device/devicesinkapi.cpp\
|
||||
dsp/afsquelch.cpp\
|
||||
dsp/agc.cpp\
|
||||
dsp/downchannelizer.cpp\
|
||||
@ -112,6 +113,7 @@ HEADERS += mainwindow.h\
|
||||
audio/audiofifo.h\
|
||||
audio/audiooutput.h\
|
||||
device/devicesourceapi.h\
|
||||
device/devicesinkapi.h\
|
||||
dsp/afsquelch.h\
|
||||
dsp/downchannelizer.h\
|
||||
dsp/upchannelizer.h\
|
||||
|
Loading…
Reference in New Issue
Block a user