From 5e4fdba67ae6ea001aeaa27ae67e01d9d974eaf1 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 15 Sep 2020 21:02:26 +0200 Subject: [PATCH] BladeRF2 MIMO: REST API: added report with range information --- .../samplemimo/bladerf2mimo/bladerf2mimo.cpp | 84 +++++ .../samplemimo/bladerf2mimo/bladerf2mimo.h | 5 + sdrbase/resources/webapi.qrc | 1 + sdrbase/resources/webapi/doc/html2/index.html | 40 ++- .../webapi/doc/swagger/include/BladeRF2.yaml | 24 ++ .../doc/swagger/include/DeviceReports.yaml | 2 + sdrbase/webapi/webapirequestmapper.cpp | 3 + .../api/swagger/include/BladeRF2.yaml | 24 ++ .../api/swagger/include/DeviceReports.yaml | 2 + swagger/sdrangel/code/html2/index.html | 40 ++- .../code/qt5/client/SWGBladeRF2MIMOReport.cpp | 314 ++++++++++++++++++ .../code/qt5/client/SWGBladeRF2MIMOReport.h | 110 ++++++ .../code/qt5/client/SWGDeviceReport.cpp | 25 ++ .../code/qt5/client/SWGDeviceReport.h | 7 + .../code/qt5/client/SWGModelFactory.h | 4 + 15 files changed, 683 insertions(+), 2 deletions(-) create mode 100644 swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.h diff --git a/plugins/samplemimo/bladerf2mimo/bladerf2mimo.cpp b/plugins/samplemimo/bladerf2mimo/bladerf2mimo.cpp index cf2022b86..c6fb40cb5 100644 --- a/plugins/samplemimo/bladerf2mimo/bladerf2mimo.cpp +++ b/plugins/samplemimo/bladerf2mimo/bladerf2mimo.cpp @@ -26,6 +26,7 @@ #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" #include "SWGTestMISettings.h" +#include "SWGDeviceReport.h" #include "device/deviceapi.h" #include "dsp/dspcommands.h" @@ -1301,6 +1302,89 @@ void BladeRF2MIMO::webapiReverseSendStartStop(bool start) delete swgDeviceSettings; } +int BladeRF2MIMO::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QString& errorMessage) +{ + (void) errorMessage; + response.setBladeRf2MimoReport(new SWGSDRangel::SWGBladeRF2MIMOReport()); + response.getBladeRf2MimoReport()->init(); + webapiFormatDeviceReport(response); + return 200; +} + +void BladeRF2MIMO::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response) +{ + if (m_dev) + { + int min, max, step; + float scale; + uint64_t f_min, f_max; + + m_dev->getBandwidthRangeRx(min, max, step, scale); + + response.getBladeRf2MimoReport()->setBandwidthRangeRx(new SWGSDRangel::SWGRange); + response.getBladeRf2MimoReport()->getBandwidthRangeRx()->setMin(min); + response.getBladeRf2MimoReport()->getBandwidthRangeRx()->setMax(max); + response.getBladeRf2MimoReport()->getBandwidthRangeRx()->setStep(step); + response.getBladeRf2MimoReport()->getBandwidthRangeRx()->setScale(scale); + + m_dev->getFrequencyRangeRx(f_min, f_max, step, scale); + + response.getBladeRf2MimoReport()->setFrequencyRangeRx(new SWGSDRangel::SWGFrequencyRange); + response.getBladeRf2MimoReport()->getFrequencyRangeRx()->setMin(f_min); + response.getBladeRf2MimoReport()->getFrequencyRangeRx()->setMax(f_max); + response.getBladeRf2MimoReport()->getFrequencyRangeRx()->setStep(step); + response.getBladeRf2MimoReport()->getFrequencyRangeRx()->setScale(scale); + + m_dev->getGlobalGainRangeRx(min, max, step, scale); + + response.getBladeRf2MimoReport()->setGlobalGainRangeRx(new SWGSDRangel::SWGRange); + response.getBladeRf2MimoReport()->getGlobalGainRangeRx()->setMin(min); + response.getBladeRf2MimoReport()->getGlobalGainRangeRx()->setMax(max); + response.getBladeRf2MimoReport()->getGlobalGainRangeRx()->setStep(step); + response.getBladeRf2MimoReport()->getGlobalGainRangeRx()->setScale(scale); + + m_dev->getSampleRateRangeRx(min, max, step, scale); + + response.getBladeRf2MimoReport()->setSampleRateRangeRx(new SWGSDRangel::SWGRange); + response.getBladeRf2MimoReport()->getSampleRateRangeRx()->setMin(min); + response.getBladeRf2MimoReport()->getSampleRateRangeRx()->setMax(max); + response.getBladeRf2MimoReport()->getSampleRateRangeRx()->setStep(step); + response.getBladeRf2MimoReport()->getSampleRateRangeRx()->setScale(scale); + + m_dev->getBandwidthRangeTx(min, max, step, scale); + + response.getBladeRf2MimoReport()->setBandwidthRangeTx(new SWGSDRangel::SWGRange); + response.getBladeRf2MimoReport()->getBandwidthRangeTx()->setMin(min); + response.getBladeRf2MimoReport()->getBandwidthRangeTx()->setMax(max); + response.getBladeRf2MimoReport()->getBandwidthRangeTx()->setStep(step); + response.getBladeRf2MimoReport()->getBandwidthRangeTx()->setScale(scale); + + m_dev->getFrequencyRangeTx(f_min, f_max, step, scale); + + response.getBladeRf2MimoReport()->setFrequencyRangeTx(new SWGSDRangel::SWGFrequencyRange); + response.getBladeRf2MimoReport()->getFrequencyRangeTx()->setMin(f_min); + response.getBladeRf2MimoReport()->getFrequencyRangeTx()->setMax(f_max); + response.getBladeRf2MimoReport()->getFrequencyRangeTx()->setStep(step); + response.getBladeRf2MimoReport()->getFrequencyRangeTx()->setScale(scale); + + m_dev->getGlobalGainRangeTx(min, max, step, scale); + + response.getBladeRf2MimoReport()->setGlobalGainRangeTx(new SWGSDRangel::SWGRange); + response.getBladeRf2MimoReport()->getGlobalGainRangeTx()->setMin(min); + response.getBladeRf2MimoReport()->getGlobalGainRangeTx()->setMax(max); + response.getBladeRf2MimoReport()->getGlobalGainRangeTx()->setStep(step); + response.getBladeRf2MimoReport()->getGlobalGainRangeTx()->setScale(scale); + + m_dev->getSampleRateRangeTx(min, max, step, scale); + + response.getBladeRf2MimoReport()->setSampleRateRangeTx(new SWGSDRangel::SWGRange); + response.getBladeRf2MimoReport()->getSampleRateRangeTx()->setMin(min); + response.getBladeRf2MimoReport()->getSampleRateRangeTx()->setMax(max); + response.getBladeRf2MimoReport()->getSampleRateRangeTx()->setStep(step); + response.getBladeRf2MimoReport()->getSampleRateRangeTx()->setScale(scale); + } +} + void BladeRF2MIMO::networkManagerFinished(QNetworkReply *reply) { QNetworkReply::NetworkError replyError = reply->error(); diff --git a/plugins/samplemimo/bladerf2mimo/bladerf2mimo.h b/plugins/samplemimo/bladerf2mimo/bladerf2mimo.h index f0894dfb2..9cbf613cf 100644 --- a/plugins/samplemimo/bladerf2mimo/bladerf2mimo.h +++ b/plugins/samplemimo/bladerf2mimo/bladerf2mimo.h @@ -133,6 +133,10 @@ public: SWGSDRangel::SWGDeviceSettings& response, // query + response QString& errorMessage); + virtual int webapiReportGet( + SWGSDRangel::SWGDeviceReport& response, + QString& errorMessage); + virtual int webapiRunGet( int subsystemIndex, SWGSDRangel::SWGDeviceState& response, @@ -193,6 +197,7 @@ private: bool setTxDeviceCenterFrequency(struct bladerf *dev, quint64 freq_hz, int loPpmTenths); void webapiReverseSendSettings(QList& deviceSettingsKeys, const BladeRF2MIMOSettings& settings, bool force); void webapiReverseSendStartStop(bool start); + void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response); private slots: void networkManagerFinished(QNetworkReply *reply); diff --git a/sdrbase/resources/webapi.qrc b/sdrbase/resources/webapi.qrc index 210438142..2af764b7d 100644 --- a/sdrbase/resources/webapi.qrc +++ b/sdrbase/resources/webapi.qrc @@ -24,6 +24,7 @@ webapi/doc/swagger/include/DSDDemod.yaml webapi/doc/swagger/include/DeviceActions.yaml webapi/doc/swagger/include/DeviceSettings.yaml + webapi/doc/swagger/include/DeviceReports.yaml webapi/doc/swagger/include/FCDPro.yaml webapi/doc/swagger/include/FCDProPlus.yaml webapi/doc/swagger/include/FileSink.yaml diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 2437b437c..5dc2a8822 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1797,6 +1797,41 @@ margin-bottom: 20px; } }, "description" : "BladeRF2" +}; + defs.BladeRF2MIMOReport = { + "properties" : { + "frequencyRangeRx" : { + "$ref" : "#/definitions/FrequencyRange" + }, + "sampleRateRangeRx" : { + "$ref" : "#/definitions/Range" + }, + "bandwidthRangeRx" : { + "$ref" : "#/definitions/Range" + }, + "globalGainRangeRx" : { + "$ref" : "#/definitions/Range" + }, + "gainModesRx" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/NamedEnum" + } + }, + "frequencyRangeTx" : { + "$ref" : "#/definitions/FrequencyRange" + }, + "sampleRateRangeTx" : { + "$ref" : "#/definitions/Range" + }, + "bandwidthRangeTx" : { + "$ref" : "#/definitions/Range" + }, + "globalGainRangeTx" : { + "$ref" : "#/definitions/Range" + } + }, + "description" : "BladeRF2" }; defs.BladeRF2MIMOSettings = { "properties" : { @@ -3199,6 +3234,9 @@ margin-bottom: 20px; "bladeRF2OutputReport" : { "$ref" : "#/definitions/BladeRF2OutputReport" }, + "bladeRF2MIMOReport" : { + "$ref" : "#/definitions/BladeRF2MIMOReport" + }, "fileInputReport" : { "$ref" : "#/definitions/FileInputReport" }, @@ -37630,7 +37668,7 @@ except ApiException as e:
- Generated 2020-09-15T08:45:12.589+02:00 + Generated 2020-09-15T13:30:17.634+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml b/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml index aa1cc7745..100a335c1 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml @@ -184,3 +184,27 @@ BladeRF2MIMOSettings: type: integer reverseAPIDeviceIndex: type: integer + +BladeRF2MIMOReport: + description: BladeRF2 + properties: + frequencyRangeRx: + $ref: "/doc/swagger/include/Structs.yaml#/FrequencyRange" + sampleRateRangeRx: + $ref: "/doc/swagger/include/Structs.yaml#/Range" + bandwidthRangeRx: + $ref: "/doc/swagger/include/Structs.yaml#/Range" + globalGainRangeRx: + $ref: "/doc/swagger/include/Structs.yaml#/Range" + gainModesRx: + type: array + items: + $ref: "/doc/swagger/include/Structs.yaml#/NamedEnum" + frequencyRangeTx: + $ref: "/doc/swagger/include/Structs.yaml#/FrequencyRange" + sampleRateRangeTx: + $ref: "/doc/swagger/include/Structs.yaml#/Range" + bandwidthRangeTx: + $ref: "/doc/swagger/include/Structs.yaml#/Range" + globalGainRangeTx: + $ref: "/doc/swagger/include/Structs.yaml#/Range" diff --git a/sdrbase/resources/webapi/doc/swagger/include/DeviceReports.yaml b/sdrbase/resources/webapi/doc/swagger/include/DeviceReports.yaml index 1a1cdc969..203b22794 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/DeviceReports.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/DeviceReports.yaml @@ -19,6 +19,8 @@ DeviceReport: $ref: "/doc/swagger/include/BladeRF2.yaml#/BladeRF2InputReport" bladeRF2OutputReport: $ref: "/doc/swagger/include/BladeRF2.yaml#/BladeRF2OutputReport" + bladeRF2MIMOReport: + $ref: "/doc/swagger/include/BladeRF2.yaml#/BladeRF2MIMOReport" fileInputReport: $ref: "/doc/swagger/include/FileInput.yaml#/FileInputReport" limeSdrInputReport: diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index a5ddb5b68..05414d7ed 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -3959,6 +3959,9 @@ void WebAPIRequestMapper::resetDeviceReport(SWGSDRangel::SWGDeviceReport& device deviceReport.setRemoteOutputReport(nullptr); deviceReport.setRemoteInputReport(nullptr); deviceReport.setSdrPlayReport(nullptr); + deviceReport.setBladeRf2InputReport(nullptr); + deviceReport.setBladeRf2OutputReport(nullptr); + deviceReport.setBladeRf2MimoReport(nullptr); } void WebAPIRequestMapper::resetDeviceActions(SWGSDRangel::SWGDeviceActions& deviceActions) diff --git a/swagger/sdrangel/api/swagger/include/BladeRF2.yaml b/swagger/sdrangel/api/swagger/include/BladeRF2.yaml index c238db632..460747364 100644 --- a/swagger/sdrangel/api/swagger/include/BladeRF2.yaml +++ b/swagger/sdrangel/api/swagger/include/BladeRF2.yaml @@ -184,3 +184,27 @@ BladeRF2MIMOSettings: type: integer reverseAPIDeviceIndex: type: integer + +BladeRF2MIMOReport: + description: BladeRF2 + properties: + frequencyRangeRx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/FrequencyRange" + sampleRateRangeRx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Range" + bandwidthRangeRx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Range" + globalGainRangeRx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Range" + gainModesRx: + type: array + items: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/NamedEnum" + frequencyRangeTx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/FrequencyRange" + sampleRateRangeTx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Range" + bandwidthRangeTx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Range" + globalGainRangeTx: + $ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Range" diff --git a/swagger/sdrangel/api/swagger/include/DeviceReports.yaml b/swagger/sdrangel/api/swagger/include/DeviceReports.yaml index b83e45b50..0782adf16 100644 --- a/swagger/sdrangel/api/swagger/include/DeviceReports.yaml +++ b/swagger/sdrangel/api/swagger/include/DeviceReports.yaml @@ -19,6 +19,8 @@ DeviceReport: $ref: "http://swgserver:8081/api/swagger/include/BladeRF2.yaml#/BladeRF2InputReport" bladeRF2OutputReport: $ref: "http://swgserver:8081/api/swagger/include/BladeRF2.yaml#/BladeRF2OutputReport" + bladeRF2MIMOReport: + $ref: "http://swgserver:8081/api/swagger/include/BladeRF2.yaml#/BladeRF2MIMOReport" fileInputReport: $ref: "http://swgserver:8081/api/swagger/include/FileInput.yaml#/FileInputReport" limeSdrInputReport: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 2437b437c..5dc2a8822 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1797,6 +1797,41 @@ margin-bottom: 20px; } }, "description" : "BladeRF2" +}; + defs.BladeRF2MIMOReport = { + "properties" : { + "frequencyRangeRx" : { + "$ref" : "#/definitions/FrequencyRange" + }, + "sampleRateRangeRx" : { + "$ref" : "#/definitions/Range" + }, + "bandwidthRangeRx" : { + "$ref" : "#/definitions/Range" + }, + "globalGainRangeRx" : { + "$ref" : "#/definitions/Range" + }, + "gainModesRx" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/NamedEnum" + } + }, + "frequencyRangeTx" : { + "$ref" : "#/definitions/FrequencyRange" + }, + "sampleRateRangeTx" : { + "$ref" : "#/definitions/Range" + }, + "bandwidthRangeTx" : { + "$ref" : "#/definitions/Range" + }, + "globalGainRangeTx" : { + "$ref" : "#/definitions/Range" + } + }, + "description" : "BladeRF2" }; defs.BladeRF2MIMOSettings = { "properties" : { @@ -3199,6 +3234,9 @@ margin-bottom: 20px; "bladeRF2OutputReport" : { "$ref" : "#/definitions/BladeRF2OutputReport" }, + "bladeRF2MIMOReport" : { + "$ref" : "#/definitions/BladeRF2MIMOReport" + }, "fileInputReport" : { "$ref" : "#/definitions/FileInputReport" }, @@ -37630,7 +37668,7 @@ except ApiException as e:
- Generated 2020-09-15T08:45:12.589+02:00 + Generated 2020-09-15T13:30:17.634+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.cpp b/swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.cpp new file mode 100644 index 000000000..f09e1448d --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.cpp @@ -0,0 +1,314 @@ +/** + * 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: 5.9.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 "SWGBladeRF2MIMOReport.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGBladeRF2MIMOReport::SWGBladeRF2MIMOReport(QString* json) { + init(); + this->fromJson(*json); +} + +SWGBladeRF2MIMOReport::SWGBladeRF2MIMOReport() { + frequency_range_rx = nullptr; + m_frequency_range_rx_isSet = false; + sample_rate_range_rx = nullptr; + m_sample_rate_range_rx_isSet = false; + bandwidth_range_rx = nullptr; + m_bandwidth_range_rx_isSet = false; + global_gain_range_rx = nullptr; + m_global_gain_range_rx_isSet = false; + gain_modes_rx = nullptr; + m_gain_modes_rx_isSet = false; + frequency_range_tx = nullptr; + m_frequency_range_tx_isSet = false; + sample_rate_range_tx = nullptr; + m_sample_rate_range_tx_isSet = false; + bandwidth_range_tx = nullptr; + m_bandwidth_range_tx_isSet = false; + global_gain_range_tx = nullptr; + m_global_gain_range_tx_isSet = false; +} + +SWGBladeRF2MIMOReport::~SWGBladeRF2MIMOReport() { + this->cleanup(); +} + +void +SWGBladeRF2MIMOReport::init() { + frequency_range_rx = new SWGFrequencyRange(); + m_frequency_range_rx_isSet = false; + sample_rate_range_rx = new SWGRange(); + m_sample_rate_range_rx_isSet = false; + bandwidth_range_rx = new SWGRange(); + m_bandwidth_range_rx_isSet = false; + global_gain_range_rx = new SWGRange(); + m_global_gain_range_rx_isSet = false; + gain_modes_rx = new QList(); + m_gain_modes_rx_isSet = false; + frequency_range_tx = new SWGFrequencyRange(); + m_frequency_range_tx_isSet = false; + sample_rate_range_tx = new SWGRange(); + m_sample_rate_range_tx_isSet = false; + bandwidth_range_tx = new SWGRange(); + m_bandwidth_range_tx_isSet = false; + global_gain_range_tx = new SWGRange(); + m_global_gain_range_tx_isSet = false; +} + +void +SWGBladeRF2MIMOReport::cleanup() { + if(frequency_range_rx != nullptr) { + delete frequency_range_rx; + } + if(sample_rate_range_rx != nullptr) { + delete sample_rate_range_rx; + } + if(bandwidth_range_rx != nullptr) { + delete bandwidth_range_rx; + } + if(global_gain_range_rx != nullptr) { + delete global_gain_range_rx; + } + if(gain_modes_rx != nullptr) { + auto arr = gain_modes_rx; + for(auto o: *arr) { + delete o; + } + delete gain_modes_rx; + } + if(frequency_range_tx != nullptr) { + delete frequency_range_tx; + } + if(sample_rate_range_tx != nullptr) { + delete sample_rate_range_tx; + } + if(bandwidth_range_tx != nullptr) { + delete bandwidth_range_tx; + } + if(global_gain_range_tx != nullptr) { + delete global_gain_range_tx; + } +} + +SWGBladeRF2MIMOReport* +SWGBladeRF2MIMOReport::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGBladeRF2MIMOReport::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&frequency_range_rx, pJson["frequencyRangeRx"], "SWGFrequencyRange", "SWGFrequencyRange"); + + ::SWGSDRangel::setValue(&sample_rate_range_rx, pJson["sampleRateRangeRx"], "SWGRange", "SWGRange"); + + ::SWGSDRangel::setValue(&bandwidth_range_rx, pJson["bandwidthRangeRx"], "SWGRange", "SWGRange"); + + ::SWGSDRangel::setValue(&global_gain_range_rx, pJson["globalGainRangeRx"], "SWGRange", "SWGRange"); + + + ::SWGSDRangel::setValue(&gain_modes_rx, pJson["gainModesRx"], "QList", "SWGNamedEnum"); + ::SWGSDRangel::setValue(&frequency_range_tx, pJson["frequencyRangeTx"], "SWGFrequencyRange", "SWGFrequencyRange"); + + ::SWGSDRangel::setValue(&sample_rate_range_tx, pJson["sampleRateRangeTx"], "SWGRange", "SWGRange"); + + ::SWGSDRangel::setValue(&bandwidth_range_tx, pJson["bandwidthRangeTx"], "SWGRange", "SWGRange"); + + ::SWGSDRangel::setValue(&global_gain_range_tx, pJson["globalGainRangeTx"], "SWGRange", "SWGRange"); + +} + +QString +SWGBladeRF2MIMOReport::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGBladeRF2MIMOReport::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if((frequency_range_rx != nullptr) && (frequency_range_rx->isSet())){ + toJsonValue(QString("frequencyRangeRx"), frequency_range_rx, obj, QString("SWGFrequencyRange")); + } + if((sample_rate_range_rx != nullptr) && (sample_rate_range_rx->isSet())){ + toJsonValue(QString("sampleRateRangeRx"), sample_rate_range_rx, obj, QString("SWGRange")); + } + if((bandwidth_range_rx != nullptr) && (bandwidth_range_rx->isSet())){ + toJsonValue(QString("bandwidthRangeRx"), bandwidth_range_rx, obj, QString("SWGRange")); + } + if((global_gain_range_rx != nullptr) && (global_gain_range_rx->isSet())){ + toJsonValue(QString("globalGainRangeRx"), global_gain_range_rx, obj, QString("SWGRange")); + } + if(gain_modes_rx && gain_modes_rx->size() > 0){ + toJsonArray((QList*)gain_modes_rx, obj, "gainModesRx", "SWGNamedEnum"); + } + if((frequency_range_tx != nullptr) && (frequency_range_tx->isSet())){ + toJsonValue(QString("frequencyRangeTx"), frequency_range_tx, obj, QString("SWGFrequencyRange")); + } + if((sample_rate_range_tx != nullptr) && (sample_rate_range_tx->isSet())){ + toJsonValue(QString("sampleRateRangeTx"), sample_rate_range_tx, obj, QString("SWGRange")); + } + if((bandwidth_range_tx != nullptr) && (bandwidth_range_tx->isSet())){ + toJsonValue(QString("bandwidthRangeTx"), bandwidth_range_tx, obj, QString("SWGRange")); + } + if((global_gain_range_tx != nullptr) && (global_gain_range_tx->isSet())){ + toJsonValue(QString("globalGainRangeTx"), global_gain_range_tx, obj, QString("SWGRange")); + } + + return obj; +} + +SWGFrequencyRange* +SWGBladeRF2MIMOReport::getFrequencyRangeRx() { + return frequency_range_rx; +} +void +SWGBladeRF2MIMOReport::setFrequencyRangeRx(SWGFrequencyRange* frequency_range_rx) { + this->frequency_range_rx = frequency_range_rx; + this->m_frequency_range_rx_isSet = true; +} + +SWGRange* +SWGBladeRF2MIMOReport::getSampleRateRangeRx() { + return sample_rate_range_rx; +} +void +SWGBladeRF2MIMOReport::setSampleRateRangeRx(SWGRange* sample_rate_range_rx) { + this->sample_rate_range_rx = sample_rate_range_rx; + this->m_sample_rate_range_rx_isSet = true; +} + +SWGRange* +SWGBladeRF2MIMOReport::getBandwidthRangeRx() { + return bandwidth_range_rx; +} +void +SWGBladeRF2MIMOReport::setBandwidthRangeRx(SWGRange* bandwidth_range_rx) { + this->bandwidth_range_rx = bandwidth_range_rx; + this->m_bandwidth_range_rx_isSet = true; +} + +SWGRange* +SWGBladeRF2MIMOReport::getGlobalGainRangeRx() { + return global_gain_range_rx; +} +void +SWGBladeRF2MIMOReport::setGlobalGainRangeRx(SWGRange* global_gain_range_rx) { + this->global_gain_range_rx = global_gain_range_rx; + this->m_global_gain_range_rx_isSet = true; +} + +QList* +SWGBladeRF2MIMOReport::getGainModesRx() { + return gain_modes_rx; +} +void +SWGBladeRF2MIMOReport::setGainModesRx(QList* gain_modes_rx) { + this->gain_modes_rx = gain_modes_rx; + this->m_gain_modes_rx_isSet = true; +} + +SWGFrequencyRange* +SWGBladeRF2MIMOReport::getFrequencyRangeTx() { + return frequency_range_tx; +} +void +SWGBladeRF2MIMOReport::setFrequencyRangeTx(SWGFrequencyRange* frequency_range_tx) { + this->frequency_range_tx = frequency_range_tx; + this->m_frequency_range_tx_isSet = true; +} + +SWGRange* +SWGBladeRF2MIMOReport::getSampleRateRangeTx() { + return sample_rate_range_tx; +} +void +SWGBladeRF2MIMOReport::setSampleRateRangeTx(SWGRange* sample_rate_range_tx) { + this->sample_rate_range_tx = sample_rate_range_tx; + this->m_sample_rate_range_tx_isSet = true; +} + +SWGRange* +SWGBladeRF2MIMOReport::getBandwidthRangeTx() { + return bandwidth_range_tx; +} +void +SWGBladeRF2MIMOReport::setBandwidthRangeTx(SWGRange* bandwidth_range_tx) { + this->bandwidth_range_tx = bandwidth_range_tx; + this->m_bandwidth_range_tx_isSet = true; +} + +SWGRange* +SWGBladeRF2MIMOReport::getGlobalGainRangeTx() { + return global_gain_range_tx; +} +void +SWGBladeRF2MIMOReport::setGlobalGainRangeTx(SWGRange* global_gain_range_tx) { + this->global_gain_range_tx = global_gain_range_tx; + this->m_global_gain_range_tx_isSet = true; +} + + +bool +SWGBladeRF2MIMOReport::isSet(){ + bool isObjectUpdated = false; + do{ + if(frequency_range_rx && frequency_range_rx->isSet()){ + isObjectUpdated = true; break; + } + if(sample_rate_range_rx && sample_rate_range_rx->isSet()){ + isObjectUpdated = true; break; + } + if(bandwidth_range_rx && bandwidth_range_rx->isSet()){ + isObjectUpdated = true; break; + } + if(global_gain_range_rx && global_gain_range_rx->isSet()){ + isObjectUpdated = true; break; + } + if(gain_modes_rx && (gain_modes_rx->size() > 0)){ + isObjectUpdated = true; break; + } + if(frequency_range_tx && frequency_range_tx->isSet()){ + isObjectUpdated = true; break; + } + if(sample_rate_range_tx && sample_rate_range_tx->isSet()){ + isObjectUpdated = true; break; + } + if(bandwidth_range_tx && bandwidth_range_tx->isSet()){ + isObjectUpdated = true; break; + } + if(global_gain_range_tx && global_gain_range_tx->isSet()){ + isObjectUpdated = true; break; + } + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.h b/swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.h new file mode 100644 index 000000000..d42fed084 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2MIMOReport.h @@ -0,0 +1,110 @@ +/** + * 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: 5.9.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. + */ + +/* + * SWGBladeRF2MIMOReport.h + * + * BladeRF2 + */ + +#ifndef SWGBladeRF2MIMOReport_H_ +#define SWGBladeRF2MIMOReport_H_ + +#include + + +#include "SWGFrequencyRange.h" +#include "SWGNamedEnum.h" +#include "SWGRange.h" +#include + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGBladeRF2MIMOReport: public SWGObject { +public: + SWGBladeRF2MIMOReport(); + SWGBladeRF2MIMOReport(QString* json); + virtual ~SWGBladeRF2MIMOReport(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGBladeRF2MIMOReport* fromJson(QString &jsonString) override; + + SWGFrequencyRange* getFrequencyRangeRx(); + void setFrequencyRangeRx(SWGFrequencyRange* frequency_range_rx); + + SWGRange* getSampleRateRangeRx(); + void setSampleRateRangeRx(SWGRange* sample_rate_range_rx); + + SWGRange* getBandwidthRangeRx(); + void setBandwidthRangeRx(SWGRange* bandwidth_range_rx); + + SWGRange* getGlobalGainRangeRx(); + void setGlobalGainRangeRx(SWGRange* global_gain_range_rx); + + QList* getGainModesRx(); + void setGainModesRx(QList* gain_modes_rx); + + SWGFrequencyRange* getFrequencyRangeTx(); + void setFrequencyRangeTx(SWGFrequencyRange* frequency_range_tx); + + SWGRange* getSampleRateRangeTx(); + void setSampleRateRangeTx(SWGRange* sample_rate_range_tx); + + SWGRange* getBandwidthRangeTx(); + void setBandwidthRangeTx(SWGRange* bandwidth_range_tx); + + SWGRange* getGlobalGainRangeTx(); + void setGlobalGainRangeTx(SWGRange* global_gain_range_tx); + + + virtual bool isSet() override; + +private: + SWGFrequencyRange* frequency_range_rx; + bool m_frequency_range_rx_isSet; + + SWGRange* sample_rate_range_rx; + bool m_sample_rate_range_rx_isSet; + + SWGRange* bandwidth_range_rx; + bool m_bandwidth_range_rx_isSet; + + SWGRange* global_gain_range_rx; + bool m_global_gain_range_rx_isSet; + + QList* gain_modes_rx; + bool m_gain_modes_rx_isSet; + + SWGFrequencyRange* frequency_range_tx; + bool m_frequency_range_tx_isSet; + + SWGRange* sample_rate_range_tx; + bool m_sample_rate_range_tx_isSet; + + SWGRange* bandwidth_range_tx; + bool m_bandwidth_range_tx_isSet; + + SWGRange* global_gain_range_tx; + bool m_global_gain_range_tx_isSet; + +}; + +} + +#endif /* SWGBladeRF2MIMOReport_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp index 3885586b5..4e20fe729 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.cpp @@ -40,6 +40,8 @@ SWGDeviceReport::SWGDeviceReport() { m_blade_rf2_input_report_isSet = false; blade_rf2_output_report = nullptr; m_blade_rf2_output_report_isSet = false; + blade_rf2_mimo_report = nullptr; + m_blade_rf2_mimo_report_isSet = false; file_input_report = nullptr; m_file_input_report_isSet = false; lime_sdr_input_report = nullptr; @@ -100,6 +102,8 @@ SWGDeviceReport::init() { m_blade_rf2_input_report_isSet = false; blade_rf2_output_report = new SWGBladeRF2OutputReport(); m_blade_rf2_output_report_isSet = false; + blade_rf2_mimo_report = new SWGBladeRF2MIMOReport(); + m_blade_rf2_mimo_report_isSet = false; file_input_report = new SWGFileInputReport(); m_file_input_report_isSet = false; lime_sdr_input_report = new SWGLimeSdrInputReport(); @@ -160,6 +164,9 @@ SWGDeviceReport::cleanup() { if(blade_rf2_output_report != nullptr) { delete blade_rf2_output_report; } + if(blade_rf2_mimo_report != nullptr) { + delete blade_rf2_mimo_report; + } if(file_input_report != nullptr) { delete file_input_report; } @@ -245,6 +252,8 @@ SWGDeviceReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&blade_rf2_output_report, pJson["bladeRF2OutputReport"], "SWGBladeRF2OutputReport", "SWGBladeRF2OutputReport"); + ::SWGSDRangel::setValue(&blade_rf2_mimo_report, pJson["bladeRF2MIMOReport"], "SWGBladeRF2MIMOReport", "SWGBladeRF2MIMOReport"); + ::SWGSDRangel::setValue(&file_input_report, pJson["fileInputReport"], "SWGFileInputReport", "SWGFileInputReport"); ::SWGSDRangel::setValue(&lime_sdr_input_report, pJson["limeSdrInputReport"], "SWGLimeSdrInputReport", "SWGLimeSdrInputReport"); @@ -319,6 +328,9 @@ SWGDeviceReport::asJsonObject() { if((blade_rf2_output_report != nullptr) && (blade_rf2_output_report->isSet())){ toJsonValue(QString("bladeRF2OutputReport"), blade_rf2_output_report, obj, QString("SWGBladeRF2OutputReport")); } + if((blade_rf2_mimo_report != nullptr) && (blade_rf2_mimo_report->isSet())){ + toJsonValue(QString("bladeRF2MIMOReport"), blade_rf2_mimo_report, obj, QString("SWGBladeRF2MIMOReport")); + } if((file_input_report != nullptr) && (file_input_report->isSet())){ toJsonValue(QString("fileInputReport"), file_input_report, obj, QString("SWGFileInputReport")); } @@ -443,6 +455,16 @@ SWGDeviceReport::setBladeRf2OutputReport(SWGBladeRF2OutputReport* blade_rf2_outp this->m_blade_rf2_output_report_isSet = true; } +SWGBladeRF2MIMOReport* +SWGDeviceReport::getBladeRf2MimoReport() { + return blade_rf2_mimo_report; +} +void +SWGDeviceReport::setBladeRf2MimoReport(SWGBladeRF2MIMOReport* blade_rf2_mimo_report) { + this->blade_rf2_mimo_report = blade_rf2_mimo_report; + this->m_blade_rf2_mimo_report_isSet = true; +} + SWGFileInputReport* SWGDeviceReport::getFileInputReport() { return file_input_report; @@ -666,6 +688,9 @@ SWGDeviceReport::isSet(){ if(blade_rf2_output_report && blade_rf2_output_report->isSet()){ isObjectUpdated = true; break; } + if(blade_rf2_mimo_report && blade_rf2_mimo_report->isSet()){ + isObjectUpdated = true; break; + } if(file_input_report && file_input_report->isSet()){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h index 7645bfd3d..a9ddabaf4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceReport.h @@ -25,6 +25,7 @@ #include "SWGAirspyHFReport.h" #include "SWGAirspyReport.h" #include "SWGBladeRF2InputReport.h" +#include "SWGBladeRF2MIMOReport.h" #include "SWGBladeRF2OutputReport.h" #include "SWGFileInputReport.h" #include "SWGKiwiSDRReport.h" @@ -83,6 +84,9 @@ public: SWGBladeRF2OutputReport* getBladeRf2OutputReport(); void setBladeRf2OutputReport(SWGBladeRF2OutputReport* blade_rf2_output_report); + SWGBladeRF2MIMOReport* getBladeRf2MimoReport(); + void setBladeRf2MimoReport(SWGBladeRF2MIMOReport* blade_rf2_mimo_report); + SWGFileInputReport* getFileInputReport(); void setFileInputReport(SWGFileInputReport* file_input_report); @@ -165,6 +169,9 @@ private: SWGBladeRF2OutputReport* blade_rf2_output_report; bool m_blade_rf2_output_report_isSet; + SWGBladeRF2MIMOReport* blade_rf2_mimo_report; + bool m_blade_rf2_mimo_report_isSet; + SWGFileInputReport* file_input_report; bool m_file_input_report_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index e24e509b6..319e3c063 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -40,6 +40,7 @@ #include "SWGBladeRF1OutputSettings.h" #include "SWGBladeRF2InputReport.h" #include "SWGBladeRF2InputSettings.h" +#include "SWGBladeRF2MIMOReport.h" #include "SWGBladeRF2MIMOSettings.h" #include "SWGBladeRF2OutputReport.h" #include "SWGBladeRF2OutputSettings.h" @@ -280,6 +281,9 @@ namespace SWGSDRangel { if(QString("SWGBladeRF2InputSettings").compare(type) == 0) { return new SWGBladeRF2InputSettings(); } + if(QString("SWGBladeRF2MIMOReport").compare(type) == 0) { + return new SWGBladeRF2MIMOReport(); + } if(QString("SWGBladeRF2MIMOSettings").compare(type) == 0) { return new SWGBladeRF2MIMOSettings(); }