mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-12 10:48:42 -04:00
Websocket spectrum: adapted MIMO plugins
This commit is contained in:
@@ -40,7 +40,7 @@ const int Interferometer::m_fftSize = 4096;
|
||||
Interferometer::Interferometer(DeviceAPI *deviceAPI) :
|
||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamMIMO),
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_spectrumSink(nullptr),
|
||||
m_spectrumVis(SDR_RX_SCALEF),
|
||||
m_scopeSink(nullptr),
|
||||
m_guiMessageQueue(nullptr),
|
||||
m_frequencyOffset(0),
|
||||
@@ -50,6 +50,7 @@ Interferometer::Interferometer(DeviceAPI *deviceAPI) :
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_basebandSink = new InterferometerBaseband(m_fftSize);
|
||||
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
||||
m_basebandSink->moveToThread(m_thread);
|
||||
m_deviceAPI->addMIMOChannel(this);
|
||||
m_deviceAPI->addMIMOChannelAPI(this);
|
||||
@@ -70,12 +71,6 @@ Interferometer::~Interferometer()
|
||||
delete m_thread;
|
||||
}
|
||||
|
||||
void Interferometer::setSpectrumSink(BasebandSampleSink *spectrumSink)
|
||||
{
|
||||
m_spectrumSink = spectrumSink;
|
||||
m_basebandSink->setSpectrumSink(spectrumSink);
|
||||
}
|
||||
|
||||
void Interferometer::setScopeSink(BasebandSampleSink *scopeSink)
|
||||
{
|
||||
m_scopeSink = scopeSink;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "dsp/mimochannel.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "channel/channelapi.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/message.h"
|
||||
@@ -119,7 +120,7 @@ public:
|
||||
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
|
||||
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
|
||||
|
||||
void setSpectrumSink(BasebandSampleSink *spectrumSink);
|
||||
SpectrumVis *getSpectrumVis();
|
||||
void setScopeSink(BasebandSampleSink *scopeSink);
|
||||
void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash);
|
||||
|
||||
@@ -149,8 +150,8 @@ public:
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QThread *m_thread;
|
||||
SpectrumVis m_spectrumVis;
|
||||
InterferometerBaseband* m_basebandSink;
|
||||
BasebandSampleSink* m_spectrumSink;
|
||||
BasebandSampleSink* m_scopeSink;
|
||||
InterferometerSettings m_settings;
|
||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||
|
||||
@@ -129,18 +129,18 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_scopeVis = new ScopeVis(ui->glScope);
|
||||
|
||||
m_interferometer = (Interferometer*) channelMIMO;
|
||||
m_spectrumVis = m_interferometer->getSpectrumVis();
|
||||
m_interferometer->setScopeSink(m_scopeVis);
|
||||
m_interferometer->setSpectrumSink(m_spectrumVis);
|
||||
m_interferometer->setMessageQueueToGUI(getInputMessageQueue());
|
||||
m_sampleRate = m_interferometer->getDeviceSampleRate();
|
||||
|
||||
ui->glSpectrum->setDisplayWaterfall(true);
|
||||
ui->glSpectrum->setDisplayMaxHold(true);
|
||||
ui->glSpectrum->setCenterFrequency(0);
|
||||
ui->glSpectrum->setSampleRate(m_sampleRate);
|
||||
ui->glSpectrum->setSsbSpectrum(false);
|
||||
ui->glSpectrum->setLsbDisplay(false);
|
||||
ui->glScope->setTraceModulo(Interferometer::m_fftSize);
|
||||
@@ -183,7 +183,6 @@ InterferometerGUI::~InterferometerGUI()
|
||||
{
|
||||
m_deviceUISet->removeChannelInstance(this);
|
||||
delete m_interferometer; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_spectrumVis;
|
||||
delete m_scopeVis;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ const QString ChirpChatDemod::m_channelId = "ChirpChatDemod";
|
||||
ChirpChatDemod::ChirpChatDemod(DeviceAPI* deviceAPI) :
|
||||
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_spectrumVis(SDR_RX_SCALEF),
|
||||
m_basebandSampleRate(0),
|
||||
m_lastMsgSignalDb(0.0),
|
||||
m_lastMsgNoiseDb(0.0),
|
||||
@@ -68,6 +69,7 @@ ChirpChatDemod::ChirpChatDemod(DeviceAPI* deviceAPI) :
|
||||
|
||||
m_thread = new QThread(this);
|
||||
m_basebandSink = new ChirpChatDemodBaseband();
|
||||
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
||||
m_basebandSink->setDecoderMessageQueue(getInputMessageQueue()); // Decoder held on the main thread
|
||||
m_basebandSink->moveToThread(m_thread);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "channel/channelapi.h"
|
||||
#include "util/message.h"
|
||||
#include "util/udpsinkutil.h"
|
||||
@@ -200,7 +201,7 @@ public:
|
||||
ChirpChatDemod(DeviceAPI* deviceAPI);
|
||||
virtual ~ChirpChatDemod();
|
||||
virtual void destroy() { delete this; }
|
||||
void setSpectrumSink(BasebandSampleSink* sampleSink) { m_basebandSink->setSpectrumSink(sampleSink); }
|
||||
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool pO);
|
||||
virtual void start();
|
||||
@@ -262,6 +263,7 @@ private:
|
||||
ChirpChatDemodBaseband* m_basebandSink;
|
||||
ChirpChatDemodDecoder m_decoder;
|
||||
ChirpChatDemodSettings m_settings;
|
||||
SpectrumVis m_spectrumVis;
|
||||
int m_basebandSampleRate; //!< stored from device message used when starting baseband sink
|
||||
float m_lastMsgSignalDb;
|
||||
float m_lastMsgNoiseDb;
|
||||
|
||||
@@ -402,9 +402,9 @@ ChirpChatDemodGUI::ChirpChatDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_chirpChatDemod = (ChirpChatDemod*) rxChannel;
|
||||
m_chirpChatDemod->setSpectrumSink(m_spectrumVis);
|
||||
m_spectrumVis = m_chirpChatDemod->getSpectrumVis();
|
||||
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
||||
m_chirpChatDemod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
||||
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
@@ -446,7 +446,6 @@ ChirpChatDemodGUI::~ChirpChatDemodGUI()
|
||||
{
|
||||
m_deviceUISet->removeRxChannelInstance(this);
|
||||
delete m_chirpChatDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_spectrumVis;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ MESSAGE_CLASS_DEFINITION(TestMOSync::MsgStartStop, Message)
|
||||
|
||||
TestMOSync::TestMOSync(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_spectrumVis(SDR_TX_SCALEF),
|
||||
m_settings(),
|
||||
m_sinkThread(nullptr),
|
||||
m_deviceDescription("TestMOSync"),
|
||||
m_runningTx(false),
|
||||
m_masterTimer(deviceAPI->getMasterTimer()),
|
||||
m_spectrumSink(nullptr),
|
||||
m_feedSpectrumIndex(0)
|
||||
{
|
||||
m_mimoType = MIMOHalfSynchronous;
|
||||
@@ -81,7 +81,7 @@ bool TestMOSync::startTx()
|
||||
m_sinkThread->setFcPos(m_settings.m_fcPosTx);
|
||||
m_sinkThread->setSamplerate(m_settings.m_sampleRate);
|
||||
m_sinkThread->setLog2Interpolation(m_settings.m_log2Interp);
|
||||
m_sinkThread->setSpectrumSink(m_spectrumSink);
|
||||
m_sinkThread->setSpectrumSink(&m_spectrumVis);
|
||||
m_sinkThread->setFeedSpectrumIndex(m_feedSpectrumIndex);
|
||||
m_sinkThread->connectTimer(m_masterTimer);
|
||||
m_sinkThread->startWork();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "dsp/devicesamplemimo.h"
|
||||
#include "dsp/spectrumvis.h"
|
||||
#include "testmosyncsettings.h"
|
||||
|
||||
class DeviceAPI;
|
||||
@@ -141,20 +142,20 @@ public:
|
||||
const QStringList& deviceSettingsKeys,
|
||||
SWGSDRangel::SWGDeviceSettings& response);
|
||||
|
||||
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
|
||||
bool getRxRunning() const { return false; }
|
||||
bool getTxRunning() const { return m_runningTx; }
|
||||
void setSpectrumSink(BasebandSampleSink* spectrumSink) { m_spectrumSink = spectrumSink; }
|
||||
void setFeedSpectrumIndex(unsigned int feedSpectrumIndex);
|
||||
|
||||
private:
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
SpectrumVis m_spectrumVis;
|
||||
TestMOSyncSettings m_settings;
|
||||
TestMOSyncThread* m_sinkThread;
|
||||
QString m_deviceDescription;
|
||||
bool m_runningTx;
|
||||
const QTimer& m_masterTimer;
|
||||
BasebandSampleSink* m_spectrumSink;
|
||||
unsigned int m_feedSpectrumIndex;
|
||||
|
||||
bool applySettings(const TestMOSyncSettings& settings, bool force);
|
||||
|
||||
@@ -58,8 +58,8 @@ TestMOSyncGui::TestMOSyncGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
|
||||
ui->sampleRate->setValueRange(7, 32000U, 9000000U);
|
||||
|
||||
m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, ui->glSpectrum);
|
||||
m_sampleMIMO->setSpectrumSink(m_spectrumVis);
|
||||
m_spectrumVis = m_sampleMIMO->getSpectrumVis();
|
||||
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
||||
ui->glSpectrum->setCenterFrequency(m_settings.m_centerFrequency);
|
||||
ui->glSpectrum->setSampleRate(m_settings.m_sampleRate*(1<<m_settings.m_log2Interp));
|
||||
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
|
||||
@@ -82,7 +82,6 @@ TestMOSyncGui::TestMOSyncGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
|
||||
TestMOSyncGui::~TestMOSyncGui()
|
||||
{
|
||||
delete m_spectrumVis;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user