1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

Merge pull request #958 from srcejon/fix_953

Start to add support for device settings in Satellite Tracker web API
This commit is contained in:
Edouard Griffiths 2021-07-08 21:52:29 +02:00 committed by GitHub
commit 4dc1bce43b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1143 additions and 780 deletions

View File

@ -207,3 +207,7 @@ Full details of the API can be found in the Swagger documentation. Here is a qui
And how to set the target:
curl -X PATCH "http://127.0.0.1:8091/sdrangel/featureset/0/feature/0/settings" -d '{"featureType": "SatelliteTracker", "SatelliteTrackerSettings": { "target": "NOAA 15" }}'
Or, to set the device settings:
curl -X PATCH "http://127.0.0.1:8091/sdrangel/featureset/0/feature/0/settings" -d '{"featureType": "SatelliteTracker", "SatelliteTrackerSettings": { "deviceSettings": [ { "satellite": "ISS", "deviceSettings": [ { "deviceSet": "R0", "doppler": [1], "frequency": 0, "presetDescription": Sat", "presetFrequency": 145.825, "presetGroup": "ISS Digi", "startOnAOS": 1, "startStopFileSinks": 1, "stopOnLOS": 1}] } ] }}'

View File

@ -25,6 +25,8 @@
#include "SWGFeatureReport.h"
#include "SWGFeatureActions.h"
#include "SWGDeviceState.h"
#include "SWGSatelliteTrackerSettings.h"
#include "SWGSatelliteDeviceSettings.h"
#include "dsp/dspengine.h"
#include "util/httpdownloadmanager.h"
@ -388,6 +390,94 @@ static QStringList convertPtrsToStringList(QList<QString *> *listIn)
return listOut;
}
// Convert struct SatelliteDeviceSettings to Swagger
QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>* SatelliteTracker::getSWGSatelliteDeviceSettingsList(const SatelliteTrackerSettings& settings)
{
QList <SWGSDRangel::SWGSatelliteDeviceSettingsList*>* deviceSettingsList = new QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>();
QHashIterator<QString, QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *> i(settings.m_deviceSettings);
while (i.hasNext())
{
i.next();
QList<SatelliteTrackerSettings::SatelliteDeviceSettings*>* l = i.value();
if (l->size() > 0)
{
SWGSDRangel::SWGSatelliteDeviceSettingsList* dsl = new SWGSDRangel::SWGSatelliteDeviceSettingsList();
dsl->setSatellite(new QString(i.key()));
QList<SWGSDRangel::SWGSatelliteDeviceSettings*>* ds = new QList<SWGSDRangel::SWGSatelliteDeviceSettings*>();
for (int j = 0; j < l->size(); j++)
{
SWGSDRangel::SWGSatelliteDeviceSettings* deviceSettings = new SWGSDRangel::SWGSatelliteDeviceSettings();
deviceSettings->setDeviceSet(new QString(l->at(j)->m_deviceSet));
deviceSettings->setPresetGroup(new QString(l->at(j)->m_presetGroup));
deviceSettings->setPresetDescription(new QString(l->at(j)->m_presetDescription));
deviceSettings->setPresetFrequency(l->at(j)->m_presetFrequency);
QList<qint32>* doppler = new QList<qint32>();
for (int k = 0; k < l->at(j)->m_doppler.size(); k++) {
doppler->append(l->at(j)->m_doppler[k]);
}
deviceSettings->setDoppler(doppler);
deviceSettings->setStartOnAos((int)l->at(j)->m_startOnAOS);
deviceSettings->setStopOnLos((int)l->at(j)->m_stopOnLOS);
deviceSettings->setStartStopFileSinks((int)l->at(j)->m_startStopFileSink);
deviceSettings->setFrequency((int)l->at(j)->m_frequency);
deviceSettings->setAosCommand(new QString(l->at(j)->m_aosCommand));
deviceSettings->setLosCommand(new QString(l->at(j)->m_losCommand));
ds->append(deviceSettings);
}
dsl->setDeviceSettings(ds);
deviceSettingsList->append(dsl);
}
}
return deviceSettingsList;
}
// Convert Swagger device settings to struct SatelliteDeviceSettings
QHash<QString, QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *> SatelliteTracker::getSatelliteDeviceSettings(QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>* list)
{
QHash<QString, QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *> hash;
for (int i = 0; i < list->size(); i++)
{
SWGSDRangel::SWGSatelliteDeviceSettingsList* satList = list->at(i);
if (satList->getSatellite())
{
QString satellite = *satList->getSatellite();
QList<SWGSDRangel::SWGSatelliteDeviceSettings*>* swgDeviceSettingsList = satList->getDeviceSettings();
if (swgDeviceSettingsList)
{
QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *deviceSettingsList = new QList<SatelliteTrackerSettings::SatelliteDeviceSettings *>();
for (int j = 0; j < swgDeviceSettingsList->size(); j++)
{
SatelliteTrackerSettings::SatelliteDeviceSettings *deviceSettings = new SatelliteTrackerSettings::SatelliteDeviceSettings();
deviceSettings->m_deviceSet = *swgDeviceSettingsList->at(j)->getDeviceSet();
deviceSettings->m_presetGroup = *swgDeviceSettingsList->at(j)->getPresetGroup();
deviceSettings->m_presetFrequency = swgDeviceSettingsList->at(j)->getPresetFrequency();
deviceSettings->m_presetDescription = *swgDeviceSettingsList->at(j)->getPresetDescription();
deviceSettings->m_doppler = *swgDeviceSettingsList->at(j)->getDoppler();
deviceSettings->m_startOnAOS = swgDeviceSettingsList->at(j)->getStartOnAos();
deviceSettings->m_stopOnLOS = swgDeviceSettingsList->at(j)->getStopOnLos();
deviceSettings->m_startStopFileSink = swgDeviceSettingsList->at(j)->getStartStopFileSinks();
deviceSettings->m_frequency = swgDeviceSettingsList->at(j)->getFrequency();
deviceSettings->m_aosCommand = *swgDeviceSettingsList->at(j)->getAosCommand();
deviceSettings->m_losCommand = *swgDeviceSettingsList->at(j)->getLosCommand();
deviceSettingsList->append(deviceSettings);
}
hash.insert(satellite, deviceSettingsList);
}
else
{
qDebug() << "SatelliteTracker::getSatelliteDeviceSettings: No device settings for satellite " << satellite;
}
}
else
{
qDebug() << "SatelliteTracker::getSatelliteDeviceSettings: No satellite name in device settings";
}
}
return hash;
}
void SatelliteTracker::webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response,
const SatelliteTrackerSettings& settings)
@ -417,6 +507,7 @@ void SatelliteTracker::webapiFormatFeatureSettings(
response.getSatelliteTrackerSettings()->setPredictionPeriod(settings.m_predictionPeriod);
response.getSatelliteTrackerSettings()->setPassStartTime(new QString(settings.m_passStartTime.toString()));
response.getSatelliteTrackerSettings()->setPassFinishTime(new QString(settings.m_passFinishTime.toString()));
response.getSatelliteTrackerSettings()->setDeviceSettings(getSWGSatelliteDeviceSettingsList(settings));
if (response.getSatelliteTrackerSettings()->getTitle()) {
*response.getSatelliteTrackerSettings()->getTitle() = settings.m_title;
@ -518,6 +609,9 @@ void SatelliteTracker::webapiUpdateFeatureSettings(
if (featureSettingsKeys.contains("passFinishTime")) {
settings.m_passFinishTime = QTime::fromString(*response.getSatelliteTrackerSettings()->getPassFinishTime());
}
if (featureSettingsKeys.contains("deviceSettings")) {
settings.m_deviceSettings = getSatelliteDeviceSettings(response.getSatelliteTrackerSettings()->getDeviceSettings());
}
if (featureSettingsKeys.contains("title")) {
settings.m_title = *response.getSatelliteTrackerSettings()->getTitle();
}
@ -624,6 +718,9 @@ void SatelliteTracker::webapiReverseSendSettings(QList<QString>& featureSettings
if (featureSettingsKeys.contains("passFinishTime") || force) {
swgSatelliteTrackerSettings->setPassFinishTime(new QString(settings.m_passFinishTime.toString()));
}
if (featureSettingsKeys.contains("deviceSettings") || force) {
swgSatelliteTrackerSettings->setDeviceSettings(getSWGSatelliteDeviceSettingsList(settings));
}
if (featureSettingsKeys.contains("title") || force) {
swgSatelliteTrackerSettings->setTitle(new QString(settings.m_title));
}

View File

@ -36,6 +36,7 @@ class QNetworkReply;
namespace SWGSDRangel {
class SWGDeviceState;
class SWGSatelliteDeviceSettingsList;
}
class SatelliteTracker : public Feature
@ -191,6 +192,8 @@ private:
void updateSatellitesReply(QNetworkReply *reply);
void updateTransmittersReply(QNetworkReply *reply);
void updateTLEsReply(QNetworkReply *reply);
static QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>* getSWGSatelliteDeviceSettingsList(const SatelliteTrackerSettings& settings);
static QHash<QString, QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *> getSatelliteDeviceSettings(QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>* list);
private slots:
void networkManagerFinished(QNetworkReply *reply);

View File

@ -92,6 +92,11 @@ SatelliteTrackerSettings:
losCommand:
description: "Command to execute on LOS for all satellites"
type: string
deviceSettings:
description: "Device set settings to apply on AOS / LOS"
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/SatelliteTracker.yaml#/SatelliteDeviceSettingsList"
title:
type: string
rgbColor:
@ -107,3 +112,56 @@ SatelliteTrackerSettings:
type: integer
reverseAPIChannelIndex:
type: integer
SatelliteDeviceSettingsList:
description: "List of device set settings for a satellite"
properties:
satellite:
description: "Name of the satellite"
type: string
deviceSettings:
description: "Device set settings"
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/SatelliteTracker.yaml#/SatelliteDeviceSettings"
SatelliteDeviceSettings:
description: "Device set settings"
properties:
deviceSet:
description: "Name of the device set (E.g. R0)"
type: string
presetGroup:
description: "Group for preset to load on AOS"
type: string
presetFrequency:
description: "Frequency of preset to load on AOS"
type: integer
format: int64
presetDescription:
description: "Description of preset to load on AOS"
type: string
doppler:
description: "Whether to apply doppler correction to each channel (1 for yes, 0 for no)"
type: array
items:
type: integer
startOnAOS:
description: "Start acquisition on AOS (1 for yes, 0 for no)"
type: integer
stopOnLOS:
description: "Stop acquisition on LOS (1 for yes, 0 for no)"
type: integer
startStopFileSinks:
description: "Start/stop file sinks on AOS/LOS (1 for yes, 0 for no)"
type: integer
frequency:
description: "Frequency to override in preset"
type: integer
format: int64
aosCommand:
description: "Command to execute on AOS"
type: string
losCommand:
description: "Command to execute on LOS"
type: string

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,351 @@
/**
* 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: 6.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 "SWGSatelliteDeviceSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSatelliteDeviceSettings::SWGSatelliteDeviceSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGSatelliteDeviceSettings::SWGSatelliteDeviceSettings() {
device_set = nullptr;
m_device_set_isSet = false;
preset_group = nullptr;
m_preset_group_isSet = false;
preset_frequency = 0L;
m_preset_frequency_isSet = false;
preset_description = nullptr;
m_preset_description_isSet = false;
doppler = new QList<qint32>();
m_doppler_isSet = false;
start_on_aos = 0;
m_start_on_aos_isSet = false;
stop_on_los = 0;
m_stop_on_los_isSet = false;
start_stop_file_sinks = 0;
m_start_stop_file_sinks_isSet = false;
frequency = 0L;
m_frequency_isSet = false;
aos_command = nullptr;
m_aos_command_isSet = false;
los_command = nullptr;
m_los_command_isSet = false;
}
SWGSatelliteDeviceSettings::~SWGSatelliteDeviceSettings() {
this->cleanup();
}
void
SWGSatelliteDeviceSettings::init() {
device_set = new QString("");
m_device_set_isSet = false;
preset_group = new QString("");
m_preset_group_isSet = false;
preset_frequency = 0L;
m_preset_frequency_isSet = false;
preset_description = new QString("");
m_preset_description_isSet = false;
doppler = new QList<qint32>();
m_doppler_isSet = false;
start_on_aos = 0;
m_start_on_aos_isSet = false;
stop_on_los = 0;
m_stop_on_los_isSet = false;
start_stop_file_sinks = 0;
m_start_stop_file_sinks_isSet = false;
frequency = 0L;
m_frequency_isSet = false;
aos_command = new QString("");
m_aos_command_isSet = false;
los_command = new QString("");
m_los_command_isSet = false;
}
void
SWGSatelliteDeviceSettings::cleanup() {
if(device_set != nullptr) {
delete device_set;
}
if(preset_group != nullptr) {
delete preset_group;
}
if(preset_description != nullptr) {
delete preset_description;
}
if(aos_command != nullptr) {
delete aos_command;
}
if(los_command != nullptr) {
delete los_command;
}
}
SWGSatelliteDeviceSettings*
SWGSatelliteDeviceSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSatelliteDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&device_set, pJson["deviceSet"], "QString", "QString");
::SWGSDRangel::setValue(&preset_group, pJson["presetGroup"], "QString", "QString");
::SWGSDRangel::setValue(&preset_frequency, pJson["presetFrequency"], "qint64", "");
::SWGSDRangel::setValue(&preset_description, pJson["presetDescription"], "QString", "QString");
::SWGSDRangel::setValue(&doppler, pJson["doppler"], "QList", "qint32");
::SWGSDRangel::setValue(&start_on_aos, pJson["startOnAOS"], "qint32", "");
::SWGSDRangel::setValue(&stop_on_los, pJson["stopOnLOS"], "qint32", "");
::SWGSDRangel::setValue(&start_stop_file_sinks, pJson["startStopFileSinks"], "qint32", "");
::SWGSDRangel::setValue(&frequency, pJson["frequency"], "qint64", "");
::SWGSDRangel::setValue(&aos_command, pJson["aosCommand"], "QString", "QString");
::SWGSDRangel::setValue(&los_command, pJson["losCommand"], "QString", "QString");
}
QString
SWGSatelliteDeviceSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSatelliteDeviceSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(device_set != nullptr && *device_set != QString("")){
toJsonValue(QString("deviceSet"), device_set, obj, QString("QString"));
}
if(preset_group != nullptr && *preset_group != QString("")){
toJsonValue(QString("presetGroup"), preset_group, obj, QString("QString"));
}
if(m_preset_frequency_isSet){
obj->insert("presetFrequency", QJsonValue(preset_frequency));
}
if(preset_description != nullptr && *preset_description != QString("")){
toJsonValue(QString("presetDescription"), preset_description, obj, QString("QString"));
}
if(doppler && doppler->size() > 0){
toJsonArray((QList<void*>*)doppler, obj, "doppler", "");
}
if(m_start_on_aos_isSet){
obj->insert("startOnAOS", QJsonValue(start_on_aos));
}
if(m_stop_on_los_isSet){
obj->insert("stopOnLOS", QJsonValue(stop_on_los));
}
if(m_start_stop_file_sinks_isSet){
obj->insert("startStopFileSinks", QJsonValue(start_stop_file_sinks));
}
if(m_frequency_isSet){
obj->insert("frequency", QJsonValue(frequency));
}
if(aos_command != nullptr && *aos_command != QString("")){
toJsonValue(QString("aosCommand"), aos_command, obj, QString("QString"));
}
if(los_command != nullptr && *los_command != QString("")){
toJsonValue(QString("losCommand"), los_command, obj, QString("QString"));
}
return obj;
}
QString*
SWGSatelliteDeviceSettings::getDeviceSet() {
return device_set;
}
void
SWGSatelliteDeviceSettings::setDeviceSet(QString* device_set) {
this->device_set = device_set;
this->m_device_set_isSet = true;
}
QString*
SWGSatelliteDeviceSettings::getPresetGroup() {
return preset_group;
}
void
SWGSatelliteDeviceSettings::setPresetGroup(QString* preset_group) {
this->preset_group = preset_group;
this->m_preset_group_isSet = true;
}
qint64
SWGSatelliteDeviceSettings::getPresetFrequency() {
return preset_frequency;
}
void
SWGSatelliteDeviceSettings::setPresetFrequency(qint64 preset_frequency) {
this->preset_frequency = preset_frequency;
this->m_preset_frequency_isSet = true;
}
QString*
SWGSatelliteDeviceSettings::getPresetDescription() {
return preset_description;
}
void
SWGSatelliteDeviceSettings::setPresetDescription(QString* preset_description) {
this->preset_description = preset_description;
this->m_preset_description_isSet = true;
}
QList<qint32>*
SWGSatelliteDeviceSettings::getDoppler() {
return doppler;
}
void
SWGSatelliteDeviceSettings::setDoppler(QList<qint32>* doppler) {
this->doppler = doppler;
this->m_doppler_isSet = true;
}
qint32
SWGSatelliteDeviceSettings::getStartOnAos() {
return start_on_aos;
}
void
SWGSatelliteDeviceSettings::setStartOnAos(qint32 start_on_aos) {
this->start_on_aos = start_on_aos;
this->m_start_on_aos_isSet = true;
}
qint32
SWGSatelliteDeviceSettings::getStopOnLos() {
return stop_on_los;
}
void
SWGSatelliteDeviceSettings::setStopOnLos(qint32 stop_on_los) {
this->stop_on_los = stop_on_los;
this->m_stop_on_los_isSet = true;
}
qint32
SWGSatelliteDeviceSettings::getStartStopFileSinks() {
return start_stop_file_sinks;
}
void
SWGSatelliteDeviceSettings::setStartStopFileSinks(qint32 start_stop_file_sinks) {
this->start_stop_file_sinks = start_stop_file_sinks;
this->m_start_stop_file_sinks_isSet = true;
}
qint64
SWGSatelliteDeviceSettings::getFrequency() {
return frequency;
}
void
SWGSatelliteDeviceSettings::setFrequency(qint64 frequency) {
this->frequency = frequency;
this->m_frequency_isSet = true;
}
QString*
SWGSatelliteDeviceSettings::getAosCommand() {
return aos_command;
}
void
SWGSatelliteDeviceSettings::setAosCommand(QString* aos_command) {
this->aos_command = aos_command;
this->m_aos_command_isSet = true;
}
QString*
SWGSatelliteDeviceSettings::getLosCommand() {
return los_command;
}
void
SWGSatelliteDeviceSettings::setLosCommand(QString* los_command) {
this->los_command = los_command;
this->m_los_command_isSet = true;
}
bool
SWGSatelliteDeviceSettings::isSet(){
bool isObjectUpdated = false;
do{
if(device_set && *device_set != QString("")){
isObjectUpdated = true; break;
}
if(preset_group && *preset_group != QString("")){
isObjectUpdated = true; break;
}
if(m_preset_frequency_isSet){
isObjectUpdated = true; break;
}
if(preset_description && *preset_description != QString("")){
isObjectUpdated = true; break;
}
if(m_doppler_isSet){
isObjectUpdated = true; break;
}
if(doppler && (doppler->size() > 0)){
isObjectUpdated = true; break;
}
if(m_start_on_aos_isSet){
isObjectUpdated = true; break;
}
if(m_stop_on_los_isSet){
isObjectUpdated = true; break;
}
if(m_start_stop_file_sinks_isSet){
isObjectUpdated = true; break;
}
if(m_frequency_isSet){
isObjectUpdated = true; break;
}
if(aos_command && *aos_command != QString("")){
isObjectUpdated = true; break;
}
if(los_command && *los_command != QString("")){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,120 @@
/**
* 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: 6.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.
*/
/*
* SWGSatelliteDeviceSettings.h
*
* Device set settings
*/
#ifndef SWGSatelliteDeviceSettings_H_
#define SWGSatelliteDeviceSettings_H_
#include <QJsonObject>
#include <QList>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSatelliteDeviceSettings: public SWGObject {
public:
SWGSatelliteDeviceSettings();
SWGSatelliteDeviceSettings(QString* json);
virtual ~SWGSatelliteDeviceSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSatelliteDeviceSettings* fromJson(QString &jsonString) override;
QString* getDeviceSet();
void setDeviceSet(QString* device_set);
QString* getPresetGroup();
void setPresetGroup(QString* preset_group);
qint64 getPresetFrequency();
void setPresetFrequency(qint64 preset_frequency);
QString* getPresetDescription();
void setPresetDescription(QString* preset_description);
QList<qint32>* getDoppler();
void setDoppler(QList<qint32>* doppler);
qint32 getStartOnAos();
void setStartOnAos(qint32 start_on_aos);
qint32 getStopOnLos();
void setStopOnLos(qint32 stop_on_los);
qint32 getStartStopFileSinks();
void setStartStopFileSinks(qint32 start_stop_file_sinks);
qint64 getFrequency();
void setFrequency(qint64 frequency);
QString* getAosCommand();
void setAosCommand(QString* aos_command);
QString* getLosCommand();
void setLosCommand(QString* los_command);
virtual bool isSet() override;
private:
QString* device_set;
bool m_device_set_isSet;
QString* preset_group;
bool m_preset_group_isSet;
qint64 preset_frequency;
bool m_preset_frequency_isSet;
QString* preset_description;
bool m_preset_description_isSet;
QList<qint32>* doppler;
bool m_doppler_isSet;
qint32 start_on_aos;
bool m_start_on_aos_isSet;
qint32 stop_on_los;
bool m_stop_on_los_isSet;
qint32 start_stop_file_sinks;
bool m_start_stop_file_sinks_isSet;
qint64 frequency;
bool m_frequency_isSet;
QString* aos_command;
bool m_aos_command_isSet;
QString* los_command;
bool m_los_command_isSet;
};
}
#endif /* SWGSatelliteDeviceSettings_H_ */

View File

@ -0,0 +1,139 @@
/**
* 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: 6.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 "SWGSatelliteDeviceSettingsList.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGSatelliteDeviceSettingsList::SWGSatelliteDeviceSettingsList(QString* json) {
init();
this->fromJson(*json);
}
SWGSatelliteDeviceSettingsList::SWGSatelliteDeviceSettingsList() {
satellite = nullptr;
m_satellite_isSet = false;
device_settings = nullptr;
m_device_settings_isSet = false;
}
SWGSatelliteDeviceSettingsList::~SWGSatelliteDeviceSettingsList() {
this->cleanup();
}
void
SWGSatelliteDeviceSettingsList::init() {
satellite = new QString("");
m_satellite_isSet = false;
device_settings = new QList<SWGSatelliteDeviceSettings*>();
m_device_settings_isSet = false;
}
void
SWGSatelliteDeviceSettingsList::cleanup() {
if(satellite != nullptr) {
delete satellite;
}
if(device_settings != nullptr) {
auto arr = device_settings;
for(auto o: *arr) {
delete o;
}
delete device_settings;
}
}
SWGSatelliteDeviceSettingsList*
SWGSatelliteDeviceSettingsList::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGSatelliteDeviceSettingsList::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&satellite, pJson["satellite"], "QString", "QString");
::SWGSDRangel::setValue(&device_settings, pJson["deviceSettings"], "QList", "SWGSatelliteDeviceSettings");
}
QString
SWGSatelliteDeviceSettingsList::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGSatelliteDeviceSettingsList::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(satellite != nullptr && *satellite != QString("")){
toJsonValue(QString("satellite"), satellite, obj, QString("QString"));
}
if(device_settings && device_settings->size() > 0){
toJsonArray((QList<void*>*)device_settings, obj, "deviceSettings", "SWGSatelliteDeviceSettings");
}
return obj;
}
QString*
SWGSatelliteDeviceSettingsList::getSatellite() {
return satellite;
}
void
SWGSatelliteDeviceSettingsList::setSatellite(QString* satellite) {
this->satellite = satellite;
this->m_satellite_isSet = true;
}
QList<SWGSatelliteDeviceSettings*>*
SWGSatelliteDeviceSettingsList::getDeviceSettings() {
return device_settings;
}
void
SWGSatelliteDeviceSettingsList::setDeviceSettings(QList<SWGSatelliteDeviceSettings*>* device_settings) {
this->device_settings = device_settings;
this->m_device_settings_isSet = true;
}
bool
SWGSatelliteDeviceSettingsList::isSet(){
bool isObjectUpdated = false;
do{
if(satellite && *satellite != QString("")){
isObjectUpdated = true; break;
}
if(device_settings && (device_settings->size() > 0)){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,67 @@
/**
* 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: 6.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.
*/
/*
* SWGSatelliteDeviceSettingsList.h
*
* List of device set settings for a satellite
*/
#ifndef SWGSatelliteDeviceSettingsList_H_
#define SWGSatelliteDeviceSettingsList_H_
#include <QJsonObject>
#include "SWGSatelliteDeviceSettings.h"
#include <QList>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGSatelliteDeviceSettingsList: public SWGObject {
public:
SWGSatelliteDeviceSettingsList();
SWGSatelliteDeviceSettingsList(QString* json);
virtual ~SWGSatelliteDeviceSettingsList();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSatelliteDeviceSettingsList* fromJson(QString &jsonString) override;
QString* getSatellite();
void setSatellite(QString* satellite);
QList<SWGSatelliteDeviceSettings*>* getDeviceSettings();
void setDeviceSettings(QList<SWGSatelliteDeviceSettings*>* device_settings);
virtual bool isSet() override;
private:
QString* satellite;
bool m_satellite_isSet;
QList<SWGSatelliteDeviceSettings*>* device_settings;
bool m_device_settings_isSet;
};
}
#endif /* SWGSatelliteDeviceSettingsList_H_ */

