From f9cba5844b5e520b21ef807bf767bb08bdbc41e1 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 26 May 2018 14:28:06 +0200 Subject: [PATCH] RTL-SDR input: implemeted WEB API for reporting --- plugins/samplesource/rtlsdr/rtlsdrinput.cpp | 25 ++++ plugins/samplesource/rtlsdr/rtlsdrinput.h | 5 + sdrbase/resources/webapi/doc/html2/index.html | 24 +++- .../webapi/doc/swagger/include/RtlSdr.yaml | 12 +- .../resources/webapi/doc/swagger/swagger.yaml | 2 + .../sdrangel/api/swagger/include/RtlSdr.yaml | 12 +- swagger/sdrangel/api/swagger/swagger.yaml | 2 + swagger/sdrangel/code/html2/index.html | 24 +++- .../code/qt5/client/SWGDeviceReport.cpp | 23 ++++ .../code/qt5/client/SWGDeviceReport.h | 7 ++ .../code/qt5/client/SWGModelFactory.h | 8 ++ .../code/qt5/client/SWGRtlSdrReport.cpp | 112 ++++++++++++++++++ .../code/qt5/client/SWGRtlSdrReport.h | 60 ++++++++++ .../code/qt5/client/SWGRtlSdrReport_gains.cpp | 106 +++++++++++++++++ .../code/qt5/client/SWGRtlSdrReport_gains.h | 58 +++++++++ 15 files changed, 476 insertions(+), 4 deletions(-) create mode 100644 swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.h create mode 100644 swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.h diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp index d0d722a16..2b1125fe9 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp @@ -22,6 +22,8 @@ #include "SWGDeviceSettings.h" #include "SWGRtlSdrSettings.h" #include "SWGDeviceState.h" +#include "SWGDeviceReport.h" +#include "SWGRtlSdrReport.h" #include "rtlsdrinput.h" #include "device/devicesourceapi.h" @@ -653,3 +655,26 @@ int RTLSDRInput::webapiRun( return 200; } + +int RTLSDRInput::webapiReportGet( + SWGSDRangel::SWGDeviceReport& response, + QString& errorMessage __attribute__((unused))) +{ + response.setRtlSdrReport(new SWGSDRangel::SWGRtlSdrReport()); + response.getRtlSdrReport()->init(); + webapiFormatDeviceReport(response); + return 200; +} + +void RTLSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response) +{ + response.getRtlSdrReport()->setGains(new QList); + + for (std::vector::const_iterator it = getGains().begin(); it != getGains().end(); ++it) + { + response.getRtlSdrReport()->getGains()->append(new SWGSDRangel::SWGRtlSdrReport_gains); + response.getRtlSdrReport()->getGains()->back()->setGain(*it); + } +} + + diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.h b/plugins/samplesource/rtlsdr/rtlsdrinput.h index 2ec558f5f..c67b6815d 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.h +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.h @@ -121,6 +121,10 @@ public: SWGSDRangel::SWGDeviceSettings& response, // query + response QString& errorMessage); + virtual int webapiReportGet( + SWGSDRangel::SWGDeviceReport& response, + QString& errorMessage); + virtual int webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage); @@ -157,6 +161,7 @@ private: void closeDevice(); bool applySettings(const RTLSDRSettings& settings, bool force); void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RTLSDRSettings& settings); + void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response); }; #endif // INCLUDE_RTLSDRINPUT_H diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 597e8388b..58108848b 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1717,6 +1717,9 @@ margin-bottom: 20px; }, "perseusReport" : { "$ref" : "#/definitions/PerseusReport" + }, + "rtlSdrReport" : { + "$ref" : "#/definitions/RtlSdrReport" } }, "description" : "Base device report. The specific device report present depeds on deviceHwType" @@ -2714,6 +2717,25 @@ margin-bottom: 20px; "format" : "float" } } +}; + defs.RtlSdrReport = { + "properties" : { + "gains" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/RtlSdrReport_gains" + } + } + }, + "description" : "RTLSDR" +}; + defs.RtlSdrReport_gains = { + "properties" : { + "gain" : { + "type" : "integer", + "description" : "gain in centi Bels" + } + } }; defs.RtlSdrSettings = { "properties" : { @@ -21922,7 +21944,7 @@ except ApiException as e:
- Generated 2018-05-26T12:32:33.813+02:00 + Generated 2018-05-26T14:09:06.509+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/RtlSdr.yaml b/sdrbase/resources/webapi/doc/swagger/include/RtlSdr.yaml index 4d8cc5245..bc27d1981 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/RtlSdr.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/RtlSdr.yaml @@ -33,4 +33,14 @@ RtlSdrSettings: type: integer fileRecordName: type: string - \ No newline at end of file + +RtlSdrReport: + description: RTLSDR + properties: + gains: + type: array + items: + properties: + gain: + description: gain in centi Bels + type: integer diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 73e762e5c..d2df88a99 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1793,6 +1793,8 @@ definitions: $ref: "/doc/swagger/include/FileSource.yaml#/FileSourceReport" perseusReport: $ref: "/doc/swagger/include/Perseus.yaml#/PerseusReport" + rtlSdrReport: + $ref: "/doc/swagger/include/RtlSdr.yaml#/RtlSdrReport" ChannelSettings: description: Base channel settings. The specific channel settings present depends on channelType. diff --git a/swagger/sdrangel/api/swagger/include/RtlSdr.yaml b/swagger/sdrangel/api/swagger/include/RtlSdr.yaml index 4d8cc5245..bc27d1981 100644 --- a/swagger/sdrangel/api/swagger/include/RtlSdr.yaml +++ b/swagger/sdrangel/api/swagger/include/RtlSdr.yaml @@ -33,4 +33,14 @@ RtlSdrSettings: type: integer fileRecordName: type: string - \ No newline at end of file + +RtlSdrReport: + description: RTLSDR + properties: + gains: + type: array + items: + properties: + gain: + description: gain in centi Bels + type: integer diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 721a0b2fe..0c67bad7c 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1793,6 +1793,8 @@ definitions: $ref: "http://localhost:8081/api/swagger/include/FileSource.yaml#/FileSourceReport" perseusReport: $ref: "http://localhost:8081/api/swagger/include/Perseus.yaml#/PerseusReport" + rtlSdrReport: + $ref: "http://localhost:8081/api/swagger/include/RtlSdr.yaml#/RtlSdrReport" ChannelSettings: description: Base channel settings. The specific channel settings present depends on channelType. diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 597e8388b..58108848b 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1717,6 +1717,9 @@ margin-bottom: 20px; }, "perseusReport" : { "$ref" : "#/definitions/PerseusReport" + }, + "rtlSdrReport" : { + "$ref" : "#/definitions/RtlSdrReport" } }, "description" : "Base device report. The specific device report present depeds on deviceHwType" @@ -2714,6 +2717,25 @@ margin-bottom: 20px; "format" : "float" } } +}; + defs.RtlSdrReport = { + "properties" : { + "gains" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/RtlSdrReport_gains" + } + } + }, + "description" : "RTLSDR" +}; + defs.RtlSdrReport_gains = { + "properties" : { + "gain" : { + "type" : "integer", + "description" : "gain in centi Bels" + } + } }; defs.RtlSdrSettings = { "properties" : { @@ -21922,7 +21944,7 @@ except ApiException as e:
- Generated 2018-05-26T12:32:33.813+02:00 + Generated 2018-05-26T14:09:06.509+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp index 7160ee595..07d6195e4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp @@ -40,6 +40,8 @@ SWGDeviceReport::SWGDeviceReport() { m_file_source_report_isSet = false; perseus_report = nullptr; m_perseus_report_isSet = false; + rtl_sdr_report = nullptr; + m_rtl_sdr_report_isSet = false; } SWGDeviceReport::~SWGDeviceReport() { @@ -60,6 +62,8 @@ SWGDeviceReport::init() { m_file_source_report_isSet = false; perseus_report = new SWGPerseusReport(); m_perseus_report_isSet = false; + rtl_sdr_report = new SWGRtlSdrReport(); + m_rtl_sdr_report_isSet = false; } void @@ -80,6 +84,9 @@ SWGDeviceReport::cleanup() { if(perseus_report != nullptr) { delete perseus_report; } + if(rtl_sdr_report != nullptr) { + delete rtl_sdr_report; + } } SWGDeviceReport* @@ -105,6 +112,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&perseus_report, pJson["perseusReport"], "SWGPerseusReport", "SWGPerseusReport"); + ::SWGSDRangel::setValue(&rtl_sdr_report, pJson["rtlSdrReport"], "SWGRtlSdrReport", "SWGRtlSdrReport"); + } QString @@ -139,6 +148,9 @@ SWGDeviceReport::asJsonObject() { if((perseus_report != nullptr) && (perseus_report->isSet())){ toJsonValue(QString("perseusReport"), perseus_report, obj, QString("SWGPerseusReport")); } + if((rtl_sdr_report != nullptr) && (rtl_sdr_report->isSet())){ + toJsonValue(QString("rtlSdrReport"), rtl_sdr_report, obj, QString("SWGRtlSdrReport")); + } return obj; } @@ -203,6 +215,16 @@ SWGDeviceReport::setPerseusReport(SWGPerseusReport* perseus_report) { this->m_perseus_report_isSet = true; } +SWGRtlSdrReport* +SWGDeviceReport::getRtlSdrReport() { + return rtl_sdr_report; +} +void +SWGDeviceReport::setRtlSdrReport(SWGRtlSdrReport* rtl_sdr_report) { + this->rtl_sdr_report = rtl_sdr_report; + this->m_rtl_sdr_report_isSet = true; +} + bool SWGDeviceReport::isSet(){ @@ -214,6 +236,7 @@ SWGDeviceReport::isSet(){ if(airspy_hf_report != nullptr && airspy_hf_report->isSet()){ isObjectUpdated = true; break;} if(file_source_report != nullptr && file_source_report->isSet()){ isObjectUpdated = true; break;} if(perseus_report != nullptr && perseus_report->isSet()){ isObjectUpdated = true; break;} + if(rtl_sdr_report != nullptr && rtl_sdr_report->isSet()){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h index ba3a9f73d..d54c7d20c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h @@ -26,6 +26,7 @@ #include "SWGAirspyReport.h" #include "SWGFileSourceReport.h" #include "SWGPerseusReport.h" +#include "SWGRtlSdrReport.h" #include #include "SWGObject.h" @@ -64,6 +65,9 @@ public: SWGPerseusReport* getPerseusReport(); void setPerseusReport(SWGPerseusReport* perseus_report); + SWGRtlSdrReport* getRtlSdrReport(); + void setRtlSdrReport(SWGRtlSdrReport* rtl_sdr_report); + virtual bool isSet() override; @@ -86,6 +90,9 @@ private: SWGPerseusReport* perseus_report; bool m_perseus_report_isSet; + SWGRtlSdrReport* rtl_sdr_report; + bool m_rtl_sdr_report_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 9e70778cb..68b4ccfda 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -77,6 +77,8 @@ #include "SWGPresets.h" #include "SWGRDSReport.h" #include "SWGRDSReport_altFrequencies.h" +#include "SWGRtlSdrReport.h" +#include "SWGRtlSdrReport_gains.h" #include "SWGRtlSdrSettings.h" #include "SWGSSBModReport.h" #include "SWGSSBModSettings.h" @@ -283,6 +285,12 @@ namespace SWGSDRangel { if(QString("SWGRDSReport_altFrequencies").compare(type) == 0) { return new SWGRDSReport_altFrequencies(); } + if(QString("SWGRtlSdrReport").compare(type) == 0) { + return new SWGRtlSdrReport(); + } + if(QString("SWGRtlSdrReport_gains").compare(type) == 0) { + return new SWGRtlSdrReport_gains(); + } if(QString("SWGRtlSdrSettings").compare(type) == 0) { return new SWGRtlSdrSettings(); } diff --git a/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.cpp b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.cpp new file mode 100644 index 000000000..824ff9dae --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.cpp @@ -0,0 +1,112 @@ +/** + * 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 "SWGRtlSdrReport.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGRtlSdrReport::SWGRtlSdrReport(QString* json) { + init(); + this->fromJson(*json); +} + +SWGRtlSdrReport::SWGRtlSdrReport() { + gains = nullptr; + m_gains_isSet = false; +} + +SWGRtlSdrReport::~SWGRtlSdrReport() { + this->cleanup(); +} + +void +SWGRtlSdrReport::init() { + gains = new QList(); + m_gains_isSet = false; +} + +void +SWGRtlSdrReport::cleanup() { + if(gains != nullptr) { + auto arr = gains; + for(auto o: *arr) { + delete o; + } + delete gains; + } +} + +SWGRtlSdrReport* +SWGRtlSdrReport::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGRtlSdrReport::fromJsonObject(QJsonObject &pJson) { + + ::SWGSDRangel::setValue(&gains, pJson["gains"], "QList", "SWGRtlSdrReport_gains"); +} + +QString +SWGRtlSdrReport::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGRtlSdrReport::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(gains->size() > 0){ + toJsonArray((QList*)gains, obj, "gains", "SWGRtlSdrReport_gains"); + } + + return obj; +} + +QList* +SWGRtlSdrReport::getGains() { + return gains; +} +void +SWGRtlSdrReport::setGains(QList* gains) { + this->gains = gains; + this->m_gains_isSet = true; +} + + +bool +SWGRtlSdrReport::isSet(){ + bool isObjectUpdated = false; + do{ + if(gains->size() > 0){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.h b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.h new file mode 100644 index 000000000..f6fa9a371 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport.h @@ -0,0 +1,60 @@ +/** + * 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. + */ + +/* + * SWGRtlSdrReport.h + * + * RTLSDR + */ + +#ifndef SWGRtlSdrReport_H_ +#define SWGRtlSdrReport_H_ + +#include + + +#include "SWGRtlSdrReport_gains.h" +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGRtlSdrReport: public SWGObject { +public: + SWGRtlSdrReport(); + SWGRtlSdrReport(QString* json); + virtual ~SWGRtlSdrReport(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGRtlSdrReport* fromJson(QString &jsonString) override; + + QList* getGains(); + void setGains(QList* gains); + + + virtual bool isSet() override; + +private: + QList* gains; + bool m_gains_isSet; + +}; + +} + +#endif /* SWGRtlSdrReport_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.cpp b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.cpp new file mode 100644 index 000000000..001232465 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.cpp @@ -0,0 +1,106 @@ +/** + * 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 "SWGRtlSdrReport_gains.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGRtlSdrReport_gains::SWGRtlSdrReport_gains(QString* json) { + init(); + this->fromJson(*json); +} + +SWGRtlSdrReport_gains::SWGRtlSdrReport_gains() { + gain = 0; + m_gain_isSet = false; +} + +SWGRtlSdrReport_gains::~SWGRtlSdrReport_gains() { + this->cleanup(); +} + +void +SWGRtlSdrReport_gains::init() { + gain = 0; + m_gain_isSet = false; +} + +void +SWGRtlSdrReport_gains::cleanup() { + +} + +SWGRtlSdrReport_gains* +SWGRtlSdrReport_gains::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGRtlSdrReport_gains::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", ""); + +} + +QString +SWGRtlSdrReport_gains::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGRtlSdrReport_gains::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_gain_isSet){ + obj->insert("gain", QJsonValue(gain)); + } + + return obj; +} + +qint32 +SWGRtlSdrReport_gains::getGain() { + return gain; +} +void +SWGRtlSdrReport_gains::setGain(qint32 gain) { + this->gain = gain; + this->m_gain_isSet = true; +} + + +bool +SWGRtlSdrReport_gains::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_gain_isSet){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.h b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.h new file mode 100644 index 000000000..b876573ca --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGRtlSdrReport_gains.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. * 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. + */ + +/* + * SWGRtlSdrReport_gains.h + * + * + */ + +#ifndef SWGRtlSdrReport_gains_H_ +#define SWGRtlSdrReport_gains_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGRtlSdrReport_gains: public SWGObject { +public: + SWGRtlSdrReport_gains(); + SWGRtlSdrReport_gains(QString* json); + virtual ~SWGRtlSdrReport_gains(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGRtlSdrReport_gains* fromJson(QString &jsonString) override; + + qint32 getGain(); + void setGain(qint32 gain); + + + virtual bool isSet() override; + +private: + qint32 gain; + bool m_gain_isSet; + +}; + +} + +#endif /* SWGRtlSdrReport_gains_H_ */