1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Add tunerType to Web API report

This commit is contained in:
Jon Beniston 2023-09-15 09:33:24 +01:00
parent 1b1530f10d
commit 28c566f84c
4 changed files with 36 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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