mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-23 18:52:28 -04:00
LimeRFE USB support: REST API: implemented power API
This commit is contained in:
parent
9bb0435f42
commit
b5761c8b1d
@ -192,33 +192,33 @@ int LimeRFEController::setTx(LimeRFESettings& settings, bool txOn)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFEController::driveTx(LimeRFESettings& settings, bool txOn)
|
||||
int LimeRFEController::getFwdPower(int& powerDB)
|
||||
{
|
||||
|
||||
if (!m_rfeDevice)
|
||||
{
|
||||
qDebug("LimeRFEController::driveTx: not open");
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (settings.m_rxChannels == ChannelsCellular)
|
||||
{
|
||||
qDebug("LimeRFEController::driveTx: do nothing for cellular bands");
|
||||
return 0; // cellular is TRX anyway
|
||||
int power;
|
||||
int rc = RFE_ReadADC(m_rfeDevice, RFE_ADC1, &power);
|
||||
|
||||
if (rc == 0) {
|
||||
powerDB = power;
|
||||
}
|
||||
|
||||
int mode = txOn ? RFE_MODE_TX : RFE_MODE_RX;
|
||||
int rc = RFE_Mode(m_rfeDevice, mode);
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
settings.m_rxOn = !txOn;
|
||||
settings.m_txOn = txOn;
|
||||
qDebug("LimeRFEController::driveTx: done: Rx: %s Tx: %s", settings.m_rxOn ? "on" : "off", settings.m_txOn ? "on" : "off");
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
|
||||
int LimeRFEController::getRefPower(int& powerDB)
|
||||
{
|
||||
qInfo("LimeRFEController::driveTx: %s error: %s", txOn ? "on" : "off", getError(rc).c_str());
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int power;
|
||||
int rc = RFE_ReadADC(m_rfeDevice, RFE_ADC2, &power);
|
||||
|
||||
if (rc == 0) {
|
||||
powerDB = power;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -104,9 +104,10 @@ public:
|
||||
int configure();
|
||||
int getState();
|
||||
static std::string getError(int errorCode);
|
||||
int setRx(LimeRFESettings& settings, bool rxOn); //!< Used by USB driver
|
||||
int setTx(LimeRFESettings& settings, bool txOn); //!< USed by USB driver
|
||||
int driveTx(LimeRFESettings& settings, bool txOn); //!< Used by the device set trigger
|
||||
int setRx(LimeRFESettings& settings, bool rxOn);
|
||||
int setTx(LimeRFESettings& settings, bool txOn);
|
||||
int getFwdPower(int& powerDB);
|
||||
int getRefPower(int& powerDB);
|
||||
|
||||
void settingsToState(const LimeRFESettings& settings);
|
||||
void stateToSettings(LimeRFESettings& settings);
|
||||
|
@ -46,3 +46,13 @@ LimeRFESettings:
|
||||
txOn:
|
||||
description: Boolean 1 if Tx is active else 0
|
||||
type: integer
|
||||
|
||||
LimeRFEPower:
|
||||
description: report of forward and reflected power measurements
|
||||
properties:
|
||||
forward:
|
||||
description: relative forward power in dB
|
||||
type: integer
|
||||
reflected:
|
||||
description: relative reflected power in dB
|
||||
type: integer
|
@ -555,8 +555,6 @@ paths:
|
||||
operationId: instanceLimeRFEConfigGet
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: serial
|
||||
in: query
|
||||
@ -628,6 +626,33 @@ paths:
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/limerfe/power:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
description: get forward and reflected relative powers in dB
|
||||
operationId: instanceLimeRFEPowerGet
|
||||
tags:
|
||||
- Instance
|
||||
parameters:
|
||||
- name: serial
|
||||
in: query
|
||||
description: device serial path
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: On success return forward and reflected powers
|
||||
schema:
|
||||
$ref: "/doc/swagger/include/LimeRFE.yaml#/LimeRFEPower"
|
||||
"400":
|
||||
description: Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/presets:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
|
@ -35,6 +35,7 @@ QString WebAPIAdapterInterface::instanceAMBEDevicesURL = "/sdrangel/ambe/devices
|
||||
QString WebAPIAdapterInterface::instanceLimeRFESerialURL = "/sdrangel/limerfe/serial";
|
||||
QString WebAPIAdapterInterface::instanceLimeRFEConfigURL = "/sdrangel/limerfe/config";
|
||||
QString WebAPIAdapterInterface::instanceLimeRFERunURL = "/sdrangel/limerfe/run";
|
||||
QString WebAPIAdapterInterface::instanceLimeRFEPowerURL = "/sdrangel/limerfe/power";
|
||||
QString WebAPIAdapterInterface::instancePresetsURL = "/sdrangel/presets";
|
||||
QString WebAPIAdapterInterface::instancePresetURL = "/sdrangel/preset";
|
||||
QString WebAPIAdapterInterface::instancePresetFileURL = "/sdrangel/preset/file";
|
||||
|
@ -44,6 +44,7 @@ namespace SWGSDRangel
|
||||
class SWGAMBEDevices;
|
||||
class SWGLimeRFEDevices;
|
||||
class SWGLimeRFESettings;
|
||||
class SWGLimeRFEPower;
|
||||
class SWGPresets;
|
||||
class SWGPresetTransfer;
|
||||
class SWGPresetIdentifier;
|
||||
@ -487,6 +488,22 @@ public:
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/limerfe/power (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
*/
|
||||
virtual int instanceLimeRFEPowerGet(
|
||||
const QString& serial,
|
||||
SWGSDRangel::SWGLimeRFEPower& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
(void) serial;
|
||||
(void) response;
|
||||
error.init();
|
||||
*error.getMessage() = QString("Function not implemented");
|
||||
return 501;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler of /sdrangel/presets (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||
* returns the Http status code (default 501: not implemented)
|
||||
@ -971,6 +988,7 @@ public:
|
||||
static QString instanceLimeRFESerialURL;
|
||||
static QString instanceLimeRFEConfigURL;
|
||||
static QString instanceLimeRFERunURL;
|
||||
static QString instanceLimeRFEPowerURL;
|
||||
static QString instancePresetsURL;
|
||||
static QString instancePresetURL;
|
||||
static QString instancePresetFileURL;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "SWGAMBEDevices.h"
|
||||
#include "SWGLimeRFEDevices.h"
|
||||
#include "SWGLimeRFESettings.h"
|
||||
#include "SWGLimeRFEPower.h"
|
||||
#include "SWGPresets.h"
|
||||
#include "SWGPresetTransfer.h"
|
||||
#include "SWGPresetIdentifier.h"
|
||||
@ -264,6 +265,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
||||
instanceLimeRFEConfigService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceLimeRFERunURL) {
|
||||
instanceLimeRFERunService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instanceLimeRFEPowerURL) {
|
||||
instanceLimeRFEPowerService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instancePresetsURL) {
|
||||
instancePresetsService(request, response);
|
||||
} else if (path == WebAPIAdapterInterface::instancePresetURL) {
|
||||
@ -1128,6 +1131,35 @@ void WebAPIRequestMapper::instanceLimeRFERunService(qtwebapp::HttpRequest& reque
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instanceLimeRFEPowerService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
QByteArray serialStr = request.getParameter("serial");
|
||||
SWGSDRangel::SWGLimeRFEPower normalResponse;
|
||||
|
||||
int status = m_adapter->instanceLimeRFEPowerGet(serialStr, normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setStatus(405,"Invalid HTTP method");
|
||||
errorResponse.init();
|
||||
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::instancePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
void instanceLimeRFESerialService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceLimeRFEConfigService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceLimeRFERunService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instanceLimeRFEPowerService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instancePresetsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void instancePresetFileService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
|
@ -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(
|
||||
|
@ -159,6 +159,11 @@ public:
|
||||
SWGSDRangel::SWGLimeRFESettings& query,
|
||||
SWGSDRangel::SWGSuccessResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceLimeRFEPowerGet(
|
||||
const QString& serial,
|
||||
SWGSDRangel::SWGLimeRFEPower& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
#endif
|
||||
|
||||
virtual int instancePresetsGet(
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGLimeRFEDevices.h"
|
||||
#include "SWGLimeRFESettings.h"
|
||||
#include "SWGLimeRFEPower.h"
|
||||
|
||||
#include "maincore.h"
|
||||
#include "loggerwithfile.h"
|
||||
@ -975,6 +976,52 @@ int WebAPIAdapterSrv::instanceLimeRFERunPut(
|
||||
*response.getMessage() = QString("LimeRFE device at %1 mode updated successfully").arg(*query.getDevicePath());
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterSrv::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 WebAPIAdapterSrv::instancePresetFilePut(
|
||||
|
@ -159,6 +159,11 @@ public:
|
||||
SWGSDRangel::SWGLimeRFESettings& query,
|
||||
SWGSDRangel::SWGSuccessResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceLimeRFEPowerGet(
|
||||
const QString& serial,
|
||||
SWGSDRangel::SWGLimeRFEPower& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
#endif
|
||||
|
||||
virtual int instancePresetFilePut(
|
||||
|
@ -46,3 +46,13 @@ LimeRFESettings:
|
||||
txOn:
|
||||
description: Boolean 1 if Tx is active else 0
|
||||
type: integer
|
||||
|
||||
LimeRFEPower:
|
||||
description: report of forward and reflected power measurements
|
||||
properties:
|
||||
forward:
|
||||
description: relative forward power in dB
|
||||
type: integer
|
||||
reflected:
|
||||
description: relative reflected power in dB
|
||||
type: integer
|
@ -555,8 +555,6 @@ paths:
|
||||
operationId: instanceLimeRFEConfigGet
|
||||
tags:
|
||||
- Instance
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: serial
|
||||
in: query
|
||||
@ -628,6 +626,33 @@ paths:
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/limerfe/power:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
description: get forward and reflected relative powers in dB
|
||||
operationId: instanceLimeRFEPowerGet
|
||||
tags:
|
||||
- Instance
|
||||
parameters:
|
||||
- name: serial
|
||||
in: query
|
||||
description: device serial path
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: On success return forward and reflected powers in dB
|
||||
schema:
|
||||
$ref: "http://localhost:8081/api/swagger/include/LimeRFE.yaml#/LimeRFEPower"
|
||||
"400":
|
||||
description: Error
|
||||
schema:
|
||||
$ref: "#/definitions/ErrorResponse"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrangel/presets:
|
||||
x-swagger-router-controller: instance
|
||||
get:
|
||||
|
@ -1171,6 +1171,66 @@ SWGInstanceApi::instanceLimeRFEConfigPutCallback(SWGHttpRequestWorker * worker)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceLimeRFEPowerGet(QString* serial) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrangel/limerfe/power");
|
||||
|
||||
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append("&");
|
||||
else
|
||||
fullPath.append("?");
|
||||
fullPath.append(QUrl::toPercentEncoding("serial"))
|
||||
.append("=")
|
||||
.append(QUrl::toPercentEncoding(stringValue(serial)));
|
||||
|
||||
|
||||
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
||||
SWGHttpRequestInput input(fullPath, "GET");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach(QString key, this->defaultHeaders.keys()) {
|
||||
input.headers.insert(key, this->defaultHeaders.value(key));
|
||||
}
|
||||
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGInstanceApi::instanceLimeRFEPowerGetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceLimeRFEPowerGetCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
msg = QString("Success! %1 bytes").arg(worker->response.length());
|
||||
}
|
||||
else {
|
||||
msg = "Error: " + worker->error_str;
|
||||
}
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGLimeRFEPower* output = static_cast<SWGLimeRFEPower*>(create(json, QString("SWGLimeRFEPower")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit instanceLimeRFEPowerGetSignal(output);
|
||||
} else {
|
||||
emit instanceLimeRFEPowerGetSignalE(output, error_type, error_str);
|
||||
emit instanceLimeRFEPowerGetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGInstanceApi::instanceLimeRFERunPut(SWGLimeRFESettings& body) {
|
||||
QString fullPath;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGLimeRFEDevices.h"
|
||||
#include "SWGLimeRFEPower.h"
|
||||
#include "SWGLimeRFESettings.h"
|
||||
#include "SWGLocationInformation.h"
|
||||
#include "SWGLoggingInfo.h"
|
||||
@ -75,6 +76,7 @@ public:
|
||||
void instanceDevices(qint32 direction);
|
||||
void instanceLimeRFEConfigGet(QString* serial);
|
||||
void instanceLimeRFEConfigPut(SWGLimeRFESettings& body);
|
||||
void instanceLimeRFEPowerGet(QString* serial);
|
||||
void instanceLimeRFERunPut(SWGLimeRFESettings& body);
|
||||
void instanceLimeRFESerialGet();
|
||||
void instanceLocationGet();
|
||||
@ -112,6 +114,7 @@ private:
|
||||
void instanceDevicesCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLimeRFEConfigGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLimeRFEConfigPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLimeRFEPowerGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLimeRFERunPutCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLimeRFESerialGetCallback (SWGHttpRequestWorker * worker);
|
||||
void instanceLocationGetCallback (SWGHttpRequestWorker * worker);
|
||||
@ -149,6 +152,7 @@ signals:
|
||||
void instanceDevicesSignal(SWGInstanceDevicesResponse* summary);
|
||||
void instanceLimeRFEConfigGetSignal(SWGLimeRFESettings* summary);
|
||||
void instanceLimeRFEConfigPutSignal(SWGSuccessResponse* summary);
|
||||
void instanceLimeRFEPowerGetSignal(SWGLimeRFEPower* summary);
|
||||
void instanceLimeRFERunPutSignal(SWGSuccessResponse* summary);
|
||||
void instanceLimeRFESerialGetSignal(SWGLimeRFEDevices* summary);
|
||||
void instanceLocationGetSignal(SWGLocationInformation* summary);
|
||||
@ -185,6 +189,7 @@ signals:
|
||||
void instanceDevicesSignalE(SWGInstanceDevicesResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFEConfigGetSignalE(SWGLimeRFESettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFEConfigPutSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFEPowerGetSignalE(SWGLimeRFEPower* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFERunPutSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFESerialGetSignalE(SWGLimeRFEDevices* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLocationGetSignalE(SWGLocationInformation* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
@ -221,6 +226,7 @@ signals:
|
||||
void instanceDevicesSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFEConfigGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFEConfigPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFEPowerGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFERunPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLimeRFESerialGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void instanceLocationGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
131
swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.cpp
Normal file
131
swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
/**
|
||||
* 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 ---
|
||||
*
|
||||
* OpenAPI spec version: 5.0.0
|
||||
* Contact: f4exb06@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
#include "SWGLimeRFEPower.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGLimeRFEPower::SWGLimeRFEPower(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGLimeRFEPower::SWGLimeRFEPower() {
|
||||
forward = 0;
|
||||
m_forward_isSet = false;
|
||||
reflected = 0;
|
||||
m_reflected_isSet = false;
|
||||
}
|
||||
|
||||
SWGLimeRFEPower::~SWGLimeRFEPower() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGLimeRFEPower::init() {
|
||||
forward = 0;
|
||||
m_forward_isSet = false;
|
||||
reflected = 0;
|
||||
m_reflected_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGLimeRFEPower::cleanup() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGLimeRFEPower*
|
||||
SWGLimeRFEPower::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGLimeRFEPower::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&forward, pJson["forward"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reflected, pJson["reflected"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGLimeRFEPower::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGLimeRFEPower::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_forward_isSet){
|
||||
obj->insert("forward", QJsonValue(forward));
|
||||
}
|
||||
if(m_reflected_isSet){
|
||||
obj->insert("reflected", QJsonValue(reflected));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGLimeRFEPower::getForward() {
|
||||
return forward;
|
||||
}
|
||||
void
|
||||
SWGLimeRFEPower::setForward(qint32 forward) {
|
||||
this->forward = forward;
|
||||
this->m_forward_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGLimeRFEPower::getReflected() {
|
||||
return reflected;
|
||||
}
|
||||
void
|
||||
SWGLimeRFEPower::setReflected(qint32 reflected) {
|
||||
this->reflected = reflected;
|
||||
this->m_reflected_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGLimeRFEPower::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_forward_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_reflected_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
64
swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.h
Normal file
64
swagger/sdrangel/code/qt5/client/SWGLimeRFEPower.h
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* 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 ---
|
||||
*
|
||||
* OpenAPI spec version: 5.0.0
|
||||
* Contact: f4exb06@gmail.com
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGLimeRFEPower.h
|
||||
*
|
||||
* report of forward and reflected power measurements
|
||||
*/
|
||||
|
||||
#ifndef SWGLimeRFEPower_H_
|
||||
#define SWGLimeRFEPower_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGLimeRFEPower: public SWGObject {
|
||||
public:
|
||||
SWGLimeRFEPower();
|
||||
SWGLimeRFEPower(QString* json);
|
||||
virtual ~SWGLimeRFEPower();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGLimeRFEPower* fromJson(QString &jsonString) override;
|
||||
|
||||
qint32 getForward();
|
||||
void setForward(qint32 forward);
|
||||
|
||||
qint32 getReflected();
|
||||
void setReflected(qint32 reflected);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
qint32 forward;
|
||||
bool m_forward_isSet;
|
||||
|
||||
qint32 reflected;
|
||||
bool m_reflected_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGLimeRFEPower_H_ */
|
@ -93,6 +93,7 @@
|
||||
#include "SWGKiwiSDRSettings.h"
|
||||
#include "SWGLimeRFEDevice.h"
|
||||
#include "SWGLimeRFEDevices.h"
|
||||
#include "SWGLimeRFEPower.h"
|
||||
#include "SWGLimeRFESettings.h"
|
||||
#include "SWGLimeSdrInputReport.h"
|
||||
#include "SWGLimeSdrInputSettings.h"
|
||||
@ -409,6 +410,9 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGLimeRFEDevices").compare(type) == 0) {
|
||||
return new SWGLimeRFEDevices();
|
||||
}
|
||||
if(QString("SWGLimeRFEPower").compare(type) == 0) {
|
||||
return new SWGLimeRFEPower();
|
||||
}
|
||||
if(QString("SWGLimeRFESettings").compare(type) == 0) {
|
||||
return new SWGLimeRFESettings();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user