From 636c014427d4c0464ef329e1b4c182491292d2d6 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 26 Oct 2020 09:03:23 +0000 Subject: [PATCH] Add loOffset to API --- plugins/samplesink/usrpoutput/usrpoutput.cpp | 7 ++++++ plugins/samplesource/usrpinput/usrpinput.cpp | 7 ++++++ sdrbase/resources/webapi/doc/html2/index.html | 8 ++++++- .../sdrangel/api/swagger/include/USRP.yaml | 4 ++++ swagger/sdrangel/code/html2/index.html | 8 ++++++- .../code/qt5/client/SWGUSRPInputSettings.cpp | 23 +++++++++++++++++++ .../code/qt5/client/SWGUSRPInputSettings.h | 6 +++++ .../code/qt5/client/SWGUSRPOutputSettings.cpp | 23 +++++++++++++++++++ .../code/qt5/client/SWGUSRPOutputSettings.h | 6 +++++ 9 files changed, 90 insertions(+), 2 deletions(-) diff --git a/plugins/samplesink/usrpoutput/usrpoutput.cpp b/plugins/samplesink/usrpoutput/usrpoutput.cpp index b175136e3..b389c67da 100644 --- a/plugins/samplesink/usrpoutput/usrpoutput.cpp +++ b/plugins/samplesink/usrpoutput/usrpoutput.cpp @@ -951,6 +951,9 @@ void USRPOutput::webapiUpdateDeviceSettings( if (deviceSettingsKeys.contains("devSampleRate")) { settings.m_devSampleRate = response.getUsrpOutputSettings()->getDevSampleRate(); } + if (deviceSettingsKeys.contains("loOffset")) { + settings.m_loOffset = response.getUsrpOutputSettings()->getLoOffset(); + } if (deviceSettingsKeys.contains("clockSource")) { settings.m_clockSource = *response.getUsrpOutputSettings()->getClockSource(); } @@ -998,6 +1001,7 @@ void USRPOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& resp response.getUsrpOutputSettings()->setAntennaPath(new QString(settings.m_antennaPath)); response.getUsrpOutputSettings()->setCenterFrequency(settings.m_centerFrequency); response.getUsrpOutputSettings()->setDevSampleRate(settings.m_devSampleRate); + response.getUsrpOutputSettings()->setLoOffset(settings.m_loOffset); response.getUsrpOutputSettings()->setClockSource(new QString(settings.m_clockSource)); response.getUsrpOutputSettings()->setGain(settings.m_gain); response.getUsrpOutputSettings()->setLog2SoftInterp(settings.m_log2SoftInterp); @@ -1083,6 +1087,9 @@ void USRPOutput::webapiReverseSendSettings(QList& deviceSettingsKeys, c if (deviceSettingsKeys.contains("devSampleRate") || force) { swgUsrpOutputSettings->setDevSampleRate(settings.m_devSampleRate); } + if (deviceSettingsKeys.contains("loOffset") || force) { + swgUsrpOutputSettings->setLoOffset(settings.m_loOffset); + } if (deviceSettingsKeys.contains("clockSource") || force) { swgUsrpOutputSettings->setClockSource(new QString(settings.m_clockSource)); } diff --git a/plugins/samplesource/usrpinput/usrpinput.cpp b/plugins/samplesource/usrpinput/usrpinput.cpp index cdd14a0aa..52d26c3b3 100644 --- a/plugins/samplesource/usrpinput/usrpinput.cpp +++ b/plugins/samplesource/usrpinput/usrpinput.cpp @@ -1025,6 +1025,9 @@ void USRPInput::webapiUpdateDeviceSettings( if (deviceSettingsKeys.contains("centerFrequency")) { settings.m_centerFrequency = response.getUsrpInputSettings()->getCenterFrequency(); } + if (deviceSettingsKeys.contains("loOffset")) { + settings.m_loOffset = response.getUsrpInputSettings()->getLoOffset(); + } if (deviceSettingsKeys.contains("dcBlock")) { settings.m_dcBlock = response.getUsrpInputSettings()->getDcBlock() != 0; } @@ -1075,6 +1078,7 @@ void USRPInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& respo response.getUsrpInputSettings()->setCenterFrequency(settings.m_centerFrequency); response.getUsrpInputSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0); response.getUsrpInputSettings()->setDevSampleRate(settings.m_devSampleRate); + response.getUsrpInputSettings()->setLoOffset(settings.m_loOffset); response.getUsrpInputSettings()->setClockSource(new QString(settings.m_clockSource)); response.getUsrpInputSettings()->setGain(settings.m_gain); response.getUsrpInputSettings()->setGainMode((int) settings.m_gainMode); @@ -1171,6 +1175,9 @@ void USRPInput::webapiReverseSendSettings(QList& deviceSettingsKeys, co if (deviceSettingsKeys.contains("centerFrequency") || force) { swgUsrpInputSettings->setCenterFrequency(settings.m_centerFrequency); } + if (deviceSettingsKeys.contains("loOffset") || force) { + swgUsrpInputSettings->setLoOffset(settings.m_loOffset); + } if (deviceSettingsKeys.contains("dcBlock") || force) { swgUsrpInputSettings->setDcBlock(settings.m_dcBlock ? 1 : 0); } diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 2dd81cdeb..daacfd4b1 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -7583,6 +7583,9 @@ margin-bottom: 20px; "devSampleRate" : { "type" : "integer" }, + "loOffset" : { + "type" : "integer" + }, "dcBlock" : { "type" : "integer" }, @@ -7659,6 +7662,9 @@ margin-bottom: 20px; "devSampleRate" : { "type" : "integer" }, + "loOffset" : { + "type" : "integer" + }, "log2SoftInterp" : { "type" : "integer" }, @@ -39969,7 +39975,7 @@ except ApiException as e:
- Generated 2020-10-11T08:49:12.690+02:00 + Generated 2020-10-25T21:28:04.207+01:00
diff --git a/swagger/sdrangel/api/swagger/include/USRP.yaml b/swagger/sdrangel/api/swagger/include/USRP.yaml index 05d22351c..e388f288f 100644 --- a/swagger/sdrangel/api/swagger/include/USRP.yaml +++ b/swagger/sdrangel/api/swagger/include/USRP.yaml @@ -6,6 +6,8 @@ USRPInputSettings: format: int64 devSampleRate: type: integer + loOffset: + type: integer dcBlock: type: integer iqCorrection: @@ -46,6 +48,8 @@ USRPOutputSettings: format: int64 devSampleRate: type: integer + loOffset: + type: integer log2SoftInterp: type: integer lpfBW: diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 2dd81cdeb..daacfd4b1 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -7583,6 +7583,9 @@ margin-bottom: 20px; "devSampleRate" : { "type" : "integer" }, + "loOffset" : { + "type" : "integer" + }, "dcBlock" : { "type" : "integer" }, @@ -7659,6 +7662,9 @@ margin-bottom: 20px; "devSampleRate" : { "type" : "integer" }, + "loOffset" : { + "type" : "integer" + }, "log2SoftInterp" : { "type" : "integer" }, @@ -39969,7 +39975,7 @@ except ApiException as e:
- Generated 2020-10-11T08:49:12.690+02:00 + Generated 2020-10-25T21:28:04.207+01:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.cpp index 61f39674b..963cdf5fa 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.cpp @@ -32,6 +32,8 @@ SWGUSRPInputSettings::SWGUSRPInputSettings() { m_center_frequency_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; + lo_offset = 0; + m_lo_offset_isSet = false; dc_block = 0; m_dc_block_isSet = false; iq_correction = 0; @@ -72,6 +74,8 @@ SWGUSRPInputSettings::init() { m_center_frequency_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; + lo_offset = 0; + m_lo_offset_isSet = false; dc_block = 0; m_dc_block_isSet = false; iq_correction = 0; @@ -110,6 +114,7 @@ SWGUSRPInputSettings::cleanup() { + if(antenna_path != nullptr) { delete antenna_path; } @@ -143,6 +148,8 @@ SWGUSRPInputSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&lo_offset, pJson["loOffset"], "qint32", ""); + ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", ""); ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", ""); @@ -193,6 +200,9 @@ SWGUSRPInputSettings::asJsonObject() { if(m_dev_sample_rate_isSet){ obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); } + if(m_lo_offset_isSet){ + obj->insert("loOffset", QJsonValue(lo_offset)); + } if(m_dc_block_isSet){ obj->insert("dcBlock", QJsonValue(dc_block)); } @@ -259,6 +269,16 @@ SWGUSRPInputSettings::setDevSampleRate(qint32 dev_sample_rate) { this->m_dev_sample_rate_isSet = true; } +qint32 +SWGUSRPInputSettings::getLoOffset() { + return lo_offset; +} +void +SWGUSRPInputSettings::setLoOffset(qint32 lo_offset) { + this->lo_offset = lo_offset; + this->m_lo_offset_isSet = true; +} + qint32 SWGUSRPInputSettings::getDcBlock() { return dc_block; @@ -410,6 +430,9 @@ SWGUSRPInputSettings::isSet(){ if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break; } + if(m_lo_offset_isSet){ + isObjectUpdated = true; break; + } if(m_dc_block_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.h b/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.h index b4c6d20d4..5e8cabbc4 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGUSRPInputSettings.h @@ -48,6 +48,9 @@ public: qint32 getDevSampleRate(); void setDevSampleRate(qint32 dev_sample_rate); + qint32 getLoOffset(); + void setLoOffset(qint32 lo_offset); + qint32 getDcBlock(); void setDcBlock(qint32 dc_block); @@ -100,6 +103,9 @@ private: qint32 dev_sample_rate; bool m_dev_sample_rate_isSet; + qint32 lo_offset; + bool m_lo_offset_isSet; + qint32 dc_block; bool m_dc_block_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.cpp index 46be95fae..5e666d639 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.cpp @@ -32,6 +32,8 @@ SWGUSRPOutputSettings::SWGUSRPOutputSettings() { m_center_frequency_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; + lo_offset = 0; + m_lo_offset_isSet = false; log2_soft_interp = 0; m_log2_soft_interp_isSet = false; lpf_bw = 0; @@ -66,6 +68,8 @@ SWGUSRPOutputSettings::init() { m_center_frequency_isSet = false; dev_sample_rate = 0; m_dev_sample_rate_isSet = false; + lo_offset = 0; + m_lo_offset_isSet = false; log2_soft_interp = 0; m_log2_soft_interp_isSet = false; lpf_bw = 0; @@ -97,6 +101,7 @@ SWGUSRPOutputSettings::cleanup() { + if(antenna_path != nullptr) { delete antenna_path; } @@ -128,6 +133,8 @@ SWGUSRPOutputSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&lo_offset, pJson["loOffset"], "qint32", ""); + ::SWGSDRangel::setValue(&log2_soft_interp, pJson["log2SoftInterp"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", ""); @@ -172,6 +179,9 @@ SWGUSRPOutputSettings::asJsonObject() { if(m_dev_sample_rate_isSet){ obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); } + if(m_lo_offset_isSet){ + obj->insert("loOffset", QJsonValue(lo_offset)); + } if(m_log2_soft_interp_isSet){ obj->insert("log2SoftInterp", QJsonValue(log2_soft_interp)); } @@ -229,6 +239,16 @@ SWGUSRPOutputSettings::setDevSampleRate(qint32 dev_sample_rate) { this->m_dev_sample_rate_isSet = true; } +qint32 +SWGUSRPOutputSettings::getLoOffset() { + return lo_offset; +} +void +SWGUSRPOutputSettings::setLoOffset(qint32 lo_offset) { + this->lo_offset = lo_offset; + this->m_lo_offset_isSet = true; +} + qint32 SWGUSRPOutputSettings::getLog2SoftInterp() { return log2_soft_interp; @@ -350,6 +370,9 @@ SWGUSRPOutputSettings::isSet(){ if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break; } + if(m_lo_offset_isSet){ + isObjectUpdated = true; break; + } if(m_log2_soft_interp_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.h b/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.h index 586ef560c..1955f9bdd 100644 --- a/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGUSRPOutputSettings.h @@ -48,6 +48,9 @@ public: qint32 getDevSampleRate(); void setDevSampleRate(qint32 dev_sample_rate); + qint32 getLoOffset(); + void setLoOffset(qint32 lo_offset); + qint32 getLog2SoftInterp(); void setLog2SoftInterp(qint32 log2_soft_interp); @@ -91,6 +94,9 @@ private: qint32 dev_sample_rate; bool m_dev_sample_rate_isSet; + qint32 lo_offset; + bool m_lo_offset_isSet; + qint32 log2_soft_interp; bool m_log2_soft_interp_isSet;