mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
Multi device support: removed as much as possible (now) DSPDeviceEngine dependencies in MainWindow to source plugin GUIs. This includes file sink handling. Applies to BladeRF only.
This commit is contained in:
parent
5de7b0168e
commit
e25c465b82
@ -338,7 +338,7 @@ void AirspyGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -36,6 +36,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -22,7 +22,10 @@
|
||||
#include "ui_bladerfgui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "gui/colormapper.h"
|
||||
#include "gui/glspectrum.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/filesink.h"
|
||||
#include "bladerfgui.h"
|
||||
|
||||
BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
@ -31,6 +34,7 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_settings(),
|
||||
m_sampleSource(NULL),
|
||||
m_sampleRate(0),
|
||||
m_lastEngineState((DSPDeviceEngine::State)-1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -57,10 +61,19 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
|
||||
m_sampleSource = new BladerfInput();
|
||||
DSPEngine::instance()->setSource(m_sampleSource);
|
||||
|
||||
char recFileNameCStr[30];
|
||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_pluginAPI->getDeviceUID());
|
||||
m_fileSink = new FileSink(std::string(recFileNameCStr));
|
||||
m_pluginAPI->addSink(m_fileSink);
|
||||
|
||||
connect(m_pluginAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
BladerfGui::~BladerfGui()
|
||||
{
|
||||
m_pluginAPI->removeSink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
delete m_sampleSource; // Valgrind memcheck
|
||||
delete ui;
|
||||
}
|
||||
@ -129,6 +142,37 @@ bool BladerfGui::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
void BladerfGui::handleDSPMessages()
|
||||
{
|
||||
Message* message;
|
||||
|
||||
while ((message = m_pluginAPI->getDeviceOutputMessageQueue()->pop()) != 0)
|
||||
{
|
||||
qDebug("BladerfGui::handleDSPMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (DSPSignalNotification::match(*message))
|
||||
{
|
||||
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||
m_sampleRate = notif->getSampleRate();
|
||||
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||
qDebug("BladerfGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
// updateCenterFreqDisplay();
|
||||
updateSampleRateAndFrequency();
|
||||
// qDebug() << "MainWindow::handleDSPMessages: forward to file sink";
|
||||
// m_fileSink->handleMessage(*notif);
|
||||
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BladerfGui::updateSampleRateAndFrequency()
|
||||
{
|
||||
m_pluginAPI->getSpectrum()->setSampleRate(m_sampleRate);
|
||||
m_pluginAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||
ui->deviceRateLabel->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||
}
|
||||
|
||||
void BladerfGui::displaySettings()
|
||||
{
|
||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||
@ -325,6 +369,20 @@ void BladerfGui::on_startStop_toggled(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void BladerfGui::on_record_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
m_fileSink->stopRecording();
|
||||
}
|
||||
}
|
||||
|
||||
void BladerfGui::updateHardware()
|
||||
{
|
||||
qDebug() << "BladerfGui::updateHardware";
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "bladerfinput.h"
|
||||
|
||||
class PluginAPI;
|
||||
class FileSink;
|
||||
|
||||
namespace Ui {
|
||||
class BladerfGui;
|
||||
@ -56,13 +57,18 @@ private:
|
||||
QTimer m_statusTimer;
|
||||
std::vector<int> m_gains;
|
||||
SampleSource* m_sampleSource;
|
||||
FileSink *m_fileSink; //!< File sink to record device I/Q output
|
||||
int m_sampleRate;
|
||||
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||
int m_lastEngineState;
|
||||
|
||||
void displaySettings();
|
||||
void sendSettings();
|
||||
unsigned int getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter);
|
||||
void updateSampleRateAndFrequency();
|
||||
|
||||
private slots:
|
||||
void handleDSPMessages();
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_dcOffset_toggled(bool checked);
|
||||
void on_iqImbalance_toggled(bool checked);
|
||||
@ -75,6 +81,7 @@ private slots:
|
||||
void on_xb200_currentIndexChanged(int index);
|
||||
void on_fcPos_currentIndexChanged(int index);
|
||||
void on_startStop_toggled(bool checked);
|
||||
void on_record_toggled(bool checked);
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
};
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>175</height>
|
||||
<width>259</width>
|
||||
<height>207</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -35,16 +35,56 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/play.png</normaloff>
|
||||
<normalon>:/stop.png</normalon>:/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="deviceUILayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deviceButtonsLayout">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/play.png</normaloff>
|
||||
<normalon>:/stop.png</normalon>:/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="record">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/record_off.png</normaloff>
|
||||
<normalon>:/record_on.png</normalon>:/record_off.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deviceRateLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceRateLabel">
|
||||
<property name="toolTip">
|
||||
<string>Sample rate kS/s</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00000k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="freqLeftSpacer">
|
||||
@ -141,13 +181,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="corrLabel">
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -161,6 +194,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="corrLabel">
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="xb200Label">
|
||||
<property name="text">
|
||||
|
@ -408,7 +408,7 @@ void FCDProGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -25,6 +25,9 @@
|
||||
<property name="windowTitle">
|
||||
<string>FunCubeDongle</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
|
@ -182,7 +182,7 @@ void FCDProPlusGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -36,6 +36,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -209,7 +209,7 @@ void FileSourceGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -36,6 +36,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -321,7 +321,7 @@ void HackRFGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -42,6 +42,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -288,7 +288,7 @@ void RTLSDRGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -36,6 +36,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -654,7 +654,7 @@ void SDRdaemonGui::updateStatus()
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
|
@ -36,6 +36,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="toolTip">
|
||||
<string>start/stop acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "dsp/filesink.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/message.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(FileSink::MsgConfigureFileSink, Message)
|
||||
|
||||
FileSink::FileSink() :
|
||||
SampleSink(),
|
||||
m_fileName(std::string("test.sdriq")),
|
||||
@ -19,15 +17,29 @@ FileSink::FileSink() :
|
||||
setObjectName("FileSink");
|
||||
}
|
||||
|
||||
FileSink::FileSink(const std::string& filename) :
|
||||
SampleSink(),
|
||||
m_fileName(std::string(filename)),
|
||||
m_sampleRate(0),
|
||||
m_centerFrequency(0),
|
||||
m_recordOn(false),
|
||||
m_recordStart(false),
|
||||
m_byteCount(0)
|
||||
{
|
||||
setObjectName("FileSink");
|
||||
}
|
||||
|
||||
FileSink::~FileSink()
|
||||
{
|
||||
stopRecording();
|
||||
}
|
||||
|
||||
void FileSink::configure(MessageQueue* msgQueue, const std::string& filename)
|
||||
void FileSink::setFileName(const std::string& filename)
|
||||
{
|
||||
Message* cmd = MsgConfigureFileSink::create(filename);
|
||||
msgQueue->push(cmd);
|
||||
if (!m_recordOn)
|
||||
{
|
||||
m_fileName = filename;
|
||||
}
|
||||
}
|
||||
|
||||
void FileSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||
@ -94,13 +106,6 @@ bool FileSink::handleMessage(const Message& message)
|
||||
<< " m_centerFrequency: " << m_centerFrequency;
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureFileSink::match(message))
|
||||
{
|
||||
MsgConfigureFileSink& conf = (MsgConfigureFileSink&) message;
|
||||
handleConfigure(conf.getFileName());
|
||||
qDebug() << "FileSink::handleMessage: MsgConfigureFileSink: fileName: " << m_fileName.c_str();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -113,7 +118,7 @@ void FileSink::handleConfigure(const std::string& fileName)
|
||||
{
|
||||
stopRecording();
|
||||
}
|
||||
|
||||
|
||||
m_fileName = fileName;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include <ctime>
|
||||
#include "dsp/samplesink.h"
|
||||
#include "util/export.h"
|
||||
#include "util/message.h"
|
||||
#include "util/messagequeue.h"
|
||||
|
||||
class Message;
|
||||
|
||||
class SDRANGEL_API FileSink : public SampleSink {
|
||||
public:
|
||||
@ -22,11 +22,12 @@ public:
|
||||
};
|
||||
|
||||
FileSink();
|
||||
FileSink(const std::string& filename);
|
||||
virtual ~FileSink();
|
||||
|
||||
|
||||
quint64 getByteCount() const { return m_byteCount; }
|
||||
|
||||
void configure(MessageQueue* msgQueue, const std::string& filename);
|
||||
void setFileName(const std::string& filename);
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual void start();
|
||||
@ -37,26 +38,6 @@ public:
|
||||
static void readHeader(std::ifstream& samplefile, Header& header);
|
||||
|
||||
private:
|
||||
class MsgConfigureFileSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const std::string& getFileName() const { return m_fileName; }
|
||||
|
||||
static MsgConfigureFileSink* create(const std::string& fileName)
|
||||
{
|
||||
return new MsgConfigureFileSink(fileName);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_fileName;
|
||||
|
||||
MsgConfigureFileSink(const std::string& fileName) :
|
||||
Message(),
|
||||
m_fileName(fileName)
|
||||
{ }
|
||||
};
|
||||
|
||||
std::string m_fileName;
|
||||
int m_sampleRate;
|
||||
quint64 m_centerFrequency;
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "gui/audiodialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "dsp/filesink.h"
|
||||
//#include "dsp/filesink.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "plugin/plugingui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
@ -105,13 +105,13 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
|
||||
DSPDeviceEngine *dspDeviceEngine = m_dspEngine->getDeviceEngineByIndex(0);
|
||||
|
||||
connect(dspDeviceEngine->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
// connect(dspDeviceEngine->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||
dspDeviceEngine->start();
|
||||
|
||||
m_pluginManager = new PluginManager(this, dspDeviceEngine);
|
||||
m_pluginManager->loadPlugins();
|
||||
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
|
||||
|
||||
m_deviceUIs.push_back(new DeviceUISet(m_masterTimer));
|
||||
m_pluginManager = new PluginManager(this, dspDeviceEngine, m_deviceUIs.back()->m_spectrum);
|
||||
m_pluginManager->loadPlugins();
|
||||
|
||||
ui->tabSpectra->addTab(m_deviceUIs.back()->m_spectrum, "X0");
|
||||
ui->tabSpectraGUI->addTab(m_deviceUIs.back()->m_spectrumGUI, "X0");
|
||||
@ -123,8 +123,8 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
|
||||
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, "X0");
|
||||
|
||||
m_fileSink = new FileSink();
|
||||
dspDeviceEngine->addSink(m_fileSink); // TODO: one file sink per device engine
|
||||
// m_fileSink = new FileSink();
|
||||
// dspDeviceEngine->addSink(m_fileSink); // TODO: one file sink per device engine
|
||||
|
||||
qDebug() << "MainWindow::MainWindow: loadSettings...";
|
||||
|
||||
@ -174,9 +174,9 @@ MainWindow::~MainWindow()
|
||||
delete m_deviceUIs[i];
|
||||
}
|
||||
|
||||
m_dspEngine->removeSink(m_fileSink); // TODO: one file sink per device engine
|
||||
//m_dspEngine->removeSink(m_rxSpectrumVis);
|
||||
delete m_fileSink;
|
||||
// m_dspEngine->removeSink(m_fileSink); // TODO: one file sink per device engine
|
||||
// //m_dspEngine->removeSink(m_rxSpectrumVis);
|
||||
// delete m_fileSink;
|
||||
//delete m_rxSpectrumVis;
|
||||
delete m_pluginManager;
|
||||
|
||||
@ -364,9 +364,7 @@ void MainWindow::handleDSPMessages()
|
||||
|
||||
while ((message = m_dspEngine->getOutputMessageQueue()->pop()) != 0)
|
||||
{
|
||||
qDebug("Message: %s", message->getIdentifier());
|
||||
|
||||
std::cerr << "MainWindow::handleDSPMessages: " << message->getIdentifier() << std::endl;
|
||||
qDebug("MainWindow::handleDSPMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (DSPSignalNotification::match(*message))
|
||||
{
|
||||
@ -376,8 +374,8 @@ void MainWindow::handleDSPMessages()
|
||||
qDebug("SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||
updateCenterFreqDisplay();
|
||||
updateSampleRate();
|
||||
qDebug() << "MainWindow::handleDSPMessages: forward to file sink";
|
||||
m_fileSink->handleMessage(*notif);
|
||||
// qDebug() << "MainWindow::handleDSPMessages: forward to file sink";
|
||||
// m_fileSink->handleMessage(*notif);
|
||||
|
||||
delete message;
|
||||
}
|
||||
@ -390,8 +388,7 @@ void MainWindow::handleMessages()
|
||||
|
||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||
{
|
||||
qDebug("Message: %s", message->getIdentifier());
|
||||
std::cerr << "MainWindow::handleMessages: " << message->getIdentifier() << std::endl;
|
||||
qDebug("MainWindow::handleMessages: message: %s", message->getIdentifier());
|
||||
|
||||
if (!m_pluginManager->handleMessage(*message))
|
||||
{
|
||||
@ -400,17 +397,17 @@ void MainWindow::handleMessages()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Start_Recording_triggered()
|
||||
{
|
||||
m_recording->setColor(Qt::red);
|
||||
m_fileSink->startRecording();
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Stop_Recording_triggered()
|
||||
{
|
||||
m_recording->setColor(Qt::gray);
|
||||
m_fileSink->stopRecording();
|
||||
}
|
||||
//void MainWindow::on_action_Start_Recording_triggered()
|
||||
//{
|
||||
// m_recording->setColor(Qt::red);
|
||||
// m_fileSink->startRecording();
|
||||
//}
|
||||
//
|
||||
//void MainWindow::on_action_Stop_Recording_triggered()
|
||||
//{
|
||||
// m_recording->setColor(Qt::gray);
|
||||
// m_fileSink->stopRecording();
|
||||
//}
|
||||
|
||||
void MainWindow::on_action_View_Fullscreen_toggled(bool checked)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ class SpectrumVis;
|
||||
class GLSpectrum;
|
||||
class GLSpectrumGUI;
|
||||
class ChannelWindow;
|
||||
class FileSink;
|
||||
//class FileSink;
|
||||
class SampleSource;
|
||||
class PluginAPI;
|
||||
class PluginGUI;
|
||||
@ -96,7 +96,7 @@ private:
|
||||
MainSettings m_settings;
|
||||
|
||||
SpectrumVis* m_rxSpectrumVis;
|
||||
FileSink *m_fileSink;
|
||||
// FileSink *m_fileSink;
|
||||
|
||||
std::vector<DeviceUISet*> m_deviceUIs;
|
||||
|
||||
@ -135,8 +135,8 @@ private:
|
||||
private slots:
|
||||
void handleDSPMessages();
|
||||
void handleMessages();
|
||||
void on_action_Start_Recording_triggered();
|
||||
void on_action_Stop_Recording_triggered();
|
||||
// void on_action_Start_Recording_triggered();
|
||||
// void on_action_Stop_Recording_triggered();
|
||||
void on_action_View_Fullscreen_toggled(bool checked);
|
||||
void on_presetSave_clicked();
|
||||
void on_presetUpdate_clicked();
|
||||
|
@ -58,6 +58,16 @@ void PluginAPI::registerSampleSource(const QString& sourceName, PluginInterface*
|
||||
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);
|
||||
@ -93,6 +103,26 @@ 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();
|
||||
}
|
||||
|
||||
GLSpectrum *PluginAPI::getSpectrum()
|
||||
{
|
||||
return m_pluginManager->getSpectrum();
|
||||
}
|
||||
|
||||
PluginAPI::PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow) :
|
||||
QObject(mainWindow),
|
||||
m_pluginManager(pluginManager),
|
||||
|
@ -18,6 +18,7 @@ class MessageQueue;
|
||||
class MainWindow;
|
||||
class ChannelMarker;
|
||||
class ThreadedSampleSink;
|
||||
class GLSpectrum;
|
||||
class PluginGUI;
|
||||
|
||||
class SDRANGEL_API PluginAPI : public QObject {
|
||||
@ -42,13 +43,20 @@ public:
|
||||
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
|
||||
|
||||
// Device engine stuff
|
||||
void addThreadedSink(ThreadedSampleSink* sink);
|
||||
void removeThreadedSink(ThreadedSampleSink* sink);
|
||||
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
|
||||
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();
|
||||
|
||||
GLSpectrum *getSpectrum();
|
||||
|
||||
// R/O access to main window
|
||||
const MainWindow* getMainWindow() const { return m_mainWindow; }
|
||||
|
@ -10,11 +10,12 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
PluginManager::PluginManager(MainWindow* mainWindow, DSPDeviceEngine* dspDeviceEngine, QObject* parent) :
|
||||
PluginManager::PluginManager(MainWindow* mainWindow, DSPDeviceEngine* dspDeviceEngine, GLSpectrum *spectrum, QObject* parent) :
|
||||
QObject(parent),
|
||||
m_pluginAPI(this, mainWindow),
|
||||
m_mainWindow(mainWindow),
|
||||
m_dspDeviceEngine(dspDeviceEngine),
|
||||
m_spectrum(spectrum),
|
||||
m_sampleSourceId(),
|
||||
m_sampleSourceSerial(),
|
||||
m_sampleSourceSequence(0),
|
||||
@ -86,6 +87,16 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
|
||||
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -14,7 +14,10 @@ class Preset;
|
||||
class MainWindow;
|
||||
class SampleSource;
|
||||
class Message;
|
||||
class MessageQueue;
|
||||
class DSPDeviceEngine;
|
||||
class GLSpectrum;
|
||||
class SampleSink;
|
||||
class ThreadedSampleSink;
|
||||
|
||||
class SDRANGEL_API PluginManager : public QObject {
|
||||
@ -36,7 +39,7 @@ public:
|
||||
|
||||
typedef QList<Plugin> Plugins;
|
||||
|
||||
explicit PluginManager(MainWindow* mainWindow, DSPDeviceEngine* dspDeviceEngine, QObject* parent = NULL);
|
||||
explicit PluginManager(MainWindow* mainWindow, DSPDeviceEngine* dspDeviceEngine, GLSpectrum *spectrum, QObject* parent = NULL);
|
||||
~PluginManager();
|
||||
void loadPlugins();
|
||||
|
||||
@ -49,13 +52,20 @@ public:
|
||||
|
||||
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
|
||||
|
||||
void addThreadedSink(ThreadedSampleSink* sink);
|
||||
void removeThreadedSink(ThreadedSampleSink* sink);
|
||||
void addSink(SampleSink* sink);
|
||||
void removeSink(SampleSink* sink);
|
||||
void addThreadedSink(ThreadedSampleSink* sink);
|
||||
void removeThreadedSink(ThreadedSampleSink* sink);
|
||||
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(); }
|
||||
|
||||
GLSpectrum *getSpectrum() { return m_spectrum; }
|
||||
|
||||
void loadSettings(const Preset* preset);
|
||||
void loadSourceSettings(const Preset* preset);
|
||||
@ -132,6 +142,7 @@ private:
|
||||
PluginAPI m_pluginAPI;
|
||||
MainWindow* m_mainWindow;
|
||||
DSPDeviceEngine* m_dspDeviceEngine;
|
||||
GLSpectrum* m_spectrum;
|
||||
Plugins m_plugins;
|
||||
|
||||
ChannelRegistrations m_channelRegistrations;
|
||||
|
Loading…
Reference in New Issue
Block a user