1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

Web API: report Tx channel info summary

This commit is contained in:
f4exb 2017-11-19 19:14:33 +01:00
parent dc50ba1249
commit 4169833b4d
24 changed files with 99 additions and 6 deletions

View File

@ -41,6 +41,7 @@ const int AMMod::m_levelNbSamples = 480; // every 10ms
AMMod::AMMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_absoluteFrequencyOffset(0),
m_movingAverage(40, 0),
m_volumeAGC(40, 0),
m_audioFifo(4800),
@ -296,6 +297,7 @@ bool AMMod::handleMessage(const Message& cmd)
AMModSettings settings = cfg.getSettings();
// These settings are set with DownChannelizer::MsgChannelizerNotification
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_basebandSampleRate = m_settings.m_basebandSampleRate;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;

View File

@ -23,6 +23,7 @@
#include <fstream>
#include "dsp/basebandsamplesource.h"
#include "channel/channelsourceapi.h"
#include "dsp/nco.h"
#include "dsp/ncof.h"
#include "dsp/interpolator.h"
@ -38,7 +39,7 @@ class ThreadedBasebandSampleSource;
class UpChannelizer;
class DeviceSinkAPI;
class AMMod : public BasebandSampleSource {
class AMMod : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
@ -234,6 +235,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_magsq; }
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
@ -259,7 +264,9 @@ private:
DeviceSinkAPI* m_deviceAPI;
ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer;
AMModSettings m_settings;
int m_absoluteFrequencyOffset;
NCO m_carrierNco;
NCOF m_toneNco;

View File

@ -41,6 +41,7 @@ void AMModSettings::resetToDefaults()
m_channelMute = false;
m_playLoop = false;
m_rgbColor = QColor(255, 255, 0).rgb();
m_title = "AM Modulator";
}
QByteArray AMModSettings::serialize() const
@ -62,6 +63,8 @@ QByteArray AMModSettings::serialize() const
s.writeBlob(8, m_channelMarker->serialize());
}
s.writeString(9, m_title);
return s.final();
}
@ -98,6 +101,8 @@ bool AMModSettings::deserialize(const QByteArray& data)
m_channelMarker->deserialize(bytetmp);
}
d.readString(9, &m_title, "AM Modulator");
return true;
}
else

View File

@ -34,6 +34,7 @@ struct AMModSettings
bool m_channelMute;
bool m_playLoop;
quint32 m_rgbColor;
QString m_title;
Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI;

View File

@ -50,6 +50,7 @@ const int ATVMod::m_ssbFftLen = 1024;
ATVMod::ATVMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_absoluteFrequencyOffset(0),
m_modPhasor(0.0f),
m_tvSampleRate(1000000),
m_evenImage(true),
@ -527,6 +528,7 @@ bool ATVMod::handleMessage(const Message& cmd)
ATVModSettings settings = cfg.getSettings();
// These settings are set with UpChannelizer::MsgChannelizerNotification
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;

View File

@ -28,6 +28,7 @@
#include <stdint.h>
#include "dsp/basebandsamplesource.h"
#include "channel/channelsourceapi.h"
#include "dsp/nco.h"
#include "dsp/interpolator.h"
#include "dsp/movingaverage.h"
@ -40,7 +41,7 @@ class DeviceSinkAPI;
class ThreadedBasebandSampleSource;
class UpChannelizer;
class ATVMod : public BasebandSampleSource {
class ATVMod : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
@ -400,6 +401,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; }
int getEffectiveSampleRate() const { return m_tvSampleRate; };
double getMagSq() const { return m_movingAverage.average(); }
void getCameraNumbers(std::vector<int>& numbers);
@ -456,7 +461,9 @@ private:
DeviceSinkAPI* m_deviceAPI;
ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer;
ATVModSettings m_settings;
int m_absoluteFrequencyOffset;
NCO m_carrierNco;
Complex m_modSample;

View File

@ -49,6 +49,7 @@ void ATVModSettings::resetToDefaults()
m_forceDecimator = false;
m_overlayText = "ATV";
m_rgbColor = QColor(255, 255, 255).rgb();
m_title = "ATV Modulator";
}
QByteArray ATVModSettings::serialize() const
@ -74,6 +75,8 @@ QByteArray ATVModSettings::serialize() const
s.writeBlob(15, m_channelMarker->serialize());
}
s.writeString(16, m_title);
return s.final();
}
@ -120,6 +123,8 @@ bool ATVModSettings::deserialize(const QByteArray& data)
m_channelMarker->deserialize(bytetmp);
}
d.readString(16, &m_title, "ATV Modulator");
return true;
}
else

View File

