1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Merge pull request #2174 from srcejon/freq_scanner

ILS Demod: Add DDM/SDM/Deviation to ILS channel report
This commit is contained in:
Edouard Griffiths 2024-06-18 17:20:51 +02:00 committed by GitHub
commit deb4feed3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 332 additions and 22 deletions

View File

@ -37,6 +37,7 @@
#include "device/deviceapi.h"
#include "settings/serializable.h"
#include "util/db.h"
#include "util/morse.h"
#include "maincore.h"
MESSAGE_CLASS_DEFINITION(ILSDemod::MsgConfigureILSDemod, Message)
@ -46,11 +47,17 @@ const char * const ILSDemod::m_channelIdURI = "sdrangel.channel.ilsdemod";
const char * const ILSDemod::m_channelId = "ILSDemod";
ILSDemod::ILSDemod(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
m_deviceAPI(deviceAPI),
m_running(false),
m_spectrumVis(SDR_RX_SCALEF),
m_basebandSampleRate(0)
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
m_deviceAPI(deviceAPI),
m_running(false),
m_spectrumVis(SDR_RX_SCALEF),
m_basebandSampleRate(0),
m_ident(""),
m_dm90(NAN),
m_dm150(NAN),
m_sdm(NAN),
m_ddm(NAN),
m_angle(NAN)
{
setObjectName(m_channelId);
@ -201,6 +208,9 @@ bool ILSDemod::handleMessage(const Message& cmd)
m_guiMessageQueue->push(msg);
}
// Save for channel report
m_ident = Morse::toString(report.getIdent());
return true;
}
else if (ILSDemod::MsgAngleEstimate::match(cmd))
@ -246,6 +256,13 @@ bool ILSDemod::handleMessage(const Message& cmd)
<< "\n";
}
// Save for channel report
m_sdm = report.getSDM();
m_ddm = report.getDDM();
m_dm90 = report.getModDepth90();
m_dm150 = report.getModDepth150();
m_angle = report.getAngle();
return true;
}
else if (MainCore::MsgChannelDemodQuery::match(cmd))
@ -736,6 +753,12 @@ void ILSDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response
response.getIlsDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
response.getIlsDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate());
response.getIlsDemodReport()->setIdent(new QString(m_ident));
response.getIlsDemodReport()->setDeviation(m_angle);
response.getIlsDemodReport()->setSdm(m_sdm);
response.getIlsDemodReport()->setDdm(m_ddm);
response.getIlsDemodReport()->setDm90(m_dm90);
response.getIlsDemodReport()->setDm150(m_dm150);
}
void ILSDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const ILSDemodSettings& settings, bool force)

View File

@ -205,6 +205,14 @@ private:
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
// Saved values from sink for channel report
QString m_ident;
Real m_dm90;
Real m_dm150;
Real m_sdm;
Real m_ddm;
Real m_angle;
virtual bool handleMessage(const Message& cmd);
void applySettings(const ILSDemodSettings& settings, bool force = false);
void sendSampleRateToDemodAnalyzer();

View File

@ -93,6 +93,7 @@ const QList<ILSDemodGUI::ILS> ILSDemodGUI::m_ils = {
{"EGLC", "ILSR", "27", 111150000, 272.89, 5.5, 51.504927, 0.064960, 48, 10.7, 1580, 0.0},
{"EGSS", "ISX", "22", 110500000, 222.78, 3.0, 51.895165, 0.250051, 352, 14.9, 3430, 0.0},
{"EGSS", "ISED", "04", 110500000, 42.78, 3.0, 51.877054, 0.222887, 352, 16.2, 3130, 0.0},
{"KGYH", "IGYH", "5", 108300000, 40.00, 3.0, 34.749987, -82.384983,850, 15.84, 2750, -0.6},
};
ILSDemodGUI* ILSDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)

View File

