From 750f556eaa5be064f924f4341e003721aff90a34 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Tue, 5 Oct 2021 14:03:31 +0100 Subject: [PATCH] GS-232 Controller Updates Fix broken pipe #1006. Add onTarget and current and target aziumth and elevation to web report. Set run/stop button background to yellow when rotator is rotating (not onTarget). Use floating point value for tolerance setting. --- .../gs232controller/gs232controller.cpp | 36 +++++- .../feature/gs232controller/gs232controller.h | 5 + .../gs232controller/gs232controllergui.cpp | 29 ++++- .../gs232controller/gs232controllergui.h | 3 +- .../gs232controller/gs232controllergui.ui | 22 ++-- .../gs232controller/gs232controllerplugin.cpp | 2 +- .../gs232controllersettings.cpp | 21 +++- .../gs232controller/gs232controllersettings.h | 3 +- .../gs232controller/gs232controllerworker.cpp | 27 +--- .../gs232controller/gs232controllerworker.h | 3 - plugins/feature/gs232controller/readme.md | 14 ++- .../api/swagger/include/GS232Controller.yaml | 22 +++- .../qt5/client/SWGGS232ControllerReport.cpp | 115 ++++++++++++++++++ .../qt5/client/SWGGS232ControllerReport.h | 30 +++++ .../qt5/client/SWGGS232ControllerSettings.cpp | 10 +- .../qt5/client/SWGGS232ControllerSettings.h | 6 +- 16 files changed, 286 insertions(+), 62 deletions(-) diff --git a/plugins/feature/gs232controller/gs232controller.cpp b/plugins/feature/gs232controller/gs232controller.cpp index 47653c050..66e105bca 100644 --- a/plugins/feature/gs232controller/gs232controller.cpp +++ b/plugins/feature/gs232controller/gs232controller.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include "SWGFeatureSettings.h" @@ -31,7 +30,6 @@ #include "dsp/dspengine.h" #include "device/deviceset.h" -#include "channel/channelapi.h" #include "feature/featureset.h" #include "maincore.h" @@ -78,7 +76,6 @@ void GS232Controller::start() m_worker->reset(); m_worker->setMessageQueueToFeature(getInputMessageQueue()); - m_worker->setMessageQueueToGUI(getMessageQueueToGUI()); bool ok = m_worker->startWork(); m_state = ok ? StRunning : StError; m_thread.start(); @@ -133,6 +130,18 @@ bool GS232Controller::handleMessage(const Message& cmd) } return true; } + else if (GS232ControllerReport::MsgReportAzAl::match(cmd)) + { + GS232ControllerReport::MsgReportAzAl& report = (GS232ControllerReport::MsgReportAzAl&) cmd; + // Save state for Web report/getOnTarget + m_currentAzimuth = report.getAzimuth(); + m_currentElevation = report.getElevation(); + // Forward to GUI + if (getMessageQueueToGUI()) { + getMessageQueueToGUI()->push(new GS232ControllerReport::MsgReportAzAl(report)); + } + return true; + } else if (MainCore::MsgTargetAzimuthElevation::match(cmd)) { // New source from another plugin @@ -167,9 +176,20 @@ bool GS232Controller::handleMessage(const Message& cmd) } } +// Calculate whether last received az/el was on target +bool GS232Controller::getOnTarget() const +{ + float targetAziumth, targetElevation; + m_settings.calcTargetAzEl(targetAziumth, targetElevation); + float readTolerance = m_settings.m_tolerance + 0.5f; + bool onTarget = (abs(m_currentAzimuth - targetAziumth) < readTolerance) + && (abs(m_currentElevation - targetElevation) < readTolerance); + return onTarget; +} + void GS232Controller::updatePipes() { - QList availablePipes = updateAvailablePipeSources("source", GS232ControllerSettings::m_pipeTypes, GS232ControllerSettings::m_pipeURIs, this); + QList availablePipes = updateAvailablePipeSources("target", GS232ControllerSettings::m_pipeTypes, GS232ControllerSettings::m_pipeURIs, this); if (availablePipes != m_availablePipes) { @@ -574,6 +594,14 @@ void GS232Controller::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& r QSerialPortInfo info = i.next(); response.getGs232ControllerReport()->getSerialPorts()->append(new QString(info.portName())); } + + float azimuth, elevation; + m_settings.calcTargetAzEl(azimuth, elevation); + response.getGs232ControllerReport()->setTargetAzimuth(azimuth); + response.getGs232ControllerReport()->setTargetElevation(elevation); + response.getGs232ControllerReport()->setCurrentAzimuth(m_currentAzimuth); + response.getGs232ControllerReport()->setCurrentElevation(m_currentElevation); + response.getGs232ControllerReport()->setOnTarget(getOnTarget()); } void GS232Controller::networkManagerFinished(QNetworkReply *reply) diff --git a/plugins/feature/gs232controller/gs232controller.h b/plugins/feature/gs232controller/gs232controller.h index 3d95294df..eba2cd173 100644 --- a/plugins/feature/gs232controller/gs232controller.h +++ b/plugins/feature/gs232controller/gs232controller.h @@ -139,6 +139,8 @@ public: const QStringList& featureSettingsKeys, SWGSDRangel::SWGFeatureSettings& response); + bool getOnTarget() const; + static const char* const m_featureIdURI; static const char* const m_featureId; @@ -153,6 +155,9 @@ private: QNetworkAccessManager *m_networkManager; QNetworkRequest m_networkRequest; + float m_currentAzimuth; + float m_currentElevation; + void start(); void stop(); void applySettings(const GS232ControllerSettings& settings, bool force = false); diff --git a/plugins/feature/gs232controller/gs232controllergui.cpp b/plugins/feature/gs232controller/gs232controllergui.cpp index b05fba5a8..087902fcf 100644 --- a/plugins/feature/gs232controller/gs232controllergui.cpp +++ b/plugins/feature/gs232controller/gs232controllergui.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include "SWGTargetAzimuthElevation.h" @@ -136,7 +135,8 @@ GS232ControllerGUI::GS232ControllerGUI(PluginAPI* pluginAPI, FeatureUISet *featu m_pluginAPI(pluginAPI), m_featureUISet(featureUISet), m_doApplySettings(true), - m_lastFeatureState(0) + m_lastFeatureState(0), + m_lastOnTarget(false) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); @@ -151,7 +151,7 @@ GS232ControllerGUI::GS232ControllerGUI(PluginAPI* pluginAPI, FeatureUISet *featu connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); - m_statusTimer.start(1000); + m_statusTimer.start(250); ui->azimuthCurrentText->setText("-"); ui->elevationCurrentText->setText("-"); @@ -191,6 +191,7 @@ void GS232ControllerGUI::displaySettings() ui->azimuthMax->setValue(m_settings.m_azimuthMax); ui->elevationMin->setValue(m_settings.m_elevationMin); ui->elevationMax->setValue(m_settings.m_elevationMax); + ui->tolerance->setValue(m_settings.m_tolerance); blockApplySettings(false); } @@ -375,7 +376,7 @@ void GS232ControllerGUI::on_elevationMax_valueChanged(int value) applySettings(); } -void GS232ControllerGUI::on_tolerance_valueChanged(int value) +void GS232ControllerGUI::on_tolerance_valueChanged(double value) { m_settings.m_tolerance = value; applySettings(); @@ -405,6 +406,7 @@ void GS232ControllerGUI::on_sources_currentTextChanged(const QString& text) void GS232ControllerGUI::updateStatus() { int state = m_gs232Controller->getState(); + bool onTarget = m_gs232Controller->getOnTarget(); if (m_lastFeatureState != state) { @@ -425,7 +427,12 @@ void GS232ControllerGUI::updateStatus() oldState = ui->startStop->blockSignals(true); ui->startStop->setChecked(true); ui->startStop->blockSignals(oldState); - ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); + if (onTarget) { + ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); + } else { + ui->startStop->setStyleSheet("QToolButton { background-color : yellow; }"); + } + m_lastOnTarget = onTarget; break; case Feature::StError: ui->startStop->setStyleSheet("QToolButton { background-color : red; }"); @@ -437,6 +444,18 @@ void GS232ControllerGUI::updateStatus() m_lastFeatureState = state; } + else if (state == Feature::StRunning) + { + if (onTarget != m_lastOnTarget) + { + if (onTarget) { + ui->startStop->setStyleSheet("QToolButton { background-color : green; }"); + } else { + ui->startStop->setStyleSheet("QToolButton { background-color : yellow; }"); + } + } + m_lastOnTarget = onTarget; + } } void GS232ControllerGUI::applySettings(bool force) diff --git a/plugins/feature/gs232controller/gs232controllergui.h b/plugins/feature/gs232controller/gs232controllergui.h index c0e2bd46f..b5ca162f5 100644 --- a/plugins/feature/gs232controller/gs232controllergui.h +++ b/plugins/feature/gs232controller/gs232controllergui.h @@ -57,6 +57,7 @@ private: MessageQueue m_inputMessageQueue; QTimer m_statusTimer; int m_lastFeatureState; + bool m_lastOnTarget; explicit GS232ControllerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr); virtual ~GS232ControllerGUI(); @@ -90,7 +91,7 @@ private slots: void on_azimuthMax_valueChanged(int value); void on_elevationMin_valueChanged(int value); void on_elevationMax_valueChanged(int value); - void on_tolerance_valueChanged(int value); + void on_tolerance_valueChanged(double value); void updateStatus(); }; diff --git a/plugins/feature/gs232controller/gs232controllergui.ui b/plugins/feature/gs232controller/gs232controllergui.ui index 7fc84dbbd..415634483 100644 --- a/plugins/feature/gs232controller/gs232controllergui.ui +++ b/plugins/feature/gs232controller/gs232controllergui.ui @@ -356,13 +356,6 @@ - - - - Tolerance in degrees - - - @@ -452,6 +445,16 @@ + + + + Tolerance in degrees + + + 1 + + + @@ -474,6 +477,11 @@ startStop azimuth elevation + track + sources + targetName + protocol + tolerance serialPort baudRate azimuthOffset diff --git a/plugins/feature/gs232controller/gs232controllerplugin.cpp b/plugins/feature/gs232controller/gs232controllerplugin.cpp index ef0912638..b9d8eaf75 100644 --- a/plugins/feature/gs232controller/gs232controllerplugin.cpp +++ b/plugins/feature/gs232controller/gs232controllerplugin.cpp @@ -30,7 +30,7 @@ const PluginDescriptor GS232ControllerPlugin::m_pluginDescriptor = { GS232Controller::m_featureId, QStringLiteral("GS-232 Rotator Controller"), - QStringLiteral("6.16.6"), + QStringLiteral("6.16.7"), QStringLiteral("(c) Jon Beniston, M7RCE"), QStringLiteral("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/feature/gs232controller/gs232controllersettings.cpp b/plugins/feature/gs232controller/gs232controllersettings.cpp index a896964dd..0b8afdb7f 100644 --- a/plugins/feature/gs232controller/gs232controllersettings.cpp +++ b/plugins/feature/gs232controller/gs232controllersettings.cpp @@ -63,7 +63,7 @@ void GS232ControllerSettings::resetToDefaults() m_azimuthMax = 450; m_elevationMin = 0; m_elevationMax = 180; - m_tolerance = 0; + m_tolerance = 0.0f; m_protocol = GS232; } @@ -90,7 +90,7 @@ QByteArray GS232ControllerSettings::serialize() const s.writeS32(18, m_azimuthMax); s.writeS32(19, m_elevationMin); s.writeS32(20, m_elevationMax); - s.writeS32(21, m_tolerance); + s.writeFloat(21, m_tolerance); s.writeS32(22, (int)m_protocol); return s.final(); @@ -140,7 +140,7 @@ bool GS232ControllerSettings::deserialize(const QByteArray& data) d.readS32(18, &m_azimuthMax, 450); d.readS32(19, &m_elevationMin, 0); d.readS32(20, &m_elevationMax, 180); - d.readS32(21, &m_tolerance, 0); + d.readFloat(21, &m_tolerance, 0.0f); d.readS32(22, (int*)&m_protocol, GS232); return true; @@ -151,3 +151,18 @@ bool GS232ControllerSettings::deserialize(const QByteArray& data) return false; } } + +void GS232ControllerSettings::calcTargetAzEl(float& targetAz, float& targetEl) const +{ + // Apply offset then clamp + + targetAz = m_azimuth; + targetAz += m_azimuthOffset; + targetAz = std::max(targetAz, (float)m_azimuthMin); + targetAz = std::min(targetAz, (float)m_azimuthMax); + + targetEl = m_elevation; + targetEl += m_elevationOffset; + targetEl = std::max(targetEl, (float)m_elevationMin); + targetEl = std::min(targetEl, (float)m_elevationMax); +} diff --git a/plugins/feature/gs232controller/gs232controllersettings.h b/plugins/feature/gs232controller/gs232controllersettings.h index 8f103d157..ca0e153d9 100644 --- a/plugins/feature/gs232controller/gs232controllersettings.h +++ b/plugins/feature/gs232controller/gs232controllersettings.h @@ -40,7 +40,7 @@ struct GS232ControllerSettings int m_azimuthMax; int m_elevationMin; int m_elevationMax; - int m_tolerance; + float m_tolerance; enum Protocol { GS232, SPID } m_protocol; QString m_title; quint32 m_rgbColor; @@ -54,6 +54,7 @@ struct GS232ControllerSettings void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); + void calcTargetAzEl(float& targetAz, float& targetEl) const; static const QStringList m_pipeTypes; static const QStringList m_pipeURIs; diff --git a/plugins/feature/gs232controller/gs232controllerworker.cpp b/plugins/feature/gs232controller/gs232controllerworker.cpp index 11c930594..8f7d5e5b4 100644 --- a/plugins/feature/gs232controller/gs232controllerworker.cpp +++ b/plugins/feature/gs232controller/gs232controllerworker.cpp @@ -20,9 +20,6 @@ #include #include -#include -#include -#include #include #include #include @@ -36,7 +33,6 @@ MESSAGE_CLASS_DEFINITION(GS232ControllerReport::MsgReportAzAl, Message) GS232ControllerWorker::GS232ControllerWorker() : m_msgQueueToFeature(nullptr), - m_msgQueueToGUI(nullptr), m_running(false), m_mutex(QMutex::Recursive), m_lastAzimuth(-1.0f), @@ -144,15 +140,8 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting // Apply offset then clamp - float azimuth = settings.m_azimuth; - azimuth += settings.m_azimuthOffset; - azimuth = std::max(azimuth, (float)settings.m_azimuthMin); - azimuth = std::min(azimuth, (float)settings.m_azimuthMax); - - float elevation = settings.m_elevation; - elevation += settings.m_elevationOffset; - elevation = std::max(elevation, (float)settings.m_elevationMin); - elevation = std::min(elevation, (float)settings.m_elevationMax); + float azimuth, elevation; + settings.calcTargetAzEl(azimuth, elevation); // Don't set if within tolerance of last setting float azDiff = std::abs(azimuth - m_lastAzimuth); @@ -270,9 +259,7 @@ void GS232ControllerWorker::readSerialData() QString az = match.captured(1); QString el = match.captured(2); //qDebug() << "GS232ControllerWorker::readSerialData read Az " << az << " El " << el; - if (getMessageQueueToGUI()) { - getMessageQueueToGUI()->push( GS232ControllerReport::MsgReportAzAl::create(az.toFloat(), el.toFloat())); - } + m_msgQueueToFeature->push(GS232ControllerReport::MsgReportAzAl::create(az.toFloat(), el.toFloat())); } else if (response == "\r\n") { @@ -281,9 +268,7 @@ void GS232ControllerWorker::readSerialData() else { qDebug() << "GS232ControllerWorker::readSerialData - unexpected GS-232 response \"" << response << "\""; - if (m_msgQueueToFeature) { - m_msgQueueToFeature->push(GS232Controller::MsgReportWorker::create(QString("Unexpected GS-232 response: %1").arg(response))); - } + m_msgQueueToFeature->push(GS232Controller::MsgReportWorker::create(QString("Unexpected GS-232 response: %1").arg(response))); } } } @@ -300,9 +285,7 @@ void GS232ControllerWorker::readSerialData() az = buf[1] * 100.0 + buf[2] * 10.0 + buf[3] + buf[4] / 10.0 - 360.0; el = buf[6] * 100.0 + buf[7] * 10.0 + buf[8] + buf[9] / 10.0 - 360.0; //qDebug() << "GS232ControllerWorker::readSerialData read Az " << az << " El " << el; - if (getMessageQueueToGUI()) { - getMessageQueueToGUI()->push( GS232ControllerReport::MsgReportAzAl::create(az, el)); - } + m_msgQueueToFeature->push(GS232ControllerReport::MsgReportAzAl::create(az, el)); if (m_spidStatusSent && m_spidSetSent) { qDebug() << "GS232ControllerWorker::readSerialData - m_spidStatusSent and m_spidSetSent set simultaneously"; } diff --git a/plugins/feature/gs232controller/gs232controllerworker.h b/plugins/feature/gs232controller/gs232controllerworker.h index 3755cde20..70e9b7cc4 100644 --- a/plugins/feature/gs232controller/gs232controllerworker.h +++ b/plugins/feature/gs232controller/gs232controllerworker.h @@ -63,13 +63,11 @@ public: bool isRunning() const { return m_running; } MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } void setMessageQueueToFeature(MessageQueue *messageQueue) { m_msgQueueToFeature = messageQueue; } - void setMessageQueueToGUI(MessageQueue *messageQueue) { m_msgQueueToGUI = messageQueue; } private: MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue *m_msgQueueToFeature; //!< Queue to report channel change to main feature object - MessageQueue *m_msgQueueToGUI; GS232ControllerSettings m_settings; bool m_running; QMutex m_mutex; @@ -85,7 +83,6 @@ private: bool handleMessage(const Message& cmd); void applySettings(const GS232ControllerSettings& settings, bool force = false); - MessageQueue *getMessageQueueToGUI() { return m_msgQueueToGUI; } void openSerialPort(const GS232ControllerSettings& settings); void setAzimuth(float azimuth); void setAzimuthElevation(float azimuth, float elevation); diff --git a/plugins/feature/gs232controller/readme.md b/plugins/feature/gs232controller/readme.md index 4dfb24669..55cebc876 100644 --- a/plugins/feature/gs232controller/readme.md +++ b/plugins/feature/gs232controller/readme.md @@ -2,7 +2,7 @@