@ -78,6 +78,7 @@ struct ATVModSettings
bool m_forceDecimator; //!< Forces decimator even when channel and source sample rates are equal
QString m_overlayText;
quint32 m_rgbColor;
QString m_title;
QString m_udpAddress;
uint16_t m_udpPort;

View File

@ -44,6 +44,7 @@ const int NFMMod::m_levelNbSamples = 480; // every 10ms
NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_absoluteFrequencyOffset(0),
m_modPhasor(0.0f),
m_movingAverage(40, 0),
m_volumeAGC(40, 0),
@ -309,6 +310,7 @@ bool NFMMod::handleMessage(const Message& cmd)
NFMModSettings settings = cfg.getSettings();
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;

View File

@ -23,6 +23,7 @@
#include <fstream>
#include "dsp/basebandsamplesource.h"
#include "channel/channelsourceapi.h"
#include "dsp/nco.h"
#include "dsp/ncof.h"
#include "dsp/interpolator.h"
@ -40,7 +41,7 @@ class DeviceSinkAPI;
class ThreadedBasebandSampleSource;
class UpChannelizer;
class NFMMod : public BasebandSampleSource {
class NFMMod : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
@ -236,6 +237,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_magsq; }
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
@ -261,7 +266,9 @@ private:
DeviceSinkAPI* m_deviceAPI;
ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer;
NFMModSettings m_settings;
int m_absoluteFrequencyOffset;
NCO m_carrierNco;
NCOF m_toneNco;

View File

@ -58,6 +58,7 @@ void NFMModSettings::resetToDefaults()
m_ctcssOn = false;
m_ctcssIndex = 0;
m_rgbColor = QColor(255, 0, 0).rgb();
m_title = "NFM Modulator";
}
QByteArray NFMModSettings::serialize() const
@ -82,6 +83,7 @@ QByteArray NFMModSettings::serialize() const
s.writeBool(9, m_ctcssOn);
s.writeS32(10, m_ctcssIndex);
s.writeString(12, m_title);
return s.final();
}
@ -123,6 +125,8 @@ bool NFMModSettings::deserialize(const QByteArray& data)
m_channelMarker->deserialize(bytetmp);
}
d.readString(12, &m_title, "NFM Modulator");
return true;
}
else

View File

@ -42,6 +42,7 @@ struct NFMModSettings
bool m_ctcssOn;
int m_ctcssIndex;
quint32 m_rgbColor;
QString m_title;
Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI;

View File

@ -43,6 +43,7 @@ const int SSBMod::m_ssbFftLen = 1024;
SSBMod::SSBMod(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_absoluteFrequencyOffset(0),
m_SSBFilter(0),
m_DSBFilter(0),
m_SSBFilterBuffer(0),
@ -569,6 +570,7 @@ bool SSBMod::handleMessage(const Message& cmd)
SSBModSettings settings = cfg.getSettings();
// These settings are set with UpChannelizer::MsgChannelizerNotification
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_basebandSampleRate = m_settings.m_basebandSampleRate;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;

View File

@ -23,6 +23,7 @@
#include <fstream>
#include "dsp/basebandsamplesource.h"
#include "channel/channelsourceapi.h"
#include "dsp/basebandsamplesink.h"
#include "dsp/ncof.h"
#include "dsp/interpolator.h"
@ -39,7 +40,7 @@ class DeviceSinkAPI;
class ThreadedBasebandSampleSource;
class UpChannelizer;
class SSBMod : public BasebandSampleSource {
class SSBMod : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
@ -237,6 +238,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_magsq; }
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
@ -262,7 +267,9 @@ private:
DeviceSinkAPI* m_deviceAPI;
ThreadedBasebandSampleSource* m_threadedChannelizer;
UpChannelizer* m_channelizer;
SSBModSettings m_settings;
int m_absoluteFrequencyOffset;
NCOF m_carrierNco;
NCOF m_toneNco;

View File

@ -70,6 +70,7 @@ void SSBModSettings::resetToDefaults()
m_rgbColor = QColor(0, 255, 0).rgb();
m_udpAddress = "127.0.0.1";
m_udpPort = 9999;
m_title = "SSB Modulator";
}
QByteArray SSBModSettings::serialize() const
@ -106,6 +107,8 @@ QByteArray SSBModSettings::serialize() const
s.writeBlob(18, m_channelMarker->serialize());
}
s.writeString(19, m_title);
return s.final();
}
@ -164,6 +167,13 @@ bool SSBModSettings::deserialize(const QByteArray& data)
d.readS32(17, &tmp, 20);
m_agcOrder = tmp / 100.0;
if (m_channelMarker) {
d.readBlob(18, &bytetmp);
m_channelMarker->deserialize(bytetmp);
}
d.readString(19, &m_title, "SSB Modulator");
return true;
}
else

View File

