mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
#1106 - Add satellite data to Satellite Tracker feature Web API report
This commit is contained in:
parent
c25837fcf7
commit
d4a649ad35
@ -35,6 +35,7 @@
|
||||
#include "feature/featurewebapiutils.h"
|
||||
|
||||
#include "satellitetrackerworker.h"
|
||||
#include "satellitetrackerreport.h"
|
||||
#include "satellitetracker.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(SatelliteTracker::MsgConfigureSatelliteTracker, Message)
|
||||
@ -72,6 +73,7 @@ SatelliteTracker::~SatelliteTracker()
|
||||
}
|
||||
|
||||
delete m_worker;
|
||||
qDeleteAll(m_satState);
|
||||
}
|
||||
|
||||
void SatelliteTracker::start()
|
||||
@ -143,6 +145,21 @@ bool SatelliteTracker::handleMessage(const Message& cmd)
|
||||
updateSatData();
|
||||
return true;
|
||||
}
|
||||
else if (SatelliteTrackerReport::MsgReportSat::match(cmd))
|
||||
{
|
||||
// Save latest satellite state for Web report
|
||||
SatelliteTrackerReport::MsgReportSat& satReport = (SatelliteTrackerReport::MsgReportSat&) cmd;
|
||||
SatelliteState *satState = satReport.getSatelliteState();
|
||||
if (m_satState.contains(satState->m_name))
|
||||
{
|
||||
delete m_satState.value(satState->m_name);
|
||||
m_satState.remove(satState->m_name);
|
||||
}
|
||||
if (m_settings.m_satellites.contains(satState->m_name)) {
|
||||
m_satState.insert(satState->m_name, satState);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -334,6 +351,19 @@ void SatelliteTracker::applySettings(const SatelliteTrackerSettings& settings, b
|
||||
else
|
||||
updateSatData();
|
||||
}
|
||||
|
||||
// Remove unneeded satellite state
|
||||
QMutableHashIterator<QString, SatelliteState *> itr(m_satState);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
SatelliteState *satState = itr.value();
|
||||
if (!m_settings.m_satellites.contains(satState->m_name))
|
||||
{
|
||||
delete satState;
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int SatelliteTracker::webapiRun(bool run,
|
||||
@ -843,6 +873,36 @@ void SatelliteTracker::webapiReverseSendSettings(QList<QString>& featureSettings
|
||||
void SatelliteTracker::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response)
|
||||
{
|
||||
response.getSatelliteTrackerReport()->setRunningState(getState());
|
||||
QList<SWGSDRangel::SWGSatelliteState *> *list = response.getSatelliteTrackerReport()->getSatelliteState();
|
||||
QHashIterator<QString, SatelliteState *> itr(m_satState);
|
||||
while (itr.hasNext())
|
||||
{
|
||||
itr.next();
|
||||
SatelliteState *satState = itr.value();
|
||||
SWGSDRangel::SWGSatelliteState *swgSatState = new SWGSDRangel::SWGSatelliteState();
|
||||
swgSatState->setName(new QString(satState->m_name));
|
||||
swgSatState->setLatitude(satState->m_latitude);
|
||||
swgSatState->setLongitude(satState->m_longitude);
|
||||
swgSatState->setAltitude(satState->m_altitude);
|
||||
swgSatState->setAzimuth(satState->m_azimuth);
|
||||
swgSatState->setElevation(satState->m_elevation);
|
||||
swgSatState->setRange(satState->m_range);
|
||||
swgSatState->setRangeRate(satState->m_rangeRate);
|
||||
swgSatState->setSpeed(satState->m_speed);
|
||||
swgSatState->setPeriod(satState->m_period);
|
||||
swgSatState->setElevation(satState->m_elevation);
|
||||
QList<SWGSDRangel::SWGSatellitePass *> *passesList = new QList<SWGSDRangel::SWGSatellitePass*>();
|
||||
for (auto pass : satState->m_passes)
|
||||
{
|
||||
SWGSDRangel::SWGSatellitePass *swgPass = new SWGSDRangel::SWGSatellitePass();
|
||||
swgPass->setAos(new QString(pass->m_aos.toString(Qt::ISODateWithMs)));
|
||||
swgPass->setLos(new QString(pass->m_los.toString(Qt::ISODateWithMs)));
|
||||
swgPass->setMaxElevation(pass->m_maxElevation);
|
||||
passesList->append(swgPass);
|
||||
}
|
||||
swgSatState->setPasses(passesList);
|
||||
list->append(swgSatState);
|
||||
}
|
||||
}
|
||||
|
||||
void SatelliteTracker::networkManagerFinished(QNetworkReply *reply)
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "satellitetrackersettings.h"
|
||||
#include "satnogs.h"
|
||||
#include "satellitetrackersgp4.h"
|
||||
|
||||
class WebAPIAdapterInterface;
|
||||
class SatelliteTrackerWorker;
|
||||
@ -188,6 +189,8 @@ private:
|
||||
|
||||
QDateTime m_startedDateTime;
|
||||
|
||||
QHash<QString, SatelliteState *> m_satState;
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void applySettings(const SatelliteTrackerSettings& settings, bool force = false);
|
||||
|
@ -497,6 +497,10 @@ void SatelliteTrackerWorker::update()
|
||||
// Send to GUI
|
||||
if (getMessageQueueToGUI())
|
||||
getMessageQueueToGUI()->push(SatelliteTrackerReport::MsgReportSat::create(new SatelliteState(satWorkerState->m_satState)));
|
||||
|
||||
// Sent to Feature for Web report
|
||||
if (m_msgQueueToFeature)
|
||||
m_msgQueueToFeature->push(SatelliteTrackerReport::MsgReportSat::create(new SatelliteState(satWorkerState->m_satState)));
|
||||
}
|
||||
else
|
||||
qDebug() << "SatelliteTrackerWorker::update: No TLE for " << sat->m_name << ". Can't compute position.";
|
||||
|
@ -179,6 +179,68 @@ SatelliteTrackerReport:
|
||||
* 1 - idle
|
||||
* 2 - running
|
||||
* 3 - error
|
||||
satelliteState:
|
||||
type: array
|
||||
items:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/SatelliteTracker.yaml#/SatelliteState"
|
||||
|
||||
SatelliteState:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
latitude:
|
||||
description: "Latitude of satellite in degrees"
|
||||
type: number
|
||||
format: float
|
||||
longitude:
|
||||
description: "Longitude of satellite in degrees"
|
||||
type: number
|
||||
format: float
|
||||
altitude:
|
||||
description: "Altitude of satellite in km"
|
||||
type: number
|
||||
format: float
|
||||
azimuth:
|
||||
description: "Azimuth to satellite in degrees"
|
||||
type: number
|
||||
format: float
|
||||
elevation:
|
||||
description: "Elevation to satellite in degrees"
|
||||
type: number
|
||||
format: float
|
||||
range:
|
||||
description: "Satellite range in km"
|
||||
type: number
|
||||
format: float
|
||||
rangeRate:
|
||||
description: "Satellite range rate in km/s"
|
||||
type: number
|
||||
format: float
|
||||
speed:
|
||||
description: "Satellite speed in km/s"
|
||||
type: number
|
||||
format: float
|
||||
period:
|
||||
description: "Satellite period in minutes"
|
||||
type: number
|
||||
format: float
|
||||
passes:
|
||||
type: array
|
||||
items:
|
||||
$ref: "http://swgserver:8081/api/swagger/include/SatelliteTracker.yaml#/SatellitePass"
|
||||
|
||||
SatellitePass:
|
||||
properties:
|
||||
aos:
|
||||
description: "Date and time of AOS"
|
||||
type: string
|
||||
los:
|
||||
description: "Date and time of LOS"
|
||||
type: string
|
||||
maxElevation:
|
||||
description: "Maximum elevation of pass in degrees"
|
||||
type: number
|
||||
format: float
|
||||
|
||||
SatelliteTrackerActions:
|
||||
description: "Satellite Tracker actions"
|
||||
|
@ -248,6 +248,8 @@
|
||||
#include "SWGSamplingDevice.h"
|
||||
#include "SWGSatelliteDeviceSettings.h"
|
||||
#include "SWGSatelliteDeviceSettingsList.h"
|
||||
#include "SWGSatellitePass.h"
|
||||
#include "SWGSatelliteState.h"
|
||||
#include "SWGSatelliteTrackerActions.h"
|
||||
#include "SWGSatelliteTrackerReport.h"
|
||||
#include "SWGSatelliteTrackerSettings.h"
|
||||
@ -1487,6 +1489,16 @@ namespace SWGSDRangel {
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGSatellitePass").compare(type) == 0) {
|
||||
SWGSatellitePass *obj = new SWGSatellitePass();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGSatelliteState").compare(type) == 0) {
|
||||
SWGSatelliteState *obj = new SWGSatelliteState();
|
||||
obj->init();
|
||||
return obj;
|
||||
}
|
||||
if(QString("SWGSatelliteTrackerActions").compare(type) == 0) {
|
||||
SWGSatelliteTrackerActions *obj = new SWGSatelliteTrackerActions();
|
||||
obj->init();
|
||||
|
158
swagger/sdrangel/code/qt5/client/SWGSatellitePass.cpp
Normal file
158
swagger/sdrangel/code/qt5/client/SWGSatellitePass.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
/**
|
||||
* 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 "SWGSatellitePass.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGSatellitePass::SWGSatellitePass(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGSatellitePass::SWGSatellitePass() {
|
||||
aos = nullptr;
|
||||
m_aos_isSet = false;
|
||||
los = nullptr;
|
||||
m_los_isSet = false;
|
||||
max_elevation = 0.0f;
|
||||
m_max_elevation_isSet = false;
|
||||
}
|
||||
|
||||
SWGSatellitePass::~SWGSatellitePass() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatellitePass::init() {
|
||||
aos = new QString("");
|
||||
m_aos_isSet = false;
|
||||
los = new QString("");
|
||||
m_los_isSet = false;
|
||||
max_elevation = 0.0f;
|
||||
m_max_elevation_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatellitePass::cleanup() {
|
||||
if(aos != nullptr) {
|
||||
delete aos;
|
||||
}
|
||||
if(los != nullptr) {
|
||||
delete los;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWGSatellitePass*
|
||||
SWGSatellitePass::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatellitePass::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&aos, pJson["aos"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&los, pJson["los"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&max_elevation, pJson["maxElevation"], "float", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
SWGSatellitePass::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGSatellitePass::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(aos != nullptr && *aos != QString("")){
|
||||
toJsonValue(QString("aos"), aos, obj, QString("QString"));
|
||||
}
|
||||
if(los != nullptr && *los != QString("")){
|
||||
toJsonValue(QString("los"), los, obj, QString("QString"));
|
||||
}
|
||||
if(m_max_elevation_isSet){
|
||||
obj->insert("maxElevation", QJsonValue(max_elevation));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGSatellitePass::getAos() {
|
||||
return aos;
|
||||
}
|
||||
void
|
||||
SWGSatellitePass::setAos(QString* aos) {
|
||||
this->aos = aos;
|
||||
this->m_aos_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGSatellitePass::getLos() {
|
||||
return los;
|
||||
}
|
||||
void
|
||||
SWGSatellitePass::setLos(QString* los) {
|
||||
this->los = los;
|
||||
this->m_los_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatellitePass::getMaxElevation() {
|
||||
return max_elevation;
|
||||
}
|
||||
void
|
||||
SWGSatellitePass::setMaxElevation(float max_elevation) {
|
||||
this->max_elevation = max_elevation;
|
||||
this->m_max_elevation_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGSatellitePass::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(aos && *aos != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(los && *los != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_max_elevation_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
71
swagger/sdrangel/code/qt5/client/SWGSatellitePass.h
Normal file
71
swagger/sdrangel/code/qt5/client/SWGSatellitePass.h
Normal file
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGSatellitePass.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SWGSatellitePass_H_
|
||||
#define SWGSatellitePass_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGSatellitePass: public SWGObject {
|
||||
public:
|
||||
SWGSatellitePass();
|
||||
SWGSatellitePass(QString* json);
|
||||
virtual ~SWGSatellitePass();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGSatellitePass* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getAos();
|
||||
void setAos(QString* aos);
|
||||
|
||||
QString* getLos();
|
||||
void setLos(QString* los);
|
||||
|
||||
float getMaxElevation();
|
||||
void setMaxElevation(float max_elevation);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* aos;
|
||||
bool m_aos_isSet;
|
||||
|
||||
QString* los;
|
||||
bool m_los_isSet;
|
||||
|
||||
float max_elevation;
|
||||
bool m_max_elevation_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGSatellitePass_H_ */
|
346
swagger/sdrangel/code/qt5/client/SWGSatelliteState.cpp
Normal file
346
swagger/sdrangel/code/qt5/client/SWGSatelliteState.cpp
Normal file
@ -0,0 +1,346 @@
|
||||
/**
|
||||
* 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 "SWGSatelliteState.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGSatelliteState::SWGSatelliteState(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGSatelliteState::SWGSatelliteState() {
|
||||
name = nullptr;
|
||||
m_name_isSet = false;
|
||||
latitude = 0.0f;
|
||||
m_latitude_isSet = false;
|
||||
longitude = 0.0f;
|
||||
m_longitude_isSet = false;
|
||||
altitude = 0.0f;
|
||||
m_altitude_isSet = false;
|
||||
azimuth = 0.0f;
|
||||
m_azimuth_isSet = false;
|
||||
elevation = 0.0f;
|
||||
m_elevation_isSet = false;
|
||||
range = 0.0f;
|
||||
m_range_isSet = false;
|
||||
range_rate = 0.0f;
|
||||
m_range_rate_isSet = false;
|
||||
speed = 0.0f;
|
||||
m_speed_isSet = false;
|
||||
period = 0.0f;
|
||||
m_period_isSet = false;
|
||||
passes = nullptr;
|
||||
m_passes_isSet = false;
|
||||
}
|
||||
|
||||
SWGSatelliteState::~SWGSatelliteState() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatelliteState::init() {
|
||||
name = new QString("");
|
||||
m_name_isSet = false;
|
||||
latitude = 0.0f;
|
||||
m_latitude_isSet = false;
|
||||
longitude = 0.0f;
|
||||
m_longitude_isSet = false;
|
||||
altitude = 0.0f;
|
||||
m_altitude_isSet = false;
|
||||
azimuth = 0.0f;
|
||||
m_azimuth_isSet = false;
|
||||
elevation = 0.0f;
|
||||
m_elevation_isSet = false;
|
||||
range = 0.0f;
|
||||
m_range_isSet = false;
|
||||
range_rate = 0.0f;
|
||||
m_range_rate_isSet = false;
|
||||
speed = 0.0f;
|
||||
m_speed_isSet = false;
|
||||
period = 0.0f;
|
||||
m_period_isSet = false;
|
||||
passes = new QList<SWGSatellitePass*>();
|
||||
m_passes_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatelliteState::cleanup() {
|
||||
if(name != nullptr) {
|
||||
delete name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(passes != nullptr) {
|
||||
auto arr = passes;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete passes;
|
||||
}
|
||||
}
|
||||
|
||||
SWGSatelliteState*
|
||||
SWGSatelliteState::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatelliteState::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&altitude, pJson["altitude"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&azimuth, pJson["azimuth"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&elevation, pJson["elevation"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&range, pJson["range"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&range_rate, pJson["rangeRate"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&speed, pJson["speed"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&period, pJson["period"], "float", "");
|
||||
|
||||
|
||||
::SWGSDRangel::setValue(&passes, pJson["passes"], "QList", "SWGSatellitePass");
|
||||
}
|
||||
|
||||
QString
|
||||
SWGSatelliteState::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGSatelliteState::asJsonObject() {
|
||||
QJsonObject* obj = new QJsonObject();
|
||||
if(name != nullptr && *name != QString("")){
|
||||
toJsonValue(QString("name"), name, obj, QString("QString"));
|
||||
}
|
||||
if(m_latitude_isSet){
|
||||
obj->insert("latitude", QJsonValue(latitude));
|
||||
}
|
||||
if(m_longitude_isSet){
|
||||
obj->insert("longitude", QJsonValue(longitude));
|
||||
}
|
||||
if(m_altitude_isSet){
|
||||
obj->insert("altitude", QJsonValue(altitude));
|
||||
}
|
||||
if(m_azimuth_isSet){
|
||||
obj->insert("azimuth", QJsonValue(azimuth));
|
||||
}
|
||||
if(m_elevation_isSet){
|
||||
obj->insert("elevation", QJsonValue(elevation));
|
||||
}
|
||||
if(m_range_isSet){
|
||||
obj->insert("range", QJsonValue(range));
|
||||
}
|
||||
if(m_range_rate_isSet){
|
||||
obj->insert("rangeRate", QJsonValue(range_rate));
|
||||
}
|
||||
if(m_speed_isSet){
|
||||
obj->insert("speed", QJsonValue(speed));
|
||||
}
|
||||
if(m_period_isSet){
|
||||
obj->insert("period", QJsonValue(period));
|
||||
}
|
||||
if(passes && passes->size() > 0){
|
||||
toJsonArray((QList<void*>*)passes, obj, "passes", "SWGSatellitePass");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGSatelliteState::getName() {
|
||||
return name;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setName(QString* name) {
|
||||
this->name = name;
|
||||
this->m_name_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setLatitude(float latitude) {
|
||||
this->latitude = latitude;
|
||||
this->m_latitude_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setLongitude(float longitude) {
|
||||
this->longitude = longitude;
|
||||
this->m_longitude_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getAltitude() {
|
||||
return altitude;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setAltitude(float altitude) {
|
||||
this->altitude = altitude;
|
||||
this->m_altitude_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getAzimuth() {
|
||||
return azimuth;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setAzimuth(float azimuth) {
|
||||
this->azimuth = azimuth;
|
||||
this->m_azimuth_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getElevation() {
|
||||
return elevation;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setElevation(float elevation) {
|
||||
this->elevation = elevation;
|
||||
this->m_elevation_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getRange() {
|
||||
return range;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setRange(float range) {
|
||||
this->range = range;
|
||||
this->m_range_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getRangeRate() {
|
||||
return range_rate;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setRangeRate(float range_rate) {
|
||||
this->range_rate = range_rate;
|
||||
this->m_range_rate_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setSpeed(float speed) {
|
||||
this->speed = speed;
|
||||
this->m_speed_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGSatelliteState::getPeriod() {
|
||||
return period;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setPeriod(float period) {
|
||||
this->period = period;
|
||||
this->m_period_isSet = true;
|
||||
}
|
||||
|
||||
QList<SWGSatellitePass*>*
|
||||
SWGSatelliteState::getPasses() {
|
||||
return passes;
|
||||
}
|
||||
void
|
||||
SWGSatelliteState::setPasses(QList<SWGSatellitePass*>* passes) {
|
||||
this->passes = passes;
|
||||
this->m_passes_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGSatelliteState::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(name && *name != QString("")){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_latitude_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_longitude_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_altitude_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_azimuth_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_elevation_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_range_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_range_rate_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_speed_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_period_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(passes && (passes->size() > 0)){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
}
|
||||
|
121
swagger/sdrangel/code/qt5/client/SWGSatelliteState.h
Normal file
121
swagger/sdrangel/code/qt5/client/SWGSatelliteState.h
Normal file
@ -0,0 +1,121 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGSatelliteState.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SWGSatelliteState_H_
|
||||
#define SWGSatelliteState_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGSatellitePass.h"
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGSatelliteState: public SWGObject {
|
||||
public:
|
||||
SWGSatelliteState();
|
||||
SWGSatelliteState(QString* json);
|
||||
virtual ~SWGSatelliteState();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGSatelliteState* fromJson(QString &jsonString) override;
|
||||
|
||||
QString* getName();
|
||||
void setName(QString* name);
|
||||
|
||||
float getLatitude();
|
||||
void setLatitude(float latitude);
|
||||
|
||||
float getLongitude();
|
||||
void setLongitude(float longitude);
|
||||
|
||||
float getAltitude();
|
||||
void setAltitude(float altitude);
|
||||
|
||||
float getAzimuth();
|
||||
void setAzimuth(float azimuth);
|
||||
|
||||
float getElevation();
|
||||
void setElevation(float elevation);
|
||||
|
||||
float getRange();
|
||||
void setRange(float range);
|
||||
|
||||
float getRangeRate();
|
||||
void setRangeRate(float range_rate);
|
||||
|
||||
float getSpeed();
|
||||
void setSpeed(float speed);
|
||||
|
||||
float getPeriod();
|
||||
void setPeriod(float period);
|
||||
|
||||
QList<SWGSatellitePass*>* getPasses();
|
||||
void setPasses(QList<SWGSatellitePass*>* passes);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
private:
|
||||
QString* name;
|
||||
bool m_name_isSet;
|
||||
|
||||
float latitude;
|
||||
bool m_latitude_isSet;
|
||||
|
||||
float longitude;
|
||||
bool m_longitude_isSet;
|
||||
|
||||
float altitude;
|
||||
bool m_altitude_isSet;
|
||||
|
||||
float azimuth;
|
||||
bool m_azimuth_isSet;
|
||||
|
||||
float elevation;
|
||||
bool m_elevation_isSet;
|
||||
|
||||
float range;
|
||||
bool m_range_isSet;
|
||||
|
||||
float range_rate;
|
||||
bool m_range_rate_isSet;
|
||||
|
||||
float speed;
|
||||
bool m_speed_isSet;
|
||||
|
||||
float period;
|
||||
bool m_period_isSet;
|
||||
|
||||
QList<SWGSatellitePass*>* passes;
|
||||
bool m_passes_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SWGSatelliteState_H_ */
|
@ -30,6 +30,8 @@ SWGSatelliteTrackerReport::SWGSatelliteTrackerReport(QString* json) {
|
||||
SWGSatelliteTrackerReport::SWGSatelliteTrackerReport() {
|
||||
running_state = 0;
|
||||
m_running_state_isSet = false;
|
||||
satellite_state = nullptr;
|
||||
m_satellite_state_isSet = false;
|
||||
}
|
||||
|
||||
SWGSatelliteTrackerReport::~SWGSatelliteTrackerReport() {
|
||||
@ -40,11 +42,20 @@ void
|
||||
SWGSatelliteTrackerReport::init() {
|
||||
running_state = 0;
|
||||
m_running_state_isSet = false;
|
||||
satellite_state = new QList<SWGSatelliteState*>();
|
||||
m_satellite_state_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGSatelliteTrackerReport::cleanup() {
|
||||
|
||||
if(satellite_state != nullptr) {
|
||||
auto arr = satellite_state;
|
||||
for(auto o: *arr) {
|
||||
delete o;
|
||||
}
|
||||
delete satellite_state;
|
||||
}
|
||||
}
|
||||
|
||||
SWGSatelliteTrackerReport*
|
||||
@ -60,6 +71,8 @@ void
|
||||
SWGSatelliteTrackerReport::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&running_state, pJson["runningState"], "qint32", "");
|
||||
|
||||
|
||||
::SWGSDRangel::setValue(&satellite_state, pJson["satelliteState"], "QList", "SWGSatelliteState");
|
||||
}
|
||||
|
||||
QString
|
||||
@ -79,6 +92,9 @@ SWGSatelliteTrackerReport::asJsonObject() {
|
||||
if(m_running_state_isSet){
|
||||
obj->insert("runningState", QJsonValue(running_state));
|
||||
}
|
||||
if(satellite_state && satellite_state->size() > 0){
|
||||
toJsonArray((QList<void*>*)satellite_state, obj, "satelliteState", "SWGSatelliteState");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -93,6 +109,16 @@ SWGSatelliteTrackerReport::setRunningState(qint32 running_state) {
|
||||
this->m_running_state_isSet = true;
|
||||
}
|
||||
|
||||
QList<SWGSatelliteState*>*
|
||||
SWGSatelliteTrackerReport::getSatelliteState() {
|
||||
return satellite_state;
|
||||
}
|
||||
void
|
||||
SWGSatelliteTrackerReport::setSatelliteState(QList<SWGSatelliteState*>* satellite_state) {
|
||||
this->satellite_state = satellite_state;
|
||||
this->m_satellite_state_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGSatelliteTrackerReport::isSet(){
|
||||
@ -101,6 +127,9 @@ SWGSatelliteTrackerReport::isSet(){
|
||||
if(m_running_state_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(satellite_state && (satellite_state->size() > 0)){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGSatelliteState.h"
|
||||
#include <QList>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
@ -44,6 +46,9 @@ public:
|
||||
qint32 getRunningState();
|
||||
void setRunningState(qint32 running_state);
|
||||
|
||||
QList<SWGSatelliteState*>* getSatelliteState();
|
||||
void setSatelliteState(QList<SWGSatelliteState*>* satellite_state);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -51,6 +56,9 @@ private:
|
||||
qint32 running_state;
|
||||
bool m_running_state_isSet;
|
||||
|
||||
QList<SWGSatelliteState*>* satellite_state;
|
||||
bool m_satellite_state_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user