Introduction

-The GS-232 Rotator Controller feature plugin allows SDRangel to send commands to GS-232 rotators. This allows SDRangel to point antennas mounted on a rotator to a specified azimuth and elevation. +The GS-232 Rotator Controller feature plugin allows SDRangel to send commands to GS-232 and SPID rotators. This allows SDRangel to point antennas mounted on a rotator to a specified azimuth and elevation. Azimuth and elevation can be set manually by a user in the GUI, via the REST API, or via another plugin, such as the Map Feature, the ADS-B Demodulator, or the Star Tracker. @@ -12,17 +12,19 @@ Azimuth and elevation can be set manually by a user in the GUI, via the REST API

1: Start/Stop plugin

-This button starts or stops the plugin. When the plugin is stopped, azimuth and elevation commands will not be sent to the GS-232 rotator. +This button starts or stops the plugin. When the plugin is stopped, azimuth and elevation commands will not be sent to the rotator. + +When started, the background will be green if the rotator is pointing at target azimuth and elevation within the specified tolerance. When off target (i.e. while rotating) the background will be yellow.

2: Azimuth

Specifies the target azimuth (angle in degrees, clockwise from North) to point the antenna towards. Valid values range from 0 to 450 degrees. -The value to the right of the target azimuth, is the current azimuth read from the GS-232 rotator. +The value to the right of the target azimuth, is the current azimuth read from the rotator.

