From 97583d08581da73bcf841764c599db39c347e535 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 8 Nov 2021 01:45:02 +0100 Subject: [PATCH] Packet demod: change mode processing. API: added report --- plugins/channelrx/demodpacket/packetdemod.cpp | 31 +++++ plugins/channelrx/demodpacket/packetdemod.h | 5 + .../demodpacket/packetdemodbaseband.cpp | 5 + .../demodpacket/packetdemodbaseband.h | 1 + .../demodpacket/packetdemodsettings.cpp | 6 +- .../demodpacket/packetdemodsettings.h | 9 +- .../channelrx/demodpacket/packetdemodsink.cpp | 14 +- sdrbase/resources/webapi/doc/html2/index.html | 22 ++- .../doc/swagger/include/ChannelReport.yaml | 2 + .../doc/swagger/include/PacketDemod.yaml | 14 +- .../api/swagger/include/ChannelReport.yaml | 2 + .../api/swagger/include/PacketDemod.yaml | 14 +- swagger/sdrangel/code/html2/index.html | 22 ++- .../code/qt5/client/SWGChannelReport.cpp | 25 ++++ .../code/qt5/client/SWGChannelReport.h | 7 + .../code/qt5/client/SWGModelFactory.h | 6 + .../code/qt5/client/SWGPacketDemodReport.cpp | 131 ++++++++++++++++++ .../code/qt5/client/SWGPacketDemodReport.h | 64 +++++++++ .../qt5/client/SWGPacketDemodSettings.cpp | 20 ++- .../code/qt5/client/SWGPacketDemodSettings.h | 6 +- 20 files changed, 373 insertions(+), 33 deletions(-) create mode 100644 swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.h diff --git a/plugins/channelrx/demodpacket/packetdemod.cpp b/plugins/channelrx/demodpacket/packetdemod.cpp index 242ccd211..bbb2689a1 100644 --- a/plugins/channelrx/demodpacket/packetdemod.cpp +++ b/plugins/channelrx/demodpacket/packetdemod.cpp @@ -236,6 +236,9 @@ void PacketDemod::applySettings(const PacketDemodSettings& settings, bool force) if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) { reverseAPIKeys.append("inputFrequencyOffset"); } + if ((settings.m_mode != m_settings.m_mode) || force) { + reverseAPIKeys.append("mode"); + } if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) { reverseAPIKeys.append("rfBandwidth"); } @@ -393,6 +396,17 @@ int PacketDemod::webapiSettingsPutPatch( return 200; } +int PacketDemod::webapiReportGet( + SWGSDRangel::SWGChannelReport& response, + QString& errorMessage) +{ + (void) errorMessage; + response.setPacketDemodReport(new SWGSDRangel::SWGPacketDemodReport()); + response.getPacketDemodReport()->init(); + webapiFormatChannelReport(response); + return 200; +} + void PacketDemod::webapiUpdateChannelSettings( PacketDemodSettings& settings, const QStringList& channelSettingsKeys, @@ -401,6 +415,9 @@ void PacketDemod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("inputFrequencyOffset")) { settings.m_inputFrequencyOffset = response.getPacketDemodSettings()->getInputFrequencyOffset(); } + if (channelSettingsKeys.contains("mode")) { + settings.m_mode = (PacketDemodSettings::Mode) response.getPacketDemodSettings()->getMode(); + } if (channelSettingsKeys.contains("fmDeviation")) { settings.m_fmDeviation = response.getPacketDemodSettings()->getFmDeviation(); } @@ -452,6 +469,7 @@ void PacketDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r { response.getPacketDemodSettings()->setFmDeviation(settings.m_fmDeviation); response.getPacketDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); + response.getPacketDemodSettings()->setMode((int) settings.m_mode); response.getPacketDemodSettings()->setRfBandwidth(settings.m_rfBandwidth); response.getPacketDemodSettings()->setUdpEnabled(settings.m_udpEnabled); response.getPacketDemodSettings()->setUdpAddress(new QString(settings.m_udpAddress)); @@ -480,6 +498,16 @@ void PacketDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r response.getPacketDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex); } +void PacketDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) +{ + double magsqAvg, magsqPeak; + int nbMagsqSamples; + getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples); + + response.getPacketDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); + response.getPacketDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate()); +} + void PacketDemod::webapiReverseSendSettings(QList& channelSettingsKeys, const PacketDemodSettings& settings, bool force) { SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); @@ -527,6 +555,9 @@ void PacketDemod::webapiFormatChannelSettings( if (channelSettingsKeys.contains("inputFrequencyOffset") || force) { swgPacketDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset); } + if (channelSettingsKeys.contains("mode") || force) { + swgPacketDemodSettings->setMode((int) settings.m_mode); + } if (channelSettingsKeys.contains("rfBandwidth") || force) { swgPacketDemodSettings->setRfBandwidth(settings.m_rfBandwidth); } diff --git a/plugins/channelrx/demodpacket/packetdemod.h b/plugins/channelrx/demodpacket/packetdemod.h index eb4abc45c..315069e02 100644 --- a/plugins/channelrx/demodpacket/packetdemod.h +++ b/plugins/channelrx/demodpacket/packetdemod.h @@ -103,6 +103,10 @@ public: SWGSDRangel::SWGChannelSettings& response, QString& errorMessage); + virtual int webapiReportGet( + SWGSDRangel::SWGChannelReport& response, + QString& errorMessage); + static void webapiFormatChannelSettings( SWGSDRangel::SWGChannelSettings& response, const PacketDemodSettings& settings); @@ -150,6 +154,7 @@ private: const PacketDemodSettings& settings, bool force ); + void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); private slots: void networkManagerFinished(QNetworkReply *reply); diff --git a/plugins/channelrx/demodpacket/packetdemodbaseband.cpp b/plugins/channelrx/demodpacket/packetdemodbaseband.cpp index 264978c37..904295b88 100644 --- a/plugins/channelrx/demodpacket/packetdemodbaseband.cpp +++ b/plugins/channelrx/demodpacket/packetdemodbaseband.cpp @@ -168,6 +168,11 @@ void PacketDemodBaseband::applySettings(const PacketDemodSettings& settings, boo m_settings = settings; } +int PacketDemodBaseband::getChannelSampleRate() const +{ + return m_channelizer->getChannelSampleRate(); +} + void PacketDemodBaseband::setBasebandSampleRate(int sampleRate) { m_channelizer->setBasebandSampleRate(sampleRate); diff --git a/plugins/channelrx/demodpacket/packetdemodbaseband.h b/plugins/channelrx/demodpacket/packetdemodbaseband.h index 14df864d7..b988e4cfc 100644 --- a/plugins/channelrx/demodpacket/packetdemodbaseband.h +++ b/plugins/channelrx/demodpacket/packetdemodbaseband.h @@ -71,6 +71,7 @@ public: } void setMessageQueueToChannel(MessageQueue *messageQueue) { m_sink.setMessageQueueToChannel(messageQueue); } void setBasebandSampleRate(int sampleRate); + int getChannelSampleRate() const; void setChannel(ChannelAPI *channel); double getMagSq() const { return m_sink.getMagSq(); } bool isRunning() const { return m_running; } diff --git a/plugins/channelrx/demodpacket/packetdemodsettings.cpp b/plugins/channelrx/demodpacket/packetdemodsettings.cpp index 1bed7dbe4..1d9b94a08 100644 --- a/plugins/channelrx/demodpacket/packetdemodsettings.cpp +++ b/plugins/channelrx/demodpacket/packetdemodsettings.cpp @@ -32,7 +32,7 @@ PacketDemodSettings::PacketDemodSettings() : void PacketDemodSettings::resetToDefaults() { m_inputFrequencyOffset = 0; - m_baud = 1200; + m_mode = ModeAFSK1200; m_rfBandwidth = 12500.0f; m_fmDeviation = 2500.0f; m_filterFrom = ""; @@ -171,4 +171,8 @@ bool PacketDemodSettings::deserialize(const QByteArray& data) } } +int PacketDemodSettings::getBaudRate() const +{ + return 1200; +} diff --git a/plugins/channelrx/demodpacket/packetdemodsettings.h b/plugins/channelrx/demodpacket/packetdemodsettings.h index 2171eeb9e..6a06288f5 100644 --- a/plugins/channelrx/demodpacket/packetdemodsettings.h +++ b/plugins/channelrx/demodpacket/packetdemodsettings.h @@ -29,8 +29,12 @@ class Serializable; struct PacketDemodSettings { + enum Mode { + ModeAFSK1200 + }; + qint32 m_inputFrequencyOffset; - qint32 m_baud; + Mode m_mode; Real m_rfBandwidth; Real m_fmDeviation; QString m_filterFrom; @@ -57,13 +61,14 @@ struct PacketDemodSettings int m_columnSizes[PACKETDEMOD_COLUMNS]; //!< Size of the columns in the table static const int PACKETDEMOD_CHANNEL_BANDWIDTH = 9600; - static const int PACKETDEMOD_CHANNEL_SAMPLE_RATE = 38400; // Must be integer multiple of m_baud=1200 + static const int PACKETDEMOD_CHANNEL_SAMPLE_RATE = 38400; // Must be integer multiple of baud rate (x32, x4) PacketDemodSettings(); void resetToDefaults(); void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; } QByteArray serialize() const; bool deserialize(const QByteArray& data); + int getBaudRate() const; }; #endif /* INCLUDE_PACKETDEMODSETTINGS_H */ diff --git a/plugins/channelrx/demodpacket/packetdemodsink.cpp b/plugins/channelrx/demodpacket/packetdemodsink.cpp index 22abf706f..ce8f08101 100644 --- a/plugins/channelrx/demodpacket/packetdemodsink.cpp +++ b/plugins/channelrx/demodpacket/packetdemodsink.cpp @@ -136,7 +136,7 @@ void PacketDemodSink::processOneSample(Complex &ci) // Look for edge if (sample != m_samplePrev) { - m_syncCount = PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE/m_settings.m_baud/2; + m_syncCount = PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE/m_settings.getBaudRate()/2; } else { @@ -197,7 +197,9 @@ void PacketDemodSink::processOneSample(Complex &ci) } } else - qDebug() << QString("CRC mismatch: %1 %2").arg(calcCrc, 4, 16, QLatin1Char('0')).arg(rxCrc, 4, 16, QLatin1Char('0')); + qDebug() << QString("PacketDemodSink::processOneSample: CRC mismatch: %1 %2") + .arg(calcCrc, 4, 16, QLatin1Char('0')) + .arg(rxCrc, 4, 16, QLatin1Char('0')); // Reset state to start receiving next packet m_gotSOP = false; m_bits = 0; @@ -235,7 +237,7 @@ void PacketDemodSink::processOneSample(Complex &ci) m_bitCount = 0; } } - m_syncCount = PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE/m_settings.m_baud; + m_syncCount = PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE/m_settings.getBaudRate(); } } m_samplePrev = sample; @@ -307,7 +309,7 @@ void PacketDemodSink::applySettings(const PacketDemodSettings& settings, bool fo delete[] m_f1; delete[] m_f0; delete[] m_corrBuf; - m_correlationLength = PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE/settings.m_baud; + m_correlationLength = PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE/settings.getBaudRate(); m_f1 = new Complex[m_correlationLength](); m_f0 = new Complex[m_correlationLength](); m_corrBuf = new Complex[m_correlationLength](); @@ -323,8 +325,8 @@ void PacketDemodSink::applySettings(const PacketDemodSettings& settings, bool fo f1 += 2.0f*(Real)M_PI*1200.0f/PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE; } - m_lowpassF1.create(301, PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE, settings.m_baud * 1.1f); - m_lowpassF0.create(301, PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE, settings.m_baud * 1.1f); + m_lowpassF1.create(301, PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE, settings.getBaudRate() * 1.1f); + m_lowpassF0.create(301, PacketDemodSettings::PACKETDEMOD_CHANNEL_SAMPLE_RATE, settings.getBaudRate() * 1.1f); m_samplePrev = 0; m_syncCount = 0; m_symbolPrev = 0; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index bc0abbfd7..79727530c 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -3136,6 +3136,9 @@ margin-bottom: 20px; "RemoteSourceReport" : { "$ref" : "#/definitions/RemoteSourceReport" }, + "PacketDemodReport" : { + "$ref" : "#/definitions/PacketDemodReport" + }, "PacketModReport" : { "$ref" : "#/definitions/PacketModReport" }, @@ -8140,6 +8143,19 @@ margin-bottom: 20px; } }, "description" : "PER Tester settings" +}; + defs.PacketDemodReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power received in channel (dB)" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "AMDemod" }; defs.PacketDemodSettings = { "properties" : { @@ -8148,8 +8164,8 @@ margin-bottom: 20px; "format" : "int64" }, "mode" : { - "type" : "string", - "description" : "Transmission mode\n * \"1200 AFSK\"\n" + "type" : "integer", + "description" : "Transmission mode\n * 0 - 1200 AFSK\n" }, "rfBandwidth" : { "type" : "number", @@ -51277,7 +51293,7 @@ except ApiException as e:
- Generated 2021-11-07T12:25:19.263+01:00 + Generated 2021-11-08T00:48:24.214+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml index 0cae44f80..8f09ddebc 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelReport.yaml @@ -61,6 +61,8 @@ ChannelReport: $ref: "/doc/swagger/include/RadioClock.yaml#/RadioClockReport" RemoteSourceReport: $ref: "/doc/swagger/include/RemoteSource.yaml#/RemoteSourceReport" + PacketDemodReport: + $ref: "/doc/swagger/include/PacketDemod.yaml#/PacketDemodReport" PacketModReport: $ref: "/doc/swagger/include/PacketMod.yaml#/PacketModReport" PagerDemodReport: diff --git a/sdrbase/resources/webapi/doc/swagger/include/PacketDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/PacketDemod.yaml index 4619a45a2..be5d00308 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/PacketDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/PacketDemod.yaml @@ -5,10 +5,10 @@ PacketDemodSettings: type: integer format: int64 mode: - type: string + type: integer description: > Transmission mode - * "1200 AFSK" + * 0 - 1200 AFSK rfBandwidth: type: number format: float @@ -46,3 +46,13 @@ PacketDemodSettings: type: integer reverseAPIChannelIndex: type: integer + +PacketDemodReport: + description: AMDemod + properties: + channelPowerDB: + description: power received in channel (dB) + type: number + format: float + channelSampleRate: + type: integer diff --git a/swagger/sdrangel/api/swagger/include/ChannelReport.yaml b/swagger/sdrangel/api/swagger/include/ChannelReport.yaml index 19e85cde6..7948cda1d 100644 --- a/swagger/sdrangel/api/swagger/include/ChannelReport.yaml +++ b/swagger/sdrangel/api/swagger/include/ChannelReport.yaml @@ -61,6 +61,8 @@ ChannelReport: $ref: "http://swgserver:8081/api/swagger/include/RadioClock.yaml#/RadioClockReport" RemoteSourceReport: $ref: "http://swgserver:8081/api/swagger/include/RemoteSource.yaml#/RemoteSourceReport" + PacketDemodReport: + $ref: "http://swgserver:8081/api/swagger/include/PacketDemod.yaml#/PacketDemodReport" PacketModReport: $ref: "http://swgserver:8081/api/swagger/include/PacketMod.yaml#/PacketModReport" PagerDemodReport: diff --git a/swagger/sdrangel/api/swagger/include/PacketDemod.yaml b/swagger/sdrangel/api/swagger/include/PacketDemod.yaml index 4619a45a2..be5d00308 100644 --- a/swagger/sdrangel/api/swagger/include/PacketDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/PacketDemod.yaml @@ -5,10 +5,10 @@ PacketDemodSettings: type: integer format: int64 mode: - type: string + type: integer description: > Transmission mode - * "1200 AFSK" + * 0 - 1200 AFSK rfBandwidth: type: number format: float @@ -46,3 +46,13 @@ PacketDemodSettings: type: integer reverseAPIChannelIndex: type: integer + +PacketDemodReport: + description: AMDemod + properties: + channelPowerDB: + description: power received in channel (dB) + type: number + format: float + channelSampleRate: + type: integer diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index bc0abbfd7..79727530c 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -3136,6 +3136,9 @@ margin-bottom: 20px; "RemoteSourceReport" : { "$ref" : "#/definitions/RemoteSourceReport" }, + "PacketDemodReport" : { + "$ref" : "#/definitions/PacketDemodReport" + }, "PacketModReport" : { "$ref" : "#/definitions/PacketModReport" }, @@ -8140,6 +8143,19 @@ margin-bottom: 20px; } }, "description" : "PER Tester settings" +}; + defs.PacketDemodReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power received in channel (dB)" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "AMDemod" }; defs.PacketDemodSettings = { "properties" : { @@ -8148,8 +8164,8 @@ margin-bottom: 20px; "format" : "int64" }, "mode" : { - "type" : "string", - "description" : "Transmission mode\n * \"1200 AFSK\"\n" + "type" : "integer", + "description" : "Transmission mode\n * 0 - 1200 AFSK\n" }, "rfBandwidth" : { "type" : "number", @@ -51277,7 +51293,7 @@ except ApiException as e:
- Generated 2021-11-07T12:25:19.263+01:00 + Generated 2021-11-08T00:48:24.214+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp index 4f7ed5f17..1445fa542 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp @@ -82,6 +82,8 @@ SWGChannelReport::SWGChannelReport() { m_radio_clock_report_isSet = false; remote_source_report = nullptr; m_remote_source_report_isSet = false; + packet_demod_report = nullptr; + m_packet_demod_report_isSet = false; packet_mod_report = nullptr; m_packet_mod_report_isSet = false; pager_demod_report = nullptr; @@ -164,6 +166,8 @@ SWGChannelReport::init() { m_radio_clock_report_isSet = false; remote_source_report = new SWGRemoteSourceReport(); m_remote_source_report_isSet = false; + packet_demod_report = new SWGPacketDemodReport(); + m_packet_demod_report_isSet = false; packet_mod_report = new SWGPacketModReport(); m_packet_mod_report_isSet = false; pager_demod_report = new SWGPagerDemodReport(); @@ -267,6 +271,9 @@ SWGChannelReport::cleanup() { if(remote_source_report != nullptr) { delete remote_source_report; } + if(packet_demod_report != nullptr) { + delete packet_demod_report; + } if(packet_mod_report != nullptr) { delete packet_mod_report; } @@ -364,6 +371,8 @@ SWGChannelReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&remote_source_report, pJson["RemoteSourceReport"], "SWGRemoteSourceReport", "SWGRemoteSourceReport"); + ::SWGSDRangel::setValue(&packet_demod_report, pJson["PacketDemodReport"], "SWGPacketDemodReport", "SWGPacketDemodReport"); + ::SWGSDRangel::setValue(&packet_mod_report, pJson["PacketModReport"], "SWGPacketModReport", "SWGPacketModReport"); ::SWGSDRangel::setValue(&pager_demod_report, pJson["PagerDemodReport"], "SWGPagerDemodReport", "SWGPagerDemodReport"); @@ -481,6 +490,9 @@ SWGChannelReport::asJsonObject() { if((remote_source_report != nullptr) && (remote_source_report->isSet())){ toJsonValue(QString("RemoteSourceReport"), remote_source_report, obj, QString("SWGRemoteSourceReport")); } + if((packet_demod_report != nullptr) && (packet_demod_report->isSet())){ + toJsonValue(QString("PacketDemodReport"), packet_demod_report, obj, QString("SWGPacketDemodReport")); + } if((packet_mod_report != nullptr) && (packet_mod_report->isSet())){ toJsonValue(QString("PacketModReport"), packet_mod_report, obj, QString("SWGPacketModReport")); } @@ -785,6 +797,16 @@ SWGChannelReport::setRemoteSourceReport(SWGRemoteSourceReport* remote_source_rep this->m_remote_source_report_isSet = true; } +SWGPacketDemodReport* +SWGChannelReport::getPacketDemodReport() { + return packet_demod_report; +} +void +SWGChannelReport::setPacketDemodReport(SWGPacketDemodReport* packet_demod_report) { + this->packet_demod_report = packet_demod_report; + this->m_packet_demod_report_isSet = true; +} + SWGPacketModReport* SWGChannelReport::getPacketModReport() { return packet_mod_report; @@ -971,6 +993,9 @@ SWGChannelReport::isSet(){ if(remote_source_report && remote_source_report->isSet()){ isObjectUpdated = true; break; } + if(packet_demod_report && packet_demod_report->isSet()){ + isObjectUpdated = true; break; + } if(packet_mod_report && packet_mod_report->isSet()){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelReport.h b/swagger/sdrangel/code/qt5/client/SWGChannelReport.h index 2b40a3bec..e2f13d5dd 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGChannelReport.h @@ -43,6 +43,7 @@ #include "SWGNFMDemodReport.h" #include "SWGNFMModReport.h" #include "SWGNoiseFigureReport.h" +#include "SWGPacketDemodReport.h" #include "SWGPacketModReport.h" #include "SWGPagerDemodReport.h" #include "SWGRadioAstronomyReport.h" @@ -158,6 +159,9 @@ public: SWGRemoteSourceReport* getRemoteSourceReport(); void setRemoteSourceReport(SWGRemoteSourceReport* remote_source_report); + SWGPacketDemodReport* getPacketDemodReport(); + void setPacketDemodReport(SWGPacketDemodReport* packet_demod_report); + SWGPacketModReport* getPacketModReport(); void setPacketModReport(SWGPacketModReport* packet_mod_report); @@ -273,6 +277,9 @@ private: SWGRemoteSourceReport* remote_source_report; bool m_remote_source_report_isSet; + SWGPacketDemodReport* packet_demod_report; + bool m_packet_demod_report_isSet; + SWGPacketModReport* packet_mod_report; bool m_packet_mod_report_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 6a1c76ec3..b2dc78c21 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -187,6 +187,7 @@ #include "SWGPERTesterActions_aos.h" #include "SWGPERTesterReport.h" #include "SWGPERTesterSettings.h" +#include "SWGPacketDemodReport.h" #include "SWGPacketDemodSettings.h" #include "SWGPacketModActions.h" #include "SWGPacketModActions_tx.h" @@ -1174,6 +1175,11 @@ namespace SWGSDRangel { obj->init(); return obj; } + if(QString("SWGPacketDemodReport").compare(type) == 0) { + SWGPacketDemodReport *obj = new SWGPacketDemodReport(); + obj->init(); + return obj; + } if(QString("SWGPacketDemodSettings").compare(type) == 0) { SWGPacketDemodSettings *obj = new SWGPacketDemodSettings(); obj->init(); diff --git a/swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.cpp b/swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.cpp new file mode 100644 index 000000000..fc94605b4 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.cpp @@ -0,0 +1,131 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 6.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGPacketDemodReport.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGPacketDemodReport::SWGPacketDemodReport(QString* json) { + init(); + this->fromJson(*json); +} + +SWGPacketDemodReport::SWGPacketDemodReport() { + channel_power_db = 0.0f; + m_channel_power_db_isSet = false; + channel_sample_rate = 0; + m_channel_sample_rate_isSet = false; +} + +SWGPacketDemodReport::~SWGPacketDemodReport() { + this->cleanup(); +} + +void +SWGPacketDemodReport::init() { + channel_power_db = 0.0f; + m_channel_power_db_isSet = false; + channel_sample_rate = 0; + m_channel_sample_rate_isSet = false; +} + +void +SWGPacketDemodReport::cleanup() { + + +} + +SWGPacketDemodReport* +SWGPacketDemodReport::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGPacketDemodReport::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", ""); + + ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", ""); + +} + +QString +SWGPacketDemodReport::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGPacketDemodReport::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_channel_power_db_isSet){ + obj->insert("channelPowerDB", QJsonValue(channel_power_db)); + } + if(m_channel_sample_rate_isSet){ + obj->insert("channelSampleRate", QJsonValue(channel_sample_rate)); + } + + return obj; +} + +float +SWGPacketDemodReport::getChannelPowerDb() { + return channel_power_db; +} +void +SWGPacketDemodReport::setChannelPowerDb(float channel_power_db) { + this->channel_power_db = channel_power_db; + this->m_channel_power_db_isSet = true; +} + +qint32 +SWGPacketDemodReport::getChannelSampleRate() { + return channel_sample_rate; +} +void +SWGPacketDemodReport::setChannelSampleRate(qint32 channel_sample_rate) { + this->channel_sample_rate = channel_sample_rate; + this->m_channel_sample_rate_isSet = true; +} + + +bool +SWGPacketDemodReport::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_channel_power_db_isSet){ + isObjectUpdated = true; break; + } + if(m_channel_sample_rate_isSet){ + isObjectUpdated = true; break; + } + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.h b/swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.h new file mode 100644 index 000000000..e36a67742 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGPacketDemodReport.h @@ -0,0 +1,64 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 6.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGPacketDemodReport.h + * + * AMDemod + */ + +#ifndef SWGPacketDemodReport_H_ +#define SWGPacketDemodReport_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGPacketDemodReport: public SWGObject { +public: + SWGPacketDemodReport(); + SWGPacketDemodReport(QString* json); + virtual ~SWGPacketDemodReport(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGPacketDemodReport* fromJson(QString &jsonString) override; + + float getChannelPowerDb(); + void setChannelPowerDb(float channel_power_db); + + qint32 getChannelSampleRate(); + void setChannelSampleRate(qint32 channel_sample_rate); + + + virtual bool isSet() override; + +private: + float channel_power_db; + bool m_channel_power_db_isSet; + + qint32 channel_sample_rate; + bool m_channel_sample_rate_isSet; + +}; + +} + +#endif /* SWGPacketDemodReport_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.cpp index 23a3a7164..59f5829ba 100644 --- a/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.cpp @@ -30,7 +30,7 @@ SWGPacketDemodSettings::SWGPacketDemodSettings(QString* json) { SWGPacketDemodSettings::SWGPacketDemodSettings() { input_frequency_offset = 0L; m_input_frequency_offset_isSet = false; - mode = nullptr; + mode = 0; m_mode_isSet = false; rf_bandwidth = 0.0f; m_rf_bandwidth_isSet = false; @@ -72,7 +72,7 @@ void SWGPacketDemodSettings::init() { input_frequency_offset = 0L; m_input_frequency_offset_isSet = false; - mode = new QString(""); + mode = 0; m_mode_isSet = false; rf_bandwidth = 0.0f; m_rf_bandwidth_isSet = false; @@ -109,9 +109,7 @@ SWGPacketDemodSettings::init() { void SWGPacketDemodSettings::cleanup() { - if(mode != nullptr) { - delete mode; - } + @@ -150,7 +148,7 @@ void SWGPacketDemodSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); - ::SWGSDRangel::setValue(&mode, pJson["mode"], "QString", "QString"); + ::SWGSDRangel::setValue(&mode, pJson["mode"], "qint32", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); @@ -201,8 +199,8 @@ SWGPacketDemodSettings::asJsonObject() { if(m_input_frequency_offset_isSet){ obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); } - if(mode != nullptr && *mode != QString("")){ - toJsonValue(QString("mode"), mode, obj, QString("QString")); + if(m_mode_isSet){ + obj->insert("mode", QJsonValue(mode)); } if(m_rf_bandwidth_isSet){ obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); @@ -263,12 +261,12 @@ SWGPacketDemodSettings::setInputFrequencyOffset(qint64 input_frequency_offset) { this->m_input_frequency_offset_isSet = true; } -QString* +qint32 SWGPacketDemodSettings::getMode() { return mode; } void -SWGPacketDemodSettings::setMode(QString* mode) { +SWGPacketDemodSettings::setMode(qint32 mode) { this->mode = mode; this->m_mode_isSet = true; } @@ -431,7 +429,7 @@ SWGPacketDemodSettings::isSet(){ if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break; } - if(mode && *mode != QString("")){ + if(m_mode_isSet){ isObjectUpdated = true; break; } if(m_rf_bandwidth_isSet){ diff --git a/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.h index 698af795b..301fb9d94 100644 --- a/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGPacketDemodSettings.h @@ -45,8 +45,8 @@ public: qint64 getInputFrequencyOffset(); void setInputFrequencyOffset(qint64 input_frequency_offset); - QString* getMode(); - void setMode(QString* mode); + qint32 getMode(); + void setMode(qint32 mode); float getRfBandwidth(); void setRfBandwidth(float rf_bandwidth); @@ -100,7 +100,7 @@ private: qint64 input_frequency_offset; bool m_input_frequency_offset_isSet; - QString* mode; + qint32 mode; bool m_mode_isSet; float rf_bandwidth;