@ -8234,6 +8234,34 @@ margin-bottom: 20px;
},
"channelSampleRate" : {
"type" : "integer"
},
"ident" : {
"type" : "string"
},
"deviation" : {
"type" : "number",
"format" : "float",
"description" : "deviation in degrees"
},
"sdm" : {
"type" : "number",
"format" : "float",
"description" : "Sum of the Depth of Modulation in percent"
},
"ddm" : {
"type" : "number",
"format" : "float",
"description" : "Difference in the Depth of Modulation in percent"
},
"dm90" : {
"type" : "number",
"format" : "float",
"description" : "Depth of modulation of the 90Hz tone as a percentage of the carrier"
},
"dm150" : {
"type" : "number",
"format" : "float",
"description" : "Depth of modulation of the 150Hz tone as percentage of the carrier"
}
},
"description" : "ILSDemod"
@ -59056,7 +59084,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2024-05-23T18:36:35.471+02:00
Generated 2024-06-18T10:11:11.522+02:00
</div>
</div>
</div>

View File

@ -95,4 +95,26 @@ ILSDemodReport:
format: float
channelSampleRate:
type: integer
ident:
type: string
deviation:
description: deviation in degrees
type: number
format: float
sdm:
description: Sum of the Depth of Modulation in percent
type: number
format: float
ddm:
description: Difference in the Depth of Modulation in percent
type: number
format: float
dm90:
description: Depth of modulation of the 90Hz tone as a percentage of the carrier
type: number
format: float
dm150:
description: Depth of modulation of the 150Hz tone as percentage of the carrier
type: number
format: float

View File

