LimeRFE USB support: REST API: SWR handling fixes

pull/480/head
f4exb 2020-01-15 00:28:25 +01:00
rodzic b5761c8b1d
commit ec25e62de1
13 zmienionych plików z 118 dodań i 14 usunięć

Wyświetl plik

@ -97,11 +97,11 @@ int LimeRFEController::configure()
<< "attValue: " << (int) m_rfeBoardState.attValue << "attValue: " << (int) m_rfeBoardState.attValue
<< "channelIDRX: " << (int) m_rfeBoardState.channelIDRX << "channelIDRX: " << (int) m_rfeBoardState.channelIDRX
<< "channelIDTX: " << (int) m_rfeBoardState.channelIDTX << "channelIDTX: " << (int) m_rfeBoardState.channelIDTX
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
<< "mode: " << (int) m_rfeBoardState.mode << "mode: " << (int) m_rfeBoardState.mode
<< "notchOnOff: " << (int) m_rfeBoardState.notchOnOff << "notchOnOff: " << (int) m_rfeBoardState.notchOnOff
<< "selPortRX: " << (int) m_rfeBoardState.selPortRX << "selPortRX: " << (int) m_rfeBoardState.selPortRX
<< "selPortTX: " << (int) m_rfeBoardState.selPortTX << "selPortTX: " << (int) m_rfeBoardState.selPortTX
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
<< "sourceSWR: " << (int) m_rfeBoardState.sourceSWR; << "sourceSWR: " << (int) m_rfeBoardState.sourceSWR;
int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState); int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState);
@ -127,11 +127,11 @@ int LimeRFEController::getState()
<< "attValue: " << (int) m_rfeBoardState.attValue << "attValue: " << (int) m_rfeBoardState.attValue
<< "channelIDRX: " << (int) m_rfeBoardState.channelIDRX << "channelIDRX: " << (int) m_rfeBoardState.channelIDRX
<< "channelIDTX: " << (int) m_rfeBoardState.channelIDTX << "channelIDTX: " << (int) m_rfeBoardState.channelIDTX
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
<< "mode: " << (int) m_rfeBoardState.mode << "mode: " << (int) m_rfeBoardState.mode
<< "notchOnOff: " << (int) m_rfeBoardState.notchOnOff << "notchOnOff: " << (int) m_rfeBoardState.notchOnOff
<< "selPortRX: " << (int) m_rfeBoardState.selPortRX << "selPortRX: " << (int) m_rfeBoardState.selPortRX
<< "selPortTX: " << (int) m_rfeBoardState.selPortTX << "selPortTX: " << (int) m_rfeBoardState.selPortTX
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
<< "sourceSWR: " << (int) m_rfeBoardState.sourceSWR; << "sourceSWR: " << (int) m_rfeBoardState.sourceSWR;
if (rc != 0) { 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.attValue = settings.m_attenuationFactor < 0 ? 0 : settings.m_attenuationFactor > 7 ? 7 : settings.m_attenuationFactor;
m_rfeBoardState.notchOnOff = settings.m_amfmNotch; m_rfeBoardState.notchOnOff = settings.m_amfmNotch;
m_rfeBoardState.enableSWR = 0; // TODO m_rfeBoardState.enableSWR = settings.m_swrEnable ? RFE_SWR_ENABLE : RFE_SWR_DISABLE;
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_EXT; // TODO
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) void LimeRFEController::stateToSettings(LimeRFESettings& settings)
@ -540,4 +545,7 @@ void LimeRFEController::stateToSettings(LimeRFESettings& settings)
settings.m_rxOn = true; settings.m_rxOn = true;
settings.m_txOn = 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;
} }

Wyświetl plik

