From 98a87bb86079a3afc18154c04f4d63a7fd8b34cb Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 30 Sep 2018 11:10:07 +0200 Subject: [PATCH] BladeRF2: REST API: implemented LO soft correction setting --- .../bladerf2output/bladerf2output.cpp | 4 ++ .../bladerf2input/bladerf2input.cpp | 4 ++ sdrbase/resources/webapi/doc/html2/index.html | 11 +++-- .../webapi/doc/swagger/include/BladeRF2.yaml | 6 ++- .../api/swagger/include/BladeRF2.yaml | 4 ++ swagger/sdrangel/code/html2/index.html | 11 +++-- .../qt5/client/SWGBladeRF2InputSettings.cpp | 21 ++++++++++ .../qt5/client/SWGBladeRF2InputSettings.h | 6 +++ .../qt5/client/SWGBladeRF2OutputSettings.cpp | 40 +++++++++---------- .../qt5/client/SWGBladeRF2OutputSettings.h | 12 +++--- 10 files changed, 83 insertions(+), 36 deletions(-) diff --git a/plugins/samplesink/bladerf2output/bladerf2output.cpp b/plugins/samplesink/bladerf2output/bladerf2output.cpp index 6c6903185..38cbe76cb 100644 --- a/plugins/samplesink/bladerf2output/bladerf2output.cpp +++ b/plugins/samplesink/bladerf2output/bladerf2output.cpp @@ -876,6 +876,9 @@ int BladeRF2Output::webapiSettingsPutPatch( if (deviceSettingsKeys.contains("centerFrequency")) { settings.m_centerFrequency = response.getBladeRf2OutputSettings()->getCenterFrequency(); } + if (deviceSettingsKeys.contains("LOppmTenths")) { + settings.m_LOppmTenths = response.getBladeRf2OutputSettings()->getLOppmTenths(); + } if (deviceSettingsKeys.contains("devSampleRate")) { settings.m_devSampleRate = response.getBladeRf2OutputSettings()->getDevSampleRate(); } @@ -916,6 +919,7 @@ int BladeRF2Output::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QStr void BladeRF2Output::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF2OutputSettings& settings) { response.getBladeRf2OutputSettings()->setCenterFrequency(settings.m_centerFrequency); + response.getBladeRf2OutputSettings()->setLOppmTenths(settings.m_LOppmTenths); response.getBladeRf2OutputSettings()->setDevSampleRate(settings.m_devSampleRate); response.getBladeRf2OutputSettings()->setBandwidth(settings.m_bandwidth); response.getBladeRf2OutputSettings()->setLog2Interp(settings.m_log2Interp); diff --git a/plugins/samplesource/bladerf2input/bladerf2input.cpp b/plugins/samplesource/bladerf2input/bladerf2input.cpp index 44287e514..2ce1fbf41 100644 --- a/plugins/samplesource/bladerf2input/bladerf2input.cpp +++ b/plugins/samplesource/bladerf2input/bladerf2input.cpp @@ -960,6 +960,9 @@ int BladeRF2Input::webapiSettingsPutPatch( if (deviceSettingsKeys.contains("centerFrequency")) { settings.m_centerFrequency = response.getBladeRf2InputSettings()->getCenterFrequency(); } + if (deviceSettingsKeys.contains("LOppmTenths")) { + settings.m_LOppmTenths = response.getBladeRf2InputSettings()->getLOppmTenths(); + } if (deviceSettingsKeys.contains("devSampleRate")) { settings.m_devSampleRate = response.getBladeRf2InputSettings()->getDevSampleRate(); } @@ -1015,6 +1018,7 @@ int BladeRF2Input::webapiReportGet(SWGSDRangel::SWGDeviceReport& response, QStri void BladeRF2Input::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF2InputSettings& settings) { response.getBladeRf2InputSettings()->setCenterFrequency(settings.m_centerFrequency); + response.getBladeRf2InputSettings()->setLOppmTenths(settings.m_LOppmTenths); response.getBladeRf2InputSettings()->setDevSampleRate(settings.m_devSampleRate); response.getBladeRf2InputSettings()->setBandwidth(settings.m_bandwidth); response.getBladeRf2InputSettings()->setLog2Decim(settings.m_log2Decim); diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 162f29506..f355d8eab 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -1331,6 +1331,9 @@ margin-bottom: 20px; "type" : "integer", "format" : "int64" }, + "LOppmTenths" : { + "type" : "integer" + }, "devSampleRate" : { "type" : "integer" }, @@ -1387,15 +1390,15 @@ margin-bottom: 20px; "type" : "integer", "format" : "int64" }, + "LOppmTenths" : { + "type" : "integer" + }, "devSampleRate" : { "type" : "integer" }, "bandwidth" : { "type" : "integer" }, - "gainMode" : { - "type" : "integer" - }, "globalGain" : { "type" : "integer" }, @@ -23225,7 +23228,7 @@ except ApiException as e:
- Generated 2018-09-29T10:10:59.386+02:00 + Generated 2018-09-30T11:01:56.666+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml b/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml index 5a6e73ed3..dd873fc17 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/BladeRF2.yaml @@ -4,6 +4,8 @@ BladeRF2InputSettings: centerFrequency: type: integer format: int64 + LOppmTenths: + type: integer devSampleRate: type: integer bandwidth: @@ -47,12 +49,12 @@ BladeRF2OutputSettings: centerFrequency: type: integer format: int64 + LOppmTenths: + type: integer devSampleRate: type: integer bandwidth: type: integer - gainMode: - type: integer globalGain: type: integer biasTee: diff --git a/swagger/sdrangel/api/swagger/include/BladeRF2.yaml b/swagger/sdrangel/api/swagger/include/BladeRF2.yaml index d8816fa23..9fb90fded 100644 --- a/swagger/sdrangel/api/swagger/include/BladeRF2.yaml +++ b/swagger/sdrangel/api/swagger/include/BladeRF2.yaml @@ -4,6 +4,8 @@ BladeRF2InputSettings: centerFrequency: type: integer format: int64 + LOppmTenths: + type: integer devSampleRate: type: integer bandwidth: @@ -47,6 +49,8 @@ BladeRF2OutputSettings: centerFrequency: type: integer format: int64 + LOppmTenths: + type: integer devSampleRate: type: integer bandwidth: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 162f29506..f355d8eab 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -1331,6 +1331,9 @@ margin-bottom: 20px; "type" : "integer", "format" : "int64" }, + "LOppmTenths" : { + "type" : "integer" + }, "devSampleRate" : { "type" : "integer" }, @@ -1387,15 +1390,15 @@ margin-bottom: 20px; "type" : "integer", "format" : "int64" }, + "LOppmTenths" : { + "type" : "integer" + }, "devSampleRate" : { "type" : "integer" }, "bandwidth" : { "type" : "integer" }, - "gainMode" : { - "type" : "integer" - }, "globalGain" : { "type" : "integer" }, @@ -23225,7 +23228,7 @@ except ApiException as e:
- Generated 2018-09-29T10:10:59.386+02:00 + Generated 2018-09-30T11:01:56.666+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.cpp index 60e5492a4..a8c80301a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.cpp @@ -30,6 +30,8 @@ SWGBladeRF2InputSettings::SWGBladeRF2InputSettings(QString* json) { SWGBladeRF2InputSettings::SWGBladeRF2InputSettings() { center_frequency = 0L; m_center_frequency_isSet = false; + l_oppm_tenths = 0; + m_l_oppm_tenths_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; bandwidth = 0; @@ -60,6 +62,8 @@ void SWGBladeRF2InputSettings::init() { center_frequency = 0L; m_center_frequency_isSet = false; + l_oppm_tenths = 0; + m_l_oppm_tenths_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; bandwidth = 0; @@ -94,6 +98,7 @@ SWGBladeRF2InputSettings::cleanup() { + if(file_record_name != nullptr) { delete file_record_name; } @@ -112,6 +117,8 @@ void SWGBladeRF2InputSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", ""); + ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); + ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", ""); @@ -151,6 +158,9 @@ SWGBladeRF2InputSettings::asJsonObject() { 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_isSet){ obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); } @@ -195,6 +205,16 @@ SWGBladeRF2InputSettings::setCenterFrequency(qint64 center_frequency) { this->m_center_frequency_isSet = true; } +qint32 +SWGBladeRF2InputSettings::getLOppmTenths() { + return l_oppm_tenths; +} +void +SWGBladeRF2InputSettings::setLOppmTenths(qint32 l_oppm_tenths) { + this->l_oppm_tenths = l_oppm_tenths; + this->m_l_oppm_tenths_isSet = true; +} + qint32 SWGBladeRF2InputSettings::getDevSampleRate() { return dev_sample_rate; @@ -301,6 +321,7 @@ SWGBladeRF2InputSettings::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_isSet){ isObjectUpdated = true; break;} if(m_bandwidth_isSet){ isObjectUpdated = true; break;} if(m_gain_mode_isSet){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.h b/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.h index 1a24a82f8..fdc92abe2 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2InputSettings.h @@ -45,6 +45,9 @@ public: qint64 getCenterFrequency(); void setCenterFrequency(qint64 center_frequency); + qint32 getLOppmTenths(); + void setLOppmTenths(qint32 l_oppm_tenths); + qint32 getDevSampleRate(); void setDevSampleRate(qint32 dev_sample_rate); @@ -82,6 +85,9 @@ private: qint64 center_frequency; bool m_center_frequency_isSet; + qint32 l_oppm_tenths; + bool m_l_oppm_tenths_isSet; + qint32 dev_sample_rate; bool m_dev_sample_rate_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.cpp index f28ca0d5c..df7a85fd4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.cpp @@ -30,12 +30,12 @@ SWGBladeRF2OutputSettings::SWGBladeRF2OutputSettings(QString* json) { SWGBladeRF2OutputSettings::SWGBladeRF2OutputSettings() { center_frequency = 0L; m_center_frequency_isSet = false; + l_oppm_tenths = 0; + m_l_oppm_tenths_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; bandwidth = 0; m_bandwidth_isSet = false; - gain_mode = 0; - m_gain_mode_isSet = false; global_gain = 0; m_global_gain_isSet = false; bias_tee = 0; @@ -52,12 +52,12 @@ void SWGBladeRF2OutputSettings::init() { center_frequency = 0L; m_center_frequency_isSet = false; + l_oppm_tenths = 0; + m_l_oppm_tenths_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; bandwidth = 0; m_bandwidth_isSet = false; - gain_mode = 0; - m_gain_mode_isSet = false; global_gain = 0; m_global_gain_isSet = false; bias_tee = 0; @@ -90,12 +90,12 @@ void SWGBladeRF2OutputSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint64", ""); + ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); + ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", ""); - ::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", ""); - ::SWGSDRangel::setValue(&global_gain, pJson["globalGain"], "qint32", ""); ::SWGSDRangel::setValue(&bias_tee, pJson["biasTee"], "qint32", ""); @@ -121,15 +121,15 @@ SWGBladeRF2OutputSettings::asJsonObject() { 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_isSet){ obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); } if(m_bandwidth_isSet){ obj->insert("bandwidth", QJsonValue(bandwidth)); } - if(m_gain_mode_isSet){ - obj->insert("gainMode", QJsonValue(gain_mode)); - } if(m_global_gain_isSet){ obj->insert("globalGain", QJsonValue(global_gain)); } @@ -153,6 +153,16 @@ SWGBladeRF2OutputSettings::setCenterFrequency(qint64 center_frequency) { this->m_center_frequency_isSet = true; } +qint32 +SWGBladeRF2OutputSettings::getLOppmTenths() { + return l_oppm_tenths; +} +void +SWGBladeRF2OutputSettings::setLOppmTenths(qint32 l_oppm_tenths) { + this->l_oppm_tenths = l_oppm_tenths; + this->m_l_oppm_tenths_isSet = true; +} + qint32 SWGBladeRF2OutputSettings::getDevSampleRate() { return dev_sample_rate; @@ -173,16 +183,6 @@ SWGBladeRF2OutputSettings::setBandwidth(qint32 bandwidth) { this->m_bandwidth_isSet = true; } -qint32 -SWGBladeRF2OutputSettings::getGainMode() { - return gain_mode; -} -void -SWGBladeRF2OutputSettings::setGainMode(qint32 gain_mode) { - this->gain_mode = gain_mode; - this->m_gain_mode_isSet = true; -} - qint32 SWGBladeRF2OutputSettings::getGlobalGain() { return global_gain; @@ -219,9 +219,9 @@ SWGBladeRF2OutputSettings::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_isSet){ isObjectUpdated = true; break;} if(m_bandwidth_isSet){ isObjectUpdated = true; break;} - if(m_gain_mode_isSet){ isObjectUpdated = true; break;} if(m_global_gain_isSet){ isObjectUpdated = true; break;} if(m_bias_tee_isSet){ isObjectUpdated = true; break;} if(m_log2_interp_isSet){ isObjectUpdated = true; break;} diff --git a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.h b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.h index 89daff30f..af1a497c3 100644 --- a/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGBladeRF2OutputSettings.h @@ -44,15 +44,15 @@ public: qint64 getCenterFrequency(); void setCenterFrequency(qint64 center_frequency); + qint32 getLOppmTenths(); + void setLOppmTenths(qint32 l_oppm_tenths); + qint32 getDevSampleRate(); void setDevSampleRate(qint32 dev_sample_rate); qint32 getBandwidth(); void setBandwidth(qint32 bandwidth); - qint32 getGainMode(); - void setGainMode(qint32 gain_mode); - qint32 getGlobalGain(); void setGlobalGain(qint32 global_gain); @@ -69,15 +69,15 @@ private: qint64 center_frequency; bool m_center_frequency_isSet; + qint32 l_oppm_tenths; + bool m_l_oppm_tenths_isSet; + qint32 dev_sample_rate; bool m_dev_sample_rate_isSet; qint32 bandwidth; bool m_bandwidth_isSet; - qint32 gain_mode; - bool m_gain_mode_isSet; - qint32 global_gain; bool m_global_gain_isSet;