3: Elevation

Specifies the target elevation (angle in degrees) to point the antenna towards. Valid values range from 0 to 180 degrees, where 0 and 180 point towards the horizon and 90 degrees to zenith. -The value to the right of the target elevation, is the current elevation read from the GS-232 rotator. +The value to the right of the target elevation, is the current elevation read from the rotator.

4: Track

@@ -52,11 +54,11 @@ If it is set to 2, then a change in azimuth of +-1 degree from the previous azim

9: Serial Port

-Specifies the serial port (E.g. COM3 on Windows or /dev/ttyS0 on Linux) that will be used to send commands to the GS-232 rotator. +Specifies the serial port (E.g. COM3 on Windows or /dev/ttyS0 on Linux) that will be used to send commands to the rotator.

10: Baud rate

-Specifies the baud rate that will be used to send commands to the GS-232 rotator. Typically this is 9600. +Specifies the baud rate that will be used to send commands to the rotator. Typically this is 9600 for GS-232.

11: Azimuth Offset

diff --git a/swagger/sdrangel/api/swagger/include/GS232Controller.yaml b/swagger/sdrangel/api/swagger/include/GS232Controller.yaml index 7ac79be42..36b4659a8 100644 --- a/swagger/sdrangel/api/swagger/include/GS232Controller.yaml +++ b/swagger/sdrangel/api/swagger/include/GS232Controller.yaml @@ -41,7 +41,8 @@ GS232ControllerSettings: type: integer tolerance: description: Tolerance in degrees - type: integer + type: number + format: float protocol: description: (0 GS-232, 1 SPID rot2prog) type: integer @@ -74,3 +75,22 @@ GS232ControllerReport: type: array items: type: string + targetAzimuth: + desription: "Target azimuth in degrees (0-450)" + type: number + format: float + targetElevation: + description: "Target elevation in degrees (0-180)" + type: number + format: float + currentAzimuth: + desription: "Current azimuth in degrees (0-450)" + type: number + format: float + currentElevation: + description: "Current elevation in degrees (0-180)" + type: number + format: float + onTarget: + description: "Indicates whether the rotator is pointing at the current target within the set tolerance" + type: integer diff --git a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.cpp b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.cpp index da748f981..322d7c20f 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.cpp @@ -32,6 +32,16 @@ SWGGS232ControllerReport::SWGGS232ControllerReport() { m_sources_isSet = false; serial_ports = nullptr; m_serial_ports_isSet = false; + target_azimuth = 0.0f; + m_target_azimuth_isSet = false; + target_elevation = 0.0f; + m_target_elevation_isSet = false; + current_azimuth = 0.0f; + m_current_azimuth_isSet = false; + current_elevation = 0.0f; + m_current_elevation_isSet = false; + on_target = 0; + m_on_target_isSet = false; } SWGGS232ControllerReport::~SWGGS232ControllerReport() { @@ -44,6 +54,16 @@ SWGGS232ControllerReport::init() { m_sources_isSet = false; serial_ports = new QList(); m_serial_ports_isSet = false; + target_azimuth = 0.0f; + m_target_azimuth_isSet = false; + target_elevation = 0.0f; + m_target_elevation_isSet = false; + current_azimuth = 0.0f; + m_current_azimuth_isSet = false; + current_elevation = 0.0f; + m_current_elevation_isSet = false; + on_target = 0; + m_on_target_isSet = false; } void @@ -62,6 +82,11 @@ SWGGS232ControllerReport::cleanup() { } delete serial_ports; } + + + + + } SWGGS232ControllerReport* @@ -79,6 +104,16 @@ SWGGS232ControllerReport::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&sources, pJson["sources"], "QList", "QString"); ::SWGSDRangel::setValue(&serial_ports, pJson["serialPorts"], "QList", "QString"); + ::SWGSDRangel::setValue(&target_azimuth, pJson["targetAzimuth"], "float", ""); + + ::SWGSDRangel::setValue(&target_elevation, pJson["targetElevation"], "float", ""); + + ::SWGSDRangel::setValue(¤t_azimuth, pJson["currentAzimuth"], "float", ""); + + ::SWGSDRangel::setValue(¤t_elevation, pJson["currentElevation"], "float", ""); + + ::SWGSDRangel::setValue(&on_target, pJson["onTarget"], "qint32", ""); + } QString @@ -101,6 +136,21 @@ SWGGS232ControllerReport::asJsonObject() { if(serial_ports && serial_ports->size() > 0){ toJsonArray((QList*)serial_ports, obj, "serialPorts", "QString"); } + if(m_target_azimuth_isSet){ + obj->insert("targetAzimuth", QJsonValue(target_azimuth)); + } + if(m_target_elevation_isSet){ + obj->insert("targetElevation", QJsonValue(target_elevation)); + } + if(m_current_azimuth_isSet){ + obj->insert("currentAzimuth", QJsonValue(current_azimuth)); + } + if(m_current_elevation_isSet){ + obj->insert("currentElevation", QJsonValue(current_elevation)); + } + if(m_on_target_isSet){ + obj->insert("onTarget", QJsonValue(on_target)); + } return obj; } @@ -125,6 +175,56 @@ SWGGS232ControllerReport::setSerialPorts(QList* serial_ports) { this->m_serial_ports_isSet = true; } +float +SWGGS232ControllerReport::getTargetAzimuth() { + return target_azimuth; +} +void +SWGGS232ControllerReport::setTargetAzimuth(float target_azimuth) { + this->target_azimuth = target_azimuth; + this->m_target_azimuth_isSet = true; +} + +float +SWGGS232ControllerReport::getTargetElevation() { + return target_elevation; +} +void +SWGGS232ControllerReport::setTargetElevation(float target_elevation) { + this->target_elevation = target_elevation; + this->m_target_elevation_isSet = true; +} + +float +SWGGS232ControllerReport::getCurrentAzimuth() { + return current_azimuth; +} +void +SWGGS232ControllerReport::setCurrentAzimuth(float current_azimuth) { + this->current_azimuth = current_azimuth; + this->m_current_azimuth_isSet = true; +} + +float +SWGGS232ControllerReport::getCurrentElevation() { + return current_elevation; +} +void +SWGGS232ControllerReport::setCurrentElevation(float current_elevation) { + this->current_elevation = current_elevation; + this->m_current_elevation_isSet = true; +} + +qint32 +SWGGS232ControllerReport::getOnTarget() { + return on_target; +} +void +SWGGS232ControllerReport::setOnTarget(qint32 on_target) { + this->on_target = on_target; + this->m_on_target_isSet = true; +} + bool SWGGS232ControllerReport::isSet(){ @@ -136,6 +236,21 @@ SWGGS232ControllerReport::isSet(){ if(serial_ports && (serial_ports->size() > 0)){ isObjectUpdated = true; break; } + if(m_target_azimuth_isSet){ + isObjectUpdated = true; break; + } + if(m_target_elevation_isSet){ + isObjectUpdated = true; break; + } + if(m_current_azimuth_isSet){ + isObjectUpdated = true; break; + } + if(m_current_elevation_isSet){ + isObjectUpdated = true; break; + } + if(m_on_target_isSet){ + isObjectUpdated = true; break; + } }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.h b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.h index 6f5268133..03699bdd9 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.h +++ b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerReport.h @@ -49,6 +49,21 @@ public: QList* getSerialPorts(); void setSerialPorts(QList* serial_ports); + float getTargetAzimuth(); + void setTargetAzimuth(float target_azimuth); + + float getTargetElevation(); + void setTargetElevation(float target_elevation); + + float getCurrentAzimuth(); + void setCurrentAzimuth(float current_azimuth); + + float getCurrentElevation(); + void setCurrentElevation(float current_elevation); + + qint32 getOnTarget(); + void setOnTarget(qint32 on_target); + virtual bool isSet() override; @@ -59,6 +74,21 @@ private: QList* serial_ports; bool m_serial_ports_isSet; + float target_azimuth; + bool m_target_azimuth_isSet; + + float target_elevation; + bool m_target_elevation_isSet; + + float current_azimuth; + bool m_current_azimuth_isSet; + + float current_elevation; + bool m_current_elevation_isSet; + + qint32 on_target; + bool m_on_target_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.cpp index 413234724..3f7ab4369 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.cpp @@ -52,7 +52,7 @@ SWGGS232ControllerSettings::SWGGS232ControllerSettings() { m_elevation_min_isSet = false; elevation_max = 0; m_elevation_max_isSet = false; - tolerance = 0; + tolerance = 0.0f; m_tolerance_isSet = false; protocol = 0; m_protocol_isSet = false; @@ -102,7 +102,7 @@ SWGGS232ControllerSettings::init() { m_elevation_min_isSet = false; elevation_max = 0; m_elevation_max_isSet = false; - tolerance = 0; + tolerance = 0.0f; m_tolerance_isSet = false; protocol = 0; m_protocol_isSet = false; @@ -190,7 +190,7 @@ SWGGS232ControllerSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&elevation_max, pJson["elevationMax"], "qint32", ""); - ::SWGSDRangel::setValue(&tolerance, pJson["tolerance"], "qint32", ""); + ::SWGSDRangel::setValue(&tolerance, pJson["tolerance"], "float", ""); ::SWGSDRangel::setValue(&protocol, pJson["protocol"], "qint32", ""); @@ -411,12 +411,12 @@ SWGGS232ControllerSettings::setElevationMax(qint32 elevation_max) { this->m_elevation_max_isSet = true; } -qint32 +float SWGGS232ControllerSettings::getTolerance() { return tolerance; } void -SWGGS232ControllerSettings::setTolerance(qint32 tolerance) { +SWGGS232ControllerSettings::setTolerance(float tolerance) { this->tolerance = tolerance; this->m_tolerance_isSet = true; } diff --git a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.h b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.h index 063ba8d9d..77d4f68ad 100644 --- a/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGGS232ControllerSettings.h @@ -78,8 +78,8 @@ public: qint32 getElevationMax(); void setElevationMax(qint32 elevation_max); - qint32 getTolerance(); - void setTolerance(qint32 tolerance); + float getTolerance(); + void setTolerance(float tolerance); qint32 getProtocol(); void setProtocol(qint32 protocol); @@ -145,7 +145,7 @@ private: qint32 elevation_max; bool m_elevation_max_isSet; - qint32 tolerance; + float tolerance; bool m_tolerance_isSet; qint32 protocol;