2017-12-01 23:45:30 -05:00
|
|
|
/**
|
|
|
|
* SDRangel
|
2018-01-05 21:46:53 -05:00
|
|
|
* 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. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * 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 demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
|
2017-12-01 23:45:30 -05:00
|
|
|
*
|
|
|
|
* OpenAPI spec version: 4.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 "SWGDeviceSetApi.h"
|
|
|
|
#include "SWGHelpers.h"
|
|
|
|
#include "SWGModelFactory.h"
|
|
|
|
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
|
|
|
|
|
|
|
namespace SWGSDRangel {
|
|
|
|
|
|
|
|
SWGDeviceSetApi::SWGDeviceSetApi() {}
|
|
|
|
|
|
|
|
SWGDeviceSetApi::~SWGDeviceSetApi() {}
|
|
|
|
|
|
|
|
SWGDeviceSetApi::SWGDeviceSetApi(QString host, QString basePath) {
|
|
|
|
this->host = host;
|
|
|
|
this->basePath = basePath;
|
|
|
|
}
|
|
|
|
|
2017-12-10 14:27:08 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}");
|
|
|
|
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "DELETE");
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-10 14:27:08 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelDeleteCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelDeleteCallback(SWGHttpRequestWorker * worker) {
|
2017-12-10 14:27:08 -05:00
|
|
|
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);
|
|
|
|
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelDeleteSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelDeleteSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelDeleteSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-10 14:27:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSettings& body) {
|
2017-12-10 14:27:08 -05:00
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "POST");
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
|
2017-12-10 14:27:08 -05:00
|
|
|
QString output = body.asJson();
|
|
|
|
input.request_body.append(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-10 14:27:08 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelPostCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelPostCallback(SWGHttpRequestWorker * worker) {
|
2017-12-10 14:27:08 -05:00
|
|
|
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);
|
2017-12-19 11:55:05 -05:00
|
|
|
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
|
2017-12-10 14:27:08 -05:00
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelPostSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelPostSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelPostSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-10 14:27:08 -05:00
|
|
|
}
|
|
|
|
|
2018-03-18 15:17:11 -04:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetChannelReportGet(qint32 device_set_index, qint32 channel_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/report");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}");
|
|
|
|
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelReportGetCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetChannelReportGetCallback(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);
|
|
|
|
SWGChannelReport* output = static_cast<SWGChannelReport*>(create(json, QString("SWGChannelReport")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelReportGetSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelReportGetSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelReportGetSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-10 14:27:08 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}");
|
|
|
|
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "GET");
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-10 14:27:08 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelSettingsGetCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelSettingsGetCallback(SWGHttpRequestWorker * worker) {
|
2017-12-10 14:27:08 -05:00
|
|
|
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);
|
|
|
|
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelSettingsGetSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelSettingsGetSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelSettingsGetSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-10 14:27:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body) {
|
2017-12-10 14:27:08 -05:00
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}");
|
|
|
|
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "PATCH");
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
|
2017-12-28 16:46:01 -05:00
|
|
|
QString output = body.asJson();
|
|
|
|
input.request_body.append(output);
|
|
|
|
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-10 14:27:08 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelSettingsPatchCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(SWGHttpRequestWorker * worker) {
|
2017-12-10 14:27:08 -05:00
|
|
|
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);
|
|
|
|
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelSettingsPatchSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelSettingsPatchSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelSettingsPatchSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-10 14:27:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body) {
|
2017-12-10 14:27:08 -05:00
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}");
|
|
|
|
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "PUT");
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
|
2017-12-28 16:46:01 -05:00
|
|
|
QString output = body.asJson();
|
|
|
|
input.request_body.append(output);
|
|
|
|
|
2017-12-10 14:27:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-10 14:27:08 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelSettingsPutCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetChannelSettingsPutCallback(SWGHttpRequestWorker * worker) {
|
2017-12-10 14:27:08 -05:00
|
|
|
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);
|
|
|
|
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelSettingsPutSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelSettingsPutSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelSettingsPutSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-10 14:27:08 -05:00
|
|
|
}
|
|
|
|
|
2018-03-18 19:08:38 -04:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetChannelsReportGet(qint32 device_set_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channels/report");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
&SWGDeviceSetApi::devicesetChannelsReportGetCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetChannelsReportGetCallback(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);
|
|
|
|
SWGChannelsDetail* output = static_cast<SWGChannelsDetail*>(create(json, QString("SWGChannelsDetail")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetChannelsReportGetSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetChannelsReportGetSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetChannelsReportGetSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-03 18:48:14 -05:00
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body) {
|
2017-12-06 17:49:14 -05:00
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "PUT");
|
2017-12-06 17:49:14 -05:00
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
|
2017-12-06 17:49:14 -05:00
|
|
|
QString output = body.asJson();
|
|
|
|
input.request_body.append(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-06 17:49:14 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetDevicePutCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDevicePutCallback(SWGHttpRequestWorker * worker) {
|
2017-12-06 17:49:14 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceListItem* output = static_cast<SWGDeviceListItem*>(create(json, QString("SWGDeviceListItem")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDevicePutSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDevicePutSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDevicePutSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-06 17:49:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "DELETE");
|
2017-12-06 17:49:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-06 17:49:14 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetDeviceRunDeleteCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(SWGHttpRequestWorker * worker) {
|
2017-12-06 17:49:14 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDeviceRunDeleteSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDeviceRunDeleteSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDeviceRunDeleteSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-06 17:49:14 -05:00
|
|
|
}
|
|
|
|
|
2017-12-09 04:49:20 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "GET");
|
2017-12-09 04:49:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-09 04:49:20 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetDeviceRunGetCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceRunGetCallback(SWGHttpRequestWorker * worker) {
|
2017-12-09 04:49:20 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDeviceRunGetSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDeviceRunGetSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDeviceRunGetSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-09 04:49:20 -05:00
|
|
|
}
|
|
|
|
|
2017-12-06 17:49:14 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/run");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "POST");
|
2017-12-06 17:49:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-06 17:49:14 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetDeviceRunPostCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceRunPostCallback(SWGHttpRequestWorker * worker) {
|
2017-12-06 17:49:14 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDeviceRunPostSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDeviceRunPostSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDeviceRunPostSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-06 17:49:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
|
2017-12-03 18:48:14 -05:00
|
|
|
QString fullPath;
|
2017-12-06 16:08:34 -05:00
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
|
2017-12-03 18:48:14 -05:00
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "GET");
|
2017-12-03 18:48:14 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-03 18:48:14 -05:00
|
|
|
this,
|
2017-12-06 17:49:14 -05:00
|
|
|
&SWGDeviceSetApi::devicesetDeviceSettingsGetCallback);
|
2017-12-03 18:48:14 -05:00
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(SWGHttpRequestWorker * worker) {
|
2017-12-03 18:48:14 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDeviceSettingsGetSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDeviceSettingsGetSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDeviceSettingsGetSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-03 18:48:14 -05:00
|
|
|
}
|
|
|
|
|
2017-12-01 23:45:30 -05:00
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings& body) {
|
2017-12-01 23:45:30 -05:00
|
|
|
QString fullPath;
|
2017-12-06 17:49:14 -05:00
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "PATCH");
|
2017-12-06 17:49:14 -05:00
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
|
2017-12-06 17:49:14 -05:00
|
|
|
QString output = body.asJson();
|
|
|
|
input.request_body.append(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-06 17:49:14 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(SWGHttpRequestWorker * worker) {
|
2017-12-06 17:49:14 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDeviceSettingsPatchSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDeviceSettingsPatchSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDeviceSettingsPatchSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-06 17:49:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings& body) {
|
2017-12-06 17:49:14 -05:00
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
|
2017-12-01 23:45:30 -05:00
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "PUT");
|
2017-12-01 23:45:30 -05:00
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
|
2017-12-01 23:45:30 -05:00
|
|
|
QString output = body.asJson();
|
|
|
|
input.request_body.append(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-01 23:45:30 -05:00
|
|
|
this,
|
2017-12-06 17:49:14 -05:00
|
|
|
&SWGDeviceSetApi::devicesetDeviceSettingsPutCallback);
|
2017-12-01 23:45:30 -05:00
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(SWGHttpRequestWorker * worker) {
|
2017-12-01 23:45:30 -05:00
|
|
|
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);
|
2017-12-06 17:49:14 -05:00
|
|
|
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
|
2017-12-01 23:45:30 -05:00
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetDeviceSettingsPutSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetDeviceSettingsPutSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetDeviceSettingsPutSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-01 23:45:30 -05:00
|
|
|
}
|
|
|
|
|
2018-01-05 21:46:53 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/focus");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "PATCH");
|
2018-01-05 21:46:53 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2018-01-05 21:46:53 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetFocusPatchCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetFocusPatchCallback(SWGHttpRequestWorker * worker) {
|
2018-01-05 21:46:53 -05:00
|
|
|
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);
|
2018-01-06 03:50:09 -05:00
|
|
|
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
|
2018-01-05 21:46:53 -05:00
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetFocusPatchSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetFocusPatchSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetFocusPatchSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2018-01-05 21:46:53 -05:00
|
|
|
}
|
|
|
|
|
2017-12-01 23:45:30 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}");
|
|
|
|
|
|
|
|
QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}");
|
|
|
|
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "GET");
|
2017-12-01 23:45:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-01 23:45:30 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::devicesetGetCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::devicesetGetCallback(SWGHttpRequestWorker * worker) {
|
2017-12-01 23:45:30 -05:00
|
|
|
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);
|
|
|
|
SWGDeviceSet* output = static_cast<SWGDeviceSet*>(create(json, QString("SWGDeviceSet")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit devicesetGetSignal(output);
|
|
|
|
} else {
|
|
|
|
emit devicesetGetSignalE(output, error_type, error_str);
|
|
|
|
emit devicesetGetSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-01 23:45:30 -05:00
|
|
|
}
|
|
|
|
|
2017-12-23 17:41:37 -05:00
|
|
|
void
|
|
|
|
SWGDeviceSetApi::instanceDeviceSetDelete() {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset");
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "DELETE");
|
2017-12-23 17:41:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-23 17:41:37 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::instanceDeviceSetDeleteCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::instanceDeviceSetDeleteCallback(SWGHttpRequestWorker * worker) {
|
2017-12-23 17:41:37 -05:00
|
|
|
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);
|
|
|
|
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit instanceDeviceSetDeleteSignal(output);
|
|
|
|
} else {
|
|
|
|
emit instanceDeviceSetDeleteSignalE(output, error_type, error_str);
|
|
|
|
emit instanceDeviceSetDeleteSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-23 17:41:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
|
|
|
|
QString fullPath;
|
|
|
|
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset");
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (fullPath.indexOf("?") > 0)
|
2017-12-23 17:41:37 -05:00
|
|
|
fullPath.append("&");
|
2018-02-12 12:20:27 -05:00
|
|
|
else
|
2017-12-23 17:41:37 -05:00
|
|
|
fullPath.append("?");
|
|
|
|
fullPath.append(QUrl::toPercentEncoding("tx"))
|
|
|
|
.append("=")
|
|
|
|
.append(QUrl::toPercentEncoding(stringValue(tx)));
|
|
|
|
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
|
|
|
|
SWGHttpRequestInput input(fullPath, "POST");
|
2017-12-23 17:41:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(QString key, this->defaultHeaders.keys()) {
|
|
|
|
input.headers.insert(key, this->defaultHeaders.value(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(worker,
|
2018-02-12 12:20:27 -05:00
|
|
|
&SWGHttpRequestWorker::on_execution_finished,
|
2017-12-23 17:41:37 -05:00
|
|
|
this,
|
|
|
|
&SWGDeviceSetApi::instanceDeviceSetPostCallback);
|
|
|
|
|
|
|
|
worker->execute(&input);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-02-12 12:20:27 -05:00
|
|
|
SWGDeviceSetApi::instanceDeviceSetPostCallback(SWGHttpRequestWorker * worker) {
|
2017-12-23 17:41:37 -05:00
|
|
|
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);
|
|
|
|
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
|
|
|
|
worker->deleteLater();
|
|
|
|
|
2018-02-12 12:20:27 -05:00
|
|
|
if (worker->error_type == QNetworkReply::NoError) {
|
|
|
|
emit instanceDeviceSetPostSignal(output);
|
|
|
|
} else {
|
|
|
|
emit instanceDeviceSetPostSignalE(output, error_type, error_str);
|
|
|
|
emit instanceDeviceSetPostSignalEFull(worker, error_type, error_str);
|
|
|
|
}
|
2017-12-23 17:41:37 -05:00
|
|
|
}
|
|
|
|
|
2017-12-01 23:45:30 -05:00
|
|
|
|
|
|
|
}
|