From ac8a22a94beb159444ec74f14a0bd69d7b735364 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 22 May 2022 19:53:57 +0200 Subject: [PATCH] LimeRFE feature: removed rxOn and txOn from settings --- plugins/feature/limerfe/limerfe.cpp | 98 +++++++++---------- plugins/feature/limerfe/limerfe.h | 8 +- plugins/feature/limerfe/limerfegui.cpp | 74 +++++++++----- plugins/feature/limerfe/limerfegui.h | 2 + plugins/feature/limerfe/limerfesettings.cpp | 6 -- plugins/feature/limerfe/limerfesettings.h | 2 - sdrbase/resources/webapi/doc/html2/index.html | 22 +++-- .../webapi/doc/swagger/include/LimeRFE.yaml | 15 +-- sdrbase/webapi/webapiadapter.cpp | 7 -- sdrbase/webapi/webapirequestmapper.cpp | 10 -- .../sdrangel/api/swagger/include/LimeRFE.yaml | 15 +-- swagger/sdrangel/code/html2/index.html | 22 +++-- .../code/qt5/client/SWGLimeRFEActions.cpp | 23 +++++ .../code/qt5/client/SWGLimeRFEActions.h | 6 ++ .../code/qt5/client/SWGLimeRFEReport.cpp | 46 +++++++++ .../code/qt5/client/SWGLimeRFEReport.h | 12 +++ .../code/qt5/client/SWGLimeRFESettings.cpp | 46 --------- .../code/qt5/client/SWGLimeRFESettings.h | 12 --- 18 files changed, 234 insertions(+), 192 deletions(-) diff --git a/plugins/feature/limerfe/limerfe.cpp b/plugins/feature/limerfe/limerfe.cpp index 4a9c9127a..a8d21dc7e 100644 --- a/plugins/feature/limerfe/limerfe.cpp +++ b/plugins/feature/limerfe/limerfe.cpp @@ -257,6 +257,27 @@ int LimeRFE::getState() qInfo("LimeRFE::getState: %s", getError(rc).c_str()); } + if (m_rfeBoardState.mode == RFE_MODE_RX) + { + m_rxOn = true; + m_txOn = false; + } + else if (m_rfeBoardState.mode == RFE_MODE_TX) + { + m_rxOn = false; + m_txOn = true; + } + else if (m_rfeBoardState.mode == RFE_MODE_NONE) + { + m_rxOn = false; + m_txOn = false; + } + else if (m_rfeBoardState.mode == RFE_MODE_TXRX) + { + m_rxOn = true; + m_txOn = true; + } + return rc; } @@ -271,7 +292,7 @@ std::string LimeRFE::getError(int errorCode) } } -int LimeRFE::setRx(LimeRFESettings& settings, bool rxOn) +int LimeRFE::setRx(bool rxOn) { if (!m_rfeDevice) { return -1; @@ -281,7 +302,7 @@ int LimeRFE::setRx(LimeRFESettings& settings, bool rxOn) if (rxOn) { - if (settings.m_txOn) { + if (m_txOn) { mode = RFE_MODE_TXRX; } else { mode = RFE_MODE_RX; @@ -289,7 +310,7 @@ int LimeRFE::setRx(LimeRFESettings& settings, bool rxOn) } else { - if (settings.m_txOn) { + if (m_txOn) { mode = RFE_MODE_TX; } } @@ -298,7 +319,7 @@ int LimeRFE::setRx(LimeRFESettings& settings, bool rxOn) int rc = RFE_Mode(m_rfeDevice, mode); if (rc == 0) { - settings.m_rxOn = rxOn; + m_rxOn = rxOn; } else { qInfo("LimeRFE::setRx: %s", getError(rc).c_str()); } @@ -306,7 +327,7 @@ int LimeRFE::setRx(LimeRFESettings& settings, bool rxOn) return rc; } -int LimeRFE::setTx(LimeRFESettings& settings, bool txOn) +int LimeRFE::setTx(bool txOn) { if (!m_rfeDevice) { return -1; @@ -316,7 +337,7 @@ int LimeRFE::setTx(LimeRFESettings& settings, bool txOn) if (txOn) { - if (settings.m_rxOn) { + if (m_rxOn) { mode = RFE_MODE_TXRX; } else { mode = RFE_MODE_TX; @@ -324,7 +345,7 @@ int LimeRFE::setTx(LimeRFESettings& settings, bool txOn) } else { - if (settings.m_rxOn) { + if (m_rxOn) { mode = RFE_MODE_RX; } } @@ -333,7 +354,7 @@ int LimeRFE::setTx(LimeRFESettings& settings, bool txOn) int rc = RFE_Mode(m_rfeDevice, mode); if (rc == 0) { - settings.m_txOn = txOn; + m_txOn = txOn; } else { qInfo("LimeRFE::setTx: %s", getError(rc).c_str()); } @@ -433,14 +454,6 @@ void LimeRFE::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 == LimeRFESettings::ChannelGroups::ChannelsWideband) { if (settings.m_rxWidebandChannel == LimeRFESettings::WidebandChannel::WidebandLow) { @@ -716,28 +729,6 @@ void LimeRFE::stateToSettings(LimeRFESettings& settings) settings.m_attenuationFactor = m_rfeBoardState.attValue; settings.m_amfmNotch = m_rfeBoardState.notchOnOff == RFE_NOTCH_ON; - - if (m_rfeBoardState.mode == RFE_MODE_RX) - { - settings.m_rxOn = true; - settings.m_txOn = false; - } - else if (m_rfeBoardState.mode == RFE_MODE_TX) - { - settings.m_rxOn = false; - settings.m_txOn = true; - } - else if (m_rfeBoardState.mode == RFE_MODE_NONE) - { - settings.m_rxOn = false; - settings.m_txOn = false; - } - else if (m_rfeBoardState.mode == RFE_MODE_TXRX) - { - 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 ? LimeRFESettings::SWRSource::SWRCellular : @@ -847,6 +838,18 @@ int LimeRFE::webapiActionsPost( } } + if (featureActionsKeys.contains("getState") && (swgLimeRFEActions->getGetState() != 0)) + { + int rc = getState(); + unknownAction = false; + + if (rc != 0) + { + errorMessage = QString("Get state %1: %2").arg(m_settings.m_devicePath).arg(getError(rc).c_str()); + return 500; + } + } + if (featureActionsKeys.contains("fromToSettings") && (swgLimeRFEActions->getFromToSettings() != 0)) { settingsToState(m_settings); @@ -858,7 +861,7 @@ int LimeRFE::webapiActionsPost( if (channel == 0) { bool on = swgLimeRFEActions->getSwitchChannel() != 0; - int rc = setRx(m_settings, on); + int rc = setRx(on); if (rc != 0) { @@ -868,14 +871,14 @@ int LimeRFE::webapiActionsPost( if (getMessageQueueToGUI()) { - MsgConfigureLimeRFE *msg = MsgConfigureLimeRFE::create(m_settings, false); + MsgReportSetRx *msg = MsgReportSetRx::create(on); getMessageQueueToGUI()->push(msg); } } else { bool on = swgLimeRFEActions->getSwitchChannel() != 0; - int rc = setTx(m_settings, swgLimeRFEActions->getSwitchChannel() != 0); + int rc = setTx(on); if (rc != 0) { @@ -885,7 +888,7 @@ int LimeRFE::webapiActionsPost( if (getMessageQueueToGUI()) { - MsgConfigureLimeRFE *msg = MsgConfigureLimeRFE::create(m_settings, false); + MsgReportSetTx *msg = MsgReportSetTx::create(on); getMessageQueueToGUI()->push(msg); } } @@ -949,7 +952,6 @@ void LimeRFE::webapiFormatFeatureSettings( response.getLimeRfeSettings()->setRxHamChannel((int) settings.m_rxHAMChannel); response.getLimeRfeSettings()->setRxCellularChannel((int) settings.m_rxCellularChannel); response.getLimeRfeSettings()->setRxPort((int) settings.m_rxPort); - response.getLimeRfeSettings()->setRxOn(settings.m_rxOn ? 1 : 0); response.getLimeRfeSettings()->setAmfmNotch(settings.m_amfmNotch ? 1 : 0); response.getLimeRfeSettings()->setAttenuationFactor(settings.m_attenuationFactor); response.getLimeRfeSettings()->setTxChannels((int) settings.m_txChannels); @@ -957,7 +959,6 @@ void LimeRFE::webapiFormatFeatureSettings( response.getLimeRfeSettings()->setTxHamChannel((int) settings.m_txHAMChannel); response.getLimeRfeSettings()->setTxCellularChannel((int) settings.m_txCellularChannel); response.getLimeRfeSettings()->setTxPort((int) settings.m_txPort); - response.getLimeRfeSettings()->setTxOn(settings.m_txOn ? 1 : 0); response.getLimeRfeSettings()->setSwrEnable(settings.m_swrEnable ? 1 : 0); response.getLimeRfeSettings()->setSwrSource((int) settings.m_swrSource); response.getLimeRfeSettings()->setTxRxDriven(settings.m_txRxDriven ? 1 : 0); @@ -1018,9 +1019,6 @@ void LimeRFE::webapiUpdateFeatureSettings( if (featureSettingsKeys.contains("rxPort")) { settings.m_rxPort = (LimeRFESettings::RxPort) response.getLimeRfeSettings()->getRxPort(); } - if (featureSettingsKeys.contains("rxOn")) { - settings.m_rxOn = response.getLimeRfeSettings()->getRxOn() != 0; - } if (featureSettingsKeys.contains("amfmNotch")) { settings.m_amfmNotch = response.getLimeRfeSettings()->getAmfmNotch() != 0; } @@ -1042,9 +1040,6 @@ void LimeRFE::webapiUpdateFeatureSettings( if (featureSettingsKeys.contains("txPort")) { settings.m_txPort = (LimeRFESettings::TxPort) response.getLimeRfeSettings()->getTxPort(); } - if (featureSettingsKeys.contains("txOn")) { - settings.m_txOn = response.getLimeRfeSettings()->getTxOn() != 0; - } if (featureSettingsKeys.contains("swrEnable")) { settings.m_swrEnable = response.getLimeRfeSettings()->getSwrEnable() != 0; } @@ -1076,6 +1071,9 @@ void LimeRFE::webapiUpdateFeatureSettings( int LimeRFE::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response, QString& errorMessage) { + response.getLimeRfeReport()->setRxOn(m_rxOn ? 1 : 0); + response.getLimeRfeReport()->setTxOn(m_txOn ? 1 : 0); + int fwdPower; int rc = getFwdPower(fwdPower); diff --git a/plugins/feature/limerfe/limerfe.h b/plugins/feature/limerfe/limerfe.h index e224fd87a..9f24490bc 100644 --- a/plugins/feature/limerfe/limerfe.h +++ b/plugins/feature/limerfe/limerfe.h @@ -146,8 +146,10 @@ public: int configure(); int getState(); static std::string getError(int errorCode); - int setRx(LimeRFESettings& settings, bool rxOn); - int setTx(LimeRFESettings& settings, bool txOn); + int setRx(bool rxOn); + int setTx(bool txOn); + bool getRx() const { return m_rxOn; }; + bool getTx() const { return m_txOn; }; bool turnDevice(int deviceSetIndex, bool on); int getFwdPower(int& powerDB); int getRefPower(int& powerDB); @@ -161,6 +163,8 @@ public: private: LimeRFESettings m_settings; LimeRFEUSBCalib m_calib; + bool m_rxOn; + bool m_txOn; QNetworkAccessManager *m_networkManager; QNetworkRequest m_networkRequest; diff --git a/plugins/feature/limerfe/limerfegui.cpp b/plugins/feature/limerfe/limerfegui.cpp index 05c5fabe5..32c136820 100644 --- a/plugins/feature/limerfe/limerfegui.cpp +++ b/plugins/feature/limerfe/limerfegui.cpp @@ -128,6 +128,8 @@ LimeRFEGUI::LimeRFEGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature ui(new Ui::LimeRFEGUI), m_pluginAPI(pluginAPI), m_featureUISet(featureUISet), + m_rxOn(false), + m_txOn(false), m_doApplySettings(true), m_rxTxToggle(false), m_currentPowerCorrection(0.0), @@ -200,9 +202,9 @@ void LimeRFEGUI::displayMode() { QString s; - if (m_settings.m_rxOn) + if (m_rxOn) { - if (m_settings.m_txOn) { + if (m_txOn) { s = "Rx/Tx"; } else { s = "Rx"; @@ -210,7 +212,7 @@ void LimeRFEGUI::displayMode() } else { - if (m_settings.m_txOn) { + if (m_txOn) { s = "Tx"; } else { s = "None"; @@ -222,20 +224,20 @@ void LimeRFEGUI::displayMode() ui->modeRx->blockSignals(true); ui->modeTx->blockSignals(true); - if (m_settings.m_rxOn) { + if (m_rxOn) { ui->modeRx->setStyleSheet("QToolButton { background-color : green; }"); } else { ui->modeRx->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); } - if (m_settings.m_txOn) { + if (m_txOn) { ui->modeTx->setStyleSheet("QToolButton { background-color : red; }"); } else { ui->modeTx->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); } - ui->modeRx->setChecked(m_settings.m_rxOn); - ui->modeTx->setChecked(m_settings.m_txOn); + ui->modeRx->setChecked(m_rxOn); + ui->modeTx->setChecked(m_txOn); ui->modeRx->blockSignals(false); ui->modeTx->blockSignals(false); @@ -674,6 +676,8 @@ void LimeRFEGUI::on_deviceToGUI_clicked() } m_limeRFE->stateToSettings(m_settings); + m_rxOn = m_limeRFE->getRx(); + m_txOn = m_limeRFE->getTx(); displaySettings(); highlightApplyButton(false); } @@ -830,14 +834,14 @@ void LimeRFEGUI::on_deviceSetSync_clicked() void LimeRFEGUI::syncRxTx() { - if (!m_settings.m_txOn) { - stopStartTx(m_settings.m_txOn); + if (!m_txOn) { + stopStartTx(m_txOn); } - stopStartRx(m_settings.m_rxOn); + stopStartRx(m_rxOn); - if (m_settings.m_txOn) { - stopStartTx(m_settings.m_txOn); + if (m_txOn) { + stopStartTx(m_txOn); } } @@ -865,30 +869,30 @@ void LimeRFEGUI::on_modeRx_toggled(bool checked) { int rc; ui->statusText->clear(); - m_settings.m_rxOn = checked; + m_rxOn = checked; if (m_rxTxToggle) { - m_settings.m_txOn = !checked; + m_txOn = !checked; if (checked) // Rx on { - rc = m_limeRFE->setTx(m_settings, false); // stop Tx first + rc = m_limeRFE->setTx(false); // stop Tx first ui->statusText->append(QString("Stop TX: %1").arg(m_limeRFE->getError(rc).c_str())); } - rc = m_limeRFE->setRx(m_settings, m_settings.m_rxOn); // Rx on or off + rc = m_limeRFE->setRx(m_rxOn); // Rx on or off ui->statusText->append(QString("RX: %1").arg(m_limeRFE->getError(rc).c_str())); if (!checked) // Rx off { - rc = m_limeRFE->setTx(m_settings, true); // start Tx next + rc = m_limeRFE->setTx(true); // start Tx next ui->statusText->append(QString("Start TX: %1").arg(m_limeRFE->getError(rc).c_str())); } } else { - rc = m_limeRFE->setRx(m_settings, m_settings.m_rxOn); + rc = m_limeRFE->setRx(m_rxOn); ui->statusText->setText(m_limeRFE->getError(rc).c_str()); } @@ -903,30 +907,30 @@ void LimeRFEGUI::on_modeTx_toggled(bool checked) { int rc; ui->statusText->clear(); - m_settings.m_txOn = checked; + m_txOn = checked; if (m_rxTxToggle) { - m_settings.m_rxOn = !checked; + m_rxOn = !checked; if (checked) // Tx on { - rc = m_limeRFE->setRx(m_settings, false); // stop Rx first + rc = m_limeRFE->setRx(false); // stop Rx first ui->statusText->append(QString("Stop RX: %1").arg(m_limeRFE->getError(rc).c_str())); } - rc = m_limeRFE->setTx(m_settings, m_settings.m_txOn); // Tx on or off + rc = m_limeRFE->setTx(m_txOn); // Tx on or off ui->statusText->append(QString("TX: %1").arg(m_limeRFE->getError(rc).c_str())); if (!checked) // Tx off { - rc = m_limeRFE->setRx(m_settings, true); // start Rx next + rc = m_limeRFE->setRx(true); // start Rx next ui->statusText->append(QString("Start RX: %1").arg(m_limeRFE->getError(rc).c_str())); } } else { - rc = m_limeRFE->setTx(m_settings, m_settings.m_txOn); + rc = m_limeRFE->setTx(m_txOn); ui->statusText->setText(m_limeRFE->getError(rc).c_str()); } @@ -941,10 +945,10 @@ void LimeRFEGUI::on_rxTxToggle_clicked() { m_rxTxToggle = ui->rxTxToggle->isChecked(); - if (m_rxTxToggle && m_settings.m_rxOn && m_settings.m_txOn) + if (m_rxTxToggle && m_rxOn && m_txOn) { - m_settings.m_txOn = false; - int rc = m_limeRFE->setTx(m_settings, m_settings.m_txOn); + m_txOn = false; + int rc = m_limeRFE->setTx(m_txOn); ui->statusText->setText(m_limeRFE->getError(rc).c_str()); displayMode(); @@ -991,6 +995,22 @@ bool LimeRFEGUI::handleMessage(const Message& message) highlightApplyButton(cfg.getForce()); return true; } + else if (LimeRFE::MsgReportSetRx::match(message)) + { + bool on = ((LimeRFE::MsgReportSetRx&) message).isOn(); + qDebug("LimeRFEGUI::handleMessage: LimeRFE::MsgReportSetRx: %s", on ? "on" : "off"); + m_rxOn = on; + displaySettings(); + return true; + } + else if (LimeRFE::MsgReportSetTx::match(message)) + { + bool on = ((LimeRFE::MsgReportSetTx&) message).isOn(); + qDebug("LimeRFEGUI::handleMessage: LimeRFE::MsgReportSetTx: %s", on ? "on" : "off"); + m_txOn = on; + displaySettings(); + return true; + } return false; } diff --git a/plugins/feature/limerfe/limerfegui.h b/plugins/feature/limerfe/limerfegui.h index 1d6688aea..f3563b8ea 100644 --- a/plugins/feature/limerfe/limerfegui.h +++ b/plugins/feature/limerfe/limerfegui.h @@ -65,6 +65,8 @@ private: LimeRFESettings m_settings; LimeRFEUSBCalib* m_limeRFEUSBCalib; RollupState m_rollupState; + bool m_rxOn; + bool m_txOn; bool m_doApplySettings; bool m_rxTxToggle; QTimer m_timer; diff --git a/plugins/feature/limerfe/limerfesettings.cpp b/plugins/feature/limerfe/limerfesettings.cpp index e164cc96d..12a87b6fa 100644 --- a/plugins/feature/limerfe/limerfesettings.cpp +++ b/plugins/feature/limerfe/limerfesettings.cpp @@ -48,8 +48,6 @@ void LimeRFESettings::resetToDefaults() m_swrEnable = false; m_swrSource = SWRExternal; m_txRxDriven = false; - m_rxOn = false; - m_txOn = false; m_useReverseAPI = false; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; @@ -79,8 +77,6 @@ QByteArray LimeRFESettings::serialize() const s.writeS32(16, (int) m_swrSource); s.writeBool(20, m_txRxDriven); - s.writeBool(21, m_rxOn); - s.writeBool(22, m_txOn); s.writeString(30, m_title); s.writeU32(31, m_rgbColor); @@ -145,8 +141,6 @@ bool LimeRFESettings::deserialize(const QByteArray& data) m_swrSource = (SWRSource) tmp; d.readBool(20, &m_txRxDriven, false); - d.readBool(21, &m_rxOn, false); - d.readBool(22, &m_txOn, false); d.readString(30, &m_title, "Lime RFE"); d.readU32(31, &m_rgbColor, QColor(50, 205, 50).rgb()); diff --git a/plugins/feature/limerfe/limerfesettings.h b/plugins/feature/limerfe/limerfesettings.h index 9e3a98180..2e29381b5 100644 --- a/plugins/feature/limerfe/limerfesettings.h +++ b/plugins/feature/limerfe/limerfesettings.h @@ -97,8 +97,6 @@ struct LimeRFESettings SWRSource m_swrSource; // Rx/Tx bool m_txRxDriven; //!< Tx settings set according to Rx settings - bool m_rxOn; - bool m_txOn; // Common QString m_devicePath; QString m_title; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 7e220ddf6..423a2de1f 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -7092,6 +7092,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "Switch on or off\n * 0 - Off\n * 1 - On\n" }, + "getState" : { + "type" : "integer", + "description" : "Set to non zero value to get the board state" + }, "fromToSettings" : { "type" : "integer", "description" : "Move from/to settings to/from device\n * 0 - From device to settings. The toGUI button in GUI mode\n * 1 - From settings to device. The Apply button in GUI mode\n" @@ -7144,6 +7148,14 @@ margin-bottom: 20px; }; defs.LimeRFEReport = { "properties" : { + "rxOn" : { + "type" : "integer", + "description" : "Boolean 1 if Rx is active else 0" + }, + "txOn" : { + "type" : "integer", + "description" : "Boolean 1 if Tx is active else 0" + }, "forwardPower" : { "type" : "integer", "description" : "relative forward power in centi-Bels" @@ -7226,14 +7238,6 @@ margin-bottom: 20px; "type" : "integer", "description" : "Boolean 1 if Tx is copy of Rx else 0" }, - "rxOn" : { - "type" : "integer", - "description" : "Boolean 1 if Rx is active else 0" - }, - "txOn" : { - "type" : "integer", - "description" : "Boolean 1 if Tx is active else 0" - }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -59773,7 +59777,7 @@ except ApiException as e:
- Generated 2022-05-21T22:11:42.796+02:00 + Generated 2022-05-22T12:29:41.738+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml b/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml index 81c17aa87..bee219f91 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/LimeRFE.yaml @@ -109,12 +109,6 @@ LimeRFESettings: txRxDriven: description: Boolean 1 if Tx is copy of Rx else 0 type: integer - rxOn: - description: Boolean 1 if Rx is active else 0 - type: integer - txOn: - description: Boolean 1 if Tx is active else 0 - type: integer useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer @@ -132,6 +126,12 @@ LimeRFESettings: LimeRFEReport: description: LimeRFE properties: + rxOn: + description: Boolean 1 if Rx is active else 0 + type: integer + txOn: + description: Boolean 1 if Tx is active else 0 + type: integer forwardPower: description: relative forward power in centi-Bels type: integer @@ -157,6 +157,9 @@ LimeRFEActions: Switch on or off * 0 - Off * 1 - On + getState: + type: integer + description: Set to non zero value to get the board state fromToSettings: type: integer description: > diff --git a/sdrbase/webapi/webapiadapter.cpp b/sdrbase/webapi/webapiadapter.cpp index ea5885018..ff92d1761 100644 --- a/sdrbase/webapi/webapiadapter.cpp +++ b/sdrbase/webapi/webapiadapter.cpp @@ -995,7 +995,6 @@ int WebAPIAdapter::instanceLimeRFEConfigGet( response.setRxHamChannel((int) settings.m_rxHAMChannel); response.setRxCellularChannel((int) settings.m_rxCellularChannel); response.setRxPort((int) settings.m_rxPort); - response.setRxOn(settings.m_rxOn ? 1 : 0); response.setAmfmNotch(settings.m_amfmNotch ? 1 : 0); response.setAttenuationFactor(settings.m_attenuationFactor); response.setTxChannels((int) settings.m_txChannels); @@ -1003,7 +1002,6 @@ int WebAPIAdapter::instanceLimeRFEConfigGet( response.setTxHamChannel((int) settings.m_txHAMChannel); 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); @@ -1032,7 +1030,6 @@ int WebAPIAdapter::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(); @@ -1040,7 +1037,6 @@ int WebAPIAdapter::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; settings.m_swrEnable = query.getSwrEnable() != 0; settings.m_swrSource = (LimeRFEController::SWRSource) query.getSwrSource(); @@ -1078,9 +1074,6 @@ int WebAPIAdapter::instanceLimeRFERunPut( } LimeRFEController::LimeRFESettings settings; - settings.m_rxOn = query.getRxOn() != 0; - settings.m_txOn = query.getTxOn() != 0; - rc = controller.setRx(settings, settings.m_rxOn); if (rc != 0) diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 5df2a6e71..edfb00858 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -4371,16 +4371,6 @@ bool WebAPIRequestMapper::validateLimeRFEConfig(SWGSDRangel::SWGLimeRFESettings& limeRFESettings.setTxPort(jsonObject["txPort"].toInt()); limeRFESettingsKeys.append("txPort"); } - if (jsonObject.contains("rxOn")) - { - limeRFESettings.setRxOn(jsonObject["rxOn"].toInt()); - limeRFESettingsKeys.append("rxOn"); - } - if (jsonObject.contains("txOn")) - { - limeRFESettings.setTxOn(jsonObject["txOn"].toInt()); - limeRFESettingsKeys.append("txOn"); - } if (jsonObject.contains("swrEnable")) { limeRFESettings.setSwrEnable(jsonObject["swrEnable"].toInt()); diff --git a/swagger/sdrangel/api/swagger/include/LimeRFE.yaml b/swagger/sdrangel/api/swagger/include/LimeRFE.yaml index 06fc4e70f..f8c0bebf0 100644 --- a/swagger/sdrangel/api/swagger/include/LimeRFE.yaml +++ b/swagger/sdrangel/api/swagger/include/LimeRFE.yaml @@ -109,12 +109,6 @@ LimeRFESettings: txRxDriven: description: Boolean 1 if Tx is copy of Rx else 0 type: integer - rxOn: - description: Boolean 1 if Rx is active else 0 - type: integer - txOn: - description: Boolean 1 if Tx is active else 0 - type: integer useReverseAPI: description: Synchronize with reverse API (1 for yes, 0 for no) type: integer @@ -132,6 +126,12 @@ LimeRFESettings: LimeRFEReport: description: LimeRFE properties: + rxOn: + description: Boolean 1 if Rx is active else 0 + type: integer + txOn: + description: Boolean 1 if Tx is active else 0 + type: integer forwardPower: description: relative forward power in centi-Bels type: integer @@ -157,6 +157,9 @@ LimeRFEActions: Switch on or off * 0 - Off * 1 - On + getState: + type: integer + description: Set to non zero value to get the board state fromToSettings: type: integer description: > diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 7e220ddf6..423a2de1f 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -7092,6 +7092,10 @@ margin-bottom: 20px; "type" : "integer", "description" : "Switch on or off\n * 0 - Off\n * 1 - On\n" }, + "getState" : { + "type" : "integer", + "description" : "Set to non zero value to get the board state" + }, "fromToSettings" : { "type" : "integer", "description" : "Move from/to settings to/from device\n * 0 - From device to settings. The toGUI button in GUI mode\n * 1 - From settings to device. The Apply button in GUI mode\n" @@ -7144,6 +7148,14 @@ margin-bottom: 20px; }; defs.LimeRFEReport = { "properties" : { + "rxOn" : { + "type" : "integer", + "description" : "Boolean 1 if Rx is active else 0" + }, + "txOn" : { + "type" : "integer", + "description" : "Boolean 1 if Tx is active else 0" + }, "forwardPower" : { "type" : "integer", "description" : "relative forward power in centi-Bels" @@ -7226,14 +7238,6 @@ margin-bottom: 20px; "type" : "integer", "description" : "Boolean 1 if Tx is copy of Rx else 0" }, - "rxOn" : { - "type" : "integer", - "description" : "Boolean 1 if Rx is active else 0" - }, - "txOn" : { - "type" : "integer", - "description" : "Boolean 1 if Tx is active else 0" - }, "useReverseAPI" : { "type" : "integer", "description" : "Synchronize with reverse API (1 for yes, 0 for no)" @@ -59773,7 +59777,7 @@ except ApiException as e:
- Generated 2022-05-21T22:11:42.796+02:00 + Generated 2022-05-22T12:29:41.738+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.cpp b/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.cpp index 9484cf862..0ca4f36b8 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.cpp @@ -34,6 +34,8 @@ SWGLimeRFEActions::SWGLimeRFEActions() { m_device_set_index_isSet = false; switch_channel = 0; m_switch_channel_isSet = false; + get_state = 0; + m_get_state_isSet = false; from_to_settings = 0; m_from_to_settings_isSet = false; open_close_device = 0; @@ -52,6 +54,8 @@ SWGLimeRFEActions::init() { m_device_set_index_isSet = false; switch_channel = 0; m_switch_channel_isSet = false; + get_state = 0; + m_get_state_isSet = false; from_to_settings = 0; m_from_to_settings_isSet = false; open_close_device = 0; @@ -65,6 +69,7 @@ SWGLimeRFEActions::cleanup() { + } SWGLimeRFEActions* @@ -84,6 +89,8 @@ SWGLimeRFEActions::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&switch_channel, pJson["switchChannel"], "qint32", ""); + ::SWGSDRangel::setValue(&get_state, pJson["getState"], "qint32", ""); + ::SWGSDRangel::setValue(&from_to_settings, pJson["fromToSettings"], "qint32", ""); ::SWGSDRangel::setValue(&open_close_device, pJson["openCloseDevice"], "qint32", ""); @@ -113,6 +120,9 @@ SWGLimeRFEActions::asJsonObject() { if(m_switch_channel_isSet){ obj->insert("switchChannel", QJsonValue(switch_channel)); } + if(m_get_state_isSet){ + obj->insert("getState", QJsonValue(get_state)); + } if(m_from_to_settings_isSet){ obj->insert("fromToSettings", QJsonValue(from_to_settings)); } @@ -153,6 +163,16 @@ SWGLimeRFEActions::setSwitchChannel(qint32 switch_channel) { this->m_switch_channel_isSet = true; } +qint32 +SWGLimeRFEActions::getGetState() { + return get_state; +} +void +SWGLimeRFEActions::setGetState(qint32 get_state) { + this->get_state = get_state; + this->m_get_state_isSet = true; +} + qint32 SWGLimeRFEActions::getFromToSettings() { return from_to_settings; @@ -187,6 +207,9 @@ SWGLimeRFEActions::isSet(){ if(m_switch_channel_isSet){ isObjectUpdated = true; break; } + if(m_get_state_isSet){ + isObjectUpdated = true; break; + } if(m_from_to_settings_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.h b/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.h index 29fa4c518..74e1dc096 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.h +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFEActions.h @@ -50,6 +50,9 @@ public: qint32 getSwitchChannel(); void setSwitchChannel(qint32 switch_channel); + qint32 getGetState(); + void setGetState(qint32 get_state); + qint32 getFromToSettings(); void setFromToSettings(qint32 from_to_settings); @@ -69,6 +72,9 @@ private: qint32 switch_channel; bool m_switch_channel_isSet; + qint32 get_state; + bool m_get_state_isSet; + qint32 from_to_settings; bool m_from_to_settings_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.cpp b/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.cpp index 9df562a65..1b2078baa 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.cpp @@ -28,6 +28,10 @@ SWGLimeRFEReport::SWGLimeRFEReport(QString* json) { } SWGLimeRFEReport::SWGLimeRFEReport() { + rx_on = 0; + m_rx_on_isSet = false; + tx_on = 0; + m_tx_on_isSet = false; forward_power = 0; m_forward_power_isSet = false; reflected_power = 0; @@ -40,6 +44,10 @@ SWGLimeRFEReport::~SWGLimeRFEReport() { void SWGLimeRFEReport::init() { + rx_on = 0; + m_rx_on_isSet = false; + tx_on = 0; + m_tx_on_isSet = false; forward_power = 0; m_forward_power_isSet = false; reflected_power = 0; @@ -50,6 +58,8 @@ void SWGLimeRFEReport::cleanup() { + + } SWGLimeRFEReport* @@ -63,6 +73,10 @@ SWGLimeRFEReport::fromJson(QString &json) { void SWGLimeRFEReport::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&rx_on, pJson["rxOn"], "qint32", ""); + + ::SWGSDRangel::setValue(&tx_on, pJson["txOn"], "qint32", ""); + ::SWGSDRangel::setValue(&forward_power, pJson["forwardPower"], "qint32", ""); ::SWGSDRangel::setValue(&reflected_power, pJson["reflectedPower"], "qint32", ""); @@ -83,6 +97,12 @@ SWGLimeRFEReport::asJson () QJsonObject* SWGLimeRFEReport::asJsonObject() { QJsonObject* obj = new QJsonObject(); + if(m_rx_on_isSet){ + obj->insert("rxOn", QJsonValue(rx_on)); + } + if(m_tx_on_isSet){ + obj->insert("txOn", QJsonValue(tx_on)); + } if(m_forward_power_isSet){ obj->insert("forwardPower", QJsonValue(forward_power)); } @@ -93,6 +113,26 @@ SWGLimeRFEReport::asJsonObject() { return obj; } +qint32 +SWGLimeRFEReport::getRxOn() { + return rx_on; +} +void +SWGLimeRFEReport::setRxOn(qint32 rx_on) { + this->rx_on = rx_on; + this->m_rx_on_isSet = true; +} + +qint32 +SWGLimeRFEReport::getTxOn() { + return tx_on; +} +void +SWGLimeRFEReport::setTxOn(qint32 tx_on) { + this->tx_on = tx_on; + this->m_tx_on_isSet = true; +} + qint32 SWGLimeRFEReport::getForwardPower() { return forward_power; @@ -118,6 +158,12 @@ bool SWGLimeRFEReport::isSet(){ bool isObjectUpdated = false; do{ + if(m_rx_on_isSet){ + isObjectUpdated = true; break; + } + if(m_tx_on_isSet){ + isObjectUpdated = true; break; + } if(m_forward_power_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.h b/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.h index 6929fdf4f..49006caba 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFEReport.h @@ -41,6 +41,12 @@ public: virtual void fromJsonObject(QJsonObject &json) override; virtual SWGLimeRFEReport* fromJson(QString &jsonString) override; + qint32 getRxOn(); + void setRxOn(qint32 rx_on); + + qint32 getTxOn(); + void setTxOn(qint32 tx_on); + qint32 getForwardPower(); void setForwardPower(qint32 forward_power); @@ -51,6 +57,12 @@ public: virtual bool isSet() override; private: + qint32 rx_on; + bool m_rx_on_isSet; + + qint32 tx_on; + bool m_tx_on_isSet; + qint32 forward_power; bool m_forward_power_isSet; diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp index c0e0e1098..cce21df5c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.cpp @@ -64,10 +64,6 @@ SWGLimeRFESettings::SWGLimeRFESettings() { m_swr_source_isSet = false; tx_rx_driven = 0; m_tx_rx_driven_isSet = false; - rx_on = 0; - m_rx_on_isSet = false; - tx_on = 0; - m_tx_on_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = nullptr; @@ -124,10 +120,6 @@ SWGLimeRFESettings::init() { m_swr_source_isSet = false; tx_rx_driven = 0; m_tx_rx_driven_isSet = false; - rx_on = 0; - m_rx_on_isSet = false; - tx_on = 0; - m_tx_on_isSet = false; use_reverse_api = 0; m_use_reverse_api_isSet = false; reverse_api_address = new QString(""); @@ -167,8 +159,6 @@ SWGLimeRFESettings::cleanup() { - - if(reverse_api_address != nullptr) { delete reverse_api_address; } @@ -227,10 +217,6 @@ SWGLimeRFESettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&tx_rx_driven, pJson["txRxDriven"], "qint32", ""); - ::SWGSDRangel::setValue(&rx_on, pJson["rxOn"], "qint32", ""); - - ::SWGSDRangel::setValue(&tx_on, pJson["txOn"], "qint32", ""); - ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString"); @@ -313,12 +299,6 @@ SWGLimeRFESettings::asJsonObject() { if(m_tx_rx_driven_isSet){ obj->insert("txRxDriven", QJsonValue(tx_rx_driven)); } - if(m_rx_on_isSet){ - obj->insert("rxOn", QJsonValue(rx_on)); - } - if(m_tx_on_isSet){ - obj->insert("txOn", QJsonValue(tx_on)); - } if(m_use_reverse_api_isSet){ obj->insert("useReverseAPI", QJsonValue(use_reverse_api)); } @@ -521,26 +501,6 @@ SWGLimeRFESettings::setTxRxDriven(qint32 tx_rx_driven) { this->m_tx_rx_driven_isSet = true; } -qint32 -SWGLimeRFESettings::getRxOn() { - return rx_on; -} -void -SWGLimeRFESettings::setRxOn(qint32 rx_on) { - this->rx_on = rx_on; - this->m_rx_on_isSet = true; -} - -qint32 -SWGLimeRFESettings::getTxOn() { - return tx_on; -} -void -SWGLimeRFESettings::setTxOn(qint32 tx_on) { - this->tx_on = tx_on; - this->m_tx_on_isSet = true; -} - qint32 SWGLimeRFESettings::getUseReverseApi() { return use_reverse_api; @@ -660,12 +620,6 @@ SWGLimeRFESettings::isSet(){ if(m_tx_rx_driven_isSet){ isObjectUpdated = true; break; } - if(m_rx_on_isSet){ - isObjectUpdated = true; break; - } - if(m_tx_on_isSet){ - isObjectUpdated = true; break; - } if(m_use_reverse_api_isSet){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h index e947fead1..a36df8076 100644 --- a/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGLimeRFESettings.h @@ -97,12 +97,6 @@ public: qint32 getTxRxDriven(); void setTxRxDriven(qint32 tx_rx_driven); - qint32 getRxOn(); - void setRxOn(qint32 rx_on); - - qint32 getTxOn(); - void setTxOn(qint32 tx_on); - qint32 getUseReverseApi(); void setUseReverseApi(qint32 use_reverse_api); @@ -179,12 +173,6 @@ private: qint32 tx_rx_driven; bool m_tx_rx_driven_isSet; - qint32 rx_on; - bool m_rx_on_isSet; - - qint32 tx_on; - bool m_tx_on_isSet; - qint32 use_reverse_api; bool m_use_reverse_api_isSet;