mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-14 20:31:53 -05:00
Hack to try ChannelAnalyzer channel plugin handled via DeviceUISet
This commit is contained in:
parent
edc427804c
commit
da5f8aa6f9
@ -17,6 +17,7 @@
|
|||||||
#include "chanalyzergui.h"
|
#include "chanalyzergui.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
|
#include "device/deviceuiset.h"
|
||||||
#include <dsp/downchannelizer.h>
|
#include <dsp/downchannelizer.h>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
@ -39,9 +40,9 @@
|
|||||||
|
|
||||||
const QString ChannelAnalyzerGUI::m_channelID = "org.f4exb.sdrangelove.channel.chanalyzer";
|
const QString ChannelAnalyzerGUI::m_channelID = "org.f4exb.sdrangelove.channel.chanalyzer";
|
||||||
|
|
||||||
ChannelAnalyzerGUI* ChannelAnalyzerGUI::create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI)
|
ChannelAnalyzerGUI* ChannelAnalyzerGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet)
|
||||||
{
|
{
|
||||||
ChannelAnalyzerGUI* gui = new ChannelAnalyzerGUI(pluginAPI, deviceAPI);
|
ChannelAnalyzerGUI* gui = new ChannelAnalyzerGUI(pluginAPI, deviceUISet);
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,11 +323,12 @@ void ChannelAnalyzerGUI::onMenuDoubleClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent) :
|
||||||
RollupWidget(parent),
|
RollupWidget(parent),
|
||||||
ui(new Ui::ChannelAnalyzerGUI),
|
ui(new Ui::ChannelAnalyzerGUI),
|
||||||
m_pluginAPI(pluginAPI),
|
m_pluginAPI(pluginAPI),
|
||||||
m_deviceAPI(deviceAPI),
|
// m_deviceAPI(deviceAPI),
|
||||||
|
m_deviceUISet(deviceUISet),
|
||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
m_basicSettingsShown(false),
|
m_basicSettingsShown(false),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
@ -342,7 +344,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceSourceAPI *de
|
|||||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||||
m_scopeVis = new ScopeVis(ui->glScope);
|
m_scopeVis = new ScopeVis(ui->glScope);
|
||||||
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
|
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
|
||||||
m_channelAnalyzer = new ChannelAnalyzer(m_deviceAPI);
|
m_channelAnalyzer = new ChannelAnalyzer(m_deviceUISet->m_deviceSourceAPI);
|
||||||
m_channelAnalyzer->setSampleSink(m_spectrumScopeComboVis);
|
m_channelAnalyzer->setSampleSink(m_spectrumScopeComboVis);
|
||||||
m_channelAnalyzer->setMessageQueueToGUI(getInputMessageQueue());
|
m_channelAnalyzer->setMessageQueueToGUI(getInputMessageQueue());
|
||||||
|
|
||||||
@ -368,9 +370,9 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceSourceAPI *de
|
|||||||
|
|
||||||
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
|
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
|
||||||
|
|
||||||
m_deviceAPI->registerChannelInstance(m_channelID, this);
|
m_deviceUISet->registerChannelInstance(m_channelID, this);
|
||||||
m_deviceAPI->addChannelMarker(&m_channelMarker);
|
m_deviceUISet->addChannelMarker(&m_channelMarker);
|
||||||
m_deviceAPI->addRollupWidget(this);
|
m_deviceUISet->addRollupWidget(this);
|
||||||
|
|
||||||
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
||||||
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
||||||
@ -383,7 +385,7 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceSourceAPI *de
|
|||||||
|
|
||||||
ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
|
ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeChannelInstance(this);
|
m_deviceUISet->removeChannelInstance(this);
|
||||||
delete m_channelAnalyzer;
|
delete m_channelAnalyzer;
|
||||||
delete m_spectrumVis;
|
delete m_spectrumVis;
|
||||||
delete m_scopeVis;
|
delete m_scopeVis;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
class DeviceSourceAPI;
|
class DeviceUISet;
|
||||||
|
|
||||||
class ThreadedBasebandSampleSink;
|
class ThreadedBasebandSampleSink;
|
||||||
class DownChannelizer;
|
class DownChannelizer;
|
||||||
@ -41,7 +41,7 @@ class ChannelAnalyzerGUI : public RollupWidget, public PluginInstanceGUI {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ChannelAnalyzerGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
|
static ChannelAnalyzerGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUIset);
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
@ -73,7 +73,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::ChannelAnalyzerGUI* ui;
|
Ui::ChannelAnalyzerGUI* ui;
|
||||||
PluginAPI* m_pluginAPI;
|
PluginAPI* m_pluginAPI;
|
||||||
DeviceSourceAPI* m_deviceAPI;
|
// DeviceSourceAPI* m_deviceAPI;
|
||||||
|
DeviceUISet* m_deviceUISet;
|
||||||
ChannelMarker m_channelMarker;
|
ChannelMarker m_channelMarker;
|
||||||
bool m_basicSettingsShown;
|
bool m_basicSettingsShown;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
@ -89,7 +90,7 @@ private:
|
|||||||
ScopeVis* m_scopeVis;
|
ScopeVis* m_scopeVis;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
|
||||||
explicit ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
explicit ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, QWidget* parent = 0);
|
||||||
virtual ~ChannelAnalyzerGUI();
|
virtual ~ChannelAnalyzerGUI();
|
||||||
|
|
||||||
int getEffectiveLowCutoff(int lowCutoff);
|
int getEffectiveLowCutoff(int lowCutoff);
|
||||||
|
@ -33,18 +33,18 @@ void ChannelAnalyzerPlugin::initPlugin(PluginAPI* pluginAPI)
|
|||||||
m_pluginAPI->registerRxChannel(ChannelAnalyzerGUI::m_channelID, this);
|
m_pluginAPI->registerRxChannel(ChannelAnalyzerGUI::m_channelID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInstanceGUI* ChannelAnalyzerPlugin::createRxChannel(const QString& channelName, DeviceSourceAPI *deviceAPI)
|
PluginInstanceGUI* ChannelAnalyzerPlugin::createRxChannel(const QString& channelName, DeviceUISet *deviceUISet)
|
||||||
{
|
{
|
||||||
if(channelName == ChannelAnalyzerGUI::m_channelID)
|
if(channelName == ChannelAnalyzerGUI::m_channelID)
|
||||||
{
|
{
|
||||||
ChannelAnalyzerGUI* gui = ChannelAnalyzerGUI::create(m_pluginAPI, deviceAPI);
|
ChannelAnalyzerGUI* gui = ChannelAnalyzerGUI::create(m_pluginAPI, deviceUISet);
|
||||||
return gui;
|
return gui;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelAnalyzerPlugin::createInstanceChannelAnalyzer(DeviceSourceAPI *deviceAPI)
|
void ChannelAnalyzerPlugin::createInstanceChannelAnalyzer(DeviceUISet *deviceUISet)
|
||||||
{
|
{
|
||||||
ChannelAnalyzerGUI::create(m_pluginAPI, deviceAPI);
|
ChannelAnalyzerGUI::create(m_pluginAPI, deviceUISet);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "plugin/plugininterface.h"
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceUISet;
|
||||||
|
|
||||||
class ChannelAnalyzerPlugin : public QObject, PluginInterface {
|
class ChannelAnalyzerPlugin : public QObject, PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -17,7 +17,7 @@ public:
|
|||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
void initPlugin(PluginAPI* pluginAPI);
|
void initPlugin(PluginAPI* pluginAPI);
|
||||||
|
|
||||||
PluginInstanceGUI* createRxChannel(const QString& channelName, DeviceSourceAPI *deviceAPI);
|
PluginInstanceGUI* createRxChannel(const QString& channelName, DeviceUISet *deviceUISet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
@ -25,7 +25,7 @@ private:
|
|||||||
PluginAPI* m_pluginAPI;
|
PluginAPI* m_pluginAPI;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void createInstanceChannelAnalyzer(DeviceSourceAPI *deviceAPI);
|
void createInstanceChannelAnalyzer(DeviceUISet *deviceUISet);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_CHANALYZERPLUGIN_H
|
#endif // INCLUDE_CHANALYZERPLUGIN_H
|
||||||
|
@ -63,6 +63,16 @@ DeviceUISet::~DeviceUISet()
|
|||||||
delete m_spectrum;
|
delete m_spectrum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceUISet::addChannelMarker(ChannelMarker* channelMarker)
|
||||||
|
{
|
||||||
|
m_spectrum->addChannelMarker(channelMarker);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceUISet::addRollupWidget(QWidget *widget)
|
||||||
|
{
|
||||||
|
m_channelWindow->addRollupWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceUISet::registerChannelInstance(const QString& channelName, PluginInstanceGUI* pluginGUI)
|
void DeviceUISet::registerChannelInstance(const QString& channelName, PluginInstanceGUI* pluginGUI)
|
||||||
{
|
{
|
||||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, pluginGUI));
|
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, pluginGUI));
|
||||||
@ -136,11 +146,10 @@ void DeviceUISet::loadChannelSettings(const Preset *preset, PluginAPI *pluginAPI
|
|||||||
if((*channelRegistrations)[i].m_channelName == channelConfig.m_channel)
|
if((*channelRegistrations)[i].m_channelName == channelConfig.m_channel)
|
||||||
{
|
{
|
||||||
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
qDebug("DeviceUISet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channel));
|
||||||
// TOOO: replace m_deviceSourceAPI by this
|
|
||||||
reg = ChannelInstanceRegistration(
|
reg = ChannelInstanceRegistration(
|
||||||
channelConfig.m_channel,
|
channelConfig.m_channel,
|
||||||
(*channelRegistrations)[i].
|
(*channelRegistrations)[i].
|
||||||
m_plugin->createRxChannel(channelConfig.m_channel, m_deviceSourceAPI)
|
m_plugin->createRxChannel(channelConfig.m_channel, this)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1024,8 +1024,13 @@ void MainWindow::on_channel_addClicked(bool checked __attribute__((unused)))
|
|||||||
|
|
||||||
if (deviceUI->m_deviceSourceEngine) // source device => Rx channels
|
if (deviceUI->m_deviceSourceEngine) // source device => Rx channels
|
||||||
{
|
{
|
||||||
|
qDebug("MainWindow::on_channel_addClicked: channel name: %s", qPrintable(m_pluginManager->getRxChannelInstanceName(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex())));
|
||||||
|
if (m_pluginManager->getRxChannelInstanceName(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex()) == "org.f4exb.sdrangelove.channel.chanalyzer") {
|
||||||
|
m_pluginManager->createRxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI);
|
||||||
|
} else {
|
||||||
m_pluginManager->createRxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI->m_deviceSourceAPI);
|
m_pluginManager->createRxChannelInstance(deviceUI->m_samplingDeviceControl->getChannelSelector()->currentIndex(), deviceUI->m_deviceSourceAPI);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
||||||
{
|
{
|
||||||
uint32_t nbSources = deviceUI->m_deviceSinkAPI->getNumberOfSources();
|
uint32_t nbSources = deviceUI->m_deviceSinkAPI->getNumberOfSources();
|
||||||
|
@ -54,7 +54,15 @@ public:
|
|||||||
|
|
||||||
// channel Rx plugins
|
// channel Rx plugins
|
||||||
|
|
||||||
virtual PluginInstanceGUI* createRxChannel(const QString& channelName __attribute__((unused)), DeviceSourceAPI *deviceAPI __attribute__((unused)) ) { return 0; }
|
// TODO: remove this one when migration is complete
|
||||||
|
virtual PluginInstanceGUI* createRxChannel(
|
||||||
|
const QString& channelName __attribute__((unused)),
|
||||||
|
DeviceSourceAPI *deviceAPI __attribute__((unused)) )
|
||||||
|
{ return 0; }
|
||||||
|
virtual PluginInstanceGUI* createRxChannel(
|
||||||
|
const QString& channelName __attribute__((unused)),
|
||||||
|
DeviceUISet *deviceAPI __attribute__((unused)) )
|
||||||
|
{ return 0; }
|
||||||
|
|
||||||
// channel Tx plugins
|
// channel Tx plugins
|
||||||
|
|
||||||
|
@ -627,6 +627,27 @@ void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceSource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet)
|
||||||
|
{
|
||||||
|
if (channelPluginIndex < m_rxChannelRegistrations.size())
|
||||||
|
{
|
||||||
|
PluginInterface *pluginInterface = m_rxChannelRegistrations[channelPluginIndex].m_plugin;
|
||||||
|
pluginInterface->createRxChannel(m_rxChannelRegistrations[channelPluginIndex].m_channelName, deviceUISet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PluginManager::getRxChannelInstanceName(int channelPluginIndex)
|
||||||
|
{
|
||||||
|
if (channelPluginIndex < m_rxChannelRegistrations.size())
|
||||||
|
{
|
||||||
|
return m_rxChannelRegistrations[channelPluginIndex].m_channelName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI)
|
void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
if (channelPluginIndex < m_txChannelRegistrations.size())
|
if (channelPluginIndex < m_txChannelRegistrations.size())
|
||||||
|
@ -72,6 +72,8 @@ public:
|
|||||||
|
|
||||||
void populateRxChannelComboBox(QComboBox *channels);
|
void populateRxChannelComboBox(QComboBox *channels);
|
||||||
void createRxChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI);
|
void createRxChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI);
|
||||||
|
void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet);
|
||||||
|
QString getRxChannelInstanceName(int channelPluginIndex);
|
||||||
|
|
||||||
void populateTxChannelComboBox(QComboBox *channels);
|
void populateTxChannelComboBox(QComboBox *channels);
|
||||||
void createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI);
|
void createTxChannelInstance(int channelPluginIndex, DeviceSinkAPI *deviceAPI);
|
||||||
|
Loading…
Reference in New Issue
Block a user