From db2e7fe71bcd71203a8c7c6fdba280bdddfde36c Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 22 Mar 2018 05:10:13 +0100 Subject: [PATCH] Web API: AirspyHF: implemented settings entry points --- .../samplesource/airspyhf/airspyhfinput.cpp | 64 +++++ plugins/samplesource/airspyhf/airspyhfinput.h | 11 + sdrbase/resources/res.qrc | 1 + sdrbase/resources/webapi/doc/html2/index.html | 37 ++- .../webapi/doc/swagger/include/AMDemod.yaml | 4 +- .../webapi/doc/swagger/include/AirspyHF.yaml | 20 ++ .../resources/webapi/doc/swagger/swagger.yaml | 2 + .../sdrangel/api/swagger/include/AMDemod.yaml | 4 +- .../api/swagger/include/AirspyHF.yaml | 20 ++ swagger/sdrangel/api/swagger/swagger.yaml | 2 + swagger/sdrangel/code/html2/index.html | 37 ++- .../code/qt5/client/SWGAirspyHFSettings.cpp | 232 ++++++++++++++++++ .../code/qt5/client/SWGAirspyHFSettings.h | 94 +++++++ .../code/qt5/client/SWGDeviceSettings.cpp | 23 ++ .../code/qt5/client/SWGDeviceSettings.h | 7 + .../code/qt5/client/SWGModelFactory.h | 4 + 16 files changed, 552 insertions(+), 10 deletions(-) create mode 100644 sdrbase/resources/webapi/doc/swagger/include/AirspyHF.yaml create mode 100644 swagger/sdrangel/api/swagger/include/AirspyHF.yaml create mode 100644 swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.h diff --git a/plugins/samplesource/airspyhf/airspyhfinput.cpp b/plugins/samplesource/airspyhf/airspyhfinput.cpp index ac9ee6fa4..c91dc014c 100644 --- a/plugins/samplesource/airspyhf/airspyhfinput.cpp +++ b/plugins/samplesource/airspyhf/airspyhfinput.cpp @@ -485,6 +485,70 @@ airspyhf_device_t *AirspyHFInput::open_airspyhf_from_serial(const QString& seria } } +int AirspyHFInput::webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage __attribute__((unused))) +{ + response.setAirspyHfSettings(new SWGSDRangel::SWGAirspyHFSettings()); + response.getAirspyHfSettings()->init(); + webapiFormatDeviceSettings(response, m_settings); + return 200; +} + +int AirspyHFInput::webapiSettingsPutPatch( + bool force, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response, // query + response + QString& errorMessage __attribute__((unused))) +{ + AirspyHFSettings settings = m_settings; + + if (deviceSettingsKeys.contains("centerFrequency")) { + settings.m_centerFrequency = response.getAirspyHfSettings()->getCenterFrequency(); + } + if (deviceSettingsKeys.contains("devSampleRateIndex")) { + settings.m_devSampleRateIndex = response.getAirspyHfSettings()->getDevSampleRateIndex(); + } + if (deviceSettingsKeys.contains("LOppmTenths")) { + settings.m_LOppmTenths = response.getAirspyHfSettings()->getLOppmTenths(); + } + if (deviceSettingsKeys.contains("log2Decim")) { + settings.m_log2Decim = response.getAirspyHfSettings()->getLog2Decim(); + } + if (deviceSettingsKeys.contains("transverterDeltaFrequency")) { + settings.m_transverterDeltaFrequency = response.getAirspyHfSettings()->getTransverterDeltaFrequency(); + } + if (deviceSettingsKeys.contains("transverterMode")) { + settings.m_transverterMode = response.getAirspyHfSettings()->getTransverterMode() != 0; + } + if (deviceSettingsKeys.contains("bandIndex")) { + settings.m_bandIndex = response.getAirspyHfSettings()->getBandIndex() != 0; + } + + MsgConfigureAirspyHF *msg = MsgConfigureAirspyHF::create(settings, force); + m_inputMessageQueue.push(msg); + + if (m_guiMessageQueue) // forward to GUI if any + { + MsgConfigureAirspyHF *msgToGUI = MsgConfigureAirspyHF::create(settings, force); + m_guiMessageQueue->push(msgToGUI); + } + + webapiFormatDeviceSettings(response, settings); + return 200; +} + +void AirspyHFInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings) +{ + response.getAirspyHfSettings()->setCenterFrequency(settings.m_centerFrequency); + response.getAirspyHfSettings()->setDevSampleRateIndex(settings.m_devSampleRateIndex); + response.getAirspyHfSettings()->setLOppmTenths(settings.m_LOppmTenths); + response.getAirspyHfSettings()->setLog2Decim(settings.m_log2Decim); + response.getAirspyHfSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency); + response.getAirspyHfSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0); + response.getAirspyHfSettings()->setBandIndex(settings.m_bandIndex ? 1 : 0); +} + int AirspyHFInput::webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage __attribute__((unused))) diff --git a/plugins/samplesource/airspyhf/airspyhfinput.h b/plugins/samplesource/airspyhf/airspyhfinput.h index f88e312ab..4392841c0 100644 --- a/plugins/samplesource/airspyhf/airspyhfinput.h +++ b/plugins/samplesource/airspyhf/airspyhfinput.h @@ -112,6 +112,16 @@ public: virtual bool handleMessage(const Message& message); + virtual int webapiSettingsGet( + SWGSDRangel::SWGDeviceSettings& response, + QString& errorMessage); + + virtual int webapiSettingsPutPatch( + bool force, + const QStringList& deviceSettingsKeys, + SWGSDRangel::SWGDeviceSettings& response, // query + response + QString& errorMessage); + virtual int webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage); @@ -132,6 +142,7 @@ private: bool applySettings(const AirspyHFSettings& settings, bool force); airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr); void setDeviceCenterFrequency(quint64 freq, const AirspyHFSettings& settings); + void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const AirspyHFSettings& settings); DeviceSourceAPI *m_deviceAPI; QMutex m_mutex; diff --git a/sdrbase/resources/res.qrc b/sdrbase/resources/res.qrc index a601873c7..240442a8e 100644 --- a/sdrbase/resources/res.qrc +++ b/sdrbase/resources/res.qrc @@ -3,6 +3,7 @@ webapi/doc/html2/index.html webapi/doc/swagger/swagger.yaml webapi/doc/swagger/include/CWKeyer.yaml + webapi/doc/swagger/include/AirspyHF.yaml webapi/doc/swagger/include/FileSource.yaml webapi/doc/swagger/include/HackRF.yaml webapi/doc/swagger/include/LimeSdr.yaml diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index aeb9afb38..6310f8e8b 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -720,12 +720,12 @@ margin-bottom: 20px; "rfBandwidth" : { "type" : "number", "format" : "float", - "description" : "channel RF bandwidth in Hz (rounds to lower kHz)" + "description" : "channel RF bandwidth in Hz (floors to next 100 Hz)" }, "squelch" : { "type" : "number", "format" : "float", - "description" : "power squelch threshold in centi-bels" + "description" : "power squelch threshold in decibels" }, "volume" : { "type" : "number", @@ -761,6 +761,34 @@ margin-bottom: 20px; } }, "description" : "AMDemod" +}; + defs.AirspyHFSettings = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "LOppmTenths" : { + "type" : "integer" + }, + "devSampleRateIndex" : { + "type" : "integer" + }, + "log2Decim" : { + "type" : "integer" + }, + "transverterMode" : { + "type" : "integer" + }, + "transverterDeltaFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "bandIndex" : { + "type" : "integer" + } + }, + "description" : "AirspyHF" }; defs.AudioDevice = { "properties" : { @@ -1093,6 +1121,9 @@ margin-bottom: 20px; "type" : "integer", "description" : "Not zero if it is a tx device else it is a rx device" }, + "airspyHFSettings" : { + "$ref" : "#/definitions/AirspyHFSettings" + }, "fileSourceSettings" : { "$ref" : "#/definitions/FileSourceSettings" }, @@ -18032,7 +18063,7 @@ except ApiException as e:
- Generated 2018-03-21T22:39:00.405+01:00 + Generated 2018-03-22T05:08:39.552+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml b/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml index e2a619958..be2f44669 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/AMDemod.yaml @@ -6,11 +6,11 @@ AMDemodSettings: type: integer format: int64 rfBandwidth: - description: channel RF bandwidth in Hz (rounds to lower kHz) + description: channel RF bandwidth in Hz (floors to next 100 Hz) type: number format: float squelch: - description: power squelch threshold in centi-bels + description: power squelch threshold in decibels type: number format: float volume: diff --git a/sdrbase/resources/webapi/doc/swagger/include/AirspyHF.yaml b/sdrbase/resources/webapi/doc/swagger/include/AirspyHF.yaml new file mode 100644 index 000000000..b041dc6bb --- /dev/null +++ b/sdrbase/resources/webapi/doc/swagger/include/AirspyHF.yaml @@ -0,0 +1,20 @@ +AirspyHFSettings: + description: AirspyHF + properties: + centerFrequency: + type: integer + format: int64 + LOppmTenths: + type: integer + devSampleRateIndex: + type: integer + log2Decim: + type: integer + transverterMode: + type: integer + transverterDeltaFrequency: + type: integer + format: int64 + bandIndex: + type: integer + \ No newline at end of file diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index 8951e50a9..992b7afa7 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -1568,6 +1568,8 @@ definitions: tx: description: Not zero if it is a tx device else it is a rx device type: integer + airspyHFSettings: + $ref: "/doc/swagger/include/AirspyHF.yaml#/AirspyHFSettings" fileSourceSettings: $ref: "/doc/swagger/include/FileSource.yaml#/FileSourceSettings" hackRFInputSettings: diff --git a/swagger/sdrangel/api/swagger/include/AMDemod.yaml b/swagger/sdrangel/api/swagger/include/AMDemod.yaml index e2a619958..be2f44669 100644 --- a/swagger/sdrangel/api/swagger/include/AMDemod.yaml +++ b/swagger/sdrangel/api/swagger/include/AMDemod.yaml @@ -6,11 +6,11 @@ AMDemodSettings: type: integer format: int64 rfBandwidth: - description: channel RF bandwidth in Hz (rounds to lower kHz) + description: channel RF bandwidth in Hz (floors to next 100 Hz) type: number format: float squelch: - description: power squelch threshold in centi-bels + description: power squelch threshold in decibels type: number format: float volume: diff --git a/swagger/sdrangel/api/swagger/include/AirspyHF.yaml b/swagger/sdrangel/api/swagger/include/AirspyHF.yaml new file mode 100644 index 000000000..b041dc6bb --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/AirspyHF.yaml @@ -0,0 +1,20 @@ +AirspyHFSettings: + description: AirspyHF + properties: + centerFrequency: + type: integer + format: int64 + LOppmTenths: + type: integer + devSampleRateIndex: + type: integer + log2Decim: + type: integer + transverterMode: + type: integer + transverterDeltaFrequency: + type: integer + format: int64 + bandIndex: + type: integer + \ No newline at end of file diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 1eac6aeb3..e30f9adf4 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -1568,6 +1568,8 @@ definitions: tx: description: Not zero if it is a tx device else it is a rx device type: integer + airspyHFSettings: + $ref: "http://localhost:8081/api/swagger/include/AirspyHF.yaml#/AirspyHFSettings" fileSourceSettings: $ref: "http://localhost:8081/api/swagger/include/FileSource.yaml#/FileSourceSettings" hackRFInputSettings: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index aeb9afb38..6310f8e8b 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -720,12 +720,12 @@ margin-bottom: 20px; "rfBandwidth" : { "type" : "number", "format" : "float", - "description" : "channel RF bandwidth in Hz (rounds to lower kHz)" + "description" : "channel RF bandwidth in Hz (floors to next 100 Hz)" }, "squelch" : { "type" : "number", "format" : "float", - "description" : "power squelch threshold in centi-bels" + "description" : "power squelch threshold in decibels" }, "volume" : { "type" : "number", @@ -761,6 +761,34 @@ margin-bottom: 20px; } }, "description" : "AMDemod" +}; + defs.AirspyHFSettings = { + "properties" : { + "centerFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "LOppmTenths" : { + "type" : "integer" + }, + "devSampleRateIndex" : { + "type" : "integer" + }, + "log2Decim" : { + "type" : "integer" + }, + "transverterMode" : { + "type" : "integer" + }, + "transverterDeltaFrequency" : { + "type" : "integer", + "format" : "int64" + }, + "bandIndex" : { + "type" : "integer" + } + }, + "description" : "AirspyHF" }; defs.AudioDevice = { "properties" : { @@ -1093,6 +1121,9 @@ margin-bottom: 20px; "type" : "integer", "description" : "Not zero if it is a tx device else it is a rx device" }, + "airspyHFSettings" : { + "$ref" : "#/definitions/AirspyHFSettings" + }, "fileSourceSettings" : { "$ref" : "#/definitions/FileSourceSettings" }, @@ -18032,7 +18063,7 @@ except ApiException as e:
- Generated 2018-03-21T22:39:00.405+01:00 + Generated 2018-03-22T05:08:39.552+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.cpp new file mode 100644 index 000000000..b2c1c07fa --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.cpp @@ -0,0 +1,232 @@ +/** + * 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 "SWGAirspyHFSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGAirspyHFSettings::SWGAirspyHFSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGAirspyHFSettings::SWGAirspyHFSettings() { + center_frequency = 0L; + m_center_frequency_isSet = false; + l_oppm_tenths = 0; + m_l_oppm_tenths_isSet = false; + dev_sample_rate_index = 0; + m_dev_sample_rate_index_isSet = false; + log2_decim = 0; + m_log2_decim_isSet = false; + transverter_mode = 0; + m_transverter_mode_isSet = false; + transverter_delta_frequency = 0L; + m_transverter_delta_frequency_isSet = false; + band_index = 0; + m_band_index_isSet = false; +} + +SWGAirspyHFSettings::~SWGAirspyHFSettings() { + this->cleanup(); +} + +void +SWGAirspyHFSettings::init() { + center_frequency = 0L; + m_center_frequency_isSet = false; + l_oppm_tenths = 0; + m_l_oppm_tenths_isSet = false; + dev_sample_rate_index = 0; + m_dev_sample_rate_index_isSet = false; + log2_decim = 0; + m_log2_decim_isSet = false; + transverter_mode = 0; + m_transverter_mode_isSet = false; + transverter_delta_frequency = 0L; + m_transverter_delta_frequency_isSet = false; + band_index = 0; + m_band_index_isSet = false; +} + +void +SWGAirspyHFSettings::cleanup() { + + + + + + + +} + +SWGAirspyHFSettings* +SWGAirspyHFSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGAirspyHFSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", ""); + + ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); + + ::SWGSDRangel::setValue(&dev_sample_rate_index, pJson["devSampleRateIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", ""); + + ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", ""); + + ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", ""); + + ::SWGSDRangel::setValue(&band_index, pJson["bandIndex"], "qint32", ""); + +} + +QString +SWGAirspyHFSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGAirspyHFSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(m_l_oppm_tenths_isSet){ + obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths)); + } + if(m_dev_sample_rate_index_isSet){ + obj->insert("devSampleRateIndex", QJsonValue(dev_sample_rate_index)); + } + if(m_log2_decim_isSet){ + obj->insert("log2Decim", QJsonValue(log2_decim)); + } + if(m_transverter_mode_isSet){ + obj->insert("transverterMode", QJsonValue(transverter_mode)); + } + if(m_transverter_delta_frequency_isSet){ + obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency)); + } + if(m_band_index_isSet){ + obj->insert("bandIndex", QJsonValue(band_index)); + } + + return obj; +} + +qint64 +SWGAirspyHFSettings::getCenterFrequency() { + return center_frequency; +} +void +SWGAirspyHFSettings::setCenterFrequency(qint64 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +qint32 +SWGAirspyHFSettings::getLOppmTenths() { + return l_oppm_tenths; +} +void +SWGAirspyHFSettings::setLOppmTenths(qint32 l_oppm_tenths) { + this->l_oppm_tenths = l_oppm_tenths; + this->m_l_oppm_tenths_isSet = true; +} + +qint32 +SWGAirspyHFSettings::getDevSampleRateIndex() { + return dev_sample_rate_index; +} +void +SWGAirspyHFSettings::setDevSampleRateIndex(qint32 dev_sample_rate_index) { + this->dev_sample_rate_index = dev_sample_rate_index; + this->m_dev_sample_rate_index_isSet = true; +} + +qint32 +SWGAirspyHFSettings::getLog2Decim() { + return log2_decim; +} +void +SWGAirspyHFSettings::setLog2Decim(qint32 log2_decim) { + this->log2_decim = log2_decim; + this->m_log2_decim_isSet = true; +} + +qint32 +SWGAirspyHFSettings::getTransverterMode() { + return transverter_mode; +} +void +SWGAirspyHFSettings::setTransverterMode(qint32 transverter_mode) { + this->transverter_mode = transverter_mode; + this->m_transverter_mode_isSet = true; +} + +qint64 +SWGAirspyHFSettings::getTransverterDeltaFrequency() { + return transverter_delta_frequency; +} +void +SWGAirspyHFSettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) { + this->transverter_delta_frequency = transverter_delta_frequency; + this->m_transverter_delta_frequency_isSet = true; +} + +qint32 +SWGAirspyHFSettings::getBandIndex() { + return band_index; +} +void +SWGAirspyHFSettings::setBandIndex(qint32 band_index) { + this->band_index = band_index; + this->m_band_index_isSet = true; +} + + +bool +SWGAirspyHFSettings::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_center_frequency_isSet){ isObjectUpdated = true; break;} + if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;} + if(m_dev_sample_rate_index_isSet){ isObjectUpdated = true; break;} + if(m_log2_decim_isSet){ isObjectUpdated = true; break;} + if(m_transverter_mode_isSet){ isObjectUpdated = true; break;} + if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;} + if(m_band_index_isSet){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.h b/swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.h new file mode 100644 index 000000000..c6de47087 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGAirspyHFSettings.h @@ -0,0 +1,94 @@ +/** + * 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. + */ + +/* + * SWGAirspyHFSettings.h + * + * AirspyHF + */ + +#ifndef SWGAirspyHFSettings_H_ +#define SWGAirspyHFSettings_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGAirspyHFSettings: public SWGObject { +public: + SWGAirspyHFSettings(); + SWGAirspyHFSettings(QString* json); + virtual ~SWGAirspyHFSettings(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGAirspyHFSettings* fromJson(QString &jsonString) override; + + qint64 getCenterFrequency(); + void setCenterFrequency(qint64 center_frequency); + + qint32 getLOppmTenths(); + void setLOppmTenths(qint32 l_oppm_tenths); + + qint32 getDevSampleRateIndex(); + void setDevSampleRateIndex(qint32 dev_sample_rate_index); + + qint32 getLog2Decim(); + void setLog2Decim(qint32 log2_decim); + + qint32 getTransverterMode(); + void setTransverterMode(qint32 transverter_mode); + + qint64 getTransverterDeltaFrequency(); + void setTransverterDeltaFrequency(qint64 transverter_delta_frequency); + + qint32 getBandIndex(); + void setBandIndex(qint32 band_index); + + + virtual bool isSet() override; + +private: + qint64 center_frequency; + bool m_center_frequency_isSet; + + qint32 l_oppm_tenths; + bool m_l_oppm_tenths_isSet; + + qint32 dev_sample_rate_index; + bool m_dev_sample_rate_index_isSet; + + qint32 log2_decim; + bool m_log2_decim_isSet; + + qint32 transverter_mode; + bool m_transverter_mode_isSet; + + qint64 transverter_delta_frequency; + bool m_transverter_delta_frequency_isSet; + + qint32 band_index; + bool m_band_index_isSet; + +}; + +} + +#endif /* SWGAirspyHFSettings_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp index e43744cf4..28f28926b 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.cpp @@ -32,6 +32,8 @@ SWGDeviceSettings::SWGDeviceSettings() { m_device_hw_type_isSet = false; tx = 0; m_tx_isSet = false; + airspy_hf_settings = nullptr; + m_airspy_hf_settings_isSet = false; file_source_settings = nullptr; m_file_source_settings_isSet = false; hack_rf_input_settings = nullptr; @@ -56,6 +58,8 @@ SWGDeviceSettings::init() { m_device_hw_type_isSet = false; tx = 0; m_tx_isSet = false; + airspy_hf_settings = new SWGAirspyHFSettings(); + m_airspy_hf_settings_isSet = false; file_source_settings = new SWGFileSourceSettings(); m_file_source_settings_isSet = false; hack_rf_input_settings = new SWGHackRFInputSettings(); @@ -76,6 +80,9 @@ SWGDeviceSettings::cleanup() { delete device_hw_type; } + if(airspy_hf_settings != nullptr) { + delete airspy_hf_settings; + } if(file_source_settings != nullptr) { delete file_source_settings; } @@ -111,6 +118,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); + ::SWGSDRangel::setValue(&airspy_hf_settings, pJson["airspyHFSettings"], "SWGAirspyHFSettings", "SWGAirspyHFSettings"); + ::SWGSDRangel::setValue(&file_source_settings, pJson["fileSourceSettings"], "SWGFileSourceSettings", "SWGFileSourceSettings"); ::SWGSDRangel::setValue(&hack_rf_input_settings, pJson["hackRFInputSettings"], "SWGHackRFInputSettings", "SWGHackRFInputSettings"); @@ -145,6 +154,9 @@ SWGDeviceSettings::asJsonObject() { if(m_tx_isSet){ obj->insert("tx", QJsonValue(tx)); } + if((airspy_hf_settings != nullptr) && (airspy_hf_settings->isSet())){ + toJsonValue(QString("airspyHFSettings"), airspy_hf_settings, obj, QString("SWGAirspyHFSettings")); + } if((file_source_settings != nullptr) && (file_source_settings->isSet())){ toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings")); } @@ -187,6 +199,16 @@ SWGDeviceSettings::setTx(qint32 tx) { this->m_tx_isSet = true; } +SWGAirspyHFSettings* +SWGDeviceSettings::getAirspyHfSettings() { + return airspy_hf_settings; +} +void +SWGDeviceSettings::setAirspyHfSettings(SWGAirspyHFSettings* airspy_hf_settings) { + this->airspy_hf_settings = airspy_hf_settings; + this->m_airspy_hf_settings_isSet = true; +} + SWGFileSourceSettings* SWGDeviceSettings::getFileSourceSettings() { return file_source_settings; @@ -254,6 +276,7 @@ SWGDeviceSettings::isSet(){ do{ if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;} if(m_tx_isSet){ isObjectUpdated = true; break;} + if(airspy_hf_settings != nullptr && airspy_hf_settings->isSet()){ isObjectUpdated = true; break;} if(file_source_settings != nullptr && file_source_settings->isSet()){ isObjectUpdated = true; break;} if(hack_rf_input_settings != nullptr && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break;} if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h index e0f890104..2268a2c77 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSettings.h @@ -22,6 +22,7 @@ #include +#include "SWGAirspyHFSettings.h" #include "SWGFileSourceSettings.h" #include "SWGHackRFInputSettings.h" #include "SWGHackRFOutputSettings.h" @@ -54,6 +55,9 @@ public: qint32 getTx(); void setTx(qint32 tx); + SWGAirspyHFSettings* getAirspyHfSettings(); + void setAirspyHfSettings(SWGAirspyHFSettings* airspy_hf_settings); + SWGFileSourceSettings* getFileSourceSettings(); void setFileSourceSettings(SWGFileSourceSettings* file_source_settings); @@ -82,6 +86,9 @@ private: qint32 tx; bool m_tx_isSet; + SWGAirspyHFSettings* airspy_hf_settings; + bool m_airspy_hf_settings_isSet; + SWGFileSourceSettings* file_source_settings; bool m_file_source_settings_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 6500aba6b..c611101e4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -16,6 +16,7 @@ #include "SWGAMDemodReport.h" #include "SWGAMDemodSettings.h" +#include "SWGAirspyHFSettings.h" #include "SWGAudioDevice.h" #include "SWGAudioDevices.h" #include "SWGAudioDevicesSelect.h" @@ -67,6 +68,9 @@ namespace SWGSDRangel { if(QString("SWGAMDemodSettings").compare(type) == 0) { return new SWGAMDemodSettings(); } + if(QString("SWGAirspyHFSettings").compare(type) == 0) { + return new SWGAirspyHFSettings(); + } if(QString("SWGAudioDevice").compare(type) == 0) { return new SWGAudioDevice(); }