@ -55,6 +55,8 @@ struct SSBModSettings
QString m_udpAddress;
uint16_t m_udpPort;
QString m_title;
Serializable *m_channelMarker;
Serializable *m_spectrumGUI;
Serializable *m_cwKeyerGUI;

View File

@ -322,6 +322,7 @@ bool WFMMod::handleMessage(const Message& cmd)
WFMModSettings settings = cfg.getSettings();
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_basebandSampleRate = m_settings.m_basebandSampleRate;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;

View File

@ -23,6 +23,7 @@
#include <fstream>
#include "dsp/basebandsamplesource.h"
#include "channel/channelsourceapi.h"
#include "dsp/nco.h"
#include "dsp/ncof.h"
#include "dsp/interpolator.h"
@ -39,7 +40,7 @@ class DeviceSinkAPI;
class ThreadedBasebandSampleSource;
class UpChannelizer;
class WFMMod : public BasebandSampleSource {
class WFMMod : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
@ -235,6 +236,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_magsq; }
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
@ -262,6 +267,7 @@ private:
UpChannelizer* m_channelizer;
WFMModSettings m_settings;
int m_absoluteFrequencyOffset;
NCO m_carrierNco;
NCOF m_toneNco;

View File

@ -49,6 +49,7 @@ void WFMModSettings::resetToDefaults()
m_channelMute = false;
m_playLoop = false;
m_rgbColor = QColor(0, 0, 255).rgb();
m_title = "WFM Modulator";
}
QByteArray WFMModSettings::serialize() const
@ -71,6 +72,8 @@ QByteArray WFMModSettings::serialize() const
s.writeBlob(9, m_channelMarker->serialize());
}
s.writeString(10, m_title);
return s.final();
}
@ -108,6 +111,8 @@ bool WFMModSettings::deserialize(const QByteArray& data)
m_channelMarker->deserialize(bytetmp);
}
d.readString(10, &m_title, "WFM Modulator");
return true;
}
else

View File

@ -38,6 +38,7 @@ struct WFMModSettings
bool m_channelMute;
bool m_playLoop;
quint32 m_rgbColor;
QString m_title;
Serializable *m_channelMarker;
Serializable *m_cwKeyerGUI;

View File

@ -346,6 +346,7 @@ bool UDPSink::handleMessage(const Message& cmd)
UDPSinkSettings settings = cfg.getSettings();
// These settings are set with DownChannelizer::MsgChannelizerNotification
m_absoluteFrequencyOffset = settings.m_inputFrequencyOffset;
settings.m_basebandSampleRate = m_settings.m_basebandSampleRate;
settings.m_outputSampleRate = m_settings.m_outputSampleRate;
settings.m_inputFrequencyOffset = m_settings.m_inputFrequencyOffset;

View File

@ -20,6 +20,7 @@
#include <QObject>
#include "dsp/basebandsamplesource.h"
#include "channel/channelsourceapi.h"
#include "dsp/basebandsamplesink.h"
#include "dsp/interpolator.h"
#include "dsp/movingaverage.h"
@ -34,7 +35,7 @@ class DeviceSinkAPI;
class ThreadedBasebandSampleSource;
class UpChannelizer;
class UDPSink : public BasebandSampleSource {
class UDPSink : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
@ -95,6 +96,10 @@ public:
virtual void pull(Sample& sample);
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_magsq; }
double getInMagSq() const { return m_inMagsq; }
int32_t getBufferGauge() const { return m_udpHandler.getBufferGauge(); }
@ -157,6 +162,8 @@ private:
UpChannelizer* m_channelizer;
UDPSinkSettings m_settings;
int m_absoluteFrequencyOffset;
Real m_squelch;
NCO m_carrierNco;

View File

@ -48,6 +48,7 @@ void UDPSinkSettings::resetToDefaults()
m_udpAddress = "127.0.0.1";
m_udpPort = 9999;
m_rgbColor = QColor(225, 25, 99).rgb();
m_title = "UDP Sample Sink";
}
QByteArray UDPSinkSettings::serialize() const
@ -76,6 +77,8 @@ QByteArray UDPSinkSettings::serialize() const
s.writeS32(17, roundf(m_gainIn * 10.0));
s.writeString(18, m_udpAddress);
s.writeU32(19, m_udpPort);
s.writeString(20, m_title);
return s.final();
}
@ -150,6 +153,8 @@ bool UDPSinkSettings::deserialize(const QByteArray& data)
m_udpPort = 9999;
}
d.readString(20, &m_title, "UDP Sample Sink");
return true;
}
else

View File

@ -56,6 +56,8 @@ struct UDPSinkSettings
QString m_udpAddress;
uint16_t m_udpPort;
QString m_title;
Serializable *m_channelMarker;
Serializable *m_spectrumGUI;