mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-10 13:40:37 -04:00
SDRDaemon: replaced specific channel data settings by generic channel data settings
This commit is contained in:
parent
7e22fe20f9
commit
0ace2e9499
sdrbase
resources
webapi
sdrdaemon/webapi
swagger/sdrangel
@ -21,6 +21,7 @@
|
||||
<file>webapi/doc/swagger/include/Perseus.yaml</file>
|
||||
<file>webapi/doc/swagger/include/PlutoSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/RtlSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/SDRDaemonChannel.yaml</file>
|
||||
<file>webapi/doc/swagger/include/SDRDaemonSource.yaml</file>
|
||||
<file>webapi/doc/swagger/include/SDRDaemonSink.yaml</file>
|
||||
<file>webapi/doc/swagger/include/SDRPlay.yaml</file>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@
|
||||
SDRDaemonChannelSettings:
|
||||
description: "Data handling details for SDRDaemon"
|
||||
properties:
|
||||
nbFECBlocks:
|
||||
description: "Number of FEC blocks per frame"
|
||||
type: integer
|
||||
dataAddress:
|
||||
description: "Receiving USB data address"
|
||||
type: string
|
||||
dataPort:
|
||||
description: "Receiving USB data port"
|
||||
type: integer
|
||||
txDelay:
|
||||
description: "Minimum delay in ms between consecutive USB blocks transmissions"
|
||||
type: integer
|
@ -1298,46 +1298,46 @@ paths:
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrdaemon/data/settings:
|
||||
/sdrdaemon/channel/settings:
|
||||
x-swagger-router-controller: deviceset
|
||||
get:
|
||||
description: Get data handling details
|
||||
operationId: daemonDataSettingsGet
|
||||
description: Get channel handling details
|
||||
operationId: daemonChannelSettingsGet
|
||||
tags:
|
||||
- Daemon
|
||||
responses:
|
||||
"200":
|
||||
description: On success returns current data handling details
|
||||
description: On success return channel settings
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
put:
|
||||
description: Apply data handling details unconditionally (force)
|
||||
operationId: daemonDataSettingsPut
|
||||
description: Apply channel handling details unconditionally (force)
|
||||
operationId: daemonChannelSettingsPut
|
||||
tags:
|
||||
- Daemon
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Data handling details to apply
|
||||
description: Channel handling details to apply
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success returns new settings values
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
patch:
|
||||
description: Apply data handling details differentially (no force)
|
||||
operationId: daemonDataSettingsPatch
|
||||
description: Apply channel handling details differentially (no force)
|
||||
operationId: daemonChannelSettingsPatch
|
||||
tags:
|
||||
- Daemon
|
||||
parameters:
|
||||
@ -1346,12 +1346,12 @@ paths:
|
||||
description: Data handling detail to apply
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success returns new settings values
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
@ -2194,6 +2194,8 @@ definitions:
|
||||
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
|
||||
NFMModSettings:
|
||||
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModSettings"
|
||||
SDRDaemonChannelSettings:
|
||||
$ref: "/doc/swagger/include/SDRDaemonChannel.yaml#/SDRDaemonChannelSettings"
|
||||
SSBModSettings:
|
||||
$ref: "/doc/swagger/include/SSBMod.yaml#/SSBModSettings"
|
||||
SSBDemodSettings:
|
||||
@ -2244,22 +2246,6 @@ definitions:
|
||||
WFMModReport:
|
||||
$ref: "/doc/swagger/include/WFMMod.yaml#/WFMModReport"
|
||||
|
||||
SDRDaemonDataSettings:
|
||||
description: "Data handling details for SDRDaemon"
|
||||
properties:
|
||||
nbFECBlocks:
|
||||
description: "Number of FEC blocks per frame"
|
||||
type: integer
|
||||
dataAddress:
|
||||
description: "Receiving USB data address"
|
||||
type: string
|
||||
dataPort:
|
||||
description: "Receiving USB data port"
|
||||
type: integer
|
||||
txDelay:
|
||||
description: "Minimum delay in ms between consecutive USB blocks transmissions"
|
||||
type: integer
|
||||
|
||||
responses:
|
||||
|
||||
Response_500:
|
||||
|
@ -2146,6 +2146,14 @@ bool WebAPIRequestMapper::validateChannelSettings(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "SDRDaemonChannel")
|
||||
{
|
||||
QJsonObject sdrDaemonChannelSettingsJsonObject = jsonObject["SDRDaemonChannelSettings"].toObject();
|
||||
channelSettingsKeys = sdrDaemonChannelSettingsJsonObject.keys();
|
||||
channelSettings.setSdrDaemonChannelSettings(new SWGSDRangel::SWGSDRDaemonChannelSettings());
|
||||
channelSettings.getSdrDaemonChannelSettings()->fromJsonObject(sdrDaemonChannelSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else if (*channelType == "SSBDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
@ -2384,6 +2392,7 @@ void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings&
|
||||
channelSettings.setDsdDemodSettings(0);
|
||||
channelSettings.setNfmDemodSettings(0);
|
||||
channelSettings.setNfmModSettings(0);
|
||||
channelSettings.setSdrDaemonChannelSettings(0);
|
||||
channelSettings.setSsbDemodSettings(0);
|
||||
channelSettings.setSsbModSettings(0);
|
||||
channelSettings.setUdpSinkSettings(0);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGSDRDaemonDataSettings.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "dsp/dsptypes.h"
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
QString WebAPIAdapterDaemon::daemonInstanceSummaryURL = "/sdrdaemon";
|
||||
QString WebAPIAdapterDaemon::daemonInstanceLoggingURL = "/sdrdaemon/logging";
|
||||
QString WebAPIAdapterDaemon::daemonDataSettingsURL = "/sdrdaemon/data/settings";
|
||||
QString WebAPIAdapterDaemon::daemonChannelSettingsURL = "/sdrdaemon/channel/settings";
|
||||
QString WebAPIAdapterDaemon::daemonDeviceSettingsURL = "/sdrdaemon/device/settings";
|
||||
QString WebAPIAdapterDaemon::daemonDeviceReportURL = "/sdrdaemon/device/report";
|
||||
QString WebAPIAdapterDaemon::daemonRunURL = "/sdrdaemon/run";
|
||||
@ -176,8 +176,8 @@ int WebAPIAdapterDaemon::daemonInstanceLoggingPut(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterDaemon::daemonDataSettingsGet(
|
||||
SWGSDRangel::SWGSDRDaemonDataSettings& response __attribute__((unused)),
|
||||
int WebAPIAdapterDaemon::daemonChannelSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response __attribute__((unused)),
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
@ -185,10 +185,10 @@ int WebAPIAdapterDaemon::daemonDataSettingsGet(
|
||||
return 501;
|
||||
}
|
||||
|
||||
int WebAPIAdapterDaemon::daemonDataSettingsPutPatch(
|
||||
int WebAPIAdapterDaemon::daemonChannelSettingsPutPatch(
|
||||
bool force __attribute__((unused)),
|
||||
const QStringList& dataSettingsKeys __attribute__((unused)),
|
||||
SWGSDRangel::SWGSDRDaemonDataSettings& response __attribute__((unused)),
|
||||
const QStringList& channelSettingsKeys __attribute__((unused)),
|
||||
SWGSDRangel::SWGChannelSettings& response __attribute__((unused)),
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
|
@ -33,7 +33,7 @@ namespace SWGSDRangel
|
||||
class SWGSuccessResponse;
|
||||
class SWGErrorResponse;
|
||||
class SWGLoggingInfo;
|
||||
class SWGSDRDaemonDataSettings;
|
||||
class SWGChannelSettings;
|
||||
}
|
||||
|
||||
class SDRDaemonMain;
|
||||
@ -57,14 +57,14 @@ public:
|
||||
SWGSDRangel::SWGLoggingInfo& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
int daemonDataSettingsGet(
|
||||
SWGSDRangel::SWGSDRDaemonDataSettings& response,
|
||||
int daemonChannelSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
int daemonDataSettingsPutPatch(
|
||||
int daemonChannelSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& dataSettingsKeys,
|
||||
SWGSDRangel::SWGSDRDaemonDataSettings& response,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
int daemonDeviceSettingsGet(
|
||||
@ -95,7 +95,7 @@ public:
|
||||
|
||||
static QString daemonInstanceSummaryURL;
|
||||
static QString daemonInstanceLoggingURL;
|
||||
static QString daemonDataSettingsURL;
|
||||
static QString daemonChannelSettingsURL;
|
||||
static QString daemonDeviceSettingsURL;
|
||||
static QString daemonDeviceReportURL;
|
||||
static QString daemonRunURL;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "webapirequestmapper.h"
|
||||
#include "SWGDaemonSummaryResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGSDRDaemonDataSettings.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
@ -96,8 +96,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
||||
daemonInstanceSummaryService(request, response);
|
||||
} else if (path == WebAPIAdapterDaemon::daemonInstanceLoggingURL) {
|
||||
daemonInstanceLoggingService(request, response);
|
||||
} else if (path == WebAPIAdapterDaemon::daemonDataSettingsURL) {
|
||||
daemonDataSettingsService(request, response);
|
||||
} else if (path == WebAPIAdapterDaemon::daemonChannelSettingsURL) {
|
||||
daemonChannelSettingsService(request, response);
|
||||
} else if (path == WebAPIAdapterDaemon::daemonDeviceSettingsURL) {
|
||||
daemonDeviceSettingsService(request, response);
|
||||
} else if (path == WebAPIAdapterDaemon::daemonDeviceReportURL) {
|
||||
@ -191,27 +191,41 @@ void WebAPIRequestMapper::daemonInstanceLoggingService(qtwebapp::HttpRequest& re
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIRequestMapper::daemonDataSettingsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
void WebAPIRequestMapper::daemonChannelSettingsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||
{
|
||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
if ((request.getMethod() == "PUT") || (request.getMethod() == "PATCH"))
|
||||
if (request.getMethod() == "GET")
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings normalResponse;
|
||||
resetChannelSettings(normalResponse);
|
||||
int status = m_adapter->daemonChannelSettingsGet(normalResponse, errorResponse);
|
||||
response.setStatus(status);
|
||||
|
||||
if (status/100 == 2) {
|
||||
response.write(normalResponse.asJson().toUtf8());
|
||||
} else {
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if ((request.getMethod() == "PUT") || (request.getMethod() == "PATCH"))
|
||||
{
|
||||
QString jsonStr = request.getBody();
|
||||
QJsonObject jsonObject;
|
||||
|
||||
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||
{
|
||||
SWGSDRangel::SWGSDRDaemonDataSettings normalResponse;
|
||||
QStringList dataSettingsKeys;
|
||||
SWGSDRangel::SWGChannelSettings normalResponse;
|
||||
resetChannelSettings(normalResponse);
|
||||
QStringList channelSettingsKeys;
|
||||
|
||||
if (validateDataSettings(normalResponse, jsonObject, dataSettingsKeys))
|
||||
if (validateChannelSettings(normalResponse, jsonObject, channelSettingsKeys))
|
||||
{
|
||||
int status = m_adapter->daemonDataSettingsPutPatch(
|
||||
int status = m_adapter->daemonChannelSettingsPutPatch(
|
||||
(request.getMethod() == "PUT"), // force settings on PUT
|
||||
dataSettingsKeys,
|
||||
channelSettingsKeys,
|
||||
normalResponse,
|
||||
errorResponse);
|
||||
response.setStatus(status);
|
||||
@ -238,18 +252,6 @@ void WebAPIRequestMapper::daemonDataSettingsService(qtwebapp::HttpRequest& reque
|
||||
response.write(errorResponse.asJson().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (request.getMethod() == "GET")
|
||||
{
|
||||
SWGSDRangel::SWGSDRDaemonDataSettings normalResponse;
|
||||
int status = m_adapter->daemonDataSettingsGet(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");
|
||||
@ -411,51 +413,248 @@ void WebAPIRequestMapper::daemonRunService(qtwebapp::HttpRequest& request, qtweb
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WebAPIRequestMapper::validateDataSettings(SWGSDRangel::SWGSDRDaemonDataSettings& dataSettings, QJsonObject& jsonObject, QStringList& dataSettingsKeys)
|
||||
// TODO: put in library in common with SDRangel. Can be static.
|
||||
bool WebAPIRequestMapper::validateChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& channelSettings,
|
||||
QJsonObject& jsonObject,
|
||||
QStringList& channelSettingsKeys)
|
||||
{
|
||||
if (jsonObject.contains("nbFECBlocks"))
|
||||
{
|
||||
int nbFECBlocks = jsonObject["nbFECBlocks"].toInt();
|
||||
|
||||
if (nbFECBlocks >=0 && nbFECBlocks < 127) {
|
||||
dataSettings.setNbFecBlocks(nbFECBlocks);
|
||||
} else {
|
||||
dataSettings.setNbFecBlocks(0);
|
||||
}
|
||||
if (jsonObject.contains("tx")) {
|
||||
channelSettings.setTx(jsonObject["tx"].toInt());
|
||||
} else {
|
||||
channelSettings.setTx(0); // assume Rx
|
||||
}
|
||||
|
||||
if (jsonObject.contains("dataPort"))
|
||||
{
|
||||
int dataPort = jsonObject["dataPort"].toInt();
|
||||
|
||||
if (dataPort > 1023 && dataPort < 65536) {
|
||||
dataSettings.setDataPort(dataPort);
|
||||
} else {
|
||||
dataSettings.setDataPort(9090);
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonObject.contains("txDelay"))
|
||||
{
|
||||
int txDelay = jsonObject["txDelay"].toInt();
|
||||
|
||||
if (txDelay > 100) {
|
||||
dataSettings.setTxDelay(txDelay);
|
||||
} else {
|
||||
dataSettings.setTxDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonObject.contains("dataAddress") && jsonObject["dataAddress"].isString()) {
|
||||
dataSettings.setDataAddress(new QString(jsonObject["dataAddress"].toString()));
|
||||
if (jsonObject.contains("channelType") && jsonObject["channelType"].isString()) {
|
||||
channelSettings.setChannelType(new QString(jsonObject["channelType"].toString()));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
dataSettingsKeys = jsonObject.keys();
|
||||
QString *channelType = channelSettings.getChannelType();
|
||||
|
||||
return true;
|
||||
if (*channelType == "AMDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject amDemodSettingsJsonObject = jsonObject["AMDemodSettings"].toObject();
|
||||
channelSettingsKeys = amDemodSettingsJsonObject.keys();
|
||||
channelSettings.setAmDemodSettings(new SWGSDRangel::SWGAMDemodSettings());
|
||||
channelSettings.getAmDemodSettings()->fromJsonObject(amDemodSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "AMMod")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject amModSettingsJsonObject = jsonObject["AMModSettings"].toObject();
|
||||
channelSettingsKeys = amModSettingsJsonObject.keys();
|
||||
|
||||
if (channelSettingsKeys.contains("cwKeyer"))
|
||||
{
|
||||
QJsonObject cwKeyerSettingsJsonObject;
|
||||
appendSettingsSubKeys(amModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
|
||||
}
|
||||
|
||||
channelSettings.setAmModSettings(new SWGSDRangel::SWGAMModSettings());
|
||||
channelSettings.getAmModSettings()->fromJsonObject(amModSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "ATVMod")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject atvModSettingsJsonObject = jsonObject["ATVModSettings"].toObject();
|
||||
channelSettingsKeys = atvModSettingsJsonObject.keys();
|
||||
channelSettings.setAtvModSettings(new SWGSDRangel::SWGATVModSettings());
|
||||
channelSettings.getAtvModSettings()->fromJsonObject(atvModSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "BFMDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject bfmDemodSettingsJsonObject = jsonObject["BFMDemodSettings"].toObject();
|
||||
channelSettingsKeys = bfmDemodSettingsJsonObject.keys();
|
||||
channelSettings.setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings());
|
||||
channelSettings.getBfmDemodSettings()->fromJsonObject(bfmDemodSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "DSDDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject dsdDemodSettingsJsonObject = jsonObject["DSDDemodSettings"].toObject();
|
||||
channelSettingsKeys = dsdDemodSettingsJsonObject.keys();
|
||||
channelSettings.setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings());
|
||||
channelSettings.getDsdDemodSettings()->fromJsonObject(dsdDemodSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "NFMDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject nfmDemodSettingsJsonObject = jsonObject["NFMDemodSettings"].toObject();
|
||||
channelSettingsKeys = nfmDemodSettingsJsonObject.keys();
|
||||
channelSettings.setNfmDemodSettings(new SWGSDRangel::SWGNFMDemodSettings());
|
||||
channelSettings.getNfmDemodSettings()->fromJsonObject(nfmDemodSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "NFMMod")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject nfmModSettingsJsonObject = jsonObject["NFMModSettings"].toObject();
|
||||
channelSettingsKeys = nfmModSettingsJsonObject.keys();
|
||||
|
||||
if (channelSettingsKeys.contains("cwKeyer"))
|
||||
{
|
||||
QJsonObject cwKeyerSettingsJsonObject;
|
||||
appendSettingsSubKeys(nfmModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
|
||||
}
|
||||
|
||||
channelSettings.setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
|
||||
channelSettings.getNfmModSettings()->fromJsonObject(nfmModSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "SDRDaemonChannel")
|
||||
{
|
||||
QJsonObject sdrDaemonChannelSettingsJsonObject = jsonObject["SDRDaemonChannelSettings"].toObject();
|
||||
channelSettingsKeys = sdrDaemonChannelSettingsJsonObject.keys();
|
||||
channelSettings.setSdrDaemonChannelSettings(new SWGSDRangel::SWGSDRDaemonChannelSettings());
|
||||
channelSettings.getSdrDaemonChannelSettings()->fromJsonObject(sdrDaemonChannelSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else if (*channelType == "SSBDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject ssbDemodSettingsJsonObject = jsonObject["SSBDemodSettings"].toObject();
|
||||
channelSettingsKeys = ssbDemodSettingsJsonObject.keys();
|
||||
channelSettings.setSsbDemodSettings(new SWGSDRangel::SWGSSBDemodSettings());
|
||||
channelSettings.getSsbDemodSettings()->fromJsonObject(ssbDemodSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "SSBMod")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject ssbModSettingsJsonObject = jsonObject["SSBModSettings"].toObject();
|
||||
channelSettingsKeys = ssbModSettingsJsonObject.keys();
|
||||
|
||||
if (channelSettingsKeys.contains("cwKeyer"))
|
||||
{
|
||||
QJsonObject cwKeyerSettingsJsonObject;
|
||||
appendSettingsSubKeys(ssbModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
|
||||
}
|
||||
|
||||
channelSettings.setSsbModSettings(new SWGSDRangel::SWGSSBModSettings());
|
||||
channelSettings.getSsbModSettings()->fromJsonObject(ssbModSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "UDPSink")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject udpSinkSettingsJsonObject = jsonObject["UDPSinkSettings"].toObject();
|
||||
channelSettingsKeys = udpSinkSettingsJsonObject.keys();
|
||||
channelSettings.setUdpSinkSettings(new SWGSDRangel::SWGUDPSinkSettings());
|
||||
channelSettings.getUdpSinkSettings()->fromJsonObject(udpSinkSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "UDPSrc")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject udpSrcSettingsJsonObject = jsonObject["UDPSrcSettings"].toObject();
|
||||
channelSettingsKeys = udpSrcSettingsJsonObject.keys();
|
||||
channelSettings.setUdpSrcSettings(new SWGSDRangel::SWGUDPSrcSettings());
|
||||
channelSettings.getUdpSrcSettings()->fromJsonObject(udpSrcSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "WFMDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
{
|
||||
QJsonObject wfmDemodSettingsJsonObject = jsonObject["WFMDemodSettings"].toObject();
|
||||
channelSettingsKeys = wfmDemodSettingsJsonObject.keys();
|
||||
channelSettings.setWfmDemodSettings(new SWGSDRangel::SWGWFMDemodSettings());
|
||||
channelSettings.getWfmDemodSettings()->fromJsonObject(wfmDemodSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "WFMMod")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject wfmModSettingsJsonObject = jsonObject["WFMModSettings"].toObject();
|
||||
channelSettingsKeys = wfmModSettingsJsonObject.keys();
|
||||
|
||||
if (channelSettingsKeys.contains("cwKeyer"))
|
||||
{
|
||||
QJsonObject cwKeyerSettingsJsonObject;
|
||||
appendSettingsSubKeys(wfmModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
|
||||
}
|
||||
|
||||
channelSettings.setWfmModSettings(new SWGSDRangel::SWGWFMModSettings());
|
||||
channelSettings.getWfmModSettings()->fromJsonObject(wfmModSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: put in library in common with SDRangel. Can be static.
|
||||
@ -774,6 +973,27 @@ bool WebAPIRequestMapper::parseJsonBody(QString& jsonStr, QJsonObject& jsonObjec
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: put in library in common with SDRangel. Can be static.
|
||||
void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings& channelSettings)
|
||||
{
|
||||
channelSettings.cleanup();
|
||||
channelSettings.setChannelType(0);
|
||||
channelSettings.setAmDemodSettings(0);
|
||||
channelSettings.setAmModSettings(0);
|
||||
channelSettings.setAtvModSettings(0);
|
||||
channelSettings.setBfmDemodSettings(0);
|
||||
channelSettings.setDsdDemodSettings(0);
|
||||
channelSettings.setNfmDemodSettings(0);
|
||||
channelSettings.setNfmModSettings(0);
|
||||
channelSettings.setSdrDaemonChannelSettings(0);
|
||||
channelSettings.setSsbDemodSettings(0);
|
||||
channelSettings.setSsbModSettings(0);
|
||||
channelSettings.setUdpSinkSettings(0);
|
||||
channelSettings.setUdpSrcSettings(0);
|
||||
channelSettings.setWfmDemodSettings(0);
|
||||
channelSettings.setWfmModSettings(0);
|
||||
}
|
||||
|
||||
// TODO: put in library in common with SDRangel. Can be static.
|
||||
void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
namespace SWGSDRangel
|
||||
{
|
||||
class SWGSDRDaemonDataSettings;
|
||||
class SWGChannelSettings;
|
||||
class SWGDeviceSettings;
|
||||
class SWGDeviceReport;
|
||||
}
|
||||
@ -54,12 +54,12 @@ private:
|
||||
|
||||
void daemonInstanceSummaryService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void daemonInstanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void daemonDataSettingsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void daemonChannelSettingsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void daemonDeviceSettingsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void daemonRunService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
void daemonDeviceReportService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||
|
||||
bool validateDataSettings(SWGSDRangel::SWGSDRDaemonDataSettings& dataSettings, QJsonObject& jsonObject, QStringList& dataSettingsKeys);
|
||||
bool validateChannelSettings(SWGSDRangel::SWGChannelSettings& channelSettings, QJsonObject& jsonObject, QStringList& channelSettingsKeys);
|
||||
bool validateDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings, QJsonObject& jsonObject, QStringList& deviceSettingsKeys);
|
||||
|
||||
void appendSettingsSubKeys(
|
||||
@ -70,6 +70,7 @@ private:
|
||||
|
||||
bool parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response);
|
||||
|
||||
void resetChannelSettings(SWGSDRangel::SWGChannelSettings& channelSettings);
|
||||
void resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings);
|
||||
void resetDeviceReport(SWGSDRangel::SWGDeviceReport& deviceReport);
|
||||
};
|
||||
|
15
swagger/sdrangel/api/swagger/include/SDRDaemonChannel.yaml
Normal file
15
swagger/sdrangel/api/swagger/include/SDRDaemonChannel.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
SDRDaemonChannelSettings:
|
||||
description: "Data handling details for SDRDaemon"
|
||||
properties:
|
||||
nbFECBlocks:
|
||||
description: "Number of FEC blocks per frame"
|
||||
type: integer
|
||||
dataAddress:
|
||||
description: "Receiving USB data address"
|
||||
type: string
|
||||
dataPort:
|
||||
description: "Receiving USB data port"
|
||||
type: integer
|
||||
txDelay:
|
||||
description: "Minimum delay in ms between consecutive USB blocks transmissions"
|
||||
type: integer
|
@ -1298,46 +1298,46 @@ paths:
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
|
||||
/sdrdaemon/data/settings:
|
||||
/sdrdaemon/channel/settings:
|
||||
x-swagger-router-controller: deviceset
|
||||
get:
|
||||
description: Get data handling details
|
||||
operationId: daemonDataSettingsGet
|
||||
description: Get channel handling details
|
||||
operationId: daemonChannelSettingsGet
|
||||
tags:
|
||||
- Daemon
|
||||
responses:
|
||||
"200":
|
||||
description: On success returns current data handling details
|
||||
description: On success return channel settings
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
put:
|
||||
description: Apply data handling details unconditionally (force)
|
||||
operationId: daemonDataSettingsPut
|
||||
description: Apply channel handling details unconditionally (force)
|
||||
operationId: daemonChannelSettingsPut
|
||||
tags:
|
||||
- Daemon
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
description: Data handling details to apply
|
||||
description: Channel handling details to apply
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success returns new settings values
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
$ref: "#/responses/Response_501"
|
||||
patch:
|
||||
description: Apply data handling details differentially (no force)
|
||||
operationId: daemonDataSettingsPatch
|
||||
description: Apply channel handling details differentially (no force)
|
||||
operationId: daemonChannelSettingsPatch
|
||||
tags:
|
||||
- Daemon
|
||||
parameters:
|
||||
@ -1346,12 +1346,12 @@ paths:
|
||||
description: Data handling detail to apply
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
responses:
|
||||
"200":
|
||||
description: On success returns new settings values
|
||||
schema:
|
||||
$ref: "#/definitions/SDRDaemonDataSettings"
|
||||
$ref: "#/definitions/ChannelSettings"
|
||||
"500":
|
||||
$ref: "#/responses/Response_500"
|
||||
"501":
|
||||
@ -2194,6 +2194,8 @@ definitions:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
|
||||
NFMModSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModSettings"
|
||||
SDRDaemonChannelSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/SDRDaemonChannel.yaml#/SDRDaemonChannelSettings"
|
||||
SSBModSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/SSBMod.yaml#/SSBModSettings"
|
||||
SSBDemodSettings:
|
||||
@ -2244,22 +2246,6 @@ definitions:
|
||||
WFMModReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModReport"
|
||||
|
||||
SDRDaemonDataSettings:
|
||||
description: "Data handling details for SDRDaemon"
|
||||
properties:
|
||||
nbFECBlocks:
|
||||
description: "Number of FEC blocks per frame"
|
||||
type: integer
|
||||
dataAddress:
|
||||
description: "Receiving USB data address"
|
||||
type: string
|
||||
dataPort:
|
||||
description: "Receiving USB data port"
|
||||
type: integer
|
||||
txDelay:
|
||||
description: "Minimum delay in ms between consecutive USB blocks transmissions"
|
||||
type: integer
|
||||
|
||||
responses:
|
||||
|
||||
Response_500:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,6 +46,8 @@ SWGChannelSettings::SWGChannelSettings() {
|
||||
m_nfm_demod_settings_isSet = false;
|
||||
nfm_mod_settings = nullptr;
|
||||
m_nfm_mod_settings_isSet = false;
|
||||
sdr_daemon_channel_settings = nullptr;
|
||||
m_sdr_daemon_channel_settings_isSet = false;
|
||||
ssb_mod_settings = nullptr;
|
||||
m_ssb_mod_settings_isSet = false;
|
||||
ssb_demod_settings = nullptr;
|
||||
@ -84,6 +86,8 @@ SWGChannelSettings::init() {
|
||||
m_nfm_demod_settings_isSet = false;
|
||||
nfm_mod_settings = new SWGNFMModSettings();
|
||||
m_nfm_mod_settings_isSet = false;
|
||||
sdr_daemon_channel_settings = new SWGSDRDaemonChannelSettings();
|
||||
m_sdr_daemon_channel_settings_isSet = false;
|
||||
ssb_mod_settings = new SWGSSBModSettings();
|
||||
m_ssb_mod_settings_isSet = false;
|
||||
ssb_demod_settings = new SWGSSBDemodSettings();
|
||||
@ -125,6 +129,9 @@ SWGChannelSettings::cleanup() {
|
||||
if(nfm_mod_settings != nullptr) {
|
||||
delete nfm_mod_settings;
|
||||
}
|
||||
if(sdr_daemon_channel_settings != nullptr) {
|
||||
delete sdr_daemon_channel_settings;
|
||||
}
|
||||
if(ssb_mod_settings != nullptr) {
|
||||
delete ssb_mod_settings;
|
||||
}
|
||||
@ -174,6 +181,8 @@ SWGChannelSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&sdr_daemon_channel_settings, pJson["SDRDaemonChannelSettings"], "SWGSDRDaemonChannelSettings", "SWGSDRDaemonChannelSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&ssb_mod_settings, pJson["SSBModSettings"], "SWGSSBModSettings", "SWGSSBModSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&ssb_demod_settings, pJson["SSBDemodSettings"], "SWGSSBDemodSettings", "SWGSSBDemodSettings");
|
||||
@ -229,6 +238,9 @@ SWGChannelSettings::asJsonObject() {
|
||||
if((nfm_mod_settings != nullptr) && (nfm_mod_settings->isSet())){
|
||||
toJsonValue(QString("NFMModSettings"), nfm_mod_settings, obj, QString("SWGNFMModSettings"));
|
||||
}
|
||||
if((sdr_daemon_channel_settings != nullptr) && (sdr_daemon_channel_settings->isSet())){
|
||||
toJsonValue(QString("SDRDaemonChannelSettings"), sdr_daemon_channel_settings, obj, QString("SWGSDRDaemonChannelSettings"));
|
||||
}
|
||||
if((ssb_mod_settings != nullptr) && (ssb_mod_settings->isSet())){
|
||||
toJsonValue(QString("SSBModSettings"), ssb_mod_settings, obj, QString("SWGSSBModSettings"));
|
||||
}
|
||||
@ -341,6 +353,16 @@ SWGChannelSettings::setNfmModSettings(SWGNFMModSettings* nfm_mod_settings) {
|
||||
this->m_nfm_mod_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGSDRDaemonChannelSettings*
|
||||
SWGChannelSettings::getSdrDaemonChannelSettings() {
|
||||
return sdr_daemon_channel_settings;
|
||||
}
|
||||
void
|
||||
SWGChannelSettings::setSdrDaemonChannelSettings(SWGSDRDaemonChannelSettings* sdr_daemon_channel_settings) {
|
||||
this->sdr_daemon_channel_settings = sdr_daemon_channel_settings;
|
||||
this->m_sdr_daemon_channel_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGSSBModSettings*
|
||||
SWGChannelSettings::getSsbModSettings() {
|
||||
return ssb_mod_settings;
|
||||
@ -415,6 +437,7 @@ SWGChannelSettings::isSet(){
|
||||
if(dsd_demod_settings != nullptr && dsd_demod_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(nfm_demod_settings != nullptr && nfm_demod_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(nfm_mod_settings != nullptr && nfm_mod_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(sdr_daemon_channel_settings != nullptr && sdr_daemon_channel_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(ssb_mod_settings != nullptr && ssb_mod_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(ssb_demod_settings != nullptr && ssb_demod_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
if(udp_sink_settings != nullptr && udp_sink_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "SWGDSDDemodSettings.h"
|
||||
#include "SWGNFMDemodSettings.h"
|
||||
#include "SWGNFMModSettings.h"
|
||||
#include "SWGSDRDaemonChannelSettings.h"
|
||||
#include "SWGSSBDemodSettings.h"
|
||||
#include "SWGSSBModSettings.h"
|
||||
#include "SWGUDPSinkSettings.h"
|
||||
@ -82,6 +83,9 @@ public:
|
||||
SWGNFMModSettings* getNfmModSettings();
|
||||
void setNfmModSettings(SWGNFMModSettings* nfm_mod_settings);
|
||||
|
||||
SWGSDRDaemonChannelSettings* getSdrDaemonChannelSettings();
|
||||
void setSdrDaemonChannelSettings(SWGSDRDaemonChannelSettings* sdr_daemon_channel_settings);
|
||||
|
||||
SWGSSBModSettings* getSsbModSettings();
|
||||
void setSsbModSettings(SWGSSBModSettings* ssb_mod_settings);
|
||||
|
||||
@ -131,6 +135,9 @@ private:
|
||||
SWGNFMModSettings* nfm_mod_settings;
|
||||
bool m_nfm_mod_settings_isSet;
|
||||
|
||||
SWGSDRDaemonChannelSettings* sdr_daemon_channel_settings;
|
||||
bool m_sdr_daemon_channel_settings_isSet;
|
||||
|
||||
SWGSSBModSettings* ssb_mod_settings;
|
||||
bool m_ssb_mod_settings_isSet;
|
||||
|
||||
|
@ -29,9 +29,9 @@ SWGDaemonApi::SWGDaemonApi(QString host, QString basePath) {
|
||||
}
|
||||
|
||||
void
|
||||
SWGDaemonApi::daemonDataSettingsGet() {
|
||||
SWGDaemonApi::daemonChannelSettingsGet() {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrdaemon/data/settings");
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrdaemon/channel/settings");
|
||||
|
||||
|
||||
|
||||
@ -49,13 +49,13 @@ SWGDaemonApi::daemonDataSettingsGet() {
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGDaemonApi::daemonDataSettingsGetCallback);
|
||||
&SWGDaemonApi::daemonChannelSettingsGetCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGDaemonApi::daemonDataSettingsGetCallback(SWGHttpRequestWorker * worker) {
|
||||
SWGDaemonApi::daemonChannelSettingsGetCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
@ -69,21 +69,21 @@ SWGDaemonApi::daemonDataSettingsGetCallback(SWGHttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGSDRDaemonDataSettings* output = static_cast<SWGSDRDaemonDataSettings*>(create(json, QString("SWGSDRDaemonDataSettings")));
|
||||
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit daemonDataSettingsGetSignal(output);
|
||||
emit daemonChannelSettingsGetSignal(output);
|
||||
} else {
|
||||
emit daemonDataSettingsGetSignalE(output, error_type, error_str);
|
||||
emit daemonDataSettingsGetSignalEFull(worker, error_type, error_str);
|
||||
emit daemonChannelSettingsGetSignalE(output, error_type, error_str);
|
||||
emit daemonChannelSettingsGetSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGDaemonApi::daemonDataSettingsPatch(SWGSDRDaemonDataSettings& body) {
|
||||
SWGDaemonApi::daemonChannelSettingsPatch(SWGChannelSettings& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrdaemon/data/settings");
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrdaemon/channel/settings");
|
||||
|
||||
|
||||
|
||||
@ -104,13 +104,13 @@ SWGDaemonApi::daemonDataSettingsPatch(SWGSDRDaemonDataSettings& body) {
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGDaemonApi::daemonDataSettingsPatchCallback);
|
||||
&SWGDaemonApi::daemonChannelSettingsPatchCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGDaemonApi::daemonDataSettingsPatchCallback(SWGHttpRequestWorker * worker) {
|
||||
SWGDaemonApi::daemonChannelSettingsPatchCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
@ -124,21 +124,21 @@ SWGDaemonApi::daemonDataSettingsPatchCallback(SWGHttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGSDRDaemonDataSettings* output = static_cast<SWGSDRDaemonDataSettings*>(create(json, QString("SWGSDRDaemonDataSettings")));
|
||||
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit daemonDataSettingsPatchSignal(output);
|
||||
emit daemonChannelSettingsPatchSignal(output);
|
||||
} else {
|
||||
emit daemonDataSettingsPatchSignalE(output, error_type, error_str);
|
||||
emit daemonDataSettingsPatchSignalEFull(worker, error_type, error_str);
|
||||
emit daemonChannelSettingsPatchSignalE(output, error_type, error_str);
|
||||
emit daemonChannelSettingsPatchSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SWGDaemonApi::daemonDataSettingsPut(SWGSDRDaemonDataSettings& body) {
|
||||
SWGDaemonApi::daemonChannelSettingsPut(SWGChannelSettings& body) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrdaemon/data/settings");
|
||||
fullPath.append(this->host).append(this->basePath).append("/sdrdaemon/channel/settings");
|
||||
|
||||
|
||||
|
||||
@ -159,13 +159,13 @@ SWGDaemonApi::daemonDataSettingsPut(SWGSDRDaemonDataSettings& body) {
|
||||
connect(worker,
|
||||
&SWGHttpRequestWorker::on_execution_finished,
|
||||
this,
|
||||
&SWGDaemonApi::daemonDataSettingsPutCallback);
|
||||
&SWGDaemonApi::daemonChannelSettingsPutCallback);
|
||||
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
void
|
||||
SWGDaemonApi::daemonDataSettingsPutCallback(SWGHttpRequestWorker * worker) {
|
||||
SWGDaemonApi::daemonChannelSettingsPutCallback(SWGHttpRequestWorker * worker) {
|
||||
QString msg;
|
||||
QString error_str = worker->error_str;
|
||||
QNetworkReply::NetworkError error_type = worker->error_type;
|
||||
@ -179,14 +179,14 @@ SWGDaemonApi::daemonDataSettingsPutCallback(SWGHttpRequestWorker * worker) {
|
||||
|
||||
|
||||
QString json(worker->response);
|
||||
SWGSDRDaemonDataSettings* output = static_cast<SWGSDRDaemonDataSettings*>(create(json, QString("SWGSDRDaemonDataSettings")));
|
||||
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
||||
worker->deleteLater();
|
||||
|
||||
if (worker->error_type == QNetworkReply::NoError) {
|
||||
emit daemonDataSettingsPutSignal(output);
|
||||
emit daemonChannelSettingsPutSignal(output);
|
||||
} else {
|
||||
emit daemonDataSettingsPutSignalE(output, error_type, error_str);
|
||||
emit daemonDataSettingsPutSignalEFull(worker, error_type, error_str);
|
||||
emit daemonChannelSettingsPutSignalE(output, error_type, error_str);
|
||||
emit daemonChannelSettingsPutSignalEFull(worker, error_type, error_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
#include "SWGHttpRequest.h"
|
||||
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGDaemonSummaryResponse.h"
|
||||
#include "SWGDeviceReport.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
#include "SWGLoggingInfo.h"
|
||||
#include "SWGSDRDaemonDataSettings.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -39,9 +39,9 @@ public:
|
||||
QString basePath;
|
||||
QMap<QString, QString> defaultHeaders;
|
||||
|
||||
void daemonDataSettingsGet();
|
||||
void daemonDataSettingsPatch(SWGSDRDaemonDataSettings& body);
|
||||
void daemonDataSettingsPut(SWGSDRDaemonDataSettings& body);
|
||||
void daemonChannelSettingsGet();
|
||||
void daemonChannelSettingsPatch(SWGChannelSettings& body);
|
||||
void daemonChannelSettingsPut(SWGChannelSettings& body);
|
||||
void daemonDeviceReportGet();
|
||||
void daemonDeviceSettingsGet();
|
||||
void daemonDeviceSettingsPatch(SWGDeviceSettings& body);
|
||||
@ -54,9 +54,9 @@ public:
|
||||
void daemonRunPost();
|
||||
|
||||
private:
|
||||
void daemonDataSettingsGetCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonDataSettingsPatchCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonDataSettingsPutCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonChannelSettingsGetCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonChannelSettingsPatchCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonChannelSettingsPutCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonDeviceReportGetCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonDeviceSettingsGetCallback (SWGHttpRequestWorker * worker);
|
||||
void daemonDeviceSettingsPatchCallback (SWGHttpRequestWorker * worker);
|
||||
@ -69,9 +69,9 @@ private:
|
||||
void daemonRunPostCallback (SWGHttpRequestWorker * worker);
|
||||
|
||||
signals:
|
||||
void daemonDataSettingsGetSignal(SWGSDRDaemonDataSettings* summary);
|
||||
void daemonDataSettingsPatchSignal(SWGSDRDaemonDataSettings* summary);
|
||||
void daemonDataSettingsPutSignal(SWGSDRDaemonDataSettings* summary);
|
||||
void daemonChannelSettingsGetSignal(SWGChannelSettings* summary);
|
||||
void daemonChannelSettingsPatchSignal(SWGChannelSettings* summary);
|
||||
void daemonChannelSettingsPutSignal(SWGChannelSettings* summary);
|
||||
void daemonDeviceReportGetSignal(SWGDeviceReport* summary);
|
||||
void daemonDeviceSettingsGetSignal(SWGDeviceSettings* summary);
|
||||
void daemonDeviceSettingsPatchSignal(SWGDeviceSettings* summary);
|
||||
@ -83,9 +83,9 @@ signals:
|
||||
void daemonRunGetSignal(SWGDeviceState* summary);
|
||||
void daemonRunPostSignal(SWGDeviceState* summary);
|
||||
|
||||
void daemonDataSettingsGetSignalE(SWGSDRDaemonDataSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDataSettingsPatchSignalE(SWGSDRDaemonDataSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDataSettingsPutSignalE(SWGSDRDaemonDataSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonChannelSettingsGetSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonChannelSettingsPatchSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonChannelSettingsPutSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDeviceReportGetSignalE(SWGDeviceReport* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDeviceSettingsGetSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDeviceSettingsPatchSignalE(SWGDeviceSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
@ -97,9 +97,9 @@ signals:
|
||||
void daemonRunGetSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonRunPostSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
||||
void daemonDataSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDataSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDataSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonChannelSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonChannelSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonChannelSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDeviceReportGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDeviceSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
void daemonDeviceSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
|
||||
|
@ -89,7 +89,7 @@
|
||||
#include "SWGRDSReport_altFrequencies.h"
|
||||
#include "SWGRtlSdrReport.h"
|
||||
#include "SWGRtlSdrSettings.h"
|
||||
#include "SWGSDRDaemonDataSettings.h"
|
||||
#include "SWGSDRDaemonChannelSettings.h"
|
||||
#include "SWGSDRPlayReport.h"
|
||||
#include "SWGSDRPlaySettings.h"
|
||||
#include "SWGSDRdaemonSinkReport.h"
|
||||
@ -341,8 +341,8 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGRtlSdrSettings").compare(type) == 0) {
|
||||
return new SWGRtlSdrSettings();
|
||||
}
|
||||
if(QString("SWGSDRDaemonDataSettings").compare(type) == 0) {
|
||||
return new SWGSDRDaemonDataSettings();
|
||||
if(QString("SWGSDRDaemonChannelSettings").compare(type) == 0) {
|
||||
return new SWGSDRDaemonChannelSettings();
|
||||
}
|
||||
if(QString("SWGSDRPlayReport").compare(type) == 0) {
|
||||
return new SWGSDRPlayReport();
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "SWGSDRDaemonDataSettings.h"
|
||||
#include "SWGSDRDaemonChannelSettings.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
@ -22,12 +22,12 @@
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGSDRDaemonDataSettings::SWGSDRDaemonDataSettings(QString* json) {
|
||||
SWGSDRDaemonChannelSettings::SWGSDRDaemonChannelSettings(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGSDRDaemonDataSettings::SWGSDRDaemonDataSettings() {
|
||||
SWGSDRDaemonChannelSettings::SWGSDRDaemonChannelSettings() {
|
||||
nb_fec_blocks = 0;
|
||||
m_nb_fec_blocks_isSet = false;
|
||||
data_address = nullptr;
|
||||
@ -38,12 +38,12 @@ SWGSDRDaemonDataSettings::SWGSDRDaemonDataSettings() {
|
||||
m_tx_delay_isSet = false;
|
||||
}
|
||||
|
||||
SWGSDRDaemonDataSettings::~SWGSDRDaemonDataSettings() {
|
||||
SWGSDRDaemonChannelSettings::~SWGSDRDaemonChannelSettings() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGSDRDaemonDataSettings::init() {
|
||||
SWGSDRDaemonChannelSettings::init() {
|
||||
nb_fec_blocks = 0;
|
||||
m_nb_fec_blocks_isSet = false;
|
||||
data_address = new QString("");
|
||||
@ -55,7 +55,7 @@ SWGSDRDaemonDataSettings::init() {
|
||||
}
|
||||
|
||||
void
|
||||
SWGSDRDaemonDataSettings::cleanup() {
|
||||
SWGSDRDaemonChannelSettings::cleanup() {
|
||||
|
||||
if(data_address != nullptr) {
|
||||
delete data_address;
|
||||
@ -64,8 +64,8 @@ SWGSDRDaemonDataSettings::cleanup() {
|
||||
|
||||
}
|
||||
|
||||
SWGSDRDaemonDataSettings*
|
||||
SWGSDRDaemonDataSettings::fromJson(QString &json) {
|
||||
SWGSDRDaemonChannelSettings*
|
||||
SWGSDRDaemonChannelSettings::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
@ -74,7 +74,7 @@ SWGSDRDaemonDataSettings::fromJson(QString &json) {
|
||||
}
|
||||
|
||||
void
|
||||
SWGSDRDaemonDataSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
SWGSDRDaemonChannelSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&data_address, pJson["dataAddress"], "QString", "QString");
|
||||
@ -86,7 +86,7 @@ SWGSDRDaemonDataSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
}
|
||||
|
||||
QString
|
||||
SWGSDRDaemonDataSettings::asJson ()
|
||||
SWGSDRDaemonChannelSettings::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
@ -97,7 +97,7 @@ SWGSDRDaemonDataSettings::asJson ()
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGSDRDaemonDataSettings::asJsonObject() {
|
||||
SWGSDRDaemonChannelSettings::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(m_nb_fec_blocks_isSet){
|
||||
obj->insert("nbFECBlocks", QJsonValue(nb_fec_blocks));
|
||||
@ -116,48 +116,48 @@ SWGSDRDaemonDataSettings::asJsonObject() {
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRDaemonDataSettings::getNbFecBlocks() {
|
||||
SWGSDRDaemonChannelSettings::getNbFecBlocks() {
|
||||
return nb_fec_blocks;
|
||||
}
|
||||
void
|
||||
SWGSDRDaemonDataSettings::setNbFecBlocks(qint32 nb_fec_blocks) {
|
||||
SWGSDRDaemonChannelSettings::setNbFecBlocks(qint32 nb_fec_blocks) {
|
||||
this->nb_fec_blocks = nb_fec_blocks;
|
||||
this->m_nb_fec_blocks_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGSDRDaemonDataSettings::getDataAddress() {
|
||||
SWGSDRDaemonChannelSettings::getDataAddress() {
|
||||
return data_address;
|
||||
}
|
||||
void
|
||||
SWGSDRDaemonDataSettings::setDataAddress(QString* data_address) {
|
||||
SWGSDRDaemonChannelSettings::setDataAddress(QString* data_address) {
|
||||
this->data_address = data_address;
|
||||
this->m_data_address_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRDaemonDataSettings::getDataPort() {
|
||||
SWGSDRDaemonChannelSettings::getDataPort() {
|
||||
return data_port;
|
||||
}
|
||||
void
|
||||
SWGSDRDaemonDataSettings::setDataPort(qint32 data_port) {
|
||||
SWGSDRDaemonChannelSettings::setDataPort(qint32 data_port) {
|
||||
this->data_port = data_port;
|
||||
this->m_data_port_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGSDRDaemonDataSettings::getTxDelay() {
|
||||
SWGSDRDaemonChannelSettings::getTxDelay() {
|
||||
return tx_delay;
|
||||
}
|
||||
void
|
||||
SWGSDRDaemonDataSettings::setTxDelay(qint32 tx_delay) {
|
||||
SWGSDRDaemonChannelSettings::setTxDelay(qint32 tx_delay) {
|
||||
this->tx_delay = tx_delay;
|
||||
this->m_tx_delay_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGSDRDaemonDataSettings::isSet(){
|
||||
SWGSDRDaemonChannelSettings::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_nb_fec_blocks_isSet){ isObjectUpdated = true; break;}
|
@ -11,13 +11,13 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGSDRDaemonDataSettings.h
|
||||
* SWGSDRDaemonChannelSettings.h
|
||||
*
|
||||
* Data handling details for SDRDaemon
|
||||
*/
|
||||
|
||||
#ifndef SWGSDRDaemonDataSettings_H_
|
||||
#define SWGSDRDaemonDataSettings_H_
|
||||
#ifndef SWGSDRDaemonChannelSettings_H_
|
||||
#define SWGSDRDaemonChannelSettings_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
@ -29,18 +29,18 @@
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGSDRDaemonDataSettings: public SWGObject {
|
||||
class SWG_API SWGSDRDaemonChannelSettings: public SWGObject {
|
||||
public:
|
||||
SWGSDRDaemonDataSettings();
|
||||
SWGSDRDaemonDataSettings(QString* json);
|
||||
virtual ~SWGSDRDaemonDataSettings();
|
||||
SWGSDRDaemonChannelSettings();
|
||||
SWGSDRDaemonChannelSettings(QString* json);
|
||||
virtual ~SWGSDRDaemonChannelSettings();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGSDRDaemonDataSettings* fromJson(QString &jsonString) override;
|
||||
virtual SWGSDRDaemonChannelSettings* fromJson(QString &jsonString) override;
|
||||
|
||||
qint32 getNbFecBlocks();
|
||||
void setNbFecBlocks(qint32 nb_fec_blocks);
|
||||
@ -74,4 +74,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGSDRDaemonDataSettings_H_ */
|
||||
#endif /* SWGSDRDaemonChannelSettings_H_ */
|
Loading…
Reference in New Issue
Block a user