diff --git a/sdrbase/limerfe/limerfecontroller.cpp b/sdrbase/limerfe/limerfecontroller.cpp index 7e5f65ae6..63f645714 100644 --- a/sdrbase/limerfe/limerfecontroller.cpp +++ b/sdrbase/limerfe/limerfecontroller.cpp @@ -93,10 +93,23 @@ int LimeRFEController::configure() return -1; } + qDebug() << "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 + << "sourceSWR: " << (int) m_rfeBoardState.sourceSWR; + int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState); if (rc != 0) { qInfo("LimeRFEController::configure: %s", getError(rc).c_str()); + } else { + qDebug() << "LimeRFEController::configure: done"; } return rc; @@ -241,6 +254,11 @@ void LimeRFEController::settingsToState(const LimeRFESettings& settings) } else { + m_rfeBoardState.mode = settings.m_rxOn && settings.m_txOn ? + RFE_MODE_TXRX : settings.m_rxOn ? + RFE_MODE_RX : settings.m_txOn ? + RFE_MODE_TX : RFE_MODE_NONE; + if (settings.m_rxChannels == ChannelsWideband) { if (settings.m_rxWidebandChannel == WidebandLow) { @@ -327,6 +345,8 @@ 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 } void LimeRFEController::stateToSettings(LimeRFESettings& settings) diff --git a/sdrbase/resources/webapi/doc/swagger/swagger.yaml b/sdrbase/resources/webapi/doc/swagger/swagger.yaml index e339f261b..d0197c1da 100644 --- a/sdrbase/resources/webapi/doc/swagger/swagger.yaml +++ b/sdrbase/resources/webapi/doc/swagger/swagger.yaml @@ -595,10 +595,6 @@ paths: description: Error schema: $ref: "#/definitions/ErrorResponse" - "404": - description: LimeRFE device not found - schema: - $ref: "#/definitions/ErrorResponse" "500": $ref: "#/responses/Response_500" "501": @@ -627,10 +623,6 @@ paths: description: Error schema: $ref: "#/definitions/ErrorResponse" - "404": - description: LimeRFE device not found - schema: - $ref: "#/definitions/ErrorResponse" "500": $ref: "#/responses/Response_500" "501": diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index ca5400c10..8361ba4c0 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -461,7 +461,7 @@ public: */ virtual int instanceLimeRFEConfigPut( SWGSDRangel::SWGLimeRFESettings& query, - SWGSDRangel::SWGLimeRFESettings& response, + SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { (void) query; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index d7ddfd831..488585c13 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -1011,7 +1011,7 @@ void WebAPIRequestMapper::instanceLimeRFEConfigService(qtwebapp::HttpRequest& re else if (request.getMethod() == "PUT") { SWGSDRangel::SWGLimeRFESettings query; - SWGSDRangel::SWGLimeRFESettings normalResponse; + SWGSDRangel::SWGSuccessResponse normalResponse; QString jsonStr = request.getBody(); QJsonObject jsonObject; diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index 0da0e3bb9..646ca8908 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -842,6 +842,7 @@ int WebAPIAdapterGUI::instanceLimeRFESerialGet( SWGSDRangel::SWGErrorResponse& error) { (void) error; + response.init(); std::vector comPorts; SerialUtil::getComPorts(comPorts, "ttyUSB[0-9]+"); // regex is for Linux only response.setNbDevices((int) comPorts.size()); @@ -911,7 +912,7 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigGet( int WebAPIAdapterGUI::instanceLimeRFEConfigPut( SWGSDRangel::SWGLimeRFESettings& query, - SWGSDRangel::SWGLimeRFESettings& response, + SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { LimeRFEController controller; @@ -931,6 +932,7 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut( settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) query.getRxHamChannel(); settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) query.getRxCellularChannel(); settings.m_rxPort = (LimeRFEController::RxPort) query.getRxPort(); + settings.m_rxOn = query.getRxOn() != 0; settings.m_amfmNotch = query.getAmfmNotch() != 0; settings.m_attenuationFactor = query.getAttenuationFactor(); settings.m_txChannels = (LimeRFEController::ChannelGroups) query.getTxChannels(); @@ -938,14 +940,12 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut( settings.m_txHAMChannel = (LimeRFEController::HAMChannel) query.getTxHamChannel(); settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel(); settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort(); + settings.m_txOn = query.getTxOn() != 0; controller.settingsToState(settings); rc = controller.configure(); - response.init(); - response = query; - if (rc != 0) { error.init(); @@ -954,6 +954,8 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut( return 500; } + response.init(); + *response.getMessage() = QString("LimeRFE device at %1 configuration updated successfully").arg(*query.getDevicePath()); return 200; } @@ -988,6 +990,7 @@ int WebAPIAdapterGUI::instanceLimeRFERunPut( } response.init(); + *response.getMessage() = QString("LimeRFE device at %1 mode updated successfully").arg(*query.getDevicePath()); return 200; } #endif diff --git a/sdrgui/webapi/webapiadaptergui.h b/sdrgui/webapi/webapiadaptergui.h index 03f85e511..1704b7767 100644 --- a/sdrgui/webapi/webapiadaptergui.h +++ b/sdrgui/webapi/webapiadaptergui.h @@ -152,7 +152,7 @@ public: virtual int instanceLimeRFEConfigPut( SWGSDRangel::SWGLimeRFESettings& query, - SWGSDRangel::SWGLimeRFESettings& response, + SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceLimeRFERunPut( diff --git a/sdrsrv/webapi/webapiadaptersrv.cpp b/sdrsrv/webapi/webapiadaptersrv.cpp index 07d0b6ff5..0dd1101b8 100644 --- a/sdrsrv/webapi/webapiadaptersrv.cpp +++ b/sdrsrv/webapi/webapiadaptersrv.cpp @@ -894,7 +894,7 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigGet( int WebAPIAdapterSrv::instanceLimeRFEConfigPut( SWGSDRangel::SWGLimeRFESettings& query, - SWGSDRangel::SWGLimeRFESettings& response, + SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { LimeRFEController controller; @@ -914,6 +914,7 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut( settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) query.getRxHamChannel(); settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) query.getRxCellularChannel(); settings.m_rxPort = (LimeRFEController::RxPort) query.getRxPort(); + settings.m_rxOn = query.getRxOn() != 0; settings.m_amfmNotch = query.getAmfmNotch() != 0; settings.m_attenuationFactor = query.getAttenuationFactor(); settings.m_txChannels = (LimeRFEController::ChannelGroups) query.getTxChannels(); @@ -921,14 +922,12 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut( settings.m_txHAMChannel = (LimeRFEController::HAMChannel) query.getTxHamChannel(); settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel(); settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort(); + settings.m_txOn = query.getTxOn() != 0; controller.settingsToState(settings); rc = controller.configure(); - response.init(); - response = query; - if (rc != 0) { error.init(); @@ -937,6 +936,8 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut( return 500; } + response.init(); + *response.getMessage() = QString("LimeRFE device at %1 configuration updated successfully").arg(*query.getDevicePath()); return 200; } @@ -971,6 +972,7 @@ int WebAPIAdapterSrv::instanceLimeRFERunPut( } response.init(); + *response.getMessage() = QString("LimeRFE device at %1 mode updated successfully").arg(*query.getDevicePath()); return 200; } #endif diff --git a/sdrsrv/webapi/webapiadaptersrv.h b/sdrsrv/webapi/webapiadaptersrv.h index 207b17059..0ff70ec7b 100644 --- a/sdrsrv/webapi/webapiadaptersrv.h +++ b/sdrsrv/webapi/webapiadaptersrv.h @@ -152,7 +152,7 @@ public: virtual int instanceLimeRFEConfigPut( SWGSDRangel::SWGLimeRFESettings& query, - SWGSDRangel::SWGLimeRFESettings& response, + SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error); virtual int instanceLimeRFERunPut( diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 81ca1d306..b51c0eb69 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -595,10 +595,6 @@ paths: description: Error schema: $ref: "#/definitions/ErrorResponse" - "404": - description: LimeRFE device not found - schema: - $ref: "#/definitions/ErrorResponse" "500": $ref: "#/responses/Response_500" "501": @@ -627,10 +623,6 @@ paths: description: Error schema: $ref: "#/definitions/ErrorResponse" - "404": - description: LimeRFE device not found - schema: - $ref: "#/definitions/ErrorResponse" "500": $ref: "#/responses/Response_500" "501":