mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
LimeRFE USB support: REST API: implemented power API
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGLimeRFEDevices.h"
|
||||
#include "SWGLimeRFESettings.h"
|
||||
#include "SWGLimeRFEPower.h"
|
||||
|
||||
#ifdef HAS_LIMERFE
|
||||
#include "limerfe/limerfecontroller.h"
|
||||
@@ -993,6 +994,52 @@ int WebAPIAdapterGUI::instanceLimeRFERunPut(
|
||||
*response.getMessage() = QString("LimeRFE device at %1 mode updated successfully").arg(*query.getDevicePath());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::instanceLimeRFEPowerGet(
|
||||
const QString& serial,
|
||||
SWGSDRangel::SWGLimeRFEPower& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
LimeRFEController controller;
|
||||
int rc = controller.openDevice(serial.toStdString());
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Error opening LimeRFE device %1: %2")
|
||||
.arg(serial).arg(controller.getError(rc).c_str());
|
||||
return 400;
|
||||
}
|
||||
|
||||
int fwdPower;
|
||||
rc = controller.getFwdPower(fwdPower);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Error getting forward power from LimeRFE device %1: %2")
|
||||
.arg(serial).arg(controller.getError(rc).c_str());
|
||||
return 500;
|
||||
}
|
||||
|
||||
int refPower;
|
||||
rc = controller.getRefPower(refPower);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Error getting reflected power from LimeRFE device %1: %2")
|
||||
.arg(serial).arg(controller.getError(rc).c_str());
|
||||
return 500;
|
||||
}
|
||||
|
||||
controller.closeDevice();
|
||||
|
||||
response.init();
|
||||
response.setForward(fwdPower);
|
||||
response.setReflected(refPower);
|
||||
return 200;
|
||||
}
|
||||
#endif
|
||||
|
||||
int WebAPIAdapterGUI::instancePresetsGet(
|
||||
|
||||
Reference in New Issue
Block a user