@ -73,6 +73,12 @@ public:
TxPortJ5 //!< Rx/Tx HF TxPortJ5 //!< Rx/Tx HF
}; };
enum SWRSource
{
SWRExternal,
SWRCellular
};
struct LimeRFESettings struct LimeRFESettings
{ {
LimeRFESettings(); LimeRFESettings();
@ -90,6 +96,8 @@ public:
LimeRFEController::HAMChannel m_txHAMChannel; LimeRFEController::HAMChannel m_txHAMChannel;
LimeRFEController::CellularChannel m_txCellularChannel; LimeRFEController::CellularChannel m_txCellularChannel;
LimeRFEController::TxPort m_txPort; LimeRFEController::TxPort m_txPort;
bool m_swrEnable;
LimeRFEController::SWRSource m_swrSource;
// Rx/Tx // Rx/Tx
bool m_txRxDriven; //!< Tx settings set according to Rx settings bool m_txRxDriven; //!< Tx settings set according to Rx settings
bool m_rxOn; bool m_rxOn;

Wyświetl plik

@ -40,6 +40,12 @@ LimeRFESettings:
txPort: txPort:
description: Tx port selected (see LimeRFEController.TxPort enumeration) description: Tx port selected (see LimeRFEController.TxPort enumeration)
type: integer 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: rxOn:
description: Boolean 1 if Rx is active else 0 description: Boolean 1 if Rx is active else 0
type: integer type: integer
@ -51,8 +57,8 @@ LimeRFEPower:
description: report of forward and reflected power measurements description: report of forward and reflected power measurements
properties: properties:
forward: forward:
description: relative forward power in dB description: relative forward power in centi-Bels
type: integer type: integer
reflected: reflected:
description: relative reflected power in dB description: relative reflected power in centi-Bels
type: integer type: integer

Wyświetl plik

@ -629,7 +629,7 @@ paths:
/sdrangel/limerfe/power: /sdrangel/limerfe/power:
x-swagger-router-controller: instance x-swagger-router-controller: instance
get: get:
description: get forward and reflected relative powers in dB description: get forward and reflected relative powers in centi-Bels
operationId: instanceLimeRFEPowerGet operationId: instanceLimeRFEPowerGet
tags: tags:
- Instance - Instance
@ -641,7 +641,7 @@ paths:
type: string type: string
responses: responses:
"200": "200":
description: On success return forward and reflected powers description: On success return forward and reflected powers in centi-Bels
schema: schema:
$ref: "/doc/swagger/include/LimeRFE.yaml#/LimeRFEPower" $ref: "/doc/swagger/include/LimeRFE.yaml#/LimeRFEPower"
"400": "400":

Wyświetl plik

@ -2587,6 +2587,16 @@ bool WebAPIRequestMapper::validateLimeRFEConfig(SWGSDRangel::SWGLimeRFESettings&
limeRFESettings.setTxOn(jsonObject["txOn"].toInt()); limeRFESettings.setTxOn(jsonObject["txOn"].toInt());
limeRFESettingsKeys.append("txOn"); 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; return true;
} }

Wyświetl plik

@ -907,6 +907,8 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigGet(
response.setTxCellularChannel((int) settings.m_txCellularChannel); response.setTxCellularChannel((int) settings.m_txCellularChannel);
response.setTxPort((int) settings.m_txPort); response.setTxPort((int) settings.m_txPort);
response.setTxOn(settings.m_txOn ? 1 : 0); response.setTxOn(settings.m_txOn ? 1 : 0);
response.setSwrEnable(settings.m_swrEnable ? 1 : 0);
response.setSwrSource((int) settings.m_swrSource);
return 200; return 200;
} }
@ -942,6 +944,8 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut(
settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel(); settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel();
settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort(); settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort();
settings.m_txOn = query.getTxOn() != 0; settings.m_txOn = query.getTxOn() != 0;
settings.m_swrEnable = query.getSwrEnable() != 0;
settings.m_swrSource = (LimeRFEController::SWRSource) query.getSwrSource();
controller.settingsToState(settings); controller.settingsToState(settings);

Wyświetl plik

@ -889,6 +889,8 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigGet(
response.setTxCellularChannel((int) settings.m_txCellularChannel); response.setTxCellularChannel((int) settings.m_txCellularChannel);
response.setTxPort((int) settings.m_txPort); response.setTxPort((int) settings.m_txPort);
response.setTxOn(settings.m_txOn ? 1 : 0); response.setTxOn(settings.m_txOn ? 1 : 0);
response.setSwrEnable(settings.m_swrEnable ? 1 : 0);
response.setSwrSource((int) settings.m_swrSource);
return 200; return 200;
} }
@ -924,6 +926,8 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut(
settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel(); settings.m_txCellularChannel = (LimeRFEController::CellularChannel) query.getTxCellularChannel();
settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort(); settings.m_txPort = (LimeRFEController::TxPort) query.getTxPort();
settings.m_txOn = query.getTxOn() != 0; settings.m_txOn = query.getTxOn() != 0;
settings.m_swrEnable = query.getSwrEnable() != 0;
settings.m_swrSource = (LimeRFEController::SWRSource) query.getSwrSource();
controller.settingsToState(settings); controller.settingsToState(settings);

Wyświetl plik

@ -40,6 +40,12 @@ LimeRFESettings:
txPort: txPort:
description: Tx port selected (see LimeRFEController.TxPort enumeration) description: Tx port selected (see LimeRFEController.TxPort enumeration)
type: integer 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: rxOn:
description: Boolean 1 if Rx is active else 0 description: Boolean 1 if Rx is active else 0
type: integer type: integer
@ -51,8 +57,8 @@ LimeRFEPower:
description: report of forward and reflected power measurements description: report of forward and reflected power measurements
properties: properties:
forward: forward:
description: relative forward power in dB description: relative forward power in centi-Bels
type: integer type: integer
reflected: reflected:
description: relative reflected power in dB description: relative reflected power in centi-Bels
type: integer type: integer

Wyświetl plik

@ -629,7 +629,7 @@ paths:
/sdrangel/limerfe/power: /sdrangel/limerfe/power:
x-swagger-router-controller: instance x-swagger-router-controller: instance
get: get:
description: get forward and reflected relative powers in dB description: get forward and reflected relative powers in centi-Bels
operationId: instanceLimeRFEPowerGet operationId: instanceLimeRFEPowerGet
tags: tags:
- Instance - Instance
@ -641,7 +641,7 @@ paths:
type: string type: string
responses: responses:
"200": "200":
description: On success return forward and reflected powers in dB description: On success return forward and reflected powers in centi-Bels
schema: schema:
$ref: "http://localhost:8081/api/swagger/include/LimeRFE.yaml#/LimeRFEPower" $ref: "http://localhost:8081/api/swagger/include/LimeRFE.yaml#/LimeRFEPower"
"400": "400":

Wyświetl plik

@ -2,7 +2,7 @@
* SDRangel * 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 --- * 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 * Contact: f4exb06@gmail.com
* *
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.

Wyświetl plik

@ -2,7 +2,7 @@
* SDRangel * 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 --- * 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 * Contact: f4exb06@gmail.com
* *
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.

Wyświetl plik

@ -54,6 +54,10 @@ SWGLimeRFESettings::SWGLimeRFESettings() {
m_tx_cellular_channel_isSet = false; m_tx_cellular_channel_isSet = false;
tx_port = 0; tx_port = 0;
m_tx_port_isSet = false; m_tx_port_isSet = false;
swr_enable = 0;
m_swr_enable_isSet = false;
swr_source = 0;
m_swr_source_isSet = false;
rx_on = 0; rx_on = 0;
m_rx_on_isSet = false; m_rx_on_isSet = false;
tx_on = 0; tx_on = 0;
@ -92,6 +96,10 @@ SWGLimeRFESettings::init() {
m_tx_cellular_channel_isSet = false; m_tx_cellular_channel_isSet = false;
tx_port = 0; tx_port = 0;
m_tx_port_isSet = false; m_tx_port_isSet = false;
swr_enable = 0;
m_swr_enable_isSet = false;
swr_source = 0;
m_swr_source_isSet = false;
rx_on = 0; rx_on = 0;
m_rx_on_isSet = false; m_rx_on_isSet = false;
tx_on = 0; tx_on = 0;
@ -117,6 +125,8 @@ SWGLimeRFESettings::cleanup() {
} }
SWGLimeRFESettings* SWGLimeRFESettings*
@ -156,6 +166,10 @@ SWGLimeRFESettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&tx_port, pJson["txPort"], "qint32", ""); ::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(&rx_on, pJson["rxOn"], "qint32", "");
::SWGSDRangel::setValue(&tx_on, pJson["txOn"], "qint32", ""); ::SWGSDRangel::setValue(&tx_on, pJson["txOn"], "qint32", "");
@ -215,6 +229,12 @@ SWGLimeRFESettings::asJsonObject() {
if(m_tx_port_isSet){ if(m_tx_port_isSet){
obj->insert("txPort", QJsonValue(tx_port)); 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){ if(m_rx_on_isSet){
obj->insert("rxOn", QJsonValue(rx_on)); obj->insert("rxOn", QJsonValue(rx_on));
} }
@ -355,6 +375,26 @@ SWGLimeRFESettings::setTxPort(qint32 tx_port) {
this->m_tx_port_isSet = true; 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 qint32
SWGLimeRFESettings::getRxOn() { SWGLimeRFESettings::getRxOn() {
return rx_on; return rx_on;
@ -419,6 +459,12 @@ SWGLimeRFESettings::isSet(){
if(m_tx_port_isSet){ if(m_tx_port_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(m_swr_enable_isSet){
isObjectUpdated = true; break;
}
if(m_swr_source_isSet){
isObjectUpdated = true; break;
}
if(m_rx_on_isSet){ if(m_rx_on_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }

Wyświetl plik

@ -81,6 +81,12 @@ public:
qint32 getTxPort(); qint32 getTxPort();
void setTxPort(qint32 tx_port); void setTxPort(qint32 tx_port);
qint32 getSwrEnable();
void setSwrEnable(qint32 swr_enable);
qint32 getSwrSource();
void setSwrSource(qint32 swr_source);
qint32 getRxOn(); qint32 getRxOn();
void setRxOn(qint32 rx_on); void setRxOn(qint32 rx_on);
@ -130,6 +136,12 @@ private:
qint32 tx_port; qint32 tx_port;
bool m_tx_port_isSet; bool m_tx_port_isSet;
qint32 swr_enable;
bool m_swr_enable_isSet;
qint32 swr_source;
bool m_swr_source_isSet;
qint32 rx_on; qint32 rx_on;
bool m_rx_on_isSet; bool m_rx_on_isSet;