mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
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.
This commit is contained in:
parent
dc7232ee4f
commit
750f556eaa
@ -20,7 +20,6 @@
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QBuffer>
|
||||
#include <QRegExp>
|
||||
#include <QSerialPortInfo>
|
||||
|
||||
#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<AvailablePipeSource> availablePipes = updateAvailablePipeSources("source", GS232ControllerSettings::m_pipeTypes, GS232ControllerSettings::m_pipeURIs, this);
|
||||
QList<AvailablePipeSource> 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)
|
||||
|
@ -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);
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <QMessageBox>
|
||||
#include <QLineEdit>
|
||||
#include <QSerialPortInfo>
|
||||
|
||||
#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)
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
|
@ -356,13 +356,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="tolerance">
|
||||
<property name="toolTip">
|
||||
<string>Tolerance in degrees</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="protocolLabel">
|
||||
<property name="text">
|
||||
@ -452,6 +445,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QDoubleSpinBox" name="tolerance">
|
||||
<property name="toolTip">
|
||||
<string>Tolerance in degrees</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -474,6 +477,11 @@
|
||||
<tabstop>startStop</tabstop>
|
||||
<tabstop>azimuth</tabstop>
|
||||
<tabstop>elevation</tabstop>
|
||||
<tabstop>track</tabstop>
|
||||
<tabstop>sources</tabstop>
|
||||
<tabstop>targetName</tabstop>
|
||||
<tabstop>protocol</tabstop>
|
||||
<tabstop>tolerance</tabstop>
|
||||
<tabstop>serialPort</tabstop>
|
||||
<tabstop>baudRate</tabstop>
|
||||
<tabstop>azimuthOffset</tabstop>
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -20,9 +20,6 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QSerialPort>
|
||||
#include <QRegularExpression>
|
||||
@ -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";
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
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
|
||||
|
||||
<h3>1: Start/Stop plugin</h3>
|
||||
|
||||
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.
|
||||
|
||||
<h3>2: Azimuth</h3>
|
||||
|
||||
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.
|
||||
|
||||
<h3>3: Elevation</h3>
|
||||
|
||||
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.
|
||||
|
||||
<h3>4: Track</h3>
|
||||
|
||||
@ -52,11 +54,11 @@ If it is set to 2, then a change in azimuth of +-1 degree from the previous azim
|
||||
|
||||
<h3>9: Serial Port</h3>
|
||||
|
||||
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.
|
||||
|
||||
<h3>10: Baud rate</h3>
|
||||
|
||||
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.
|
||||
|
||||
<h3>11: Azimuth Offset</h3>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<QString*>();
|
||||
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<void*>*)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<QString*>* 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;
|
||||
}
|
||||
|
@ -49,6 +49,21 @@ public:
|
||||
QList<QString*>* getSerialPorts();
|
||||
void setSerialPorts(QList<QString*>* 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<QString*>* 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;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user