mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
Web API: report Rx channel info summary
This commit is contained in:
parent
5ba857f278
commit
dc50ba1249
@ -37,6 +37,7 @@ const int AMDemod::m_udpBlockSize = 512;
|
||||
|
||||
AMDemod::AMDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_squelchOpen(false),
|
||||
m_magsqSum(0.0f),
|
||||
m_magsqPeak(0.0f),
|
||||
@ -177,6 +178,7 @@ bool AMDemod::handleMessage(const Message& cmd)
|
||||
AMDemodSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
@ -121,6 +121,7 @@ private:
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
int m_absoluteFrequencyOffset;
|
||||
AMDemodSettings m_settings;
|
||||
|
||||
NCO m_nco;
|
||||
|
@ -40,6 +40,7 @@ const int BFMDemod::m_udpBlockSize = 512;
|
||||
|
||||
BFMDemod::BFMDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_audioFifo(250000),
|
||||
m_settingsMutex(QMutex::Recursive),
|
||||
m_pilotPLL(19000/384000, 50/384000, 0.01),
|
||||
@ -347,6 +348,7 @@ bool BFMDemod::handleMessage(const Message& cmd)
|
||||
BFMDemodSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
@ -163,6 +163,7 @@ private:
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
BFMDemodSettings m_settings;
|
||||
int m_absoluteFrequencyOffset;
|
||||
|
||||
NCO m_nco;
|
||||
Interpolator m_interpolator; //!< Interpolator between fixed demod bandwidth and audio bandwidth (rational)
|
||||
|
@ -40,6 +40,7 @@ const int DSDDemod::m_udpBlockSize = 512;
|
||||
|
||||
DSDDemod::DSDDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_interpolatorDistance(0.0f),
|
||||
m_interpolatorDistanceRemain(0.0f),
|
||||
m_sampleCount(0),
|
||||
@ -349,6 +350,7 @@ bool DSDDemod::handleMessage(const Message& cmd)
|
||||
DSDDemodSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_settings.m_inputFrequencyOffset; }
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
@ -151,12 +151,13 @@ private:
|
||||
RSRunning
|
||||
};
|
||||
|
||||
DSDDemodSettings m_settings;
|
||||
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
DSDDemodSettings m_settings;
|
||||
int m_absoluteFrequencyOffset;
|
||||
|
||||
NCO m_nco;
|
||||
Interpolator m_interpolator;
|
||||
Real m_interpolatorDistance;
|
||||
|
@ -66,6 +66,7 @@ LoRaDemod::LoRaDemod(DeviceSourceAPI* deviceAPI) :
|
||||
m_channelizer = new DownChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
}
|
||||
|
||||
LoRaDemod::~LoRaDemod()
|
||||
@ -81,6 +82,7 @@ LoRaDemod::~LoRaDemod()
|
||||
if (finetune)
|
||||
delete [] finetune;
|
||||
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <QMutex>
|
||||
#include <vector>
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "dsp/nco.h"
|
||||
#include "dsp/interpolator.h"
|
||||
#include "util/message.h"
|
||||
@ -39,7 +40,7 @@ class DeviceSourceAPI;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
|
||||
class LoRaDemod : public BasebandSampleSink {
|
||||
class LoRaDemod : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
public:
|
||||
class MsgConfigureLoRaDemod : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
@ -96,6 +97,10 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return 0; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
static const QString m_channelID;
|
||||
|
||||
private:
|
||||
|
@ -22,6 +22,7 @@ void LoRaDemodSettings::resetToDefaults()
|
||||
m_bandwidthIndex = 0;
|
||||
m_spread = 0;
|
||||
m_rgbColor = QColor(255, 0, 255).rgb();
|
||||
m_title = "LoRa Demodulator";
|
||||
}
|
||||
|
||||
QByteArray LoRaDemodSettings::serialize() const
|
||||
@ -39,6 +40,8 @@ QByteArray LoRaDemodSettings::serialize() const
|
||||
s.writeBlob(5, m_channelMarker->serialize());
|
||||
}
|
||||
|
||||
s.writeString(6, m_title);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -70,6 +73,8 @@ bool LoRaDemodSettings::deserialize(const QByteArray& data)
|
||||
m_channelMarker->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
d.readString(6, &m_title, "LoRa Demodulator");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -3,6 +3,8 @@
|
||||
#define PLUGINS_CHANNELRX_DEMODLORA_LORADEMODSETTINGS_H_
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class Serializable;
|
||||
@ -13,6 +15,7 @@ struct LoRaDemodSettings
|
||||
int m_bandwidthIndex;
|
||||
int m_spread;
|
||||
uint32_t m_rgbColor;
|
||||
QString m_title;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
Serializable *m_spectrumGUI;
|
||||
|
@ -42,6 +42,7 @@ const int NFMDemod::m_udpBlockSize = 512;
|
||||
|
||||
NFMDemod::NFMDemod(DeviceSourceAPI *devieAPI) :
|
||||
m_deviceAPI(devieAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_ctcssIndex(0),
|
||||
m_sampleCount(0),
|
||||
m_squelchCount(0),
|
||||
@ -77,6 +78,7 @@ NFMDemod::NFMDemod(DeviceSourceAPI *devieAPI) :
|
||||
m_channelizer = new DownChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
}
|
||||
@ -85,6 +87,7 @@ NFMDemod::~NFMDemod()
|
||||
{
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
delete m_udpBufferAudio;
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
@ -345,6 +348,7 @@ bool NFMDemod::handleMessage(const Message& cmd)
|
||||
|
||||
NFMDemodSettings settings = cfg.getSettings();
|
||||
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -18,10 +18,12 @@
|
||||
#ifndef INCLUDE_NFMDEMOD_H
|
||||
#define INCLUDE_NFMDEMOD_H
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include <dsp/phasediscri.h>
|
||||
#include <QMutex>
|
||||
#include <vector>
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "dsp/phasediscri.h"
|
||||
#include "dsp/nco.h"
|
||||
#include "dsp/interpolator.h"
|
||||
#include "dsp/lowpass.h"
|
||||
@ -39,7 +41,7 @@ class DeviceSourceAPI;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
|
||||
class NFMDemod : public BasebandSampleSink {
|
||||
class NFMDemod : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
public:
|
||||
class MsgConfigureNFMDemod : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
@ -115,6 +117,10 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
const Real *getCtcssToneSet(int& nbTones) const {
|
||||
nbTones = m_ctcssDetector.getNTones();
|
||||
return m_ctcssDetector.getToneSet();
|
||||
@ -151,6 +157,7 @@ private:
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
NFMDemodSettings m_settings;
|
||||
int m_absoluteFrequencyOffset;
|
||||
|
||||
NCO m_nco;
|
||||
Interpolator m_interpolator;
|
||||
|
@ -224,8 +224,9 @@ void NFMDemodGUI::onMenuDialogCalled(const QPoint &p)
|
||||
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
|
||||
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
|
||||
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
||||
m_settings.m_title = m_channelMarker.getTitle();
|
||||
|
||||
setWindowTitle(m_channelMarker.getTitle());
|
||||
setWindowTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
displayUDPAddress();
|
||||
|
||||
@ -336,6 +337,7 @@ void NFMDemodGUI::displaySettings()
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.blockSignals(false);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor);
|
||||
|
||||
|
@ -55,6 +55,7 @@ void NFMDemodSettings::resetToDefaults()
|
||||
m_udpAddress = "127.0.0.1";
|
||||
m_udpPort = 9999;
|
||||
m_rgbColor = QColor(255, 0, 0).rgb();
|
||||
m_title = "NFM Demodulator";
|
||||
}
|
||||
|
||||
QByteArray NFMDemodSettings::serialize() const
|
||||
@ -75,6 +76,9 @@ QByteArray NFMDemodSettings::serialize() const
|
||||
if (m_channelMarker) {
|
||||
s.writeBlob(13, m_channelMarker->serialize());
|
||||
}
|
||||
|
||||
s.writeString(14, m_title);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -116,6 +120,7 @@ bool NFMDemodSettings::deserialize(const QByteArray& data)
|
||||
d.readBool(10, &m_audioMute, false);
|
||||
d.readS32(11, &m_squelchGate, 5);
|
||||
d.readBool(12, &m_deltaSquelch, false);
|
||||
d.readString(14, &m_title, "NFM Demodulator");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ struct NFMDemodSettings
|
||||
QString m_udpAddress;
|
||||
uint16_t m_udpPort;
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
|
||||
|
@ -60,8 +60,8 @@ SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_volume = 2.0;
|
||||
m_spanLog2 = 3;
|
||||
m_sampleRate = 96000;
|
||||
m_frequency = 0;
|
||||
m_nco.setFreq(m_frequency, m_sampleRate);
|
||||
m_absoluteFrequencyOffset = 0;
|
||||
m_nco.setFreq(m_absoluteFrequencyOffset, m_sampleRate);
|
||||
m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
||||
|
||||
m_interpolator.create(16, m_sampleRate, 5000);
|
||||
@ -89,6 +89,7 @@ SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_channelizer = new DownChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
}
|
||||
@ -100,6 +101,7 @@ SSBDemod::~SSBDemod()
|
||||
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
@ -318,7 +320,8 @@ bool SSBDemod::handleMessage(const Message& cmd)
|
||||
|
||||
SSBDemodSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotificatione
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset; // save as absolut frequency shift in baseband
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <QMutex>
|
||||
#include <vector>
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "dsp/ncof.h"
|
||||
#include "dsp/interpolator.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
@ -38,7 +39,7 @@ class DeviceSourceAPI;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
|
||||
class SSBDemod : public BasebandSampleSink {
|
||||
class SSBDemod : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
public:
|
||||
class MsgConfigureSSBDemod : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
@ -110,7 +111,11 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
double getMagSq() const { return m_magsq; }
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
double getMagSq() const { return m_magsq; }
|
||||
bool getAudioActive() const { return m_audioActive; }
|
||||
|
||||
void getMagSqLevels(double& avg, double& peak, int& nbSamples)
|
||||
@ -232,7 +237,7 @@ private:
|
||||
fftfilt::cmplx m_sum;
|
||||
int m_undersampleCount;
|
||||
int m_sampleRate;
|
||||
int m_frequency;
|
||||
int m_absoluteFrequencyOffset;
|
||||
bool m_audioBinaual;
|
||||
bool m_audioFlipChannels;
|
||||
bool m_usb;
|
||||
|
@ -375,6 +375,7 @@ void SSBDemodGUI::displaySettings()
|
||||
{
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth * 2);
|
||||
m_channelMarker.setLowCutoff(m_settings.m_lowCutoff);
|
||||
|
||||
|
@ -47,6 +47,7 @@ void SSBDemodSettings::resetToDefaults()
|
||||
m_inputFrequencyOffset = 0;
|
||||
m_audioSampleRate = DSPEngine::instance()->getAudioSampleRate();
|
||||
m_rgbColor = QColor(0, 255, 0).rgb();
|
||||
m_title = "SSB Demodulator";
|
||||
}
|
||||
|
||||
QByteArray SSBDemodSettings::serialize() const
|
||||
@ -71,6 +72,8 @@ QByteArray SSBDemodSettings::serialize() const
|
||||
s.writeS32(13, m_agcPowerThreshold);
|
||||
s.writeS32(14, m_agcThresholdGate);
|
||||
s.writeBool(15, m_agcClamping);
|
||||
s.writeString(16, m_title);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -113,6 +116,7 @@ bool SSBDemodSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(13, &m_agcPowerThreshold, -40);
|
||||
d.readS32(14, &m_agcThresholdGate, 4);
|
||||
d.readBool(15, &m_agcClamping, false);
|
||||
d.readString(16, &m_title, "SSB Demodulator");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ struct SSBDemodSettings
|
||||
QString m_udpAddress;
|
||||
quint16 m_udpPort;
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
Serializable *m_spectrumGUI;
|
||||
|
@ -37,6 +37,7 @@ const QString WFMDemod::m_channelID = "de.maintech.sdrangelove.channel.wfm";
|
||||
|
||||
WFMDemod::WFMDemod(DeviceSourceAPI* deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_squelchOpen(false),
|
||||
m_magsq(0.0f),
|
||||
m_magsqSum(0.0f),
|
||||
@ -63,6 +64,7 @@ WFMDemod::WFMDemod(DeviceSourceAPI* deviceAPI) :
|
||||
m_channelizer = new DownChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
}
|
||||
@ -76,6 +78,7 @@ WFMDemod::~WFMDemod()
|
||||
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
@ -233,6 +236,7 @@ bool WFMDemod::handleMessage(const Message& cmd)
|
||||
WFMDemodSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
||||
#ifndef INCLUDE_WFMDEMOD_H
|
||||
#define INCLUDE_WFMDEMOD_H
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include <QMutex>
|
||||
#include <vector>
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "dsp/nco.h"
|
||||
#include "dsp/interpolator.h"
|
||||
#include "dsp/lowpass.h"
|
||||
@ -38,7 +40,7 @@ class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
class DeviceSourceAPI;
|
||||
|
||||
class WFMDemod : public BasebandSampleSink {
|
||||
class WFMDemod : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
public:
|
||||
class MsgConfigureWFMDemod : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
@ -95,6 +97,10 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
double getMagSq() const { return m_movingAverage.average(); }
|
||||
bool getSquelchOpen() const { return m_squelchOpen; }
|
||||
|
||||
@ -120,7 +126,9 @@ private:
|
||||
DeviceSourceAPI* m_deviceAPI;
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
WFMDemodSettings m_settings;
|
||||
int m_absoluteFrequencyOffset;
|
||||
|
||||
NCO m_nco;
|
||||
Interpolator m_interpolator; //!< Interpolator between sample rate sent from DSP engine and requested RF bandwidth (rational)
|
||||
|
@ -145,8 +145,9 @@ void WFMDemodGUI::onMenuDialogCalled(const QPoint &p)
|
||||
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
|
||||
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
|
||||
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
||||
m_settings.m_title = m_channelMarker.getTitle();
|
||||
|
||||
setWindowTitle(m_channelMarker.getTitle());
|
||||
setWindowTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
displayUDPAddress();
|
||||
|
||||
@ -240,6 +241,7 @@ void WFMDemodGUI::displaySettings()
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.blockSignals(false);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
||||
|
||||
|
@ -48,6 +48,7 @@ void WFMDemodSettings::resetToDefaults()
|
||||
m_udpAddress = "127.0.0.1";
|
||||
m_udpPort = 9999;
|
||||
m_rgbColor = QColor(0, 0, 255).rgb();
|
||||
m_title = "WFM Demodulator";
|
||||
}
|
||||
|
||||
QByteArray WFMDemodSettings::serialize() const
|
||||
@ -59,6 +60,7 @@ QByteArray WFMDemodSettings::serialize() const
|
||||
s.writeS32(4, m_volume*10.0);
|
||||
s.writeS32(5, m_squelch);
|
||||
s.writeU32(7, m_rgbColor);
|
||||
s.writeString(8, m_title);
|
||||
|
||||
if (m_channelMarker) {
|
||||
s.writeBlob(11, m_channelMarker->serialize());
|
||||
@ -94,6 +96,7 @@ bool WFMDemodSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(5, &tmp, -60);
|
||||
m_squelch = tmp;
|
||||
d.readU32(7, &m_rgbColor);
|
||||
d.readString(8, &m_title, "WFM Demodulator");
|
||||
|
||||
d.readBlob(11, &bytetmp);
|
||||
|
||||
|
@ -34,6 +34,7 @@ struct WFMDemodSettings
|
||||
QString m_udpAddress;
|
||||
quint16 m_udpPort;
|
||||
quint32 m_rgbColor;
|
||||
QString m_title;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
|
||||
|
@ -34,6 +34,7 @@ const QString TCPSrc::m_channelID = "sdrangel.channel.tcpsrc";
|
||||
|
||||
TCPSrc::TCPSrc(DeviceSourceAPI* deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_settingsMutex(QMutex::Recursive)
|
||||
{
|
||||
setObjectName("TCPSrc");
|
||||
@ -64,12 +65,14 @@ TCPSrc::TCPSrc(DeviceSourceAPI* deviceAPI) :
|
||||
m_channelizer = new DownChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
}
|
||||
|
||||
TCPSrc::~TCPSrc()
|
||||
{
|
||||
if (TCPFilter) delete TCPFilter;
|
||||
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
@ -226,6 +229,7 @@ bool TCPSrc::handleMessage(const Message& cmd)
|
||||
TCPSrcSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <QMutex>
|
||||
#include <QHostAddress>
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "dsp/nco.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
#include "dsp/interpolator.h"
|
||||
@ -21,7 +22,7 @@ class DeviceSourceAPI;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
|
||||
class TCPSrc : public BasebandSampleSink {
|
||||
class TCPSrc : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -113,6 +114,10 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
static const QString m_channelID;
|
||||
|
||||
protected:
|
||||
@ -155,11 +160,13 @@ protected:
|
||||
{ }
|
||||
};
|
||||
|
||||
TCPSrcSettings m_settings;
|
||||
DeviceSourceAPI* m_deviceAPI;
|
||||
DeviceSourceAPI* m_deviceAPI;
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
TCPSrcSettings m_settings;
|
||||
int m_absoluteFrequencyOffset;
|
||||
|
||||
int m_inputSampleRate;
|
||||
|
||||
int m_sampleFormat;
|
||||
|
@ -53,16 +53,6 @@ void TCPSrcGUI::resetToDefaults()
|
||||
QByteArray TCPSrcGUI::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
// SimpleSerializer s(1);
|
||||
// s.writeS32(2, m_channelMarker.getCenterFrequency());
|
||||
// s.writeS32(3, m_sampleFormat);
|
||||
// s.writeReal(4, m_outputSampleRate);
|
||||
// s.writeReal(5, m_rfBandwidth);
|
||||
// s.writeS32(6, m_tcpPort);
|
||||
// s.writeBlob(7, ui->spectrumGUI->serialize());
|
||||
// s.writeS32(8, (qint32)m_boost);
|
||||
// s.writeS32(9, m_channelMarker.getCenterFrequency());
|
||||
// return s.final();
|
||||
}
|
||||
|
||||
bool TCPSrcGUI::deserialize(const QByteArray& data)
|
||||
@ -309,6 +299,7 @@ void TCPSrcGUI::displaySettings()
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.blockSignals(false);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
||||
|
||||
|
@ -50,6 +50,7 @@ void TCPSrcSettings::resetToDefaults()
|
||||
m_udpPort = 9999;
|
||||
m_audioPort = 9998;
|
||||
m_rgbColor = QColor(225, 25, 99).rgb();
|
||||
m_title = "TCP Source";
|
||||
}
|
||||
|
||||
QByteArray TCPSrcSettings::serialize() const
|
||||
@ -78,6 +79,8 @@ QByteArray TCPSrcSettings::serialize() const
|
||||
s.writeS32(16, m_squelchdB);
|
||||
s.writeS32(17, m_squelchGate);
|
||||
s.writeBool(18, m_agc);
|
||||
s.writeString(19, m_title);
|
||||
|
||||
return s.final();
|
||||
|
||||
}
|
||||
@ -134,6 +137,8 @@ bool TCPSrcSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(16, &m_squelchdB, -60);
|
||||
d.readS32(17, &m_squelchGate, 5);
|
||||
d.readBool(18, &m_agc, false);
|
||||
d.readString(19, &m_title, "TCP Source");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -54,6 +54,8 @@ struct TCPSrcSettings
|
||||
uint16_t m_udpPort;
|
||||
uint16_t m_audioPort;
|
||||
|
||||
QString m_title;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
Serializable *m_spectrumGUI;
|
||||
|
||||
|
@ -37,6 +37,7 @@ const QString UDPSrc::m_channelID = "sdrangel.channel.udpsrc";
|
||||
|
||||
UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_absoluteFrequencyOffset(0),
|
||||
m_outMovingAverage(480, 1e-10),
|
||||
m_inMovingAverage(480, 1e-10),
|
||||
m_amMovingAverage(1200, 1e-10),
|
||||
@ -96,6 +97,7 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
m_channelizer = new DownChannelizer(this);
|
||||
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
|
||||
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
|
||||
m_deviceAPI->addChannelAPI(this);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
}
|
||||
@ -108,6 +110,7 @@ UDPSrc::~UDPSrc()
|
||||
delete[] m_udpAudioBuf;
|
||||
if (UDPFilter) delete UDPFilter;
|
||||
if (m_settings.m_audioActive) DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
m_deviceAPI->removeChannelAPI(this);
|
||||
m_deviceAPI->removeThreadedSink(m_threadedChannelizer);
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
@ -353,6 +356,7 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
UDPSrcSettings settings = cfg.getSettings();
|
||||
|
||||
// These settings are set with DownChannelizer::MsgChannelizerNotification
|
||||
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
settings.m_inputSampleRate = m_settings.m_inputSampleRate;
|
||||
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
||||
#ifndef INCLUDE_UDPSRC_H
|
||||
#define INCLUDE_UDPSRC_H
|
||||
|
||||
#include <dsp/basebandsamplesink.h>
|
||||
#include <QMutex>
|
||||
#include <QHostAddress>
|
||||
|
||||
#include "dsp/basebandsamplesink.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "dsp/nco.h"
|
||||
#include "dsp/fftfilt.h"
|
||||
#include "dsp/interpolator.h"
|
||||
@ -39,7 +41,7 @@ class DeviceSourceAPI;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class DownChannelizer;
|
||||
|
||||
class UDPSrc : public BasebandSampleSink {
|
||||
class UDPSrc : public BasebandSampleSink, public ChannelSinkAPI {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -104,6 +106,10 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual int getDeltaFrequency() const { return m_absoluteFrequencyOffset; }
|
||||
virtual void getIdentifier(QString& id) { id = objectName(); }
|
||||
virtual void getTitle(QString& title) { title = m_settings.m_title; }
|
||||
|
||||
static const QString m_channelID;
|
||||
static const int udpBlockSize = 512; // UDP block size in number of bytes
|
||||
|
||||
@ -131,12 +137,13 @@ protected:
|
||||
{ }
|
||||
};
|
||||
|
||||
UDPSrcSettings m_settings;
|
||||
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
|
||||
UDPSrcSettings m_settings;
|
||||
int m_absoluteFrequencyOffset;
|
||||
|
||||
QUdpSocket *m_audioSocket;
|
||||
|
||||
double m_magsq;
|
||||
|
@ -215,6 +215,7 @@ void UDPSrcGUI::displaySettings()
|
||||
m_channelMarker.blockSignals(true);
|
||||
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
m_channelMarker.setTitle(m_settings.m_title);
|
||||
m_channelMarker.blockSignals(false);
|
||||
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
|
||||
|
||||
@ -544,8 +545,9 @@ void UDPSrcGUI::onMenuDialogCalled(const QPoint &p)
|
||||
m_settings.m_udpAddress = m_channelMarker.getUDPAddress(),
|
||||
m_settings.m_udpPort = m_channelMarker.getUDPSendPort(),
|
||||
m_settings.m_rgbColor = m_channelMarker.getColor().rgb();
|
||||
m_settings.m_title = m_channelMarker.getTitle();
|
||||
|
||||
setWindowTitle(m_channelMarker.getTitle());
|
||||
setWindowTitle(m_settings.m_title);
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
displayUDPAddress();
|
||||
|
||||
|
@ -49,6 +49,7 @@ void UDPSrcSettings::resetToDefaults()
|
||||
m_udpPort = 9999;
|
||||
m_audioPort = 9998;
|
||||
m_rgbColor = QColor(225, 25, 99).rgb();
|
||||
m_title = "UDP Sample Source";
|
||||
}
|
||||
|
||||
QByteArray UDPSrcSettings::serialize() const
|
||||
@ -76,6 +77,8 @@ QByteArray UDPSrcSettings::serialize() const
|
||||
s.writeS32(16, m_squelchdB);
|
||||
s.writeS32(17, m_squelchGate);
|
||||
s.writeBool(18, m_agc);
|
||||
s.writeString(19, m_title);
|
||||
|
||||
return s.final();
|
||||
|
||||
}
|
||||
@ -130,6 +133,8 @@ bool UDPSrcSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(16, &m_squelchdB, -60);
|
||||
d.readS32(17, &m_squelchGate, 5);
|
||||
d.readBool(18, &m_agc, false);
|
||||
d.readString(19, &m_title, "UDP Sample Source");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -60,6 +60,8 @@ struct UDPSrcSettings
|
||||
uint16_t m_udpPort;
|
||||
uint16_t m_audioPort;
|
||||
|
||||
QString m_title;
|
||||
|
||||
Serializable *m_channelMarker;
|
||||
Serializable *m_spectrumGUI;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user