1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

KiwiSDR: implemented REST API and cosmetic changes

This commit is contained in:
f4exb 2019-06-08 21:25:08 +02:00
parent 9e8c8a4507
commit 4c04ac85ed
25 changed files with 688 additions and 16 deletions

View File

@ -1,3 +1,9 @@
sdrangel (4.10.0-1) unstable; urgency=medium
* Support for KiwiSDR
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 09 Jun 2019 20:44:06 +0100
sdrangel (4.9.1-1) unstable; urgency=medium
* WFM demod: variable RF bandwidth. Implements #320

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
sdrangel (4.10.0-1) unstable; urgency=medium
* Support for KiwiSDR
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 09 Jun 2019 20:44:06 +0100
sdrangel (4.9.1-1) unstable; urgency=medium
* WFM demod: variable RF bandwidth. Implements #320

1
debian/control vendored
View File

@ -12,6 +12,7 @@ Build-Depends: debhelper (>= 9),
qttools5-dev-tools,
qtmultimedia5-dev,
libqt5multimedia5-plugins,
libqt5websockets5-dev,
libusb-1.0-0-dev,
libboost-all-dev,
librtlsdr-dev,

View File

@ -15,6 +15,7 @@ set(kiwisdr_HEADERS
)
include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
${Boost_INCLUDE_DIRS}
)
@ -22,7 +23,6 @@ if(NOT SERVER_MODE)
set(kiwisdr_SOURCES
${kiwisdr_SOURCES}
kiwisdrgui.cpp
kiwisdrgui.ui
)
set(kiwisdr_HEADERS

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Vort //
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Vort //
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Vort //
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
@ -24,6 +24,9 @@
#include <QNetworkAccessManager>
#include <QBuffer>
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "kiwisdrinput.h"
#include "device/deviceapi.h"
#include "kiwisdrworker.h"
@ -290,7 +293,9 @@ int KiwiSDRInput::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage)
{
return 404;
(void) errorMessage;
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
return 200;
}
int KiwiSDRInput::webapiRun(
@ -298,14 +303,29 @@ int KiwiSDRInput::webapiRun(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage)
{
return 404;
(void) errorMessage;
m_deviceAPI->getDeviceEngineStateStr(*response.getState());
MsgStartStop *message = MsgStartStop::create(run);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgStartStop *msgToGUI = MsgStartStop::create(run);
m_guiMessageQueue->push(msgToGUI);
}
return 200;
}
int KiwiSDRInput::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage)
{
return 404;
(void) errorMessage;
response.setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings());
response.getKiwiSdrSettings()->init();
webapiFormatDeviceSettings(response, m_settings);
return 200;
}
int KiwiSDRInput::webapiSettingsPutPatch(
@ -314,19 +334,126 @@ int KiwiSDRInput::webapiSettingsPutPatch(
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage)
{
return 404;
(void) errorMessage;
KiwiSDRSettings settings = m_settings;
if (deviceSettingsKeys.contains("gain")) {
settings.m_gain = response.getKiwiSdrSettings()->getGain();
}
if (deviceSettingsKeys.contains("useAGC")) {
settings.m_useAGC = response.getKiwiSdrSettings()->getUseAgc();
}
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getKiwiSdrSettings()->getCenterFrequency();
}
if (deviceSettingsKeys.contains("serverAddress")) {
settings.m_serverAddress = *response.getKiwiSdrSettings()->getServerAddress();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getKiwiSdrSettings()->getUseReverseApi() != 0;
}
if (deviceSettingsKeys.contains("reverseAPIAddress")) {
settings.m_reverseAPIAddress = *response.getKiwiSdrSettings()->getReverseApiAddress();
}
if (deviceSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getKiwiSdrSettings()->getReverseApiPort();
}
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getKiwiSdrSettings()->getReverseApiDeviceIndex();
}
MsgConfigureKiwiSDR *msg = MsgConfigureKiwiSDR::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureKiwiSDR *msgToGUI = MsgConfigureKiwiSDR::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatDeviceSettings(response, settings);
return 200;
}
void KiwiSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const KiwiSDRSettings& settings)
{
response.getKiwiSdrSettings()->setGain(settings.m_gain);
response.getKiwiSdrSettings()->setUseAgc(settings.m_useAGC ? 1 : 0);
response.getKiwiSdrSettings()->setCenterFrequency(settings.m_centerFrequency);
if (response.getKiwiSdrSettings()->getServerAddress()) {
*response.getKiwiSdrSettings()->getServerAddress() = settings.m_serverAddress;
} else {
response.getKiwiSdrSettings()->setServerAddress(new QString(settings.m_serverAddress));
}
}
void KiwiSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const KiwiSDRSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
swgDeviceSettings->setDirection(0); // single Rx
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
swgDeviceSettings->setDeviceHwType(new QString("KiwiSDR"));
swgDeviceSettings->setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings());
SWGSDRangel::SWGKiwiSDRSettings *swgKiwiSDRSettings = swgDeviceSettings->getKiwiSdrSettings();
// transfer data that has been modified. When force is on transfer all data except reverse API data
if (deviceSettingsKeys.contains("gain")) {
swgKiwiSDRSettings->setGain(settings.m_gain);
}
if (deviceSettingsKeys.contains("useAGC")) {
swgKiwiSDRSettings->setUseAgc(settings.m_useAGC ? 1 : 0);
}
if (deviceSettingsKeys.contains("centerFrequency") || force) {
swgKiwiSDRSettings->setCenterFrequency(settings.m_centerFrequency);
}
if (deviceSettingsKeys.contains("serverAddress") || force) {
swgKiwiSDRSettings->setServerAddress(new QString(settings.m_serverAddress));
}
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)
.arg(settings.m_reverseAPIPort)
.arg(settings.m_reverseAPIDeviceIndex);
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer=new QBuffer();
buffer->open((QBuffer::ReadWrite));
buffer->write(swgDeviceSettings->asJson().toUtf8());
buffer->seek(0);
// Always use PATCH to avoid passing reverse API settings
m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
delete swgDeviceSettings;
}
void KiwiSDRInput::webapiReverseSendStartStop(bool start)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
swgDeviceSettings->setDirection(0); // single Rx
swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
swgDeviceSettings->setDeviceHwType(new QString("KiwiSDR"));
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
.arg(m_settings.m_reverseAPIAddress)
.arg(m_settings.m_reverseAPIPort)
.arg(m_settings.m_reverseAPIDeviceIndex);
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer=new QBuffer();
buffer->open((QBuffer::ReadWrite));
buffer->write(swgDeviceSettings->asJson().toUtf8());
buffer->seek(0);
if (start) {
m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
}
void KiwiSDRInput::networkManagerFinished(QNetworkReply *reply)

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Vort //
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //

