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

SDRplay V3: added device type in API report

This commit is contained in:
f4exb 2021-08-25 15:27:06 +02:00
parent 786d753ec9
commit 0ec7ec414d
7 changed files with 70 additions and 2 deletions

View File

@ -937,6 +937,28 @@ void SDRPlayV3Input::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
response.getSdrPlayV3Report()->getBandwidths()->append(new SWGSDRangel::SWGBandwidth);
response.getSdrPlayV3Report()->getBandwidths()->back()->setBandwidth(SDRPlayV3Bandwidths::getBandwidth(i));
}
switch(getDeviceId())
{
case SDRPLAY_RSP1_ID:
response.getSdrPlayV3Report()->setDeviceType(new QString("RSP1"));
break;
case SDRPLAY_RSP1A_ID:
response.getSdrPlayV3Report()->setDeviceType(new QString("RSP1A"));
break;
case SDRPLAY_RSP2_ID:
response.getSdrPlayV3Report()->setDeviceType(new QString("RSP2"));
break;
case SDRPLAY_RSPduo_ID:
response.getSdrPlayV3Report()->setDeviceType(new QString("RSPduo"));
break;
case SDRPLAY_RSPdx_ID:
response.getSdrPlayV3Report()->setDeviceType(new QString("RSPdx"));
break;
default:
response.getSdrPlayV3Report()->setDeviceType(new QString("Unknown"));
break;
}
}
void SDRPlayV3Input::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const SDRPlayV3Settings& settings, bool force)

View File

@ -9495,6 +9495,10 @@ margin-bottom: 20px;
};
defs.SDRPlayV3Report = {
"properties" : {
"deviceType" : {
"type" : "string",
"description" : "SDRplay device type. Can be RSP1, RSP1A, RSP2, RSPduo, RSPdx, Unknown"
},
"bandwidths" : {
"type" : "array",
"items" : {
@ -47724,7 +47728,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-08-21T12:00:48.492+02:00
Generated 2021-08-25T15:15:18.832+02:00
</div>
</div>
</div>

View File

@ -51,6 +51,9 @@ SDRPlayV3Settings:
SDRPlayV3Report:
description: SDRplayV3
properties:
deviceType:
type: string
description: SDRplay device type. Can be RSP1, RSP1A, RSP2, RSPduo, RSPdx, Unknown
bandwidths:
type: array
items:

View File

@ -51,6 +51,9 @@ SDRPlayV3Settings:
SDRPlayV3Report:
description: SDRplayV3
properties:
deviceType:
type: string
description: SDRplay device type. Can be RSP1, RSP1A, RSP2, RSPduo, RSPdx, Unknown
bandwidths:
type: array
items:

View File

@ -9495,6 +9495,10 @@ margin-bottom: 20px;
};
defs.SDRPlayV3Report = {
"properties" : {
"deviceType" : {
"type" : "string",
"description" : "SDRplay device type. Can be RSP1, RSP1A, RSP2, RSPduo, RSPdx, Unknown"
},
"bandwidths" : {
"type" : "array",
"items" : {
@ -47724,7 +47728,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-08-21T12:00:48.492+02:00
Generated 2021-08-25T15:15:18.832+02:00
</div>
</div>
</div>

View File

@ -28,6 +28,8 @@ SWGSDRPlayV3Report::SWGSDRPlayV3Report(QString* json) {
}
SWGSDRPlayV3Report::SWGSDRPlayV3Report() {
device_type = nullptr;
m_device_type_isSet = false;
bandwidths = nullptr;
m_bandwidths_isSet = false;
intermediate_frequencies = nullptr;
@ -40,6 +42,8 @@ SWGSDRPlayV3Report::~SWGSDRPlayV3Report() {
void
SWGSDRPlayV3Report::init() {
device_type = new QString("");
m_device_type_isSet = false;
bandwidths = new QList<SWGBandwidth*>();
m_bandwidths_isSet = false;
intermediate_frequencies = new QList<SWGFrequency*>();
@ -48,6 +52,9 @@ SWGSDRPlayV3Report::init() {
void
SWGSDRPlayV3Report::cleanup() {
if(device_type != nullptr) {
delete device_type;
}
if(bandwidths != nullptr) {
auto arr = bandwidths;
for(auto o: *arr) {
@ -75,6 +82,8 @@ SWGSDRPlayV3Report::fromJson(QString &json) {
void
SWGSDRPlayV3Report::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&device_type, pJson["deviceType"], "QString", "QString");
::SWGSDRangel::setValue(&bandwidths, pJson["bandwidths"], "QList", "SWGBandwidth");
@ -95,6 +104,9 @@ SWGSDRPlayV3Report::asJson ()
QJsonObject*
SWGSDRPlayV3Report::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(device_type != nullptr && *device_type != QString("")){
toJsonValue(QString("deviceType"), device_type, obj, QString("QString"));
}
if(bandwidths && bandwidths->size() > 0){
toJsonArray((QList<void*>*)bandwidths, obj, "bandwidths", "SWGBandwidth");
}
@ -105,6 +117,16 @@ SWGSDRPlayV3Report::asJsonObject() {
return obj;
}
QString*
SWGSDRPlayV3Report::getDeviceType() {
return device_type;
}
void
SWGSDRPlayV3Report::setDeviceType(QString* device_type) {
this->device_type = device_type;
this->m_device_type_isSet = true;
}
QList<SWGBandwidth*>*
SWGSDRPlayV3Report::getBandwidths() {
return bandwidths;
@ -130,6 +152,9 @@ bool
SWGSDRPlayV3Report::isSet(){
bool isObjectUpdated = false;
do{
if(device_type && *device_type != QString("")){
isObjectUpdated = true; break;
}
if(bandwidths && (bandwidths->size() > 0)){
isObjectUpdated = true; break;
}

View File

@ -25,6 +25,7 @@
#include "SWGBandwidth.h"
#include "SWGFrequency.h"
#include <QList>
#include <QString>
#include "SWGObject.h"
#include "export.h"
@ -44,6 +45,9 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGSDRPlayV3Report* fromJson(QString &jsonString) override;
QString* getDeviceType();
void setDeviceType(QString* device_type);
QList<SWGBandwidth*>* getBandwidths();
void setBandwidths(QList<SWGBandwidth*>* bandwidths);
@ -54,6 +58,9 @@ public:
virtual bool isSet() override;
private:
QString* device_type;
bool m_device_type_isSet;
QList<SWGBandwidth*>* bandwidths;
bool m_bandwidths_isSet;