From 0c328546b099c1277bb833d4532db13598f43c9f Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 25 May 2018 10:08:47 +0200 Subject: [PATCH] WFM demod: implemeted WEB API --- plugins/channelrx/demodbfm/bfmdemod.cpp | 2 +- plugins/channelrx/demoddsd/dsddemodplugin.cpp | 2 +- plugins/channelrx/demodssb/ssbplugin.cpp | 2 +- plugins/channelrx/demodwfm/CMakeLists.txt | 1 + plugins/channelrx/demodwfm/wfmdemod.cpp | 122 ++++++++ plugins/channelrx/demodwfm/wfmdemod.h | 26 ++ plugins/channelrx/demodwfm/wfmdemodgui.cpp | 32 +- plugins/channelrx/demodwfm/wfmdemodgui.h | 10 +- sdrbase/resources/webapi/doc/html2/index.html | 70 ++++- .../webapi/doc/swagger/include/DSDDemod.yaml | 4 +- .../webapi/doc/swagger/include/WFMDemod.yaml | 42 +++ .../resources/webapi/doc/swagger/swagger.yaml | 4 + sdrbase/webapi/webapirequestmapper.cpp | 14 + .../api/swagger/include/WFMDemod.yaml | 42 +++ swagger/sdrangel/api/swagger/swagger.yaml | 4 + swagger/sdrangel/code/html2/index.html | 70 ++++- .../code/qt5/client/SWGChannelReport.cpp | 23 ++ .../code/qt5/client/SWGChannelReport.h | 7 + .../code/qt5/client/SWGChannelSettings.cpp | 23 ++ .../code/qt5/client/SWGChannelSettings.h | 7 + .../code/qt5/client/SWGModelFactory.h | 8 + .../code/qt5/client/SWGWFMDemodReport.cpp | 169 +++++++++++ .../code/qt5/client/SWGWFMDemodReport.h | 76 +++++ .../code/qt5/client/SWGWFMDemodSettings.cpp | 278 ++++++++++++++++++ .../code/qt5/client/SWGWFMDemodSettings.h | 107 +++++++ swagger/sdrangel/examples/rx_test.py | 8 + 26 files changed, 1131 insertions(+), 22 deletions(-) create mode 100644 sdrbase/resources/webapi/doc/swagger/include/WFMDemod.yaml create mode 100644 swagger/sdrangel/api/swagger/include/WFMDemod.yaml create mode 100644 swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.h create mode 100644 swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.h diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index 56fe6f37f..65bb03a19 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -605,7 +605,7 @@ int BFMDemod::webapiSettingsPutPatch( if (frequencyOffsetChanged) { MsgConfigureChannelizer* channelConfigMsg = MsgConfigureChannelizer::create( - requiredBW(settings.m_rfBandwidth), settings.m_inputFrequencyOffset); // FIXME + requiredBW(settings.m_rfBandwidth), settings.m_inputFrequencyOffset); m_inputMessageQueue.push(channelConfigMsg); } diff --git a/plugins/channelrx/demoddsd/dsddemodplugin.cpp b/plugins/channelrx/demoddsd/dsddemodplugin.cpp index 8403767d0..577846410 100644 --- a/plugins/channelrx/demoddsd/dsddemodplugin.cpp +++ b/plugins/channelrx/demoddsd/dsddemodplugin.cpp @@ -25,7 +25,7 @@ const PluginDescriptor DSDDemodPlugin::m_pluginDescriptor = { QString("DSD Demodulator"), - QString("3.14.5"), + QString("4.0.0"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelrx/demodssb/ssbplugin.cpp b/plugins/channelrx/demodssb/ssbplugin.cpp index 2e04494ed..c5e930f84 100644 --- a/plugins/channelrx/demodssb/ssbplugin.cpp +++ b/plugins/channelrx/demodssb/ssbplugin.cpp @@ -8,7 +8,7 @@ const PluginDescriptor SSBPlugin::m_pluginDescriptor = { QString("SSB Demodulator"), - QString("3.14.5"), + QString("4.0.0"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelrx/demodwfm/CMakeLists.txt b/plugins/channelrx/demodwfm/CMakeLists.txt index c088697c2..914a448ff 100644 --- a/plugins/channelrx/demodwfm/CMakeLists.txt +++ b/plugins/channelrx/demodwfm/CMakeLists.txt @@ -23,6 +23,7 @@ set(wfm_FORMS include_directories( . ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ) #include(${QT_USE_FILE}) diff --git a/plugins/channelrx/demodwfm/wfmdemod.cpp b/plugins/channelrx/demodwfm/wfmdemod.cpp index e12606162..5e4a993ea 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.cpp +++ b/plugins/channelrx/demodwfm/wfmdemod.cpp @@ -21,12 +21,18 @@ #include #include +#include "SWGChannelSettings.h" +#include "SWGWFMDemodSettings.h" +#include "SWGChannelReport.h" +#include "SWGWFMDemodReport.h" + #include #include "dsp/threadedbasebandsamplesink.h" #include "device/devicesourceapi.h" #include "audio/audiooutput.h" #include "dsp/dspengine.h" #include "dsp/dspcommands.h" +#include "util/db.h" #include "wfmdemod.h" @@ -375,3 +381,119 @@ bool WFMDemod::deserialize(const QByteArray& data) } } +int WFMDemod::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage __attribute__((unused))) +{ + response.setWfmDemodSettings(new SWGSDRangel::SWGWFMDemodSettings()); + response.getWfmDemodSettings()->init(); + webapiFormatChannelSettings(response, m_settings); + return 200; +} + +int WFMDemod::webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage __attribute__((unused))) +{ + WFMDemodSettings settings = m_settings; + bool frequencyOffsetChanged = false; + + if (channelSettingsKeys.contains("inputFrequencyOffset")) + { + settings.m_inputFrequencyOffset = response.getWfmDemodSettings()->getInputFrequencyOffset(); + frequencyOffsetChanged = true; + } + if (channelSettingsKeys.contains("rfBandwidth")) { + settings.m_rfBandwidth = response.getWfmDemodSettings()->getRfBandwidth(); + } + if (channelSettingsKeys.contains("afBandwidth")) { + settings.m_afBandwidth = response.getWfmDemodSettings()->getAfBandwidth(); + } + if (channelSettingsKeys.contains("volume")) { + settings.m_volume = response.getWfmDemodSettings()->getVolume(); + } + if (channelSettingsKeys.contains("squelch")) { + settings.m_squelch = response.getWfmDemodSettings()->getSquelch(); + } + if (channelSettingsKeys.contains("audioMute")) { + settings.m_audioMute = response.getWfmDemodSettings()->getAudioMute() != 0; + } + if (channelSettingsKeys.contains("rgbColor")) { + settings.m_rgbColor = response.getWfmDemodSettings()->getRgbColor(); + } + if (channelSettingsKeys.contains("title")) { + settings.m_title = *response.getWfmDemodSettings()->getTitle(); + } + if (channelSettingsKeys.contains("audioDeviceName")) { + settings.m_audioDeviceName = *response.getWfmDemodSettings()->getAudioDeviceName(); + } + + if (frequencyOffsetChanged) + { + MsgConfigureChannelizer* channelConfigMsg = MsgConfigureChannelizer::create( + requiredBW(settings.m_rfBandwidth), settings.m_inputFrequencyOffset); + m_inputMessageQueue.push(channelConfigMsg); + } + + MsgConfigureWFMDemod *msg = MsgConfigureWFMDemod::create(settings, force); + m_inputMessageQueue.push(msg); + + qDebug("WFMDemod::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue); + if (m_guiMessageQueue) // forward to GUI if any + { + MsgConfigureWFMDemod *msgToGUI = MsgConfigureWFMDemod::create(settings, force); + m_guiMessageQueue->push(msgToGUI); + } + + webapiFormatChannelSettings(response, settings); + + return 200; +} + +int WFMDemod::webapiReportGet( + SWGSDRangel::SWGChannelReport& response, + QString& errorMessage __attribute__((unused))) +{ + response.setWfmDemodReport(new SWGSDRangel::SWGWFMDemodReport()); + response.getWfmDemodReport()->init(); + webapiFormatChannelReport(response); + return 200; +} + +void WFMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const WFMDemodSettings& settings) +{ + response.getWfmDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); + response.getWfmDemodSettings()->setRfBandwidth(settings.m_rfBandwidth); + response.getWfmDemodSettings()->setAfBandwidth(settings.m_afBandwidth); + response.getWfmDemodSettings()->setVolume(settings.m_volume); + response.getWfmDemodSettings()->setSquelch(settings.m_squelch); + response.getWfmDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0); + response.getWfmDemodSettings()->setRgbColor(settings.m_rgbColor); + + if (response.getWfmDemodSettings()->getTitle()) { + *response.getWfmDemodSettings()->getTitle() = settings.m_title; + } else { + response.getWfmDemodSettings()->setTitle(new QString(settings.m_title)); + } + + if (response.getWfmDemodSettings()->getAudioDeviceName()) { + *response.getWfmDemodSettings()->getAudioDeviceName() = settings.m_audioDeviceName; + } else { + response.getWfmDemodSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName)); + } +} + +void WFMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) +{ + double magsqAvg, magsqPeak; + int nbMagsqSamples; + getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples); + + response.getWfmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); + response.getWfmDemodReport()->setSquelch(m_squelchState > 0 ? 1 : 0); + response.getWfmDemodReport()->setAudioSampleRate(m_audioSampleRate); + response.getWfmDemodReport()->setChannelSampleRate(m_inputSampleRate); +} + diff --git a/plugins/channelrx/demodwfm/wfmdemod.h b/plugins/channelrx/demodwfm/wfmdemod.h index 32ebccfbd..0e594eb33 100644 --- a/plugins/channelrx/demodwfm/wfmdemod.h +++ b/plugins/channelrx/demodwfm/wfmdemod.h @@ -118,6 +118,29 @@ public: m_magsqCount = 0; } + virtual int webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage); + + virtual int webapiSettingsPutPatch( + bool force, + const QStringList& channelSettingsKeys, + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage); + + virtual int webapiReportGet( + SWGSDRangel::SWGChannelReport& response, + QString& errorMessage); + + static int requiredBW(int rfBW) + { + if (rfBW <= 48000) { + return 48000; + } else { + return (3*rfBW)/2; + } + } + static const QString m_channelIdURI; static const QString m_channelId; @@ -167,6 +190,9 @@ private: void applyAudioSampleRate(int sampleRate); void applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force = false); void applySettings(const WFMDemodSettings& settings, bool force = false); + + void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const WFMDemodSettings& settings); + void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); }; #endif // INCLUDE_WFMDEMOD_H diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.cpp b/plugins/channelrx/demodwfm/wfmdemodgui.cpp index 6f78a3ad9..883884621 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.cpp +++ b/plugins/channelrx/demodwfm/wfmdemodgui.cpp @@ -77,7 +77,33 @@ bool WFMDemodGUI::deserialize(const QByteArray& data) bool WFMDemodGUI::handleMessage(const Message& message __attribute__((unused))) { - return false; + if (WFMDemod::MsgConfigureWFMDemod::match(message)) + { + qDebug("WFMDemodGUI::handleMessage: WFMDemod::MsgConfigureWFMDemod"); + const WFMDemod::MsgConfigureWFMDemod& cfg = (WFMDemod::MsgConfigureWFMDemod&) message; + m_settings = cfg.getSettings(); + blockApplySettings(true); + displaySettings(); + blockApplySettings(false); + return true; + } + else + { + return false; + } +} + +void WFMDemodGUI::handleInputMessages() +{ + Message* message; + + while ((message = getInputMessageQueue()->pop()) != 0) + { + if (handleMessage(*message)) + { + delete message; + } + } } void WFMDemodGUI::channelMarkerChangedByCursor() @@ -165,8 +191,10 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban setAttribute(Qt::WA_DeleteOnClose, true); connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); + connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); m_wfmDemod = (WFMDemod*) rxChannel; //new WFMDemod(m_deviceUISet->m_deviceSourceAPI); + m_wfmDemod->setMessageQueueToGUI(getInputMessageQueue()); connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); @@ -226,7 +254,7 @@ void WFMDemodGUI::applySettings(bool force) if (m_doApplySettings) { WFMDemod::MsgConfigureChannelizer *msgChan = WFMDemod::MsgConfigureChannelizer::create( - requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())), + WFMDemod::requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())), m_channelMarker.getCenterFrequency()); m_wfmDemod->getInputMessageQueue()->push(msgChan); diff --git a/plugins/channelrx/demodwfm/wfmdemodgui.h b/plugins/channelrx/demodwfm/wfmdemodgui.h index 8920a522c..c7998cc8e 100644 --- a/plugins/channelrx/demodwfm/wfmdemodgui.h +++ b/plugins/channelrx/demodwfm/wfmdemodgui.h @@ -63,15 +63,6 @@ private: void leaveEvent(QEvent*); void enterEvent(QEvent*); - static int requiredBW(int rfBW) - { - if (rfBW <= 48000) { - return 48000; - } else { - return (3*rfBW)/2; - } - } - private slots: void on_deltaFrequency_changed(qint64 value); void on_rfBW_currentIndexChanged(int index); @@ -81,6 +72,7 @@ private slots: void on_audioMute_toggled(bool checked); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDialogCalled(const QPoint& p); + void handleInputMessages(); void audioSelect(); void tick(); }; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 5e0f819be..baf09ca35 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1322,6 +1322,9 @@ margin-bottom: 20px; "UDPSinkReport" : { "$ref" : "#/definitions/UDPSinkReport" }, + "WFMDemodReport" : { + "$ref" : "#/definitions/WFMDemodReport" + }, "WFMModReport" : { "$ref" : "#/definitions/WFMModReport" } @@ -1367,6 +1370,9 @@ margin-bottom: 20px; "UDPSinkSettings" : { "$ref" : "#/definitions/UDPSinkSettings" }, + "WFMDemodSettings" : { + "$ref" : "#/definitions/WFMDemodSettings" + }, "WFMModSettings" : { "$ref" : "#/definitions/WFMModSettings" } @@ -1413,11 +1419,11 @@ margin-bottom: 20px; }, "slot1On" : { "type" : "integer", - "description" : "slot 1 status (1 if active else 0)" + "description" : "slot 1 status (1 if voice active else 0)" }, "slot2On" : { "type" : "integer", - "description" : "slot 2 status (1 if active else 0)" + "description" : "slot 2 status (1 if voice active else 0)" }, "syncType" : { "type" : "string", @@ -2653,6 +2659,64 @@ margin-bottom: 20px; } }, "description" : "UDPSink" +}; + defs.WFMDemodReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power transmitted in channel (dB)" + }, + "squelch" : { + "type" : "integer", + "description" : "squelch status (1 if open else 0)" + }, + "audioSampleRate" : { + "type" : "integer" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "WFMDemod" +}; + defs.WFMDemodSettings = { + "properties" : { + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "afBandwidth" : { + "type" : "number", + "format" : "float" + }, + "volume" : { + "type" : "number", + "format" : "float" + }, + "squelch" : { + "type" : "number", + "format" : "float" + }, + "audioMute" : { + "type" : "integer", + "description" : "audio mute (1 if muted else 0)" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "audioDeviceName" : { + "type" : "string" + } + }, + "description" : "WFMDemod" }; defs.WFMModReport = { "properties" : { @@ -20953,7 +21017,7 @@ except ApiException as e:
- Generated 2018-05-24T10:19:21.195+02:00 + Generated 2018-05-25T09:35:58.275+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/DSDDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/DSDDemod.yaml index 273a71222..91895f382 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/DSDDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/DSDDemod.yaml @@ -73,10 +73,10 @@ DSDDemodReport: description: symbol PLL status (1 if locked else 0) type: integer slot1On: - description: slot 1 status (1 if active else 0) + description: slot 1 status (1 if voice active else 0) type: integer slot2On: - description: slot 2 status (1 if active else 0) + description: slot 2 status (1 if voice active else 0) type: integer syncType: description: type of frame synchronized diff --git a/sdrbase/resources/webapi/doc/swagger/include/WFMDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/WFMDemod.yaml new file mode 100644 index 000000000..bf112fe15 --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/WFMDemod.yaml @@ -0,0 +1,42 @@ +WFMDemodSettings: + description: WFMDemod + properties: + inputFrequencyOffset: + type: integer + format: int64 + rfBandwidth: + type: number + format: float + afBandwidth: + type: number + format: float + volume: + type: number + format: float + squelch: + type: number + format: float + audioMute: + description: audio mute (1 if muted else 0) + type: integer + rgbColor: + type: integer + title: + type: string + audioDeviceName: + type: string + +WFMDemodReport: + description: WFMDemod + properties: + channelPowerDB: + description: power transmitted in channel (dB) + type: number + format: float + squelch: + description: squelch status (1 if open else 0) + type: integer + audioSampleRate: + type: integer + channelSampleRate: + type: integer diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 0a9e735f9..0cc758421 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1763,6 +1763,8 @@ definitions: $ref: "/doc/swagger/include/SSBMod.yaml#/SSBModSettings" UDPSinkSettings: $ref: "/doc/swagger/include/UDPSink.yaml#/UDPSinkSettings" + WFMDemodSettings: + $ref: "/doc/swagger/include/WFMDemod.yaml#/WFMDemodSettings" WFMModSettings: $ref: "/doc/swagger/include/WFMMod.yaml#/WFMModSettings" @@ -1794,6 +1796,8 @@ definitions: $ref: "/doc/swagger/include/SSBMod.yaml#/SSBModReport" UDPSinkReport: $ref: "/doc/swagger/include/UDPSink.yaml#/UDPSinkReport" + WFMDemodReport: + $ref: "/doc/swagger/include/WFMDemod.yaml#/WFMDemodReport" WFMModReport: $ref: "/doc/swagger/include/WFMMod.yaml#/WFMModReport" diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 6c57241db..ad630411a 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -1973,6 +1973,20 @@ bool WebAPIRequestMapper::validateChannelSettings( return false; } } + else if (*channelType == "WFMDemod") + { + if (channelSettings.getTx() == 0) + { + QJsonObject wfmDemodSettingsJsonObject = jsonObject["WFMDemodSettings"].toObject(); + channelSettingsKeys = wfmDemodSettingsJsonObject.keys(); + channelSettings.setWfmDemodSettings(new SWGSDRangel::SWGWFMDemodSettings()); + channelSettings.getWfmDemodSettings()->fromJsonObject(wfmDemodSettingsJsonObject); + return true; + } + else { + return false; + } + } else if (*channelType == "WFMMod") { if (channelSettings.getTx() != 0) diff --git a/swagger/sdrangel/api/swagger/include/WFMDemod.yaml b/swagger/sdrangel/api/swagger/include/WFMDemod.yaml new file mode 100644 index 000000000..bf112fe15 --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/WFMDemod.yaml @@ -0,0 +1,42 @@ +WFMDemodSettings: + description: WFMDemod + properties: + inputFrequencyOffset: + type: integer + format: int64 + rfBandwidth: + type: number + format: float + afBandwidth: + type: number + format: float + volume: + type: number + format: float + squelch: + type: number + format: float + audioMute: + description: audio mute (1 if muted else 0) + type: integer + rgbColor: + type: integer + title: + type: string + audioDeviceName: + type: string + +WFMDemodReport: + description: WFMDemod + properties: + channelPowerDB: + description: power transmitted in channel (dB) + type: number + format: float + squelch: + description: squelch status (1 if open else 0) + type: integer + audioSampleRate: + type: integer + channelSampleRate: + type: integer diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index fee0e1bd5..072153c37 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1763,6 +1763,8 @@ definitions: $ref: "http://localhost:8081/api/swagger/include/SSBMod.yaml#/SSBModSettings" UDPSinkSettings: $ref: "http://localhost:8081/api/swagger/include/UDPSink.yaml#/UDPSinkSettings" + WFMDemodSettings: + $ref: "http://localhost:8081/api/swagger/include/WFMDemod.yaml#/WFMDemodSettings" WFMModSettings: $ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModSettings" @@ -1794,6 +1796,8 @@ definitions: $ref: "http://localhost:8081/api/swagger/include/SSBMod.yaml#/SSBModReport" UDPSinkReport: $ref: "http://localhost:8081/api/swagger/include/UDPSink.yaml#/UDPSinkReport" + WFMDemodReport: + $ref: "http://localhost:8081/api/swagger/include/WFMDemod.yaml#/WFMDemodReport" WFMModReport: $ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModReport" diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 5e0f819be..baf09ca35 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1322,6 +1322,9 @@ margin-bottom: 20px; "UDPSinkReport" : { "$ref" : "#/definitions/UDPSinkReport" }, + "WFMDemodReport" : { + "$ref" : "#/definitions/WFMDemodReport" + }, "WFMModReport" : { "$ref" : "#/definitions/WFMModReport" } @@ -1367,6 +1370,9 @@ margin-bottom: 20px; "UDPSinkSettings" : { "$ref" : "#/definitions/UDPSinkSettings" }, + "WFMDemodSettings" : { + "$ref" : "#/definitions/WFMDemodSettings" + }, "WFMModSettings" : { "$ref" : "#/definitions/WFMModSettings" } @@ -1413,11 +1419,11 @@ margin-bottom: 20px; }, "slot1On" : { "type" : "integer", - "description" : "slot 1 status (1 if active else 0)" + "description" : "slot 1 status (1 if voice active else 0)" }, "slot2On" : { "type" : "integer", - "description" : "slot 2 status (1 if active else 0)" + "description" : "slot 2 status (1 if voice active else 0)" }, "syncType" : { "type" : "string", @@ -2653,6 +2659,64 @@ margin-bottom: 20px; } }, "description" : "UDPSink" +}; + defs.WFMDemodReport = { + "properties" : { + "channelPowerDB" : { + "type" : "number", + "format" : "float", + "description" : "power transmitted in channel (dB)" + }, + "squelch" : { + "type" : "integer", + "description" : "squelch status (1 if open else 0)" + }, + "audioSampleRate" : { + "type" : "integer" + }, + "channelSampleRate" : { + "type" : "integer" + } + }, + "description" : "WFMDemod" +}; + defs.WFMDemodSettings = { + "properties" : { + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "afBandwidth" : { + "type" : "number", + "format" : "float" + }, + "volume" : { + "type" : "number", + "format" : "float" + }, + "squelch" : { + "type" : "number", + "format" : "float" + }, + "audioMute" : { + "type" : "integer", + "description" : "audio mute (1 if muted else 0)" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "audioDeviceName" : { + "type" : "string" + } + }, + "description" : "WFMDemod" }; defs.WFMModReport = { "properties" : { @@ -20953,7 +21017,7 @@ except ApiException as e:
- Generated 2018-05-24T10:19:21.195+02:00 + Generated 2018-05-25T09:35:58.275+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp index c358588a8..40e23b6d1 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGChannelReport.cpp @@ -50,6 +50,8 @@ SWGChannelReport::SWGChannelReport() { m_ssb_mod_report_isSet = false; udp_sink_report = nullptr; m_udp_sink_report_isSet = false; + wfm_demod_report = nullptr; + m_wfm_demod_report_isSet = false; wfm_mod_report = nullptr; m_wfm_mod_report_isSet = false; } @@ -82,6 +84,8 @@ SWGChannelReport::init() { m_ssb_mod_report_isSet = false; udp_sink_report = new SWGUDPSinkReport(); m_udp_sink_report_isSet = false; + wfm_demod_report = new SWGWFMDemodReport(); + m_wfm_demod_report_isSet = false; wfm_mod_report = new SWGWFMModReport(); m_wfm_mod_report_isSet = false; } @@ -119,6 +123,9 @@ SWGChannelReport::cleanup() { if(udp_sink_report != nullptr) { delete udp_sink_report; } + if(wfm_demod_report != nullptr) { + delete wfm_demod_report; + } if(wfm_mod_report != nullptr) { delete wfm_mod_report; } @@ -157,6 +164,8 @@ SWGChannelReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&udp_sink_report, pJson["UDPSinkReport"], "SWGUDPSinkReport", "SWGUDPSinkReport"); + ::SWGSDRangel::setValue(&wfm_demod_report, pJson["WFMDemodReport"], "SWGWFMDemodReport", "SWGWFMDemodReport"); + ::SWGSDRangel::setValue(&wfm_mod_report, pJson["WFMModReport"], "SWGWFMModReport", "SWGWFMModReport"); } @@ -208,6 +217,9 @@ SWGChannelReport::asJsonObject() { if((udp_sink_report != nullptr) && (udp_sink_report->isSet())){ toJsonValue(QString("UDPSinkReport"), udp_sink_report, obj, QString("SWGUDPSinkReport")); } + if((wfm_demod_report != nullptr) && (wfm_demod_report->isSet())){ + toJsonValue(QString("WFMDemodReport"), wfm_demod_report, obj, QString("SWGWFMDemodReport")); + } if((wfm_mod_report != nullptr) && (wfm_mod_report->isSet())){ toJsonValue(QString("WFMModReport"), wfm_mod_report, obj, QString("SWGWFMModReport")); } @@ -325,6 +337,16 @@ SWGChannelReport::setUdpSinkReport(SWGUDPSinkReport* udp_sink_report) { this->m_udp_sink_report_isSet = true; } +SWGWFMDemodReport* +SWGChannelReport::getWfmDemodReport() { + return wfm_demod_report; +} +void +SWGChannelReport::setWfmDemodReport(SWGWFMDemodReport* wfm_demod_report) { + this->wfm_demod_report = wfm_demod_report; + this->m_wfm_demod_report_isSet = true; +} + SWGWFMModReport* SWGChannelReport::getWfmModReport() { return wfm_mod_report; @@ -351,6 +373,7 @@ SWGChannelReport::isSet(){ if(nfm_mod_report != nullptr && nfm_mod_report->isSet()){ isObjectUpdated = true; break;} if(ssb_mod_report != nullptr && ssb_mod_report->isSet()){ isObjectUpdated = true; break;} if(udp_sink_report != nullptr && udp_sink_report->isSet()){ isObjectUpdated = true; break;} + if(wfm_demod_report != nullptr && wfm_demod_report->isSet()){ isObjectUpdated = true; break;} if(wfm_mod_report != nullptr && wfm_mod_report->isSet()){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelReport.h b/swagger/sdrangel/code/qt5/client/SWGChannelReport.h index ff112531c..a2f747ad6 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGChannelReport.h @@ -31,6 +31,7 @@ #include "SWGNFMModReport.h" #include "SWGSSBModReport.h" #include "SWGUDPSinkReport.h" +#include "SWGWFMDemodReport.h" #include "SWGWFMModReport.h" #include @@ -85,6 +86,9 @@ public: SWGUDPSinkReport* getUdpSinkReport(); void setUdpSinkReport(SWGUDPSinkReport* udp_sink_report); + SWGWFMDemodReport* getWfmDemodReport(); + void setWfmDemodReport(SWGWFMDemodReport* wfm_demod_report); + SWGWFMModReport* getWfmModReport(); void setWfmModReport(SWGWFMModReport* wfm_mod_report); @@ -125,6 +129,9 @@ private: SWGUDPSinkReport* udp_sink_report; bool m_udp_sink_report_isSet; + SWGWFMDemodReport* wfm_demod_report; + bool m_wfm_demod_report_isSet; + SWGWFMModReport* wfm_mod_report; bool m_wfm_mod_report_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp index 32c6b59df..9acec3f34 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp @@ -50,6 +50,8 @@ SWGChannelSettings::SWGChannelSettings() { m_ssb_mod_settings_isSet = false; udp_sink_settings = nullptr; m_udp_sink_settings_isSet = false; + wfm_demod_settings = nullptr; + m_wfm_demod_settings_isSet = false; wfm_mod_settings = nullptr; m_wfm_mod_settings_isSet = false; } @@ -82,6 +84,8 @@ SWGChannelSettings::init() { m_ssb_mod_settings_isSet = false; udp_sink_settings = new SWGUDPSinkSettings(); m_udp_sink_settings_isSet = false; + wfm_demod_settings = new SWGWFMDemodSettings(); + m_wfm_demod_settings_isSet = false; wfm_mod_settings = new SWGWFMModSettings(); m_wfm_mod_settings_isSet = false; } @@ -119,6 +123,9 @@ SWGChannelSettings::cleanup() { if(udp_sink_settings != nullptr) { delete udp_sink_settings; } + if(wfm_demod_settings != nullptr) { + delete wfm_demod_settings; + } if(wfm_mod_settings != nullptr) { delete wfm_mod_settings; } @@ -157,6 +164,8 @@ SWGChannelSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&udp_sink_settings, pJson["UDPSinkSettings"], "SWGUDPSinkSettings", "SWGUDPSinkSettings"); + ::SWGSDRangel::setValue(&wfm_demod_settings, pJson["WFMDemodSettings"], "SWGWFMDemodSettings", "SWGWFMDemodSettings"); + ::SWGSDRangel::setValue(&wfm_mod_settings, pJson["WFMModSettings"], "SWGWFMModSettings", "SWGWFMModSettings"); } @@ -208,6 +217,9 @@ SWGChannelSettings::asJsonObject() { if((udp_sink_settings != nullptr) && (udp_sink_settings->isSet())){ toJsonValue(QString("UDPSinkSettings"), udp_sink_settings, obj, QString("SWGUDPSinkSettings")); } + if((wfm_demod_settings != nullptr) && (wfm_demod_settings->isSet())){ + toJsonValue(QString("WFMDemodSettings"), wfm_demod_settings, obj, QString("SWGWFMDemodSettings")); + } if((wfm_mod_settings != nullptr) && (wfm_mod_settings->isSet())){ toJsonValue(QString("WFMModSettings"), wfm_mod_settings, obj, QString("SWGWFMModSettings")); } @@ -325,6 +337,16 @@ SWGChannelSettings::setUdpSinkSettings(SWGUDPSinkSettings* udp_sink_settings) { this->m_udp_sink_settings_isSet = true; } +SWGWFMDemodSettings* +SWGChannelSettings::getWfmDemodSettings() { + return wfm_demod_settings; +} +void +SWGChannelSettings::setWfmDemodSettings(SWGWFMDemodSettings* wfm_demod_settings) { + this->wfm_demod_settings = wfm_demod_settings; + this->m_wfm_demod_settings_isSet = true; +} + SWGWFMModSettings* SWGChannelSettings::getWfmModSettings() { return wfm_mod_settings; @@ -351,6 +373,7 @@ SWGChannelSettings::isSet(){ if(nfm_mod_settings != nullptr && nfm_mod_settings->isSet()){ isObjectUpdated = true; break;} if(ssb_mod_settings != nullptr && ssb_mod_settings->isSet()){ isObjectUpdated = true; break;} if(udp_sink_settings != nullptr && udp_sink_settings->isSet()){ isObjectUpdated = true; break;} + if(wfm_demod_settings != nullptr && wfm_demod_settings->isSet()){ isObjectUpdated = true; break;} if(wfm_mod_settings != nullptr && wfm_mod_settings->isSet()){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h index d3fb1d576..8dd292d0f 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h @@ -31,6 +31,7 @@ #include "SWGNFMModSettings.h" #include "SWGSSBModSettings.h" #include "SWGUDPSinkSettings.h" +#include "SWGWFMDemodSettings.h" #include "SWGWFMModSettings.h" #include @@ -85,6 +86,9 @@ public: SWGUDPSinkSettings* getUdpSinkSettings(); void setUdpSinkSettings(SWGUDPSinkSettings* udp_sink_settings); + SWGWFMDemodSettings* getWfmDemodSettings(); + void setWfmDemodSettings(SWGWFMDemodSettings* wfm_demod_settings); + SWGWFMModSettings* getWfmModSettings(); void setWfmModSettings(SWGWFMModSettings* wfm_mod_settings); @@ -125,6 +129,9 @@ private: SWGUDPSinkSettings* udp_sink_settings; bool m_udp_sink_settings_isSet; + SWGWFMDemodSettings* wfm_demod_settings; + bool m_wfm_demod_settings_isSet; + SWGWFMModSettings* wfm_mod_settings; bool m_wfm_mod_settings_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 2505a20a4..b4a2ffd13 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -74,6 +74,8 @@ #include "SWGSuccessResponse.h" #include "SWGUDPSinkReport.h" #include "SWGUDPSinkSettings.h" +#include "SWGWFMDemodReport.h" +#include "SWGWFMDemodSettings.h" #include "SWGWFMModReport.h" #include "SWGWFMModSettings.h" @@ -260,6 +262,12 @@ namespace SWGSDRangel { if(QString("SWGUDPSinkSettings").compare(type) == 0) { return new SWGUDPSinkSettings(); } + if(QString("SWGWFMDemodReport").compare(type) == 0) { + return new SWGWFMDemodReport(); + } + if(QString("SWGWFMDemodSettings").compare(type) == 0) { + return new SWGWFMDemodSettings(); + } if(QString("SWGWFMModReport").compare(type) == 0) { return new SWGWFMModReport(); } diff --git a/swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.cpp b/swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.cpp new file mode 100644 index 000000000..a7ae40494 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.cpp @@ -0,0 +1,169 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.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 "SWGWFMDemodReport.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGWFMDemodReport::SWGWFMDemodReport(QString* json) { + init(); + this->fromJson(*json); +} + +SWGWFMDemodReport::SWGWFMDemodReport() { + channel_power_db = 0.0f; + m_channel_power_db_isSet = false; + squelch = 0; + m_squelch_isSet = false; + audio_sample_rate = 0; + m_audio_sample_rate_isSet = false; + channel_sample_rate = 0; + m_channel_sample_rate_isSet = false; +} + +SWGWFMDemodReport::~SWGWFMDemodReport() { + this->cleanup(); +} + +void +SWGWFMDemodReport::init() { + channel_power_db = 0.0f; + m_channel_power_db_isSet = false; + squelch = 0; + m_squelch_isSet = false; + audio_sample_rate = 0; + m_audio_sample_rate_isSet = false; + channel_sample_rate = 0; + m_channel_sample_rate_isSet = false; +} + +void +SWGWFMDemodReport::cleanup() { + + + + +} + +SWGWFMDemodReport* +SWGWFMDemodReport::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGWFMDemodReport::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", ""); + + ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "qint32", ""); + + ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); + + ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", ""); + +} + +QString +SWGWFMDemodReport::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGWFMDemodReport::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_channel_power_db_isSet){ + obj->insert("channelPowerDB", QJsonValue(channel_power_db)); + } + if(m_squelch_isSet){ + obj->insert("squelch", QJsonValue(squelch)); + } + if(m_audio_sample_rate_isSet){ + obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); + } + if(m_channel_sample_rate_isSet){ + obj->insert("channelSampleRate", QJsonValue(channel_sample_rate)); + } + + return obj; +} + +float +SWGWFMDemodReport::getChannelPowerDb() { + return channel_power_db; +} +void +SWGWFMDemodReport::setChannelPowerDb(float channel_power_db) { + this->channel_power_db = channel_power_db; + this->m_channel_power_db_isSet = true; +} + +qint32 +SWGWFMDemodReport::getSquelch() { + return squelch; +} +void +SWGWFMDemodReport::setSquelch(qint32 squelch) { + this->squelch = squelch; + this->m_squelch_isSet = true; +} + +qint32 +SWGWFMDemodReport::getAudioSampleRate() { + return audio_sample_rate; +} +void +SWGWFMDemodReport::setAudioSampleRate(qint32 audio_sample_rate) { + this->audio_sample_rate = audio_sample_rate; + this->m_audio_sample_rate_isSet = true; +} + +qint32 +SWGWFMDemodReport::getChannelSampleRate() { + return channel_sample_rate; +} +void +SWGWFMDemodReport::setChannelSampleRate(qint32 channel_sample_rate) { + this->channel_sample_rate = channel_sample_rate; + this->m_channel_sample_rate_isSet = true; +} + + +bool +SWGWFMDemodReport::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_channel_power_db_isSet){ isObjectUpdated = true; break;} + if(m_squelch_isSet){ isObjectUpdated = true; break;} + if(m_audio_sample_rate_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/SWGWFMDemodReport.h b/swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.h new file mode 100644 index 000000000..cba57e09e --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGWFMDemodReport.h @@ -0,0 +1,76 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.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. + */ + +/* + * SWGWFMDemodReport.h + * + * WFMDemod + */ + +#ifndef SWGWFMDemodReport_H_ +#define SWGWFMDemodReport_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGWFMDemodReport: public SWGObject { +public: + SWGWFMDemodReport(); + SWGWFMDemodReport(QString* json); + virtual ~SWGWFMDemodReport(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGWFMDemodReport* fromJson(QString &jsonString) override; + + float getChannelPowerDb(); + void setChannelPowerDb(float channel_power_db); + + qint32 getSquelch(); + void setSquelch(qint32 squelch); + + qint32 getAudioSampleRate(); + void setAudioSampleRate(qint32 audio_sample_rate); + + qint32 getChannelSampleRate(); + void setChannelSampleRate(qint32 channel_sample_rate); + + + virtual bool isSet() override; + +private: + float channel_power_db; + bool m_channel_power_db_isSet; + + qint32 squelch; + bool m_squelch_isSet; + + qint32 audio_sample_rate; + bool m_audio_sample_rate_isSet; + + qint32 channel_sample_rate; + bool m_channel_sample_rate_isSet; + +}; + +} + +#endif /* SWGWFMDemodReport_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.cpp new file mode 100644 index 000000000..8e7999fff --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.cpp @@ -0,0 +1,278 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.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 "SWGWFMDemodSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGWFMDemodSettings::SWGWFMDemodSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGWFMDemodSettings::SWGWFMDemodSettings() { + input_frequency_offset = 0L; + m_input_frequency_offset_isSet = false; + rf_bandwidth = 0.0f; + m_rf_bandwidth_isSet = false; + af_bandwidth = 0.0f; + m_af_bandwidth_isSet = false; + volume = 0.0f; + m_volume_isSet = false; + squelch = 0.0f; + m_squelch_isSet = false; + audio_mute = 0; + m_audio_mute_isSet = false; + rgb_color = 0; + m_rgb_color_isSet = false; + title = nullptr; + m_title_isSet = false; + audio_device_name = nullptr; + m_audio_device_name_isSet = false; +} + +SWGWFMDemodSettings::~SWGWFMDemodSettings() { + this->cleanup(); +} + +void +SWGWFMDemodSettings::init() { + input_frequency_offset = 0L; + m_input_frequency_offset_isSet = false; + rf_bandwidth = 0.0f; + m_rf_bandwidth_isSet = false; + af_bandwidth = 0.0f; + m_af_bandwidth_isSet = false; + volume = 0.0f; + m_volume_isSet = false; + squelch = 0.0f; + m_squelch_isSet = false; + audio_mute = 0; + m_audio_mute_isSet = false; + rgb_color = 0; + m_rgb_color_isSet = false; + title = new QString(""); + m_title_isSet = false; + audio_device_name = new QString(""); + m_audio_device_name_isSet = false; +} + +void +SWGWFMDemodSettings::cleanup() { + + + + + + + + if(title != nullptr) { + delete title; + } + if(audio_device_name != nullptr) { + delete audio_device_name; + } +} + +SWGWFMDemodSettings* +SWGWFMDemodSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGWFMDemodSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); + + ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); + + ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", ""); + + ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", ""); + + ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", ""); + + ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", ""); + + ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); + + ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); + + ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString"); + +} + +QString +SWGWFMDemodSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGWFMDemodSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_input_frequency_offset_isSet){ + obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); + } + if(m_rf_bandwidth_isSet){ + obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); + } + if(m_af_bandwidth_isSet){ + obj->insert("afBandwidth", QJsonValue(af_bandwidth)); + } + if(m_volume_isSet){ + obj->insert("volume", QJsonValue(volume)); + } + if(m_squelch_isSet){ + obj->insert("squelch", QJsonValue(squelch)); + } + if(m_audio_mute_isSet){ + obj->insert("audioMute", QJsonValue(audio_mute)); + } + if(m_rgb_color_isSet){ + obj->insert("rgbColor", QJsonValue(rgb_color)); + } + if(title != nullptr && *title != QString("")){ + toJsonValue(QString("title"), title, obj, QString("QString")); + } + if(audio_device_name != nullptr && *audio_device_name != QString("")){ + toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString")); + } + + return obj; +} + +qint64 +SWGWFMDemodSettings::getInputFrequencyOffset() { + return input_frequency_offset; +} +void +SWGWFMDemodSettings::setInputFrequencyOffset(qint64 input_frequency_offset) { + this->input_frequency_offset = input_frequency_offset; + this->m_input_frequency_offset_isSet = true; +} + +float +SWGWFMDemodSettings::getRfBandwidth() { + return rf_bandwidth; +} +void +SWGWFMDemodSettings::setRfBandwidth(float rf_bandwidth) { + this->rf_bandwidth = rf_bandwidth; + this->m_rf_bandwidth_isSet = true; +} + +float +SWGWFMDemodSettings::getAfBandwidth() { + return af_bandwidth; +} +void +SWGWFMDemodSettings::setAfBandwidth(float af_bandwidth) { + this->af_bandwidth = af_bandwidth; + this->m_af_bandwidth_isSet = true; +} + +float +SWGWFMDemodSettings::getVolume() { + return volume; +} +void +SWGWFMDemodSettings::setVolume(float volume) { + this->volume = volume; + this->m_volume_isSet = true; +} + +float +SWGWFMDemodSettings::getSquelch() { + return squelch; +} +void +SWGWFMDemodSettings::setSquelch(float squelch) { + this->squelch = squelch; + this->m_squelch_isSet = true; +} + +qint32 +SWGWFMDemodSettings::getAudioMute() { + return audio_mute; +} +void +SWGWFMDemodSettings::setAudioMute(qint32 audio_mute) { + this->audio_mute = audio_mute; + this->m_audio_mute_isSet = true; +} + +qint32 +SWGWFMDemodSettings::getRgbColor() { + return rgb_color; +} +void +SWGWFMDemodSettings::setRgbColor(qint32 rgb_color) { + this->rgb_color = rgb_color; + this->m_rgb_color_isSet = true; +} + +QString* +SWGWFMDemodSettings::getTitle() { + return title; +} +void +SWGWFMDemodSettings::setTitle(QString* title) { + this->title = title; + this->m_title_isSet = true; +} + +QString* +SWGWFMDemodSettings::getAudioDeviceName() { + return audio_device_name; +} +void +SWGWFMDemodSettings::setAudioDeviceName(QString* audio_device_name) { + this->audio_device_name = audio_device_name; + this->m_audio_device_name_isSet = true; +} + + +bool +SWGWFMDemodSettings::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;} + if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;} + if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;} + if(m_volume_isSet){ isObjectUpdated = true; break;} + if(m_squelch_isSet){ isObjectUpdated = true; break;} + if(m_audio_mute_isSet){ isObjectUpdated = true; break;} + if(m_rgb_color_isSet){ isObjectUpdated = true; break;} + if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;} + if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.h new file mode 100644 index 000000000..91432b19a --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGWFMDemodSettings.h @@ -0,0 +1,107 @@ +/** + * 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 --- + * + * OpenAPI spec version: 4.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. + */ + +/* + * SWGWFMDemodSettings.h + * + * WFMDemod + */ + +#ifndef SWGWFMDemodSettings_H_ +#define SWGWFMDemodSettings_H_ + +#include + + +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGWFMDemodSettings: public SWGObject { +public: + SWGWFMDemodSettings(); + SWGWFMDemodSettings(QString* json); + virtual ~SWGWFMDemodSettings(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGWFMDemodSettings* fromJson(QString &jsonString) override; + + qint64 getInputFrequencyOffset(); + void setInputFrequencyOffset(qint64 input_frequency_offset); + + float getRfBandwidth(); + void setRfBandwidth(float rf_bandwidth); + + float getAfBandwidth(); + void setAfBandwidth(float af_bandwidth); + + float getVolume(); + void setVolume(float volume); + + float getSquelch(); + void setSquelch(float squelch); + + qint32 getAudioMute(); + void setAudioMute(qint32 audio_mute); + + qint32 getRgbColor(); + void setRgbColor(qint32 rgb_color); + + QString* getTitle(); + void setTitle(QString* title); + + QString* getAudioDeviceName(); + void setAudioDeviceName(QString* audio_device_name); + + + virtual bool isSet() override; + +private: + qint64 input_frequency_offset; + bool m_input_frequency_offset_isSet; + + float rf_bandwidth; + bool m_rf_bandwidth_isSet; + + float af_bandwidth; + bool m_af_bandwidth_isSet; + + float volume; + bool m_volume_isSet; + + float squelch; + bool m_squelch_isSet; + + qint32 audio_mute; + bool m_audio_mute_isSet; + + qint32 rgb_color; + bool m_rgb_color_isSet; + + QString* title; + bool m_title_isSet; + + QString* audio_device_name; + bool m_audio_device_name_isSet; + +}; + +} + +#endif /* SWGWFMDemodSettings_H_ */ diff --git a/swagger/sdrangel/examples/rx_test.py b/swagger/sdrangel/examples/rx_test.py index 2fe2a9bf5..ba5272f96 100644 --- a/swagger/sdrangel/examples/rx_test.py +++ b/swagger/sdrangel/examples/rx_test.py @@ -174,6 +174,14 @@ def setupChannel(deviceset_url, options): settings["BFMDemodSettings"]["lsbStereo"] = 1 if options.lsb_stereo else 0 settings["BFMDemodSettings"]["rdsActive"] = 1 if options.rds else 0 settings["BFMDemodSettings"]["title"] = "Channel %d" % i + elif options.channel_id == "WFMDemod": + settings["WFMDemodSettings"]["inputFrequencyOffset"] = options.channel_freq + settings["WFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000 + settings["WFMDemodSettings"]["rfBandwidth"] = options.rf_bw + settings["WFMDemodSettings"]["volume"] = options.volume + settings["WFMDemodSettings"]["squelch"] = options.squelch_db # dB + settings["WFMDemodSettings"]["audioMute"] = 0 + settings["WFMDemodSettings"]["title"] = "Channel %d" % i elif options.channel_id == "AMDemod": settings["AMDemodSettings"]["inputFrequencyOffset"] = options.channel_freq settings["AMDemodSettings"]["rfBandwidth"] = options.rf_bw