mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-24 03:02:29 -04:00
LimeRFE USB support: REST API fixes
This commit is contained in:
parent
d83da57a1e
commit
17d109b78b
@ -93,10 +93,23 @@ int LimeRFEController::configure()
|
|||||||
return -1;
|
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);
|
int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState);
|
||||||
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
qInfo("LimeRFEController::configure: %s", getError(rc).c_str());
|
qInfo("LimeRFEController::configure: %s", getError(rc).c_str());
|
||||||
|
} else {
|
||||||
|
qDebug() << "LimeRFEController::configure: done";
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -241,6 +254,11 @@ void LimeRFEController::settingsToState(const LimeRFESettings& settings)
|
|||||||
}
|
}
|
||||||
else
|
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_rxChannels == ChannelsWideband)
|
||||||
{
|
{
|
||||||
if (settings.m_rxWidebandChannel == WidebandLow) {
|
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.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.sourceSWR = RFE_SWR_SRC_EXT; // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeRFEController::stateToSettings(LimeRFESettings& settings)
|
void LimeRFEController::stateToSettings(LimeRFESettings& settings)
|
||||||
|
@ -595,10 +595,6 @@ paths:
|
|||||||
description: Error
|
description: Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
|
||||||
description: LimeRFE device not found
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/ErrorResponse"
|
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/Response_500"
|
$ref: "#/responses/Response_500"
|
||||||
"501":
|
"501":
|
||||||
@ -627,10 +623,6 @@ paths:
|
|||||||
description: Error
|
description: Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
|
||||||
description: LimeRFE device not found
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/ErrorResponse"
|
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/Response_500"
|
$ref: "#/responses/Response_500"
|
||||||
"501":
|
"501":
|
||||||
|
@ -461,7 +461,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual int instanceLimeRFEConfigPut(
|
virtual int instanceLimeRFEConfigPut(
|
||||||
SWGSDRangel::SWGLimeRFESettings& query,
|
SWGSDRangel::SWGLimeRFESettings& query,
|
||||||
SWGSDRangel::SWGLimeRFESettings& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error)
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
{
|
{
|
||||||
(void) query;
|
(void) query;
|
||||||
|
@ -1011,7 +1011,7 @@ void WebAPIRequestMapper::instanceLimeRFEConfigService(qtwebapp::HttpRequest& re
|
|||||||
else if (request.getMethod() == "PUT")
|
else if (request.getMethod() == "PUT")
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGLimeRFESettings query;
|
SWGSDRangel::SWGLimeRFESettings query;
|
||||||
SWGSDRangel::SWGLimeRFESettings normalResponse;
|
SWGSDRangel::SWGSuccessResponse normalResponse;
|
||||||
QString jsonStr = request.getBody();
|
QString jsonStr = request.getBody();
|
||||||
QJsonObject jsonObject;
|
QJsonObject jsonObject;
|
||||||
|
|
||||||
|
@ -842,6 +842,7 @@ int WebAPIAdapterGUI::instanceLimeRFESerialGet(
|
|||||||
SWGSDRangel::SWGErrorResponse& error)
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
{
|
{
|
||||||
(void) error;
|
(void) error;
|
||||||
|
response.init();
|
||||||
std::vector<std::string> comPorts;
|
std::vector<std::string> comPorts;
|
||||||
SerialUtil::getComPorts(comPorts, "ttyUSB[0-9]+"); // regex is for Linux only
|
SerialUtil::getComPorts(comPorts, "ttyUSB[0-9]+"); // regex is for Linux only
|
||||||
response.setNbDevices((int) comPorts.size());
|
response.setNbDevices((int) comPorts.size());
|
||||||
@ -911,7 +912,7 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigGet(
|
|||||||
|
|
||||||
int WebAPIAdapterGUI::instanceLimeRFEConfigPut(
|
int WebAPIAdapterGUI::instanceLimeRFEConfigPut(
|
||||||
SWGSDRangel::SWGLimeRFESettings& query,
|
SWGSDRangel::SWGLimeRFESettings& query,
|
||||||
SWGSDRangel::SWGLimeRFESettings& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error)
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
{
|
{
|
||||||
LimeRFEController controller;
|
LimeRFEController controller;
|
||||||
@ -931,6 +932,7 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut(
|
|||||||
settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) query.getRxHamChannel();
|
settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) query.getRxHamChannel();
|
||||||
settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) query.getRxCellularChannel();
|
settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) query.getRxCellularChannel();
|
||||||
settings.m_rxPort = (LimeRFEController::RxPort) query.getRxPort();
|
settings.m_rxPort = (LimeRFEController::RxPort) query.getRxPort();
|
||||||
|
settings.m_rxOn = query.getRxOn() != 0;
|
||||||
settings.m_amfmNotch = query.getAmfmNotch() != 0;
|
settings.m_amfmNotch = query.getAmfmNotch() != 0;
|
||||||
settings.m_attenuationFactor = query.getAttenuationFactor();
|
settings.m_attenuationFactor = query.getAttenuationFactor();
|
||||||
settings.m_txChannels = (LimeRFEController::ChannelGroups) query.getTxChannels();
|
settings.m_txChannels = (LimeRFEController::ChannelGroups) query.getTxChannels();
|
||||||
@ -938,14 +940,12 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut(
|
|||||||
settings.m_txHAMChannel = (LimeRFEController::HAMChannel) query.getTxHamChannel();
|
settings.m_txHAMChannel = (LimeRFEController::HAMChannel) query.getTxHamChannel();
|
||||||
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;
|
||||||
|
|
||||||
controller.settingsToState(settings);
|
controller.settingsToState(settings);
|
||||||
|
|
||||||
rc = controller.configure();
|
rc = controller.configure();
|
||||||
|
|
||||||
response.init();
|
|
||||||
response = query;
|
|
||||||
|
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
{
|
{
|
||||||
error.init();
|
error.init();
|
||||||
@ -954,6 +954,8 @@ int WebAPIAdapterGUI::instanceLimeRFEConfigPut(
|
|||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
response.init();
|
||||||
|
*response.getMessage() = QString("LimeRFE device at %1 configuration updated successfully").arg(*query.getDevicePath());
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -988,6 +990,7 @@ int WebAPIAdapterGUI::instanceLimeRFERunPut(
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.init();
|
response.init();
|
||||||
|
*response.getMessage() = QString("LimeRFE device at %1 mode updated successfully").arg(*query.getDevicePath());
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -152,7 +152,7 @@ public:
|
|||||||
|
|
||||||
virtual int instanceLimeRFEConfigPut(
|
virtual int instanceLimeRFEConfigPut(
|
||||||
SWGSDRangel::SWGLimeRFESettings& query,
|
SWGSDRangel::SWGLimeRFESettings& query,
|
||||||
SWGSDRangel::SWGLimeRFESettings& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error);
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
virtual int instanceLimeRFERunPut(
|
virtual int instanceLimeRFERunPut(
|
||||||
|
@ -894,7 +894,7 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigGet(
|
|||||||
|
|
||||||
int WebAPIAdapterSrv::instanceLimeRFEConfigPut(
|
int WebAPIAdapterSrv::instanceLimeRFEConfigPut(
|
||||||
SWGSDRangel::SWGLimeRFESettings& query,
|
SWGSDRangel::SWGLimeRFESettings& query,
|
||||||
SWGSDRangel::SWGLimeRFESettings& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error)
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
{
|
{
|
||||||
LimeRFEController controller;
|
LimeRFEController controller;
|
||||||
@ -914,6 +914,7 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut(
|
|||||||
settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) query.getRxHamChannel();
|
settings.m_rxHAMChannel = (LimeRFEController::HAMChannel) query.getRxHamChannel();
|
||||||
settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) query.getRxCellularChannel();
|
settings.m_rxCellularChannel = (LimeRFEController::CellularChannel) query.getRxCellularChannel();
|
||||||
settings.m_rxPort = (LimeRFEController::RxPort) query.getRxPort();
|
settings.m_rxPort = (LimeRFEController::RxPort) query.getRxPort();
|
||||||
|
settings.m_rxOn = query.getRxOn() != 0;
|
||||||
settings.m_amfmNotch = query.getAmfmNotch() != 0;
|
settings.m_amfmNotch = query.getAmfmNotch() != 0;
|
||||||
settings.m_attenuationFactor = query.getAttenuationFactor();
|
settings.m_attenuationFactor = query.getAttenuationFactor();
|
||||||
settings.m_txChannels = (LimeRFEController::ChannelGroups) query.getTxChannels();
|
settings.m_txChannels = (LimeRFEController::ChannelGroups) query.getTxChannels();
|
||||||
@ -921,14 +922,12 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut(
|
|||||||
settings.m_txHAMChannel = (LimeRFEController::HAMChannel) query.getTxHamChannel();
|
settings.m_txHAMChannel = (LimeRFEController::HAMChannel) query.getTxHamChannel();
|
||||||
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;
|
||||||
|
|
||||||
controller.settingsToState(settings);
|
controller.settingsToState(settings);
|
||||||
|
|
||||||
rc = controller.configure();
|
rc = controller.configure();
|
||||||
|
|
||||||
response.init();
|
|
||||||
response = query;
|
|
||||||
|
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
{
|
{
|
||||||
error.init();
|
error.init();
|
||||||
@ -937,6 +936,8 @@ int WebAPIAdapterSrv::instanceLimeRFEConfigPut(
|
|||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
response.init();
|
||||||
|
*response.getMessage() = QString("LimeRFE device at %1 configuration updated successfully").arg(*query.getDevicePath());
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,6 +972,7 @@ int WebAPIAdapterSrv::instanceLimeRFERunPut(
|
|||||||
}
|
}
|
||||||
|
|
||||||
response.init();
|
response.init();
|
||||||
|
*response.getMessage() = QString("LimeRFE device at %1 mode updated successfully").arg(*query.getDevicePath());
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -152,7 +152,7 @@ public:
|
|||||||
|
|
||||||
virtual int instanceLimeRFEConfigPut(
|
virtual int instanceLimeRFEConfigPut(
|
||||||
SWGSDRangel::SWGLimeRFESettings& query,
|
SWGSDRangel::SWGLimeRFESettings& query,
|
||||||
SWGSDRangel::SWGLimeRFESettings& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error);
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
virtual int instanceLimeRFERunPut(
|
virtual int instanceLimeRFERunPut(
|
||||||
|
@ -595,10 +595,6 @@ paths:
|
|||||||
description: Error
|
description: Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
|
||||||
description: LimeRFE device not found
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/ErrorResponse"
|
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/Response_500"
|
$ref: "#/responses/Response_500"
|
||||||
"501":
|
"501":
|
||||||
@ -627,10 +623,6 @@ paths:
|
|||||||
description: Error
|
description: Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
|
||||||
description: LimeRFE device not found
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/ErrorResponse"
|
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/responses/Response_500"
|
$ref: "#/responses/Response_500"
|
||||||
"501":
|
"501":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user