View File

@ -1,5 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Vort //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
@ -29,7 +30,7 @@
const PluginDescriptor KiwiSDRPlugin::m_pluginDescriptor = {
QString("KiwiSDR input"),
QString("0.0.1"),
QString("4.10.0"),
QString("(c) Vort (c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,

View File

@ -1,5 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Vort //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Vort //
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Vort //
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //

View File

@ -20,6 +20,7 @@
<file>webapi/doc/swagger/include/FreqTracker.yaml</file>
<file>webapi/doc/swagger/include/HackRF.yaml</file>
<file>webapi/doc/swagger/include/LimeSdr.yaml</file>
<file>webapi/doc/swagger/include/KiwiSDR.yaml</file>
<file>webapi/doc/swagger/include/LocalInput.yaml</file>
<file>webapi/doc/swagger/include/LocalOutput.yaml</file>
<file>webapi/doc/swagger/include/NFMDemod.yaml</file>

View File

@ -2297,6 +2297,9 @@ margin-bottom: 20px;
"hackRFOutputSettings" : {
"$ref" : "#/definitions/HackRFOutputSettings"
},
"kiwiSDRSettings" : {
"$ref" : "#/definitions/KiwiSDRSettings"
},
"limeSdrInputSettings" : {
"$ref" : "#/definitions/LimeSdrInputSettings"
},
@ -3073,6 +3076,39 @@ margin-bottom: 20px;
}
},
"description" : "Summarized information about this SDRangel instance"
};
defs.KiwiSDRSettings = {
"properties" : {
"gain" : {
"type" : "integer"
},
"useAGC" : {
"type" : "integer",
"description" : "AGC active (1 for yes, 0 for no)"
},
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"serverAddress" : {
"type" : "string",
"description" : "Distant KiwiSDR instance URL or IPv4 address with port"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
}
},
"description" : "KiwiSDR"
};
defs.LimeSdrInputReport = {
"properties" : {
@ -25100,7 +25136,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-05-25T21:27:31.978+02:00
Generated 2019-06-08T11:06:14.976+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,23 @@
KiwiSDRSettings:
description: KiwiSDR
properties:
gain:
type: integer
useAGC:
description: AGC active (1 for yes, 0 for no)
type: integer
centerFrequency:
type: integer
format: int64
serverAddress:
description: Distant KiwiSDR instance URL or IPv4 address with port
type: string
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer

View File

@ -1802,6 +1802,8 @@ definitions:
$ref: "/doc/swagger/include/HackRF.yaml#/HackRFInputSettings"
hackRFOutputSettings:
$ref: "/doc/swagger/include/HackRF.yaml#/HackRFOutputSettings"
kiwiSDRSettings:
$ref: "/doc/swagger/include/KiwiSDR.yaml#/KiwiSDRSettings"
limeSdrInputSettings:
$ref: "/doc/swagger/include/LimeSdr.yaml#/LimeSdrInputSettings"
limeSdrOutputSettings:

View File

@ -1944,6 +1944,21 @@ bool WebAPIRequestMapper::validateDeviceSettings(
return false;
}
}
else if ((*deviceHwType == "KiwiSDR") && (deviceSettings.getDirection() == 0))
{
if (jsonObject.contains("kiwiSDRSettings") && jsonObject["kiwiSDRSettings"].isObject())
{
QJsonObject kiwiSDRSettingsJsonObject = jsonObject["kiwiSDRSettings"].toObject();
deviceSettingsKeys = kiwiSDRSettingsJsonObject.keys();
deviceSettings.setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings());
deviceSettings.getKiwiSdrSettings()->fromJsonObject(kiwiSDRSettingsJsonObject);
return true;
}
else
{
return false;
}
}
else if ((*deviceHwType == "LimeSDR") && (deviceSettings.getDirection() == 0))
{
if (jsonObject.contains("limeSdrInputSettings") && jsonObject["limeSdrInputSettings"].isObject())

View File

@ -0,0 +1,23 @@
KiwiSDRSettings:
description: KiwiSDR
properties:
gain:
type: integer
useAGC:
description: AGC active (1 for yes, 0 for no)
type: integer
centerFrequency:
type: integer
format: int64
serverAddress:
description: Distant KiwiSDR instance URL or IPv4 address with port
type: string
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer

View File

@ -1802,6 +1802,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/HackRF.yaml#/HackRFInputSettings"
hackRFOutputSettings:
$ref: "http://localhost:8081/api/swagger/include/HackRF.yaml#/HackRFOutputSettings"
kiwiSDRSettings:
$ref: "http://localhost:8081/api/swagger/include/KiwiSDR.yaml#/KiwiSDRSettings"
limeSdrInputSettings:
$ref: "http://localhost:8081/api/swagger/include/LimeSdr.yaml#/LimeSdrInputSettings"
limeSdrOutputSettings:

View File

@ -2297,6 +2297,9 @@ margin-bottom: 20px;
"hackRFOutputSettings" : {
"$ref" : "#/definitions/HackRFOutputSettings"
},
"kiwiSDRSettings" : {
"$ref" : "#/definitions/KiwiSDRSettings"
},
"limeSdrInputSettings" : {
"$ref" : "#/definitions/LimeSdrInputSettings"
},
@ -3073,6 +3076,39 @@ margin-bottom: 20px;
}
},
"description" : "Summarized information about this SDRangel instance"
};
defs.KiwiSDRSettings = {
"properties" : {
"gain" : {
"type" : "integer"
},
"useAGC" : {
"type" : "integer",
"description" : "AGC active (1 for yes, 0 for no)"
},
"centerFrequency" : {
"type" : "integer",
"format" : "int64"
},
"serverAddress" : {
"type" : "string",
"description" : "Distant KiwiSDR instance URL or IPv4 address with port"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
}
},
"description" : "KiwiSDR"
};
defs.LimeSdrInputReport = {
"properties" : {
@ -25100,7 +25136,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-05-25T21:27:31.978+02:00
Generated 2019-06-08T11:06:14.976+02:00
</div>
</div>
</div>

View File

@ -56,6 +56,8 @@ SWGDeviceSettings::SWGDeviceSettings() {
m_hack_rf_input_settings_isSet = false;
hack_rf_output_settings = nullptr;
m_hack_rf_output_settings_isSet = false;
kiwi_sdr_settings = nullptr;
m_kiwi_sdr_settings_isSet = false;
lime_sdr_input_settings = nullptr;
m_lime_sdr_input_settings_isSet = false;
lime_sdr_output_settings = nullptr;
@ -126,6 +128,8 @@ SWGDeviceSettings::init() {
m_hack_rf_input_settings_isSet = false;
hack_rf_output_settings = new SWGHackRFOutputSettings();
m_hack_rf_output_settings_isSet = false;
kiwi_sdr_settings = new SWGKiwiSDRSettings();
m_kiwi_sdr_settings_isSet = false;
lime_sdr_input_settings = new SWGLimeSdrInputSettings();
m_lime_sdr_input_settings_isSet = false;
lime_sdr_output_settings = new SWGLimeSdrOutputSettings();
@ -202,6 +206,9 @@ SWGDeviceSettings::cleanup() {
if(hack_rf_output_settings != nullptr) {
delete hack_rf_output_settings;
}
if(kiwi_sdr_settings != nullptr) {
delete kiwi_sdr_settings;
}
if(lime_sdr_input_settings != nullptr) {
delete lime_sdr_input_settings;
}
@ -294,6 +301,8 @@ SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&hack_rf_output_settings, pJson["hackRFOutputSettings"], "SWGHackRFOutputSettings", "SWGHackRFOutputSettings");
::SWGSDRangel::setValue(&kiwi_sdr_settings, pJson["kiwiSDRSettings"], "SWGKiwiSDRSettings", "SWGKiwiSDRSettings");
::SWGSDRangel::setValue(&lime_sdr_input_settings, pJson["limeSdrInputSettings"], "SWGLimeSdrInputSettings", "SWGLimeSdrInputSettings");
::SWGSDRangel::setValue(&lime_sdr_output_settings, pJson["limeSdrOutputSettings"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings");
@ -386,6 +395,9 @@ SWGDeviceSettings::asJsonObject() {
if((hack_rf_output_settings != nullptr) && (hack_rf_output_settings->isSet())){
toJsonValue(QString("hackRFOutputSettings"), hack_rf_output_settings, obj, QString("SWGHackRFOutputSettings"));
}
if((kiwi_sdr_settings != nullptr) && (kiwi_sdr_settings->isSet())){
toJsonValue(QString("kiwiSDRSettings"), kiwi_sdr_settings, obj, QString("SWGKiwiSDRSettings"));
}
if((lime_sdr_input_settings != nullptr) && (lime_sdr_input_settings->isSet())){
toJsonValue(QString("limeSdrInputSettings"), lime_sdr_input_settings, obj, QString("SWGLimeSdrInputSettings"));
}
@ -581,6 +593,16 @@ SWGDeviceSettings::setHackRfOutputSettings(SWGHackRFOutputSettings* hack_rf_outp
this->m_hack_rf_output_settings_isSet = true;
}
SWGKiwiSDRSettings*
SWGDeviceSettings::getKiwiSdrSettings() {
return kiwi_sdr_settings;
}
void
SWGDeviceSettings::setKiwiSdrSettings(SWGKiwiSDRSettings* kiwi_sdr_settings) {
this->kiwi_sdr_settings = kiwi_sdr_settings;
this->m_kiwi_sdr_settings_isSet = true;
}
SWGLimeSdrInputSettings*
SWGDeviceSettings::getLimeSdrInputSettings() {
return lime_sdr_input_settings;
@ -770,6 +792,7 @@ SWGDeviceSettings::isSet(){
if(file_source_settings != nullptr && file_source_settings->isSet()){ isObjectUpdated = true; break;}
if(hack_rf_input_settings != nullptr && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break;}
if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;}
if(kiwi_sdr_settings != nullptr && kiwi_sdr_settings->isSet()){ isObjectUpdated = true; break;}
if(lime_sdr_input_settings != nullptr && lime_sdr_input_settings->isSet()){ isObjectUpdated = true; break;}
if(lime_sdr_output_settings != nullptr && lime_sdr_output_settings->isSet()){ isObjectUpdated = true; break;}
if(local_input_settings != nullptr && local_input_settings->isSet()){ isObjectUpdated = true; break;}

View File

@ -33,6 +33,7 @@
#include "SWGFileSourceSettings.h"
#include "SWGHackRFInputSettings.h"
#include "SWGHackRFOutputSettings.h"
#include "SWGKiwiSDRSettings.h"
#include "SWGLimeSdrInputSettings.h"
#include "SWGLimeSdrOutputSettings.h"
#include "SWGLocalInputSettings.h"
@ -112,6 +113,9 @@ public:
SWGHackRFOutputSettings* getHackRfOutputSettings();
void setHackRfOutputSettings(SWGHackRFOutputSettings* hack_rf_output_settings);
SWGKiwiSDRSettings* getKiwiSdrSettings();
void setKiwiSdrSettings(SWGKiwiSDRSettings* kiwi_sdr_settings);
SWGLimeSdrInputSettings* getLimeSdrInputSettings();
void setLimeSdrInputSettings(SWGLimeSdrInputSettings* lime_sdr_input_settings);
@ -209,6 +213,9 @@ private:
SWGHackRFOutputSettings* hack_rf_output_settings;
bool m_hack_rf_output_settings_isSet;
SWGKiwiSDRSettings* kiwi_sdr_settings;
bool m_kiwi_sdr_settings_isSet;
SWGLimeSdrInputSettings* lime_sdr_input_settings;
bool m_lime_sdr_input_settings_isSet;

View File

@ -0,0 +1,257 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 4.8.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 "SWGKiwiSDRSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGKiwiSDRSettings::SWGKiwiSDRSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGKiwiSDRSettings::SWGKiwiSDRSettings() {
gain = 0;
m_gain_isSet = false;
use_agc = 0;
m_use_agc_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
server_address = nullptr;
m_server_address_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = nullptr;
m_reverse_api_address_isSet = false;
reverse_api_port = 0;
m_reverse_api_port_isSet = false;
reverse_api_device_index = 0;
m_reverse_api_device_index_isSet = false;
}
SWGKiwiSDRSettings::~SWGKiwiSDRSettings() {
this->cleanup();
}
void
SWGKiwiSDRSettings::init() {
gain = 0;
m_gain_isSet = false;
use_agc = 0;
m_use_agc_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
server_address = new QString("");
m_server_address_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = new QString("");
m_reverse_api_address_isSet = false;
reverse_api_port = 0;
m_reverse_api_port_isSet = false;
reverse_api_device_index = 0;
m_reverse_api_device_index_isSet = false;
}
void
SWGKiwiSDRSettings::cleanup() {
if(server_address != nullptr) {
delete server_address;
}
if(reverse_api_address != nullptr) {
delete reverse_api_address;
}
}
SWGKiwiSDRSettings*
SWGKiwiSDRSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGKiwiSDRSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&use_agc, pJson["useAGC"], "qint32", "");
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&server_address, pJson["serverAddress"], "QString", "QString");
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
}
QString
SWGKiwiSDRSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGKiwiSDRSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_gain_isSet){
obj->insert("gain", QJsonValue(gain));
}
if(m_use_agc_isSet){
obj->insert("useAGC", QJsonValue(use_agc));
}
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency));
}
if(server_address != nullptr && *server_address != QString("")){
toJsonValue(QString("serverAddress"), server_address, obj, QString("QString"));
}
if(m_use_reverse_api_isSet){
obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
}
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
}
if(m_reverse_api_port_isSet){
obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
}
if(m_reverse_api_device_index_isSet){
obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
}
return obj;
}
qint32
SWGKiwiSDRSettings::getGain() {
return gain;
}
void
SWGKiwiSDRSettings::setGain(qint32 gain) {
this->gain = gain;
this->m_gain_isSet = true;
}
qint32
SWGKiwiSDRSettings::getUseAgc() {
return use_agc;
}
void
SWGKiwiSDRSettings::setUseAgc(qint32 use_agc) {
this->use_agc = use_agc;
this->m_use_agc_isSet = true;
}
qint64
SWGKiwiSDRSettings::getCenterFrequency() {
return center_frequency;
}
void
SWGKiwiSDRSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
}
QString*
SWGKiwiSDRSettings::getServerAddress() {
return server_address;
}
void
SWGKiwiSDRSettings::setServerAddress(QString* server_address) {
this->server_address = server_address;
this->m_server_address_isSet = true;
}
qint32
SWGKiwiSDRSettings::getUseReverseApi() {
return use_reverse_api;
}
void
SWGKiwiSDRSettings::setUseReverseApi(qint32 use_reverse_api) {
this->use_reverse_api = use_reverse_api;
this->m_use_reverse_api_isSet = true;
}
QString*
SWGKiwiSDRSettings::getReverseApiAddress() {
return reverse_api_address;
}
void
SWGKiwiSDRSettings::setReverseApiAddress(QString* reverse_api_address) {
this->reverse_api_address = reverse_api_address;
this->m_reverse_api_address_isSet = true;
}
qint32
SWGKiwiSDRSettings::getReverseApiPort() {
return reverse_api_port;
}
void
SWGKiwiSDRSettings::setReverseApiPort(qint32 reverse_api_port) {
this->reverse_api_port = reverse_api_port;
this->m_reverse_api_port_isSet = true;
}
qint32
SWGKiwiSDRSettings::getReverseApiDeviceIndex() {
return reverse_api_device_index;
}
void
SWGKiwiSDRSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
this->reverse_api_device_index = reverse_api_device_index;
this->m_reverse_api_device_index_isSet = true;
}
bool
SWGKiwiSDRSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_gain_isSet){ isObjectUpdated = true; break;}
if(m_use_agc_isSet){ isObjectUpdated = true; break;}
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(server_address != nullptr && *server_address != QString("")){ isObjectUpdated = true; break;}
if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,101 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time ---
*
* OpenAPI spec version: 4.8.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.
*/
/*
* SWGKiwiSDRSettings.h
*
* KiwiSDR
*/
#ifndef SWGKiwiSDRSettings_H_
#define SWGKiwiSDRSettings_H_
#include <QJsonObject>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGKiwiSDRSettings: public SWGObject {
public:
SWGKiwiSDRSettings();
SWGKiwiSDRSettings(QString* json);
virtual ~SWGKiwiSDRSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGKiwiSDRSettings* fromJson(QString &jsonString) override;
qint32 getGain();
void setGain(qint32 gain);
qint32 getUseAgc();
void setUseAgc(qint32 use_agc);
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
QString* getServerAddress();
void setServerAddress(QString* server_address);
qint32 getUseReverseApi();
void setUseReverseApi(qint32 use_reverse_api);
QString* getReverseApiAddress();
void setReverseApiAddress(QString* reverse_api_address);
qint32 getReverseApiPort();
void setReverseApiPort(qint32 reverse_api_port);
qint32 getReverseApiDeviceIndex();
void setReverseApiDeviceIndex(qint32 reverse_api_device_index);
virtual bool isSet() override;
private:
qint32 gain;
bool m_gain_isSet;
qint32 use_agc;
bool m_use_agc_isSet;
qint64 center_frequency;
bool m_center_frequency_isSet;
QString* server_address;
bool m_server_address_isSet;
qint32 use_reverse_api;
bool m_use_reverse_api_isSet;
QString* reverse_api_address;
bool m_reverse_api_address_isSet;
qint32 reverse_api_port;
bool m_reverse_api_port_isSet;
qint32 reverse_api_device_index;
bool m_reverse_api_device_index_isSet;
};
}
#endif /* SWGKiwiSDRSettings_H_ */

View File

@ -75,6 +75,7 @@
#include "SWGInstanceChannelsResponse.h"
#include "SWGInstanceDevicesResponse.h"
#include "SWGInstanceSummaryResponse.h"
#include "SWGKiwiSDRSettings.h"
#include "SWGLimeSdrInputReport.h"
#include "SWGLimeSdrInputSettings.h"
#include "SWGLimeSdrOutputReport.h"
@ -334,6 +335,9 @@ namespace SWGSDRangel {
if(QString("SWGInstanceSummaryResponse").compare(type) == 0) {
return new SWGInstanceSummaryResponse();
}
if(QString("SWGKiwiSDRSettings").compare(type) == 0) {
return new SWGKiwiSDRSettings();
}
if(QString("SWGLimeSdrInputReport").compare(type) == 0) {
return new SWGLimeSdrInputReport();
}