From 092efb3780b52c776b073f94852e976c54ceb5a3 Mon Sep 17 00:00:00 2001 From: srcejon Date: Fri, 21 Jun 2024 09:03:32 +0100 Subject: [PATCH 1/4] Update FreqScanner swagger files --- sdrbase/resources/webapi/doc/html2/index.html | 33 ++++- .../doc/swagger/include/ChannelActions.yaml | 2 + .../doc/swagger/include/FreqScanner.yaml | 24 ++++ .../api/swagger/include/ChannelActions.yaml | 2 + .../api/swagger/include/FreqScanner.yaml | 24 ++++ swagger/sdrangel/code/html2/index.html | 33 ++++- .../code/qt5/client/SWGChannelActions.cpp | 25 ++++ .../code/qt5/client/SWGChannelActions.h | 7 + .../code/qt5/client/SWGFreqScannerActions.cpp | 108 +++++++++++++++ .../code/qt5/client/SWGFreqScannerActions.h | 58 ++++++++ .../qt5/client/SWGFreqScannerChannelState.cpp | 131 ++++++++++++++++++ .../qt5/client/SWGFreqScannerChannelState.h | 64 +++++++++ .../code/qt5/client/SWGFreqScannerReport.cpp | 29 ++++ .../code/qt5/client/SWGFreqScannerReport.h | 8 ++ .../code/qt5/client/SWGModelFactory.h | 12 ++ 15 files changed, 558 insertions(+), 2 deletions(-) create mode 100644 swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.h create mode 100644 swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.h diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index e602fe535c..044777b059 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -3598,6 +3598,9 @@ "FileSourceActions" : { "$ref" : "#/definitions/FileSourceActions" }, + "FreqScannerActions" : { + "$ref" : "#/definitions/FreqScannerActions" + }, "IEEE_802_15_4_ModActions" : { "$ref" : "#/definitions/IEEE_802_15_4_ModActions" }, @@ -7221,6 +7224,28 @@ } }, "description" : "FreeDVMod" +}; + defs.FreqScannerActions = { + "properties" : { + "run" : { + "type" : "integer", + "description" : "Set the plugin running state\n * 0 - idle\n * 1 - run\n" + } + }, + "description" : "Frequency Scanner actions" +}; + defs.FreqScannerChannelState = { + "properties" : { + "frequency" : { + "type" : "integer", + "description" : "Channel centre frequency in Hz" + }, + "power" : { + "type" : "number", + "format" : "float", + "description" : "Channel power in dB" + } + } }; defs.FreqScannerFrequency = { "properties" : { @@ -7252,6 +7277,12 @@ "properties" : { "channelSampleRate" : { "type" : "integer" + }, + "channelState" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/FreqScannerChannelState" + } } }, "description" : "FreqScanner" @@ -59084,7 +59115,7 @@

Status: 501 - Function not implemented

- Generated 2024-06-18T10:11:11.522+02:00 + Generated 2024-06-21T10:02:32.986+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml b/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml index b484c1116c..02856ac8de 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/ChannelActions.yaml @@ -25,6 +25,8 @@ ChannelActions: $ref: "/doc/swagger/include/FileSink.yaml#/FileSinkActions" FileSourceActions: $ref: "/doc/swagger/include/FileSource.yaml#/FileSourceActions" + FreqScannerActions: + $ref: "/doc/swagger/include/FreqScanner.yaml#/FreqScannerActions" IEEE_802_15_4_ModActions: $ref: "/doc/swagger/include/IEEE_802_15_4_Mod.yaml#/IEEE_802_15_4_ModActions" PacketModActions: diff --git a/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml b/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml index 64e74ffef0..760eee0877 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml @@ -59,6 +59,20 @@ FreqScannerReport: properties: channelSampleRate: type: integer + channelState: + type: array + items: + $ref: "/doc/swagger/include/FreqScanner.yaml#/FreqScannerChannelState" + +FreqScannerChannelState: + properties: + frequency: + description: "Channel centre frequency in Hz" + type: integer + power: + description: "Channel power in dB" + type: number + format: float FreqScannerFrequency: properties: @@ -77,3 +91,13 @@ FreqScannerFrequency: type: string squelch: type: string + +FreqScannerActions: + description: "Frequency Scanner actions" + properties: + run: + type: integer + description: > + Set the plugin running state + * 0 - idle + * 1 - run diff --git a/swagger/sdrangel/api/swagger/include/ChannelActions.yaml b/swagger/sdrangel/api/swagger/include/ChannelActions.yaml index d0cad67df2..4523c25224 100644 --- a/swagger/sdrangel/api/swagger/include/ChannelActions.yaml +++ b/swagger/sdrangel/api/swagger/include/ChannelActions.yaml @@ -25,6 +25,8 @@ ChannelActions: $ref: "http://swgserver:8081/api/swagger/include/FileSink.yaml#/FileSinkActions" FileSourceActions: $ref: "http://swgserver:8081/api/swagger/include/FileSource.yaml#/FileSourceActions" + FreqScannerActions: + $ref: "http://swgserver:8081/api/swagger/include/FreqScanner.yaml#/FreqScannerActions" IEEE_802_15_4_ModActions: $ref: "http://swgserver:8081/api/swagger/include/IEEE_802_15_4_Mod.yaml#/IEEE_802_15_4_ModActions" PacketModActions: diff --git a/swagger/sdrangel/api/swagger/include/FreqScanner.yaml b/swagger/sdrangel/api/swagger/include/FreqScanner.yaml index 3319faa686..c3e4471607 100644 --- a/swagger/sdrangel/api/swagger/include/FreqScanner.yaml +++ b/swagger/sdrangel/api/swagger/include/FreqScanner.yaml @@ -59,6 +59,20 @@ FreqScannerReport: properties: channelSampleRate: type: integer + channelState: + type: array + items: + $ref: "http://swgserver:8081/api/swagger/include/FreqScanner.yaml#/FreqScannerChannelState" + +FreqScannerChannelState: + properties: + frequency: + description: "Channel centre frequency in Hz" + type: integer + power: + description: "Channel power in dB" + type: number + format: float FreqScannerFrequency: properties: @@ -77,3 +91,13 @@ FreqScannerFrequency: type: string squelch: type: string + +FreqScannerActions: + description: "Frequency Scanner actions" + properties: + run: + type: integer + description: > + Set the plugin running state + * 0 - idle + * 1 - run diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index e602fe535c..044777b059 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -3598,6 +3598,9 @@ "FileSourceActions" : { "$ref" : "#/definitions/FileSourceActions" }, + "FreqScannerActions" : { + "$ref" : "#/definitions/FreqScannerActions" + }, "IEEE_802_15_4_ModActions" : { "$ref" : "#/definitions/IEEE_802_15_4_ModActions" }, @@ -7221,6 +7224,28 @@ } }, "description" : "FreeDVMod" +}; + defs.FreqScannerActions = { + "properties" : { + "run" : { + "type" : "integer", + "description" : "Set the plugin running state\n * 0 - idle\n * 1 - run\n" + } + }, + "description" : "Frequency Scanner actions" +}; + defs.FreqScannerChannelState = { + "properties" : { + "frequency" : { + "type" : "integer", + "description" : "Channel centre frequency in Hz" + }, + "power" : { + "type" : "number", + "format" : "float", + "description" : "Channel power in dB" + } + } }; defs.FreqScannerFrequency = { "properties" : { @@ -7252,6 +7277,12 @@ "properties" : { "channelSampleRate" : { "type" : "integer" + }, + "channelState" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/FreqScannerChannelState" + } } }, "description" : "FreqScanner" @@ -59084,7 +59115,7 @@

Status: 501 - Function not implemented

- Generated 2024-06-18T10:11:11.522+02:00 + Generated 2024-06-21T10:02:32.986+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelActions.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelActions.cpp index 767398c252..43566c3b4c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelActions.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGChannelActions.cpp @@ -44,6 +44,8 @@ SWGChannelActions::SWGChannelActions() { m_file_sink_actions_isSet = false; file_source_actions = nullptr; m_file_source_actions_isSet = false; + freq_scanner_actions = nullptr; + m_freq_scanner_actions_isSet = false; ieee_802_15_4_mod_actions = nullptr; m_ieee_802_15_4_mod_actions_isSet = false; packet_mod_actions = nullptr; @@ -80,6 +82,8 @@ SWGChannelActions::init() { m_file_sink_actions_isSet = false; file_source_actions = new SWGFileSourceActions(); m_file_source_actions_isSet = false; + freq_scanner_actions = new SWGFreqScannerActions(); + m_freq_scanner_actions_isSet = false; ieee_802_15_4_mod_actions = new SWGIEEE_802_15_4_ModActions(); m_ieee_802_15_4_mod_actions_isSet = false; packet_mod_actions = new SWGPacketModActions(); @@ -114,6 +118,9 @@ SWGChannelActions::cleanup() { if(file_source_actions != nullptr) { delete file_source_actions; } + if(freq_scanner_actions != nullptr) { + delete freq_scanner_actions; + } if(ieee_802_15_4_mod_actions != nullptr) { delete ieee_802_15_4_mod_actions; } @@ -161,6 +168,8 @@ SWGChannelActions::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&file_source_actions, pJson["FileSourceActions"], "SWGFileSourceActions", "SWGFileSourceActions"); + ::SWGSDRangel::setValue(&freq_scanner_actions, pJson["FreqScannerActions"], "SWGFreqScannerActions", "SWGFreqScannerActions"); + ::SWGSDRangel::setValue(&ieee_802_15_4_mod_actions, pJson["IEEE_802_15_4_ModActions"], "SWGIEEE_802_15_4_ModActions", "SWGIEEE_802_15_4_ModActions"); ::SWGSDRangel::setValue(&packet_mod_actions, pJson["PacketModActions"], "SWGPacketModActions", "SWGPacketModActions"); @@ -213,6 +222,9 @@ SWGChannelActions::asJsonObject() { if((file_source_actions != nullptr) && (file_source_actions->isSet())){ toJsonValue(QString("FileSourceActions"), file_source_actions, obj, QString("SWGFileSourceActions")); } + if((freq_scanner_actions != nullptr) && (freq_scanner_actions->isSet())){ + toJsonValue(QString("FreqScannerActions"), freq_scanner_actions, obj, QString("SWGFreqScannerActions")); + } if((ieee_802_15_4_mod_actions != nullptr) && (ieee_802_15_4_mod_actions->isSet())){ toJsonValue(QString("IEEE_802_15_4_ModActions"), ieee_802_15_4_mod_actions, obj, QString("SWGIEEE_802_15_4_ModActions")); } @@ -315,6 +327,16 @@ SWGChannelActions::setFileSourceActions(SWGFileSourceActions* file_source_action this->m_file_source_actions_isSet = true; } +SWGFreqScannerActions* +SWGChannelActions::getFreqScannerActions() { + return freq_scanner_actions; +} +void +SWGChannelActions::setFreqScannerActions(SWGFreqScannerActions* freq_scanner_actions) { + this->freq_scanner_actions = freq_scanner_actions; + this->m_freq_scanner_actions_isSet = true; +} + SWGIEEE_802_15_4_ModActions* SWGChannelActions::getIeee802154ModActions() { return ieee_802_15_4_mod_actions; @@ -404,6 +426,9 @@ SWGChannelActions::isSet(){ if(file_source_actions && file_source_actions->isSet()){ isObjectUpdated = true; break; } + if(freq_scanner_actions && freq_scanner_actions->isSet()){ + isObjectUpdated = true; break; + } if(ieee_802_15_4_mod_actions && ieee_802_15_4_mod_actions->isSet()){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelActions.h b/swagger/sdrangel/code/qt5/client/SWGChannelActions.h index c93e066d57..9d42262a78 100644 --- a/swagger/sdrangel/code/qt5/client/SWGChannelActions.h +++ b/swagger/sdrangel/code/qt5/client/SWGChannelActions.h @@ -26,6 +26,7 @@ #include "SWGAPTDemodActions.h" #include "SWGFileSinkActions.h" #include "SWGFileSourceActions.h" +#include "SWGFreqScannerActions.h" #include "SWGIEEE_802_15_4_ModActions.h" #include "SWGPSK31ModActions.h" #include "SWGPacketModActions.h" @@ -76,6 +77,9 @@ class SWG_API SWGChannelActions: public SWGObject { SWGFileSourceActions* getFileSourceActions(); void setFileSourceActions(SWGFileSourceActions* file_source_actions); + SWGFreqScannerActions* getFreqScannerActions(); + void setFreqScannerActions(SWGFreqScannerActions* freq_scanner_actions); + SWGIEEE_802_15_4_ModActions* getIeee802154ModActions(); void setIeee802154ModActions(SWGIEEE_802_15_4_ModActions* ieee_802_15_4_mod_actions); @@ -122,6 +126,9 @@ class SWG_API SWGChannelActions: public SWGObject { SWGFileSourceActions* file_source_actions; bool m_file_source_actions_isSet; + SWGFreqScannerActions* freq_scanner_actions; + bool m_freq_scanner_actions_isSet; + SWGIEEE_802_15_4_ModActions* ieee_802_15_4_mod_actions; bool m_ieee_802_15_4_mod_actions_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.cpp b/swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.cpp new file mode 100644 index 0000000000..a0e8a6732e --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.cpp @@ -0,0 +1,108 @@ +/** + * 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: 7.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 "SWGFreqScannerActions.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGFreqScannerActions::SWGFreqScannerActions(QString* json) { + init(); + this->fromJson(*json); +} + +SWGFreqScannerActions::SWGFreqScannerActions() { + run = 0; + m_run_isSet = false; +} + +SWGFreqScannerActions::~SWGFreqScannerActions() { + this->cleanup(); +} + +void +SWGFreqScannerActions::init() { + run = 0; + m_run_isSet = false; +} + +void +SWGFreqScannerActions::cleanup() { + +} + +SWGFreqScannerActions* +SWGFreqScannerActions::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGFreqScannerActions::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&run, pJson["run"], "qint32", ""); + +} + +QString +SWGFreqScannerActions::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGFreqScannerActions::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_run_isSet){ + obj->insert("run", QJsonValue(run)); + } + + return obj; +} + +qint32 +SWGFreqScannerActions::getRun() { + return run; +} +void +SWGFreqScannerActions::setRun(qint32 run) { + this->run = run; + this->m_run_isSet = true; +} + + +bool +SWGFreqScannerActions::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_run_isSet){ + isObjectUpdated = true; break; + } + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.h b/swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.h new file mode 100644 index 0000000000..1445b8406d --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerActions.h @@ -0,0 +1,58 @@ +/** + * 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: 7.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. + */ + +/* + * SWGFreqScannerActions.h + * + * Frequency Scanner actions + */ + +#ifndef SWGFreqScannerActions_H_ +#define SWGFreqScannerActions_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGFreqScannerActions: public SWGObject { +public: + SWGFreqScannerActions(); + SWGFreqScannerActions(QString* json); + virtual ~SWGFreqScannerActions(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGFreqScannerActions* fromJson(QString &jsonString) override; + + qint32 getRun(); + void setRun(qint32 run); + + + virtual bool isSet() override; + +private: + qint32 run; + bool m_run_isSet; + +}; + +} + +#endif /* SWGFreqScannerActions_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.cpp b/swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.cpp new file mode 100644 index 0000000000..c9137e44d1 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.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: 7.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 "SWGFreqScannerChannelState.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGFreqScannerChannelState::SWGFreqScannerChannelState(QString* json) { + init(); + this->fromJson(*json); +} + +SWGFreqScannerChannelState::SWGFreqScannerChannelState() { + frequency = 0; + m_frequency_isSet = false; + power = 0.0f; + m_power_isSet = false; +} + +SWGFreqScannerChannelState::~SWGFreqScannerChannelState() { + this->cleanup(); +} + +void +SWGFreqScannerChannelState::init() { + frequency = 0; + m_frequency_isSet = false; + power = 0.0f; + m_power_isSet = false; +} + +void +SWGFreqScannerChannelState::cleanup() { + + +} + +SWGFreqScannerChannelState* +SWGFreqScannerChannelState::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGFreqScannerChannelState::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&frequency, pJson["frequency"], "qint32", ""); + + ::SWGSDRangel::setValue(&power, pJson["power"], "float", ""); + +} + +QString +SWGFreqScannerChannelState::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGFreqScannerChannelState::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_frequency_isSet){ + obj->insert("frequency", QJsonValue(frequency)); + } + if(m_power_isSet){ + obj->insert("power", QJsonValue(power)); + } + + return obj; +} + +qint32 +SWGFreqScannerChannelState::getFrequency() { + return frequency; +} +void +SWGFreqScannerChannelState::setFrequency(qint32 frequency) { + this->frequency = frequency; + this->m_frequency_isSet = true; +} + +float +SWGFreqScannerChannelState::getPower() { + return power; +} +void +SWGFreqScannerChannelState::setPower(float power) { + this->power = power; + this->m_power_isSet = true; +} + + +bool +SWGFreqScannerChannelState::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_frequency_isSet){ + isObjectUpdated = true; break; + } + if(m_power_isSet){ + isObjectUpdated = true; break; + } + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.h b/swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.h new file mode 100644 index 0000000000..42cd11784d --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerChannelState.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: 7.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. + */ + +/* + * SWGFreqScannerChannelState.h + * + * + */ + +#ifndef SWGFreqScannerChannelState_H_ +#define SWGFreqScannerChannelState_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGFreqScannerChannelState: public SWGObject { +public: + SWGFreqScannerChannelState(); + SWGFreqScannerChannelState(QString* json); + virtual ~SWGFreqScannerChannelState(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGFreqScannerChannelState* fromJson(QString &jsonString) override; + + qint32 getFrequency(); + void setFrequency(qint32 frequency); + + float getPower(); + void setPower(float power); + + + virtual bool isSet() override; + +private: + qint32 frequency; + bool m_frequency_isSet; + + float power; + bool m_power_isSet; + +}; + +} + +#endif /* SWGFreqScannerChannelState_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp index 13c29211d6..41782ab847 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp @@ -30,6 +30,8 @@ SWGFreqScannerReport::SWGFreqScannerReport(QString* json) { SWGFreqScannerReport::SWGFreqScannerReport() { channel_sample_rate = 0; m_channel_sample_rate_isSet = false; + channel_state = nullptr; + m_channel_state_isSet = false; } SWGFreqScannerReport::~SWGFreqScannerReport() { @@ -40,11 +42,20 @@ void SWGFreqScannerReport::init() { channel_sample_rate = 0; m_channel_sample_rate_isSet = false; + channel_state = new QList(); + m_channel_state_isSet = false; } void SWGFreqScannerReport::cleanup() { + if(channel_state != nullptr) { + auto arr = channel_state; + for(auto o: *arr) { + delete o; + } + delete channel_state; + } } SWGFreqScannerReport* @@ -60,6 +71,8 @@ void SWGFreqScannerReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", ""); + + ::SWGSDRangel::setValue(&channel_state, pJson["channelState"], "QList", "SWGFreqScannerChannelState"); } QString @@ -79,6 +92,9 @@ SWGFreqScannerReport::asJsonObject() { if(m_channel_sample_rate_isSet){ obj->insert("channelSampleRate", QJsonValue(channel_sample_rate)); } + if(channel_state && channel_state->size() > 0){ + toJsonArray((QList*)channel_state, obj, "channelState", "SWGFreqScannerChannelState"); + } return obj; } @@ -93,6 +109,16 @@ SWGFreqScannerReport::setChannelSampleRate(qint32 channel_sample_rate) { this->m_channel_sample_rate_isSet = true; } +QList* +SWGFreqScannerReport::getChannelState() { + return channel_state; +} +void +SWGFreqScannerReport::setChannelState(QList* channel_state) { + this->channel_state = channel_state; + this->m_channel_state_isSet = true; +} + bool SWGFreqScannerReport::isSet(){ @@ -101,6 +127,9 @@ SWGFreqScannerReport::isSet(){ if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break; } + if(channel_state && (channel_state->size() > 0)){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h index 2c669ecfff..691c5838df 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h @@ -22,6 +22,8 @@ #include +#include "SWGFreqScannerChannelState.h" +#include #include "SWGObject.h" #include "export.h" @@ -44,6 +46,9 @@ class SWG_API SWGFreqScannerReport: public SWGObject { qint32 getChannelSampleRate(); void setChannelSampleRate(qint32 channel_sample_rate); + QList* getChannelState(); + void setChannelState(QList* channel_state); + virtual bool isSet() override; @@ -51,6 +56,9 @@ class SWG_API SWGFreqScannerReport: public SWGObject { qint32 channel_sample_rate; bool m_channel_sample_rate_isSet; + QList* channel_state; + bool m_channel_state_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index a4872594cc..8e6e880971 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -157,6 +157,8 @@ #include "SWGFreeDVDemodSettings.h" #include "SWGFreeDVModReport.h" #include "SWGFreeDVModSettings.h" +#include "SWGFreqScannerActions.h" +#include "SWGFreqScannerChannelState.h" #include "SWGFreqScannerFrequency.h" #include "SWGFreqScannerReport.h" #include "SWGFreqScannerSettings.h" @@ -1102,6 +1104,16 @@ namespace SWGSDRangel { obj->init(); return obj; } + if(QString("SWGFreqScannerActions").compare(type) == 0) { + SWGFreqScannerActions *obj = new SWGFreqScannerActions(); + obj->init(); + return obj; + } + if(QString("SWGFreqScannerChannelState").compare(type) == 0) { + SWGFreqScannerChannelState *obj = new SWGFreqScannerChannelState(); + obj->init(); + return obj; + } if(QString("SWGFreqScannerFrequency").compare(type) == 0) { SWGFreqScannerFrequency *obj = new SWGFreqScannerFrequency(); obj->init(); From c1d55b9af1882535708942a3e076f9f6df92b289 Mon Sep 17 00:00:00 2001 From: srcejon Date: Fri, 21 Jun 2024 10:04:17 +0100 Subject: [PATCH 2/4] Add scanState to FreqScanner Report --- sdrbase/resources/webapi/doc/html2/index.html | 6 ++++- .../doc/swagger/include/FreqScanner.yaml | 3 +++ .../api/swagger/include/FreqScanner.yaml | 3 +++ swagger/sdrangel/code/html2/index.html | 6 ++++- .../code/qt5/client/SWGFreqScannerReport.cpp | 23 +++++++++++++++++++ .../code/qt5/client/SWGFreqScannerReport.h | 6 +++++ 6 files changed, 45 insertions(+), 2 deletions(-) diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 044777b059..d406cb8176 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -7278,6 +7278,10 @@ "channelSampleRate" : { "type" : "integer" }, + "scanState" : { + "type" : "integer", + "description" : "(IDLE=0, START_SCAN=1, SCANNING=2, WAIT_FOR_END_TX=3, WAIT_FOR_RETRANSMISSION=4)" + }, "channelState" : { "type" : "array", "items" : { @@ -59115,7 +59119,7 @@

Status: 501 - Function not implemented

- Generated 2024-06-21T10:02:32.986+02:00 + Generated 2024-06-21T11:03:53.536+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml b/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml index 760eee0877..74a9ea49e8 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/FreqScanner.yaml @@ -59,6 +59,9 @@ FreqScannerReport: properties: channelSampleRate: type: integer + scanState: + description: (IDLE=0, START_SCAN=1, SCANNING=2, WAIT_FOR_END_TX=3, WAIT_FOR_RETRANSMISSION=4) + type: integer channelState: type: array items: diff --git a/swagger/sdrangel/api/swagger/include/FreqScanner.yaml b/swagger/sdrangel/api/swagger/include/FreqScanner.yaml index c3e4471607..bb8c76ebf5 100644 --- a/swagger/sdrangel/api/swagger/include/FreqScanner.yaml +++ b/swagger/sdrangel/api/swagger/include/FreqScanner.yaml @@ -59,6 +59,9 @@ FreqScannerReport: properties: channelSampleRate: type: integer + scanState: + description: (IDLE=0, START_SCAN=1, SCANNING=2, WAIT_FOR_END_TX=3, WAIT_FOR_RETRANSMISSION=4) + type: integer channelState: type: array items: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 044777b059..d406cb8176 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -7278,6 +7278,10 @@ "channelSampleRate" : { "type" : "integer" }, + "scanState" : { + "type" : "integer", + "description" : "(IDLE=0, START_SCAN=1, SCANNING=2, WAIT_FOR_END_TX=3, WAIT_FOR_RETRANSMISSION=4)" + }, "channelState" : { "type" : "array", "items" : { @@ -59115,7 +59119,7 @@

Status: 501 - Function not implemented

- Generated 2024-06-21T10:02:32.986+02:00 + Generated 2024-06-21T11:03:53.536+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp index 41782ab847..6d1ab6fbff 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.cpp @@ -30,6 +30,8 @@ SWGFreqScannerReport::SWGFreqScannerReport(QString* json) { SWGFreqScannerReport::SWGFreqScannerReport() { channel_sample_rate = 0; m_channel_sample_rate_isSet = false; + scan_state = 0; + m_scan_state_isSet = false; channel_state = nullptr; m_channel_state_isSet = false; } @@ -42,6 +44,8 @@ void SWGFreqScannerReport::init() { channel_sample_rate = 0; m_channel_sample_rate_isSet = false; + scan_state = 0; + m_scan_state_isSet = false; channel_state = new QList(); m_channel_state_isSet = false; } @@ -49,6 +53,7 @@ SWGFreqScannerReport::init() { void SWGFreqScannerReport::cleanup() { + if(channel_state != nullptr) { auto arr = channel_state; for(auto o: *arr) { @@ -71,6 +76,8 @@ void SWGFreqScannerReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&scan_state, pJson["scanState"], "qint32", ""); + ::SWGSDRangel::setValue(&channel_state, pJson["channelState"], "QList", "SWGFreqScannerChannelState"); } @@ -92,6 +99,9 @@ SWGFreqScannerReport::asJsonObject() { if(m_channel_sample_rate_isSet){ obj->insert("channelSampleRate", QJsonValue(channel_sample_rate)); } + if(m_scan_state_isSet){ + obj->insert("scanState", QJsonValue(scan_state)); + } if(channel_state && channel_state->size() > 0){ toJsonArray((QList*)channel_state, obj, "channelState", "SWGFreqScannerChannelState"); } @@ -109,6 +119,16 @@ SWGFreqScannerReport::setChannelSampleRate(qint32 channel_sample_rate) { this->m_channel_sample_rate_isSet = true; } +qint32 +SWGFreqScannerReport::getScanState() { + return scan_state; +} +void +SWGFreqScannerReport::setScanState(qint32 scan_state) { + this->scan_state = scan_state; + this->m_scan_state_isSet = true; +} + QList* SWGFreqScannerReport::getChannelState() { return channel_state; @@ -127,6 +147,9 @@ SWGFreqScannerReport::isSet(){ if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break; } + if(m_scan_state_isSet){ + isObjectUpdated = true; break; + } if(channel_state && (channel_state->size() > 0)){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h index 691c5838df..4a1eaebc4d 100644 --- a/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGFreqScannerReport.h @@ -46,6 +46,9 @@ class SWG_API SWGFreqScannerReport: public SWGObject { qint32 getChannelSampleRate(); void setChannelSampleRate(qint32 channel_sample_rate); + qint32 getScanState(); + void setScanState(qint32 scan_state); + QList* getChannelState(); void setChannelState(QList* channel_state); @@ -56,6 +59,9 @@ class SWG_API SWGFreqScannerReport: public SWGObject { qint32 channel_sample_rate; bool m_channel_sample_rate_isSet; + qint32 scan_state; + bool m_scan_state_isSet; + QList* channel_state; bool m_channel_state_isSet; From 28cc7c3f31d058c4614183a972097115a12c4694 Mon Sep 17 00:00:00 2001 From: srcejon Date: Fri, 21 Jun 2024 10:24:16 +0100 Subject: [PATCH 3/4] FreqScanner: Add API action to run scan. Add scan results to channel report. --- plugins/channelrx/freqscanner/freqscanner.cpp | 57 ++++++++++++++++++- plugins/channelrx/freqscanner/freqscanner.h | 6 ++ .../channelrx/freqscanner/freqscannergui.cpp | 14 ++++- .../channelrx/freqscanner/freqscannergui.h | 2 +- plugins/channelrx/freqscanner/readme.md | 12 ++++ sdrbase/webapi/webapirequestmapper.cpp | 6 ++ sdrbase/webapi/webapiutils.cpp | 1 + 7 files changed, 94 insertions(+), 4 deletions(-) diff --git a/plugins/channelrx/freqscanner/freqscanner.cpp b/plugins/channelrx/freqscanner/freqscanner.cpp index 54afdd639e..04432245c2 100644 --- a/plugins/channelrx/freqscanner/freqscanner.cpp +++ b/plugins/channelrx/freqscanner/freqscanner.cpp @@ -31,6 +31,7 @@ #include "SWGWorkspaceInfo.h" #include "SWGFreqScannerSettings.h" #include "SWGChannelReport.h" +#include "SWGChannelActions.h" #include "device/deviceset.h" #include "dsp/dspengine.h" @@ -550,7 +551,9 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList< setDeviceCenterFrequency(nextCenterFrequency); } - if (complete) { + if (complete) + { + m_scanResultsForReport = m_scanResults; m_scanResults.clear(); } } @@ -815,6 +818,47 @@ int FreqScanner::webapiReportGet( return 200; } +int FreqScanner::webapiActionsPost( + const QStringList& channelActionsKeys, + SWGSDRangel::SWGChannelActions& query, + QString& errorMessage) +{ + SWGSDRangel::SWGFreqScannerActions *swgFreqScannerActions = query.getFreqScannerActions(); + + if (swgFreqScannerActions) + { + if (channelActionsKeys.contains("run")) + { + bool run = swgFreqScannerActions->getRun() != 0; + if (run) + { + MsgStartScan *start = MsgStartScan::create(); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(start); + } else { + getInputMessageQueue()->push(start); + } + } + else + { + MsgStopScan *stop = MsgStopScan::create(); + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(stop); + } else { + getInputMessageQueue()->push(stop); + } + } + } + + return 202; + } + else + { + errorMessage = "Missing FreqScannerActions in query"; + return 400; + } +} + void FreqScanner::webapiUpdateChannelSettings( FreqScannerSettings& settings, const QStringList& channelSettingsKeys, @@ -984,6 +1028,17 @@ void FreqScanner::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& r void FreqScanner::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) { response.getFreqScannerReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate()); + response.getFreqScannerReport()->setScanState((int) m_state); + + QList *list = response.getFreqScannerReport()->getChannelState(); + + for (int i = 0; i < m_scanResultsForReport.size(); i++) + { + SWGSDRangel::SWGFreqScannerChannelState *channelState = new SWGSDRangel::SWGFreqScannerChannelState(); + channelState->setFrequency(m_scanResultsForReport[i].m_frequency); + channelState->setPower(m_scanResultsForReport[i].m_power); + list->append(channelState); + } } void FreqScanner::webapiReverseSendSettings(const QStringList& channelSettingsKeys, const FreqScannerSettings& settings, bool force) diff --git a/plugins/channelrx/freqscanner/freqscanner.h b/plugins/channelrx/freqscanner/freqscanner.h index 40f1fc84d7..a5ec4ff374 100644 --- a/plugins/channelrx/freqscanner/freqscanner.h +++ b/plugins/channelrx/freqscanner/freqscanner.h @@ -341,6 +341,11 @@ class FreqScanner : public BasebandSampleSink, public ChannelAPI { SWGSDRangel::SWGChannelReport& response, QString& errorMessage); + virtual int webapiActionsPost( + const QStringList& channelActionsKeys, + SWGSDRangel::SWGChannelActions& query, + QString& errorMessage); + static void webapiFormatChannelSettings( SWGSDRangel::SWGChannelSettings& response, const FreqScannerSettings& settings); @@ -388,6 +393,7 @@ class FreqScanner : public BasebandSampleSink, public ChannelAPI { qint64 m_stepStartFrequency; qint64 m_stepStopFrequency; QList m_scanResults; + QList m_scanResultsForReport; enum State { IDLE, diff --git a/plugins/channelrx/freqscanner/freqscannergui.cpp b/plugins/channelrx/freqscanner/freqscannergui.cpp index 9660542c2d..fa8287ec01 100644 --- a/plugins/channelrx/freqscanner/freqscannergui.cpp +++ b/plugins/channelrx/freqscanner/freqscannergui.cpp @@ -204,6 +204,16 @@ bool FreqScannerGUI::handleMessage(const Message& message) return true; } + else if (FreqScanner::MsgStartScan::match(message)) + { + ui->startStop->doToggle(true); + return true; + } + else if (FreqScanner::MsgStopScan::match(message)) + { + ui->startStop->doToggle(false); + return true; + } return false; } @@ -609,7 +619,7 @@ void FreqScannerGUI::enterEvent(EnterEventType* event) ChannelGUI::enterEvent(event); } -void FreqScannerGUI::on_startStop_clicked(bool checked) +void FreqScannerGUI::on_startStop_toggled(bool checked) { if (checked) { @@ -1080,7 +1090,7 @@ void FreqScannerGUI::makeUIConnections() QObject::connect(ui->priority, QOverload::of(&QComboBox::currentIndexChanged), this, &FreqScannerGUI::on_priority_currentIndexChanged); QObject::connect(ui->measurement, QOverload::of(&QComboBox::currentIndexChanged), this, &FreqScannerGUI::on_measurement_currentIndexChanged); QObject::connect(ui->mode, QOverload::of(&QComboBox::currentIndexChanged), this, &FreqScannerGUI::on_mode_currentIndexChanged); - QObject::connect(ui->startStop, &ButtonSwitch::clicked, this, &FreqScannerGUI::on_startStop_clicked); + QObject::connect(ui->startStop, &ButtonSwitch::toggled, this, &FreqScannerGUI::on_startStop_toggled); QObject::connect(ui->table, &QTableWidget::cellChanged, this, &FreqScannerGUI::on_table_cellChanged); QObject::connect(ui->addSingle, &QToolButton::clicked, this, &FreqScannerGUI::on_addSingle_clicked); QObject::connect(ui->addRange, &QToolButton::clicked, this, &FreqScannerGUI::on_addRange_clicked); diff --git a/plugins/channelrx/freqscanner/freqscannergui.h b/plugins/channelrx/freqscanner/freqscannergui.h index 4dc9dd4842..ebff8c522f 100644 --- a/plugins/channelrx/freqscanner/freqscannergui.h +++ b/plugins/channelrx/freqscanner/freqscannergui.h @@ -140,7 +140,7 @@ private slots: void table_sectionResized(int logicalIndex, int oldSize, int newSize); void columnSelectMenu(QPoint pos); void columnSelectMenuChecked(bool checked = false); - void on_startStop_clicked(bool checked = false); + void on_startStop_toggled(bool checked = false); void on_addSingle_clicked(); void on_addRange_clicked(); void on_remove_clicked(); diff --git a/plugins/channelrx/freqscanner/readme.md b/plugins/channelrx/freqscanner/readme.md index 0636c06837..7bd676b982 100644 --- a/plugins/channelrx/freqscanner/readme.md +++ b/plugins/channelrx/freqscanner/readme.md @@ -140,3 +140,15 @@ Moves the selected rows the the frequency table (14).

21: Clear Active Count

Press to reset the value in the Active Count column to 0 for all rows. + +

API

+ +Full details of the API can be found in the Swagger documentation. Below are a few examples. + +To run a frequency scan: + + curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/actions" -d '{ "channelType": "FreqScanner", "direction": 0, "originatorDeviceSetIndex": 0, "originatorChannelIndex": 0, "FreqScannerActions": { "run": 1 }}' + +To get the results of the last scan: + + curl -X GET "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/report" diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index b424b61d0c..4eced1e82d 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -4821,6 +4821,11 @@ bool WebAPIRequestMapper::getChannelActions( channelActions->setFileSourceActions(new SWGSDRangel::SWGFileSourceActions()); channelActions->getFileSourceActions()->fromJsonObject(actionsJsonObject); } + else if (channelActionsKey == "FreqScannerActions") + { + channelActions->setFreqScannerActions(new SWGSDRangel::SWGFreqScannerActions()); + channelActions->getFreqScannerActions()->fromJsonObject(actionsJsonObject); + } else if (channelActionsKey == "IEEE_802_15_4_ModActions") { channelActions->setIeee802154ModActions(new SWGSDRangel::SWGIEEE_802_15_4_ModActions()); @@ -5629,6 +5634,7 @@ void WebAPIRequestMapper::resetChannelActions(SWGSDRangel::SWGChannelActions& ch channelActions.setAptDemodActions(nullptr); channelActions.setChannelType(nullptr); channelActions.setFileSourceActions(nullptr); + channelActions.setFreqScannerActions(nullptr); channelActions.setIeee802154ModActions(nullptr); channelActions.setPacketModActions(nullptr); channelActions.setPsk31ModActions(nullptr); diff --git a/sdrbase/webapi/webapiutils.cpp b/sdrbase/webapi/webapiutils.cpp index a89989fbe3..7873fd125a 100644 --- a/sdrbase/webapi/webapiutils.cpp +++ b/sdrbase/webapi/webapiutils.cpp @@ -216,6 +216,7 @@ const QMap WebAPIUtils::m_channelTypeToActionsKey = { {"APTDemod", "APTDemodActions"}, {"FileSink", "FileSinkActions"}, {"FileSource", "FileSourceActions"}, + {"FreqScanner", "FreqScannerActions"}, {"SigMFFileSink", "SigMFFileSinkActions"}, {"IEEE_802_15_4_Mod", "IEEE_802_15_4_ModActions"}, {"RadioAstronomy", "RadioAstronomyActions"}, From 7336cda7bc01b8a818cdb493a5e77ce612a50f5b Mon Sep 17 00:00:00 2001 From: srcejon Date: Fri, 21 Jun 2024 10:24:36 +0100 Subject: [PATCH 4/4] FreqScanner: Add HF ATC channels preset. --- .../freqscanner/freqscanneraddrangedialog.cpp | 17 +++++++++++++++++ .../freqscanner/freqscanneraddrangedialog.ui | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/freqscanner/freqscanneraddrangedialog.cpp b/plugins/channelrx/freqscanner/freqscanneraddrangedialog.cpp index 254199885c..e28b21956c 100644 --- a/plugins/channelrx/freqscanner/freqscanneraddrangedialog.cpp +++ b/plugins/channelrx/freqscanner/freqscanneraddrangedialog.cpp @@ -91,6 +91,19 @@ void FreqScannerAddRangeDialog::accept() }; m_frequencies.append(FRS_GMRSFreqs); } + else if (ui->preset->currentText() == "HF ATC") + { + static const QList hfFreqs = { + 2872000, 2890000, 2899000, 2971000, + 3016000, 3446000, 3476000, 3491000, + 4675000, 5598000, 5616000, 5649000, + 6547000, 6595000, 6622000, 6667000, + 8831000, 8864000, 8879000, 8891000, + 8906000, 10021000, 11336000, 13291000, + 13306000, 17946000 + }; + m_frequencies.append(hfFreqs); + } else { qint64 start = ui->start->getValue(); @@ -151,6 +164,10 @@ void FreqScannerAddRangeDialog::on_preset_currentTextChanged(const QString& text { enableManAdjust = false; } + else if (text == "HF ATC") + { + enableManAdjust = false; + } ui->start->setEnabled(enableManAdjust); ui->stop->setEnabled(enableManAdjust); ui->step->setEnabled(enableManAdjust); diff --git a/plugins/channelrx/freqscanner/freqscanneraddrangedialog.ui b/plugins/channelrx/freqscanner/freqscanneraddrangedialog.ui index 0329c9e0db..44532692e7 100644 --- a/plugins/channelrx/freqscanner/freqscanneraddrangedialog.ui +++ b/plugins/channelrx/freqscanner/freqscanneraddrangedialog.ui @@ -198,6 +198,11 @@ FRS-GMRS + + + HF ATC + + @@ -232,7 +237,6 @@ -