GS232 Feature: rename targets as sources. API: created GS232 report and fixed missing source name in get settings

This commit is contained in:
f4exb 2021-10-03 23:15:15 +02:00
parent f693ecc8cc
commit f5e14f6502
20 changed files with 365 additions and 64 deletions

View File

@ -134,7 +134,7 @@ bool GS232Controller::handleMessage(const Message& cmd)
}
else if (MainCore::MsgTargetAzimuthElevation::match(cmd))
{
// New target from another plugin
// New source from another plugin
if ((m_state == StRunning) && m_settings.m_track)
{
MainCore::MsgTargetAzimuthElevation& msg = (MainCore::MsgTargetAzimuthElevation&) cmd;
@ -148,7 +148,7 @@ bool GS232Controller::handleMessage(const Message& cmd)
}
else
{
// No GUI, so save target - applySettings will propagate to worker
// No GUI, so save source - applySettings will propagate to worker
SWGSDRangel::SWGTargetAzimuthElevation *swgTarget = msg.getSWGTargetAzimuthElevation();
m_settings.m_azimuth = swgTarget->getAzimuth();
m_settings.m_elevation = swgTarget->getElevation();
@ -168,11 +168,12 @@ bool GS232Controller::handleMessage(const Message& cmd)
void GS232Controller::updatePipes()
{
QList<AvailablePipeSource> availablePipes = updateAvailablePipeSources("target", GS232ControllerSettings::m_pipeTypes, GS232ControllerSettings::m_pipeURIs, this);
QList<AvailablePipeSource> availablePipes = updateAvailablePipeSources("source", GS232ControllerSettings::m_pipeTypes, GS232ControllerSettings::m_pipeURIs, this);
if (availablePipes != m_availablePipes)
{
m_availablePipes = availablePipes;
if (getMessageQueueToGUI())
{
MsgReportPipes *msgToGUI = MsgReportPipes::create();
@ -221,7 +222,7 @@ void GS232Controller::applySettings(const GS232ControllerSettings& settings, boo
<< " m_serialPort: " << settings.m_serialPort
<< " m_baudRate: " << settings.m_baudRate
<< " m_track: " << settings.m_track
<< " m_target: " << settings.m_target
<< " m_source: " << settings.m_source
<< " m_title: " << settings.m_title
<< " m_rgbColor: " << settings.m_rgbColor
<< " m_useReverseAPI: " << settings.m_useReverseAPI
@ -248,18 +249,20 @@ void GS232Controller::applySettings(const GS232ControllerSettings& settings, boo
if ((m_settings.m_track != settings.m_track) || force) {
reverseAPIKeys.append("track");
}
if ((m_settings.m_target != settings.m_target)
|| (!settings.m_target.isEmpty() && (m_selectedPipe == nullptr)) // Change in available pipes
if ((m_settings.m_source != settings.m_source)
|| (!settings.m_source.isEmpty() && (m_selectedPipe == nullptr)) // Change in available pipes
|| force)
{
if (!settings.m_target.isEmpty())
if (!settings.m_source.isEmpty())
{
m_selectedPipe = getPipeEndPoint(settings.m_target, m_availablePipes);
if (m_selectedPipe == nullptr)
qDebug() << "GS232Controller::applySettings: No plugin corresponding to target " << settings.m_target;
m_selectedPipe = getPipeEndPoint(settings.m_source, m_availablePipes);
if (m_selectedPipe == nullptr) {
qDebug() << "GS232Controller::applySettings: No plugin corresponding to source " << settings.m_source;
}
}
reverseAPIKeys.append("target");
reverseAPIKeys.append("source");
}
if ((m_settings.m_azimuthOffset != settings.m_azimuthOffset) || force) {
reverseAPIKeys.append("azimuthOffset");
@ -353,6 +356,17 @@ int GS232Controller::webapiSettingsPutPatch(
return 200;
}
int GS232Controller::webapiReportGet(
SWGSDRangel::SWGFeatureReport& response,
QString& errorMessage)
{
(void) errorMessage;
response.setGs232ControllerReport(new SWGSDRangel::SWGGS232ControllerReport());
response.getGs232ControllerReport()->init();
webapiFormatFeatureReport(response);
return 200;
}
void GS232Controller::webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response,
const GS232ControllerSettings& settings)
@ -362,6 +376,7 @@ void GS232Controller::webapiFormatFeatureSettings(
response.getGs232ControllerSettings()->setSerialPort(new QString(settings.m_serialPort));
response.getGs232ControllerSettings()->setBaudRate(settings.m_baudRate);
response.getGs232ControllerSettings()->setTrack(settings.m_track);
response.getGs232ControllerSettings()->setSource(new QString(settings.m_source));
response.getGs232ControllerSettings()->setAzimuthOffset(settings.m_azimuthOffset);
response.getGs232ControllerSettings()->setElevationOffset(settings.m_elevationOffset);
response.getGs232ControllerSettings()->setAzimuthMin(settings.m_azimuthMin);
@ -409,8 +424,8 @@ void GS232Controller::webapiUpdateFeatureSettings(
if (featureSettingsKeys.contains("track")) {
settings.m_track = response.getGs232ControllerSettings()->getTrack() != 0;
}
if (featureSettingsKeys.contains("target")) {
settings.m_target = *response.getGs232ControllerSettings()->getTarget();
if (featureSettingsKeys.contains("source")) {
settings.m_source = *response.getGs232ControllerSettings()->getSource();
}
if (featureSettingsKeys.contains("azimuthOffset")) {
settings.m_azimuthOffset = response.getGs232ControllerSettings()->getAzimuthOffset();
@ -479,8 +494,8 @@ void GS232Controller::webapiReverseSendSettings(QList<QString>& featureSettingsK
if (featureSettingsKeys.contains("track") || force) {
swgGS232ControllerSettings->setTrack(settings.m_track);
}
if (featureSettingsKeys.contains("target") || force) {
swgGS232ControllerSettings->setTarget(new QString(settings.m_target));
if (featureSettingsKeys.contains("source") || force) {
swgGS232ControllerSettings->setSource(new QString(settings.m_source));
}
if (featureSettingsKeys.contains("azimuthOffset") || force) {
swgGS232ControllerSettings->setAzimuthOffset(settings.m_azimuthOffset);
@ -533,6 +548,15 @@ void GS232Controller::webapiReverseSendSettings(QList<QString>& featureSettingsK
delete swgFeatureSettings;
}
void GS232Controller::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response)
{
response.getGs232ControllerReport()->setSources(new QList<QString*>());
for (int i = 0; i < m_availablePipes.size(); i++) {
response.getGs232ControllerReport()->getSources()->append(new QString(m_availablePipes.at(i).getName()));
}
}
void GS232Controller::networkManagerFinished(QNetworkReply *reply)
{
QNetworkReply::NetworkError replyError = reply->error();

View File

@ -126,6 +126,10 @@ public:
SWGSDRangel::SWGFeatureSettings& response,
QString& errorMessage);
virtual int webapiReportGet(
SWGSDRangel::SWGFeatureReport& response,
QString& errorMessage);
static void webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response,
const GS232ControllerSettings& settings);
@ -153,6 +157,7 @@ private:
void stop();
void applySettings(const GS232ControllerSettings& settings, bool force = false);
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const GS232ControllerSettings& settings, bool force);
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
private slots:
void updatePipes();

View File

@ -184,7 +184,7 @@ void GS232ControllerGUI::displaySettings()
ui->serialPort->lineEdit()->setText(m_settings.m_serialPort);
ui->baudRate->setCurrentText(QString("%1").arg(m_settings.m_baudRate));
ui->track->setChecked(m_settings.m_track);
ui->targets->setCurrentIndex(ui->targets->findText(m_settings.m_target));
ui->sources->setCurrentIndex(ui->sources->findText(m_settings.m_source));
ui->azimuthOffset->setValue(m_settings.m_azimuthOffset);
ui->elevationOffset->setValue(m_settings.m_elevationOffset);
ui->azimuthMin->setValue(m_settings.m_azimuthMin);
@ -208,29 +208,33 @@ void GS232ControllerGUI::updateSerialPortList()
void GS232ControllerGUI::updatePipeList()
{
QString currentText = ui->targets->currentText();
ui->targets->blockSignals(true);
ui->targets->clear();
QString currentText = ui->sources->currentText();
ui->sources->blockSignals(true);
ui->sources->clear();
QList<PipeEndPoint::AvailablePipeSource>::const_iterator it = m_availablePipes.begin();
for (int i = 0; it != m_availablePipes.end(); ++it, i++)
{
ui->targets->addItem(it->getName());
ui->sources->addItem(it->getName());
}
if (currentText.isEmpty())
{
if (m_availablePipes.size() > 0)
ui->targets->setCurrentIndex(0);
ui->sources->setCurrentIndex(0);
}
else
ui->targets->setCurrentIndex(ui->targets->findText(currentText));
ui->targets->blockSignals(false);
{
ui->sources->setCurrentIndex(ui->sources->findText(currentText));
}
ui->sources->blockSignals(false);
QString newText = ui->sources->currentText();
QString newText = ui->targets->currentText();
if (currentText != newText)
{
m_settings.m_target = newText;
m_settings.m_source = newText;
ui->targetName->setText("");
applySettings();
}
@ -381,15 +385,19 @@ void GS232ControllerGUI::on_track_stateChanged(int state)
{
m_settings.m_track = state == Qt::Checked;
ui->targetsLabel->setEnabled(m_settings.m_track);
ui->targets->setEnabled(m_settings.m_track);
if (!m_settings.m_track)
ui->sources->setEnabled(m_settings.m_track);
if (!m_settings.m_track) {
ui->targetName->setText("");
}
applySettings();
}
void GS232ControllerGUI::on_targets_currentTextChanged(const QString& text)
void GS232ControllerGUI::on_sources_currentTextChanged(const QString& text)
{
m_settings.m_target = text;
qDebug("GS232ControllerGUI::on_sources_currentTextChanged: %s", qPrintable(text));
m_settings.m_source = text;
ui->targetName->setText("");
applySettings();
}

View File

@ -83,7 +83,7 @@ private slots:
void on_track_stateChanged(int state);
void on_azimuth_valueChanged(double value);
void on_elevation_valueChanged(double value);
void on_targets_currentTextChanged(const QString& text);
void on_sources_currentTextChanged(const QString& text);
void on_azimuthOffset_valueChanged(int value);
void on_elevationOffset_valueChanged(int value);
void on_azimuthMin_valueChanged(int value);

View File

@ -440,7 +440,7 @@
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QComboBox" name="targets">
<widget class="QComboBox" name="sources">
<property name="minimumSize">
<size>
<width>150</width>

View File

@ -49,7 +49,7 @@ void GS232ControllerSettings::resetToDefaults()
m_serialPort = "";
m_baudRate = 9600;
m_track = false;
m_target = "";
m_source = "";
m_title = "GS-232 Rotator Controller";
m_rgbColor = QColor(225, 25, 99).rgb();
m_useReverseAPI = false;
@ -76,7 +76,7 @@ QByteArray GS232ControllerSettings::serialize() const
s.writeString(3, m_serialPort);
s.writeS32(4, m_baudRate);
s.writeBool(5, m_track);
s.writeString(6, m_target);
s.writeString(6, m_source);
s.writeString(8, m_title);
s.writeU32(9, m_rgbColor);
s.writeBool(10, m_useReverseAPI);
@ -117,7 +117,7 @@ bool GS232ControllerSettings::deserialize(const QByteArray& data)
d.readString(3, &m_serialPort, "");
d.readS32(4, &m_baudRate, 9600);
d.readBool(5, &m_track, false);
d.readString(6, &m_target, "");
d.readString(6, &m_source, "");
d.readString(8, &m_title, "GS-232 Rotator Controller");
d.readU32(9, &m_rgbColor, QColor(225, 25, 99).rgb());
d.readBool(10, &m_useReverseAPI, false);

View File

@ -33,7 +33,7 @@ struct GS232ControllerSettings
QString m_serialPort;
int m_baudRate;
bool m_track;
QString m_target; // Plugin to get az/el from. E.g: "R0:0 ADSBDemod". Use a string, so can be set via WebAPI
QString m_source; // Plugin to get az/el from. E.g: "R0:0 ADSBDemod". Use a string, so can be set via WebAPI
int m_azimuthOffset;
int m_elevationOffset;
int m_azimuthMin;

View File

@ -4908,6 +4908,9 @@ margin-bottom: 20px;
},
"SimplePTTReport" : {
"$ref" : "#/definitions/SimplePTTReport"
},
"GS232ControllerReport" : {
"$ref" : "#/definitions/GS232ControllerReport"
}
},
"description" : "Base feature report. Only the feature report corresponding to the feature specified in the featureType field is or should be present."
@ -5768,6 +5771,18 @@ margin-bottom: 20px;
}
},
"description" : "GLSpectrumGUI settings"
};
defs.GS232ControllerReport = {
"properties" : {
"sources" : {
"type" : "array",
"description" : "Names of pipe sources",
"items" : {
"type" : "string"
}
}
},
"description" : "GS-232 Controller report"
};
defs.GS232ControllerSettings = {
"properties" : {
@ -5793,9 +5808,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Track a target where azimuth and elevation are determined by another plugin (1 for yes, 0 for no)"
},
"target" : {
"source" : {
"type" : "string",
"description" : "Identifier of the channel or feature plugin providing target azimuth and elevation (E.g. R0:0 ADSBDemod)"
"description" : "Identifier of the channel or feature plugin providing azimuth and elevation (E.g. R0:0 ADSBDemod)"
},
"azimuthOffset" : {
"type" : "integer",
@ -50580,7 +50595,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-10-03T09:59:26.222+02:00
Generated 2021-10-03T22:30:03.018+02:00
</div>
</div>
</div>

View File

@ -11,3 +11,5 @@ FeatureReport:
$ref: "/doc/swagger/include/AFC.yaml#/AFCReport"
SimplePTTReport:
$ref: "/doc/swagger/include/SimplePTT.yaml#/SimplePTTReport"
GS232ControllerReport:
$ref: "/doc/swagger/include/GS232Controller.yaml#/GS232ControllerReport"

View File

@ -18,8 +18,8 @@ GS232ControllerSettings:
track:
description: Track a target where azimuth and elevation are determined by another plugin (1 for yes, 0 for no)
type: integer
target:
description: "Identifier of the channel or feature plugin providing target azimuth and elevation (E.g. R0:0 ADSBDemod)"
source:
description: "Identifier of the channel or feature plugin providing azimuth and elevation (E.g. R0:0 ADSBDemod)"
type: string
azimuthOffset:
description: Azimuth offset in degrees
@ -60,3 +60,12 @@ GS232ControllerSettings:
type: integer
reverseAPIFeatureIndex:
type: integer
GS232ControllerReport:
description: "GS-232 Controller report"
properties:
sources:
description: Names of pipe sources
type: array
items:
type: string

View File

@ -11,3 +11,5 @@ FeatureReport:
$ref: "http://swgserver:8081/api/swagger/include/AFC.yaml#/AFCReport"
SimplePTTReport:
$ref: "http://swgserver:8081/api/swagger/include/SimplePTT.yaml#/SimplePTTReport"
GS232ControllerReport:
$ref: "http://swgserver:8081/api/swagger/include/GS232Controller.yaml#/GS232ControllerReport"

View File

@ -18,8 +18,8 @@ GS232ControllerSettings:
track:
description: Track a target where azimuth and elevation are determined by another plugin (1 for yes, 0 for no)
type: integer
target:
description: "Identifier of the channel or feature plugin providing target azimuth and elevation (E.g. R0:0 ADSBDemod)"
source:
description: "Identifier of the channel or feature plugin providing azimuth and elevation (E.g. R0:0 ADSBDemod)"
type: string
azimuthOffset:
description: Azimuth offset in degrees
@ -60,3 +60,12 @@ GS232ControllerSettings:
type: integer
reverseAPIFeatureIndex:
type: integer
GS232ControllerReport:
description: "GS-232 Controller report"
properties:
sources:
description: Names of pipe sources
type: array
items:
type: string

View File

@ -4908,6 +4908,9 @@ margin-bottom: 20px;
},
"SimplePTTReport" : {
"$ref" : "#/definitions/SimplePTTReport"
},
"GS232ControllerReport" : {
"$ref" : "#/definitions/GS232ControllerReport"
}
},
"description" : "Base feature report. Only the feature report corresponding to the feature specified in the featureType field is or should be present."
@ -5768,6 +5771,18 @@ margin-bottom: 20px;
}
},
"description" : "GLSpectrumGUI settings"
};
defs.GS232ControllerReport = {
"properties" : {
"sources" : {
"type" : "array",
"description" : "Names of pipe sources",
"items" : {
"type" : "string"
}
}
},
"description" : "GS-232 Controller report"
};
defs.GS232ControllerSettings = {
"properties" : {
@ -5793,9 +5808,9 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Track a target where azimuth and elevation are determined by another plugin (1 for yes, 0 for no)"
},
"target" : {
"source" : {
"type" : "string",
"description" : "Identifier of the channel or feature plugin providing target azimuth and elevation (E.g. R0:0 ADSBDemod)"
"description" : "Identifier of the channel or feature plugin providing azimuth and elevation (E.g. R0:0 ADSBDemod)"
},
"azimuthOffset" : {
"type" : "integer",
@ -50580,7 +50595,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-10-03T09:59:26.222+02:00
Generated 2021-10-03T22:30:03.018+02:00
</div>
</div>
</div>

View File

@ -34,6 +34,8 @@ SWGFeatureReport::SWGFeatureReport() {
m_afc_report_isSet = false;
simple_ptt_report = nullptr;
m_simple_ptt_report_isSet = false;
gs232_controller_report = nullptr;
m_gs232_controller_report_isSet = false;
}
SWGFeatureReport::~SWGFeatureReport() {
@ -48,6 +50,8 @@ SWGFeatureReport::init() {
m_afc_report_isSet = false;
simple_ptt_report = new SWGSimplePTTReport();
m_simple_ptt_report_isSet = false;
gs232_controller_report = new SWGGS232ControllerReport();
m_gs232_controller_report_isSet = false;
}
void
@ -61,6 +65,9 @@ SWGFeatureReport::cleanup() {
if(simple_ptt_report != nullptr) {
delete simple_ptt_report;
}
if(gs232_controller_report != nullptr) {
delete gs232_controller_report;
}
}
SWGFeatureReport*
@ -80,6 +87,8 @@ SWGFeatureReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&simple_ptt_report, pJson["SimplePTTReport"], "SWGSimplePTTReport", "SWGSimplePTTReport");
::SWGSDRangel::setValue(&gs232_controller_report, pJson["GS232ControllerReport"], "SWGGS232ControllerReport", "SWGGS232ControllerReport");
}
QString
@ -105,6 +114,9 @@ SWGFeatureReport::asJsonObject() {
if((simple_ptt_report != nullptr) && (simple_ptt_report->isSet())){
toJsonValue(QString("SimplePTTReport"), simple_ptt_report, obj, QString("SWGSimplePTTReport"));
}
if((gs232_controller_report != nullptr) && (gs232_controller_report->isSet())){
toJsonValue(QString("GS232ControllerReport"), gs232_controller_report, obj, QString("SWGGS232ControllerReport"));
}
return obj;
}
@ -139,6 +151,16 @@ SWGFeatureReport::setSimplePttReport(SWGSimplePTTReport* simple_ptt_report) {
this->m_simple_ptt_report_isSet = true;
}
SWGGS232ControllerReport*
SWGFeatureReport::getGs232ControllerReport() {
return gs232_controller_report;
}
void
SWGFeatureReport::setGs232ControllerReport(SWGGS232ControllerReport* gs232_controller_report) {
this->gs232_controller_report = gs232_controller_report;
this->m_gs232_controller_report_isSet = true;
}
bool
SWGFeatureReport::isSet(){
@ -153,6 +175,9 @@ SWGFeatureReport::isSet(){
if(simple_ptt_report && simple_ptt_report->isSet()){
isObjectUpdated = true; break;
}
if(gs232_controller_report && gs232_controller_report->isSet()){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

View File

@ -23,6 +23,7 @@
#include "SWGAFCReport.h"
#include "SWGGS232ControllerReport.h"
#include "SWGSimplePTTReport.h"
#include <QString>
@ -53,6 +54,9 @@ public:
SWGSimplePTTReport* getSimplePttReport();
void setSimplePttReport(SWGSimplePTTReport* simple_ptt_report);
SWGGS232ControllerReport* getGs232ControllerReport();
void setGs232ControllerReport(SWGGS232ControllerReport* gs232_controller_report);
virtual bool isSet() override;
@ -66,6 +70,9 @@ private:
SWGSimplePTTReport* simple_ptt_report;
bool m_simple_ptt_report_isSet;
SWGGS232ControllerReport* gs232_controller_report;
bool m_gs232_controller_report_isSet;
};
}

View File

@ -0,0 +1,114 @@
/**
* 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 "SWGGS232ControllerReport.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGGS232ControllerReport::SWGGS232ControllerReport(QString* json) {
init();
this->fromJson(*json);
}
SWGGS232ControllerReport::SWGGS232ControllerReport() {
sources = nullptr;
m_sources_isSet = false;
}
SWGGS232ControllerReport::~SWGGS232ControllerReport() {
this->cleanup();
}
void
SWGGS232ControllerReport::init() {
sources = new QList<QString*>();
m_sources_isSet = false;
}
void
SWGGS232ControllerReport::cleanup() {
if(sources != nullptr) {
auto arr = sources;
for(auto o: *arr) {
delete o;
}
delete sources;
}
}
SWGGS232ControllerReport*
SWGGS232ControllerReport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGGS232ControllerReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sources, pJson["sources"], "QList", "QString");
}
QString
SWGGS232ControllerReport::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGGS232ControllerReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(sources && sources->size() > 0){
toJsonArray((QList<void*>*)sources, obj, "sources", "QString");
}
return obj;
}
QList<QString*>*
SWGGS232ControllerReport::getSources() {
return sources;
}
void
SWGGS232ControllerReport::setSources(QList<QString*>* sources) {
this->sources = sources;
this->m_sources_isSet = true;
}
bool
SWGGS232ControllerReport::isSet(){
bool isObjectUpdated = false;
do{
if(sources && (sources->size() > 0)){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,60 @@
/**
* 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.
*/
/*
* SWGGS232ControllerReport.h
*
* GS-232 Controller report
*/
#ifndef SWGGS232ControllerReport_H_
#define SWGGS232ControllerReport_H_
#include <QJsonObject>
#include <QList>
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGGS232ControllerReport: public SWGObject {
public:
SWGGS232ControllerReport();
SWGGS232ControllerReport(QString* json);
virtual ~SWGGS232ControllerReport();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGGS232ControllerReport* fromJson(QString &jsonString) override;
QList<QString*>* getSources();
void setSources(QList<QString*>* sources);
virtual bool isSet() override;
private:
QList<QString*>* sources;
bool m_sources_isSet;
};
}
#endif /* SWGGS232ControllerReport_H_ */

View File

@ -38,8 +38,8 @@ SWGGS232ControllerSettings::SWGGS232ControllerSettings() {
m_baud_rate_isSet = false;
track = 0;
m_track_isSet = false;
target = nullptr;
m_target_isSet = false;
source = nullptr;
m_source_isSet = false;
azimuth_offset = 0;
m_azimuth_offset_isSet = false;
elevation_offset = 0;
@ -88,8 +88,8 @@ SWGGS232ControllerSettings::init() {
m_baud_rate_isSet = false;
track = 0;
m_track_isSet = false;
target = new QString("");
m_target_isSet = false;
source = new QString("");
m_source_isSet = false;
azimuth_offset = 0;
m_azimuth_offset_isSet = false;
elevation_offset = 0;
@ -131,8 +131,8 @@ SWGGS232ControllerSettings::cleanup() {
}
if(target != nullptr) {
delete target;
if(source != nullptr) {
delete source;
}
@ -176,7 +176,7 @@ SWGGS232ControllerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&track, pJson["track"], "qint32", "");
::SWGSDRangel::setValue(&target, pJson["target"], "QString", "QString");
::SWGSDRangel::setValue(&source, pJson["source"], "QString", "QString");
::SWGSDRangel::setValue(&azimuth_offset, pJson["azimuthOffset"], "qint32", "");
@ -239,8 +239,8 @@ SWGGS232ControllerSettings::asJsonObject() {
if(m_track_isSet){
obj->insert("track", QJsonValue(track));
}
if(target != nullptr && *target != QString("")){
toJsonValue(QString("target"), target, obj, QString("QString"));
if(source != nullptr && *source != QString("")){
toJsonValue(QString("source"), source, obj, QString("QString"));
}
if(m_azimuth_offset_isSet){
obj->insert("azimuthOffset", QJsonValue(azimuth_offset));
@ -342,13 +342,13 @@ SWGGS232ControllerSettings::setTrack(qint32 track) {
}
QString*
SWGGS232ControllerSettings::getTarget() {
return target;
SWGGS232ControllerSettings::getSource() {
return source;
}
void
SWGGS232ControllerSettings::setTarget(QString* target) {
this->target = target;
this->m_target_isSet = true;
SWGGS232ControllerSettings::setSource(QString* source) {
this->source = source;
this->m_source_isSet = true;
}
qint32
@ -521,7 +521,7 @@ SWGGS232ControllerSettings::isSet(){
if(m_track_isSet){
isObjectUpdated = true; break;
}
if(target && *target != QString("")){
if(source && *source != QString("")){
isObjectUpdated = true; break;
}
if(m_azimuth_offset_isSet){

View File

@ -57,8 +57,8 @@ public:
qint32 getTrack();
void setTrack(qint32 track);
QString* getTarget();
void setTarget(QString* target);
QString* getSource();
void setSource(QString* source);
qint32 getAzimuthOffset();
void setAzimuthOffset(qint32 azimuth_offset);
@ -124,8 +124,8 @@ private:
qint32 track;
bool m_track_isSet;
QString* target;
bool m_target_isSet;
QString* source;
bool m_source_isSet;
qint32 azimuth_offset;
bool m_azimuth_offset_isSet;

View File

@ -133,6 +133,7 @@
#include "SWGFrequencyRange.h"
#include "SWGGLScope.h"
#include "SWGGLSpectrum.h"
#include "SWGGS232ControllerReport.h"
#include "SWGGS232ControllerSettings.h"
#include "SWGGain.h"
#include "SWGHackRFInputSettings.h"
@ -883,6 +884,11 @@ namespace SWGSDRangel {
obj->init();
return obj;
}
if(QString("SWGGS232ControllerReport").compare(type) == 0) {
SWGGS232ControllerReport *obj = new SWGGS232ControllerReport();
obj->init();
return obj;
}
if(QString("SWGGS232ControllerSettings").compare(type) == 0) {
SWGGS232ControllerSettings *obj = new SWGGS232ControllerSettings();
obj->init();