View File

@ -82,6 +82,8 @@ SWGSatelliteTrackerSettings::SWGSatelliteTrackerSettings() {
m_aos_command_isSet = false;
los_command = nullptr;
m_los_command_isSet = false;
device_settings = nullptr;
m_device_settings_isSet = false;
title = nullptr;
m_title_isSet = false;
rgb_color = 0;
@ -158,6 +160,8 @@ SWGSatelliteTrackerSettings::init() {
m_aos_command_isSet = false;
los_command = new QString("");
m_los_command_isSet = false;
device_settings = new QList<SWGSatelliteDeviceSettingsList*>();
m_device_settings_isSet = false;
title = new QString("");
m_title_isSet = false;
rgb_color = 0;
@ -233,6 +237,13 @@ SWGSatelliteTrackerSettings::cleanup() {
if(los_command != nullptr) {
delete los_command;
}
if(device_settings != nullptr) {
auto arr = device_settings;
for(auto o: *arr) {
delete o;
}
delete device_settings;
}
if(title != nullptr) {
delete title;
}
@ -311,6 +322,8 @@ SWGSatelliteTrackerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&los_command, pJson["losCommand"], "QString", "QString");
::SWGSDRangel::setValue(&device_settings, pJson["deviceSettings"], "QList", "SWGSatelliteDeviceSettingsList");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
@ -422,6 +435,9 @@ SWGSatelliteTrackerSettings::asJsonObject() {
if(los_command != nullptr && *los_command != QString("")){
toJsonValue(QString("losCommand"), los_command, obj, QString("QString"));
}
if(device_settings && device_settings->size() > 0){
toJsonArray((QList<void*>*)device_settings, obj, "deviceSettings", "SWGSatelliteDeviceSettingsList");
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString"));
}
@ -717,6 +733,16 @@ SWGSatelliteTrackerSettings::setLosCommand(QString* los_command) {
this->m_los_command_isSet = true;
}
QList<SWGSatelliteDeviceSettingsList*>*
SWGSatelliteTrackerSettings::getDeviceSettings() {
return device_settings;
}
void
SWGSatelliteTrackerSettings::setDeviceSettings(QList<SWGSatelliteDeviceSettingsList*>* device_settings) {
this->device_settings = device_settings;
this->m_device_settings_isSet = true;
}
QString*
SWGSatelliteTrackerSettings::getTitle() {
return title;
@ -873,6 +899,9 @@ SWGSatelliteTrackerSettings::isSet(){
if(los_command && *los_command != QString("")){
isObjectUpdated = true; break;
}
if(device_settings && (device_settings->size() > 0)){
isObjectUpdated = true; break;
}
if(title && *title != QString("")){
isObjectUpdated = true; break;
}

View File

@ -22,6 +22,7 @@
#include <QJsonObject>
#include "SWGSatelliteDeviceSettingsList.h"
#include <QList>
#include <QString>
@ -124,6 +125,9 @@ public:
QString* getLosCommand();
void setLosCommand(QString* los_command);
QList<SWGSatelliteDeviceSettingsList*>* getDeviceSettings();
void setDeviceSettings(QList<SWGSatelliteDeviceSettingsList*>* device_settings);
QString* getTitle();
void setTitle(QString* title);
@ -230,6 +234,9 @@ private:
QString* los_command;
bool m_los_command_isSet;
QList<SWGSatelliteDeviceSettingsList*>* device_settings;
bool m_device_settings_isSet;
QString* title;
bool m_title_isSet;