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

Update API

This commit is contained in:
Jon Beniston 2021-11-23 12:28:06 +00:00
parent 555888c7cf
commit fb394165a3
7 changed files with 110 additions and 11 deletions

View File

@ -244,6 +244,8 @@ void GS232Controller::applySettings(const GS232ControllerSettings& settings, boo
<< " m_protocol: " << settings.m_protocol
<< " m_serialPort: " << settings.m_serialPort
<< " m_baudRate: " << settings.m_baudRate
<< " m_host: " << settings.m_host
<< " m_port: " << settings.m_port
<< " m_track: " << settings.m_track
<< " m_source: " << settings.m_source
<< " m_title: " << settings.m_title
@ -269,6 +271,12 @@ void GS232Controller::applySettings(const GS232ControllerSettings& settings, boo
if ((m_settings.m_baudRate != settings.m_baudRate) || force) {
reverseAPIKeys.append("baudRate");
}
if ((m_settings.m_host != settings.m_host) || force) {
reverseAPIKeys.append("host");
}
if ((m_settings.m_port != settings.m_port) || force) {
reverseAPIKeys.append("port");
}
if ((m_settings.m_track != settings.m_track) || force) {
reverseAPIKeys.append("track");
}
@ -427,6 +435,8 @@ void GS232Controller::webapiFormatFeatureSettings(
response.getGs232ControllerSettings()->setElevation(settings.m_elevation);
response.getGs232ControllerSettings()->setSerialPort(new QString(settings.m_serialPort));
response.getGs232ControllerSettings()->setBaudRate(settings.m_baudRate);
response.getGs232ControllerSettings()->setHost(new QString(settings.m_host));
response.getGs232ControllerSettings()->setPort(settings.m_port);
response.getGs232ControllerSettings()->setTrack(settings.m_track);
response.getGs232ControllerSettings()->setSource(new QString(settings.m_source));
response.getGs232ControllerSettings()->setAzimuthOffset(settings.m_azimuthOffset);
@ -475,6 +485,12 @@ void GS232Controller::webapiUpdateFeatureSettings(
if (featureSettingsKeys.contains("baudRate")) {
settings.m_baudRate = response.getGs232ControllerSettings()->getBaudRate();
}
if (featureSettingsKeys.contains("host")) {
settings.m_host = *response.getGs232ControllerSettings()->getHost();
}
if (featureSettingsKeys.contains("port")) {
settings.m_port = response.getGs232ControllerSettings()->getPort();
}
if (featureSettingsKeys.contains("track")) {
settings.m_track = response.getGs232ControllerSettings()->getTrack() != 0;
}
@ -551,6 +567,12 @@ void GS232Controller::webapiReverseSendSettings(QList<QString>& featureSettingsK
if (featureSettingsKeys.contains("baudRate") || force) {
swgGS232ControllerSettings->setBaudRate(settings.m_baudRate);
}
if (featureSettingsKeys.contains("host") || force) {
swgGS232ControllerSettings->setHost(new QString(settings.m_host));
}
if (featureSettingsKeys.contains("port") || force) {
swgGS232ControllerSettings->setPort(settings.m_port);
}
if (featureSettingsKeys.contains("track") || force) {
swgGS232ControllerSettings->setTrack(settings.m_track);
}

View File

@ -388,14 +388,14 @@
<item row="2" column="1">
<widget class="QLineEdit" name="host">
<property name="toolTip">
<string>Host name / IP address of computer running rotctld</string>
<string>Hostname / IP address of computer to connect to</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="serialPort">
<property name="toolTip">
<string>Name of serial port to use to connect to the GS-232 controller</string>
<string>Name of serial port to use to connect to the rotator</string>
</property>
<property name="editable">
<bool>true</bool>
@ -441,7 +441,7 @@
<item row="1" column="3">
<widget class="QComboBox" name="baudRate">
<property name="toolTip">
<string>Serial port baud rate for the GS-232 controller</string>
<string>Serial port baud rate</string>
</property>
<property name="currentIndex">
<number>3</number>
@ -521,7 +521,7 @@
<item row="2" column="3">
<widget class="QSpinBox" name="port">
<property name="toolTip">
<string>TCP port number rotctld is listening on</string>
<string>TCP port number to connect to</string>
</property>
<property name="maximum">
<number>65535</number>

View File

@ -2,7 +2,8 @@
<h2>Introduction</h2>
The Rotator Controller feature plugin allows SDRangel to send commands to GS-232 and SPID rotators as well as hamlib's rotctld, via serial or TCP. This allows SDRangel to point antennas mounted on a rotator to a specified azimuth and elevation.
The Rotator Controller feature plugin allows SDRangel to send commands to GS-232 and SPID rotators as well as hamlib's rotctld, via a serial or TCP connection.
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.
@ -58,11 +59,11 @@ Specifies the baud rate that will be used to send commands to the rotator. Typic
<h3>11: Host</h3>
Specifies the hostname / IP address of the computer running rotctld.
Specifies the hostname / IP address of the computer to connect to.
<h3>12: Port</h3>
Specifies the TCP port number rotctld is listening on.
Specifies the TCP port number to connect to.
<h3>13: Azimuth Offset</h3>
@ -91,20 +92,22 @@ This can prevent some rotators that have a limited accuracy from making unbenefi
If this set to 0, every target azimuth and elevation received by the controller will be send to the rotator.
If it is set to 2, then a change in azimuth of +-1 degree from the previous azimuth, would not be sent to the rotator.
<h2>GS-232 Protocol Implementation</h2>
<h2>Protocol Implementations</h2>
<h3>GS-232 Protocol Implementation Notes</h3>
The controller uses the Waaa eee command when elevation needs to be set.
When only azimuth needs to be set, the Maaa command is used.
The C2 command is used to read current azimuth and elevation. A response of AZ=aaaEL=eee is expected.
<h2>SPID rot2prog Protocol Implementation</h2>
<h3>SPID rot2prog Protocol Implementation</h3>
The controller uses the 0x2f set command with PH/PV=2 to set azimuth and elevation.
The 0x1f status command is used to read current azimuth and elevation.
A 12 byte response is expected for set and status commands.
All frames start with 0x57 and end with 0x20.
<h2>rotctld Protocol Implementation</h2>
<h3>rotctld Protocol Implementation</h3>
The controller uses the 'P' and 'p' commands to set and get azimuth and elevation.

View File

@ -15,6 +15,12 @@ GS232ControllerSettings:
baudRate:
description: The baud rate to use for the serial connection to the GS-232 controller
type: integer
host:
description: Hostname / IP address of computer running rotctld.
type: string
port:
description: TCP port number rotctld is listening on.
type: integer
track:
description: Track a target where azimuth and elevation are determined by another plugin (1 for yes, 0 for no)
type: integer

View File

@ -6007,6 +6007,14 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "The baud rate to use for the serial connection to the GS-232 controller"
},
"host" : {
"type" : "string",
"description" : "Hostname / IP address of computer running rotctld."
},
"port" : {
"type" : "integer",
"description" : "TCP port number rotctld is listening on."
},
"track" : {
"type" : "integer",
"description" : "Track a target where azimuth and elevation are determined by another plugin (1 for yes, 0 for no)"
@ -51367,7 +51375,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-11-21T00:20:10.840+01:00
Generated 2021-11-23T13:18:02.821+01:00
</div>
</div>
</div>

View File

@ -36,6 +36,10 @@ SWGGS232ControllerSettings::SWGGS232ControllerSettings() {
m_serial_port_isSet = false;
baud_rate = 0;
m_baud_rate_isSet = false;
host = nullptr;
m_host_isSet = false;
port = 0;
m_port_isSet = false;
track = 0;
m_track_isSet = false;
source = nullptr;
@ -86,6 +90,10 @@ SWGGS232ControllerSettings::init() {
m_serial_port_isSet = false;
baud_rate = 0;
m_baud_rate_isSet = false;
host = new QString("");
m_host_isSet = false;
port = 0;
m_port_isSet = false;
track = 0;
m_track_isSet = false;
source = new QString("");
@ -130,6 +138,10 @@ SWGGS232ControllerSettings::cleanup() {
delete serial_port;
}
if(host != nullptr) {
delete host;
}
if(source != nullptr) {
delete source;
@ -174,6 +186,10 @@ SWGGS232ControllerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&baud_rate, pJson["baudRate"], "qint32", "");
::SWGSDRangel::setValue(&host, pJson["host"], "QString", "QString");
::SWGSDRangel::setValue(&port, pJson["port"], "qint32", "");
::SWGSDRangel::setValue(&track, pJson["track"], "qint32", "");
::SWGSDRangel::setValue(&source, pJson["source"], "QString", "QString");
@ -236,6 +252,12 @@ SWGGS232ControllerSettings::asJsonObject() {
if(m_baud_rate_isSet){
obj->insert("baudRate", QJsonValue(baud_rate));
}
if(host != nullptr && *host != QString("")){
toJsonValue(QString("host"), host, obj, QString("QString"));
}
if(m_port_isSet){
obj->insert("port", QJsonValue(port));
}
if(m_track_isSet){
obj->insert("track", QJsonValue(track));
}
@ -331,6 +353,26 @@ SWGGS232ControllerSettings::setBaudRate(qint32 baud_rate) {
this->m_baud_rate_isSet = true;
}
QString*
SWGGS232ControllerSettings::getHost() {
return host;
}
void
SWGGS232ControllerSettings::setHost(QString* host) {
this->host = host;
this->m_host_isSet = true;
}
qint32
SWGGS232ControllerSettings::getPort() {
return port;
}
void
SWGGS232ControllerSettings::setPort(qint32 port) {
this->port = port;
this->m_port_isSet = true;
}
qint32
SWGGS232ControllerSettings::getTrack() {
return track;
@ -518,6 +560,12 @@ SWGGS232ControllerSettings::isSet(){
if(m_baud_rate_isSet){
isObjectUpdated = true; break;
}
if(host && *host != QString("")){
isObjectUpdated = true; break;
}
if(m_port_isSet){
isObjectUpdated = true; break;
}
if(m_track_isSet){
isObjectUpdated = true; break;
}

View File

@ -54,6 +54,12 @@ public:
qint32 getBaudRate();
void setBaudRate(qint32 baud_rate);
QString* getHost();
void setHost(QString* host);
qint32 getPort();
void setPort(qint32 port);
qint32 getTrack();
void setTrack(qint32 track);
@ -121,6 +127,12 @@ private:
qint32 baud_rate;
bool m_baud_rate_isSet;
QString* host;
bool m_host_isSet;
qint32 port;
bool m_port_isSet;
qint32 track;
bool m_track_isSet;