diff --git a/sdrbase/limerfe/limerfecontroller.cpp b/sdrbase/limerfe/limerfecontroller.cpp index 71a0121ba..0aeadd886 100644 --- a/sdrbase/limerfe/limerfecontroller.cpp +++ b/sdrbase/limerfe/limerfecontroller.cpp @@ -97,11 +97,11 @@ int LimeRFEController::configure() << "attValue: " << (int) m_rfeBoardState.attValue << "channelIDRX: " << (int) m_rfeBoardState.channelIDRX << "channelIDTX: " << (int) m_rfeBoardState.channelIDTX - << "enableSWR: " << (int) m_rfeBoardState.enableSWR << "mode: " << (int) m_rfeBoardState.mode << "notchOnOff: " << (int) m_rfeBoardState.notchOnOff << "selPortRX: " << (int) m_rfeBoardState.selPortRX << "selPortTX: " << (int) m_rfeBoardState.selPortTX + << "enableSWR: " << (int) m_rfeBoardState.enableSWR << "sourceSWR: " << (int) m_rfeBoardState.sourceSWR; int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState); @@ -127,11 +127,11 @@ int LimeRFEController::getState() << "attValue: " << (int) m_rfeBoardState.attValue << "channelIDRX: " << (int) m_rfeBoardState.channelIDRX << "channelIDTX: " << (int) m_rfeBoardState.channelIDTX - << "enableSWR: " << (int) m_rfeBoardState.enableSWR << "mode: " << (int) m_rfeBoardState.mode << "notchOnOff: " << (int) m_rfeBoardState.notchOnOff << "selPortRX: " << (int) m_rfeBoardState.selPortRX << "selPortTX: " << (int) m_rfeBoardState.selPortTX + << "enableSWR: " << (int) m_rfeBoardState.enableSWR << "sourceSWR: " << (int) m_rfeBoardState.sourceSWR; if (rc != 0) { @@ -345,8 +345,13 @@ void LimeRFEController::settingsToState(const LimeRFESettings& settings) m_rfeBoardState.attValue = settings.m_attenuationFactor < 0 ? 0 : settings.m_attenuationFactor > 7 ? 7 : settings.m_attenuationFactor; m_rfeBoardState.notchOnOff = settings.m_amfmNotch; - m_rfeBoardState.enableSWR = 0; // TODO - m_rfeBoardState.sourceSWR = RFE_SWR_SRC_EXT; // TODO + m_rfeBoardState.enableSWR = settings.m_swrEnable ? RFE_SWR_ENABLE : RFE_SWR_DISABLE; + + if (settings.m_swrSource == SWRExternal) { + m_rfeBoardState.sourceSWR = RFE_SWR_SRC_EXT; + } else if (settings.m_swrSource == SWRCellular) { + m_rfeBoardState.sourceSWR = RFE_SWR_SRC_CELL; + } } void LimeRFEController::stateToSettings(LimeRFESettings& settings) @@ -540,4 +545,7 @@ void LimeRFEController::stateToSettings(LimeRFESettings& settings) settings.m_rxOn = true; settings.m_txOn = true; } + + settings.m_swrEnable = m_rfeBoardState.enableSWR == RFE_SWR_ENABLE; + settings.m_swrSource = m_rfeBoardState.sourceSWR == RFE_SWR_SRC_CELL ? SWRCellular : SWRExternal; } diff --git a/sdrbase/limerfe/limerfecontroller.h b/sdrbase/limerfe/limerfecontroller.h index 97ae98765..b63072f3b 100644 --- a/sdrbase/limerfe/limerfecontroller.h +++ b/sdrbase/limerfe/limerfecontroller.h @@ -73,6 +73,12 @@ public: TxPortJ5 //!< Rx/Tx HF }; + enum SWRSource + { + SWRExternal, + SWRCellular + }; + struct LimeRFESettings { LimeRFESettings(); @@ -90,6 +96,8 @@ public: LimeRFEController::HAMChannel m_txHAMChannel; LimeRFEController::CellularChannel m_txCellularChannel; LimeRFEController::TxPort m_txPort; + bool m_swrEnable; + LimeRFEController::SWRSource m_swrSource; // Rx/Tx bool m_txRxDriven; //!< Tx settings set according to Rx settings bool m_rxOn; diff --git a/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml b/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml index 3749d1967..1ce72fecf 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml @@ -40,6 +40,12 @@ LimeRFESettings: txPort: description: Tx port selected (see LimeRFEController.TxPort enumeration) type: integer + swrEnable: + description: Boolean if SWR measurements are enabled else 0 + type: integer + swrSource: + description: SWR measurement source (see LimeRFEController.SWRSource) + type: integer rxOn: description: Boolean 1 if Rx is active else 0 type: integer @@ -51,8 +57,8 @@ LimeRFEPower: description: report of forward and reflected power measurements properties: forward: - description: relative forward power in dB + description: relative forward power in centi-Bels type: integer reflected: - description: relative reflected power in dB + description: relative reflected power in centi-Bels 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 3d3f28d0d..735257b1f 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -629,7 +629,7 @@ paths: /sdrangel/limerfe/power: x-swagger-router-controller: instance get: - description: get forward and reflected relative powers in dB + description: get forward and reflected relative powers in centi-Bels operationId: instanceLimeRFEPowerGet tags: - Instance @@ -641,7 +641,7 @@ paths: type: string responses: "200": - description: On success return forward and reflected powers + description: On success return forward and reflected powers in centi-Bels schema: $ref: "/doc/swagger/include/LimeRFE.yaml#/LimeRFEPower" "400": diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index fd8303f9e..7821a5609 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -2608,6 +2608,16 @@ bool WebAPIRequestMapper::validateLimeRFEConfig(SWGSDRangel::SWGLimeRFESettings& limeRFESettings.setTxOn(jsonObject["txOn"].toInt()); limeRFESettingsKeys.append("txOn"); } + if (jsonObject.contains("swrEnable")) + { + limeRFESettings.setSwrEnable(jsonObject["swrEnable"].toInt()); + limeRFESettingsKeys.append("swrEnable"); + } + if (jsonObject.contains("swrSource")) + { + limeRFESettings.setSwrSource(jsonObject["swrSource"].toInt()); + limeRFESettingsKeys.append("swrSource"); + } return true; } diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index 4a52470f9..72bfc986f 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -907,6 +907,8 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigGet( response.setTxCellularChannel((int) settings.m_txCellularChannel); response.setTxPort((int) settings.m_txPort); response.setTxOn(settings.m_txOn ? 1 : 0); + response.setSwrEnable(settings.m_swrEnable ? 1 : 0); + response.setSwrSource((int) settings.m_swrSource); return 200; } @@ -942,6 +944,8 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut( settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel(); settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort(); settings.m_txOn = query.getTxOn() != 0; + settings.m_swrEnable = query.getSwrEnable() != 0; + settings.m_swrSource = (LimeRFEController::SWRSource) query.getSwrSource(); controller.settingsToState(settings); diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index ba5186f6a..8d498c26f 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -889,6 +889,8 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigGet( response.setTxCellularChannel((int) settings.m_txCellularChannel); response.setTxPort((int) settings.m_txPort); response.setTxOn(settings.m_txOn ? 1 : 0); + response.setSwrEnable(settings.m_swrEnable ? 1 : 0); + response.setSwrSource((int) settings.m_swrSource); return 200; } @@ -924,6 +926,8 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut( settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel(); settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort(); settings.m_txOn = query.getTxOn() != 0; + settings.m_swrEnable = query.getSwrEnable() != 0; + settings.m_swrSource = (LimeRFEController::SWRSource) query.getSwrSource(); controller.settingsToState(settings); diff --git a/swagger/sdrangel/api/swagger/include/LimeRFE.yaml b/swagger/sdrangel/api/swagger/include/LimeRFE.yaml index 3749d1967..1ce72fecf 100644 --- a/swagger/sdrangel/api/swagger/include/LimeRFE.yaml +++ b/swagger/sdrangel/api/swagger/include/LimeRFE.yaml @@ -40,6 +40,12 @@ LimeRFESettings: txPort: description: Tx port selected (see LimeRFEController.TxPort enumeration) type: integer + swrEnable: + description: Boolean if SWR measurements are enabled else 0 + type: integer + swrSource: + description: SWR measurement source (see LimeRFEController.SWRSource) + type: integer rxOn: description: Boolean 1 if Rx is active else 0 type: integer @@ -51,8 +57,8 @@ LimeRFEPower: description: report of forward and reflected power measurements properties: forward: - description: relative forward power in dB + description: relative forward power in centi-Bels type: integer reflected: - description: relative reflected power in dB + description: relative reflected power in centi-Bels 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 aa9c68a2b..be3e39dfa 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -629,7 +629,7 @@ paths: /sdrangel/limerfe/power: x-swagger-router-controller: instance get: - description: get forward and reflected relative powers in dB + description: get forward and reflected relative powers in centi-Bels operationId: instanceLimeRFEPowerGet tags: - Instance @@ -641,7 +641,7 @@ paths: type: string responses: "200": - description: On success return forward and reflected powers in dB + description: On success return forward and reflected powers in centi-Bels schema: $ref: "http://localhost:8081/api/swagger/include/LimeRFE.yaml#/LimeRFEPower" "400": diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.cpp b/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.cpp index 962a2e7e5..4eb1acdf1 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.cpp @@ -2,7 +2,7 @@ * 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.0.0 + * OpenAPI spec version: 4.12.5 * Contact: f4exb06@gmail.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.h b/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.h index 5f840ed3f..367fd26a8 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.h +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.h @@ -2,7 +2,7 @@ * 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.0.0 + * OpenAPI spec version: 4.12.5 * Contact: f4exb06@gmail.com * * NOTE: This class is auto generated by the swagger code generator program. diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp index b2cff2f68..acf821897 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp @@ -54,6 +54,10 @@ SWGLimeRFESettings::SWGLimeRFESettings() { m_tx_cellular_channel_isSet = false; tx_port = 0; m_tx_port_isSet = false; + swr_enable = 0; + m_swr_enable_isSet = false; + swr_source = 0; + m_swr_source_isSet = false; rx_on = 0; m_rx_on_isSet = false; tx_on = 0; @@ -92,6 +96,10 @@ SWGLimeRFESettings::init() { m_tx_cellular_channel_isSet = false; tx_port = 0; m_tx_port_isSet = false; + swr_enable = 0; + m_swr_enable_isSet = false; + swr_source = 0; + m_swr_source_isSet = false; rx_on = 0; m_rx_on_isSet = false; tx_on = 0; @@ -117,6 +125,8 @@ SWGLimeRFESettings::cleanup() { + + } SWGLimeRFESettings* @@ -156,6 +166,10 @@ SWGLimeRFESettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&tx_port, pJson["txPort"], "qint32", ""); + ::SWGSDRangel::setValue(&swr_enable, pJson["swrEnable"], "qint32", ""); + + ::SWGSDRangel::setValue(&swr_source, pJson["swrSource"], "qint32", ""); + ::SWGSDRangel::setValue(&rx_on, pJson["rxOn"], "qint32", ""); ::SWGSDRangel::setValue(&tx_on, pJson["txOn"], "qint32", ""); @@ -215,6 +229,12 @@ SWGLimeRFESettings::asJsonObject() { if(m_tx_port_isSet){ obj->insert("txPort", QJsonValue(tx_port)); } + if(m_swr_enable_isSet){ + obj->insert("swrEnable", QJsonValue(swr_enable)); + } + if(m_swr_source_isSet){ + obj->insert("swrSource", QJsonValue(swr_source)); + } if(m_rx_on_isSet){ obj->insert("rxOn", QJsonValue(rx_on)); } @@ -355,6 +375,26 @@ SWGLimeRFESettings::setTxPort(qint32 tx_port) { this->m_tx_port_isSet = true; } +qint32 +SWGLimeRFESettings::getSwrEnable() { + return swr_enable; +} +void +SWGLimeRFESettings::setSwrEnable(qint32 swr_enable) { + this->swr_enable = swr_enable; + this->m_swr_enable_isSet = true; +} + +qint32 +SWGLimeRFESettings::getSwrSource() { + return swr_source; +} +void +SWGLimeRFESettings::setSwrSource(qint32 swr_source) { + this->swr_source = swr_source; + this->m_swr_source_isSet = true; +} + qint32 SWGLimeRFESettings::getRxOn() { return rx_on; @@ -419,6 +459,12 @@ SWGLimeRFESettings::isSet(){ if(m_tx_port_isSet){ isObjectUpdated = true; break; } + if(m_swr_enable_isSet){ + isObjectUpdated = true; break; + } + if(m_swr_source_isSet){ + isObjectUpdated = true; break; + } if(m_rx_on_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h index 3bd07de22..05309f8fa 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h @@ -81,6 +81,12 @@ public: qint32 getTxPort(); void setTxPort(qint32 tx_port); + qint32 getSwrEnable(); + void setSwrEnable(qint32 swr_enable); + + qint32 getSwrSource(); + void setSwrSource(qint32 swr_source); + qint32 getRxOn(); void setRxOn(qint32 rx_on); @@ -130,6 +136,12 @@ private: qint32 tx_port; bool m_tx_port_isSet; + qint32 swr_enable; + bool m_swr_enable_isSet; + + qint32 swr_source; + bool m_swr_source_isSet; + qint32 rx_on; bool m_rx_on_isSet;