Add tunerType to Web API report

pull/1830/head
Jon Beniston 2023-09-15 09:33:24 +01:00
rodzic 1b1530f10d
commit 28c566f84c
4 zmienionych plików z 36 dodań i 0 usunięć

Wyświetl plik

@ -780,6 +780,8 @@ void RTLSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respons
response.getRtlSdrReport()->getGains()->append(new SWGSDRangel::SWGGain);
response.getRtlSdrReport()->getGains()->back()->setGainCb(*it);
}
response.getRtlSdrReport()->setTunerType(new QString(getTunerName()));
}
void RTLSDRInput::webapiReverseSendSettings(const QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force)

Wyświetl plik

@ -62,3 +62,5 @@ RtlSdrReport:
type: array
items:
$ref: "http://swgserver:8081/api/swagger/include/Structs.yaml#/Gain"
tunerType:
type: string

Wyświetl plik

@ -30,6 +30,8 @@ SWGRtlSdrReport::SWGRtlSdrReport(QString* json) {
SWGRtlSdrReport::SWGRtlSdrReport() {
gains = nullptr;
m_gains_isSet = false;
tuner_type = nullptr;
m_tuner_type_isSet = false;
}
SWGRtlSdrReport::~SWGRtlSdrReport() {
@ -40,6 +42,8 @@ void
SWGRtlSdrReport::init() {
gains = new QList<SWGGain*>();
m_gains_isSet = false;
tuner_type = new QString("");
m_tuner_type_isSet = false;
}
void
@ -51,6 +55,9 @@ SWGRtlSdrReport::cleanup() {
}
delete gains;
}
if(tuner_type != nullptr) {
delete tuner_type;
}
}
SWGRtlSdrReport*
@ -66,6 +73,8 @@ void
SWGRtlSdrReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&gains, pJson["gains"], "QList", "SWGGain");
::SWGSDRangel::setValue(&tuner_type, pJson["tunerType"], "QString", "QString");
}
QString
@ -85,6 +94,9 @@ SWGRtlSdrReport::asJsonObject() {
if(gains && gains->size() > 0){
toJsonArray((QList<void*>*)gains, obj, "gains", "SWGGain");
}
if(tuner_type != nullptr && *tuner_type != QString("")){
toJsonValue(QString("tunerType"), tuner_type, obj, QString("QString"));
}
return obj;
}
@ -99,6 +111,16 @@ SWGRtlSdrReport::setGains(QList<SWGGain*>* gains) {
this->m_gains_isSet = true;
}
QString*
SWGRtlSdrReport::getTunerType() {
return tuner_type;
}
void
SWGRtlSdrReport::setTunerType(QString* tuner_type) {
this->tuner_type = tuner_type;
this->m_tuner_type_isSet = true;
}
bool
SWGRtlSdrReport::isSet(){
@ -107,6 +129,9 @@ SWGRtlSdrReport::isSet(){
if(gains && (gains->size() > 0)){
isObjectUpdated = true; break;
}
if(tuner_type && *tuner_type != QString("")){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

Wyświetl plik

@ -24,6 +24,7 @@
#include "SWGGain.h"
#include <QList>
#include <QString>
#include "SWGObject.h"
#include "export.h"
@ -46,6 +47,9 @@ public:
QList<SWGGain*>* getGains();
void setGains(QList<SWGGain*>* gains);
QString* getTunerType();
void setTunerType(QString* tuner_type);
virtual bool isSet() override;
@ -53,6 +57,9 @@ private:
QList<SWGGain*>* gains;
bool m_gains_isSet;
QString* tuner_type;
bool m_tuner_type_isSet;
};
}