1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-21 04:16:34 -04:00

ILS Demod: Add DDM/SDM/Deviation to channel report.

This commit is contained in:
srcejon 2024-06-18 09:06:15 +01:00
parent 4770e2d281
commit 159d46ee36
5 changed files with 53 additions and 20 deletions

View File

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

View File

@ -205,6 +205,14 @@ private:
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest; 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); virtual bool handleMessage(const Message& cmd);
void applySettings(const ILSDemodSettings& settings, bool force = false); void applySettings(const ILSDemodSettings& settings, bool force = false);
void sendSampleRateToDemodAnalyzer(); 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}, {"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", "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}, {"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) ILSDemodGUI* ILSDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)

View File

@ -131,7 +131,7 @@ QString Morse::toMorse(char ascii)
} }
// Convert string to Morse code sequence consisting of . and - characters separated by spaces // 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; QStringList list;
for (int i = 0; i < string.size(); i++) 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 // Converts Morse code sequence using ASCII . and - to Unicode bullet and minus sign
// which are horizontally aligned, so look nicer in GUIs // 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 // Converts a string to a unicode Morse sequence with extra space characters between
// dots and dashes to improve readability in GUIs // dots and dashes to improve readability in GUIs
QString Morse::toSpacedUnicode(QString &morse) QString Morse::toSpacedUnicode(const QString &morse)
{ {
QString temp = toUnicode(morse); QString temp = toUnicode(morse);
for (int i = 0; i < temp.size(); i+=2) 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 // Converts a string to a unicode Morse sequence
QString Morse::toUnicodeMorse(QString &string) QString Morse::toUnicodeMorse(const QString &string)
{ {
QString ascii = toMorse(string); QString ascii = toMorse(string);
return ascii.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212)); return ascii.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212));
} }
// Converts a string to a unicode Morse sequence with spacing between dots and dashes // 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); QString temp = toUnicodeMorse(string);
for (int i = 0; i < temp.size(); i+=2) 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]))))) #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. // 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++) 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. // 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(""); QString string("");
QStringList groups = morse.split(" "); QStringList groups = morse.split(" ");

View File

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