From d4a649ad3562389f97527ec060dd8ff996ef9499 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Sun, 6 Feb 2022 11:13:09 +0000 Subject: [PATCH] #1106 - Add satellite data to Satellite Tracker feature Web API report --- .../satellitetracker/satellitetracker.cpp | 60 +++ .../satellitetracker/satellitetracker.h | 3 + .../satellitetrackerworker.cpp | 4 + .../api/swagger/include/SatelliteTracker.yaml | 62 ++++ .../code/qt5/client/SWGModelFactory.h | 12 + .../code/qt5/client/SWGSatellitePass.cpp | 158 ++++++++ .../code/qt5/client/SWGSatellitePass.h | 71 ++++ .../code/qt5/client/SWGSatelliteState.cpp | 346 ++++++++++++++++++ .../code/qt5/client/SWGSatelliteState.h | 121 ++++++ .../qt5/client/SWGSatelliteTrackerReport.cpp | 29 ++ .../qt5/client/SWGSatelliteTrackerReport.h | 8 + 11 files changed, 874 insertions(+) create mode 100644 swagger/sdrangel/code/qt5/client/SWGSatellitePass.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGSatellitePass.h create mode 100644 swagger/sdrangel/code/qt5/client/SWGSatelliteState.cpp create mode 100644 swagger/sdrangel/code/qt5/client/SWGSatelliteState.h diff --git a/plugins/feature/satellitetracker/satellitetracker.cpp b/plugins/feature/satellitetracker/satellitetracker.cpp index 0e8039ccb..fda71ab0c 100644 --- a/plugins/feature/satellitetracker/satellitetracker.cpp +++ b/plugins/feature/satellitetracker/satellitetracker.cpp @@ -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 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& featureSettings void SatelliteTracker::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response) { response.getSatelliteTrackerReport()->setRunningState(getState()); + QList *list = response.getSatelliteTrackerReport()->getSatelliteState(); + QHashIterator 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 *passesList = new QList(); + 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) diff --git a/plugins/feature/satellitetracker/satellitetracker.h b/plugins/feature/satellitetracker/satellitetracker.h index a53d0c53a..4c0c4c09a 100644 --- a/plugins/feature/satellitetracker/satellitetracker.h +++ b/plugins/feature/satellitetracker/satellitetracker.h @@ -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 m_satState; + void start(); void stop(); void applySettings(const SatelliteTrackerSettings& settings, bool force = false); diff --git a/plugins/feature/satellitetracker/satellitetrackerworker.cpp b/plugins/feature/satellitetracker/satellitetrackerworker.cpp index fc625c72f..3b6bbb8b9 100644 --- a/plugins/feature/satellitetracker/satellitetrackerworker.cpp +++ b/plugins/feature/satellitetracker/satellitetrackerworker.cpp @@ -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."; diff --git a/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml b/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml index f1011eddd..66033bdad 100644 --- a/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml +++ b/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml @@ -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" diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 4d7559b41..00b127339 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -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(); diff --git a/swagger/sdrangel/code/qt5/client/SWGSatellitePass.cpp b/swagger/sdrangel/code/qt5/client/SWGSatellitePass.cpp new file mode 100644 index 000000000..0e9fd833b --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSatellitePass.cpp @@ -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 +#include +#include +#include + +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; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGSatellitePass.h b/swagger/sdrangel/code/qt5/client/SWGSatellitePass.h new file mode 100644 index 000000000..36755c549 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSatellitePass.h @@ -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 + + +#include + +#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_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGSatelliteState.cpp b/swagger/sdrangel/code/qt5/client/SWGSatelliteState.cpp new file mode 100644 index 000000000..907e6391d --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSatelliteState.cpp @@ -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 +#include +#include +#include + +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(); + 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*)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* +SWGSatelliteState::getPasses() { + return passes; +} +void +SWGSatelliteState::setPasses(QList* 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; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGSatelliteState.h b/swagger/sdrangel/code/qt5/client/SWGSatelliteState.h new file mode 100644 index 000000000..60a2c47d4 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGSatelliteState.h @@ -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 + + +#include "SWGSatellitePass.h" +#include +#include + +#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* getPasses(); + void setPasses(QList* 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* passes; + bool m_passes_isSet; + +}; + +} + +#endif /* SWGSatelliteState_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.cpp b/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.cpp index 8f9cbf8f4..6d99f5413 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.cpp @@ -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(); + 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*)satellite_state, obj, "satelliteState", "SWGSatelliteState"); + } return obj; } @@ -93,6 +109,16 @@ SWGSatelliteTrackerReport::setRunningState(qint32 running_state) { this->m_running_state_isSet = true; } +QList* +SWGSatelliteTrackerReport::getSatelliteState() { + return satellite_state; +} +void +SWGSatelliteTrackerReport::setSatelliteState(QList* 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; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.h b/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.h index 71f8f3969..0fe2cd572 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGSatelliteTrackerReport.h @@ -22,6 +22,8 @@ #include +#include "SWGSatelliteState.h" +#include #include "SWGObject.h" #include "export.h" @@ -44,6 +46,9 @@ public: qint32 getRunningState(); void setRunningState(qint32 running_state); + QList* getSatelliteState(); + void setSatelliteState(QList* satellite_state); + virtual bool isSet() override; @@ -51,6 +56,9 @@ private: qint32 running_state; bool m_running_state_isSet; + QList* satellite_state; + bool m_satellite_state_isSet; + }; }