@ -131,7 +131,7 @@ QString Morse::toMorse(char ascii)
}
// Convert string to Morse code sequence consisting of . and - characters separated by spaces
QString Morse::toMorse(QString &string)
QString Morse::toMorse(const QString &string)
{
QStringList list;
for (int i = 0; i < string.size(); i++)
@ -145,14 +145,15 @@ QString Morse::toMorse(QString &string)
// Converts Morse code sequence using ASCII . and - to Unicode bullet and minus sign
// which are horizontally aligned, so look nicer in GUIs
QString Morse::toUnicode(QString &morse)
QString Morse::toUnicode(const QString &morse)
{
return morse.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212));
QString s = morse;
return s.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212));
}
// Converts a string to a unicode Morse sequence with extra space characters between
// dots and dashes to improve readability in GUIs
QString Morse::toSpacedUnicode(QString &morse)
QString Morse::toSpacedUnicode(const QString &morse)
{
QString temp = toUnicode(morse);
for (int i = 0; i < temp.size(); i+=2)
@ -161,14 +162,14 @@ QString Morse::toSpacedUnicode(QString &morse)
}
// Converts a string to a unicode Morse sequence
QString Morse::toUnicodeMorse(QString &string)
QString Morse::toUnicodeMorse(const QString &string)
{
QString ascii = toMorse(string);
return ascii.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212));
}
// Converts a string to a unicode Morse sequence with spacing between dots and dashes
QString Morse::toSpacedUnicodeMorse(QString &string)
QString Morse::toSpacedUnicodeMorse(const QString &string)
{
QString temp = toUnicodeMorse(string);
for (int i = 0; i < temp.size(); i+=2)
@ -179,7 +180,7 @@ QString Morse::toSpacedUnicodeMorse(QString &string)
#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
// Converts a Morse sequence to an ASCII character. -1 if no mapping found.
int Morse::toASCII(QString &morse)
int Morse::toASCII(const QString &morse)
{
for (unsigned int i = 0; i < COUNT_OF(m_asciiToMorse); i++)
{
@ -190,7 +191,7 @@ int Morse::toASCII(QString &morse)
}
// Converts a sequence of Morse code to a string. Unknown Morse codes are ignored.
QString Morse::toString(QString &morse)
QString Morse::toString(const QString &morse)
{
QString string("");
QStringList groups = morse.split(" ");

View File

@ -30,13 +30,13 @@ class SDRBASE_API Morse
{
public:
static QString toMorse(char asciiChar);
static QString toMorse(QString &string);
static QString toUnicode(QString &morse);
static QString toSpacedUnicode(QString &morse);
static QString toUnicodeMorse(QString &string);
static QString toSpacedUnicodeMorse(QString &string);
static int toASCII(QString &morse);
static QString toString(QString &morse);
static QString toMorse(const QString &string);
static QString toUnicode(const QString &morse);
static QString toSpacedUnicode(const QString &morse);
static QString toUnicodeMorse(const QString &string);
static QString toSpacedUnicodeMorse(const QString &string);
static int toASCII(const QString &morse);
static QString toString(const QString &morse);
private:
struct ASCIIToMorse {

View File

@ -95,4 +95,26 @@ ILSDemodReport:
format: float
channelSampleRate:
type: integer
ident:
type: string
deviation:
description: deviation in degrees
type: number
format: float
sdm:
description: Sum of the Depth of Modulation in percent
type: number
format: float
ddm:
description: Difference in the Depth of Modulation in percent
type: number
format: float
dm90:
description: Depth of modulation of the 90Hz tone as a percentage of the carrier
type: number
format: float
dm150:
description: Depth of modulation of the 150Hz tone as percentage of the carrier
type: number
format: float

View File

@ -8234,6 +8234,34 @@ margin-bottom: 20px;
},
"channelSampleRate" : {
"type" : "integer"
},
"ident" : {
"type" : "string"
},
"deviation" : {
"type" : "number",
"format" : "float",
"description" : "deviation in degrees"
},
"sdm" : {
"type" : "number",
"format" : "float",
"description" : "Sum of the Depth of Modulation in percent"
},
"ddm" : {
"type" : "number",
"format" : "float",
"description" : "Difference in the Depth of Modulation in percent"
},
"dm90" : {
"type" : "number",
"format" : "float",
"description" : "Depth of modulation of the 90Hz tone as a percentage of the carrier"
},
"dm150" : {
"type" : "number",
"format" : "float",
"description" : "Depth of modulation of the 150Hz tone as percentage of the carrier"
}
},
"description" : "ILSDemod"
@ -59056,7 +59084,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2024-05-23T18:36:35.471+02:00
Generated 2024-06-18T10:11:11.522+02:00
</div>
</div>
</div>

View File

@ -32,6 +32,18 @@ SWGILSDemodReport::SWGILSDemodReport() {
m_channel_power_db_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
ident = nullptr;
m_ident_isSet = false;
deviation = 0.0f;
m_deviation_isSet = false;
sdm = 0.0f;
m_sdm_isSet = false;
ddm = 0.0f;
m_ddm_isSet = false;
dm90 = 0.0f;
m_dm90_isSet = false;
dm150 = 0.0f;
m_dm150_isSet = false;
}
SWGILSDemodReport::~SWGILSDemodReport() {
@ -44,12 +56,32 @@ SWGILSDemodReport::init() {
m_channel_power_db_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
ident = new QString("");
m_ident_isSet = false;
deviation = 0.0f;
m_deviation_isSet = false;
sdm = 0.0f;
m_sdm_isSet = false;
ddm = 0.0f;
m_ddm_isSet = false;
dm90 = 0.0f;
m_dm90_isSet = false;
dm150 = 0.0f;
m_dm150_isSet = false;
}
void
SWGILSDemodReport::cleanup() {
if(ident != nullptr) {
delete ident;
}
}
SWGILSDemodReport*
@ -67,6 +99,18 @@ SWGILSDemodReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&ident, pJson["ident"], "QString", "QString");
::SWGSDRangel::setValue(&deviation, pJson["deviation"], "float", "");
::SWGSDRangel::setValue(&sdm, pJson["sdm"], "float", "");
::SWGSDRangel::setValue(&ddm, pJson["ddm"], "float", "");
::SWGSDRangel::setValue(&dm90, pJson["dm90"], "float", "");
::SWGSDRangel::setValue(&dm150, pJson["dm150"], "float", "");
}
QString
@ -89,6 +133,24 @@ SWGILSDemodReport::asJsonObject() {
if(m_channel_sample_rate_isSet){
obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
}
if(ident != nullptr && *ident != QString("")){
toJsonValue(QString("ident"), ident, obj, QString("QString"));
}
if(m_deviation_isSet){
obj->insert("deviation", QJsonValue(deviation));
}
if(m_sdm_isSet){
obj->insert("sdm", QJsonValue(sdm));
}
if(m_ddm_isSet){
obj->insert("ddm", QJsonValue(ddm));
}
if(m_dm90_isSet){
obj->insert("dm90", QJsonValue(dm90));
}
if(m_dm150_isSet){
obj->insert("dm150", QJsonValue(dm150));
}
return obj;
}
@ -113,6 +175,66 @@ SWGILSDemodReport::setChannelSampleRate(qint32 channel_sample_rate) {
this->m_channel_sample_rate_isSet = true;
}
QString*
SWGILSDemodReport::getIdent() {
return ident;
}
void
SWGILSDemodReport::setIdent(QString* ident) {
this->ident = ident;
this->m_ident_isSet = true;
}
float
SWGILSDemodReport::getDeviation() {
return deviation;
}
void
SWGILSDemodReport::setDeviation(float deviation) {
this->deviation = deviation;
this->m_deviation_isSet = true;
}
float
SWGILSDemodReport::getSdm() {
return sdm;
}
void
SWGILSDemodReport::setSdm(float sdm) {
this->sdm = sdm;
this->m_sdm_isSet = true;
}
float
SWGILSDemodReport::getDdm() {
return ddm;
}
void
SWGILSDemodReport::setDdm(float ddm) {
this->ddm = ddm;
this->m_ddm_isSet = true;
}
float
SWGILSDemodReport::getDm90() {
return dm90;
}
void
SWGILSDemodReport::setDm90(float dm90) {
this->dm90 = dm90;
this->m_dm90_isSet = true;
}
float
SWGILSDemodReport::getDm150() {
return dm150;
}
void
SWGILSDemodReport::setDm150(float dm150) {
this->dm150 = dm150;
this->m_dm150_isSet = true;
}
bool
SWGILSDemodReport::isSet(){
@ -124,6 +246,24 @@ SWGILSDemodReport::isSet(){
if(m_channel_sample_rate_isSet){
isObjectUpdated = true; break;
}
if(ident && *ident != QString("")){
isObjectUpdated = true; break;
}
if(m_deviation_isSet){
isObjectUpdated = true; break;
}
if(m_sdm_isSet){
isObjectUpdated = true; break;
}
if(m_ddm_isSet){
isObjectUpdated = true; break;
}
if(m_dm90_isSet){
isObjectUpdated = true; break;
}
if(m_dm150_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

View File

@ -22,6 +22,7 @@
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
@ -47,6 +48,24 @@ public:
qint32 getChannelSampleRate();
void setChannelSampleRate(qint32 channel_sample_rate);
QString* getIdent();
void setIdent(QString* ident);
float getDeviation();
void setDeviation(float deviation);
float getSdm();
void setSdm(float sdm);
float getDdm();
void setDdm(float ddm);
float getDm90();
void setDm90(float dm90);
float getDm150();
void setDm150(float dm150);
virtual bool isSet() override;
@ -57,6 +76,24 @@ private:
qint32 channel_sample_rate;
bool m_channel_sample_rate_isSet;
QString* ident;
bool m_ident_isSet;
float deviation;
bool m_deviation_isSet;
float sdm;
bool m_sdm_isSet;
float ddm;
bool m_ddm_isSet;
float dm90;
bool m_dm90_isSet;
float dm150;
bool m_dm150_isSet;
};
}