1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-01 05:22:26 -04:00

Web API: use a fixed version of the Qt5/cpp generator that does not create memory leaks

This commit is contained in:
f4exb 2018-02-12 18:20:27 +01:00
parent e0d4860359
commit ac6aabe97e
89 changed files with 3775 additions and 1665 deletions

File diff suppressed because one or more lines are too long

View File

@ -65,20 +65,24 @@ swagger project start -m
<h3>Installation</h3> <h3>Installation</h3>
The code generator is delivered in the form of a jar that you execute from the console using the java command. First make sure you have a JDK or JRE version 1.7 or above. In our example it will be located in `/opt/install/jdk1.8.0_74/` The released code generator is presently creating memory leaks for the Qt5/cpp generated code. A fixed version is available [here](https://github.com/etherealjoy/swagger-codegen/tree/qt5cpp_rework_antis81_patch-1).
Download the jar from [this archive](https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/). Choose the latest version ex: 2.2.3 which can be done with wget. Say you want to install the jar in `/opt/install/swagger`: So you will have to clone this repository and checkout the `qt5cpp_rework_antis81_patch-1` branch. Then follow the build instructions which are very simple when using maven:
```shell ```shell
cd /opt/install/swagger sudo apt-get install maven # do this once to install maven
wget https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar cd swagger-codegen
export JAVA_HOME=/opt/install/jdk1.8.0_74 # Example JDK change to your own
mvn clean package # let it compile...
mkdir -p /opt/install/swagger/swagger-codegen
cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar /opt/install/swagger/swagger-codegen
``` ```
Then in the same directory write a little `swagger-codegen` shell script to facilitate the invocation. For example: Then in the `/opt/install/swagger/` directory write a little `swagger-codegen` shell script to facilitate the invocation. For example:
```shell ```shell
#!/bin/sh #!/bin/sh
/opt/install/jdk1.8.0_74/bin/java -jar /opt/install/swagger/swagger-codegen-cli-2.2.3.jar ${*} /opt/install/jdk1.8.0_74/bin/java -jar /opt/install/swagger/swagger-codegen-cli.jar ${*}
``` ```
Then invoke the generator with `/opt/install/swagger/swagger-codegen <commands>` Then invoke the generator with `/opt/install/swagger/swagger-codegen <commands>`

View File

@ -1 +1 @@
2.2.3 2.4.0-SNAPSHOT

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
2.2.3 2.4.0-SNAPSHOT

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGAudioDevice::SWGAudioDevice(QString* json) { SWGAudioDevice::SWGAudioDevice(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGAudioDevice::SWGAudioDevice() { SWGAudioDevice::SWGAudioDevice() {
@ -38,18 +38,18 @@ SWGAudioDevice::~SWGAudioDevice() {
void void
SWGAudioDevice::init() { SWGAudioDevice::init() {
name = new QString(""); name = new QString("");
m_name_isSet = false;
} }
void void
SWGAudioDevice::cleanup() { SWGAudioDevice::cleanup() {
if(name != nullptr) { if(name != nullptr) {
delete name; delete name;
} }
} }
SWGAudioDevice* SWGAudioDevice*
SWGAudioDevice::fromJson(QString &json) { SWGAudioDevice::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,25 +58,26 @@ SWGAudioDevice::fromJson(QString &json) {
} }
void void
SWGAudioDevice::fromJsonObject(QJsonObject &pJson) { SWGAudioDevice::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString"); ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
} }
QString QString
SWGAudioDevice::asJson () SWGAudioDevice::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGAudioDevice::asJsonObject() { SWGAudioDevice::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString"));
}
return obj; return obj;
} }
@ -88,8 +89,17 @@ SWGAudioDevice::getName() {
void void
SWGAudioDevice::setName(QString* name) { SWGAudioDevice::setName(QString* name) {
this->name = name; this->name = name;
this->m_name_isSet = true;
} }
bool
SWGAudioDevice::isSet(){
bool isObjectUpdated = false;
do{
if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,28 +26,31 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGAudioDevice: public SWGObject { class SWGAudioDevice: public SWGObject {
public: public:
SWGAudioDevice(); SWGAudioDevice();
SWGAudioDevice(QString* json); SWGAudioDevice(QString json);
virtual ~SWGAudioDevice(); ~SWGAudioDevice();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGAudioDevice* fromJson(QString &jsonString); SWGAudioDevice* fromJson(QString jsonString);
QString* getName(); QString* getName();
void setName(QString* name); void setName(QString* name);
virtual bool isSet() override;
private: private:
QString* name; QString* name;
bool m_name_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGAudioDevices::SWGAudioDevices(QString* json) { SWGAudioDevices::SWGAudioDevices(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGAudioDevices::SWGAudioDevices() { SWGAudioDevices::SWGAudioDevices() {
@ -38,12 +38,19 @@ SWGAudioDevices::~SWGAudioDevices() {
void void
SWGAudioDevices::init() { SWGAudioDevices::init() {
input_volume = 0.0f; input_volume = 0.0f;
m_input_volume_isSet = false;
nb_input_devices = 0; nb_input_devices = 0;
m_nb_input_devices_isSet = false;
input_device_selected_index = 0; input_device_selected_index = 0;
m_input_device_selected_index_isSet = false;
input_devices = new QList<SWGAudioDevice*>(); input_devices = new QList<SWGAudioDevice*>();
m_input_devices_isSet = false;
nb_output_devices = 0; nb_output_devices = 0;
m_nb_output_devices_isSet = false;
output_device_selected_index = 0; output_device_selected_index = 0;
m_output_device_selected_index_isSet = false;
output_devices = new QList<SWGAudioDevice*>(); output_devices = new QList<SWGAudioDevice*>();
m_output_devices_isSet = false;
} }
void void
@ -51,20 +58,18 @@ SWGAudioDevices::cleanup() {
if(input_devices != nullptr) { if(input_devices != nullptr) {
QList<SWGAudioDevice*>* arr = input_devices; auto arr = input_devices;
foreach(SWGAudioDevice* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete input_devices; delete input_devices;
} }
if(output_devices != nullptr) { if(output_devices != nullptr) {
QList<SWGAudioDevice*>* arr = output_devices; auto arr = output_devices;
foreach(SWGAudioDevice* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete output_devices; delete output_devices;
@ -72,7 +77,7 @@ SWGAudioDevices::cleanup() {
} }
SWGAudioDevices* SWGAudioDevices*
SWGAudioDevices::fromJson(QString &json) { SWGAudioDevices::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -81,51 +86,56 @@ SWGAudioDevices::fromJson(QString &json) {
} }
void void
SWGAudioDevices::fromJsonObject(QJsonObject &pJson) { SWGAudioDevices::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", ""); ::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", "");
::SWGSDRangel::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", ""); ::SWGSDRangel::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", "");
::SWGSDRangel::setValue(&input_device_selected_index, pJson["inputDeviceSelectedIndex"], "qint32", ""); ::SWGSDRangel::setValue(&input_device_selected_index, pJson["inputDeviceSelectedIndex"], "qint32", "");
::SWGSDRangel::setValue(&input_devices, pJson["inputDevices"], "QList", "SWGAudioDevice");
::SWGSDRangel::setValue(&input_devices, pJson["inputDevices"], "QList", "SWGAudioDevice");
::SWGSDRangel::setValue(&nb_output_devices, pJson["nbOutputDevices"], "qint32", ""); ::SWGSDRangel::setValue(&nb_output_devices, pJson["nbOutputDevices"], "qint32", "");
::SWGSDRangel::setValue(&output_device_selected_index, pJson["outputDeviceSelectedIndex"], "qint32", ""); ::SWGSDRangel::setValue(&output_device_selected_index, pJson["outputDeviceSelectedIndex"], "qint32", "");
::SWGSDRangel::setValue(&output_devices, pJson["outputDevices"], "QList", "SWGAudioDevice");
::SWGSDRangel::setValue(&output_devices, pJson["outputDevices"], "QList", "SWGAudioDevice");
} }
QString QString
SWGAudioDevices::asJson () SWGAudioDevices::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGAudioDevices::asJsonObject() { SWGAudioDevices::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_input_volume_isSet){
obj->insert("inputVolume", QJsonValue(input_volume)); obj.insert("inputVolume", QJsonValue(input_volume));
}
obj->insert("nbInputDevices", QJsonValue(nb_input_devices)); if(m_nb_input_devices_isSet){
obj.insert("nbInputDevices", QJsonValue(nb_input_devices));
obj->insert("inputDeviceSelectedIndex", QJsonValue(input_device_selected_index)); }
if(m_input_device_selected_index_isSet){
QJsonArray input_devicesJsonArray; obj.insert("inputDeviceSelectedIndex", QJsonValue(input_device_selected_index));
toJsonArray((QList<void*>*)input_devices, &input_devicesJsonArray, "input_devices", "SWGAudioDevice"); }
obj->insert("inputDevices", input_devicesJsonArray); if(input_devices->size() > 0){
toJsonArray((QList<void*>*)input_devices, obj, "inputDevices", "SWGAudioDevice");
obj->insert("nbOutputDevices", QJsonValue(nb_output_devices)); }
if(m_nb_output_devices_isSet){
obj->insert("outputDeviceSelectedIndex", QJsonValue(output_device_selected_index)); obj.insert("nbOutputDevices", QJsonValue(nb_output_devices));
}
QJsonArray output_devicesJsonArray; if(m_output_device_selected_index_isSet){
toJsonArray((QList<void*>*)output_devices, &output_devicesJsonArray, "output_devices", "SWGAudioDevice"); obj.insert("outputDeviceSelectedIndex", QJsonValue(output_device_selected_index));
obj->insert("outputDevices", output_devicesJsonArray); }
if(output_devices->size() > 0){
toJsonArray((QList<void*>*)output_devices, obj, "outputDevices", "SWGAudioDevice");
}
return obj; return obj;
} }
@ -137,6 +147,7 @@ SWGAudioDevices::getInputVolume() {
void void
SWGAudioDevices::setInputVolume(float input_volume) { SWGAudioDevices::setInputVolume(float input_volume) {
this->input_volume = input_volume; this->input_volume = input_volume;
this->m_input_volume_isSet = true;
} }
qint32 qint32
@ -146,6 +157,7 @@ SWGAudioDevices::getNbInputDevices() {
void void
SWGAudioDevices::setNbInputDevices(qint32 nb_input_devices) { SWGAudioDevices::setNbInputDevices(qint32 nb_input_devices) {
this->nb_input_devices = nb_input_devices; this->nb_input_devices = nb_input_devices;
this->m_nb_input_devices_isSet = true;
} }
qint32 qint32
@ -155,6 +167,7 @@ SWGAudioDevices::getInputDeviceSelectedIndex() {
void void
SWGAudioDevices::setInputDeviceSelectedIndex(qint32 input_device_selected_index) { SWGAudioDevices::setInputDeviceSelectedIndex(qint32 input_device_selected_index) {
this->input_device_selected_index = input_device_selected_index; this->input_device_selected_index = input_device_selected_index;
this->m_input_device_selected_index_isSet = true;
} }
QList<SWGAudioDevice*>* QList<SWGAudioDevice*>*
@ -164,6 +177,7 @@ SWGAudioDevices::getInputDevices() {
void void
SWGAudioDevices::setInputDevices(QList<SWGAudioDevice*>* input_devices) { SWGAudioDevices::setInputDevices(QList<SWGAudioDevice*>* input_devices) {
this->input_devices = input_devices; this->input_devices = input_devices;
this->m_input_devices_isSet = true;
} }
qint32 qint32
@ -173,6 +187,7 @@ SWGAudioDevices::getNbOutputDevices() {
void void
SWGAudioDevices::setNbOutputDevices(qint32 nb_output_devices) { SWGAudioDevices::setNbOutputDevices(qint32 nb_output_devices) {
this->nb_output_devices = nb_output_devices; this->nb_output_devices = nb_output_devices;
this->m_nb_output_devices_isSet = true;
} }
qint32 qint32
@ -182,6 +197,7 @@ SWGAudioDevices::getOutputDeviceSelectedIndex() {
void void
SWGAudioDevices::setOutputDeviceSelectedIndex(qint32 output_device_selected_index) { SWGAudioDevices::setOutputDeviceSelectedIndex(qint32 output_device_selected_index) {
this->output_device_selected_index = output_device_selected_index; this->output_device_selected_index = output_device_selected_index;
this->m_output_device_selected_index_isSet = true;
} }
QList<SWGAudioDevice*>* QList<SWGAudioDevice*>*
@ -191,8 +207,23 @@ SWGAudioDevices::getOutputDevices() {
void void
SWGAudioDevices::setOutputDevices(QList<SWGAudioDevice*>* output_devices) { SWGAudioDevices::setOutputDevices(QList<SWGAudioDevice*>* output_devices) {
this->output_devices = output_devices; this->output_devices = output_devices;
this->m_output_devices_isSet = true;
} }
bool
SWGAudioDevices::isSet(){
bool isObjectUpdated = false;
do{
if(m_input_volume_isSet){ isObjectUpdated = true; break;}
if(m_nb_input_devices_isSet){ isObjectUpdated = true; break;}
if(m_input_device_selected_index_isSet){ isObjectUpdated = true; break;}
if(input_devices->size() > 0){ isObjectUpdated = true; break;}
if(m_nb_output_devices_isSet){ isObjectUpdated = true; break;}
if(m_output_device_selected_index_isSet){ isObjectUpdated = true; break;}
if(output_devices->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGAudioDevices: public SWGObject { class SWGAudioDevices: public SWGObject {
public: public:
SWGAudioDevices(); SWGAudioDevices();
SWGAudioDevices(QString* json); SWGAudioDevices(QString json);
virtual ~SWGAudioDevices(); ~SWGAudioDevices();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGAudioDevices* fromJson(QString &jsonString); SWGAudioDevices* fromJson(QString jsonString);
float getInputVolume(); float getInputVolume();
void setInputVolume(float input_volume); void setInputVolume(float input_volume);
@ -65,14 +64,30 @@ public:
void setOutputDevices(QList<SWGAudioDevice*>* output_devices); void setOutputDevices(QList<SWGAudioDevice*>* output_devices);
virtual bool isSet() override;
private: private:
float input_volume; float input_volume;
bool m_input_volume_isSet;
qint32 nb_input_devices; qint32 nb_input_devices;
bool m_nb_input_devices_isSet;
qint32 input_device_selected_index; qint32 input_device_selected_index;
bool m_input_device_selected_index_isSet;
QList<SWGAudioDevice*>* input_devices; QList<SWGAudioDevice*>* input_devices;
bool m_input_devices_isSet;
qint32 nb_output_devices; qint32 nb_output_devices;
bool m_nb_output_devices_isSet;
qint32 output_device_selected_index; qint32 output_device_selected_index;
bool m_output_device_selected_index_isSet;
QList<SWGAudioDevice*>* output_devices; QList<SWGAudioDevice*>* output_devices;
bool m_output_devices_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGAudioDevicesSelect::SWGAudioDevicesSelect(QString* json) { SWGAudioDevicesSelect::SWGAudioDevicesSelect(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGAudioDevicesSelect::SWGAudioDevicesSelect() { SWGAudioDevicesSelect::SWGAudioDevicesSelect() {
@ -38,8 +38,11 @@ SWGAudioDevicesSelect::~SWGAudioDevicesSelect() {
void void
SWGAudioDevicesSelect::init() { SWGAudioDevicesSelect::init() {
input_volume = 0.0f; input_volume = 0.0f;
m_input_volume_isSet = false;
input_index = 0; input_index = 0;
m_input_index_isSet = false;
output_index = 0; output_index = 0;
m_output_index_isSet = false;
} }
void void
@ -50,7 +53,7 @@ SWGAudioDevicesSelect::cleanup() {
} }
SWGAudioDevicesSelect* SWGAudioDevicesSelect*
SWGAudioDevicesSelect::fromJson(QString &json) { SWGAudioDevicesSelect::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -59,31 +62,36 @@ SWGAudioDevicesSelect::fromJson(QString &json) {
} }
void void
SWGAudioDevicesSelect::fromJsonObject(QJsonObject &pJson) { SWGAudioDevicesSelect::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", ""); ::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", "");
::SWGSDRangel::setValue(&input_index, pJson["inputIndex"], "qint32", ""); ::SWGSDRangel::setValue(&input_index, pJson["inputIndex"], "qint32", "");
::SWGSDRangel::setValue(&output_index, pJson["outputIndex"], "qint32", ""); ::SWGSDRangel::setValue(&output_index, pJson["outputIndex"], "qint32", "");
} }
QString QString
SWGAudioDevicesSelect::asJson () SWGAudioDevicesSelect::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGAudioDevicesSelect::asJsonObject() { SWGAudioDevicesSelect::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_input_volume_isSet){
obj->insert("inputVolume", QJsonValue(input_volume)); obj.insert("inputVolume", QJsonValue(input_volume));
}
obj->insert("inputIndex", QJsonValue(input_index)); if(m_input_index_isSet){
obj.insert("inputIndex", QJsonValue(input_index));
obj->insert("outputIndex", QJsonValue(output_index)); }
if(m_output_index_isSet){
obj.insert("outputIndex", QJsonValue(output_index));
}
return obj; return obj;
} }
@ -95,6 +103,7 @@ SWGAudioDevicesSelect::getInputVolume() {
void void
SWGAudioDevicesSelect::setInputVolume(float input_volume) { SWGAudioDevicesSelect::setInputVolume(float input_volume) {
this->input_volume = input_volume; this->input_volume = input_volume;
this->m_input_volume_isSet = true;
} }
qint32 qint32
@ -104,6 +113,7 @@ SWGAudioDevicesSelect::getInputIndex() {
void void
SWGAudioDevicesSelect::setInputIndex(qint32 input_index) { SWGAudioDevicesSelect::setInputIndex(qint32 input_index) {
this->input_index = input_index; this->input_index = input_index;
this->m_input_index_isSet = true;
} }
qint32 qint32
@ -113,8 +123,19 @@ SWGAudioDevicesSelect::getOutputIndex() {
void void
SWGAudioDevicesSelect::setOutputIndex(qint32 output_index) { SWGAudioDevicesSelect::setOutputIndex(qint32 output_index) {
this->output_index = output_index; this->output_index = output_index;
this->m_output_index_isSet = true;
} }
bool
SWGAudioDevicesSelect::isSet(){
bool isObjectUpdated = false;
do{
if(m_input_volume_isSet){ isObjectUpdated = true; break;}
if(m_input_index_isSet){ isObjectUpdated = true; break;}
if(m_output_index_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGAudioDevicesSelect: public SWGObject { class SWGAudioDevicesSelect: public SWGObject {
public: public:
SWGAudioDevicesSelect(); SWGAudioDevicesSelect();
SWGAudioDevicesSelect(QString* json); SWGAudioDevicesSelect(QString json);
virtual ~SWGAudioDevicesSelect(); ~SWGAudioDevicesSelect();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGAudioDevicesSelect* fromJson(QString &jsonString); SWGAudioDevicesSelect* fromJson(QString jsonString);
float getInputVolume(); float getInputVolume();
void setInputVolume(float input_volume); void setInputVolume(float input_volume);
@ -51,10 +50,18 @@ public:
void setOutputIndex(qint32 output_index); void setOutputIndex(qint32 output_index);
virtual bool isSet() override;
private: private:
float input_volume; float input_volume;
bool m_input_volume_isSet;
qint32 input_index; qint32 input_index;
bool m_input_index_isSet;
qint32 output_index; qint32 output_index;
bool m_output_index_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGCWKeyerSettings::SWGCWKeyerSettings(QString* json) { SWGCWKeyerSettings::SWGCWKeyerSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGCWKeyerSettings::SWGCWKeyerSettings() { SWGCWKeyerSettings::SWGCWKeyerSettings() {
@ -38,10 +38,15 @@ SWGCWKeyerSettings::~SWGCWKeyerSettings() {
void void
SWGCWKeyerSettings::init() { SWGCWKeyerSettings::init() {
sample_rate = 0; sample_rate = 0;
m_sample_rate_isSet = false;
wpm = 0; wpm = 0;
m_wpm_isSet = false;
mode = 0; mode = 0;
m_mode_isSet = false;
text = new QString(""); text = new QString("");
m_text_isSet = false;
loop = 0; loop = 0;
m_loop_isSet = false;
} }
void void
@ -49,7 +54,6 @@ SWGCWKeyerSettings::cleanup() {
if(text != nullptr) { if(text != nullptr) {
delete text; delete text;
} }
@ -57,7 +61,7 @@ SWGCWKeyerSettings::cleanup() {
} }
SWGCWKeyerSettings* SWGCWKeyerSettings*
SWGCWKeyerSettings::fromJson(QString &json) { SWGCWKeyerSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -66,37 +70,46 @@ SWGCWKeyerSettings::fromJson(QString &json) {
} }
void void
SWGCWKeyerSettings::fromJsonObject(QJsonObject &pJson) { SWGCWKeyerSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&wpm, pJson["wpm"], "qint32", ""); ::SWGSDRangel::setValue(&wpm, pJson["wpm"], "qint32", "");
::SWGSDRangel::setValue(&mode, pJson["mode"], "qint32", ""); ::SWGSDRangel::setValue(&mode, pJson["mode"], "qint32", "");
::SWGSDRangel::setValue(&text, pJson["text"], "QString", "QString"); ::SWGSDRangel::setValue(&text, pJson["text"], "QString", "QString");
::SWGSDRangel::setValue(&loop, pJson["loop"], "qint32", ""); ::SWGSDRangel::setValue(&loop, pJson["loop"], "qint32", "");
} }
QString QString
SWGCWKeyerSettings::asJson () SWGCWKeyerSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGCWKeyerSettings::asJsonObject() { SWGCWKeyerSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_sample_rate_isSet){
obj->insert("sampleRate", QJsonValue(sample_rate)); obj.insert("sampleRate", QJsonValue(sample_rate));
}
obj->insert("wpm", QJsonValue(wpm)); if(m_wpm_isSet){
obj.insert("wpm", QJsonValue(wpm));
obj->insert("mode", QJsonValue(mode)); }
if(m_mode_isSet){
obj.insert("mode", QJsonValue(mode));
}
if(text != nullptr && *text != QString("")){
toJsonValue(QString("text"), text, obj, QString("QString")); toJsonValue(QString("text"), text, obj, QString("QString"));
}
obj->insert("loop", QJsonValue(loop)); if(m_loop_isSet){
obj.insert("loop", QJsonValue(loop));
}
return obj; return obj;
} }
@ -108,6 +121,7 @@ SWGCWKeyerSettings::getSampleRate() {
void void
SWGCWKeyerSettings::setSampleRate(qint32 sample_rate) { SWGCWKeyerSettings::setSampleRate(qint32 sample_rate) {
this->sample_rate = sample_rate; this->sample_rate = sample_rate;
this->m_sample_rate_isSet = true;
} }
qint32 qint32
@ -117,6 +131,7 @@ SWGCWKeyerSettings::getWpm() {
void void
SWGCWKeyerSettings::setWpm(qint32 wpm) { SWGCWKeyerSettings::setWpm(qint32 wpm) {
this->wpm = wpm; this->wpm = wpm;
this->m_wpm_isSet = true;
} }
qint32 qint32
@ -126,6 +141,7 @@ SWGCWKeyerSettings::getMode() {
void void
SWGCWKeyerSettings::setMode(qint32 mode) { SWGCWKeyerSettings::setMode(qint32 mode) {
this->mode = mode; this->mode = mode;
this->m_mode_isSet = true;
} }
QString* QString*
@ -135,6 +151,7 @@ SWGCWKeyerSettings::getText() {
void void
SWGCWKeyerSettings::setText(QString* text) { SWGCWKeyerSettings::setText(QString* text) {
this->text = text; this->text = text;
this->m_text_isSet = true;
} }
qint32 qint32
@ -144,8 +161,21 @@ SWGCWKeyerSettings::getLoop() {
void void
SWGCWKeyerSettings::setLoop(qint32 loop) { SWGCWKeyerSettings::setLoop(qint32 loop) {
this->loop = loop; this->loop = loop;
this->m_loop_isSet = true;
} }
bool
SWGCWKeyerSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_wpm_isSet){ isObjectUpdated = true; break;}
if(m_mode_isSet){ isObjectUpdated = true; break;}
if(text != nullptr && *text != QString("")){ isObjectUpdated = true; break;}
if(m_loop_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGCWKeyerSettings: public SWGObject { class SWGCWKeyerSettings: public SWGObject {
public: public:
SWGCWKeyerSettings(); SWGCWKeyerSettings();
SWGCWKeyerSettings(QString* json); SWGCWKeyerSettings(QString json);
virtual ~SWGCWKeyerSettings(); ~SWGCWKeyerSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGCWKeyerSettings* fromJson(QString &jsonString); SWGCWKeyerSettings* fromJson(QString jsonString);
qint32 getSampleRate(); qint32 getSampleRate();
void setSampleRate(qint32 sample_rate); void setSampleRate(qint32 sample_rate);
@ -58,12 +57,24 @@ public:
void setLoop(qint32 loop); void setLoop(qint32 loop);
virtual bool isSet() override;
private: private:
qint32 sample_rate; qint32 sample_rate;
bool m_sample_rate_isSet;
qint32 wpm; qint32 wpm;
bool m_wpm_isSet;
qint32 mode; qint32 mode;
bool m_mode_isSet;
QString* text; QString* text;
bool m_text_isSet;
qint32 loop; qint32 loop;
bool m_loop_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGChannel::SWGChannel(QString* json) { SWGChannel::SWGChannel(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGChannel::SWGChannel() { SWGChannel::SWGChannel() {
@ -38,21 +38,24 @@ SWGChannel::~SWGChannel() {
void void
SWGChannel::init() { SWGChannel::init() {
index = 0; index = 0;
m_index_isSet = false;
id = new QString(""); id = new QString("");
m_id_isSet = false;
uid = 0L; uid = 0L;
m_uid_isSet = false;
title = new QString(""); title = new QString("");
m_title_isSet = false;
delta_frequency = 0; delta_frequency = 0;
m_delta_frequency_isSet = false;
} }
void void
SWGChannel::cleanup() { SWGChannel::cleanup() {
if(id != nullptr) { if(id != nullptr) {
delete id; delete id;
} }
if(title != nullptr) { if(title != nullptr) {
delete title; delete title;
} }
@ -60,7 +63,7 @@ SWGChannel::cleanup() {
} }
SWGChannel* SWGChannel*
SWGChannel::fromJson(QString &json) { SWGChannel::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -69,37 +72,46 @@ SWGChannel::fromJson(QString &json) {
} }
void void
SWGChannel::fromJsonObject(QJsonObject &pJson) { SWGChannel::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString"); ::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString");
::SWGSDRangel::setValue(&uid, pJson["uid"], "qint64", ""); ::SWGSDRangel::setValue(&uid, pJson["uid"], "qint64", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
::SWGSDRangel::setValue(&delta_frequency, pJson["deltaFrequency"], "qint32", ""); ::SWGSDRangel::setValue(&delta_frequency, pJson["deltaFrequency"], "qint32", "");
} }
QString QString
SWGChannel::asJson () SWGChannel::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGChannel::asJsonObject() { SWGChannel::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_index_isSet){
obj->insert("index", QJsonValue(index)); obj.insert("index", QJsonValue(index));
}
if(id != nullptr && *id != QString("")){
toJsonValue(QString("id"), id, obj, QString("QString")); toJsonValue(QString("id"), id, obj, QString("QString"));
}
obj->insert("uid", QJsonValue(uid)); if(m_uid_isSet){
obj.insert("uid", QJsonValue(uid));
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString"));
}
obj->insert("deltaFrequency", QJsonValue(delta_frequency)); if(m_delta_frequency_isSet){
obj.insert("deltaFrequency", QJsonValue(delta_frequency));
}
return obj; return obj;
} }
@ -111,6 +123,7 @@ SWGChannel::getIndex() {
void void
SWGChannel::setIndex(qint32 index) { SWGChannel::setIndex(qint32 index) {
this->index = index; this->index = index;
this->m_index_isSet = true;
} }
QString* QString*
@ -120,6 +133,7 @@ SWGChannel::getId() {
void void
SWGChannel::setId(QString* id) { SWGChannel::setId(QString* id) {
this->id = id; this->id = id;
this->m_id_isSet = true;
} }
qint64 qint64
@ -129,6 +143,7 @@ SWGChannel::getUid() {
void void
SWGChannel::setUid(qint64 uid) { SWGChannel::setUid(qint64 uid) {
this->uid = uid; this->uid = uid;
this->m_uid_isSet = true;
} }
QString* QString*
@ -138,6 +153,7 @@ SWGChannel::getTitle() {
void void
SWGChannel::setTitle(QString* title) { SWGChannel::setTitle(QString* title) {
this->title = title; this->title = title;
this->m_title_isSet = true;
} }
qint32 qint32
@ -147,8 +163,21 @@ SWGChannel::getDeltaFrequency() {
void void
SWGChannel::setDeltaFrequency(qint32 delta_frequency) { SWGChannel::setDeltaFrequency(qint32 delta_frequency) {
this->delta_frequency = delta_frequency; this->delta_frequency = delta_frequency;
this->m_delta_frequency_isSet = true;
} }
bool
SWGChannel::isSet(){
bool isObjectUpdated = false;
do{
if(m_index_isSet){ isObjectUpdated = true; break;}
if(id != nullptr && *id != QString("")){ isObjectUpdated = true; break;}
if(m_uid_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(m_delta_frequency_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGChannel: public SWGObject { class SWGChannel: public SWGObject {
public: public:
SWGChannel(); SWGChannel();
SWGChannel(QString* json); SWGChannel(QString json);
virtual ~SWGChannel(); ~SWGChannel();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGChannel* fromJson(QString &jsonString); SWGChannel* fromJson(QString jsonString);
qint32 getIndex(); qint32 getIndex();
void setIndex(qint32 index); void setIndex(qint32 index);
@ -58,12 +57,24 @@ public:
void setDeltaFrequency(qint32 delta_frequency); void setDeltaFrequency(qint32 delta_frequency);
virtual bool isSet() override;
private: private:
qint32 index; qint32 index;
bool m_index_isSet;
QString* id; QString* id;
bool m_id_isSet;
qint64 uid; qint64 uid;
bool m_uid_isSet;
QString* title; QString* title;
bool m_title_isSet;
qint32 delta_frequency; qint32 delta_frequency;
bool m_delta_frequency_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGChannelListItem::SWGChannelListItem(QString* json) { SWGChannelListItem::SWGChannelListItem(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGChannelListItem::SWGChannelListItem() { SWGChannelListItem::SWGChannelListItem() {
@ -38,29 +38,31 @@ SWGChannelListItem::~SWGChannelListItem() {
void void
SWGChannelListItem::init() { SWGChannelListItem::init() {
name = new QString(""); name = new QString("");
m_name_isSet = false;
id_uri = new QString(""); id_uri = new QString("");
m_id_uri_isSet = false;
id = new QString(""); id = new QString("");
m_id_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false;
version = new QString(""); version = new QString("");
m_version_isSet = false;
index = 0; index = 0;
m_index_isSet = false;
} }
void void
SWGChannelListItem::cleanup() { SWGChannelListItem::cleanup() {
if(name != nullptr) { if(name != nullptr) {
delete name; delete name;
} }
if(id_uri != nullptr) { if(id_uri != nullptr) {
delete id_uri; delete id_uri;
} }
if(id != nullptr) { if(id != nullptr) {
delete id; delete id;
} }
if(version != nullptr) { if(version != nullptr) {
delete version; delete version;
} }
@ -68,7 +70,7 @@ SWGChannelListItem::cleanup() {
} }
SWGChannelListItem* SWGChannelListItem*
SWGChannelListItem::fromJson(QString &json) { SWGChannelListItem::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -77,40 +79,51 @@ SWGChannelListItem::fromJson(QString &json) {
} }
void void
SWGChannelListItem::fromJsonObject(QJsonObject &pJson) { SWGChannelListItem::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString"); ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&id_uri, pJson["idURI"], "QString", "QString"); ::SWGSDRangel::setValue(&id_uri, pJson["idURI"], "QString", "QString");
::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString"); ::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString"); ::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString");
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
} }
QString QString
SWGChannelListItem::asJson () SWGChannelListItem::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGChannelListItem::asJsonObject() { SWGChannelListItem::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString"));
}
if(id_uri != nullptr && *id_uri != QString("")){
toJsonValue(QString("idURI"), id_uri, obj, QString("QString")); toJsonValue(QString("idURI"), id_uri, obj, QString("QString"));
}
if(id != nullptr && *id != QString("")){
toJsonValue(QString("id"), id, obj, QString("QString")); toJsonValue(QString("id"), id, obj, QString("QString"));
}
obj->insert("tx", QJsonValue(tx)); if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx));
}
if(version != nullptr && *version != QString("")){
toJsonValue(QString("version"), version, obj, QString("QString")); toJsonValue(QString("version"), version, obj, QString("QString"));
}
obj->insert("index", QJsonValue(index)); if(m_index_isSet){
obj.insert("index", QJsonValue(index));
}
return obj; return obj;
} }
@ -122,6 +135,7 @@ SWGChannelListItem::getName() {
void void
SWGChannelListItem::setName(QString* name) { SWGChannelListItem::setName(QString* name) {
this->name = name; this->name = name;
this->m_name_isSet = true;
} }
QString* QString*
@ -131,6 +145,7 @@ SWGChannelListItem::getIdUri() {
void void
SWGChannelListItem::setIdUri(QString* id_uri) { SWGChannelListItem::setIdUri(QString* id_uri) {
this->id_uri = id_uri; this->id_uri = id_uri;
this->m_id_uri_isSet = true;
} }
QString* QString*
@ -140,6 +155,7 @@ SWGChannelListItem::getId() {
void void
SWGChannelListItem::setId(QString* id) { SWGChannelListItem::setId(QString* id) {
this->id = id; this->id = id;
this->m_id_isSet = true;
} }
qint32 qint32
@ -149,6 +165,7 @@ SWGChannelListItem::getTx() {
void void
SWGChannelListItem::setTx(qint32 tx) { SWGChannelListItem::setTx(qint32 tx) {
this->tx = tx; this->tx = tx;
this->m_tx_isSet = true;
} }
QString* QString*
@ -158,6 +175,7 @@ SWGChannelListItem::getVersion() {
void void
SWGChannelListItem::setVersion(QString* version) { SWGChannelListItem::setVersion(QString* version) {
this->version = version; this->version = version;
this->m_version_isSet = true;
} }
qint32 qint32
@ -167,8 +185,22 @@ SWGChannelListItem::getIndex() {
void void
SWGChannelListItem::setIndex(qint32 index) { SWGChannelListItem::setIndex(qint32 index) {
this->index = index; this->index = index;
this->m_index_isSet = true;
} }
bool
SWGChannelListItem::isSet(){
bool isObjectUpdated = false;
do{
if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
if(id_uri != nullptr && *id_uri != QString("")){ isObjectUpdated = true; break;}
if(id != nullptr && *id != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(version != nullptr && *version != QString("")){ isObjectUpdated = true; break;}
if(m_index_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGChannelListItem: public SWGObject { class SWGChannelListItem: public SWGObject {
public: public:
SWGChannelListItem(); SWGChannelListItem();
SWGChannelListItem(QString* json); SWGChannelListItem(QString json);
virtual ~SWGChannelListItem(); ~SWGChannelListItem();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGChannelListItem* fromJson(QString &jsonString); SWGChannelListItem* fromJson(QString jsonString);
QString* getName(); QString* getName();
void setName(QString* name); void setName(QString* name);
@ -61,13 +60,27 @@ public:
void setIndex(qint32 index); void setIndex(qint32 index);
virtual bool isSet() override;
private: private:
QString* name; QString* name;
bool m_name_isSet;
QString* id_uri; QString* id_uri;
bool m_id_uri_isSet;
QString* id; QString* id;
bool m_id_isSet;
qint32 tx; qint32 tx;
bool m_tx_isSet;
QString* version; QString* version;
bool m_version_isSet;
qint32 index; qint32 index;
bool m_index_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGChannelSettings::SWGChannelSettings(QString* json) { SWGChannelSettings::SWGChannelSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGChannelSettings::SWGChannelSettings() { SWGChannelSettings::SWGChannelSettings() {
@ -38,30 +38,31 @@ SWGChannelSettings::~SWGChannelSettings() {
void void
SWGChannelSettings::init() { SWGChannelSettings::init() {
channel_type = new QString(""); channel_type = new QString("");
m_channel_type_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false;
nfm_demod_settings = new SWGNFMDemodSettings(); nfm_demod_settings = new SWGNFMDemodSettings();
m_nfm_demod_settings_isSet = false;
nfm_mod_settings = new SWGNFMModSettings(); nfm_mod_settings = new SWGNFMModSettings();
m_nfm_mod_settings_isSet = false;
} }
void void
SWGChannelSettings::cleanup() { SWGChannelSettings::cleanup() {
if(channel_type != nullptr) { if(channel_type != nullptr) {
delete channel_type; delete channel_type;
} }
if(nfm_demod_settings != nullptr) { if(nfm_demod_settings != nullptr) {
delete nfm_demod_settings; delete nfm_demod_settings;
} }
if(nfm_mod_settings != nullptr) { if(nfm_mod_settings != nullptr) {
delete nfm_mod_settings; delete nfm_mod_settings;
} }
} }
SWGChannelSettings* SWGChannelSettings*
SWGChannelSettings::fromJson(QString &json) { SWGChannelSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -70,34 +71,41 @@ SWGChannelSettings::fromJson(QString &json) {
} }
void void
SWGChannelSettings::fromJsonObject(QJsonObject &pJson) { SWGChannelSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString"); ::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&nfm_demod_settings, pJson["NFMDemodSettings"], "SWGNFMDemodSettings", "SWGNFMDemodSettings"); ::SWGSDRangel::setValue(&nfm_demod_settings, pJson["NFMDemodSettings"], "SWGNFMDemodSettings", "SWGNFMDemodSettings");
::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings"); ::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings");
} }
QString QString
SWGChannelSettings::asJson () SWGChannelSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGChannelSettings::asJsonObject() { SWGChannelSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(channel_type != nullptr && *channel_type != QString("")){
toJsonValue(QString("channelType"), channel_type, obj, QString("QString")); toJsonValue(QString("channelType"), channel_type, obj, QString("QString"));
}
obj->insert("tx", QJsonValue(tx)); if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx));
}
if((nfm_demod_settings != nullptr) && (nfm_demod_settings->isSet())){
toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings")); toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings"));
}
if((nfm_mod_settings != nullptr) && (nfm_mod_settings->isSet())){
toJsonValue(QString("NFMModSettings"), nfm_mod_settings, obj, QString("SWGNFMModSettings")); toJsonValue(QString("NFMModSettings"), nfm_mod_settings, obj, QString("SWGNFMModSettings"));
}
return obj; return obj;
} }
@ -109,6 +117,7 @@ SWGChannelSettings::getChannelType() {
void void
SWGChannelSettings::setChannelType(QString* channel_type) { SWGChannelSettings::setChannelType(QString* channel_type) {
this->channel_type = channel_type; this->channel_type = channel_type;
this->m_channel_type_isSet = true;
} }
qint32 qint32
@ -118,6 +127,7 @@ SWGChannelSettings::getTx() {
void void
SWGChannelSettings::setTx(qint32 tx) { SWGChannelSettings::setTx(qint32 tx) {
this->tx = tx; this->tx = tx;
this->m_tx_isSet = true;
} }
SWGNFMDemodSettings* SWGNFMDemodSettings*
@ -127,6 +137,7 @@ SWGChannelSettings::getNfmDemodSettings() {
void void
SWGChannelSettings::setNfmDemodSettings(SWGNFMDemodSettings* nfm_demod_settings) { SWGChannelSettings::setNfmDemodSettings(SWGNFMDemodSettings* nfm_demod_settings) {
this->nfm_demod_settings = nfm_demod_settings; this->nfm_demod_settings = nfm_demod_settings;
this->m_nfm_demod_settings_isSet = true;
} }
SWGNFMModSettings* SWGNFMModSettings*
@ -136,8 +147,20 @@ SWGChannelSettings::getNfmModSettings() {
void void
SWGChannelSettings::setNfmModSettings(SWGNFMModSettings* nfm_mod_settings) { SWGChannelSettings::setNfmModSettings(SWGNFMModSettings* nfm_mod_settings) {
this->nfm_mod_settings = nfm_mod_settings; this->nfm_mod_settings = nfm_mod_settings;
this->m_nfm_mod_settings_isSet = true;
} }
bool
SWGChannelSettings::isSet(){
bool isObjectUpdated = false;
do{
if(channel_type != nullptr && *channel_type != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(nfm_demod_settings != nullptr && nfm_demod_settings->isSet()){ isObjectUpdated = true; break;}
if(nfm_mod_settings != nullptr && nfm_mod_settings->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -28,21 +28,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGChannelSettings: public SWGObject { class SWGChannelSettings: public SWGObject {
public: public:
SWGChannelSettings(); SWGChannelSettings();
SWGChannelSettings(QString* json); SWGChannelSettings(QString json);
virtual ~SWGChannelSettings(); ~SWGChannelSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGChannelSettings* fromJson(QString &jsonString); SWGChannelSettings* fromJson(QString jsonString);
QString* getChannelType(); QString* getChannelType();
void setChannelType(QString* channel_type); void setChannelType(QString* channel_type);
@ -57,11 +56,21 @@ public:
void setNfmModSettings(SWGNFMModSettings* nfm_mod_settings); void setNfmModSettings(SWGNFMModSettings* nfm_mod_settings);
virtual bool isSet() override;
private: private:
QString* channel_type; QString* channel_type;
bool m_channel_type_isSet;
qint32 tx; qint32 tx;
bool m_tx_isSet;
SWGNFMDemodSettings* nfm_demod_settings; SWGNFMDemodSettings* nfm_demod_settings;
bool m_nfm_demod_settings_isSet;
SWGNFMModSettings* nfm_mod_settings; SWGNFMModSettings* nfm_mod_settings;
bool m_nfm_mod_settings_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDVSeralDevices::SWGDVSeralDevices(QString* json) { SWGDVSeralDevices::SWGDVSeralDevices(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDVSeralDevices::SWGDVSeralDevices() { SWGDVSeralDevices::SWGDVSeralDevices() {
@ -38,16 +38,17 @@ SWGDVSeralDevices::~SWGDVSeralDevices() {
void void
SWGDVSeralDevices::init() { SWGDVSeralDevices::init() {
nb_devices = 0; nb_devices = 0;
m_nb_devices_isSet = false;
dv_serial_devices = new QList<SWGDVSerialDevice*>(); dv_serial_devices = new QList<SWGDVSerialDevice*>();
m_dv_serial_devices_isSet = false;
} }
void void
SWGDVSeralDevices::cleanup() { SWGDVSeralDevices::cleanup() {
if(dv_serial_devices != nullptr) { if(dv_serial_devices != nullptr) {
QList<SWGDVSerialDevice*>* arr = dv_serial_devices; auto arr = dv_serial_devices;
foreach(SWGDVSerialDevice* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete dv_serial_devices; delete dv_serial_devices;
@ -55,7 +56,7 @@ SWGDVSeralDevices::cleanup() {
} }
SWGDVSeralDevices* SWGDVSeralDevices*
SWGDVSeralDevices::fromJson(QString &json) { SWGDVSeralDevices::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -64,32 +65,31 @@ SWGDVSeralDevices::fromJson(QString &json) {
} }
void void
SWGDVSeralDevices::fromJsonObject(QJsonObject &pJson) { SWGDVSeralDevices::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&nb_devices, pJson["nbDevices"], "qint32", ""); ::SWGSDRangel::setValue(&nb_devices, pJson["nbDevices"], "qint32", "");
::SWGSDRangel::setValue(&dv_serial_devices, pJson["dvSerialDevices"], "QList", "SWGDVSerialDevice");
::SWGSDRangel::setValue(&dv_serial_devices, pJson["dvSerialDevices"], "QList", "SWGDVSerialDevice");
} }
QString QString
SWGDVSeralDevices::asJson () SWGDVSeralDevices::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDVSeralDevices::asJsonObject() { SWGDVSeralDevices::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_nb_devices_isSet){
obj->insert("nbDevices", QJsonValue(nb_devices)); obj.insert("nbDevices", QJsonValue(nb_devices));
}
QJsonArray dv_serial_devicesJsonArray; if(dv_serial_devices->size() > 0){
toJsonArray((QList<void*>*)dv_serial_devices, &dv_serial_devicesJsonArray, "dv_serial_devices", "SWGDVSerialDevice"); toJsonArray((QList<void*>*)dv_serial_devices, obj, "dvSerialDevices", "SWGDVSerialDevice");
obj->insert("dvSerialDevices", dv_serial_devicesJsonArray); }
return obj; return obj;
} }
@ -101,6 +101,7 @@ SWGDVSeralDevices::getNbDevices() {
void void
SWGDVSeralDevices::setNbDevices(qint32 nb_devices) { SWGDVSeralDevices::setNbDevices(qint32 nb_devices) {
this->nb_devices = nb_devices; this->nb_devices = nb_devices;
this->m_nb_devices_isSet = true;
} }
QList<SWGDVSerialDevice*>* QList<SWGDVSerialDevice*>*
@ -110,8 +111,18 @@ SWGDVSeralDevices::getDvSerialDevices() {
void void
SWGDVSeralDevices::setDvSerialDevices(QList<SWGDVSerialDevice*>* dv_serial_devices) { SWGDVSeralDevices::setDvSerialDevices(QList<SWGDVSerialDevice*>* dv_serial_devices) {
this->dv_serial_devices = dv_serial_devices; this->dv_serial_devices = dv_serial_devices;
this->m_dv_serial_devices_isSet = true;
} }
bool
SWGDVSeralDevices::isSet(){
bool isObjectUpdated = false;
do{
if(m_nb_devices_isSet){ isObjectUpdated = true; break;}
if(dv_serial_devices->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDVSeralDevices: public SWGObject { class SWGDVSeralDevices: public SWGObject {
public: public:
SWGDVSeralDevices(); SWGDVSeralDevices();
SWGDVSeralDevices(QString* json); SWGDVSeralDevices(QString json);
virtual ~SWGDVSeralDevices(); ~SWGDVSeralDevices();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDVSeralDevices* fromJson(QString &jsonString); SWGDVSeralDevices* fromJson(QString jsonString);
qint32 getNbDevices(); qint32 getNbDevices();
void setNbDevices(qint32 nb_devices); void setNbDevices(qint32 nb_devices);
@ -50,9 +49,15 @@ public:
void setDvSerialDevices(QList<SWGDVSerialDevice*>* dv_serial_devices); void setDvSerialDevices(QList<SWGDVSerialDevice*>* dv_serial_devices);
virtual bool isSet() override;
private: private:
qint32 nb_devices; qint32 nb_devices;
bool m_nb_devices_isSet;
QList<SWGDVSerialDevice*>* dv_serial_devices; QList<SWGDVSerialDevice*>* dv_serial_devices;
bool m_dv_serial_devices_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDVSerialDevice::SWGDVSerialDevice(QString* json) { SWGDVSerialDevice::SWGDVSerialDevice(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDVSerialDevice::SWGDVSerialDevice() { SWGDVSerialDevice::SWGDVSerialDevice() {
@ -38,18 +38,18 @@ SWGDVSerialDevice::~SWGDVSerialDevice() {
void void
SWGDVSerialDevice::init() { SWGDVSerialDevice::init() {
device_name = new QString(""); device_name = new QString("");
m_device_name_isSet = false;
} }
void void
SWGDVSerialDevice::cleanup() { SWGDVSerialDevice::cleanup() {
if(device_name != nullptr) { if(device_name != nullptr) {
delete device_name; delete device_name;
} }
} }
SWGDVSerialDevice* SWGDVSerialDevice*
SWGDVSerialDevice::fromJson(QString &json) { SWGDVSerialDevice::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,25 +58,26 @@ SWGDVSerialDevice::fromJson(QString &json) {
} }
void void
SWGDVSerialDevice::fromJsonObject(QJsonObject &pJson) { SWGDVSerialDevice::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&device_name, pJson["deviceName"], "QString", "QString"); ::SWGSDRangel::setValue(&device_name, pJson["deviceName"], "QString", "QString");
} }
QString QString
SWGDVSerialDevice::asJson () SWGDVSerialDevice::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDVSerialDevice::asJsonObject() { SWGDVSerialDevice::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(device_name != nullptr && *device_name != QString("")){
toJsonValue(QString("deviceName"), device_name, obj, QString("QString")); toJsonValue(QString("deviceName"), device_name, obj, QString("QString"));
}
return obj; return obj;
} }
@ -88,8 +89,17 @@ SWGDVSerialDevice::getDeviceName() {
void void
SWGDVSerialDevice::setDeviceName(QString* device_name) { SWGDVSerialDevice::setDeviceName(QString* device_name) {
this->device_name = device_name; this->device_name = device_name;
this->m_device_name_isSet = true;
} }
bool
SWGDVSerialDevice::isSet(){
bool isObjectUpdated = false;
do{
if(device_name != nullptr && *device_name != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,28 +26,31 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDVSerialDevice: public SWGObject { class SWGDVSerialDevice: public SWGObject {
public: public:
SWGDVSerialDevice(); SWGDVSerialDevice();
SWGDVSerialDevice(QString* json); SWGDVSerialDevice(QString json);
virtual ~SWGDVSerialDevice(); ~SWGDVSerialDevice();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDVSerialDevice* fromJson(QString &jsonString); SWGDVSerialDevice* fromJson(QString jsonString);
QString* getDeviceName(); QString* getDeviceName();
void setDeviceName(QString* device_name); void setDeviceName(QString* device_name);
virtual bool isSet() override;
private: private:
QString* device_name; QString* device_name;
bool m_device_name_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceListItem::SWGDeviceListItem(QString* json) { SWGDeviceListItem::SWGDeviceListItem(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDeviceListItem::SWGDeviceListItem() { SWGDeviceListItem::SWGDeviceListItem() {
@ -38,27 +38,33 @@ SWGDeviceListItem::~SWGDeviceListItem() {
void void
SWGDeviceListItem::init() { SWGDeviceListItem::init() {
displayed_name = new QString(""); displayed_name = new QString("");
m_displayed_name_isSet = false;
hw_type = new QString(""); hw_type = new QString("");
m_hw_type_isSet = false;
serial = new QString(""); serial = new QString("");
m_serial_isSet = false;
sequence = 0; sequence = 0;
m_sequence_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false;
nb_streams = 0; nb_streams = 0;
m_nb_streams_isSet = false;
stream_index = 0; stream_index = 0;
m_stream_index_isSet = false;
device_set_index = 0; device_set_index = 0;
m_device_set_index_isSet = false;
index = 0; index = 0;
m_index_isSet = false;
} }
void void
SWGDeviceListItem::cleanup() { SWGDeviceListItem::cleanup() {
if(displayed_name != nullptr) { if(displayed_name != nullptr) {
delete displayed_name; delete displayed_name;
} }
if(hw_type != nullptr) { if(hw_type != nullptr) {
delete hw_type; delete hw_type;
} }
if(serial != nullptr) { if(serial != nullptr) {
delete serial; delete serial;
} }
@ -71,7 +77,7 @@ SWGDeviceListItem::cleanup() {
} }
SWGDeviceListItem* SWGDeviceListItem*
SWGDeviceListItem::fromJson(QString &json) { SWGDeviceListItem::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -80,49 +86,66 @@ SWGDeviceListItem::fromJson(QString &json) {
} }
void void
SWGDeviceListItem::fromJsonObject(QJsonObject &pJson) { SWGDeviceListItem::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&displayed_name, pJson["displayedName"], "QString", "QString"); ::SWGSDRangel::setValue(&displayed_name, pJson["displayedName"], "QString", "QString");
::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString"); ::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString");
::SWGSDRangel::setValue(&serial, pJson["serial"], "QString", "QString"); ::SWGSDRangel::setValue(&serial, pJson["serial"], "QString", "QString");
::SWGSDRangel::setValue(&sequence, pJson["sequence"], "qint32", ""); ::SWGSDRangel::setValue(&sequence, pJson["sequence"], "qint32", "");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&nb_streams, pJson["nbStreams"], "qint32", ""); ::SWGSDRangel::setValue(&nb_streams, pJson["nbStreams"], "qint32", "");
::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", ""); ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", "");
::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", ""); ::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", "");
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
} }
QString QString
SWGDeviceListItem::asJson () SWGDeviceListItem::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDeviceListItem::asJsonObject() { SWGDeviceListItem::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(displayed_name != nullptr && *displayed_name != QString("")){
toJsonValue(QString("displayedName"), displayed_name, obj, QString("QString")); toJsonValue(QString("displayedName"), displayed_name, obj, QString("QString"));
}
if(hw_type != nullptr && *hw_type != QString("")){
toJsonValue(QString("hwType"), hw_type, obj, QString("QString")); toJsonValue(QString("hwType"), hw_type, obj, QString("QString"));
}
if(serial != nullptr && *serial != QString("")){
toJsonValue(QString("serial"), serial, obj, QString("QString")); toJsonValue(QString("serial"), serial, obj, QString("QString"));
}
obj->insert("sequence", QJsonValue(sequence)); if(m_sequence_isSet){
obj.insert("sequence", QJsonValue(sequence));
obj->insert("tx", QJsonValue(tx)); }
if(m_tx_isSet){
obj->insert("nbStreams", QJsonValue(nb_streams)); obj.insert("tx", QJsonValue(tx));
}
obj->insert("streamIndex", QJsonValue(stream_index)); if(m_nb_streams_isSet){
obj.insert("nbStreams", QJsonValue(nb_streams));
obj->insert("deviceSetIndex", QJsonValue(device_set_index)); }
if(m_stream_index_isSet){
obj->insert("index", QJsonValue(index)); obj.insert("streamIndex", QJsonValue(stream_index));
}
if(m_device_set_index_isSet){
obj.insert("deviceSetIndex", QJsonValue(device_set_index));
}
if(m_index_isSet){
obj.insert("index", QJsonValue(index));
}
return obj; return obj;
} }
@ -134,6 +157,7 @@ SWGDeviceListItem::getDisplayedName() {
void void
SWGDeviceListItem::setDisplayedName(QString* displayed_name) { SWGDeviceListItem::setDisplayedName(QString* displayed_name) {
this->displayed_name = displayed_name; this->displayed_name = displayed_name;
this->m_displayed_name_isSet = true;
} }
QString* QString*
@ -143,6 +167,7 @@ SWGDeviceListItem::getHwType() {
void void
SWGDeviceListItem::setHwType(QString* hw_type) { SWGDeviceListItem::setHwType(QString* hw_type) {
this->hw_type = hw_type; this->hw_type = hw_type;
this->m_hw_type_isSet = true;
} }
QString* QString*
@ -152,6 +177,7 @@ SWGDeviceListItem::getSerial() {
void void
SWGDeviceListItem::setSerial(QString* serial) { SWGDeviceListItem::setSerial(QString* serial) {
this->serial = serial; this->serial = serial;
this->m_serial_isSet = true;
} }
qint32 qint32
@ -161,6 +187,7 @@ SWGDeviceListItem::getSequence() {
void void
SWGDeviceListItem::setSequence(qint32 sequence) { SWGDeviceListItem::setSequence(qint32 sequence) {
this->sequence = sequence; this->sequence = sequence;
this->m_sequence_isSet = true;
} }
qint32 qint32
@ -170,6 +197,7 @@ SWGDeviceListItem::getTx() {
void void
SWGDeviceListItem::setTx(qint32 tx) { SWGDeviceListItem::setTx(qint32 tx) {
this->tx = tx; this->tx = tx;
this->m_tx_isSet = true;
} }
qint32 qint32
@ -179,6 +207,7 @@ SWGDeviceListItem::getNbStreams() {
void void
SWGDeviceListItem::setNbStreams(qint32 nb_streams) { SWGDeviceListItem::setNbStreams(qint32 nb_streams) {
this->nb_streams = nb_streams; this->nb_streams = nb_streams;
this->m_nb_streams_isSet = true;
} }
qint32 qint32
@ -188,6 +217,7 @@ SWGDeviceListItem::getStreamIndex() {
void void
SWGDeviceListItem::setStreamIndex(qint32 stream_index) { SWGDeviceListItem::setStreamIndex(qint32 stream_index) {
this->stream_index = stream_index; this->stream_index = stream_index;
this->m_stream_index_isSet = true;
} }
qint32 qint32
@ -197,6 +227,7 @@ SWGDeviceListItem::getDeviceSetIndex() {
void void
SWGDeviceListItem::setDeviceSetIndex(qint32 device_set_index) { SWGDeviceListItem::setDeviceSetIndex(qint32 device_set_index) {
this->device_set_index = device_set_index; this->device_set_index = device_set_index;
this->m_device_set_index_isSet = true;
} }
qint32 qint32
@ -206,8 +237,25 @@ SWGDeviceListItem::getIndex() {
void void
SWGDeviceListItem::setIndex(qint32 index) { SWGDeviceListItem::setIndex(qint32 index) {
this->index = index; this->index = index;
this->m_index_isSet = true;
} }
bool
SWGDeviceListItem::isSet(){
bool isObjectUpdated = false;
do{
if(displayed_name != nullptr && *displayed_name != QString("")){ isObjectUpdated = true; break;}
if(hw_type != nullptr && *hw_type != QString("")){ isObjectUpdated = true; break;}
if(serial != nullptr && *serial != QString("")){ isObjectUpdated = true; break;}
if(m_sequence_isSet){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(m_nb_streams_isSet){ isObjectUpdated = true; break;}
if(m_stream_index_isSet){ isObjectUpdated = true; break;}
if(m_device_set_index_isSet){ isObjectUpdated = true; break;}
if(m_index_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDeviceListItem: public SWGObject { class SWGDeviceListItem: public SWGObject {
public: public:
SWGDeviceListItem(); SWGDeviceListItem();
SWGDeviceListItem(QString* json); SWGDeviceListItem(QString json);
virtual ~SWGDeviceListItem(); ~SWGDeviceListItem();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDeviceListItem* fromJson(QString &jsonString); SWGDeviceListItem* fromJson(QString jsonString);
QString* getDisplayedName(); QString* getDisplayedName();
void setDisplayedName(QString* displayed_name); void setDisplayedName(QString* displayed_name);
@ -70,16 +69,36 @@ public:
void setIndex(qint32 index); void setIndex(qint32 index);
virtual bool isSet() override;
private: private:
QString* displayed_name; QString* displayed_name;
bool m_displayed_name_isSet;
QString* hw_type; QString* hw_type;
bool m_hw_type_isSet;
QString* serial; QString* serial;
bool m_serial_isSet;
qint32 sequence; qint32 sequence;
bool m_sequence_isSet;
qint32 tx; qint32 tx;
bool m_tx_isSet;
qint32 nb_streams; qint32 nb_streams;
bool m_nb_streams_isSet;
qint32 stream_index; qint32 stream_index;
bool m_stream_index_isSet;
qint32 device_set_index; qint32 device_set_index;
bool m_device_set_index_isSet;
qint32 index; qint32 index;
bool m_index_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceSet::SWGDeviceSet(QString* json) { SWGDeviceSet::SWGDeviceSet(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDeviceSet::SWGDeviceSet() { SWGDeviceSet::SWGDeviceSet() {
@ -38,21 +38,22 @@ SWGDeviceSet::~SWGDeviceSet() {
void void
SWGDeviceSet::init() { SWGDeviceSet::init() {
sampling_device = new SWGSamplingDevice(); sampling_device = new SWGSamplingDevice();
m_sampling_device_isSet = false;
channelcount = 0; channelcount = 0;
m_channelcount_isSet = false;
channels = new QList<SWGChannel*>(); channels = new QList<SWGChannel*>();
m_channels_isSet = false;
} }
void void
SWGDeviceSet::cleanup() { SWGDeviceSet::cleanup() {
if(sampling_device != nullptr) { if(sampling_device != nullptr) {
delete sampling_device; delete sampling_device;
} }
if(channels != nullptr) { if(channels != nullptr) {
QList<SWGChannel*>* arr = channels; auto arr = channels;
foreach(SWGChannel* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete channels; delete channels;
@ -60,7 +61,7 @@ SWGDeviceSet::cleanup() {
} }
SWGDeviceSet* SWGDeviceSet*
SWGDeviceSet::fromJson(QString &json) { SWGDeviceSet::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -69,35 +70,36 @@ SWGDeviceSet::fromJson(QString &json) {
} }
void void
SWGDeviceSet::fromJsonObject(QJsonObject &pJson) { SWGDeviceSet::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&sampling_device, pJson["samplingDevice"], "SWGSamplingDevice", "SWGSamplingDevice"); ::SWGSDRangel::setValue(&sampling_device, pJson["samplingDevice"], "SWGSamplingDevice", "SWGSamplingDevice");
::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", ""); ::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannel");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannel");
} }
QString QString
SWGDeviceSet::asJson () SWGDeviceSet::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDeviceSet::asJsonObject() { SWGDeviceSet::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if((sampling_device != nullptr) && (sampling_device->isSet())){
toJsonValue(QString("samplingDevice"), sampling_device, obj, QString("SWGSamplingDevice")); toJsonValue(QString("samplingDevice"), sampling_device, obj, QString("SWGSamplingDevice"));
}
obj->insert("channelcount", QJsonValue(channelcount)); if(m_channelcount_isSet){
obj.insert("channelcount", QJsonValue(channelcount));
QJsonArray channelsJsonArray; }
toJsonArray((QList<void*>*)channels, &channelsJsonArray, "channels", "SWGChannel"); if(channels->size() > 0){
obj->insert("channels", channelsJsonArray); toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannel");
}
return obj; return obj;
} }
@ -109,6 +111,7 @@ SWGDeviceSet::getSamplingDevice() {
void void
SWGDeviceSet::setSamplingDevice(SWGSamplingDevice* sampling_device) { SWGDeviceSet::setSamplingDevice(SWGSamplingDevice* sampling_device) {
this->sampling_device = sampling_device; this->sampling_device = sampling_device;
this->m_sampling_device_isSet = true;
} }
qint32 qint32
@ -118,6 +121,7 @@ SWGDeviceSet::getChannelcount() {
void void
SWGDeviceSet::setChannelcount(qint32 channelcount) { SWGDeviceSet::setChannelcount(qint32 channelcount) {
this->channelcount = channelcount; this->channelcount = channelcount;
this->m_channelcount_isSet = true;
} }
QList<SWGChannel*>* QList<SWGChannel*>*
@ -127,8 +131,19 @@ SWGDeviceSet::getChannels() {
void void
SWGDeviceSet::setChannels(QList<SWGChannel*>* channels) { SWGDeviceSet::setChannels(QList<SWGChannel*>* channels) {
this->channels = channels; this->channels = channels;
this->m_channels_isSet = true;
} }
bool
SWGDeviceSet::isSet(){
bool isObjectUpdated = false;
do{
if(sampling_device != nullptr && sampling_device->isSet()){ isObjectUpdated = true; break;}
if(m_channelcount_isSet){ isObjectUpdated = true; break;}
if(channels->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -28,21 +28,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDeviceSet: public SWGObject { class SWGDeviceSet: public SWGObject {
public: public:
SWGDeviceSet(); SWGDeviceSet();
SWGDeviceSet(QString* json); SWGDeviceSet(QString json);
virtual ~SWGDeviceSet(); ~SWGDeviceSet();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDeviceSet* fromJson(QString &jsonString); SWGDeviceSet* fromJson(QString jsonString);
SWGSamplingDevice* getSamplingDevice(); SWGSamplingDevice* getSamplingDevice();
void setSamplingDevice(SWGSamplingDevice* sampling_device); void setSamplingDevice(SWGSamplingDevice* sampling_device);
@ -54,10 +53,18 @@ public:
void setChannels(QList<SWGChannel*>* channels); void setChannels(QList<SWGChannel*>* channels);
virtual bool isSet() override;
private: private:
SWGSamplingDevice* sampling_device; SWGSamplingDevice* sampling_device;
bool m_sampling_device_isSet;
qint32 channelcount; qint32 channelcount;
bool m_channelcount_isSet;
QList<SWGChannel*>* channels; QList<SWGChannel*>* channels;
bool m_channels_isSet;
}; };
} }

View File

@ -39,8 +39,8 @@ SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_
fullPath.replace(channel_indexPathParam, stringValue(channel_index)); fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE"); SWGHttpRequestInput input(fullPath, "DELETE");
@ -51,7 +51,7 @@ SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetChannelDeleteCallback); &SWGDeviceSetApi::devicesetChannelDeleteCallback);
@ -59,7 +59,7 @@ SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_
} }
void void
SWGDeviceSetApi::devicesetChannelDeleteCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetChannelDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -76,12 +76,16 @@ SWGDeviceSetApi::devicesetChannelDeleteCallback(HttpRequestWorker * worker) {
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings"))); SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelDeleteSignal(output); emit devicesetChannelDeleteSignal(output);
} else {
emit devicesetChannelDeleteSignalE(output, error_type, error_str); emit devicesetChannelDeleteSignalE(output, error_type, error_str);
emit devicesetChannelDeleteSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSettings body) { SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSettings& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel");
@ -89,8 +93,9 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "POST"); SWGHttpRequestInput input(fullPath, "POST");
QString output = body.asJson(); QString output = body.asJson();
@ -103,7 +108,7 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetChannelPostCallback); &SWGDeviceSetApi::devicesetChannelPostCallback);
@ -111,7 +116,7 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
} }
void void
SWGDeviceSetApi::devicesetChannelPostCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetChannelPostCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -128,8 +133,12 @@ SWGDeviceSetApi::devicesetChannelPostCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse"))); SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelPostSignal(output); emit devicesetChannelPostSignal(output);
} else {
emit devicesetChannelPostSignalE(output, error_type, error_str); emit devicesetChannelPostSignalE(output, error_type, error_str);
emit devicesetChannelPostSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -143,8 +152,8 @@ SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 cha
fullPath.replace(channel_indexPathParam, stringValue(channel_index)); fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -155,7 +164,7 @@ SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 cha
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetChannelSettingsGetCallback); &SWGDeviceSetApi::devicesetChannelSettingsGetCallback);
@ -163,7 +172,7 @@ SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 cha
} }
void void
SWGDeviceSetApi::devicesetChannelSettingsGetCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetChannelSettingsGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -180,12 +189,16 @@ SWGDeviceSetApi::devicesetChannelSettingsGetCallback(HttpRequestWorker * worker)
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings"))); SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelSettingsGetSignal(output); emit devicesetChannelSettingsGetSignal(output);
} else {
emit devicesetChannelSettingsGetSignalE(output, error_type, error_str); emit devicesetChannelSettingsGetSignalE(output, error_type, error_str);
emit devicesetChannelSettingsGetSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings body) { SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
@ -195,8 +208,9 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
fullPath.replace(channel_indexPathParam, stringValue(channel_index)); fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH"); SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson(); QString output = body.asJson();
@ -209,7 +223,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetChannelSettingsPatchCallback); &SWGDeviceSetApi::devicesetChannelSettingsPatchCallback);
@ -217,7 +231,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
} }
void void
SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -234,12 +248,16 @@ SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(HttpRequestWorker * worke
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings"))); SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelSettingsPatchSignal(output); emit devicesetChannelSettingsPatchSignal(output);
} else {
emit devicesetChannelSettingsPatchSignalE(output, error_type, error_str); emit devicesetChannelSettingsPatchSignalE(output, error_type, error_str);
emit devicesetChannelSettingsPatchSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings body) { SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
@ -249,8 +267,9 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
fullPath.replace(channel_indexPathParam, stringValue(channel_index)); fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -263,7 +282,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetChannelSettingsPutCallback); &SWGDeviceSetApi::devicesetChannelSettingsPutCallback);
@ -271,7 +290,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
} }
void void
SWGDeviceSetApi::devicesetChannelSettingsPutCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetChannelSettingsPutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -288,12 +307,16 @@ SWGDeviceSetApi::devicesetChannelSettingsPutCallback(HttpRequestWorker * worker)
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings"))); SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelSettingsPutSignal(output); emit devicesetChannelSettingsPutSignal(output);
} else {
emit devicesetChannelSettingsPutSignalE(output, error_type, error_str); emit devicesetChannelSettingsPutSignalE(output, error_type, error_str);
emit devicesetChannelSettingsPutSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body) { SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device");
@ -301,8 +324,9 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem b
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -315,7 +339,7 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem b
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDevicePutCallback); &SWGDeviceSetApi::devicesetDevicePutCallback);
@ -323,7 +347,7 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem b
} }
void void
SWGDeviceSetApi::devicesetDevicePutCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDevicePutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -340,8 +364,12 @@ SWGDeviceSetApi::devicesetDevicePutCallback(HttpRequestWorker * worker) {
SWGDeviceListItem* output = static_cast<SWGDeviceListItem*>(create(json, QString("SWGDeviceListItem"))); SWGDeviceListItem* output = static_cast<SWGDeviceListItem*>(create(json, QString("SWGDeviceListItem")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDevicePutSignal(output); emit devicesetDevicePutSignal(output);
} else {
emit devicesetDevicePutSignalE(output, error_type, error_str); emit devicesetDevicePutSignalE(output, error_type, error_str);
emit devicesetDevicePutSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -353,8 +381,8 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE"); SWGHttpRequestInput input(fullPath, "DELETE");
@ -365,7 +393,7 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDeviceRunDeleteCallback); &SWGDeviceSetApi::devicesetDeviceRunDeleteCallback);
@ -373,7 +401,7 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
} }
void void
SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -390,8 +418,12 @@ SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(HttpRequestWorker * worker) {
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState"))); SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceRunDeleteSignal(output); emit devicesetDeviceRunDeleteSignal(output);
} else {
emit devicesetDeviceRunDeleteSignalE(output, error_type, error_str); emit devicesetDeviceRunDeleteSignalE(output, error_type, error_str);
emit devicesetDeviceRunDeleteSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -403,8 +435,8 @@ SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -415,7 +447,7 @@ SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDeviceRunGetCallback); &SWGDeviceSetApi::devicesetDeviceRunGetCallback);
@ -423,7 +455,7 @@ SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
} }
void void
SWGDeviceSetApi::devicesetDeviceRunGetCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDeviceRunGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -440,8 +472,12 @@ SWGDeviceSetApi::devicesetDeviceRunGetCallback(HttpRequestWorker * worker) {
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState"))); SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceRunGetSignal(output); emit devicesetDeviceRunGetSignal(output);
} else {
emit devicesetDeviceRunGetSignalE(output, error_type, error_str); emit devicesetDeviceRunGetSignalE(output, error_type, error_str);
emit devicesetDeviceRunGetSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -453,8 +489,8 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "POST"); SWGHttpRequestInput input(fullPath, "POST");
@ -465,7 +501,7 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDeviceRunPostCallback); &SWGDeviceSetApi::devicesetDeviceRunPostCallback);
@ -473,7 +509,7 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
} }
void void
SWGDeviceSetApi::devicesetDeviceRunPostCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDeviceRunPostCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -490,8 +526,12 @@ SWGDeviceSetApi::devicesetDeviceRunPostCallback(HttpRequestWorker * worker) {
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState"))); SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceRunPostSignal(output); emit devicesetDeviceRunPostSignal(output);
} else {
emit devicesetDeviceRunPostSignalE(output, error_type, error_str); emit devicesetDeviceRunPostSignalE(output, error_type, error_str);
emit devicesetDeviceRunPostSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -503,8 +543,8 @@ SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -515,7 +555,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDeviceSettingsGetCallback); &SWGDeviceSetApi::devicesetDeviceSettingsGetCallback);
@ -523,7 +563,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
} }
void void
SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -540,12 +580,16 @@ SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(HttpRequestWorker * worker)
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings"))); SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceSettingsGetSignal(output); emit devicesetDeviceSettingsGetSignal(output);
} else {
emit devicesetDeviceSettingsGetSignalE(output, error_type, error_str); emit devicesetDeviceSettingsGetSignalE(output, error_type, error_str);
emit devicesetDeviceSettingsGetSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings body) { SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
@ -553,8 +597,9 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH"); SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson(); QString output = body.asJson();
@ -567,7 +612,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback); &SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback);
@ -575,7 +620,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
} }
void void
SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -592,12 +637,16 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(HttpRequestWorker * worker
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings"))); SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceSettingsPatchSignal(output); emit devicesetDeviceSettingsPatchSignal(output);
} else {
emit devicesetDeviceSettingsPatchSignalE(output, error_type, error_str); emit devicesetDeviceSettingsPatchSignalE(output, error_type, error_str);
emit devicesetDeviceSettingsPatchSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings body) { SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
@ -605,8 +654,9 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -619,7 +669,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetDeviceSettingsPutCallback); &SWGDeviceSetApi::devicesetDeviceSettingsPutCallback);
@ -627,7 +677,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
} }
void void
SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -644,8 +694,12 @@ SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(HttpRequestWorker * worker)
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings"))); SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceSettingsPutSignal(output); emit devicesetDeviceSettingsPutSignal(output);
} else {
emit devicesetDeviceSettingsPutSignalE(output, error_type, error_str); emit devicesetDeviceSettingsPutSignalE(output, error_type, error_str);
emit devicesetDeviceSettingsPutSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -657,8 +711,8 @@ SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH"); SWGHttpRequestInput input(fullPath, "PATCH");
@ -669,7 +723,7 @@ SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetFocusPatchCallback); &SWGDeviceSetApi::devicesetFocusPatchCallback);
@ -677,7 +731,7 @@ SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
} }
void void
SWGDeviceSetApi::devicesetFocusPatchCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetFocusPatchCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -694,8 +748,12 @@ SWGDeviceSetApi::devicesetFocusPatchCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse"))); SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetFocusPatchSignal(output); emit devicesetFocusPatchSignal(output);
} else {
emit devicesetFocusPatchSignalE(output, error_type, error_str); emit devicesetFocusPatchSignalE(output, error_type, error_str);
emit devicesetFocusPatchSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -707,8 +765,8 @@ SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -719,7 +777,7 @@ SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::devicesetGetCallback); &SWGDeviceSetApi::devicesetGetCallback);
@ -727,7 +785,7 @@ SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
} }
void void
SWGDeviceSetApi::devicesetGetCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::devicesetGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -744,8 +802,12 @@ SWGDeviceSetApi::devicesetGetCallback(HttpRequestWorker * worker) {
SWGDeviceSet* output = static_cast<SWGDeviceSet*>(create(json, QString("SWGDeviceSet"))); SWGDeviceSet* output = static_cast<SWGDeviceSet*>(create(json, QString("SWGDeviceSet")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetGetSignal(output); emit devicesetGetSignal(output);
} else {
emit devicesetGetSignalE(output, error_type, error_str); emit devicesetGetSignalE(output, error_type, error_str);
emit devicesetGetSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -755,8 +817,8 @@ SWGDeviceSetApi::instanceDeviceSetDelete() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE"); SWGHttpRequestInput input(fullPath, "DELETE");
@ -767,7 +829,7 @@ SWGDeviceSetApi::instanceDeviceSetDelete() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::instanceDeviceSetDeleteCallback); &SWGDeviceSetApi::instanceDeviceSetDeleteCallback);
@ -775,7 +837,7 @@ SWGDeviceSetApi::instanceDeviceSetDelete() {
} }
void void
SWGDeviceSetApi::instanceDeviceSetDeleteCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::instanceDeviceSetDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -792,8 +854,12 @@ SWGDeviceSetApi::instanceDeviceSetDeleteCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse"))); SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeviceSetDeleteSignal(output); emit instanceDeviceSetDeleteSignal(output);
} else {
emit instanceDeviceSetDeleteSignalE(output, error_type, error_str); emit instanceDeviceSetDeleteSignalE(output, error_type, error_str);
emit instanceDeviceSetDeleteSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -811,8 +877,8 @@ SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
.append(QUrl::toPercentEncoding(stringValue(tx))); .append(QUrl::toPercentEncoding(stringValue(tx)));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "POST"); SWGHttpRequestInput input(fullPath, "POST");
@ -823,7 +889,7 @@ SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGDeviceSetApi::instanceDeviceSetPostCallback); &SWGDeviceSetApi::instanceDeviceSetPostCallback);
@ -831,7 +897,7 @@ SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
} }
void void
SWGDeviceSetApi::instanceDeviceSetPostCallback(HttpRequestWorker * worker) { SWGDeviceSetApi::instanceDeviceSetPostCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -848,8 +914,12 @@ SWGDeviceSetApi::instanceDeviceSetPostCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse"))); SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeviceSetPostSignal(output); emit instanceDeviceSetPostSignal(output);
} else {
emit instanceDeviceSetPostSignalE(output, error_type, error_str); emit instanceDeviceSetPostSignalE(output, error_type, error_str);
emit instanceDeviceSetPostSignalEFull(worker, error_type, error_str);
}
} }

View File

@ -40,39 +40,39 @@ public:
QMap<QString, QString> defaultHeaders; QMap<QString, QString> defaultHeaders;
void devicesetChannelDelete(qint32 device_set_index, qint32 channel_index); void devicesetChannelDelete(qint32 device_set_index, qint32 channel_index);
void devicesetChannelPost(qint32 device_set_index, SWGChannelSettings body); void devicesetChannelPost(qint32 device_set_index, SWGChannelSettings& body);
void devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index); void devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index);
void devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings body); void devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body);
void devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings body); void devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index, SWGChannelSettings& body);
void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body); void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body);
void devicesetDeviceRunDelete(qint32 device_set_index); void devicesetDeviceRunDelete(qint32 device_set_index);
void devicesetDeviceRunGet(qint32 device_set_index); void devicesetDeviceRunGet(qint32 device_set_index);
void devicesetDeviceRunPost(qint32 device_set_index); void devicesetDeviceRunPost(qint32 device_set_index);
void devicesetDeviceSettingsGet(qint32 device_set_index); void devicesetDeviceSettingsGet(qint32 device_set_index);
void devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings body); void devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings& body);
void devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings body); void devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings& body);
void devicesetFocusPatch(qint32 device_set_index); void devicesetFocusPatch(qint32 device_set_index);
void devicesetGet(qint32 device_set_index); void devicesetGet(qint32 device_set_index);
void instanceDeviceSetDelete(); void instanceDeviceSetDelete();
void instanceDeviceSetPost(qint32 tx); void instanceDeviceSetPost(qint32 tx);
private: private:
void devicesetChannelDeleteCallback (HttpRequestWorker * worker); void devicesetChannelDeleteCallback (SWGHttpRequestWorker * worker);
void devicesetChannelPostCallback (HttpRequestWorker * worker); void devicesetChannelPostCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsGetCallback (HttpRequestWorker * worker); void devicesetChannelSettingsGetCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsPatchCallback (HttpRequestWorker * worker); void devicesetChannelSettingsPatchCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsPutCallback (HttpRequestWorker * worker); void devicesetChannelSettingsPutCallback (SWGHttpRequestWorker * worker);
void devicesetDevicePutCallback (HttpRequestWorker * worker); void devicesetDevicePutCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunDeleteCallback (HttpRequestWorker * worker); void devicesetDeviceRunDeleteCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunGetCallback (HttpRequestWorker * worker); void devicesetDeviceRunGetCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunPostCallback (HttpRequestWorker * worker); void devicesetDeviceRunPostCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceSettingsGetCallback (HttpRequestWorker * worker); void devicesetDeviceSettingsGetCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceSettingsPatchCallback (HttpRequestWorker * worker); void devicesetDeviceSettingsPatchCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceSettingsPutCallback (HttpRequestWorker * worker); void devicesetDeviceSettingsPutCallback (SWGHttpRequestWorker * worker);
void devicesetFocusPatchCallback (HttpRequestWorker * worker); void devicesetFocusPatchCallback (SWGHttpRequestWorker * worker);
void devicesetGetCallback (HttpRequestWorker * worker); void devicesetGetCallback (SWGHttpRequestWorker * worker);
void instanceDeviceSetDeleteCallback (HttpRequestWorker * worker); void instanceDeviceSetDeleteCallback (SWGHttpRequestWorker * worker);
void instanceDeviceSetPostCallback (HttpRequestWorker * worker); void instanceDeviceSetPostCallback (SWGHttpRequestWorker * worker);
signals: signals:
void devicesetChannelDeleteSignal(SWGChannelSettings* summary); void devicesetChannelDeleteSignal(SWGChannelSettings* summary);
@ -109,6 +109,23 @@ signals:
void instanceDeviceSetDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDeviceSetDeleteSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceDeviceSetPostSignalE(SWGSuccessResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetChannelSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDevicePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceRunPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceSettingsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceSettingsPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetDeviceSettingsPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetFocusPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void devicesetGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceSetList::SWGDeviceSetList(QString* json) { SWGDeviceSetList::SWGDeviceSetList(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDeviceSetList::SWGDeviceSetList() { SWGDeviceSetList::SWGDeviceSetList() {
@ -38,18 +38,20 @@ SWGDeviceSetList::~SWGDeviceSetList() {
void void
SWGDeviceSetList::init() { SWGDeviceSetList::init() {
devicesetcount = 0; devicesetcount = 0;
m_devicesetcount_isSet = false;
devicesetfocus = 0; devicesetfocus = 0;
m_devicesetfocus_isSet = false;
device_sets = new QList<SWGDeviceSet*>(); device_sets = new QList<SWGDeviceSet*>();
m_device_sets_isSet = false;
} }
void void
SWGDeviceSetList::cleanup() { SWGDeviceSetList::cleanup() {
if(device_sets != nullptr) { if(device_sets != nullptr) {
QList<SWGDeviceSet*>* arr = device_sets; auto arr = device_sets;
foreach(SWGDeviceSet* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete device_sets; delete device_sets;
@ -57,7 +59,7 @@ SWGDeviceSetList::cleanup() {
} }
SWGDeviceSetList* SWGDeviceSetList*
SWGDeviceSetList::fromJson(QString &json) { SWGDeviceSetList::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -66,35 +68,36 @@ SWGDeviceSetList::fromJson(QString &json) {
} }
void void
SWGDeviceSetList::fromJsonObject(QJsonObject &pJson) { SWGDeviceSetList::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&devicesetcount, pJson["devicesetcount"], "qint32", ""); ::SWGSDRangel::setValue(&devicesetcount, pJson["devicesetcount"], "qint32", "");
::SWGSDRangel::setValue(&devicesetfocus, pJson["devicesetfocus"], "qint32", ""); ::SWGSDRangel::setValue(&devicesetfocus, pJson["devicesetfocus"], "qint32", "");
::SWGSDRangel::setValue(&device_sets, pJson["deviceSets"], "QList", "SWGDeviceSet");
::SWGSDRangel::setValue(&device_sets, pJson["deviceSets"], "QList", "SWGDeviceSet");
} }
QString QString
SWGDeviceSetList::asJson () SWGDeviceSetList::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDeviceSetList::asJsonObject() { SWGDeviceSetList::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_devicesetcount_isSet){
obj->insert("devicesetcount", QJsonValue(devicesetcount)); obj.insert("devicesetcount", QJsonValue(devicesetcount));
}
obj->insert("devicesetfocus", QJsonValue(devicesetfocus)); if(m_devicesetfocus_isSet){
obj.insert("devicesetfocus", QJsonValue(devicesetfocus));
QJsonArray device_setsJsonArray; }
toJsonArray((QList<void*>*)device_sets, &device_setsJsonArray, "device_sets", "SWGDeviceSet"); if(device_sets->size() > 0){
obj->insert("deviceSets", device_setsJsonArray); toJsonArray((QList<void*>*)device_sets, obj, "deviceSets", "SWGDeviceSet");
}
return obj; return obj;
} }
@ -106,6 +109,7 @@ SWGDeviceSetList::getDevicesetcount() {
void void
SWGDeviceSetList::setDevicesetcount(qint32 devicesetcount) { SWGDeviceSetList::setDevicesetcount(qint32 devicesetcount) {
this->devicesetcount = devicesetcount; this->devicesetcount = devicesetcount;
this->m_devicesetcount_isSet = true;
} }
qint32 qint32
@ -115,6 +119,7 @@ SWGDeviceSetList::getDevicesetfocus() {
void void
SWGDeviceSetList::setDevicesetfocus(qint32 devicesetfocus) { SWGDeviceSetList::setDevicesetfocus(qint32 devicesetfocus) {
this->devicesetfocus = devicesetfocus; this->devicesetfocus = devicesetfocus;
this->m_devicesetfocus_isSet = true;
} }
QList<SWGDeviceSet*>* QList<SWGDeviceSet*>*
@ -124,8 +129,19 @@ SWGDeviceSetList::getDeviceSets() {
void void
SWGDeviceSetList::setDeviceSets(QList<SWGDeviceSet*>* device_sets) { SWGDeviceSetList::setDeviceSets(QList<SWGDeviceSet*>* device_sets) {
this->device_sets = device_sets; this->device_sets = device_sets;
this->m_device_sets_isSet = true;
} }
bool
SWGDeviceSetList::isSet(){
bool isObjectUpdated = false;
do{
if(m_devicesetcount_isSet){ isObjectUpdated = true; break;}
if(m_devicesetfocus_isSet){ isObjectUpdated = true; break;}
if(device_sets->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDeviceSetList: public SWGObject { class SWGDeviceSetList: public SWGObject {
public: public:
SWGDeviceSetList(); SWGDeviceSetList();
SWGDeviceSetList(QString* json); SWGDeviceSetList(QString json);
virtual ~SWGDeviceSetList(); ~SWGDeviceSetList();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDeviceSetList* fromJson(QString &jsonString); SWGDeviceSetList* fromJson(QString jsonString);
qint32 getDevicesetcount(); qint32 getDevicesetcount();
void setDevicesetcount(qint32 devicesetcount); void setDevicesetcount(qint32 devicesetcount);
@ -53,10 +52,18 @@ public:
void setDeviceSets(QList<SWGDeviceSet*>* device_sets); void setDeviceSets(QList<SWGDeviceSet*>* device_sets);
virtual bool isSet() override;
private: private:
qint32 devicesetcount; qint32 devicesetcount;
bool m_devicesetcount_isSet;
qint32 devicesetfocus; qint32 devicesetfocus;
bool m_devicesetfocus_isSet;
QList<SWGDeviceSet*>* device_sets; QList<SWGDeviceSet*>* device_sets;
bool m_device_sets_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceSettings::SWGDeviceSettings(QString* json) { SWGDeviceSettings::SWGDeviceSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDeviceSettings::SWGDeviceSettings() { SWGDeviceSettings::SWGDeviceSettings() {
@ -38,50 +38,51 @@ SWGDeviceSettings::~SWGDeviceSettings() {
void void
SWGDeviceSettings::init() { SWGDeviceSettings::init() {
device_hw_type = new QString(""); device_hw_type = new QString("");
m_device_hw_type_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false;
file_source_settings = new SWGFileSourceSettings(); file_source_settings = new SWGFileSourceSettings();
m_file_source_settings_isSet = false;
hack_rf_input_settings = new SWGHackRFInputSettings(); hack_rf_input_settings = new SWGHackRFInputSettings();
m_hack_rf_input_settings_isSet = false;
hack_rf_output_settings = new SWGHackRFOutputSettings(); hack_rf_output_settings = new SWGHackRFOutputSettings();
m_hack_rf_output_settings_isSet = false;
lime_sdr_input_settings = new SWGLimeSdrInputSettings(); lime_sdr_input_settings = new SWGLimeSdrInputSettings();
m_lime_sdr_input_settings_isSet = false;
lime_sdr_output_settings = new SWGLimeSdrOutputSettings(); lime_sdr_output_settings = new SWGLimeSdrOutputSettings();
m_lime_sdr_output_settings_isSet = false;
rtl_sdr_settings = new SWGRtlSdrSettings(); rtl_sdr_settings = new SWGRtlSdrSettings();
m_rtl_sdr_settings_isSet = false;
} }
void void
SWGDeviceSettings::cleanup() { SWGDeviceSettings::cleanup() {
if(device_hw_type != nullptr) { if(device_hw_type != nullptr) {
delete device_hw_type; delete device_hw_type;
} }
if(file_source_settings != nullptr) { if(file_source_settings != nullptr) {
delete file_source_settings; delete file_source_settings;
} }
if(hack_rf_input_settings != nullptr) { if(hack_rf_input_settings != nullptr) {
delete hack_rf_input_settings; delete hack_rf_input_settings;
} }
if(hack_rf_output_settings != nullptr) { if(hack_rf_output_settings != nullptr) {
delete hack_rf_output_settings; delete hack_rf_output_settings;
} }
if(lime_sdr_input_settings != nullptr) { if(lime_sdr_input_settings != nullptr) {
delete lime_sdr_input_settings; delete lime_sdr_input_settings;
} }
if(lime_sdr_output_settings != nullptr) { if(lime_sdr_output_settings != nullptr) {
delete lime_sdr_output_settings; delete lime_sdr_output_settings;
} }
if(rtl_sdr_settings != nullptr) { if(rtl_sdr_settings != nullptr) {
delete rtl_sdr_settings; delete rtl_sdr_settings;
} }
} }
SWGDeviceSettings* SWGDeviceSettings*
SWGDeviceSettings::fromJson(QString &json) { SWGDeviceSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -90,46 +91,61 @@ SWGDeviceSettings::fromJson(QString &json) {
} }
void void
SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) { SWGDeviceSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&device_hw_type, pJson["deviceHwType"], "QString", "QString"); ::SWGSDRangel::setValue(&device_hw_type, pJson["deviceHwType"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&file_source_settings, pJson["fileSourceSettings"], "SWGFileSourceSettings", "SWGFileSourceSettings"); ::SWGSDRangel::setValue(&file_source_settings, pJson["fileSourceSettings"], "SWGFileSourceSettings", "SWGFileSourceSettings");
::SWGSDRangel::setValue(&hack_rf_input_settings, pJson["hackRFInputSettings"], "SWGHackRFInputSettings", "SWGHackRFInputSettings"); ::SWGSDRangel::setValue(&hack_rf_input_settings, pJson["hackRFInputSettings"], "SWGHackRFInputSettings", "SWGHackRFInputSettings");
::SWGSDRangel::setValue(&hack_rf_output_settings, pJson["hackRFOutputSettings"], "SWGHackRFOutputSettings", "SWGHackRFOutputSettings"); ::SWGSDRangel::setValue(&hack_rf_output_settings, pJson["hackRFOutputSettings"], "SWGHackRFOutputSettings", "SWGHackRFOutputSettings");
::SWGSDRangel::setValue(&lime_sdr_input_settings, pJson["limeSdrInputSettings"], "SWGLimeSdrInputSettings", "SWGLimeSdrInputSettings"); ::SWGSDRangel::setValue(&lime_sdr_input_settings, pJson["limeSdrInputSettings"], "SWGLimeSdrInputSettings", "SWGLimeSdrInputSettings");
::SWGSDRangel::setValue(&lime_sdr_output_settings, pJson["limeSdrOutputSettings"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings"); ::SWGSDRangel::setValue(&lime_sdr_output_settings, pJson["limeSdrOutputSettings"], "SWGLimeSdrOutputSettings", "SWGLimeSdrOutputSettings");
::SWGSDRangel::setValue(&rtl_sdr_settings, pJson["rtlSdrSettings"], "SWGRtlSdrSettings", "SWGRtlSdrSettings"); ::SWGSDRangel::setValue(&rtl_sdr_settings, pJson["rtlSdrSettings"], "SWGRtlSdrSettings", "SWGRtlSdrSettings");
} }
QString QString
SWGDeviceSettings::asJson () SWGDeviceSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDeviceSettings::asJsonObject() { SWGDeviceSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(device_hw_type != nullptr && *device_hw_type != QString("")){
toJsonValue(QString("deviceHwType"), device_hw_type, obj, QString("QString")); toJsonValue(QString("deviceHwType"), device_hw_type, obj, QString("QString"));
}
obj->insert("tx", QJsonValue(tx)); if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx));
}
if((file_source_settings != nullptr) && (file_source_settings->isSet())){
toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings")); toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings"));
}
if((hack_rf_input_settings != nullptr) && (hack_rf_input_settings->isSet())){
toJsonValue(QString("hackRFInputSettings"), hack_rf_input_settings, obj, QString("SWGHackRFInputSettings")); toJsonValue(QString("hackRFInputSettings"), hack_rf_input_settings, obj, QString("SWGHackRFInputSettings"));
}
if((hack_rf_output_settings != nullptr) && (hack_rf_output_settings->isSet())){
toJsonValue(QString("hackRFOutputSettings"), hack_rf_output_settings, obj, QString("SWGHackRFOutputSettings")); toJsonValue(QString("hackRFOutputSettings"), hack_rf_output_settings, obj, QString("SWGHackRFOutputSettings"));
}
if((lime_sdr_input_settings != nullptr) && (lime_sdr_input_settings->isSet())){
toJsonValue(QString("limeSdrInputSettings"), lime_sdr_input_settings, obj, QString("SWGLimeSdrInputSettings")); toJsonValue(QString("limeSdrInputSettings"), lime_sdr_input_settings, obj, QString("SWGLimeSdrInputSettings"));
}
if((lime_sdr_output_settings != nullptr) && (lime_sdr_output_settings->isSet())){
toJsonValue(QString("limeSdrOutputSettings"), lime_sdr_output_settings, obj, QString("SWGLimeSdrOutputSettings")); toJsonValue(QString("limeSdrOutputSettings"), lime_sdr_output_settings, obj, QString("SWGLimeSdrOutputSettings"));
}
if((rtl_sdr_settings != nullptr) && (rtl_sdr_settings->isSet())){
toJsonValue(QString("rtlSdrSettings"), rtl_sdr_settings, obj, QString("SWGRtlSdrSettings")); toJsonValue(QString("rtlSdrSettings"), rtl_sdr_settings, obj, QString("SWGRtlSdrSettings"));
}
return obj; return obj;
} }
@ -141,6 +157,7 @@ SWGDeviceSettings::getDeviceHwType() {
void void
SWGDeviceSettings::setDeviceHwType(QString* device_hw_type) { SWGDeviceSettings::setDeviceHwType(QString* device_hw_type) {
this->device_hw_type = device_hw_type; this->device_hw_type = device_hw_type;
this->m_device_hw_type_isSet = true;
} }
qint32 qint32
@ -150,6 +167,7 @@ SWGDeviceSettings::getTx() {
void void
SWGDeviceSettings::setTx(qint32 tx) { SWGDeviceSettings::setTx(qint32 tx) {
this->tx = tx; this->tx = tx;
this->m_tx_isSet = true;
} }
SWGFileSourceSettings* SWGFileSourceSettings*
@ -159,6 +177,7 @@ SWGDeviceSettings::getFileSourceSettings() {
void void
SWGDeviceSettings::setFileSourceSettings(SWGFileSourceSettings* file_source_settings) { SWGDeviceSettings::setFileSourceSettings(SWGFileSourceSettings* file_source_settings) {
this->file_source_settings = file_source_settings; this->file_source_settings = file_source_settings;
this->m_file_source_settings_isSet = true;
} }
SWGHackRFInputSettings* SWGHackRFInputSettings*
@ -168,6 +187,7 @@ SWGDeviceSettings::getHackRfInputSettings() {
void void
SWGDeviceSettings::setHackRfInputSettings(SWGHackRFInputSettings* hack_rf_input_settings) { SWGDeviceSettings::setHackRfInputSettings(SWGHackRFInputSettings* hack_rf_input_settings) {
this->hack_rf_input_settings = hack_rf_input_settings; this->hack_rf_input_settings = hack_rf_input_settings;
this->m_hack_rf_input_settings_isSet = true;
} }
SWGHackRFOutputSettings* SWGHackRFOutputSettings*
@ -177,6 +197,7 @@ SWGDeviceSettings::getHackRfOutputSettings() {
void void
SWGDeviceSettings::setHackRfOutputSettings(SWGHackRFOutputSettings* hack_rf_output_settings) { SWGDeviceSettings::setHackRfOutputSettings(SWGHackRFOutputSettings* hack_rf_output_settings) {
this->hack_rf_output_settings = hack_rf_output_settings; this->hack_rf_output_settings = hack_rf_output_settings;
this->m_hack_rf_output_settings_isSet = true;
} }
SWGLimeSdrInputSettings* SWGLimeSdrInputSettings*
@ -186,6 +207,7 @@ SWGDeviceSettings::getLimeSdrInputSettings() {
void void
SWGDeviceSettings::setLimeSdrInputSettings(SWGLimeSdrInputSettings* lime_sdr_input_settings) { SWGDeviceSettings::setLimeSdrInputSettings(SWGLimeSdrInputSettings* lime_sdr_input_settings) {
this->lime_sdr_input_settings = lime_sdr_input_settings; this->lime_sdr_input_settings = lime_sdr_input_settings;
this->m_lime_sdr_input_settings_isSet = true;
} }
SWGLimeSdrOutputSettings* SWGLimeSdrOutputSettings*
@ -195,6 +217,7 @@ SWGDeviceSettings::getLimeSdrOutputSettings() {
void void
SWGDeviceSettings::setLimeSdrOutputSettings(SWGLimeSdrOutputSettings* lime_sdr_output_settings) { SWGDeviceSettings::setLimeSdrOutputSettings(SWGLimeSdrOutputSettings* lime_sdr_output_settings) {
this->lime_sdr_output_settings = lime_sdr_output_settings; this->lime_sdr_output_settings = lime_sdr_output_settings;
this->m_lime_sdr_output_settings_isSet = true;
} }
SWGRtlSdrSettings* SWGRtlSdrSettings*
@ -204,8 +227,24 @@ SWGDeviceSettings::getRtlSdrSettings() {
void void
SWGDeviceSettings::setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings) { SWGDeviceSettings::setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings) {
this->rtl_sdr_settings = rtl_sdr_settings; this->rtl_sdr_settings = rtl_sdr_settings;
this->m_rtl_sdr_settings_isSet = true;
} }
bool
SWGDeviceSettings::isSet(){
bool isObjectUpdated = false;
do{
if(device_hw_type != nullptr && *device_hw_type != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(file_source_settings != nullptr && file_source_settings->isSet()){ isObjectUpdated = true; break;}
if(hack_rf_input_settings != nullptr && hack_rf_input_settings->isSet()){ isObjectUpdated = true; break;}
if(hack_rf_output_settings != nullptr && hack_rf_output_settings->isSet()){ isObjectUpdated = true; break;}
if(lime_sdr_input_settings != nullptr && lime_sdr_input_settings->isSet()){ isObjectUpdated = true; break;}
if(lime_sdr_output_settings != nullptr && lime_sdr_output_settings->isSet()){ isObjectUpdated = true; break;}
if(rtl_sdr_settings != nullptr && rtl_sdr_settings->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -32,21 +32,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDeviceSettings: public SWGObject { class SWGDeviceSettings: public SWGObject {
public: public:
SWGDeviceSettings(); SWGDeviceSettings();
SWGDeviceSettings(QString* json); SWGDeviceSettings(QString json);
virtual ~SWGDeviceSettings(); ~SWGDeviceSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDeviceSettings* fromJson(QString &jsonString); SWGDeviceSettings* fromJson(QString jsonString);
QString* getDeviceHwType(); QString* getDeviceHwType();
void setDeviceHwType(QString* device_hw_type); void setDeviceHwType(QString* device_hw_type);
@ -73,15 +72,33 @@ public:
void setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings); void setRtlSdrSettings(SWGRtlSdrSettings* rtl_sdr_settings);
virtual bool isSet() override;
private: private:
QString* device_hw_type; QString* device_hw_type;
bool m_device_hw_type_isSet;
qint32 tx; qint32 tx;
bool m_tx_isSet;
SWGFileSourceSettings* file_source_settings; SWGFileSourceSettings* file_source_settings;
bool m_file_source_settings_isSet;
SWGHackRFInputSettings* hack_rf_input_settings; SWGHackRFInputSettings* hack_rf_input_settings;
bool m_hack_rf_input_settings_isSet;
SWGHackRFOutputSettings* hack_rf_output_settings; SWGHackRFOutputSettings* hack_rf_output_settings;
bool m_hack_rf_output_settings_isSet;
SWGLimeSdrInputSettings* lime_sdr_input_settings; SWGLimeSdrInputSettings* lime_sdr_input_settings;
bool m_lime_sdr_input_settings_isSet;
SWGLimeSdrOutputSettings* lime_sdr_output_settings; SWGLimeSdrOutputSettings* lime_sdr_output_settings;
bool m_lime_sdr_output_settings_isSet;
SWGRtlSdrSettings* rtl_sdr_settings; SWGRtlSdrSettings* rtl_sdr_settings;
bool m_rtl_sdr_settings_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceState::SWGDeviceState(QString* json) { SWGDeviceState::SWGDeviceState(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGDeviceState::SWGDeviceState() { SWGDeviceState::SWGDeviceState() {
@ -38,18 +38,18 @@ SWGDeviceState::~SWGDeviceState() {
void void
SWGDeviceState::init() { SWGDeviceState::init() {
state = new QString(""); state = new QString("");
m_state_isSet = false;
} }
void void
SWGDeviceState::cleanup() { SWGDeviceState::cleanup() {
if(state != nullptr) { if(state != nullptr) {
delete state; delete state;
} }
} }
SWGDeviceState* SWGDeviceState*
SWGDeviceState::fromJson(QString &json) { SWGDeviceState::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,25 +58,26 @@ SWGDeviceState::fromJson(QString &json) {
} }
void void
SWGDeviceState::fromJsonObject(QJsonObject &pJson) { SWGDeviceState::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString"); ::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString");
} }
QString QString
SWGDeviceState::asJson () SWGDeviceState::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGDeviceState::asJsonObject() { SWGDeviceState::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(state != nullptr && *state != QString("")){
toJsonValue(QString("state"), state, obj, QString("QString")); toJsonValue(QString("state"), state, obj, QString("QString"));
}
return obj; return obj;
} }
@ -88,8 +89,17 @@ SWGDeviceState::getState() {
void void
SWGDeviceState::setState(QString* state) { SWGDeviceState::setState(QString* state) {
this->state = state; this->state = state;
this->m_state_isSet = true;
} }
bool
SWGDeviceState::isSet(){
bool isObjectUpdated = false;
do{
if(state != nullptr && *state != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,28 +26,31 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGDeviceState: public SWGObject { class SWGDeviceState: public SWGObject {
public: public:
SWGDeviceState(); SWGDeviceState();
SWGDeviceState(QString* json); SWGDeviceState(QString json);
virtual ~SWGDeviceState(); ~SWGDeviceState();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGDeviceState* fromJson(QString &jsonString); SWGDeviceState* fromJson(QString jsonString);
QString* getState(); QString* getState();
void setState(QString* state); void setState(QString* state);
virtual bool isSet() override;
private: private:
QString* state; QString* state;
bool m_state_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGErrorResponse::SWGErrorResponse(QString* json) { SWGErrorResponse::SWGErrorResponse(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGErrorResponse::SWGErrorResponse() { SWGErrorResponse::SWGErrorResponse() {
@ -38,18 +38,18 @@ SWGErrorResponse::~SWGErrorResponse() {
void void
SWGErrorResponse::init() { SWGErrorResponse::init() {
message = new QString(""); message = new QString("");
m_message_isSet = false;
} }
void void
SWGErrorResponse::cleanup() { SWGErrorResponse::cleanup() {
if(message != nullptr) { if(message != nullptr) {
delete message; delete message;
} }
} }
SWGErrorResponse* SWGErrorResponse*
SWGErrorResponse::fromJson(QString &json) { SWGErrorResponse::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,25 +58,26 @@ SWGErrorResponse::fromJson(QString &json) {
} }
void void
SWGErrorResponse::fromJsonObject(QJsonObject &pJson) { SWGErrorResponse::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString"); ::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString");
} }
QString QString
SWGErrorResponse::asJson () SWGErrorResponse::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGErrorResponse::asJsonObject() { SWGErrorResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(message != nullptr && *message != QString("")){
toJsonValue(QString("message"), message, obj, QString("QString")); toJsonValue(QString("message"), message, obj, QString("QString"));
}
return obj; return obj;
} }
@ -88,8 +89,17 @@ SWGErrorResponse::getMessage() {
void void
SWGErrorResponse::setMessage(QString* message) { SWGErrorResponse::setMessage(QString* message) {
this->message = message; this->message = message;
this->m_message_isSet = true;
} }
bool
SWGErrorResponse::isSet(){
bool isObjectUpdated = false;
do{
if(message != nullptr && *message != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,28 +26,31 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGErrorResponse: public SWGObject { class SWGErrorResponse: public SWGObject {
public: public:
SWGErrorResponse(); SWGErrorResponse();
SWGErrorResponse(QString* json); SWGErrorResponse(QString json);
virtual ~SWGErrorResponse(); ~SWGErrorResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGErrorResponse* fromJson(QString &jsonString); SWGErrorResponse* fromJson(QString jsonString);
QString* getMessage(); QString* getMessage();
void setMessage(QString* message); void setMessage(QString* message);
virtual bool isSet() override;
private: private:
QString* message; QString* message;
bool m_message_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGFileSourceSettings::SWGFileSourceSettings(QString* json) { SWGFileSourceSettings::SWGFileSourceSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGFileSourceSettings::SWGFileSourceSettings() { SWGFileSourceSettings::SWGFileSourceSettings() {
@ -38,18 +38,18 @@ SWGFileSourceSettings::~SWGFileSourceSettings() {
void void
SWGFileSourceSettings::init() { SWGFileSourceSettings::init() {
file_name = new QString(""); file_name = new QString("");
m_file_name_isSet = false;
} }
void void
SWGFileSourceSettings::cleanup() { SWGFileSourceSettings::cleanup() {
if(file_name != nullptr) { if(file_name != nullptr) {
delete file_name; delete file_name;
} }
} }
SWGFileSourceSettings* SWGFileSourceSettings*
SWGFileSourceSettings::fromJson(QString &json) { SWGFileSourceSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,25 +58,26 @@ SWGFileSourceSettings::fromJson(QString &json) {
} }
void void
SWGFileSourceSettings::fromJsonObject(QJsonObject &pJson) { SWGFileSourceSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString"); ::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString");
} }
QString QString
SWGFileSourceSettings::asJson () SWGFileSourceSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGFileSourceSettings::asJsonObject() { SWGFileSourceSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(file_name != nullptr && *file_name != QString("")){
toJsonValue(QString("fileName"), file_name, obj, QString("QString")); toJsonValue(QString("fileName"), file_name, obj, QString("QString"));
}
return obj; return obj;
} }
@ -88,8 +89,17 @@ SWGFileSourceSettings::getFileName() {
void void
SWGFileSourceSettings::setFileName(QString* file_name) { SWGFileSourceSettings::setFileName(QString* file_name) {
this->file_name = file_name; this->file_name = file_name;
this->m_file_name_isSet = true;
} }
bool
SWGFileSourceSettings::isSet(){
bool isObjectUpdated = false;
do{
if(file_name != nullptr && *file_name != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,28 +26,31 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGFileSourceSettings: public SWGObject { class SWGFileSourceSettings: public SWGObject {
public: public:
SWGFileSourceSettings(); SWGFileSourceSettings();
SWGFileSourceSettings(QString* json); SWGFileSourceSettings(QString json);
virtual ~SWGFileSourceSettings(); ~SWGFileSourceSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGFileSourceSettings* fromJson(QString &jsonString); SWGFileSourceSettings* fromJson(QString jsonString);
QString* getFileName(); QString* getFileName();
void setFileName(QString* file_name); void setFileName(QString* file_name);
virtual bool isSet() override;
private: private:
QString* file_name; QString* file_name;
bool m_file_name_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGHackRFInputSettings::SWGHackRFInputSettings(QString* json) { SWGHackRFInputSettings::SWGHackRFInputSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGHackRFInputSettings::SWGHackRFInputSettings() { SWGHackRFInputSettings::SWGHackRFInputSettings() {
@ -38,18 +38,31 @@ SWGHackRFInputSettings::~SWGHackRFInputSettings() {
void void
SWGHackRFInputSettings::init() { SWGHackRFInputSettings::init() {
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
l_oppm_tenths = 0; l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
bandwidth = 0; bandwidth = 0;
m_bandwidth_isSet = false;
lna_gain = 0; lna_gain = 0;
m_lna_gain_isSet = false;
vga_gain = 0; vga_gain = 0;
m_vga_gain_isSet = false;
log2_decim = 0; log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0; fc_pos = 0;
m_fc_pos_isSet = false;
dev_sample_rate = 0; dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
bias_t = 0; bias_t = 0;
m_bias_t_isSet = false;
lna_ext = 0; lna_ext = 0;
m_lna_ext_isSet = false;
dc_block = 0; dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0; iq_correction = 0;
m_iq_correction_isSet = false;
link_tx_frequency = 0; link_tx_frequency = 0;
m_link_tx_frequency_isSet = false;
} }
void void
@ -70,7 +83,7 @@ SWGHackRFInputSettings::cleanup() {
} }
SWGHackRFInputSettings* SWGHackRFInputSettings*
SWGHackRFInputSettings::fromJson(QString &json) { SWGHackRFInputSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -79,61 +92,86 @@ SWGHackRFInputSettings::fromJson(QString &json) {
} }
void void
SWGHackRFInputSettings::fromJsonObject(QJsonObject &pJson) { SWGHackRFInputSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", ""); ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", ""); ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", ""); ::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", "");
::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", ""); ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", ""); ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", ""); ::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
::SWGSDRangel::setValue(&lna_ext, pJson["lnaExt"], "qint32", ""); ::SWGSDRangel::setValue(&lna_ext, pJson["lnaExt"], "qint32", "");
::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", ""); ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", ""); ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
::SWGSDRangel::setValue(&link_tx_frequency, pJson["linkTxFrequency"], "qint32", ""); ::SWGSDRangel::setValue(&link_tx_frequency, pJson["linkTxFrequency"], "qint32", "");
} }
QString QString
SWGHackRFInputSettings::asJson () SWGHackRFInputSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGHackRFInputSettings::asJsonObject() { SWGHackRFInputSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency)); obj.insert("centerFrequency", QJsonValue(center_frequency));
}
obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths)); if(m_l_oppm_tenths_isSet){
obj.insert("LOppmTenths", QJsonValue(l_oppm_tenths));
obj->insert("bandwidth", QJsonValue(bandwidth)); }
if(m_bandwidth_isSet){
obj->insert("lnaGain", QJsonValue(lna_gain)); obj.insert("bandwidth", QJsonValue(bandwidth));
}
obj->insert("vgaGain", QJsonValue(vga_gain)); if(m_lna_gain_isSet){
obj.insert("lnaGain", QJsonValue(lna_gain));
obj->insert("log2Decim", QJsonValue(log2_decim)); }
if(m_vga_gain_isSet){
obj->insert("fcPos", QJsonValue(fc_pos)); obj.insert("vgaGain", QJsonValue(vga_gain));
}
obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); if(m_log2_decim_isSet){
obj.insert("log2Decim", QJsonValue(log2_decim));
obj->insert("biasT", QJsonValue(bias_t)); }
if(m_fc_pos_isSet){
obj->insert("lnaExt", QJsonValue(lna_ext)); obj.insert("fcPos", QJsonValue(fc_pos));
}
obj->insert("dcBlock", QJsonValue(dc_block)); if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate));
obj->insert("iqCorrection", QJsonValue(iq_correction)); }
if(m_bias_t_isSet){
obj->insert("linkTxFrequency", QJsonValue(link_tx_frequency)); obj.insert("biasT", QJsonValue(bias_t));
}
if(m_lna_ext_isSet){
obj.insert("lnaExt", QJsonValue(lna_ext));
}
if(m_dc_block_isSet){
obj.insert("dcBlock", QJsonValue(dc_block));
}
if(m_iq_correction_isSet){
obj.insert("iqCorrection", QJsonValue(iq_correction));
}
if(m_link_tx_frequency_isSet){
obj.insert("linkTxFrequency", QJsonValue(link_tx_frequency));
}
return obj; return obj;
} }
@ -145,6 +183,7 @@ SWGHackRFInputSettings::getCenterFrequency() {
void void
SWGHackRFInputSettings::setCenterFrequency(qint64 center_frequency) { SWGHackRFInputSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
qint32 qint32
@ -154,6 +193,7 @@ SWGHackRFInputSettings::getLOppmTenths() {
void void
SWGHackRFInputSettings::setLOppmTenths(qint32 l_oppm_tenths) { SWGHackRFInputSettings::setLOppmTenths(qint32 l_oppm_tenths) {
this->l_oppm_tenths = l_oppm_tenths; this->l_oppm_tenths = l_oppm_tenths;
this->m_l_oppm_tenths_isSet = true;
} }
qint32 qint32
@ -163,6 +203,7 @@ SWGHackRFInputSettings::getBandwidth() {
void void
SWGHackRFInputSettings::setBandwidth(qint32 bandwidth) { SWGHackRFInputSettings::setBandwidth(qint32 bandwidth) {
this->bandwidth = bandwidth; this->bandwidth = bandwidth;
this->m_bandwidth_isSet = true;
} }
qint32 qint32
@ -172,6 +213,7 @@ SWGHackRFInputSettings::getLnaGain() {
void void
SWGHackRFInputSettings::setLnaGain(qint32 lna_gain) { SWGHackRFInputSettings::setLnaGain(qint32 lna_gain) {
this->lna_gain = lna_gain; this->lna_gain = lna_gain;
this->m_lna_gain_isSet = true;
} }
qint32 qint32
@ -181,6 +223,7 @@ SWGHackRFInputSettings::getVgaGain() {
void void
SWGHackRFInputSettings::setVgaGain(qint32 vga_gain) { SWGHackRFInputSettings::setVgaGain(qint32 vga_gain) {
this->vga_gain = vga_gain; this->vga_gain = vga_gain;
this->m_vga_gain_isSet = true;
} }
qint32 qint32
@ -190,6 +233,7 @@ SWGHackRFInputSettings::getLog2Decim() {
void void
SWGHackRFInputSettings::setLog2Decim(qint32 log2_decim) { SWGHackRFInputSettings::setLog2Decim(qint32 log2_decim) {
this->log2_decim = log2_decim; this->log2_decim = log2_decim;
this->m_log2_decim_isSet = true;
} }
qint32 qint32
@ -199,6 +243,7 @@ SWGHackRFInputSettings::getFcPos() {
void void
SWGHackRFInputSettings::setFcPos(qint32 fc_pos) { SWGHackRFInputSettings::setFcPos(qint32 fc_pos) {
this->fc_pos = fc_pos; this->fc_pos = fc_pos;
this->m_fc_pos_isSet = true;
} }
qint32 qint32
@ -208,6 +253,7 @@ SWGHackRFInputSettings::getDevSampleRate() {
void void
SWGHackRFInputSettings::setDevSampleRate(qint32 dev_sample_rate) { SWGHackRFInputSettings::setDevSampleRate(qint32 dev_sample_rate) {
this->dev_sample_rate = dev_sample_rate; this->dev_sample_rate = dev_sample_rate;
this->m_dev_sample_rate_isSet = true;
} }
qint32 qint32
@ -217,6 +263,7 @@ SWGHackRFInputSettings::getBiasT() {
void void
SWGHackRFInputSettings::setBiasT(qint32 bias_t) { SWGHackRFInputSettings::setBiasT(qint32 bias_t) {
this->bias_t = bias_t; this->bias_t = bias_t;
this->m_bias_t_isSet = true;
} }
qint32 qint32
@ -226,6 +273,7 @@ SWGHackRFInputSettings::getLnaExt() {
void void
SWGHackRFInputSettings::setLnaExt(qint32 lna_ext) { SWGHackRFInputSettings::setLnaExt(qint32 lna_ext) {
this->lna_ext = lna_ext; this->lna_ext = lna_ext;
this->m_lna_ext_isSet = true;
} }
qint32 qint32
@ -235,6 +283,7 @@ SWGHackRFInputSettings::getDcBlock() {
void void
SWGHackRFInputSettings::setDcBlock(qint32 dc_block) { SWGHackRFInputSettings::setDcBlock(qint32 dc_block) {
this->dc_block = dc_block; this->dc_block = dc_block;
this->m_dc_block_isSet = true;
} }
qint32 qint32
@ -244,6 +293,7 @@ SWGHackRFInputSettings::getIqCorrection() {
void void
SWGHackRFInputSettings::setIqCorrection(qint32 iq_correction) { SWGHackRFInputSettings::setIqCorrection(qint32 iq_correction) {
this->iq_correction = iq_correction; this->iq_correction = iq_correction;
this->m_iq_correction_isSet = true;
} }
qint32 qint32
@ -253,8 +303,29 @@ SWGHackRFInputSettings::getLinkTxFrequency() {
void void
SWGHackRFInputSettings::setLinkTxFrequency(qint32 link_tx_frequency) { SWGHackRFInputSettings::setLinkTxFrequency(qint32 link_tx_frequency) {
this->link_tx_frequency = link_tx_frequency; this->link_tx_frequency = link_tx_frequency;
this->m_link_tx_frequency_isSet = true;
} }
bool
SWGHackRFInputSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
if(m_vga_gain_isSet){ isObjectUpdated = true; break;}
if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_bias_t_isSet){ isObjectUpdated = true; break;}
if(m_lna_ext_isSet){ isObjectUpdated = true; break;}
if(m_dc_block_isSet){ isObjectUpdated = true; break;}
if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
if(m_link_tx_frequency_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGHackRFInputSettings: public SWGObject { class SWGHackRFInputSettings: public SWGObject {
public: public:
SWGHackRFInputSettings(); SWGHackRFInputSettings();
SWGHackRFInputSettings(QString* json); SWGHackRFInputSettings(QString json);
virtual ~SWGHackRFInputSettings(); ~SWGHackRFInputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGHackRFInputSettings* fromJson(QString &jsonString); SWGHackRFInputSettings* fromJson(QString jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);
@ -81,20 +80,48 @@ public:
void setLinkTxFrequency(qint32 link_tx_frequency); void setLinkTxFrequency(qint32 link_tx_frequency);
virtual bool isSet() override;
private: private:
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 l_oppm_tenths; qint32 l_oppm_tenths;
bool m_l_oppm_tenths_isSet;
qint32 bandwidth; qint32 bandwidth;
bool m_bandwidth_isSet;
qint32 lna_gain; qint32 lna_gain;
bool m_lna_gain_isSet;
qint32 vga_gain; qint32 vga_gain;
bool m_vga_gain_isSet;
qint32 log2_decim; qint32 log2_decim;
bool m_log2_decim_isSet;
qint32 fc_pos; qint32 fc_pos;
bool m_fc_pos_isSet;
qint32 dev_sample_rate; qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 bias_t; qint32 bias_t;
bool m_bias_t_isSet;
qint32 lna_ext; qint32 lna_ext;
bool m_lna_ext_isSet;
qint32 dc_block; qint32 dc_block;
bool m_dc_block_isSet;
qint32 iq_correction; qint32 iq_correction;
bool m_iq_correction_isSet;
qint32 link_tx_frequency; qint32 link_tx_frequency;
bool m_link_tx_frequency_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGHackRFOutputSettings::SWGHackRFOutputSettings(QString* json) { SWGHackRFOutputSettings::SWGHackRFOutputSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGHackRFOutputSettings::SWGHackRFOutputSettings() { SWGHackRFOutputSettings::SWGHackRFOutputSettings() {
@ -38,13 +38,21 @@ SWGHackRFOutputSettings::~SWGHackRFOutputSettings() {
void void
SWGHackRFOutputSettings::init() { SWGHackRFOutputSettings::init() {
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
l_oppm_tenths = 0; l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
bandwidth = 0; bandwidth = 0;
m_bandwidth_isSet = false;
vga_gain = 0; vga_gain = 0;
m_vga_gain_isSet = false;
log2_interp = 0; log2_interp = 0;
m_log2_interp_isSet = false;
dev_sample_rate = 0; dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
bias_t = 0; bias_t = 0;
m_bias_t_isSet = false;
lna_ext = 0; lna_ext = 0;
m_lna_ext_isSet = false;
} }
void void
@ -60,7 +68,7 @@ SWGHackRFOutputSettings::cleanup() {
} }
SWGHackRFOutputSettings* SWGHackRFOutputSettings*
SWGHackRFOutputSettings::fromJson(QString &json) { SWGHackRFOutputSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -69,46 +77,61 @@ SWGHackRFOutputSettings::fromJson(QString &json) {
} }
void void
SWGHackRFOutputSettings::fromJsonObject(QJsonObject &pJson) { SWGHackRFOutputSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", ""); ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", ""); ::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", "");
::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "qint32", ""); ::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "qint32", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", ""); ::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
::SWGSDRangel::setValue(&lna_ext, pJson["lnaExt"], "qint32", ""); ::SWGSDRangel::setValue(&lna_ext, pJson["lnaExt"], "qint32", "");
} }
QString QString
SWGHackRFOutputSettings::asJson () SWGHackRFOutputSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGHackRFOutputSettings::asJsonObject() { SWGHackRFOutputSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency)); obj.insert("centerFrequency", QJsonValue(center_frequency));
}
obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths)); if(m_l_oppm_tenths_isSet){
obj.insert("LOppmTenths", QJsonValue(l_oppm_tenths));
obj->insert("bandwidth", QJsonValue(bandwidth)); }
if(m_bandwidth_isSet){
obj->insert("vgaGain", QJsonValue(vga_gain)); obj.insert("bandwidth", QJsonValue(bandwidth));
}
obj->insert("log2Interp", QJsonValue(log2_interp)); if(m_vga_gain_isSet){
obj.insert("vgaGain", QJsonValue(vga_gain));
obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); }
if(m_log2_interp_isSet){
obj->insert("biasT", QJsonValue(bias_t)); obj.insert("log2Interp", QJsonValue(log2_interp));
}
obj->insert("lnaExt", QJsonValue(lna_ext)); if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate));
}
if(m_bias_t_isSet){
obj.insert("biasT", QJsonValue(bias_t));
}
if(m_lna_ext_isSet){
obj.insert("lnaExt", QJsonValue(lna_ext));
}
return obj; return obj;
} }
@ -120,6 +143,7 @@ SWGHackRFOutputSettings::getCenterFrequency() {
void void
SWGHackRFOutputSettings::setCenterFrequency(qint64 center_frequency) { SWGHackRFOutputSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
qint32 qint32
@ -129,6 +153,7 @@ SWGHackRFOutputSettings::getLOppmTenths() {
void void
SWGHackRFOutputSettings::setLOppmTenths(qint32 l_oppm_tenths) { SWGHackRFOutputSettings::setLOppmTenths(qint32 l_oppm_tenths) {
this->l_oppm_tenths = l_oppm_tenths; this->l_oppm_tenths = l_oppm_tenths;
this->m_l_oppm_tenths_isSet = true;
} }
qint32 qint32
@ -138,6 +163,7 @@ SWGHackRFOutputSettings::getBandwidth() {
void void
SWGHackRFOutputSettings::setBandwidth(qint32 bandwidth) { SWGHackRFOutputSettings::setBandwidth(qint32 bandwidth) {
this->bandwidth = bandwidth; this->bandwidth = bandwidth;
this->m_bandwidth_isSet = true;
} }
qint32 qint32
@ -147,6 +173,7 @@ SWGHackRFOutputSettings::getVgaGain() {
void void
SWGHackRFOutputSettings::setVgaGain(qint32 vga_gain) { SWGHackRFOutputSettings::setVgaGain(qint32 vga_gain) {
this->vga_gain = vga_gain; this->vga_gain = vga_gain;
this->m_vga_gain_isSet = true;
} }
qint32 qint32
@ -156,6 +183,7 @@ SWGHackRFOutputSettings::getLog2Interp() {
void void
SWGHackRFOutputSettings::setLog2Interp(qint32 log2_interp) { SWGHackRFOutputSettings::setLog2Interp(qint32 log2_interp) {
this->log2_interp = log2_interp; this->log2_interp = log2_interp;
this->m_log2_interp_isSet = true;
} }
qint32 qint32
@ -165,6 +193,7 @@ SWGHackRFOutputSettings::getDevSampleRate() {
void void
SWGHackRFOutputSettings::setDevSampleRate(qint32 dev_sample_rate) { SWGHackRFOutputSettings::setDevSampleRate(qint32 dev_sample_rate) {
this->dev_sample_rate = dev_sample_rate; this->dev_sample_rate = dev_sample_rate;
this->m_dev_sample_rate_isSet = true;
} }
qint32 qint32
@ -174,6 +203,7 @@ SWGHackRFOutputSettings::getBiasT() {
void void
SWGHackRFOutputSettings::setBiasT(qint32 bias_t) { SWGHackRFOutputSettings::setBiasT(qint32 bias_t) {
this->bias_t = bias_t; this->bias_t = bias_t;
this->m_bias_t_isSet = true;
} }
qint32 qint32
@ -183,8 +213,24 @@ SWGHackRFOutputSettings::getLnaExt() {
void void
SWGHackRFOutputSettings::setLnaExt(qint32 lna_ext) { SWGHackRFOutputSettings::setLnaExt(qint32 lna_ext) {
this->lna_ext = lna_ext; this->lna_ext = lna_ext;
this->m_lna_ext_isSet = true;
} }
bool
SWGHackRFOutputSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_vga_gain_isSet){ isObjectUpdated = true; break;}
if(m_log2_interp_isSet){ isObjectUpdated = true; break;}
if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_bias_t_isSet){ isObjectUpdated = true; break;}
if(m_lna_ext_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGHackRFOutputSettings: public SWGObject { class SWGHackRFOutputSettings: public SWGObject {
public: public:
SWGHackRFOutputSettings(); SWGHackRFOutputSettings();
SWGHackRFOutputSettings(QString* json); SWGHackRFOutputSettings(QString json);
virtual ~SWGHackRFOutputSettings(); ~SWGHackRFOutputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGHackRFOutputSettings* fromJson(QString &jsonString); SWGHackRFOutputSettings* fromJson(QString jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);
@ -66,15 +65,33 @@ public:
void setLnaExt(qint32 lna_ext); void setLnaExt(qint32 lna_ext);
virtual bool isSet() override;
private: private:
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 l_oppm_tenths; qint32 l_oppm_tenths;
bool m_l_oppm_tenths_isSet;
qint32 bandwidth; qint32 bandwidth;
bool m_bandwidth_isSet;
qint32 vga_gain; qint32 vga_gain;
bool m_vga_gain_isSet;
qint32 log2_interp; qint32 log2_interp;
bool m_log2_interp_isSet;
qint32 dev_sample_rate; qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 bias_t; qint32 bias_t;
bool m_bias_t_isSet;
qint32 lna_ext; qint32 lna_ext;
bool m_lna_ext_isSet;
}; };
} }

View File

@ -41,7 +41,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
} }
else if(QStringLiteral("float").compare(type) == 0) { else if(QStringLiteral("float").compare(type) == 0) {
float *val = static_cast<float*>(value); float *val = static_cast<float*>(value);
*val = obj.toDouble(); *val = static_cast<float>(obj.toDouble());
} }
else if(QStringLiteral("double").compare(type) == 0) { else if(QStringLiteral("double").compare(type) == 0) {
double *val = static_cast<double*>(value); double *val = static_cast<double*>(value);
@ -49,23 +49,16 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
} }
else if (QStringLiteral("QString").compare(type) == 0) { else if (QStringLiteral("QString").compare(type) == 0) {
QString **val = static_cast<QString**>(value); QString **val = static_cast<QString**>(value);
if(val != nullptr) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return (*val)->clear();
delete *val; (*val)->append(obj.toString());
*val = new QString(obj.toString());
return; return;
} }
else { else {
// set target to nullptr (*val)->clear();
delete *val;
*val = nullptr;
} }
} }
else {
qDebug() << "Can't set value because the target pointer is nullptr";
}
} }
else if (QStringLiteral("QDateTime").compare(type) == 0) { else if (QStringLiteral("QDateTime").compare(type) == 0) {
QDateTime **val = static_cast<QDateTime**>(value); QDateTime **val = static_cast<QDateTime**>(value);
@ -73,13 +66,13 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(val != nullptr) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return // create a new value and return
delete *val; if(*val != nullptr) delete *val;
*val = new QDateTime(QDateTime::fromString(obj.toString(), Qt::ISODate)); *val = new QDateTime(QDateTime::fromString(obj.toString(), Qt::ISODate));
return; return;
} }
else { else {
// set target to nullptr // set target to nullptr
delete *val; if(*val != nullptr) delete *val;
*val = nullptr; *val = nullptr;
} }
} }
@ -93,13 +86,13 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(val != nullptr) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return // create a new value and return
delete *val; if(*val != nullptr) delete *val;
*val = new QDate(QDate::fromString(obj.toString(), Qt::ISODate)); *val = new QDate(QDate::fromString(obj.toString(), Qt::ISODate));
return; return;
} }
else { else {
// set target to nullptr // set target to nullptr
delete *val; if(*val != nullptr) delete *val;
*val = nullptr; *val = nullptr;
} }
} }
@ -113,14 +106,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(val != nullptr) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
// create a new value and return // create a new value and return
delete *val; if(*val != nullptr) delete *val;
*val = new QByteArray(QByteArray::fromBase64(QByteArray::fromStdString(obj.toString().toStdString()))); *val = new QByteArray(QByteArray::fromBase64(QByteArray::fromStdString(obj.toString().toStdString())));
return; return;
} }
else { else {
// set target to nullptr // set target to nullptr
delete *val; if(*val != nullptr) delete *val;
*val = nullptr; *val = nullptr;
} }
} }
@ -131,144 +124,441 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
else if(type.startsWith("SWG") && obj.isObject()) { else if(type.startsWith("SWG") && obj.isObject()) {
// complex type // complex type
QJsonObject jsonObj = obj.toObject(); QJsonObject jsonObj = obj.toObject();
SWGObject * so = (SWGObject*)::SWGSDRangel::create(type); SWGObject * so = (SWGObject*)::SWGSDRangel::create(complexType);
if(so != nullptr) { if(so != nullptr) {
so->fromJsonObject(jsonObj); so->fromJsonObject(jsonObj);
SWGObject **val = static_cast<SWGObject**>(value); SWGObject **val = static_cast<SWGObject**>(value);
delete *val; if(*val != nullptr) delete *val;
*val = so; *val = so;
} }
} }
else if(type.startsWith("QList") && QString("").compare(complexType) != 0 && obj.isArray()) { else if(type.startsWith("QList") && QString("").compare(complexType) != 0 && obj.isArray()) {
// list of values // list of values
QList<void*>* output = new QList<void*>();
QJsonArray arr = obj.toArray();
foreach (const QJsonValue & jval, arr) {
if(complexType.startsWith("SWG")) { if(complexType.startsWith("SWG")) {
// it's an object auto output = reinterpret_cast<QList<SWGObject *> **> (value);
SWGObject * val = (SWGObject*)create(complexType); for (auto item : **output) {
QJsonObject t = jval.toObject(); if(item != nullptr) delete item;
val->fromJsonObject(t);
output->append(val);
} }
else { (*output)->clear();
// primitives QJsonArray arr = obj.toArray();
if(QStringLiteral("qint32").compare(complexType) == 0) { for (const QJsonValue & jval : arr) {
// it's an object
SWGObject * val = (SWGObject*)::SWGSDRangel::create(complexType);
QJsonObject t = jval.toObject();
val->fromJsonObject(t);
(*output)->append(val);
}
}
else if(QStringLiteral("qint32").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<qint32> **> (value);
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
qint32 val; qint32 val;
setValue(&val, jval, QStringLiteral("qint32"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("qint32"), QStringLiteral(""));
output->append((void*)&val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("qint64").compare(complexType) == 0) { else if(QStringLiteral("qint64").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<qint64> **> (value);
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
qint64 val; qint64 val;
setValue(&val, jval, QStringLiteral("qint64"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("qint64"), QStringLiteral(""));
output->append((void*)&val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("bool").compare(complexType) == 0) { else if(QStringLiteral("bool").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<bool> **> (value);
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
bool val; bool val;
setValue(&val, jval, QStringLiteral("bool"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("bool"), QStringLiteral(""));
output->append((void*)&val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("float").compare(complexType) == 0) { else if(QStringLiteral("float").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<float> **> (value);
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
float val; float val;
setValue(&val, jval, QStringLiteral("float"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("float"), QStringLiteral(""));
output->append((void*)&val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("double").compare(complexType) == 0) { else if(QStringLiteral("double").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<double> **> (value);
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
double val; double val;
setValue(&val, jval, QStringLiteral("double"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("double"), QStringLiteral(""));
output->append((void*)&val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("QString").compare(complexType) == 0) { else if(QStringLiteral("QString").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<QString*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
QString * val = new QString(); QString * val = new QString();
setValue(&val, jval, QStringLiteral("QString"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
output->append((void*)val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("QDate").compare(complexType) == 0) { else if(QStringLiteral("QDate").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<QDate*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
QDate * val = new QDate(); QDate * val = new QDate();
setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
output->append((void*)val); (*output)->push_back(val);
}
} }
else if(QStringLiteral("QDateTime").compare(complexType) == 0) { else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
auto output = reinterpret_cast<QList<QDateTime*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
QJsonArray arr = obj.toArray();
for (const QJsonValue & jval : arr){
QDateTime * val = new QDateTime(); QDateTime * val = new QDateTime();
setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral("")); ::SWGSDRangel::setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
output->append((void*)val); (*output)->push_back(val);
}
}
}
else if(type.startsWith("QMap") && QString("").compare(complexType) != 0 && obj.isObject()) {
// list of values
if(complexType.startsWith("SWG")) {
auto output = reinterpret_cast<QMap<QString, SWGObject*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
auto val = (SWGObject*)::SWGSDRangel::create(complexType);
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, complexType, complexType);
(*output)->insert(itemkey, val);
}
}
}
else if(QStringLiteral("qint32").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, qint32> **> (value);
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
qint32 val;
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("qint32"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("qint64").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, qint64> **> (value);
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
qint64 val;
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("qint64"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("bool").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, bool> **> (value);
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
bool val;
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("bool"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("float").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, float> **> (value);
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
float val;
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("float"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("double").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, double> **> (value);
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
double val;
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("double"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("QString").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, QString*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
QString * val = new QString();
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("QString"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("QDate").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, QDate*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
QDate * val = new QDate();
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("QDate"), QStringLiteral(""));
(*output)->insert( itemkey, val);
}
}
}
else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
auto output = reinterpret_cast<QMap<QString, QDateTime*> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
(*output)->clear();
auto varmap = obj.toObject().toVariantMap();
if(varmap.count() > 0){
for(auto itemkey : varmap.keys() ){
QDateTime * val = new QDateTime();
auto jsonval = QJsonValue::fromVariant(varmap.value(itemkey));
::SWGSDRangel::setValue(&val, jsonval, QStringLiteral("QDateTime"), QStringLiteral(""));
(*output)->insert( itemkey, val);
} }
} }
} }
QList<void*> **val = static_cast<QList<void*>**>(value);
delete *val;
*val = output;
} }
} }
void void
toJsonValue(QString name, void* value, QJsonObject* output, QString type) { toJsonValue(QString name, void* value, QJsonObject& output, QString type) {
if(value == nullptr) { if(value == nullptr) {
return; return;
} }
if(type.startsWith("SWG")) { if(type.startsWith("SWG")) {
SWGObject *swgObject = reinterpret_cast<SWGObject *>(value); SWGObject *SWGobject = reinterpret_cast<SWGObject *>(value);
if(swgObject != nullptr) { if(SWGobject != nullptr) {
QJsonObject* o = (*swgObject).asJsonObject(); QJsonObject o = SWGobject->asJsonObject();
if(name != nullptr) { if(!name.isNull()) {
output->insert(name, *o); output.insert(name, o);
delete o;
} }
else { else {
output->empty(); output.empty();
foreach(QString key, o->keys()) { for(QString key : o.keys()) {
output->insert(key, o->value(key)); output.insert(key, o.value(key));
} }
} }
} }
} }
else if(QStringLiteral("QString").compare(type) == 0) { else if(QStringLiteral("QString").compare(type) == 0) {
QString* str = static_cast<QString*>(value); QString* str = static_cast<QString*>(value);
output->insert(name, QJsonValue(*str)); output.insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("qint32").compare(type) == 0) { else if(QStringLiteral("qint32").compare(type) == 0) {
qint32* str = static_cast<qint32*>(value); qint32* str = static_cast<qint32*>(value);
output->insert(name, QJsonValue(*str)); output.insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("qint64").compare(type) == 0) { else if(QStringLiteral("qint64").compare(type) == 0) {
qint64* str = static_cast<qint64*>(value); qint64* str = static_cast<qint64*>(value);
output->insert(name, QJsonValue(*str)); output.insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("bool").compare(type) == 0) { else if(QStringLiteral("bool").compare(type) == 0) {
bool* str = static_cast<bool*>(value); bool* str = static_cast<bool*>(value);
output->insert(name, QJsonValue(*str)); output.insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("float").compare(type) == 0) { else if(QStringLiteral("float").compare(type) == 0) {
float* str = static_cast<float*>(value); float* str = static_cast<float*>(value);
output->insert(name, QJsonValue((double)*str)); output.insert(name, QJsonValue((double)*str));
} }
else if(QStringLiteral("double").compare(type) == 0) { else if(QStringLiteral("double").compare(type) == 0) {
double* str = static_cast<double*>(value); double* str = static_cast<double*>(value);
output->insert(name, QJsonValue(*str)); output.insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("QDate").compare(type) == 0) { else if(QStringLiteral("QDate").compare(type) == 0) {
QDate* date = static_cast<QDate*>(value); QDate* date = static_cast<QDate*>(value);
output->insert(name, QJsonValue(date->toString(Qt::ISODate))); output.insert(name, QJsonValue(date->toString(Qt::ISODate)));
} }
else if(QStringLiteral("QDateTime").compare(type) == 0) { else if(QStringLiteral("QDateTime").compare(type) == 0) {
QDateTime* datetime = static_cast<QDateTime*>(value); QDateTime* datetime = static_cast<QDateTime*>(value);
output->insert(name, QJsonValue(datetime->toString(Qt::ISODate))); output.insert(name, QJsonValue(datetime->toString(Qt::ISODate)));
} }
else if(QStringLiteral("QByteArray").compare(type) == 0) { else if(QStringLiteral("QByteArray").compare(type) == 0) {
QByteArray* byteArray = static_cast<QByteArray*>(value); QByteArray* byteArray = static_cast<QByteArray*>(value);
output->insert(name, QJsonValue(QString(byteArray->toBase64()))); output.insert(name, QJsonValue(QString(byteArray->toBase64())));
} }
} }
void void
toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString innerType) { toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString innerType) {
foreach(void* obj, *value) { if(value == nullptr) {
QJsonObject element; return;
toJsonValue(nullptr, obj, &element, innerType);
output->append(element);
} }
QJsonArray outputarray;
if(innerType.startsWith("SWG")){
for(void* obj : *value) {
SWGObject *SWGobject = reinterpret_cast<SWGObject *>(obj);
if(SWGobject != nullptr) {
outputarray.append(SWGobject->asJsonObject());
}
}
}
else if(QStringLiteral("QString").compare(innerType) == 0) {
for(QString* obj : *(reinterpret_cast<QList<QString*>*>(value))){
outputarray.append(QJsonValue(*obj));
}
}
else if(QStringLiteral("QDate").compare(innerType) == 0) {
for(QDate* obj : *(reinterpret_cast<QList<QDate*>*>(value))){
outputarray.append(QJsonValue(obj->toString(Qt::ISODate)));
}
}
else if(QStringLiteral("QDateTime").compare(innerType) == 0) {
for(QDateTime* obj : *(reinterpret_cast<QList<QDateTime*>*>(value))){
outputarray.append(QJsonValue(obj->toString(Qt::ISODate))); }
}
else if(QStringLiteral("QByteArray").compare(innerType) == 0) {
for(QByteArray* obj : *(reinterpret_cast<QList<QByteArray*>*>(value))){
outputarray.append(QJsonValue(QString(obj->toBase64())));
}
}
else if(QStringLiteral("qint32").compare(innerType) == 0) {
for(qint32 obj : *(reinterpret_cast<QList<qint32>*>(value)))
outputarray.append(QJsonValue(obj));
}
else if(QStringLiteral("qint64").compare(innerType) == 0) {
for(qint64 obj : *(reinterpret_cast<QList<qint64>*>(value)))
outputarray.append(QJsonValue(obj));
}
else if(QStringLiteral("bool").compare(innerType) == 0) {
for(bool obj : *(reinterpret_cast<QList<bool>*>(value)))
outputarray.append(QJsonValue(obj));
}
else if(QStringLiteral("float").compare(innerType) == 0) {
for(float obj : *(reinterpret_cast<QList<float>*>(value)))
outputarray.append(QJsonValue(obj));
}
else if(QStringLiteral("double").compare(innerType) == 0) {
for(double obj : *(reinterpret_cast<QList<double>*>(value)))
outputarray.append(QJsonValue(obj));
}
output.insert(innerName, outputarray);
}
void
toJsonMap(QMap<QString, void*>* value, QJsonObject& output, QString innerName, QString innerType) {
if(value == nullptr) {
return;
}
QJsonObject mapobj;
if(innerType.startsWith("SWG")){
auto items = reinterpret_cast< QMap<QString, SWGObject*> *>(value);
for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey),mapobj, innerType);
}
}
else if(QStringLiteral("QString").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QString*> *>(value);
for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType);
}
}
else if(QStringLiteral("QDate").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QDate*> *>(value);
for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType);
}
}
else if(QStringLiteral("QDateTime").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QDateTime*> *>(value);
for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType);
}
}
else if(QStringLiteral("QByteArray").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QByteArray*> *>(value);
for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType);
}
}
else if(QStringLiteral("qint32").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, qint32> *>(value);
for(auto itemkey: items->keys()) {
auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType);
}
}
else if(QStringLiteral("qint64").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, qint64> *>(value);
for(auto itemkey: items->keys()) {
auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType);
}
}
else if(QStringLiteral("bool").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, bool> *>(value);
for(auto itemkey: items->keys()) {
auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType);
}
}
else if(QStringLiteral("float").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, float> *>(value);
for(auto itemkey: items->keys()) {
auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType);
}
}
else if(QStringLiteral("double").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, double> *>(value);
for(auto itemkey: items->keys() ) {
auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType);
}
}
output.insert(innerName, mapobj);
} }
QString QString

View File

@ -10,16 +10,19 @@
* Do not edit the class manually. * Do not edit the class manually.
*/ */
#ifndef SWGHELPERS_H #ifndef SWG_HELPERS_H
#define SWGHELPERS_H #define SWG_HELPERS_H
#include <QJsonValue> #include <QJsonValue>
#include <QList>
#include <QMap>
namespace SWGSDRangel { namespace SWGSDRangel {
void setValue(void* value, QJsonValue obj, QString type, QString complexType); void setValue(void* value, QJsonValue obj, QString type, QString complexType);
void toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString innerType); void toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString innerType);
void toJsonValue(QString name, void* value, QJsonObject* output, QString type); void toJsonValue(QString name, void* value, QJsonObject& output, QString type);
void toJsonMap(QMap<QString, void*>* value, QJsonObject& output, QString innerName, QString innerType);
bool isCompatibleJsonValue(QString type); bool isCompatibleJsonValue(QString type);
QString stringValue(QString* value); QString stringValue(QString* value);
QString stringValue(qint32 value); QString stringValue(qint32 value);
@ -28,4 +31,4 @@ namespace SWGSDRangel {
} }
#endif // SWGHELPERS_H #endif // SWG_HELPERS_H

View File

@ -20,27 +20,27 @@
namespace SWGSDRangel { namespace SWGSDRangel {
HttpRequestInput::HttpRequestInput() { SWGHttpRequestInput::SWGHttpRequestInput() {
initialize(); initialize();
} }
HttpRequestInput::HttpRequestInput(QString v_url_str, QString v_http_method) { SWGHttpRequestInput::SWGHttpRequestInput(QString v_url_str, QString v_http_method) {
initialize(); initialize();
url_str = v_url_str; url_str = v_url_str;
http_method = v_http_method; http_method = v_http_method;
} }
void HttpRequestInput::initialize() { void SWGHttpRequestInput::initialize() {
var_layout = NOT_SET; var_layout = NOT_SET;
url_str = ""; url_str = "";
http_method = "GET"; http_method = "GET";
} }
void HttpRequestInput::add_var(QString key, QString value) { void SWGHttpRequestInput::add_var(QString key, QString value) {
vars[key] = value; vars[key] = value;
} }
void HttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) { void SWGHttpRequestInput::add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type) {
SWGHttpRequestInputFileElement file; SWGHttpRequestInputFileElement file;
file.variable_name = variable_name; file.variable_name = variable_name;
file.local_filename = local_filename; file.local_filename = local_filename;
@ -50,19 +50,19 @@ void HttpRequestInput::add_file(QString variable_name, QString local_filename, Q
} }
HttpRequestWorker::HttpRequestWorker(QObject *parent) SWGHttpRequestWorker::SWGHttpRequestWorker(QObject *parent)
: QObject(parent), manager(nullptr) : QObject(parent), manager(nullptr)
{ {
qsrand(QDateTime::currentDateTime().toTime_t()); qsrand(QDateTime::currentDateTime().toTime_t());
manager = new QNetworkAccessManager(this); manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_manager_finished(QNetworkReply*))); connect(manager, &QNetworkAccessManager::finished, this, &SWGHttpRequestWorker::on_manager_finished);
} }
HttpRequestWorker::~HttpRequestWorker() { SWGHttpRequestWorker::~SWGHttpRequestWorker() {
} }
QString HttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { QString SWGHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) {
// result structure follows RFC 5987 // result structure follows RFC 5987
bool need_utf_encoding = false; bool need_utf_encoding = false;
QString result = ""; QString result = "";
@ -110,7 +110,7 @@ QString HttpRequestWorker::http_attribute_encode(QString attribute_name, QString
return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8); return QString("%1=\"%2\"; %1*=utf-8''%3").arg(attribute_name, result, result_utf8);
} }
void HttpRequestWorker::execute(HttpRequestInput *input) { void SWGHttpRequestWorker::execute(SWGHttpRequestInput *input) {
// reset variables // reset variables
@ -262,6 +262,9 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
// prepare connection // prepare connection
QNetworkRequest request = QNetworkRequest(QUrl(input->url_str)); QNetworkRequest request = QNetworkRequest(QUrl(input->url_str));
if (SWGHttpRequestWorker::sslDefaultConfiguration != nullptr) {
request.setSslConfiguration(*SWGHttpRequestWorker::sslDefaultConfiguration);
}
request.setRawHeader("User-Agent", "Swagger-Client"); request.setRawHeader("User-Agent", "Swagger-Client");
foreach(QString key, input->headers.keys()) { foreach(QString key, input->headers.keys()) {
request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str()); request.setRawHeader(key.toStdString().c_str(), input->headers.value(key).toStdString().c_str());
@ -307,18 +310,16 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
} }
void HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { void SWGHttpRequestWorker::on_manager_finished(QNetworkReply *reply) {
error_type = reply->error(); error_type = reply->error();
if (error_type == QNetworkReply::NoError) {
response = reply->readAll(); response = reply->readAll();
}
else {
error_str = reply->errorString(); error_str = reply->errorString();
}
reply->deleteLater(); reply->deleteLater();
emit on_execution_finished(this); emit on_execution_finished(this);
} }
QSslConfiguration* SWGHttpRequestWorker::sslDefaultConfiguration;
} }

View File

@ -16,8 +16,8 @@
* *
**/ **/
#ifndef HTTPREQUESTWORKER_H #ifndef SWG_HTTPREQUESTWORKER_H
#define HTTPREQUESTWORKER_H #define SWG_HTTPREQUESTWORKER_H
#include <QObject> #include <QObject>
#include <QString> #include <QString>
@ -25,10 +25,12 @@
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
enum HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART};
namespace SWGSDRangel { namespace SWGSDRangel {
enum SWGHttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART};
class SWGHttpRequestInputFileElement { class SWGHttpRequestInputFileElement {
public: public:
@ -40,19 +42,19 @@ public:
}; };
class HttpRequestInput { class SWGHttpRequestInput {
public: public:
QString url_str; QString url_str;
QString http_method; QString http_method;
HttpRequestVarLayout var_layout; SWGHttpRequestVarLayout var_layout;
QMap<QString, QString> vars; QMap<QString, QString> vars;
QMap<QString, QString> headers; QMap<QString, QString> headers;
QList<SWGHttpRequestInputFileElement> files; QList<SWGHttpRequestInputFileElement> files;
QByteArray request_body; QByteArray request_body;
HttpRequestInput(); SWGHttpRequestInput();
HttpRequestInput(QString v_url_str, QString v_http_method); SWGHttpRequestInput(QString v_url_str, QString v_http_method);
void initialize(); void initialize();
void add_var(QString key, QString value); void add_var(QString key, QString value);
void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type); void add_file(QString variable_name, QString local_filename, QString request_filename, QString mime_type);
@ -60,7 +62,7 @@ public:
}; };
class HttpRequestWorker : public QObject { class SWGHttpRequestWorker : public QObject {
Q_OBJECT Q_OBJECT
public: public:
@ -68,14 +70,15 @@ public:
QNetworkReply::NetworkError error_type; QNetworkReply::NetworkError error_type;
QString error_str; QString error_str;
explicit HttpRequestWorker(QObject *parent = 0); explicit SWGHttpRequestWorker(QObject *parent = 0);
virtual ~HttpRequestWorker(); virtual ~SWGHttpRequestWorker();
QString http_attribute_encode(QString attribute_name, QString input); QString http_attribute_encode(QString attribute_name, QString input);
void execute(HttpRequestInput *input); void execute(SWGHttpRequestInput *input);
static QSslConfiguration* sslDefaultConfiguration;
signals: signals:
void on_execution_finished(HttpRequestWorker *worker); void on_execution_finished(SWGHttpRequestWorker *worker);
private: private:
QNetworkAccessManager *manager; QNetworkAccessManager *manager;
@ -87,4 +90,4 @@ private slots:
} }
#endif // HTTPREQUESTWORKER_H #endif // SWG_HTTPREQUESTWORKER_H

View File

@ -35,8 +35,8 @@ SWGInstanceApi::instanceAudioGet() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -47,7 +47,7 @@ SWGInstanceApi::instanceAudioGet() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceAudioGetCallback); &SWGInstanceApi::instanceAudioGetCallback);
@ -55,7 +55,7 @@ SWGInstanceApi::instanceAudioGet() {
} }
void void
SWGInstanceApi::instanceAudioGetCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceAudioGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -72,19 +72,24 @@ SWGInstanceApi::instanceAudioGetCallback(HttpRequestWorker * worker) {
SWGAudioDevices* output = static_cast<SWGAudioDevices*>(create(json, QString("SWGAudioDevices"))); SWGAudioDevices* output = static_cast<SWGAudioDevices*>(create(json, QString("SWGAudioDevices")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceAudioGetSignal(output); emit instanceAudioGetSignal(output);
} else {
emit instanceAudioGetSignalE(output, error_type, error_str); emit instanceAudioGetSignalE(output, error_type, error_str);
emit instanceAudioGetSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect body) { SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/audio"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/audio");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH"); SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson(); QString output = body.asJson();
@ -97,7 +102,7 @@ SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceAudioPatchCallback); &SWGInstanceApi::instanceAudioPatchCallback);
@ -105,7 +110,7 @@ SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect body) {
} }
void void
SWGInstanceApi::instanceAudioPatchCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceAudioPatchCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -122,8 +127,12 @@ SWGInstanceApi::instanceAudioPatchCallback(HttpRequestWorker * worker) {
SWGAudioDevicesSelect* output = static_cast<SWGAudioDevicesSelect*>(create(json, QString("SWGAudioDevicesSelect"))); SWGAudioDevicesSelect* output = static_cast<SWGAudioDevicesSelect*>(create(json, QString("SWGAudioDevicesSelect")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceAudioPatchSignal(output); emit instanceAudioPatchSignal(output);
} else {
emit instanceAudioPatchSignalE(output, error_type, error_str); emit instanceAudioPatchSignalE(output, error_type, error_str);
emit instanceAudioPatchSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -141,8 +150,8 @@ SWGInstanceApi::instanceChannels(qint32 tx) {
.append(QUrl::toPercentEncoding(stringValue(tx))); .append(QUrl::toPercentEncoding(stringValue(tx)));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -153,7 +162,7 @@ SWGInstanceApi::instanceChannels(qint32 tx) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceChannelsCallback); &SWGInstanceApi::instanceChannelsCallback);
@ -161,7 +170,7 @@ SWGInstanceApi::instanceChannels(qint32 tx) {
} }
void void
SWGInstanceApi::instanceChannelsCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceChannelsCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -178,8 +187,12 @@ SWGInstanceApi::instanceChannelsCallback(HttpRequestWorker * worker) {
SWGInstanceChannelsResponse* output = static_cast<SWGInstanceChannelsResponse*>(create(json, QString("SWGInstanceChannelsResponse"))); SWGInstanceChannelsResponse* output = static_cast<SWGInstanceChannelsResponse*>(create(json, QString("SWGInstanceChannelsResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceChannelsSignal(output); emit instanceChannelsSignal(output);
} else {
emit instanceChannelsSignalE(output, error_type, error_str); emit instanceChannelsSignalE(output, error_type, error_str);
emit instanceChannelsSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -197,8 +210,8 @@ SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) {
.append(QUrl::toPercentEncoding(stringValue(dvserial))); .append(QUrl::toPercentEncoding(stringValue(dvserial)));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH"); SWGHttpRequestInput input(fullPath, "PATCH");
@ -209,7 +222,7 @@ SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceDVSerialPatchCallback); &SWGInstanceApi::instanceDVSerialPatchCallback);
@ -217,7 +230,7 @@ SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) {
} }
void void
SWGInstanceApi::instanceDVSerialPatchCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceDVSerialPatchCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -234,8 +247,12 @@ SWGInstanceApi::instanceDVSerialPatchCallback(HttpRequestWorker * worker) {
SWGDVSeralDevices* output = static_cast<SWGDVSeralDevices*>(create(json, QString("SWGDVSeralDevices"))); SWGDVSeralDevices* output = static_cast<SWGDVSeralDevices*>(create(json, QString("SWGDVSeralDevices")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDVSerialPatchSignal(output); emit instanceDVSerialPatchSignal(output);
} else {
emit instanceDVSerialPatchSignalE(output, error_type, error_str); emit instanceDVSerialPatchSignalE(output, error_type, error_str);
emit instanceDVSerialPatchSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -245,8 +262,8 @@ SWGInstanceApi::instanceDelete() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE"); SWGHttpRequestInput input(fullPath, "DELETE");
@ -257,7 +274,7 @@ SWGInstanceApi::instanceDelete() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceDeleteCallback); &SWGInstanceApi::instanceDeleteCallback);
@ -265,7 +282,7 @@ SWGInstanceApi::instanceDelete() {
} }
void void
SWGInstanceApi::instanceDeleteCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -282,8 +299,12 @@ SWGInstanceApi::instanceDeleteCallback(HttpRequestWorker * worker) {
SWGInstanceSummaryResponse* output = static_cast<SWGInstanceSummaryResponse*>(create(json, QString("SWGInstanceSummaryResponse"))); SWGInstanceSummaryResponse* output = static_cast<SWGInstanceSummaryResponse*>(create(json, QString("SWGInstanceSummaryResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeleteSignal(output); emit instanceDeleteSignal(output);
} else {
emit instanceDeleteSignalE(output, error_type, error_str); emit instanceDeleteSignalE(output, error_type, error_str);
emit instanceDeleteSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -293,8 +314,8 @@ SWGInstanceApi::instanceDeviceSetsGet() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -305,7 +326,7 @@ SWGInstanceApi::instanceDeviceSetsGet() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceDeviceSetsGetCallback); &SWGInstanceApi::instanceDeviceSetsGetCallback);
@ -313,7 +334,7 @@ SWGInstanceApi::instanceDeviceSetsGet() {
} }
void void
SWGInstanceApi::instanceDeviceSetsGetCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceDeviceSetsGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -330,8 +351,12 @@ SWGInstanceApi::instanceDeviceSetsGetCallback(HttpRequestWorker * worker) {
SWGDeviceSetList* output = static_cast<SWGDeviceSetList*>(create(json, QString("SWGDeviceSetList"))); SWGDeviceSetList* output = static_cast<SWGDeviceSetList*>(create(json, QString("SWGDeviceSetList")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeviceSetsGetSignal(output); emit instanceDeviceSetsGetSignal(output);
} else {
emit instanceDeviceSetsGetSignalE(output, error_type, error_str); emit instanceDeviceSetsGetSignalE(output, error_type, error_str);
emit instanceDeviceSetsGetSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -349,8 +374,8 @@ SWGInstanceApi::instanceDevices(qint32 tx) {
.append(QUrl::toPercentEncoding(stringValue(tx))); .append(QUrl::toPercentEncoding(stringValue(tx)));
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -361,7 +386,7 @@ SWGInstanceApi::instanceDevices(qint32 tx) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceDevicesCallback); &SWGInstanceApi::instanceDevicesCallback);
@ -369,7 +394,7 @@ SWGInstanceApi::instanceDevices(qint32 tx) {
} }
void void
SWGInstanceApi::instanceDevicesCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceDevicesCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -386,8 +411,12 @@ SWGInstanceApi::instanceDevicesCallback(HttpRequestWorker * worker) {
SWGInstanceDevicesResponse* output = static_cast<SWGInstanceDevicesResponse*>(create(json, QString("SWGInstanceDevicesResponse"))); SWGInstanceDevicesResponse* output = static_cast<SWGInstanceDevicesResponse*>(create(json, QString("SWGInstanceDevicesResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDevicesSignal(output); emit instanceDevicesSignal(output);
} else {
emit instanceDevicesSignalE(output, error_type, error_str); emit instanceDevicesSignalE(output, error_type, error_str);
emit instanceDevicesSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -397,8 +426,8 @@ SWGInstanceApi::instanceLocationGet() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -409,7 +438,7 @@ SWGInstanceApi::instanceLocationGet() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceLocationGetCallback); &SWGInstanceApi::instanceLocationGetCallback);
@ -417,7 +446,7 @@ SWGInstanceApi::instanceLocationGet() {
} }
void void
SWGInstanceApi::instanceLocationGetCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceLocationGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -434,19 +463,24 @@ SWGInstanceApi::instanceLocationGetCallback(HttpRequestWorker * worker) {
SWGLocationInformation* output = static_cast<SWGLocationInformation*>(create(json, QString("SWGLocationInformation"))); SWGLocationInformation* output = static_cast<SWGLocationInformation*>(create(json, QString("SWGLocationInformation")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLocationGetSignal(output); emit instanceLocationGetSignal(output);
} else {
emit instanceLocationGetSignalE(output, error_type, error_str); emit instanceLocationGetSignalE(output, error_type, error_str);
emit instanceLocationGetSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instanceLocationPut(SWGLocationInformation body) { SWGInstanceApi::instanceLocationPut(SWGLocationInformation& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/location"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/location");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -459,7 +493,7 @@ SWGInstanceApi::instanceLocationPut(SWGLocationInformation body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceLocationPutCallback); &SWGInstanceApi::instanceLocationPutCallback);
@ -467,7 +501,7 @@ SWGInstanceApi::instanceLocationPut(SWGLocationInformation body) {
} }
void void
SWGInstanceApi::instanceLocationPutCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceLocationPutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -484,8 +518,12 @@ SWGInstanceApi::instanceLocationPutCallback(HttpRequestWorker * worker) {
SWGLocationInformation* output = static_cast<SWGLocationInformation*>(create(json, QString("SWGLocationInformation"))); SWGLocationInformation* output = static_cast<SWGLocationInformation*>(create(json, QString("SWGLocationInformation")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLocationPutSignal(output); emit instanceLocationPutSignal(output);
} else {
emit instanceLocationPutSignalE(output, error_type, error_str); emit instanceLocationPutSignalE(output, error_type, error_str);
emit instanceLocationPutSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -495,8 +533,8 @@ SWGInstanceApi::instanceLoggingGet() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -507,7 +545,7 @@ SWGInstanceApi::instanceLoggingGet() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceLoggingGetCallback); &SWGInstanceApi::instanceLoggingGetCallback);
@ -515,7 +553,7 @@ SWGInstanceApi::instanceLoggingGet() {
} }
void void
SWGInstanceApi::instanceLoggingGetCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceLoggingGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -532,19 +570,24 @@ SWGInstanceApi::instanceLoggingGetCallback(HttpRequestWorker * worker) {
SWGLoggingInfo* output = static_cast<SWGLoggingInfo*>(create(json, QString("SWGLoggingInfo"))); SWGLoggingInfo* output = static_cast<SWGLoggingInfo*>(create(json, QString("SWGLoggingInfo")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLoggingGetSignal(output); emit instanceLoggingGetSignal(output);
} else {
emit instanceLoggingGetSignalE(output, error_type, error_str); emit instanceLoggingGetSignalE(output, error_type, error_str);
emit instanceLoggingGetSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo body) { SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/logging"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/logging");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -557,7 +600,7 @@ SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceLoggingPutCallback); &SWGInstanceApi::instanceLoggingPutCallback);
@ -565,7 +608,7 @@ SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo body) {
} }
void void
SWGInstanceApi::instanceLoggingPutCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceLoggingPutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -582,19 +625,24 @@ SWGInstanceApi::instanceLoggingPutCallback(HttpRequestWorker * worker) {
SWGLoggingInfo* output = static_cast<SWGLoggingInfo*>(create(json, QString("SWGLoggingInfo"))); SWGLoggingInfo* output = static_cast<SWGLoggingInfo*>(create(json, QString("SWGLoggingInfo")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLoggingPutSignal(output); emit instanceLoggingPutSignal(output);
} else {
emit instanceLoggingPutSignalE(output, error_type, error_str); emit instanceLoggingPutSignalE(output, error_type, error_str);
emit instanceLoggingPutSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier body) { SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE"); SWGHttpRequestInput input(fullPath, "DELETE");
QString output = body.asJson(); QString output = body.asJson();
@ -607,7 +655,7 @@ SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetDeleteCallback); &SWGInstanceApi::instancePresetDeleteCallback);
@ -615,7 +663,7 @@ SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier body) {
} }
void void
SWGInstanceApi::instancePresetDeleteCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -632,19 +680,24 @@ SWGInstanceApi::instancePresetDeleteCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier"))); SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetDeleteSignal(output); emit instancePresetDeleteSignal(output);
} else {
emit instancePresetDeleteSignalE(output, error_type, error_str); emit instancePresetDeleteSignalE(output, error_type, error_str);
emit instancePresetDeleteSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instancePresetFilePost(SWGPresetExport body) { SWGInstanceApi::instancePresetFilePost(SWGPresetExport& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "POST"); SWGHttpRequestInput input(fullPath, "POST");
QString output = body.asJson(); QString output = body.asJson();
@ -657,7 +710,7 @@ SWGInstanceApi::instancePresetFilePost(SWGPresetExport body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetFilePostCallback); &SWGInstanceApi::instancePresetFilePostCallback);
@ -665,7 +718,7 @@ SWGInstanceApi::instancePresetFilePost(SWGPresetExport body) {
} }
void void
SWGInstanceApi::instancePresetFilePostCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetFilePostCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -682,19 +735,24 @@ SWGInstanceApi::instancePresetFilePostCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier"))); SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetFilePostSignal(output); emit instancePresetFilePostSignal(output);
} else {
emit instancePresetFilePostSignalE(output, error_type, error_str); emit instancePresetFilePostSignalE(output, error_type, error_str);
emit instancePresetFilePostSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instancePresetFilePut(SWGPresetImport body) { SWGInstanceApi::instancePresetFilePut(SWGPresetImport& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -707,7 +765,7 @@ SWGInstanceApi::instancePresetFilePut(SWGPresetImport body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetFilePutCallback); &SWGInstanceApi::instancePresetFilePutCallback);
@ -715,7 +773,7 @@ SWGInstanceApi::instancePresetFilePut(SWGPresetImport body) {
} }
void void
SWGInstanceApi::instancePresetFilePutCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetFilePutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -732,8 +790,12 @@ SWGInstanceApi::instancePresetFilePutCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier"))); SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetFilePutSignal(output); emit instancePresetFilePutSignal(output);
} else {
emit instancePresetFilePutSignalE(output, error_type, error_str); emit instancePresetFilePutSignalE(output, error_type, error_str);
emit instancePresetFilePutSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -743,8 +805,8 @@ SWGInstanceApi::instancePresetGet() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -755,7 +817,7 @@ SWGInstanceApi::instancePresetGet() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetGetCallback); &SWGInstanceApi::instancePresetGetCallback);
@ -763,7 +825,7 @@ SWGInstanceApi::instancePresetGet() {
} }
void void
SWGInstanceApi::instancePresetGetCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetGetCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -780,19 +842,24 @@ SWGInstanceApi::instancePresetGetCallback(HttpRequestWorker * worker) {
SWGPresets* output = static_cast<SWGPresets*>(create(json, QString("SWGPresets"))); SWGPresets* output = static_cast<SWGPresets*>(create(json, QString("SWGPresets")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetGetSignal(output); emit instancePresetGetSignal(output);
} else {
emit instancePresetGetSignalE(output, error_type, error_str); emit instancePresetGetSignalE(output, error_type, error_str);
emit instancePresetGetSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instancePresetPatch(SWGPresetTransfer body) { SWGInstanceApi::instancePresetPatch(SWGPresetTransfer& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH"); SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson(); QString output = body.asJson();
@ -805,7 +872,7 @@ SWGInstanceApi::instancePresetPatch(SWGPresetTransfer body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetPatchCallback); &SWGInstanceApi::instancePresetPatchCallback);
@ -813,7 +880,7 @@ SWGInstanceApi::instancePresetPatch(SWGPresetTransfer body) {
} }
void void
SWGInstanceApi::instancePresetPatchCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetPatchCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -830,19 +897,24 @@ SWGInstanceApi::instancePresetPatchCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier"))); SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetPatchSignal(output); emit instancePresetPatchSignal(output);
} else {
emit instancePresetPatchSignalE(output, error_type, error_str); emit instancePresetPatchSignalE(output, error_type, error_str);
emit instancePresetPatchSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instancePresetPost(SWGPresetTransfer body) { SWGInstanceApi::instancePresetPost(SWGPresetTransfer& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "POST"); SWGHttpRequestInput input(fullPath, "POST");
QString output = body.asJson(); QString output = body.asJson();
@ -855,7 +927,7 @@ SWGInstanceApi::instancePresetPost(SWGPresetTransfer body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetPostCallback); &SWGInstanceApi::instancePresetPostCallback);
@ -863,7 +935,7 @@ SWGInstanceApi::instancePresetPost(SWGPresetTransfer body) {
} }
void void
SWGInstanceApi::instancePresetPostCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetPostCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -880,19 +952,24 @@ SWGInstanceApi::instancePresetPostCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier"))); SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetPostSignal(output); emit instancePresetPostSignal(output);
} else {
emit instancePresetPostSignalE(output, error_type, error_str); emit instancePresetPostSignalE(output, error_type, error_str);
emit instancePresetPostSignalEFull(worker, error_type, error_str);
}
} }
void void
SWGInstanceApi::instancePresetPut(SWGPresetTransfer body) { SWGInstanceApi::instancePresetPut(SWGPresetTransfer& body) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset"); fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "PUT"); SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson(); QString output = body.asJson();
@ -905,7 +982,7 @@ SWGInstanceApi::instancePresetPut(SWGPresetTransfer body) {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instancePresetPutCallback); &SWGInstanceApi::instancePresetPutCallback);
@ -913,7 +990,7 @@ SWGInstanceApi::instancePresetPut(SWGPresetTransfer body) {
} }
void void
SWGInstanceApi::instancePresetPutCallback(HttpRequestWorker * worker) { SWGInstanceApi::instancePresetPutCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -930,8 +1007,12 @@ SWGInstanceApi::instancePresetPutCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier"))); SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetPutSignal(output); emit instancePresetPutSignal(output);
} else {
emit instancePresetPutSignalE(output, error_type, error_str); emit instancePresetPutSignalE(output, error_type, error_str);
emit instancePresetPutSignalEFull(worker, error_type, error_str);
}
} }
void void
@ -941,8 +1022,8 @@ SWGInstanceApi::instanceSummary() {
HttpRequestWorker *worker = new HttpRequestWorker(); SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
HttpRequestInput input(fullPath, "GET"); SWGHttpRequestInput input(fullPath, "GET");
@ -953,7 +1034,7 @@ SWGInstanceApi::instanceSummary() {
} }
connect(worker, connect(worker,
&HttpRequestWorker::on_execution_finished, &SWGHttpRequestWorker::on_execution_finished,
this, this,
&SWGInstanceApi::instanceSummaryCallback); &SWGInstanceApi::instanceSummaryCallback);
@ -961,7 +1042,7 @@ SWGInstanceApi::instanceSummary() {
} }
void void
SWGInstanceApi::instanceSummaryCallback(HttpRequestWorker * worker) { SWGInstanceApi::instanceSummaryCallback(SWGHttpRequestWorker * worker) {
QString msg; QString msg;
QString error_str = worker->error_str; QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type; QNetworkReply::NetworkError error_type = worker->error_type;
@ -978,8 +1059,12 @@ SWGInstanceApi::instanceSummaryCallback(HttpRequestWorker * worker) {
SWGInstanceSummaryResponse* output = static_cast<SWGInstanceSummaryResponse*>(create(json, QString("SWGInstanceSummaryResponse"))); SWGInstanceSummaryResponse* output = static_cast<SWGInstanceSummaryResponse*>(create(json, QString("SWGInstanceSummaryResponse")));
worker->deleteLater(); worker->deleteLater();
if (worker->error_type == QNetworkReply::NoError) {
emit instanceSummarySignal(output); emit instanceSummarySignal(output);
} else {
emit instanceSummarySignalE(output, error_type, error_str); emit instanceSummarySignalE(output, error_type, error_str);
emit instanceSummarySignalEFull(worker, error_type, error_str);
}
} }

View File

@ -48,45 +48,45 @@ public:
QMap<QString, QString> defaultHeaders; QMap<QString, QString> defaultHeaders;
void instanceAudioGet(); void instanceAudioGet();
void instanceAudioPatch(SWGAudioDevicesSelect body); void instanceAudioPatch(SWGAudioDevicesSelect& body);
void instanceChannels(qint32 tx); void instanceChannels(qint32 tx);
void instanceDVSerialPatch(qint32 dvserial); void instanceDVSerialPatch(qint32 dvserial);
void instanceDelete(); void instanceDelete();
void instanceDeviceSetsGet(); void instanceDeviceSetsGet();
void instanceDevices(qint32 tx); void instanceDevices(qint32 tx);
void instanceLocationGet(); void instanceLocationGet();
void instanceLocationPut(SWGLocationInformation body); void instanceLocationPut(SWGLocationInformation& body);
void instanceLoggingGet(); void instanceLoggingGet();
void instanceLoggingPut(SWGLoggingInfo body); void instanceLoggingPut(SWGLoggingInfo& body);
void instancePresetDelete(SWGPresetIdentifier body); void instancePresetDelete(SWGPresetIdentifier& body);
void instancePresetFilePost(SWGPresetExport body); void instancePresetFilePost(SWGPresetExport& body);
void instancePresetFilePut(SWGPresetImport body); void instancePresetFilePut(SWGPresetImport& body);
void instancePresetGet(); void instancePresetGet();
void instancePresetPatch(SWGPresetTransfer body); void instancePresetPatch(SWGPresetTransfer& body);
void instancePresetPost(SWGPresetTransfer body); void instancePresetPost(SWGPresetTransfer& body);
void instancePresetPut(SWGPresetTransfer body); void instancePresetPut(SWGPresetTransfer& body);
void instanceSummary(); void instanceSummary();
private: private:
void instanceAudioGetCallback (HttpRequestWorker * worker); void instanceAudioGetCallback (SWGHttpRequestWorker * worker);
void instanceAudioPatchCallback (HttpRequestWorker * worker); void instanceAudioPatchCallback (SWGHttpRequestWorker * worker);
void instanceChannelsCallback (HttpRequestWorker * worker); void instanceChannelsCallback (SWGHttpRequestWorker * worker);
void instanceDVSerialPatchCallback (HttpRequestWorker * worker); void instanceDVSerialPatchCallback (SWGHttpRequestWorker * worker);
void instanceDeleteCallback (HttpRequestWorker * worker); void instanceDeleteCallback (SWGHttpRequestWorker * worker);
void instanceDeviceSetsGetCallback (HttpRequestWorker * worker); void instanceDeviceSetsGetCallback (SWGHttpRequestWorker * worker);
void instanceDevicesCallback (HttpRequestWorker * worker); void instanceDevicesCallback (SWGHttpRequestWorker * worker);
void instanceLocationGetCallback (HttpRequestWorker * worker); void instanceLocationGetCallback (SWGHttpRequestWorker * worker);
void instanceLocationPutCallback (HttpRequestWorker * worker); void instanceLocationPutCallback (SWGHttpRequestWorker * worker);
void instanceLoggingGetCallback (HttpRequestWorker * worker); void instanceLoggingGetCallback (SWGHttpRequestWorker * worker);
void instanceLoggingPutCallback (HttpRequestWorker * worker); void instanceLoggingPutCallback (SWGHttpRequestWorker * worker);
void instancePresetDeleteCallback (HttpRequestWorker * worker); void instancePresetDeleteCallback (SWGHttpRequestWorker * worker);
void instancePresetFilePostCallback (HttpRequestWorker * worker); void instancePresetFilePostCallback (SWGHttpRequestWorker * worker);
void instancePresetFilePutCallback (HttpRequestWorker * worker); void instancePresetFilePutCallback (SWGHttpRequestWorker * worker);
void instancePresetGetCallback (HttpRequestWorker * worker); void instancePresetGetCallback (SWGHttpRequestWorker * worker);
void instancePresetPatchCallback (HttpRequestWorker * worker); void instancePresetPatchCallback (SWGHttpRequestWorker * worker);
void instancePresetPostCallback (HttpRequestWorker * worker); void instancePresetPostCallback (SWGHttpRequestWorker * worker);
void instancePresetPutCallback (HttpRequestWorker * worker); void instancePresetPutCallback (SWGHttpRequestWorker * worker);
void instanceSummaryCallback (HttpRequestWorker * worker); void instanceSummaryCallback (SWGHttpRequestWorker * worker);
signals: signals:
void instanceAudioGetSignal(SWGAudioDevices* summary); void instanceAudioGetSignal(SWGAudioDevices* summary);
@ -129,6 +129,26 @@ signals:
void instancePresetPutSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instancePresetPutSignalE(SWGPresetIdentifier* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceSummarySignalE(SWGInstanceSummaryResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); void instanceSummarySignalE(SWGInstanceSummaryResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceAudioGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceAudioPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceChannelsSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDVSerialPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDeviceSetsGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceDevicesSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLocationGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLocationPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLoggingGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceLoggingPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetDeleteSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetFilePostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetFilePutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetGetSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetPatchSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetPostSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instancePresetPutSignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
void instanceSummarySignalEFull(SWGHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str);
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse(QString* json) { SWGInstanceChannelsResponse::SWGInstanceChannelsResponse(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse() { SWGInstanceChannelsResponse::SWGInstanceChannelsResponse() {
@ -38,16 +38,17 @@ SWGInstanceChannelsResponse::~SWGInstanceChannelsResponse() {
void void
SWGInstanceChannelsResponse::init() { SWGInstanceChannelsResponse::init() {
channelcount = 0; channelcount = 0;
m_channelcount_isSet = false;
channels = new QList<SWGChannelListItem*>(); channels = new QList<SWGChannelListItem*>();
m_channels_isSet = false;
} }
void void
SWGInstanceChannelsResponse::cleanup() { SWGInstanceChannelsResponse::cleanup() {
if(channels != nullptr) { if(channels != nullptr) {
QList<SWGChannelListItem*>* arr = channels; auto arr = channels;
foreach(SWGChannelListItem* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete channels; delete channels;
@ -55,7 +56,7 @@ SWGInstanceChannelsResponse::cleanup() {
} }
SWGInstanceChannelsResponse* SWGInstanceChannelsResponse*
SWGInstanceChannelsResponse::fromJson(QString &json) { SWGInstanceChannelsResponse::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -64,32 +65,31 @@ SWGInstanceChannelsResponse::fromJson(QString &json) {
} }
void void
SWGInstanceChannelsResponse::fromJsonObject(QJsonObject &pJson) { SWGInstanceChannelsResponse::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", ""); ::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannelListItem");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannelListItem");
} }
QString QString
SWGInstanceChannelsResponse::asJson () SWGInstanceChannelsResponse::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGInstanceChannelsResponse::asJsonObject() { SWGInstanceChannelsResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_channelcount_isSet){
obj->insert("channelcount", QJsonValue(channelcount)); obj.insert("channelcount", QJsonValue(channelcount));
}
QJsonArray channelsJsonArray; if(channels->size() > 0){
toJsonArray((QList<void*>*)channels, &channelsJsonArray, "channels", "SWGChannelListItem"); toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannelListItem");
obj->insert("channels", channelsJsonArray); }
return obj; return obj;
} }
@ -101,6 +101,7 @@ SWGInstanceChannelsResponse::getChannelcount() {
void void
SWGInstanceChannelsResponse::setChannelcount(qint32 channelcount) { SWGInstanceChannelsResponse::setChannelcount(qint32 channelcount) {
this->channelcount = channelcount; this->channelcount = channelcount;
this->m_channelcount_isSet = true;
} }
QList<SWGChannelListItem*>* QList<SWGChannelListItem*>*
@ -110,8 +111,18 @@ SWGInstanceChannelsResponse::getChannels() {
void void
SWGInstanceChannelsResponse::setChannels(QList<SWGChannelListItem*>* channels) { SWGInstanceChannelsResponse::setChannels(QList<SWGChannelListItem*>* channels) {
this->channels = channels; this->channels = channels;
this->m_channels_isSet = true;
} }
bool
SWGInstanceChannelsResponse::isSet(){
bool isObjectUpdated = false;
do{
if(m_channelcount_isSet){ isObjectUpdated = true; break;}
if(channels->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGInstanceChannelsResponse: public SWGObject { class SWGInstanceChannelsResponse: public SWGObject {
public: public:
SWGInstanceChannelsResponse(); SWGInstanceChannelsResponse();
SWGInstanceChannelsResponse(QString* json); SWGInstanceChannelsResponse(QString json);
virtual ~SWGInstanceChannelsResponse(); ~SWGInstanceChannelsResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGInstanceChannelsResponse* fromJson(QString &jsonString); SWGInstanceChannelsResponse* fromJson(QString jsonString);
qint32 getChannelcount(); qint32 getChannelcount();
void setChannelcount(qint32 channelcount); void setChannelcount(qint32 channelcount);
@ -50,9 +49,15 @@ public:
void setChannels(QList<SWGChannelListItem*>* channels); void setChannels(QList<SWGChannelListItem*>* channels);
virtual bool isSet() override;
private: private:
qint32 channelcount; qint32 channelcount;
bool m_channelcount_isSet;
QList<SWGChannelListItem*>* channels; QList<SWGChannelListItem*>* channels;
bool m_channels_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGInstanceDevicesResponse::SWGInstanceDevicesResponse(QString* json) { SWGInstanceDevicesResponse::SWGInstanceDevicesResponse(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGInstanceDevicesResponse::SWGInstanceDevicesResponse() { SWGInstanceDevicesResponse::SWGInstanceDevicesResponse() {
@ -38,16 +38,17 @@ SWGInstanceDevicesResponse::~SWGInstanceDevicesResponse() {
void void
SWGInstanceDevicesResponse::init() { SWGInstanceDevicesResponse::init() {
devicecount = 0; devicecount = 0;
m_devicecount_isSet = false;
devices = new QList<SWGDeviceListItem*>(); devices = new QList<SWGDeviceListItem*>();
m_devices_isSet = false;
} }
void void
SWGInstanceDevicesResponse::cleanup() { SWGInstanceDevicesResponse::cleanup() {
if(devices != nullptr) { if(devices != nullptr) {
QList<SWGDeviceListItem*>* arr = devices; auto arr = devices;
foreach(SWGDeviceListItem* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete devices; delete devices;
@ -55,7 +56,7 @@ SWGInstanceDevicesResponse::cleanup() {
} }
SWGInstanceDevicesResponse* SWGInstanceDevicesResponse*
SWGInstanceDevicesResponse::fromJson(QString &json) { SWGInstanceDevicesResponse::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -64,32 +65,31 @@ SWGInstanceDevicesResponse::fromJson(QString &json) {
} }
void void
SWGInstanceDevicesResponse::fromJsonObject(QJsonObject &pJson) { SWGInstanceDevicesResponse::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&devicecount, pJson["devicecount"], "qint32", ""); ::SWGSDRangel::setValue(&devicecount, pJson["devicecount"], "qint32", "");
::SWGSDRangel::setValue(&devices, pJson["devices"], "QList", "SWGDeviceListItem");
::SWGSDRangel::setValue(&devices, pJson["devices"], "QList", "SWGDeviceListItem");
} }
QString QString
SWGInstanceDevicesResponse::asJson () SWGInstanceDevicesResponse::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGInstanceDevicesResponse::asJsonObject() { SWGInstanceDevicesResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_devicecount_isSet){
obj->insert("devicecount", QJsonValue(devicecount)); obj.insert("devicecount", QJsonValue(devicecount));
}
QJsonArray devicesJsonArray; if(devices->size() > 0){
toJsonArray((QList<void*>*)devices, &devicesJsonArray, "devices", "SWGDeviceListItem"); toJsonArray((QList<void*>*)devices, obj, "devices", "SWGDeviceListItem");
obj->insert("devices", devicesJsonArray); }
return obj; return obj;
} }
@ -101,6 +101,7 @@ SWGInstanceDevicesResponse::getDevicecount() {
void void
SWGInstanceDevicesResponse::setDevicecount(qint32 devicecount) { SWGInstanceDevicesResponse::setDevicecount(qint32 devicecount) {
this->devicecount = devicecount; this->devicecount = devicecount;
this->m_devicecount_isSet = true;
} }
QList<SWGDeviceListItem*>* QList<SWGDeviceListItem*>*
@ -110,8 +111,18 @@ SWGInstanceDevicesResponse::getDevices() {
void void
SWGInstanceDevicesResponse::setDevices(QList<SWGDeviceListItem*>* devices) { SWGInstanceDevicesResponse::setDevices(QList<SWGDeviceListItem*>* devices) {
this->devices = devices; this->devices = devices;
this->m_devices_isSet = true;
} }
bool
SWGInstanceDevicesResponse::isSet(){
bool isObjectUpdated = false;
do{
if(m_devicecount_isSet){ isObjectUpdated = true; break;}
if(devices->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGInstanceDevicesResponse: public SWGObject { class SWGInstanceDevicesResponse: public SWGObject {
public: public:
SWGInstanceDevicesResponse(); SWGInstanceDevicesResponse();
SWGInstanceDevicesResponse(QString* json); SWGInstanceDevicesResponse(QString json);
virtual ~SWGInstanceDevicesResponse(); ~SWGInstanceDevicesResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGInstanceDevicesResponse* fromJson(QString &jsonString); SWGInstanceDevicesResponse* fromJson(QString jsonString);
qint32 getDevicecount(); qint32 getDevicecount();
void setDevicecount(qint32 devicecount); void setDevicecount(qint32 devicecount);
@ -50,9 +49,15 @@ public:
void setDevices(QList<SWGDeviceListItem*>* devices); void setDevices(QList<SWGDeviceListItem*>* devices);
virtual bool isSet() override;
private: private:
qint32 devicecount; qint32 devicecount;
bool m_devicecount_isSet;
QList<SWGDeviceListItem*>* devices; QList<SWGDeviceListItem*>* devices;
bool m_devices_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGInstanceSummaryResponse::SWGInstanceSummaryResponse(QString* json) { SWGInstanceSummaryResponse::SWGInstanceSummaryResponse(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGInstanceSummaryResponse::SWGInstanceSummaryResponse() { SWGInstanceSummaryResponse::SWGInstanceSummaryResponse() {
@ -38,54 +38,57 @@ SWGInstanceSummaryResponse::~SWGInstanceSummaryResponse() {
void void
SWGInstanceSummaryResponse::init() { SWGInstanceSummaryResponse::init() {
version = new QString(""); version = new QString("");
m_version_isSet = false;
qt_version = new QString(""); qt_version = new QString("");
m_qt_version_isSet = false;
dsp_rx_bits = 0; dsp_rx_bits = 0;
m_dsp_rx_bits_isSet = false;
dsp_tx_bits = 0; dsp_tx_bits = 0;
m_dsp_tx_bits_isSet = false;
pid = 0; pid = 0;
m_pid_isSet = false;
appname = new QString(""); appname = new QString("");
m_appname_isSet = false;
architecture = new QString(""); architecture = new QString("");
m_architecture_isSet = false;
os = new QString(""); os = new QString("");
m_os_isSet = false;
logging = new SWGLoggingInfo(); logging = new SWGLoggingInfo();
m_logging_isSet = false;
devicesetlist = new SWGDeviceSetList(); devicesetlist = new SWGDeviceSetList();
m_devicesetlist_isSet = false;
} }
void void
SWGInstanceSummaryResponse::cleanup() { SWGInstanceSummaryResponse::cleanup() {
if(version != nullptr) { if(version != nullptr) {
delete version; delete version;
} }
if(qt_version != nullptr) { if(qt_version != nullptr) {
delete qt_version; delete qt_version;
} }
if(appname != nullptr) { if(appname != nullptr) {
delete appname; delete appname;
} }
if(architecture != nullptr) { if(architecture != nullptr) {
delete architecture; delete architecture;
} }
if(os != nullptr) { if(os != nullptr) {
delete os; delete os;
} }
if(logging != nullptr) { if(logging != nullptr) {
delete logging; delete logging;
} }
if(devicesetlist != nullptr) { if(devicesetlist != nullptr) {
delete devicesetlist; delete devicesetlist;
} }
} }
SWGInstanceSummaryResponse* SWGInstanceSummaryResponse*
SWGInstanceSummaryResponse::fromJson(QString &json) { SWGInstanceSummaryResponse::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -94,52 +97,71 @@ SWGInstanceSummaryResponse::fromJson(QString &json) {
} }
void void
SWGInstanceSummaryResponse::fromJsonObject(QJsonObject &pJson) { SWGInstanceSummaryResponse::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString"); ::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString");
::SWGSDRangel::setValue(&qt_version, pJson["qtVersion"], "QString", "QString"); ::SWGSDRangel::setValue(&qt_version, pJson["qtVersion"], "QString", "QString");
::SWGSDRangel::setValue(&dsp_rx_bits, pJson["dspRxBits"], "qint32", ""); ::SWGSDRangel::setValue(&dsp_rx_bits, pJson["dspRxBits"], "qint32", "");
::SWGSDRangel::setValue(&dsp_tx_bits, pJson["dspTxBits"], "qint32", ""); ::SWGSDRangel::setValue(&dsp_tx_bits, pJson["dspTxBits"], "qint32", "");
::SWGSDRangel::setValue(&pid, pJson["pid"], "qint32", ""); ::SWGSDRangel::setValue(&pid, pJson["pid"], "qint32", "");
::SWGSDRangel::setValue(&appname, pJson["appname"], "QString", "QString"); ::SWGSDRangel::setValue(&appname, pJson["appname"], "QString", "QString");
::SWGSDRangel::setValue(&architecture, pJson["architecture"], "QString", "QString"); ::SWGSDRangel::setValue(&architecture, pJson["architecture"], "QString", "QString");
::SWGSDRangel::setValue(&os, pJson["os"], "QString", "QString"); ::SWGSDRangel::setValue(&os, pJson["os"], "QString", "QString");
::SWGSDRangel::setValue(&logging, pJson["logging"], "SWGLoggingInfo", "SWGLoggingInfo"); ::SWGSDRangel::setValue(&logging, pJson["logging"], "SWGLoggingInfo", "SWGLoggingInfo");
::SWGSDRangel::setValue(&devicesetlist, pJson["devicesetlist"], "SWGDeviceSetList", "SWGDeviceSetList"); ::SWGSDRangel::setValue(&devicesetlist, pJson["devicesetlist"], "SWGDeviceSetList", "SWGDeviceSetList");
} }
QString QString
SWGInstanceSummaryResponse::asJson () SWGInstanceSummaryResponse::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGInstanceSummaryResponse::asJsonObject() { SWGInstanceSummaryResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(version != nullptr && *version != QString("")){
toJsonValue(QString("version"), version, obj, QString("QString")); toJsonValue(QString("version"), version, obj, QString("QString"));
}
if(qt_version != nullptr && *qt_version != QString("")){
toJsonValue(QString("qtVersion"), qt_version, obj, QString("QString")); toJsonValue(QString("qtVersion"), qt_version, obj, QString("QString"));
}
obj->insert("dspRxBits", QJsonValue(dsp_rx_bits)); if(m_dsp_rx_bits_isSet){
obj.insert("dspRxBits", QJsonValue(dsp_rx_bits));
obj->insert("dspTxBits", QJsonValue(dsp_tx_bits)); }
if(m_dsp_tx_bits_isSet){
obj->insert("pid", QJsonValue(pid)); obj.insert("dspTxBits", QJsonValue(dsp_tx_bits));
}
if(m_pid_isSet){
obj.insert("pid", QJsonValue(pid));
}
if(appname != nullptr && *appname != QString("")){
toJsonValue(QString("appname"), appname, obj, QString("QString")); toJsonValue(QString("appname"), appname, obj, QString("QString"));
}
if(architecture != nullptr && *architecture != QString("")){
toJsonValue(QString("architecture"), architecture, obj, QString("QString")); toJsonValue(QString("architecture"), architecture, obj, QString("QString"));
}
if(os != nullptr && *os != QString("")){
toJsonValue(QString("os"), os, obj, QString("QString")); toJsonValue(QString("os"), os, obj, QString("QString"));
}
if((logging != nullptr) && (logging->isSet())){
toJsonValue(QString("logging"), logging, obj, QString("SWGLoggingInfo")); toJsonValue(QString("logging"), logging, obj, QString("SWGLoggingInfo"));
}
if((devicesetlist != nullptr) && (devicesetlist->isSet())){
toJsonValue(QString("devicesetlist"), devicesetlist, obj, QString("SWGDeviceSetList")); toJsonValue(QString("devicesetlist"), devicesetlist, obj, QString("SWGDeviceSetList"));
}
return obj; return obj;
} }
@ -151,6 +173,7 @@ SWGInstanceSummaryResponse::getVersion() {
void void
SWGInstanceSummaryResponse::setVersion(QString* version) { SWGInstanceSummaryResponse::setVersion(QString* version) {
this->version = version; this->version = version;
this->m_version_isSet = true;
} }
QString* QString*
@ -160,6 +183,7 @@ SWGInstanceSummaryResponse::getQtVersion() {
void void
SWGInstanceSummaryResponse::setQtVersion(QString* qt_version) { SWGInstanceSummaryResponse::setQtVersion(QString* qt_version) {
this->qt_version = qt_version; this->qt_version = qt_version;
this->m_qt_version_isSet = true;
} }
qint32 qint32
@ -169,6 +193,7 @@ SWGInstanceSummaryResponse::getDspRxBits() {
void void
SWGInstanceSummaryResponse::setDspRxBits(qint32 dsp_rx_bits) { SWGInstanceSummaryResponse::setDspRxBits(qint32 dsp_rx_bits) {
this->dsp_rx_bits = dsp_rx_bits; this->dsp_rx_bits = dsp_rx_bits;
this->m_dsp_rx_bits_isSet = true;
} }
qint32 qint32
@ -178,6 +203,7 @@ SWGInstanceSummaryResponse::getDspTxBits() {
void void
SWGInstanceSummaryResponse::setDspTxBits(qint32 dsp_tx_bits) { SWGInstanceSummaryResponse::setDspTxBits(qint32 dsp_tx_bits) {
this->dsp_tx_bits = dsp_tx_bits; this->dsp_tx_bits = dsp_tx_bits;
this->m_dsp_tx_bits_isSet = true;
} }
qint32 qint32
@ -187,6 +213,7 @@ SWGInstanceSummaryResponse::getPid() {
void void
SWGInstanceSummaryResponse::setPid(qint32 pid) { SWGInstanceSummaryResponse::setPid(qint32 pid) {
this->pid = pid; this->pid = pid;
this->m_pid_isSet = true;
} }
QString* QString*
@ -196,6 +223,7 @@ SWGInstanceSummaryResponse::getAppname() {
void void
SWGInstanceSummaryResponse::setAppname(QString* appname) { SWGInstanceSummaryResponse::setAppname(QString* appname) {
this->appname = appname; this->appname = appname;
this->m_appname_isSet = true;
} }
QString* QString*
@ -205,6 +233,7 @@ SWGInstanceSummaryResponse::getArchitecture() {
void void
SWGInstanceSummaryResponse::setArchitecture(QString* architecture) { SWGInstanceSummaryResponse::setArchitecture(QString* architecture) {
this->architecture = architecture; this->architecture = architecture;
this->m_architecture_isSet = true;
} }
QString* QString*
@ -214,6 +243,7 @@ SWGInstanceSummaryResponse::getOs() {
void void
SWGInstanceSummaryResponse::setOs(QString* os) { SWGInstanceSummaryResponse::setOs(QString* os) {
this->os = os; this->os = os;
this->m_os_isSet = true;
} }
SWGLoggingInfo* SWGLoggingInfo*
@ -223,6 +253,7 @@ SWGInstanceSummaryResponse::getLogging() {
void void
SWGInstanceSummaryResponse::setLogging(SWGLoggingInfo* logging) { SWGInstanceSummaryResponse::setLogging(SWGLoggingInfo* logging) {
this->logging = logging; this->logging = logging;
this->m_logging_isSet = true;
} }
SWGDeviceSetList* SWGDeviceSetList*
@ -232,8 +263,26 @@ SWGInstanceSummaryResponse::getDevicesetlist() {
void void
SWGInstanceSummaryResponse::setDevicesetlist(SWGDeviceSetList* devicesetlist) { SWGInstanceSummaryResponse::setDevicesetlist(SWGDeviceSetList* devicesetlist) {
this->devicesetlist = devicesetlist; this->devicesetlist = devicesetlist;
this->m_devicesetlist_isSet = true;
} }
bool
SWGInstanceSummaryResponse::isSet(){
bool isObjectUpdated = false;
do{
if(version != nullptr && *version != QString("")){ isObjectUpdated = true; break;}
if(qt_version != nullptr && *qt_version != QString("")){ isObjectUpdated = true; break;}
if(m_dsp_rx_bits_isSet){ isObjectUpdated = true; break;}
if(m_dsp_tx_bits_isSet){ isObjectUpdated = true; break;}
if(m_pid_isSet){ isObjectUpdated = true; break;}
if(appname != nullptr && *appname != QString("")){ isObjectUpdated = true; break;}
if(architecture != nullptr && *architecture != QString("")){ isObjectUpdated = true; break;}
if(os != nullptr && *os != QString("")){ isObjectUpdated = true; break;}
if(logging != nullptr && logging->isSet()){ isObjectUpdated = true; break;}
if(devicesetlist != nullptr && devicesetlist->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -28,21 +28,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGInstanceSummaryResponse: public SWGObject { class SWGInstanceSummaryResponse: public SWGObject {
public: public:
SWGInstanceSummaryResponse(); SWGInstanceSummaryResponse();
SWGInstanceSummaryResponse(QString* json); SWGInstanceSummaryResponse(QString json);
virtual ~SWGInstanceSummaryResponse(); ~SWGInstanceSummaryResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGInstanceSummaryResponse* fromJson(QString &jsonString); SWGInstanceSummaryResponse* fromJson(QString jsonString);
QString* getVersion(); QString* getVersion();
void setVersion(QString* version); void setVersion(QString* version);
@ -75,17 +74,39 @@ public:
void setDevicesetlist(SWGDeviceSetList* devicesetlist); void setDevicesetlist(SWGDeviceSetList* devicesetlist);
virtual bool isSet() override;
private: private:
QString* version; QString* version;
bool m_version_isSet;
QString* qt_version; QString* qt_version;
bool m_qt_version_isSet;
qint32 dsp_rx_bits; qint32 dsp_rx_bits;
bool m_dsp_rx_bits_isSet;
qint32 dsp_tx_bits; qint32 dsp_tx_bits;
bool m_dsp_tx_bits_isSet;
qint32 pid; qint32 pid;
bool m_pid_isSet;
QString* appname; QString* appname;
bool m_appname_isSet;
QString* architecture; QString* architecture;
bool m_architecture_isSet;
QString* os; QString* os;
bool m_os_isSet;
SWGLoggingInfo* logging; SWGLoggingInfo* logging;
bool m_logging_isSet;
SWGDeviceSetList* devicesetlist; SWGDeviceSetList* devicesetlist;
bool m_devicesetlist_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLimeSdrInputSettings::SWGLimeSdrInputSettings(QString* json) { SWGLimeSdrInputSettings::SWGLimeSdrInputSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGLimeSdrInputSettings::SWGLimeSdrInputSettings() { SWGLimeSdrInputSettings::SWGLimeSdrInputSettings() {
@ -38,24 +38,43 @@ SWGLimeSdrInputSettings::~SWGLimeSdrInputSettings() {
void void
SWGLimeSdrInputSettings::init() { SWGLimeSdrInputSettings::init() {
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
dev_sample_rate = 0; dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_hard_decim = 0; log2_hard_decim = 0;
m_log2_hard_decim_isSet = false;
dc_block = 0; dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0; iq_correction = 0;
m_iq_correction_isSet = false;
log2_soft_decim = 0; log2_soft_decim = 0;
m_log2_soft_decim_isSet = false;
lpf_bw = 0; lpf_bw = 0;
m_lpf_bw_isSet = false;
lpf_fir_enable = 0; lpf_fir_enable = 0;
m_lpf_fir_enable_isSet = false;
lpf_firbw = 0; lpf_firbw = 0;
m_lpf_firbw_isSet = false;
gain = 0; gain = 0;
m_gain_isSet = false;
nco_enable = 0; nco_enable = 0;
m_nco_enable_isSet = false;
nco_frequency = 0; nco_frequency = 0;
m_nco_frequency_isSet = false;
antenna_path = 0; antenna_path = 0;
m_antenna_path_isSet = false;
gain_mode = 0; gain_mode = 0;
m_gain_mode_isSet = false;
lna_gain = 0; lna_gain = 0;
m_lna_gain_isSet = false;
tia_gain = 0; tia_gain = 0;
m_tia_gain_isSet = false;
pga_gain = 0; pga_gain = 0;
m_pga_gain_isSet = false;
ext_clock = 0; ext_clock = 0;
m_ext_clock_isSet = false;
ext_clock_freq = 0; ext_clock_freq = 0;
m_ext_clock_freq_isSet = false;
} }
void void
@ -82,7 +101,7 @@ SWGLimeSdrInputSettings::cleanup() {
} }
SWGLimeSdrInputSettings* SWGLimeSdrInputSettings*
SWGLimeSdrInputSettings::fromJson(QString &json) { SWGLimeSdrInputSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -91,79 +110,116 @@ SWGLimeSdrInputSettings::fromJson(QString &json) {
} }
void void
SWGLimeSdrInputSettings::fromJsonObject(QJsonObject &pJson) { SWGLimeSdrInputSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&log2_hard_decim, pJson["log2HardDecim"], "qint32", ""); ::SWGSDRangel::setValue(&log2_hard_decim, pJson["log2HardDecim"], "qint32", "");
::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", ""); ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", ""); ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
::SWGSDRangel::setValue(&log2_soft_decim, pJson["log2SoftDecim"], "qint32", ""); ::SWGSDRangel::setValue(&log2_soft_decim, pJson["log2SoftDecim"], "qint32", "");
::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", "");
::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", "");
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", ""); ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", ""); ::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", "");
::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", ""); ::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", "");
::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", ""); ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", ""); ::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", "");
::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", ""); ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
::SWGSDRangel::setValue(&tia_gain, pJson["tiaGain"], "qint32", ""); ::SWGSDRangel::setValue(&tia_gain, pJson["tiaGain"], "qint32", "");
::SWGSDRangel::setValue(&pga_gain, pJson["pgaGain"], "qint32", ""); ::SWGSDRangel::setValue(&pga_gain, pJson["pgaGain"], "qint32", "");
::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", ""); ::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", "");
::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", ""); ::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
} }
QString QString
SWGLimeSdrInputSettings::asJson () SWGLimeSdrInputSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGLimeSdrInputSettings::asJsonObject() { SWGLimeSdrInputSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency)); obj.insert("centerFrequency", QJsonValue(center_frequency));
}
obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate));
obj->insert("log2HardDecim", QJsonValue(log2_hard_decim)); }
if(m_log2_hard_decim_isSet){
obj->insert("dcBlock", QJsonValue(dc_block)); obj.insert("log2HardDecim", QJsonValue(log2_hard_decim));
}
obj->insert("iqCorrection", QJsonValue(iq_correction)); if(m_dc_block_isSet){
obj.insert("dcBlock", QJsonValue(dc_block));
obj->insert("log2SoftDecim", QJsonValue(log2_soft_decim)); }
if(m_iq_correction_isSet){
obj->insert("lpfBW", QJsonValue(lpf_bw)); obj.insert("iqCorrection", QJsonValue(iq_correction));
}
obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable)); if(m_log2_soft_decim_isSet){
obj.insert("log2SoftDecim", QJsonValue(log2_soft_decim));
obj->insert("lpfFIRBW", QJsonValue(lpf_firbw)); }
if(m_lpf_bw_isSet){
obj->insert("gain", QJsonValue(gain)); obj.insert("lpfBW", QJsonValue(lpf_bw));
}
obj->insert("ncoEnable", QJsonValue(nco_enable)); if(m_lpf_fir_enable_isSet){
obj.insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
obj->insert("ncoFrequency", QJsonValue(nco_frequency)); }
if(m_lpf_firbw_isSet){
obj->insert("antennaPath", QJsonValue(antenna_path)); obj.insert("lpfFIRBW", QJsonValue(lpf_firbw));
}
obj->insert("gainMode", QJsonValue(gain_mode)); if(m_gain_isSet){
obj.insert("gain", QJsonValue(gain));
obj->insert("lnaGain", QJsonValue(lna_gain)); }
if(m_nco_enable_isSet){
obj->insert("tiaGain", QJsonValue(tia_gain)); obj.insert("ncoEnable", QJsonValue(nco_enable));
}
obj->insert("pgaGain", QJsonValue(pga_gain)); if(m_nco_frequency_isSet){
obj.insert("ncoFrequency", QJsonValue(nco_frequency));
obj->insert("extClock", QJsonValue(ext_clock)); }
if(m_antenna_path_isSet){
obj->insert("extClockFreq", QJsonValue(ext_clock_freq)); obj.insert("antennaPath", QJsonValue(antenna_path));
}
if(m_gain_mode_isSet){
obj.insert("gainMode", QJsonValue(gain_mode));
}
if(m_lna_gain_isSet){
obj.insert("lnaGain", QJsonValue(lna_gain));
}
if(m_tia_gain_isSet){
obj.insert("tiaGain", QJsonValue(tia_gain));
}
if(m_pga_gain_isSet){
obj.insert("pgaGain", QJsonValue(pga_gain));
}
if(m_ext_clock_isSet){
obj.insert("extClock", QJsonValue(ext_clock));
}
if(m_ext_clock_freq_isSet){
obj.insert("extClockFreq", QJsonValue(ext_clock_freq));
}
return obj; return obj;
} }
@ -175,6 +231,7 @@ SWGLimeSdrInputSettings::getCenterFrequency() {
void void
SWGLimeSdrInputSettings::setCenterFrequency(qint64 center_frequency) { SWGLimeSdrInputSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
qint32 qint32
@ -184,6 +241,7 @@ SWGLimeSdrInputSettings::getDevSampleRate() {
void void
SWGLimeSdrInputSettings::setDevSampleRate(qint32 dev_sample_rate) { SWGLimeSdrInputSettings::setDevSampleRate(qint32 dev_sample_rate) {
this->dev_sample_rate = dev_sample_rate; this->dev_sample_rate = dev_sample_rate;
this->m_dev_sample_rate_isSet = true;
} }
qint32 qint32
@ -193,6 +251,7 @@ SWGLimeSdrInputSettings::getLog2HardDecim() {
void void
SWGLimeSdrInputSettings::setLog2HardDecim(qint32 log2_hard_decim) { SWGLimeSdrInputSettings::setLog2HardDecim(qint32 log2_hard_decim) {
this->log2_hard_decim = log2_hard_decim; this->log2_hard_decim = log2_hard_decim;
this->m_log2_hard_decim_isSet = true;
} }
qint32 qint32
@ -202,6 +261,7 @@ SWGLimeSdrInputSettings::getDcBlock() {
void void
SWGLimeSdrInputSettings::setDcBlock(qint32 dc_block) { SWGLimeSdrInputSettings::setDcBlock(qint32 dc_block) {
this->dc_block = dc_block; this->dc_block = dc_block;
this->m_dc_block_isSet = true;
} }
qint32 qint32
@ -211,6 +271,7 @@ SWGLimeSdrInputSettings::getIqCorrection() {
void void
SWGLimeSdrInputSettings::setIqCorrection(qint32 iq_correction) { SWGLimeSdrInputSettings::setIqCorrection(qint32 iq_correction) {
this->iq_correction = iq_correction; this->iq_correction = iq_correction;
this->m_iq_correction_isSet = true;
} }
qint32 qint32
@ -220,6 +281,7 @@ SWGLimeSdrInputSettings::getLog2SoftDecim() {
void void
SWGLimeSdrInputSettings::setLog2SoftDecim(qint32 log2_soft_decim) { SWGLimeSdrInputSettings::setLog2SoftDecim(qint32 log2_soft_decim) {
this->log2_soft_decim = log2_soft_decim; this->log2_soft_decim = log2_soft_decim;
this->m_log2_soft_decim_isSet = true;
} }
qint32 qint32
@ -229,6 +291,7 @@ SWGLimeSdrInputSettings::getLpfBw() {
void void
SWGLimeSdrInputSettings::setLpfBw(qint32 lpf_bw) { SWGLimeSdrInputSettings::setLpfBw(qint32 lpf_bw) {
this->lpf_bw = lpf_bw; this->lpf_bw = lpf_bw;
this->m_lpf_bw_isSet = true;
} }
qint32 qint32
@ -238,6 +301,7 @@ SWGLimeSdrInputSettings::getLpfFirEnable() {
void void
SWGLimeSdrInputSettings::setLpfFirEnable(qint32 lpf_fir_enable) { SWGLimeSdrInputSettings::setLpfFirEnable(qint32 lpf_fir_enable) {
this->lpf_fir_enable = lpf_fir_enable; this->lpf_fir_enable = lpf_fir_enable;
this->m_lpf_fir_enable_isSet = true;
} }
qint32 qint32
@ -247,6 +311,7 @@ SWGLimeSdrInputSettings::getLpfFirbw() {
void void
SWGLimeSdrInputSettings::setLpfFirbw(qint32 lpf_firbw) { SWGLimeSdrInputSettings::setLpfFirbw(qint32 lpf_firbw) {
this->lpf_firbw = lpf_firbw; this->lpf_firbw = lpf_firbw;
this->m_lpf_firbw_isSet = true;
} }
qint32 qint32
@ -256,6 +321,7 @@ SWGLimeSdrInputSettings::getGain() {
void void
SWGLimeSdrInputSettings::setGain(qint32 gain) { SWGLimeSdrInputSettings::setGain(qint32 gain) {
this->gain = gain; this->gain = gain;
this->m_gain_isSet = true;
} }
qint32 qint32
@ -265,6 +331,7 @@ SWGLimeSdrInputSettings::getNcoEnable() {
void void
SWGLimeSdrInputSettings::setNcoEnable(qint32 nco_enable) { SWGLimeSdrInputSettings::setNcoEnable(qint32 nco_enable) {
this->nco_enable = nco_enable; this->nco_enable = nco_enable;
this->m_nco_enable_isSet = true;
} }
qint32 qint32
@ -274,6 +341,7 @@ SWGLimeSdrInputSettings::getNcoFrequency() {
void void
SWGLimeSdrInputSettings::setNcoFrequency(qint32 nco_frequency) { SWGLimeSdrInputSettings::setNcoFrequency(qint32 nco_frequency) {
this->nco_frequency = nco_frequency; this->nco_frequency = nco_frequency;
this->m_nco_frequency_isSet = true;
} }
qint32 qint32
@ -283,6 +351,7 @@ SWGLimeSdrInputSettings::getAntennaPath() {
void void
SWGLimeSdrInputSettings::setAntennaPath(qint32 antenna_path) { SWGLimeSdrInputSettings::setAntennaPath(qint32 antenna_path) {
this->antenna_path = antenna_path; this->antenna_path = antenna_path;
this->m_antenna_path_isSet = true;
} }
qint32 qint32
@ -292,6 +361,7 @@ SWGLimeSdrInputSettings::getGainMode() {
void void
SWGLimeSdrInputSettings::setGainMode(qint32 gain_mode) { SWGLimeSdrInputSettings::setGainMode(qint32 gain_mode) {
this->gain_mode = gain_mode; this->gain_mode = gain_mode;
this->m_gain_mode_isSet = true;
} }
qint32 qint32
@ -301,6 +371,7 @@ SWGLimeSdrInputSettings::getLnaGain() {
void void
SWGLimeSdrInputSettings::setLnaGain(qint32 lna_gain) { SWGLimeSdrInputSettings::setLnaGain(qint32 lna_gain) {
this->lna_gain = lna_gain; this->lna_gain = lna_gain;
this->m_lna_gain_isSet = true;
} }
qint32 qint32
@ -310,6 +381,7 @@ SWGLimeSdrInputSettings::getTiaGain() {
void void
SWGLimeSdrInputSettings::setTiaGain(qint32 tia_gain) { SWGLimeSdrInputSettings::setTiaGain(qint32 tia_gain) {
this->tia_gain = tia_gain; this->tia_gain = tia_gain;
this->m_tia_gain_isSet = true;
} }
qint32 qint32
@ -319,6 +391,7 @@ SWGLimeSdrInputSettings::getPgaGain() {
void void
SWGLimeSdrInputSettings::setPgaGain(qint32 pga_gain) { SWGLimeSdrInputSettings::setPgaGain(qint32 pga_gain) {
this->pga_gain = pga_gain; this->pga_gain = pga_gain;
this->m_pga_gain_isSet = true;
} }
qint32 qint32
@ -328,6 +401,7 @@ SWGLimeSdrInputSettings::getExtClock() {
void void
SWGLimeSdrInputSettings::setExtClock(qint32 ext_clock) { SWGLimeSdrInputSettings::setExtClock(qint32 ext_clock) {
this->ext_clock = ext_clock; this->ext_clock = ext_clock;
this->m_ext_clock_isSet = true;
} }
qint32 qint32
@ -337,8 +411,35 @@ SWGLimeSdrInputSettings::getExtClockFreq() {
void void
SWGLimeSdrInputSettings::setExtClockFreq(qint32 ext_clock_freq) { SWGLimeSdrInputSettings::setExtClockFreq(qint32 ext_clock_freq) {
this->ext_clock_freq = ext_clock_freq; this->ext_clock_freq = ext_clock_freq;
this->m_ext_clock_freq_isSet = true;
} }
bool
SWGLimeSdrInputSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_log2_hard_decim_isSet){ isObjectUpdated = true; break;}
if(m_dc_block_isSet){ isObjectUpdated = true; break;}
if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
if(m_log2_soft_decim_isSet){ isObjectUpdated = true; break;}
if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
if(m_lpf_fir_enable_isSet){ isObjectUpdated = true; break;}
if(m_lpf_firbw_isSet){ isObjectUpdated = true; break;}
if(m_gain_isSet){ isObjectUpdated = true; break;}
if(m_nco_enable_isSet){ isObjectUpdated = true; break;}
if(m_nco_frequency_isSet){ isObjectUpdated = true; break;}
if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
if(m_gain_mode_isSet){ isObjectUpdated = true; break;}
if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
if(m_tia_gain_isSet){ isObjectUpdated = true; break;}
if(m_pga_gain_isSet){ isObjectUpdated = true; break;}
if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGLimeSdrInputSettings: public SWGObject { class SWGLimeSdrInputSettings: public SWGObject {
public: public:
SWGLimeSdrInputSettings(); SWGLimeSdrInputSettings();
SWGLimeSdrInputSettings(QString* json); SWGLimeSdrInputSettings(QString json);
virtual ~SWGLimeSdrInputSettings(); ~SWGLimeSdrInputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGLimeSdrInputSettings* fromJson(QString &jsonString); SWGLimeSdrInputSettings* fromJson(QString jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);
@ -99,26 +98,66 @@ public:
void setExtClockFreq(qint32 ext_clock_freq); void setExtClockFreq(qint32 ext_clock_freq);
virtual bool isSet() override;
private: private:
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 dev_sample_rate; qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 log2_hard_decim; qint32 log2_hard_decim;
bool m_log2_hard_decim_isSet;
qint32 dc_block; qint32 dc_block;
bool m_dc_block_isSet;
qint32 iq_correction; qint32 iq_correction;
bool m_iq_correction_isSet;
qint32 log2_soft_decim; qint32 log2_soft_decim;
bool m_log2_soft_decim_isSet;
qint32 lpf_bw; qint32 lpf_bw;
bool m_lpf_bw_isSet;
qint32 lpf_fir_enable; qint32 lpf_fir_enable;
bool m_lpf_fir_enable_isSet;
qint32 lpf_firbw; qint32 lpf_firbw;
bool m_lpf_firbw_isSet;
qint32 gain; qint32 gain;
bool m_gain_isSet;
qint32 nco_enable; qint32 nco_enable;
bool m_nco_enable_isSet;
qint32 nco_frequency; qint32 nco_frequency;
bool m_nco_frequency_isSet;
qint32 antenna_path; qint32 antenna_path;
bool m_antenna_path_isSet;
qint32 gain_mode; qint32 gain_mode;
bool m_gain_mode_isSet;
qint32 lna_gain; qint32 lna_gain;
bool m_lna_gain_isSet;
qint32 tia_gain; qint32 tia_gain;
bool m_tia_gain_isSet;
qint32 pga_gain; qint32 pga_gain;
bool m_pga_gain_isSet;
qint32 ext_clock; qint32 ext_clock;
bool m_ext_clock_isSet;
qint32 ext_clock_freq; qint32 ext_clock_freq;
bool m_ext_clock_freq_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings(QString* json) { SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings() { SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings() {
@ -38,18 +38,31 @@ SWGLimeSdrOutputSettings::~SWGLimeSdrOutputSettings() {
void void
SWGLimeSdrOutputSettings::init() { SWGLimeSdrOutputSettings::init() {
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
dev_sample_rate = 0; dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_hard_interp = 0; log2_hard_interp = 0;
m_log2_hard_interp_isSet = false;
log2_soft_interp = 0; log2_soft_interp = 0;
m_log2_soft_interp_isSet = false;
lpf_bw = 0; lpf_bw = 0;
m_lpf_bw_isSet = false;
lpf_fir_enable = 0; lpf_fir_enable = 0;
m_lpf_fir_enable_isSet = false;
lpf_firbw = 0; lpf_firbw = 0;
m_lpf_firbw_isSet = false;
gain = 0; gain = 0;
m_gain_isSet = false;
nco_enable = 0; nco_enable = 0;
m_nco_enable_isSet = false;
nco_frequency = 0; nco_frequency = 0;
m_nco_frequency_isSet = false;
antenna_path = 0; antenna_path = 0;
m_antenna_path_isSet = false;
ext_clock = 0; ext_clock = 0;
m_ext_clock_isSet = false;
ext_clock_freq = 0; ext_clock_freq = 0;
m_ext_clock_freq_isSet = false;
} }
void void
@ -70,7 +83,7 @@ SWGLimeSdrOutputSettings::cleanup() {
} }
SWGLimeSdrOutputSettings* SWGLimeSdrOutputSettings*
SWGLimeSdrOutputSettings::fromJson(QString &json) { SWGLimeSdrOutputSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -79,61 +92,86 @@ SWGLimeSdrOutputSettings::fromJson(QString &json) {
} }
void void
SWGLimeSdrOutputSettings::fromJsonObject(QJsonObject &pJson) { SWGLimeSdrOutputSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&log2_hard_interp, pJson["log2HardInterp"], "qint32", ""); ::SWGSDRangel::setValue(&log2_hard_interp, pJson["log2HardInterp"], "qint32", "");
::SWGSDRangel::setValue(&log2_soft_interp, pJson["log2SoftInterp"], "qint32", ""); ::SWGSDRangel::setValue(&log2_soft_interp, pJson["log2SoftInterp"], "qint32", "");
::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", "");
::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", "");
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", ""); ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", ""); ::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", "");
::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", ""); ::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", "");
::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", ""); ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", ""); ::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", "");
::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", ""); ::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
} }
QString QString
SWGLimeSdrOutputSettings::asJson () SWGLimeSdrOutputSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGLimeSdrOutputSettings::asJsonObject() { SWGLimeSdrOutputSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency)); obj.insert("centerFrequency", QJsonValue(center_frequency));
}
obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate));
obj->insert("log2HardInterp", QJsonValue(log2_hard_interp)); }
if(m_log2_hard_interp_isSet){
obj->insert("log2SoftInterp", QJsonValue(log2_soft_interp)); obj.insert("log2HardInterp", QJsonValue(log2_hard_interp));
}
obj->insert("lpfBW", QJsonValue(lpf_bw)); if(m_log2_soft_interp_isSet){
obj.insert("log2SoftInterp", QJsonValue(log2_soft_interp));
obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable)); }
if(m_lpf_bw_isSet){
obj->insert("lpfFIRBW", QJsonValue(lpf_firbw)); obj.insert("lpfBW", QJsonValue(lpf_bw));
}
obj->insert("gain", QJsonValue(gain)); if(m_lpf_fir_enable_isSet){
obj.insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
obj->insert("ncoEnable", QJsonValue(nco_enable)); }
if(m_lpf_firbw_isSet){
obj->insert("ncoFrequency", QJsonValue(nco_frequency)); obj.insert("lpfFIRBW", QJsonValue(lpf_firbw));
}
obj->insert("antennaPath", QJsonValue(antenna_path)); if(m_gain_isSet){
obj.insert("gain", QJsonValue(gain));
obj->insert("extClock", QJsonValue(ext_clock)); }
if(m_nco_enable_isSet){
obj->insert("extClockFreq", QJsonValue(ext_clock_freq)); obj.insert("ncoEnable", QJsonValue(nco_enable));
}
if(m_nco_frequency_isSet){
obj.insert("ncoFrequency", QJsonValue(nco_frequency));
}
if(m_antenna_path_isSet){
obj.insert("antennaPath", QJsonValue(antenna_path));
}
if(m_ext_clock_isSet){
obj.insert("extClock", QJsonValue(ext_clock));
}
if(m_ext_clock_freq_isSet){
obj.insert("extClockFreq", QJsonValue(ext_clock_freq));
}
return obj; return obj;
} }
@ -145,6 +183,7 @@ SWGLimeSdrOutputSettings::getCenterFrequency() {
void void
SWGLimeSdrOutputSettings::setCenterFrequency(qint64 center_frequency) { SWGLimeSdrOutputSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
qint32 qint32
@ -154,6 +193,7 @@ SWGLimeSdrOutputSettings::getDevSampleRate() {
void void
SWGLimeSdrOutputSettings::setDevSampleRate(qint32 dev_sample_rate) { SWGLimeSdrOutputSettings::setDevSampleRate(qint32 dev_sample_rate) {
this->dev_sample_rate = dev_sample_rate; this->dev_sample_rate = dev_sample_rate;
this->m_dev_sample_rate_isSet = true;
} }
qint32 qint32
@ -163,6 +203,7 @@ SWGLimeSdrOutputSettings::getLog2HardInterp() {
void void
SWGLimeSdrOutputSettings::setLog2HardInterp(qint32 log2_hard_interp) { SWGLimeSdrOutputSettings::setLog2HardInterp(qint32 log2_hard_interp) {
this->log2_hard_interp = log2_hard_interp; this->log2_hard_interp = log2_hard_interp;
this->m_log2_hard_interp_isSet = true;
} }
qint32 qint32
@ -172,6 +213,7 @@ SWGLimeSdrOutputSettings::getLog2SoftInterp() {
void void
SWGLimeSdrOutputSettings::setLog2SoftInterp(qint32 log2_soft_interp) { SWGLimeSdrOutputSettings::setLog2SoftInterp(qint32 log2_soft_interp) {
this->log2_soft_interp = log2_soft_interp; this->log2_soft_interp = log2_soft_interp;
this->m_log2_soft_interp_isSet = true;
} }
qint32 qint32
@ -181,6 +223,7 @@ SWGLimeSdrOutputSettings::getLpfBw() {
void void
SWGLimeSdrOutputSettings::setLpfBw(qint32 lpf_bw) { SWGLimeSdrOutputSettings::setLpfBw(qint32 lpf_bw) {
this->lpf_bw = lpf_bw; this->lpf_bw = lpf_bw;
this->m_lpf_bw_isSet = true;
} }
qint32 qint32
@ -190,6 +233,7 @@ SWGLimeSdrOutputSettings::getLpfFirEnable() {
void void
SWGLimeSdrOutputSettings::setLpfFirEnable(qint32 lpf_fir_enable) { SWGLimeSdrOutputSettings::setLpfFirEnable(qint32 lpf_fir_enable) {
this->lpf_fir_enable = lpf_fir_enable; this->lpf_fir_enable = lpf_fir_enable;
this->m_lpf_fir_enable_isSet = true;
} }
qint32 qint32
@ -199,6 +243,7 @@ SWGLimeSdrOutputSettings::getLpfFirbw() {
void void
SWGLimeSdrOutputSettings::setLpfFirbw(qint32 lpf_firbw) { SWGLimeSdrOutputSettings::setLpfFirbw(qint32 lpf_firbw) {
this->lpf_firbw = lpf_firbw; this->lpf_firbw = lpf_firbw;
this->m_lpf_firbw_isSet = true;
} }
qint32 qint32
@ -208,6 +253,7 @@ SWGLimeSdrOutputSettings::getGain() {
void void
SWGLimeSdrOutputSettings::setGain(qint32 gain) { SWGLimeSdrOutputSettings::setGain(qint32 gain) {
this->gain = gain; this->gain = gain;
this->m_gain_isSet = true;
} }
qint32 qint32
@ -217,6 +263,7 @@ SWGLimeSdrOutputSettings::getNcoEnable() {
void void
SWGLimeSdrOutputSettings::setNcoEnable(qint32 nco_enable) { SWGLimeSdrOutputSettings::setNcoEnable(qint32 nco_enable) {
this->nco_enable = nco_enable; this->nco_enable = nco_enable;
this->m_nco_enable_isSet = true;
} }
qint32 qint32
@ -226,6 +273,7 @@ SWGLimeSdrOutputSettings::getNcoFrequency() {
void void
SWGLimeSdrOutputSettings::setNcoFrequency(qint32 nco_frequency) { SWGLimeSdrOutputSettings::setNcoFrequency(qint32 nco_frequency) {
this->nco_frequency = nco_frequency; this->nco_frequency = nco_frequency;
this->m_nco_frequency_isSet = true;
} }
qint32 qint32
@ -235,6 +283,7 @@ SWGLimeSdrOutputSettings::getAntennaPath() {
void void
SWGLimeSdrOutputSettings::setAntennaPath(qint32 antenna_path) { SWGLimeSdrOutputSettings::setAntennaPath(qint32 antenna_path) {
this->antenna_path = antenna_path; this->antenna_path = antenna_path;
this->m_antenna_path_isSet = true;
} }
qint32 qint32
@ -244,6 +293,7 @@ SWGLimeSdrOutputSettings::getExtClock() {
void void
SWGLimeSdrOutputSettings::setExtClock(qint32 ext_clock) { SWGLimeSdrOutputSettings::setExtClock(qint32 ext_clock) {
this->ext_clock = ext_clock; this->ext_clock = ext_clock;
this->m_ext_clock_isSet = true;
} }
qint32 qint32
@ -253,8 +303,29 @@ SWGLimeSdrOutputSettings::getExtClockFreq() {
void void
SWGLimeSdrOutputSettings::setExtClockFreq(qint32 ext_clock_freq) { SWGLimeSdrOutputSettings::setExtClockFreq(qint32 ext_clock_freq) {
this->ext_clock_freq = ext_clock_freq; this->ext_clock_freq = ext_clock_freq;
this->m_ext_clock_freq_isSet = true;
} }
bool
SWGLimeSdrOutputSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_log2_hard_interp_isSet){ isObjectUpdated = true; break;}
if(m_log2_soft_interp_isSet){ isObjectUpdated = true; break;}
if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
if(m_lpf_fir_enable_isSet){ isObjectUpdated = true; break;}
if(m_lpf_firbw_isSet){ isObjectUpdated = true; break;}
if(m_gain_isSet){ isObjectUpdated = true; break;}
if(m_nco_enable_isSet){ isObjectUpdated = true; break;}
if(m_nco_frequency_isSet){ isObjectUpdated = true; break;}
if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGLimeSdrOutputSettings: public SWGObject { class SWGLimeSdrOutputSettings: public SWGObject {
public: public:
SWGLimeSdrOutputSettings(); SWGLimeSdrOutputSettings();
SWGLimeSdrOutputSettings(QString* json); SWGLimeSdrOutputSettings(QString json);
virtual ~SWGLimeSdrOutputSettings(); ~SWGLimeSdrOutputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGLimeSdrOutputSettings* fromJson(QString &jsonString); SWGLimeSdrOutputSettings* fromJson(QString jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);
@ -81,20 +80,48 @@ public:
void setExtClockFreq(qint32 ext_clock_freq); void setExtClockFreq(qint32 ext_clock_freq);
virtual bool isSet() override;
private: private:
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 dev_sample_rate; qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 log2_hard_interp; qint32 log2_hard_interp;
bool m_log2_hard_interp_isSet;
qint32 log2_soft_interp; qint32 log2_soft_interp;
bool m_log2_soft_interp_isSet;
qint32 lpf_bw; qint32 lpf_bw;
bool m_lpf_bw_isSet;
qint32 lpf_fir_enable; qint32 lpf_fir_enable;
bool m_lpf_fir_enable_isSet;
qint32 lpf_firbw; qint32 lpf_firbw;
bool m_lpf_firbw_isSet;
qint32 gain; qint32 gain;
bool m_gain_isSet;
qint32 nco_enable; qint32 nco_enable;
bool m_nco_enable_isSet;
qint32 nco_frequency; qint32 nco_frequency;
bool m_nco_frequency_isSet;
qint32 antenna_path; qint32 antenna_path;
bool m_antenna_path_isSet;
qint32 ext_clock; qint32 ext_clock;
bool m_ext_clock_isSet;
qint32 ext_clock_freq; qint32 ext_clock_freq;
bool m_ext_clock_freq_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLocationInformation::SWGLocationInformation(QString* json) { SWGLocationInformation::SWGLocationInformation(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGLocationInformation::SWGLocationInformation() { SWGLocationInformation::SWGLocationInformation() {
@ -38,7 +38,9 @@ SWGLocationInformation::~SWGLocationInformation() {
void void
SWGLocationInformation::init() { SWGLocationInformation::init() {
latitude = 0.0f; latitude = 0.0f;
m_latitude_isSet = false;
longitude = 0.0f; longitude = 0.0f;
m_longitude_isSet = false;
} }
void void
@ -48,7 +50,7 @@ SWGLocationInformation::cleanup() {
} }
SWGLocationInformation* SWGLocationInformation*
SWGLocationInformation::fromJson(QString &json) { SWGLocationInformation::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -57,28 +59,31 @@ SWGLocationInformation::fromJson(QString &json) {
} }
void void
SWGLocationInformation::fromJsonObject(QJsonObject &pJson) { SWGLocationInformation::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", ""); ::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", "");
::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", ""); ::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", "");
} }
QString QString
SWGLocationInformation::asJson () SWGLocationInformation::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGLocationInformation::asJsonObject() { SWGLocationInformation::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_latitude_isSet){
obj->insert("latitude", QJsonValue(latitude)); obj.insert("latitude", QJsonValue(latitude));
}
obj->insert("longitude", QJsonValue(longitude)); if(m_longitude_isSet){
obj.insert("longitude", QJsonValue(longitude));
}
return obj; return obj;
} }
@ -90,6 +95,7 @@ SWGLocationInformation::getLatitude() {
void void
SWGLocationInformation::setLatitude(float latitude) { SWGLocationInformation::setLatitude(float latitude) {
this->latitude = latitude; this->latitude = latitude;
this->m_latitude_isSet = true;
} }
float float
@ -99,8 +105,18 @@ SWGLocationInformation::getLongitude() {
void void
SWGLocationInformation::setLongitude(float longitude) { SWGLocationInformation::setLongitude(float longitude) {
this->longitude = longitude; this->longitude = longitude;
this->m_longitude_isSet = true;
} }
bool
SWGLocationInformation::isSet(){
bool isObjectUpdated = false;
do{
if(m_latitude_isSet){ isObjectUpdated = true; break;}
if(m_longitude_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGLocationInformation: public SWGObject { class SWGLocationInformation: public SWGObject {
public: public:
SWGLocationInformation(); SWGLocationInformation();
SWGLocationInformation(QString* json); SWGLocationInformation(QString json);
virtual ~SWGLocationInformation(); ~SWGLocationInformation();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGLocationInformation* fromJson(QString &jsonString); SWGLocationInformation* fromJson(QString jsonString);
float getLatitude(); float getLatitude();
void setLatitude(float latitude); void setLatitude(float latitude);
@ -48,9 +47,15 @@ public:
void setLongitude(float longitude); void setLongitude(float longitude);
virtual bool isSet() override;
private: private:
float latitude; float latitude;
bool m_latitude_isSet;
float longitude; float longitude;
bool m_longitude_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLoggingInfo::SWGLoggingInfo(QString* json) { SWGLoggingInfo::SWGLoggingInfo(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGLoggingInfo::SWGLoggingInfo() { SWGLoggingInfo::SWGLoggingInfo() {
@ -38,30 +38,31 @@ SWGLoggingInfo::~SWGLoggingInfo() {
void void
SWGLoggingInfo::init() { SWGLoggingInfo::init() {
console_level = new QString(""); console_level = new QString("");
m_console_level_isSet = false;
file_level = new QString(""); file_level = new QString("");
m_file_level_isSet = false;
dump_to_file = 0; dump_to_file = 0;
m_dump_to_file_isSet = false;
file_name = new QString(""); file_name = new QString("");
m_file_name_isSet = false;
} }
void void
SWGLoggingInfo::cleanup() { SWGLoggingInfo::cleanup() {
if(console_level != nullptr) { if(console_level != nullptr) {
delete console_level; delete console_level;
} }
if(file_level != nullptr) { if(file_level != nullptr) {
delete file_level; delete file_level;
} }
if(file_name != nullptr) { if(file_name != nullptr) {
delete file_name; delete file_name;
} }
} }
SWGLoggingInfo* SWGLoggingInfo*
SWGLoggingInfo::fromJson(QString &json) { SWGLoggingInfo::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -70,34 +71,41 @@ SWGLoggingInfo::fromJson(QString &json) {
} }
void void
SWGLoggingInfo::fromJsonObject(QJsonObject &pJson) { SWGLoggingInfo::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&console_level, pJson["consoleLevel"], "QString", "QString"); ::SWGSDRangel::setValue(&console_level, pJson["consoleLevel"], "QString", "QString");
::SWGSDRangel::setValue(&file_level, pJson["fileLevel"], "QString", "QString"); ::SWGSDRangel::setValue(&file_level, pJson["fileLevel"], "QString", "QString");
::SWGSDRangel::setValue(&dump_to_file, pJson["dumpToFile"], "qint32", ""); ::SWGSDRangel::setValue(&dump_to_file, pJson["dumpToFile"], "qint32", "");
::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString"); ::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString");
} }
QString QString
SWGLoggingInfo::asJson () SWGLoggingInfo::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGLoggingInfo::asJsonObject() { SWGLoggingInfo::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(console_level != nullptr && *console_level != QString("")){
toJsonValue(QString("consoleLevel"), console_level, obj, QString("QString")); toJsonValue(QString("consoleLevel"), console_level, obj, QString("QString"));
}
if(file_level != nullptr && *file_level != QString("")){
toJsonValue(QString("fileLevel"), file_level, obj, QString("QString")); toJsonValue(QString("fileLevel"), file_level, obj, QString("QString"));
}
obj->insert("dumpToFile", QJsonValue(dump_to_file)); if(m_dump_to_file_isSet){
obj.insert("dumpToFile", QJsonValue(dump_to_file));
}
if(file_name != nullptr && *file_name != QString("")){
toJsonValue(QString("fileName"), file_name, obj, QString("QString")); toJsonValue(QString("fileName"), file_name, obj, QString("QString"));
}
return obj; return obj;
} }
@ -109,6 +117,7 @@ SWGLoggingInfo::getConsoleLevel() {
void void
SWGLoggingInfo::setConsoleLevel(QString* console_level) { SWGLoggingInfo::setConsoleLevel(QString* console_level) {
this->console_level = console_level; this->console_level = console_level;
this->m_console_level_isSet = true;
} }
QString* QString*
@ -118,6 +127,7 @@ SWGLoggingInfo::getFileLevel() {
void void
SWGLoggingInfo::setFileLevel(QString* file_level) { SWGLoggingInfo::setFileLevel(QString* file_level) {
this->file_level = file_level; this->file_level = file_level;
this->m_file_level_isSet = true;
} }
qint32 qint32
@ -127,6 +137,7 @@ SWGLoggingInfo::getDumpToFile() {
void void
SWGLoggingInfo::setDumpToFile(qint32 dump_to_file) { SWGLoggingInfo::setDumpToFile(qint32 dump_to_file) {
this->dump_to_file = dump_to_file; this->dump_to_file = dump_to_file;
this->m_dump_to_file_isSet = true;
} }
QString* QString*
@ -136,8 +147,20 @@ SWGLoggingInfo::getFileName() {
void void
SWGLoggingInfo::setFileName(QString* file_name) { SWGLoggingInfo::setFileName(QString* file_name) {
this->file_name = file_name; this->file_name = file_name;
this->m_file_name_isSet = true;
} }
bool
SWGLoggingInfo::isSet(){
bool isObjectUpdated = false;
do{
if(console_level != nullptr && *console_level != QString("")){ isObjectUpdated = true; break;}
if(file_level != nullptr && *file_level != QString("")){ isObjectUpdated = true; break;}
if(m_dump_to_file_isSet){ isObjectUpdated = true; break;}
if(file_name != nullptr && *file_name != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGLoggingInfo: public SWGObject { class SWGLoggingInfo: public SWGObject {
public: public:
SWGLoggingInfo(); SWGLoggingInfo();
SWGLoggingInfo(QString* json); SWGLoggingInfo(QString json);
virtual ~SWGLoggingInfo(); ~SWGLoggingInfo();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGLoggingInfo* fromJson(QString &jsonString); SWGLoggingInfo* fromJson(QString jsonString);
QString* getConsoleLevel(); QString* getConsoleLevel();
void setConsoleLevel(QString* console_level); void setConsoleLevel(QString* console_level);
@ -55,11 +54,21 @@ public:
void setFileName(QString* file_name); void setFileName(QString* file_name);
virtual bool isSet() override;
private: private:
QString* console_level; QString* console_level;
bool m_console_level_isSet;
QString* file_level; QString* file_level;
bool m_file_level_isSet;
qint32 dump_to_file; qint32 dump_to_file;
bool m_dump_to_file_isSet;
QString* file_name; QString* file_name;
bool m_file_name_isSet;
}; };
} }

View File

@ -171,14 +171,13 @@ namespace SWGSDRangel {
} }
inline void* create(QString json, QString type) { inline void* create(QString json, QString type) {
void* val = create(type);
if(val != nullptr) {
SWGObject* obj = static_cast<SWGObject*>(val);
return obj->fromJson(json);
}
if(type.startsWith("QString")) { if(type.startsWith("QString")) {
return new QString(); return new QString();
} }
auto val = static_cast<SWGObject*>(create(type));
if(val != nullptr) {
return val->fromJson(json);
}
return nullptr; return nullptr;
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGNFMDemodSettings::SWGNFMDemodSettings(QString* json) { SWGNFMDemodSettings::SWGNFMDemodSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGNFMDemodSettings::SWGNFMDemodSettings() { SWGNFMDemodSettings::SWGNFMDemodSettings() {
@ -38,22 +38,39 @@ SWGNFMDemodSettings::~SWGNFMDemodSettings() {
void void
SWGNFMDemodSettings::init() { SWGNFMDemodSettings::init() {
input_frequency_offset = 0L; input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f; rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
af_bandwidth = 0.0f; af_bandwidth = 0.0f;
m_af_bandwidth_isSet = false;
fm_deviation = 0; fm_deviation = 0;
m_fm_deviation_isSet = false;
squelch_gate = 0; squelch_gate = 0;
m_squelch_gate_isSet = false;
delta_squelch = 0; delta_squelch = 0;
m_delta_squelch_isSet = false;
squelch = 0.0f; squelch = 0.0f;
m_squelch_isSet = false;
volume = 0.0f; volume = 0.0f;
m_volume_isSet = false;
ctcss_on = 0; ctcss_on = 0;
m_ctcss_on_isSet = false;
audio_mute = 0; audio_mute = 0;
m_audio_mute_isSet = false;
ctcss_index = 0; ctcss_index = 0;
m_ctcss_index_isSet = false;
audio_sample_rate = 0; audio_sample_rate = 0;
m_audio_sample_rate_isSet = false;
copy_audio_to_udp = 0; copy_audio_to_udp = 0;
m_copy_audio_to_udp_isSet = false;
udp_address = new QString(""); udp_address = new QString("");
m_udp_address_isSet = false;
udp_port = 0; udp_port = 0;
m_udp_port_isSet = false;
rgb_color = 0; rgb_color = 0;
m_rgb_color_isSet = false;
title = new QString(""); title = new QString("");
m_title_isSet = false;
} }
void void
@ -71,20 +88,18 @@ SWGNFMDemodSettings::cleanup() {
if(udp_address != nullptr) { if(udp_address != nullptr) {
delete udp_address; delete udp_address;
} }
if(title != nullptr) { if(title != nullptr) {
delete title; delete title;
} }
} }
SWGNFMDemodSettings* SWGNFMDemodSettings*
SWGNFMDemodSettings::fromJson(QString &json) { SWGNFMDemodSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -93,73 +108,106 @@ SWGNFMDemodSettings::fromJson(QString &json) {
} }
void void
SWGNFMDemodSettings::fromJsonObject(QJsonObject &pJson) { SWGNFMDemodSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", ""); ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", ""); ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", "");
::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "qint32", ""); ::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "qint32", "");
::SWGSDRangel::setValue(&delta_squelch, pJson["deltaSquelch"], "qint32", ""); ::SWGSDRangel::setValue(&delta_squelch, pJson["deltaSquelch"], "qint32", "");
::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", ""); ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", "");
::SWGSDRangel::setValue(&volume, pJson["volume"], "float", ""); ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", ""); ::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", "");
::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", ""); ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", ""); ::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", "");
::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&copy_audio_to_udp, pJson["copyAudioToUDP"], "qint32", ""); ::SWGSDRangel::setValue(&copy_audio_to_udp, pJson["copyAudioToUDP"], "qint32", "");
::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString"); ::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString");
::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", ""); ::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
} }
QString QString
SWGNFMDemodSettings::asJson () SWGNFMDemodSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGNFMDemodSettings::asJsonObject() { SWGNFMDemodSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_input_frequency_offset_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); obj.insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
}
obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); if(m_rf_bandwidth_isSet){
obj.insert("rfBandwidth", QJsonValue(rf_bandwidth));
obj->insert("afBandwidth", QJsonValue(af_bandwidth)); }
if(m_af_bandwidth_isSet){
obj->insert("fmDeviation", QJsonValue(fm_deviation)); obj.insert("afBandwidth", QJsonValue(af_bandwidth));
}
obj->insert("squelchGate", QJsonValue(squelch_gate)); if(m_fm_deviation_isSet){
obj.insert("fmDeviation", QJsonValue(fm_deviation));
obj->insert("deltaSquelch", QJsonValue(delta_squelch)); }
if(m_squelch_gate_isSet){
obj->insert("squelch", QJsonValue(squelch)); obj.insert("squelchGate", QJsonValue(squelch_gate));
}
obj->insert("volume", QJsonValue(volume)); if(m_delta_squelch_isSet){
obj.insert("deltaSquelch", QJsonValue(delta_squelch));
obj->insert("ctcssOn", QJsonValue(ctcss_on)); }
if(m_squelch_isSet){
obj->insert("audioMute", QJsonValue(audio_mute)); obj.insert("squelch", QJsonValue(squelch));
}
obj->insert("ctcssIndex", QJsonValue(ctcss_index)); if(m_volume_isSet){
obj.insert("volume", QJsonValue(volume));
obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); }
if(m_ctcss_on_isSet){
obj->insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp)); obj.insert("ctcssOn", QJsonValue(ctcss_on));
}
if(m_audio_mute_isSet){
obj.insert("audioMute", QJsonValue(audio_mute));
}
if(m_ctcss_index_isSet){
obj.insert("ctcssIndex", QJsonValue(ctcss_index));
}
if(m_audio_sample_rate_isSet){
obj.insert("audioSampleRate", QJsonValue(audio_sample_rate));
}
if(m_copy_audio_to_udp_isSet){
obj.insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp));
}
if(udp_address != nullptr && *udp_address != QString("")){
toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString")); toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString"));
}
obj->insert("udpPort", QJsonValue(udp_port)); if(m_udp_port_isSet){
obj.insert("udpPort", QJsonValue(udp_port));
obj->insert("rgbColor", QJsonValue(rgb_color)); }
if(m_rgb_color_isSet){
obj.insert("rgbColor", QJsonValue(rgb_color));
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString"));
}
return obj; return obj;
} }
@ -171,6 +219,7 @@ SWGNFMDemodSettings::getInputFrequencyOffset() {
void void
SWGNFMDemodSettings::setInputFrequencyOffset(qint64 input_frequency_offset) { SWGNFMDemodSettings::setInputFrequencyOffset(qint64 input_frequency_offset) {
this->input_frequency_offset = input_frequency_offset; this->input_frequency_offset = input_frequency_offset;
this->m_input_frequency_offset_isSet = true;
} }
float float
@ -180,6 +229,7 @@ SWGNFMDemodSettings::getRfBandwidth() {
void void
SWGNFMDemodSettings::setRfBandwidth(float rf_bandwidth) { SWGNFMDemodSettings::setRfBandwidth(float rf_bandwidth) {
this->rf_bandwidth = rf_bandwidth; this->rf_bandwidth = rf_bandwidth;
this->m_rf_bandwidth_isSet = true;
} }
float float
@ -189,6 +239,7 @@ SWGNFMDemodSettings::getAfBandwidth() {
void void
SWGNFMDemodSettings::setAfBandwidth(float af_bandwidth) { SWGNFMDemodSettings::setAfBandwidth(float af_bandwidth) {
this->af_bandwidth = af_bandwidth; this->af_bandwidth = af_bandwidth;
this->m_af_bandwidth_isSet = true;
} }
qint32 qint32
@ -198,6 +249,7 @@ SWGNFMDemodSettings::getFmDeviation() {
void void
SWGNFMDemodSettings::setFmDeviation(qint32 fm_deviation) { SWGNFMDemodSettings::setFmDeviation(qint32 fm_deviation) {
this->fm_deviation = fm_deviation; this->fm_deviation = fm_deviation;
this->m_fm_deviation_isSet = true;
} }
qint32 qint32
@ -207,6 +259,7 @@ SWGNFMDemodSettings::getSquelchGate() {
void void
SWGNFMDemodSettings::setSquelchGate(qint32 squelch_gate) { SWGNFMDemodSettings::setSquelchGate(qint32 squelch_gate) {
this->squelch_gate = squelch_gate; this->squelch_gate = squelch_gate;
this->m_squelch_gate_isSet = true;
} }
qint32 qint32
@ -216,6 +269,7 @@ SWGNFMDemodSettings::getDeltaSquelch() {
void void
SWGNFMDemodSettings::setDeltaSquelch(qint32 delta_squelch) { SWGNFMDemodSettings::setDeltaSquelch(qint32 delta_squelch) {
this->delta_squelch = delta_squelch; this->delta_squelch = delta_squelch;
this->m_delta_squelch_isSet = true;
} }
float float
@ -225,6 +279,7 @@ SWGNFMDemodSettings::getSquelch() {
void void
SWGNFMDemodSettings::setSquelch(float squelch) { SWGNFMDemodSettings::setSquelch(float squelch) {
this->squelch = squelch; this->squelch = squelch;
this->m_squelch_isSet = true;
} }
float float
@ -234,6 +289,7 @@ SWGNFMDemodSettings::getVolume() {
void void
SWGNFMDemodSettings::setVolume(float volume) { SWGNFMDemodSettings::setVolume(float volume) {
this->volume = volume; this->volume = volume;
this->m_volume_isSet = true;
} }
qint32 qint32
@ -243,6 +299,7 @@ SWGNFMDemodSettings::getCtcssOn() {
void void
SWGNFMDemodSettings::setCtcssOn(qint32 ctcss_on) { SWGNFMDemodSettings::setCtcssOn(qint32 ctcss_on) {
this->ctcss_on = ctcss_on; this->ctcss_on = ctcss_on;
this->m_ctcss_on_isSet = true;
} }
qint32 qint32
@ -252,6 +309,7 @@ SWGNFMDemodSettings::getAudioMute() {
void void
SWGNFMDemodSettings::setAudioMute(qint32 audio_mute) { SWGNFMDemodSettings::setAudioMute(qint32 audio_mute) {
this->audio_mute = audio_mute; this->audio_mute = audio_mute;
this->m_audio_mute_isSet = true;
} }
qint32 qint32
@ -261,6 +319,7 @@ SWGNFMDemodSettings::getCtcssIndex() {
void void
SWGNFMDemodSettings::setCtcssIndex(qint32 ctcss_index) { SWGNFMDemodSettings::setCtcssIndex(qint32 ctcss_index) {
this->ctcss_index = ctcss_index; this->ctcss_index = ctcss_index;
this->m_ctcss_index_isSet = true;
} }
qint32 qint32
@ -270,6 +329,7 @@ SWGNFMDemodSettings::getAudioSampleRate() {
void void
SWGNFMDemodSettings::setAudioSampleRate(qint32 audio_sample_rate) { SWGNFMDemodSettings::setAudioSampleRate(qint32 audio_sample_rate) {
this->audio_sample_rate = audio_sample_rate; this->audio_sample_rate = audio_sample_rate;
this->m_audio_sample_rate_isSet = true;
} }
qint32 qint32
@ -279,6 +339,7 @@ SWGNFMDemodSettings::getCopyAudioToUdp() {
void void
SWGNFMDemodSettings::setCopyAudioToUdp(qint32 copy_audio_to_udp) { SWGNFMDemodSettings::setCopyAudioToUdp(qint32 copy_audio_to_udp) {
this->copy_audio_to_udp = copy_audio_to_udp; this->copy_audio_to_udp = copy_audio_to_udp;
this->m_copy_audio_to_udp_isSet = true;
} }
QString* QString*
@ -288,6 +349,7 @@ SWGNFMDemodSettings::getUdpAddress() {
void void
SWGNFMDemodSettings::setUdpAddress(QString* udp_address) { SWGNFMDemodSettings::setUdpAddress(QString* udp_address) {
this->udp_address = udp_address; this->udp_address = udp_address;
this->m_udp_address_isSet = true;
} }
qint32 qint32
@ -297,6 +359,7 @@ SWGNFMDemodSettings::getUdpPort() {
void void
SWGNFMDemodSettings::setUdpPort(qint32 udp_port) { SWGNFMDemodSettings::setUdpPort(qint32 udp_port) {
this->udp_port = udp_port; this->udp_port = udp_port;
this->m_udp_port_isSet = true;
} }
qint32 qint32
@ -306,6 +369,7 @@ SWGNFMDemodSettings::getRgbColor() {
void void
SWGNFMDemodSettings::setRgbColor(qint32 rgb_color) { SWGNFMDemodSettings::setRgbColor(qint32 rgb_color) {
this->rgb_color = rgb_color; this->rgb_color = rgb_color;
this->m_rgb_color_isSet = true;
} }
QString* QString*
@ -315,8 +379,33 @@ SWGNFMDemodSettings::getTitle() {
void void
SWGNFMDemodSettings::setTitle(QString* title) { SWGNFMDemodSettings::setTitle(QString* title) {
this->title = title; this->title = title;
this->m_title_isSet = true;
} }
bool
SWGNFMDemodSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
if(m_squelch_gate_isSet){ isObjectUpdated = true; break;}
if(m_delta_squelch_isSet){ isObjectUpdated = true; break;}
if(m_squelch_isSet){ isObjectUpdated = true; break;}
if(m_volume_isSet){ isObjectUpdated = true; break;}
if(m_ctcss_on_isSet){ isObjectUpdated = true; break;}
if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
if(m_ctcss_index_isSet){ isObjectUpdated = true; break;}
if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_copy_audio_to_udp_isSet){ isObjectUpdated = true; break;}
if(udp_address != nullptr && *udp_address != QString("")){ isObjectUpdated = true; break;}
if(m_udp_port_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGNFMDemodSettings: public SWGObject { class SWGNFMDemodSettings: public SWGObject {
public: public:
SWGNFMDemodSettings(); SWGNFMDemodSettings();
SWGNFMDemodSettings(QString* json); SWGNFMDemodSettings(QString json);
virtual ~SWGNFMDemodSettings(); ~SWGNFMDemodSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGNFMDemodSettings* fromJson(QString &jsonString); SWGNFMDemodSettings* fromJson(QString jsonString);
qint64 getInputFrequencyOffset(); qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset); void setInputFrequencyOffset(qint64 input_frequency_offset);
@ -94,24 +93,60 @@ public:
void setTitle(QString* title); void setTitle(QString* title);
virtual bool isSet() override;
private: private:
qint64 input_frequency_offset; qint64 input_frequency_offset;
bool m_input_frequency_offset_isSet;
float rf_bandwidth; float rf_bandwidth;
bool m_rf_bandwidth_isSet;
float af_bandwidth; float af_bandwidth;
bool m_af_bandwidth_isSet;
qint32 fm_deviation; qint32 fm_deviation;
bool m_fm_deviation_isSet;
qint32 squelch_gate; qint32 squelch_gate;
bool m_squelch_gate_isSet;
qint32 delta_squelch; qint32 delta_squelch;
bool m_delta_squelch_isSet;
float squelch; float squelch;
bool m_squelch_isSet;
float volume; float volume;
bool m_volume_isSet;
qint32 ctcss_on; qint32 ctcss_on;
bool m_ctcss_on_isSet;
qint32 audio_mute; qint32 audio_mute;
bool m_audio_mute_isSet;
qint32 ctcss_index; qint32 ctcss_index;
bool m_ctcss_index_isSet;
qint32 audio_sample_rate; qint32 audio_sample_rate;
bool m_audio_sample_rate_isSet;
qint32 copy_audio_to_udp; qint32 copy_audio_to_udp;
bool m_copy_audio_to_udp_isSet;
QString* udp_address; QString* udp_address;
bool m_udp_address_isSet;
qint32 udp_port; qint32 udp_port;
bool m_udp_port_isSet;
qint32 rgb_color; qint32 rgb_color;
bool m_rgb_color_isSet;
QString* title; QString* title;
bool m_title_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGNFMModSettings::SWGNFMModSettings(QString* json) { SWGNFMModSettings::SWGNFMModSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGNFMModSettings::SWGNFMModSettings() { SWGNFMModSettings::SWGNFMModSettings() {
@ -38,20 +38,35 @@ SWGNFMModSettings::~SWGNFMModSettings() {
void void
SWGNFMModSettings::init() { SWGNFMModSettings::init() {
input_frequency_offset = 0L; input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f; rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
af_bandwidth = 0.0f; af_bandwidth = 0.0f;
m_af_bandwidth_isSet = false;
fm_deviation = 0.0f; fm_deviation = 0.0f;
m_fm_deviation_isSet = false;
tone_frequency = 0.0f; tone_frequency = 0.0f;
m_tone_frequency_isSet = false;
volume_factor = 0.0f; volume_factor = 0.0f;
m_volume_factor_isSet = false;
audio_sample_rate = 0; audio_sample_rate = 0;
m_audio_sample_rate_isSet = false;
channel_mute = 0; channel_mute = 0;
m_channel_mute_isSet = false;
play_loop = 0; play_loop = 0;
m_play_loop_isSet = false;
ctcss_on = 0; ctcss_on = 0;
m_ctcss_on_isSet = false;
ctcss_index = 0; ctcss_index = 0;
m_ctcss_index_isSet = false;
rgb_color = 0; rgb_color = 0;
m_rgb_color_isSet = false;
title = new QString(""); title = new QString("");
m_title_isSet = false;
mod_af_input = 0; mod_af_input = 0;
m_mod_af_input_isSet = false;
cw_keyer = new SWGCWKeyerSettings(); cw_keyer = new SWGCWKeyerSettings();
m_cw_keyer_isSet = false;
} }
void void
@ -68,19 +83,17 @@ SWGNFMModSettings::cleanup() {
if(title != nullptr) { if(title != nullptr) {
delete title; delete title;
} }
if(cw_keyer != nullptr) { if(cw_keyer != nullptr) {
delete cw_keyer; delete cw_keyer;
} }
} }
SWGNFMModSettings* SWGNFMModSettings*
SWGNFMModSettings::fromJson(QString &json) { SWGNFMModSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -89,67 +102,96 @@ SWGNFMModSettings::fromJson(QString &json) {
} }
void void
SWGNFMModSettings::fromJsonObject(QJsonObject &pJson) { SWGNFMModSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", ""); ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", ""); ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", "");
::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", ""); ::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", ""); ::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", ""); ::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", "");
::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", ""); ::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", ""); ::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", "");
::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", ""); ::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", ""); ::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", "");
::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings"); ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
} }
QString QString
SWGNFMModSettings::asJson () SWGNFMModSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGNFMModSettings::asJsonObject() { SWGNFMModSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_input_frequency_offset_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); obj.insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
}
obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); if(m_rf_bandwidth_isSet){
obj.insert("rfBandwidth", QJsonValue(rf_bandwidth));
obj->insert("afBandwidth", QJsonValue(af_bandwidth)); }
if(m_af_bandwidth_isSet){
obj->insert("fmDeviation", QJsonValue(fm_deviation)); obj.insert("afBandwidth", QJsonValue(af_bandwidth));
}
obj->insert("toneFrequency", QJsonValue(tone_frequency)); if(m_fm_deviation_isSet){
obj.insert("fmDeviation", QJsonValue(fm_deviation));
obj->insert("volumeFactor", QJsonValue(volume_factor)); }
if(m_tone_frequency_isSet){
obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); obj.insert("toneFrequency", QJsonValue(tone_frequency));
}
obj->insert("channelMute", QJsonValue(channel_mute)); if(m_volume_factor_isSet){
obj.insert("volumeFactor", QJsonValue(volume_factor));
obj->insert("playLoop", QJsonValue(play_loop)); }
if(m_audio_sample_rate_isSet){
obj->insert("ctcssOn", QJsonValue(ctcss_on)); obj.insert("audioSampleRate", QJsonValue(audio_sample_rate));
}
obj->insert("ctcssIndex", QJsonValue(ctcss_index)); if(m_channel_mute_isSet){
obj.insert("channelMute", QJsonValue(channel_mute));
obj->insert("rgbColor", QJsonValue(rgb_color)); }
if(m_play_loop_isSet){
obj.insert("playLoop", QJsonValue(play_loop));
}
if(m_ctcss_on_isSet){
obj.insert("ctcssOn", QJsonValue(ctcss_on));
}
if(m_ctcss_index_isSet){
obj.insert("ctcssIndex", QJsonValue(ctcss_index));
}
if(m_rgb_color_isSet){
obj.insert("rgbColor", QJsonValue(rgb_color));
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString"));
}
obj->insert("modAFInput", QJsonValue(mod_af_input)); if(m_mod_af_input_isSet){
obj.insert("modAFInput", QJsonValue(mod_af_input));
}
if((cw_keyer != nullptr) && (cw_keyer->isSet())){
toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings")); toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
}
return obj; return obj;
} }
@ -161,6 +203,7 @@ SWGNFMModSettings::getInputFrequencyOffset() {
void void
SWGNFMModSettings::setInputFrequencyOffset(qint64 input_frequency_offset) { SWGNFMModSettings::setInputFrequencyOffset(qint64 input_frequency_offset) {
this->input_frequency_offset = input_frequency_offset; this->input_frequency_offset = input_frequency_offset;
this->m_input_frequency_offset_isSet = true;
} }
float float
@ -170,6 +213,7 @@ SWGNFMModSettings::getRfBandwidth() {
void void
SWGNFMModSettings::setRfBandwidth(float rf_bandwidth) { SWGNFMModSettings::setRfBandwidth(float rf_bandwidth) {
this->rf_bandwidth = rf_bandwidth; this->rf_bandwidth = rf_bandwidth;
this->m_rf_bandwidth_isSet = true;
} }
float float
@ -179,6 +223,7 @@ SWGNFMModSettings::getAfBandwidth() {
void void
SWGNFMModSettings::setAfBandwidth(float af_bandwidth) { SWGNFMModSettings::setAfBandwidth(float af_bandwidth) {
this->af_bandwidth = af_bandwidth; this->af_bandwidth = af_bandwidth;
this->m_af_bandwidth_isSet = true;
} }
float float
@ -188,6 +233,7 @@ SWGNFMModSettings::getFmDeviation() {
void void
SWGNFMModSettings::setFmDeviation(float fm_deviation) { SWGNFMModSettings::setFmDeviation(float fm_deviation) {
this->fm_deviation = fm_deviation; this->fm_deviation = fm_deviation;
this->m_fm_deviation_isSet = true;
} }
float float
@ -197,6 +243,7 @@ SWGNFMModSettings::getToneFrequency() {
void void
SWGNFMModSettings::setToneFrequency(float tone_frequency) { SWGNFMModSettings::setToneFrequency(float tone_frequency) {
this->tone_frequency = tone_frequency; this->tone_frequency = tone_frequency;
this->m_tone_frequency_isSet = true;
} }
float float
@ -206,6 +253,7 @@ SWGNFMModSettings::getVolumeFactor() {
void void
SWGNFMModSettings::setVolumeFactor(float volume_factor) { SWGNFMModSettings::setVolumeFactor(float volume_factor) {
this->volume_factor = volume_factor; this->volume_factor = volume_factor;
this->m_volume_factor_isSet = true;
} }
qint32 qint32
@ -215,6 +263,7 @@ SWGNFMModSettings::getAudioSampleRate() {
void void
SWGNFMModSettings::setAudioSampleRate(qint32 audio_sample_rate) { SWGNFMModSettings::setAudioSampleRate(qint32 audio_sample_rate) {
this->audio_sample_rate = audio_sample_rate; this->audio_sample_rate = audio_sample_rate;
this->m_audio_sample_rate_isSet = true;
} }
qint32 qint32
@ -224,6 +273,7 @@ SWGNFMModSettings::getChannelMute() {
void void
SWGNFMModSettings::setChannelMute(qint32 channel_mute) { SWGNFMModSettings::setChannelMute(qint32 channel_mute) {
this->channel_mute = channel_mute; this->channel_mute = channel_mute;
this->m_channel_mute_isSet = true;
} }
qint32 qint32
@ -233,6 +283,7 @@ SWGNFMModSettings::getPlayLoop() {
void void
SWGNFMModSettings::setPlayLoop(qint32 play_loop) { SWGNFMModSettings::setPlayLoop(qint32 play_loop) {
this->play_loop = play_loop; this->play_loop = play_loop;
this->m_play_loop_isSet = true;
} }
qint32 qint32
@ -242,6 +293,7 @@ SWGNFMModSettings::getCtcssOn() {
void void
SWGNFMModSettings::setCtcssOn(qint32 ctcss_on) { SWGNFMModSettings::setCtcssOn(qint32 ctcss_on) {
this->ctcss_on = ctcss_on; this->ctcss_on = ctcss_on;
this->m_ctcss_on_isSet = true;
} }
qint32 qint32
@ -251,6 +303,7 @@ SWGNFMModSettings::getCtcssIndex() {
void void
SWGNFMModSettings::setCtcssIndex(qint32 ctcss_index) { SWGNFMModSettings::setCtcssIndex(qint32 ctcss_index) {
this->ctcss_index = ctcss_index; this->ctcss_index = ctcss_index;
this->m_ctcss_index_isSet = true;
} }
qint32 qint32
@ -260,6 +313,7 @@ SWGNFMModSettings::getRgbColor() {
void void
SWGNFMModSettings::setRgbColor(qint32 rgb_color) { SWGNFMModSettings::setRgbColor(qint32 rgb_color) {
this->rgb_color = rgb_color; this->rgb_color = rgb_color;
this->m_rgb_color_isSet = true;
} }
QString* QString*
@ -269,6 +323,7 @@ SWGNFMModSettings::getTitle() {
void void
SWGNFMModSettings::setTitle(QString* title) { SWGNFMModSettings::setTitle(QString* title) {
this->title = title; this->title = title;
this->m_title_isSet = true;
} }
qint32 qint32
@ -278,6 +333,7 @@ SWGNFMModSettings::getModAfInput() {
void void
SWGNFMModSettings::setModAfInput(qint32 mod_af_input) { SWGNFMModSettings::setModAfInput(qint32 mod_af_input) {
this->mod_af_input = mod_af_input; this->mod_af_input = mod_af_input;
this->m_mod_af_input_isSet = true;
} }
SWGCWKeyerSettings* SWGCWKeyerSettings*
@ -287,8 +343,31 @@ SWGNFMModSettings::getCwKeyer() {
void void
SWGNFMModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) { SWGNFMModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) {
this->cw_keyer = cw_keyer; this->cw_keyer = cw_keyer;
this->m_cw_keyer_isSet = true;
} }
bool
SWGNFMModSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_channel_mute_isSet){ isObjectUpdated = true; break;}
if(m_play_loop_isSet){ isObjectUpdated = true; break;}
if(m_ctcss_on_isSet){ isObjectUpdated = true; break;}
if(m_ctcss_index_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(m_mod_af_input_isSet){ isObjectUpdated = true; break;}
if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGNFMModSettings: public SWGObject { class SWGNFMModSettings: public SWGObject {
public: public:
SWGNFMModSettings(); SWGNFMModSettings();
SWGNFMModSettings(QString* json); SWGNFMModSettings(QString json);
virtual ~SWGNFMModSettings(); ~SWGNFMModSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGNFMModSettings* fromJson(QString &jsonString); SWGNFMModSettings* fromJson(QString jsonString);
qint64 getInputFrequencyOffset(); qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset); void setInputFrequencyOffset(qint64 input_frequency_offset);
@ -89,22 +88,54 @@ public:
void setCwKeyer(SWGCWKeyerSettings* cw_keyer); void setCwKeyer(SWGCWKeyerSettings* cw_keyer);
virtual bool isSet() override;
private: private:
qint64 input_frequency_offset; qint64 input_frequency_offset;
bool m_input_frequency_offset_isSet;
float rf_bandwidth; float rf_bandwidth;
bool m_rf_bandwidth_isSet;
float af_bandwidth; float af_bandwidth;
bool m_af_bandwidth_isSet;
float fm_deviation; float fm_deviation;
bool m_fm_deviation_isSet;
float tone_frequency; float tone_frequency;
bool m_tone_frequency_isSet;
float volume_factor; float volume_factor;
bool m_volume_factor_isSet;
qint32 audio_sample_rate; qint32 audio_sample_rate;
bool m_audio_sample_rate_isSet;
qint32 channel_mute; qint32 channel_mute;
bool m_channel_mute_isSet;
qint32 play_loop; qint32 play_loop;
bool m_play_loop_isSet;
qint32 ctcss_on; qint32 ctcss_on;
bool m_ctcss_on_isSet;
qint32 ctcss_index; qint32 ctcss_index;
bool m_ctcss_index_isSet;
qint32 rgb_color; qint32 rgb_color;
bool m_rgb_color_isSet;
QString* title; QString* title;
bool m_title_isSet;
qint32 mod_af_input; qint32 mod_af_input;
bool m_mod_af_input_isSet;
SWGCWKeyerSettings* cw_keyer; SWGCWKeyerSettings* cw_keyer;
bool m_cw_keyer_isSet;
}; };
} }

View File

@ -19,20 +19,23 @@ namespace SWGSDRangel {
class SWGObject { class SWGObject {
public: public:
virtual QJsonObject* asJsonObject() { virtual QJsonObject asJsonObject() {
return nullptr; return QJsonObject();
} }
virtual ~SWGObject() {} virtual ~SWGObject() {}
virtual SWGObject* fromJson(QString &jsonString) { virtual SWGObject* fromJson(QString jsonString) {
Q_UNUSED(jsonString); Q_UNUSED(jsonString);
return nullptr; return new SWGObject();
} }
virtual void fromJsonObject(QJsonObject &json) { virtual void fromJsonObject(QJsonObject json) {
Q_UNUSED(json); Q_UNUSED(json);
} }
virtual QString asJson() { virtual QString asJson() {
return QString(""); return QString("");
} }
virtual bool isSet() {
return false;
}
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetExport::SWGPresetExport(QString* json) { SWGPresetExport::SWGPresetExport(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresetExport::SWGPresetExport() { SWGPresetExport::SWGPresetExport() {
@ -38,23 +38,23 @@ SWGPresetExport::~SWGPresetExport() {
void void
SWGPresetExport::init() { SWGPresetExport::init() {
file_path = new QString(""); file_path = new QString("");
m_file_path_isSet = false;
preset = new SWGPresetIdentifier(); preset = new SWGPresetIdentifier();
m_preset_isSet = false;
} }
void void
SWGPresetExport::cleanup() { SWGPresetExport::cleanup() {
if(file_path != nullptr) { if(file_path != nullptr) {
delete file_path; delete file_path;
} }
if(preset != nullptr) { if(preset != nullptr) {
delete preset; delete preset;
} }
} }
SWGPresetExport* SWGPresetExport*
SWGPresetExport::fromJson(QString &json) { SWGPresetExport::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -63,28 +63,31 @@ SWGPresetExport::fromJson(QString &json) {
} }
void void
SWGPresetExport::fromJsonObject(QJsonObject &pJson) { SWGPresetExport::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString"); ::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier"); ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
} }
QString QString
SWGPresetExport::asJson () SWGPresetExport::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresetExport::asJsonObject() { SWGPresetExport::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(file_path != nullptr && *file_path != QString("")){
toJsonValue(QString("filePath"), file_path, obj, QString("QString")); toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
}
if((preset != nullptr) && (preset->isSet())){
toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier")); toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier"));
}
return obj; return obj;
} }
@ -96,6 +99,7 @@ SWGPresetExport::getFilePath() {
void void
SWGPresetExport::setFilePath(QString* file_path) { SWGPresetExport::setFilePath(QString* file_path) {
this->file_path = file_path; this->file_path = file_path;
this->m_file_path_isSet = true;
} }
SWGPresetIdentifier* SWGPresetIdentifier*
@ -105,8 +109,18 @@ SWGPresetExport::getPreset() {
void void
SWGPresetExport::setPreset(SWGPresetIdentifier* preset) { SWGPresetExport::setPreset(SWGPresetIdentifier* preset) {
this->preset = preset; this->preset = preset;
this->m_preset_isSet = true;
} }
bool
SWGPresetExport::isSet(){
bool isObjectUpdated = false;
do{
if(file_path != nullptr && *file_path != QString("")){ isObjectUpdated = true; break;}
if(preset != nullptr && preset->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresetExport: public SWGObject { class SWGPresetExport: public SWGObject {
public: public:
SWGPresetExport(); SWGPresetExport();
SWGPresetExport(QString* json); SWGPresetExport(QString json);
virtual ~SWGPresetExport(); ~SWGPresetExport();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresetExport* fromJson(QString &jsonString); SWGPresetExport* fromJson(QString jsonString);
QString* getFilePath(); QString* getFilePath();
void setFilePath(QString* file_path); void setFilePath(QString* file_path);
@ -50,9 +49,15 @@ public:
void setPreset(SWGPresetIdentifier* preset); void setPreset(SWGPresetIdentifier* preset);
virtual bool isSet() override;
private: private:
QString* file_path; QString* file_path;
bool m_file_path_isSet;
SWGPresetIdentifier* preset; SWGPresetIdentifier* preset;
bool m_preset_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetGroup::SWGPresetGroup(QString* json) { SWGPresetGroup::SWGPresetGroup(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresetGroup::SWGPresetGroup() { SWGPresetGroup::SWGPresetGroup() {
@ -38,21 +38,22 @@ SWGPresetGroup::~SWGPresetGroup() {
void void
SWGPresetGroup::init() { SWGPresetGroup::init() {
group_name = new QString(""); group_name = new QString("");
m_group_name_isSet = false;
nb_presets = 0; nb_presets = 0;
m_nb_presets_isSet = false;
presets = new QList<SWGPresetItem*>(); presets = new QList<SWGPresetItem*>();
m_presets_isSet = false;
} }
void void
SWGPresetGroup::cleanup() { SWGPresetGroup::cleanup() {
if(group_name != nullptr) { if(group_name != nullptr) {
delete group_name; delete group_name;
} }
if(presets != nullptr) { if(presets != nullptr) {
QList<SWGPresetItem*>* arr = presets; auto arr = presets;
foreach(SWGPresetItem* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete presets; delete presets;
@ -60,7 +61,7 @@ SWGPresetGroup::cleanup() {
} }
SWGPresetGroup* SWGPresetGroup*
SWGPresetGroup::fromJson(QString &json) { SWGPresetGroup::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -69,35 +70,36 @@ SWGPresetGroup::fromJson(QString &json) {
} }
void void
SWGPresetGroup::fromJsonObject(QJsonObject &pJson) { SWGPresetGroup::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString"); ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
::SWGSDRangel::setValue(&nb_presets, pJson["nbPresets"], "qint32", ""); ::SWGSDRangel::setValue(&nb_presets, pJson["nbPresets"], "qint32", "");
::SWGSDRangel::setValue(&presets, pJson["presets"], "QList", "SWGPresetItem");
::SWGSDRangel::setValue(&presets, pJson["presets"], "QList", "SWGPresetItem");
} }
QString QString
SWGPresetGroup::asJson () SWGPresetGroup::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresetGroup::asJsonObject() { SWGPresetGroup::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(group_name != nullptr && *group_name != QString("")){
toJsonValue(QString("groupName"), group_name, obj, QString("QString")); toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
}
obj->insert("nbPresets", QJsonValue(nb_presets)); if(m_nb_presets_isSet){
obj.insert("nbPresets", QJsonValue(nb_presets));
QJsonArray presetsJsonArray; }
toJsonArray((QList<void*>*)presets, &presetsJsonArray, "presets", "SWGPresetItem"); if(presets->size() > 0){
obj->insert("presets", presetsJsonArray); toJsonArray((QList<void*>*)presets, obj, "presets", "SWGPresetItem");
}
return obj; return obj;
} }
@ -109,6 +111,7 @@ SWGPresetGroup::getGroupName() {
void void
SWGPresetGroup::setGroupName(QString* group_name) { SWGPresetGroup::setGroupName(QString* group_name) {
this->group_name = group_name; this->group_name = group_name;
this->m_group_name_isSet = true;
} }
qint32 qint32
@ -118,6 +121,7 @@ SWGPresetGroup::getNbPresets() {
void void
SWGPresetGroup::setNbPresets(qint32 nb_presets) { SWGPresetGroup::setNbPresets(qint32 nb_presets) {
this->nb_presets = nb_presets; this->nb_presets = nb_presets;
this->m_nb_presets_isSet = true;
} }
QList<SWGPresetItem*>* QList<SWGPresetItem*>*
@ -127,8 +131,19 @@ SWGPresetGroup::getPresets() {
void void
SWGPresetGroup::setPresets(QList<SWGPresetItem*>* presets) { SWGPresetGroup::setPresets(QList<SWGPresetItem*>* presets) {
this->presets = presets; this->presets = presets;
this->m_presets_isSet = true;
} }
bool
SWGPresetGroup::isSet(){
bool isObjectUpdated = false;
do{
if(group_name != nullptr && *group_name != QString("")){ isObjectUpdated = true; break;}
if(m_nb_presets_isSet){ isObjectUpdated = true; break;}
if(presets->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -28,21 +28,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresetGroup: public SWGObject { class SWGPresetGroup: public SWGObject {
public: public:
SWGPresetGroup(); SWGPresetGroup();
SWGPresetGroup(QString* json); SWGPresetGroup(QString json);
virtual ~SWGPresetGroup(); ~SWGPresetGroup();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresetGroup* fromJson(QString &jsonString); SWGPresetGroup* fromJson(QString jsonString);
QString* getGroupName(); QString* getGroupName();
void setGroupName(QString* group_name); void setGroupName(QString* group_name);
@ -54,10 +53,18 @@ public:
void setPresets(QList<SWGPresetItem*>* presets); void setPresets(QList<SWGPresetItem*>* presets);
virtual bool isSet() override;
private: private:
QString* group_name; QString* group_name;
bool m_group_name_isSet;
qint32 nb_presets; qint32 nb_presets;
bool m_nb_presets_isSet;
QList<SWGPresetItem*>* presets; QList<SWGPresetItem*>* presets;
bool m_presets_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetIdentifier::SWGPresetIdentifier(QString* json) { SWGPresetIdentifier::SWGPresetIdentifier(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresetIdentifier::SWGPresetIdentifier() { SWGPresetIdentifier::SWGPresetIdentifier() {
@ -38,30 +38,31 @@ SWGPresetIdentifier::~SWGPresetIdentifier() {
void void
SWGPresetIdentifier::init() { SWGPresetIdentifier::init() {
group_name = new QString(""); group_name = new QString("");
m_group_name_isSet = false;
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
type = new QString(""); type = new QString("");
m_type_isSet = false;
name = new QString(""); name = new QString("");
m_name_isSet = false;
} }
void void
SWGPresetIdentifier::cleanup() { SWGPresetIdentifier::cleanup() {
if(group_name != nullptr) { if(group_name != nullptr) {
delete group_name; delete group_name;
} }
if(type != nullptr) { if(type != nullptr) {
delete type; delete type;
} }
if(name != nullptr) { if(name != nullptr) {
delete name; delete name;
} }
} }
SWGPresetIdentifier* SWGPresetIdentifier*
SWGPresetIdentifier::fromJson(QString &json) { SWGPresetIdentifier::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -70,34 +71,41 @@ SWGPresetIdentifier::fromJson(QString &json) {
} }
void void
SWGPresetIdentifier::fromJsonObject(QJsonObject &pJson) { SWGPresetIdentifier::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString"); ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString"); ::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString");
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString"); ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
} }
QString QString
SWGPresetIdentifier::asJson () SWGPresetIdentifier::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresetIdentifier::asJsonObject() { SWGPresetIdentifier::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(group_name != nullptr && *group_name != QString("")){
toJsonValue(QString("groupName"), group_name, obj, QString("QString")); toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
}
obj->insert("centerFrequency", QJsonValue(center_frequency)); if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency));
}
if(type != nullptr && *type != QString("")){
toJsonValue(QString("type"), type, obj, QString("QString")); toJsonValue(QString("type"), type, obj, QString("QString"));
}
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString"));
}
return obj; return obj;
} }
@ -109,6 +117,7 @@ SWGPresetIdentifier::getGroupName() {
void void
SWGPresetIdentifier::setGroupName(QString* group_name) { SWGPresetIdentifier::setGroupName(QString* group_name) {
this->group_name = group_name; this->group_name = group_name;
this->m_group_name_isSet = true;
} }
qint64 qint64
@ -118,6 +127,7 @@ SWGPresetIdentifier::getCenterFrequency() {
void void
SWGPresetIdentifier::setCenterFrequency(qint64 center_frequency) { SWGPresetIdentifier::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
QString* QString*
@ -127,6 +137,7 @@ SWGPresetIdentifier::getType() {
void void
SWGPresetIdentifier::setType(QString* type) { SWGPresetIdentifier::setType(QString* type) {
this->type = type; this->type = type;
this->m_type_isSet = true;
} }
QString* QString*
@ -136,8 +147,20 @@ SWGPresetIdentifier::getName() {
void void
SWGPresetIdentifier::setName(QString* name) { SWGPresetIdentifier::setName(QString* name) {
this->name = name; this->name = name;
this->m_name_isSet = true;
} }
bool
SWGPresetIdentifier::isSet(){
bool isObjectUpdated = false;
do{
if(group_name != nullptr && *group_name != QString("")){ isObjectUpdated = true; break;}
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(type != nullptr && *type != QString("")){ isObjectUpdated = true; break;}
if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresetIdentifier: public SWGObject { class SWGPresetIdentifier: public SWGObject {
public: public:
SWGPresetIdentifier(); SWGPresetIdentifier();
SWGPresetIdentifier(QString* json); SWGPresetIdentifier(QString json);
virtual ~SWGPresetIdentifier(); ~SWGPresetIdentifier();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresetIdentifier* fromJson(QString &jsonString); SWGPresetIdentifier* fromJson(QString jsonString);
QString* getGroupName(); QString* getGroupName();
void setGroupName(QString* group_name); void setGroupName(QString* group_name);
@ -55,11 +54,21 @@ public:
void setName(QString* name); void setName(QString* name);
virtual bool isSet() override;
private: private:
QString* group_name; QString* group_name;
bool m_group_name_isSet;
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
QString* type; QString* type;
bool m_type_isSet;
QString* name; QString* name;
bool m_name_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetImport::SWGPresetImport(QString* json) { SWGPresetImport::SWGPresetImport(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresetImport::SWGPresetImport() { SWGPresetImport::SWGPresetImport() {
@ -38,28 +38,28 @@ SWGPresetImport::~SWGPresetImport() {
void void
SWGPresetImport::init() { SWGPresetImport::init() {
group_name = new QString(""); group_name = new QString("");
m_group_name_isSet = false;
description = new QString(""); description = new QString("");
m_description_isSet = false;
file_path = new QString(""); file_path = new QString("");
m_file_path_isSet = false;
} }
void void
SWGPresetImport::cleanup() { SWGPresetImport::cleanup() {
if(group_name != nullptr) { if(group_name != nullptr) {
delete group_name; delete group_name;
} }
if(description != nullptr) { if(description != nullptr) {
delete description; delete description;
} }
if(file_path != nullptr) { if(file_path != nullptr) {
delete file_path; delete file_path;
} }
} }
SWGPresetImport* SWGPresetImport*
SWGPresetImport::fromJson(QString &json) { SWGPresetImport::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -68,31 +68,36 @@ SWGPresetImport::fromJson(QString &json) {
} }
void void
SWGPresetImport::fromJsonObject(QJsonObject &pJson) { SWGPresetImport::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString"); ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
::SWGSDRangel::setValue(&description, pJson["description"], "QString", "QString"); ::SWGSDRangel::setValue(&description, pJson["description"], "QString", "QString");
::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString"); ::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
} }
QString QString
SWGPresetImport::asJson () SWGPresetImport::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresetImport::asJsonObject() { SWGPresetImport::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(group_name != nullptr && *group_name != QString("")){
toJsonValue(QString("groupName"), group_name, obj, QString("QString")); toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
}
if(description != nullptr && *description != QString("")){
toJsonValue(QString("description"), description, obj, QString("QString")); toJsonValue(QString("description"), description, obj, QString("QString"));
}
if(file_path != nullptr && *file_path != QString("")){
toJsonValue(QString("filePath"), file_path, obj, QString("QString")); toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
}
return obj; return obj;
} }
@ -104,6 +109,7 @@ SWGPresetImport::getGroupName() {
void void
SWGPresetImport::setGroupName(QString* group_name) { SWGPresetImport::setGroupName(QString* group_name) {
this->group_name = group_name; this->group_name = group_name;
this->m_group_name_isSet = true;
} }
QString* QString*
@ -113,6 +119,7 @@ SWGPresetImport::getDescription() {
void void
SWGPresetImport::setDescription(QString* description) { SWGPresetImport::setDescription(QString* description) {
this->description = description; this->description = description;
this->m_description_isSet = true;
} }
QString* QString*
@ -122,8 +129,19 @@ SWGPresetImport::getFilePath() {
void void
SWGPresetImport::setFilePath(QString* file_path) { SWGPresetImport::setFilePath(QString* file_path) {
this->file_path = file_path; this->file_path = file_path;
this->m_file_path_isSet = true;
} }
bool
SWGPresetImport::isSet(){
bool isObjectUpdated = false;
do{
if(group_name != nullptr && *group_name != QString("")){ isObjectUpdated = true; break;}
if(description != nullptr && *description != QString("")){ isObjectUpdated = true; break;}
if(file_path != nullptr && *file_path != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresetImport: public SWGObject { class SWGPresetImport: public SWGObject {
public: public:
SWGPresetImport(); SWGPresetImport();
SWGPresetImport(QString* json); SWGPresetImport(QString json);
virtual ~SWGPresetImport(); ~SWGPresetImport();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresetImport* fromJson(QString &jsonString); SWGPresetImport* fromJson(QString jsonString);
QString* getGroupName(); QString* getGroupName();
void setGroupName(QString* group_name); void setGroupName(QString* group_name);
@ -52,10 +51,18 @@ public:
void setFilePath(QString* file_path); void setFilePath(QString* file_path);
virtual bool isSet() override;
private: private:
QString* group_name; QString* group_name;
bool m_group_name_isSet;
QString* description; QString* description;
bool m_description_isSet;
QString* file_path; QString* file_path;
bool m_file_path_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetItem::SWGPresetItem(QString* json) { SWGPresetItem::SWGPresetItem(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresetItem::SWGPresetItem() { SWGPresetItem::SWGPresetItem() {
@ -38,25 +38,26 @@ SWGPresetItem::~SWGPresetItem() {
void void
SWGPresetItem::init() { SWGPresetItem::init() {
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
type = new QString(""); type = new QString("");
m_type_isSet = false;
name = new QString(""); name = new QString("");
m_name_isSet = false;
} }
void void
SWGPresetItem::cleanup() { SWGPresetItem::cleanup() {
if(type != nullptr) { if(type != nullptr) {
delete type; delete type;
} }
if(name != nullptr) { if(name != nullptr) {
delete name; delete name;
} }
} }
SWGPresetItem* SWGPresetItem*
SWGPresetItem::fromJson(QString &json) { SWGPresetItem::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -65,31 +66,36 @@ SWGPresetItem::fromJson(QString &json) {
} }
void void
SWGPresetItem::fromJsonObject(QJsonObject &pJson) { SWGPresetItem::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString"); ::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString");
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString"); ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
} }
QString QString
SWGPresetItem::asJson () SWGPresetItem::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresetItem::asJsonObject() { SWGPresetItem::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_center_frequency_isSet){
obj->insert("centerFrequency", QJsonValue(center_frequency)); obj.insert("centerFrequency", QJsonValue(center_frequency));
}
if(type != nullptr && *type != QString("")){
toJsonValue(QString("type"), type, obj, QString("QString")); toJsonValue(QString("type"), type, obj, QString("QString"));
}
if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString"));
}
return obj; return obj;
} }
@ -101,6 +107,7 @@ SWGPresetItem::getCenterFrequency() {
void void
SWGPresetItem::setCenterFrequency(qint64 center_frequency) { SWGPresetItem::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
QString* QString*
@ -110,6 +117,7 @@ SWGPresetItem::getType() {
void void
SWGPresetItem::setType(QString* type) { SWGPresetItem::setType(QString* type) {
this->type = type; this->type = type;
this->m_type_isSet = true;
} }
QString* QString*
@ -119,8 +127,19 @@ SWGPresetItem::getName() {
void void
SWGPresetItem::setName(QString* name) { SWGPresetItem::setName(QString* name) {
this->name = name; this->name = name;
this->m_name_isSet = true;
} }
bool
SWGPresetItem::isSet(){
bool isObjectUpdated = false;
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(type != nullptr && *type != QString("")){ isObjectUpdated = true; break;}
if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresetItem: public SWGObject { class SWGPresetItem: public SWGObject {
public: public:
SWGPresetItem(); SWGPresetItem();
SWGPresetItem(QString* json); SWGPresetItem(QString json);
virtual ~SWGPresetItem(); ~SWGPresetItem();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresetItem* fromJson(QString &jsonString); SWGPresetItem* fromJson(QString jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);
@ -52,10 +51,18 @@ public:
void setName(QString* name); void setName(QString* name);
virtual bool isSet() override;
private: private:
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
QString* type; QString* type;
bool m_type_isSet;
QString* name; QString* name;
bool m_name_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetTransfer::SWGPresetTransfer(QString* json) { SWGPresetTransfer::SWGPresetTransfer(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresetTransfer::SWGPresetTransfer() { SWGPresetTransfer::SWGPresetTransfer() {
@ -38,20 +38,21 @@ SWGPresetTransfer::~SWGPresetTransfer() {
void void
SWGPresetTransfer::init() { SWGPresetTransfer::init() {
device_set_index = 0; device_set_index = 0;
m_device_set_index_isSet = false;
preset = new SWGPresetIdentifier(); preset = new SWGPresetIdentifier();
m_preset_isSet = false;
} }
void void
SWGPresetTransfer::cleanup() { SWGPresetTransfer::cleanup() {
if(preset != nullptr) { if(preset != nullptr) {
delete preset; delete preset;
} }
} }
SWGPresetTransfer* SWGPresetTransfer*
SWGPresetTransfer::fromJson(QString &json) { SWGPresetTransfer::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -60,28 +61,31 @@ SWGPresetTransfer::fromJson(QString &json) {
} }
void void
SWGPresetTransfer::fromJsonObject(QJsonObject &pJson) { SWGPresetTransfer::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", ""); ::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", "");
::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier"); ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
} }
QString QString
SWGPresetTransfer::asJson () SWGPresetTransfer::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresetTransfer::asJsonObject() { SWGPresetTransfer::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_device_set_index_isSet){
obj->insert("deviceSetIndex", QJsonValue(device_set_index)); obj.insert("deviceSetIndex", QJsonValue(device_set_index));
}
if((preset != nullptr) && (preset->isSet())){
toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier")); toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier"));
}
return obj; return obj;
} }
@ -93,6 +97,7 @@ SWGPresetTransfer::getDeviceSetIndex() {
void void
SWGPresetTransfer::setDeviceSetIndex(qint32 device_set_index) { SWGPresetTransfer::setDeviceSetIndex(qint32 device_set_index) {
this->device_set_index = device_set_index; this->device_set_index = device_set_index;
this->m_device_set_index_isSet = true;
} }
SWGPresetIdentifier* SWGPresetIdentifier*
@ -102,8 +107,18 @@ SWGPresetTransfer::getPreset() {
void void
SWGPresetTransfer::setPreset(SWGPresetIdentifier* preset) { SWGPresetTransfer::setPreset(SWGPresetIdentifier* preset) {
this->preset = preset; this->preset = preset;
this->m_preset_isSet = true;
} }
bool
SWGPresetTransfer::isSet(){
bool isObjectUpdated = false;
do{
if(m_device_set_index_isSet){ isObjectUpdated = true; break;}
if(preset != nullptr && preset->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresetTransfer: public SWGObject { class SWGPresetTransfer: public SWGObject {
public: public:
SWGPresetTransfer(); SWGPresetTransfer();
SWGPresetTransfer(QString* json); SWGPresetTransfer(QString json);
virtual ~SWGPresetTransfer(); ~SWGPresetTransfer();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresetTransfer* fromJson(QString &jsonString); SWGPresetTransfer* fromJson(QString jsonString);
qint32 getDeviceSetIndex(); qint32 getDeviceSetIndex();
void setDeviceSetIndex(qint32 device_set_index); void setDeviceSetIndex(qint32 device_set_index);
@ -49,9 +48,15 @@ public:
void setPreset(SWGPresetIdentifier* preset); void setPreset(SWGPresetIdentifier* preset);
virtual bool isSet() override;
private: private:
qint32 device_set_index; qint32 device_set_index;
bool m_device_set_index_isSet;
SWGPresetIdentifier* preset; SWGPresetIdentifier* preset;
bool m_preset_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresets::SWGPresets(QString* json) { SWGPresets::SWGPresets(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGPresets::SWGPresets() { SWGPresets::SWGPresets() {
@ -38,16 +38,17 @@ SWGPresets::~SWGPresets() {
void void
SWGPresets::init() { SWGPresets::init() {
nb_groups = 0; nb_groups = 0;
m_nb_groups_isSet = false;
groups = new QList<SWGPresetGroup*>(); groups = new QList<SWGPresetGroup*>();
m_groups_isSet = false;
} }
void void
SWGPresets::cleanup() { SWGPresets::cleanup() {
if(groups != nullptr) { if(groups != nullptr) {
QList<SWGPresetGroup*>* arr = groups; auto arr = groups;
foreach(SWGPresetGroup* o, *arr) { for(auto o: *arr) {
delete o; delete o;
} }
delete groups; delete groups;
@ -55,7 +56,7 @@ SWGPresets::cleanup() {
} }
SWGPresets* SWGPresets*
SWGPresets::fromJson(QString &json) { SWGPresets::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -64,32 +65,31 @@ SWGPresets::fromJson(QString &json) {
} }
void void
SWGPresets::fromJsonObject(QJsonObject &pJson) { SWGPresets::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&nb_groups, pJson["nbGroups"], "qint32", ""); ::SWGSDRangel::setValue(&nb_groups, pJson["nbGroups"], "qint32", "");
::SWGSDRangel::setValue(&groups, pJson["groups"], "QList", "SWGPresetGroup");
::SWGSDRangel::setValue(&groups, pJson["groups"], "QList", "SWGPresetGroup");
} }
QString QString
SWGPresets::asJson () SWGPresets::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGPresets::asJsonObject() { SWGPresets::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_nb_groups_isSet){
obj->insert("nbGroups", QJsonValue(nb_groups)); obj.insert("nbGroups", QJsonValue(nb_groups));
}
QJsonArray groupsJsonArray; if(groups->size() > 0){
toJsonArray((QList<void*>*)groups, &groupsJsonArray, "groups", "SWGPresetGroup"); toJsonArray((QList<void*>*)groups, obj, "groups", "SWGPresetGroup");
obj->insert("groups", groupsJsonArray); }
return obj; return obj;
} }
@ -101,6 +101,7 @@ SWGPresets::getNbGroups() {
void void
SWGPresets::setNbGroups(qint32 nb_groups) { SWGPresets::setNbGroups(qint32 nb_groups) {
this->nb_groups = nb_groups; this->nb_groups = nb_groups;
this->m_nb_groups_isSet = true;
} }
QList<SWGPresetGroup*>* QList<SWGPresetGroup*>*
@ -110,8 +111,18 @@ SWGPresets::getGroups() {
void void
SWGPresets::setGroups(QList<SWGPresetGroup*>* groups) { SWGPresets::setGroups(QList<SWGPresetGroup*>* groups) {
this->groups = groups; this->groups = groups;
this->m_groups_isSet = true;
} }
bool
SWGPresets::isSet(){
bool isObjectUpdated = false;
do{
if(m_nb_groups_isSet){ isObjectUpdated = true; break;}
if(groups->size() > 0){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -27,21 +27,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGPresets: public SWGObject { class SWGPresets: public SWGObject {
public: public:
SWGPresets(); SWGPresets();
SWGPresets(QString* json); SWGPresets(QString json);
virtual ~SWGPresets(); ~SWGPresets();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGPresets* fromJson(QString &jsonString); SWGPresets* fromJson(QString jsonString);
qint32 getNbGroups(); qint32 getNbGroups();
void setNbGroups(qint32 nb_groups); void setNbGroups(qint32 nb_groups);
@ -50,9 +49,15 @@ public:
void setGroups(QList<SWGPresetGroup*>* groups); void setGroups(QList<SWGPresetGroup*>* groups);
virtual bool isSet() override;
private: private:
qint32 nb_groups; qint32 nb_groups;
bool m_nb_groups_isSet;
QList<SWGPresetGroup*>* groups; QList<SWGPresetGroup*>* groups;
bool m_groups_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGRtlSdrSettings::SWGRtlSdrSettings(QString* json) { SWGRtlSdrSettings::SWGRtlSdrSettings(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGRtlSdrSettings::SWGRtlSdrSettings() { SWGRtlSdrSettings::SWGRtlSdrSettings() {
@ -38,19 +38,33 @@ SWGRtlSdrSettings::~SWGRtlSdrSettings() {
void void
SWGRtlSdrSettings::init() { SWGRtlSdrSettings::init() {
dev_sample_rate = 0; dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
low_sample_rate = 0; low_sample_rate = 0;
m_low_sample_rate_isSet = false;
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
gain = 0; gain = 0;
m_gain_isSet = false;
lo_ppm_correction = 0; lo_ppm_correction = 0;
m_lo_ppm_correction_isSet = false;
log2_decim = 0; log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0; fc_pos = 0;
m_fc_pos_isSet = false;
dc_block = 0; dc_block = 0;
m_dc_block_isSet = false;
iq_imbalance = 0; iq_imbalance = 0;
m_iq_imbalance_isSet = false;
agc = 0; agc = 0;
m_agc_isSet = false;
no_mod_mode = 0; no_mod_mode = 0;
m_no_mod_mode_isSet = false;
transverter_mode = 0; transverter_mode = 0;
m_transverter_mode_isSet = false;
transverter_delta_frequency = 0L; transverter_delta_frequency = 0L;
m_transverter_delta_frequency_isSet = false;
rf_bandwidth = 0; rf_bandwidth = 0;
m_rf_bandwidth_isSet = false;
} }
void void
@ -72,7 +86,7 @@ SWGRtlSdrSettings::cleanup() {
} }
SWGRtlSdrSettings* SWGRtlSdrSettings*
SWGRtlSdrSettings::fromJson(QString &json) { SWGRtlSdrSettings::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -81,64 +95,91 @@ SWGRtlSdrSettings::fromJson(QString &json) {
} }
void void
SWGRtlSdrSettings::fromJsonObject(QJsonObject &pJson) { SWGRtlSdrSettings::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&low_sample_rate, pJson["lowSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&low_sample_rate, pJson["lowSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", ""); ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&lo_ppm_correction, pJson["loPpmCorrection"], "qint32", ""); ::SWGSDRangel::setValue(&lo_ppm_correction, pJson["loPpmCorrection"], "qint32", "");
::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", ""); ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", ""); ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", ""); ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
::SWGSDRangel::setValue(&iq_imbalance, pJson["iqImbalance"], "qint32", ""); ::SWGSDRangel::setValue(&iq_imbalance, pJson["iqImbalance"], "qint32", "");
::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", ""); ::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", "");
::SWGSDRangel::setValue(&no_mod_mode, pJson["noModMode"], "qint32", ""); ::SWGSDRangel::setValue(&no_mod_mode, pJson["noModMode"], "qint32", "");
::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", ""); ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "qint32", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "qint32", "");
} }
QString QString
SWGRtlSdrSettings::asJson () SWGRtlSdrSettings::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGRtlSdrSettings::asJsonObject() { SWGRtlSdrSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_dev_sample_rate_isSet){
obj->insert("devSampleRate", QJsonValue(dev_sample_rate)); obj.insert("devSampleRate", QJsonValue(dev_sample_rate));
}
obj->insert("lowSampleRate", QJsonValue(low_sample_rate)); if(m_low_sample_rate_isSet){
obj.insert("lowSampleRate", QJsonValue(low_sample_rate));
obj->insert("centerFrequency", QJsonValue(center_frequency)); }
if(m_center_frequency_isSet){
obj->insert("gain", QJsonValue(gain)); obj.insert("centerFrequency", QJsonValue(center_frequency));
}
obj->insert("loPpmCorrection", QJsonValue(lo_ppm_correction)); if(m_gain_isSet){
obj.insert("gain", QJsonValue(gain));
obj->insert("log2Decim", QJsonValue(log2_decim)); }
if(m_lo_ppm_correction_isSet){
obj->insert("fcPos", QJsonValue(fc_pos)); obj.insert("loPpmCorrection", QJsonValue(lo_ppm_correction));
}
obj->insert("dcBlock", QJsonValue(dc_block)); if(m_log2_decim_isSet){
obj.insert("log2Decim", QJsonValue(log2_decim));
obj->insert("iqImbalance", QJsonValue(iq_imbalance)); }
if(m_fc_pos_isSet){
obj->insert("agc", QJsonValue(agc)); obj.insert("fcPos", QJsonValue(fc_pos));
}
obj->insert("noModMode", QJsonValue(no_mod_mode)); if(m_dc_block_isSet){
obj.insert("dcBlock", QJsonValue(dc_block));
obj->insert("transverterMode", QJsonValue(transverter_mode)); }
if(m_iq_imbalance_isSet){
obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency)); obj.insert("iqImbalance", QJsonValue(iq_imbalance));
}
obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); if(m_agc_isSet){
obj.insert("agc", QJsonValue(agc));
}
if(m_no_mod_mode_isSet){
obj.insert("noModMode", QJsonValue(no_mod_mode));
}
if(m_transverter_mode_isSet){
obj.insert("transverterMode", QJsonValue(transverter_mode));
}
if(m_transverter_delta_frequency_isSet){
obj.insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
}
if(m_rf_bandwidth_isSet){
obj.insert("rfBandwidth", QJsonValue(rf_bandwidth));
}
return obj; return obj;
} }
@ -150,6 +191,7 @@ SWGRtlSdrSettings::getDevSampleRate() {
void void
SWGRtlSdrSettings::setDevSampleRate(qint32 dev_sample_rate) { SWGRtlSdrSettings::setDevSampleRate(qint32 dev_sample_rate) {
this->dev_sample_rate = dev_sample_rate; this->dev_sample_rate = dev_sample_rate;
this->m_dev_sample_rate_isSet = true;
} }
qint32 qint32
@ -159,6 +201,7 @@ SWGRtlSdrSettings::getLowSampleRate() {
void void
SWGRtlSdrSettings::setLowSampleRate(qint32 low_sample_rate) { SWGRtlSdrSettings::setLowSampleRate(qint32 low_sample_rate) {
this->low_sample_rate = low_sample_rate; this->low_sample_rate = low_sample_rate;
this->m_low_sample_rate_isSet = true;
} }
qint64 qint64
@ -168,6 +211,7 @@ SWGRtlSdrSettings::getCenterFrequency() {
void void
SWGRtlSdrSettings::setCenterFrequency(qint64 center_frequency) { SWGRtlSdrSettings::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
qint32 qint32
@ -177,6 +221,7 @@ SWGRtlSdrSettings::getGain() {
void void
SWGRtlSdrSettings::setGain(qint32 gain) { SWGRtlSdrSettings::setGain(qint32 gain) {
this->gain = gain; this->gain = gain;
this->m_gain_isSet = true;
} }
qint32 qint32
@ -186,6 +231,7 @@ SWGRtlSdrSettings::getLoPpmCorrection() {
void void
SWGRtlSdrSettings::setLoPpmCorrection(qint32 lo_ppm_correction) { SWGRtlSdrSettings::setLoPpmCorrection(qint32 lo_ppm_correction) {
this->lo_ppm_correction = lo_ppm_correction; this->lo_ppm_correction = lo_ppm_correction;
this->m_lo_ppm_correction_isSet = true;
} }
qint32 qint32
@ -195,6 +241,7 @@ SWGRtlSdrSettings::getLog2Decim() {
void void
SWGRtlSdrSettings::setLog2Decim(qint32 log2_decim) { SWGRtlSdrSettings::setLog2Decim(qint32 log2_decim) {
this->log2_decim = log2_decim; this->log2_decim = log2_decim;
this->m_log2_decim_isSet = true;
} }
qint32 qint32
@ -204,6 +251,7 @@ SWGRtlSdrSettings::getFcPos() {
void void
SWGRtlSdrSettings::setFcPos(qint32 fc_pos) { SWGRtlSdrSettings::setFcPos(qint32 fc_pos) {
this->fc_pos = fc_pos; this->fc_pos = fc_pos;
this->m_fc_pos_isSet = true;
} }
qint32 qint32
@ -213,6 +261,7 @@ SWGRtlSdrSettings::getDcBlock() {
void void
SWGRtlSdrSettings::setDcBlock(qint32 dc_block) { SWGRtlSdrSettings::setDcBlock(qint32 dc_block) {
this->dc_block = dc_block; this->dc_block = dc_block;
this->m_dc_block_isSet = true;
} }
qint32 qint32
@ -222,6 +271,7 @@ SWGRtlSdrSettings::getIqImbalance() {
void void
SWGRtlSdrSettings::setIqImbalance(qint32 iq_imbalance) { SWGRtlSdrSettings::setIqImbalance(qint32 iq_imbalance) {
this->iq_imbalance = iq_imbalance; this->iq_imbalance = iq_imbalance;
this->m_iq_imbalance_isSet = true;
} }
qint32 qint32
@ -231,6 +281,7 @@ SWGRtlSdrSettings::getAgc() {
void void
SWGRtlSdrSettings::setAgc(qint32 agc) { SWGRtlSdrSettings::setAgc(qint32 agc) {
this->agc = agc; this->agc = agc;
this->m_agc_isSet = true;
} }
qint32 qint32
@ -240,6 +291,7 @@ SWGRtlSdrSettings::getNoModMode() {
void void
SWGRtlSdrSettings::setNoModMode(qint32 no_mod_mode) { SWGRtlSdrSettings::setNoModMode(qint32 no_mod_mode) {
this->no_mod_mode = no_mod_mode; this->no_mod_mode = no_mod_mode;
this->m_no_mod_mode_isSet = true;
} }
qint32 qint32
@ -249,6 +301,7 @@ SWGRtlSdrSettings::getTransverterMode() {
void void
SWGRtlSdrSettings::setTransverterMode(qint32 transverter_mode) { SWGRtlSdrSettings::setTransverterMode(qint32 transverter_mode) {
this->transverter_mode = transverter_mode; this->transverter_mode = transverter_mode;
this->m_transverter_mode_isSet = true;
} }
qint64 qint64
@ -258,6 +311,7 @@ SWGRtlSdrSettings::getTransverterDeltaFrequency() {
void void
SWGRtlSdrSettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) { SWGRtlSdrSettings::setTransverterDeltaFrequency(qint64 transverter_delta_frequency) {
this->transverter_delta_frequency = transverter_delta_frequency; this->transverter_delta_frequency = transverter_delta_frequency;
this->m_transverter_delta_frequency_isSet = true;
} }
qint32 qint32
@ -267,8 +321,30 @@ SWGRtlSdrSettings::getRfBandwidth() {
void void
SWGRtlSdrSettings::setRfBandwidth(qint32 rf_bandwidth) { SWGRtlSdrSettings::setRfBandwidth(qint32 rf_bandwidth) {
this->rf_bandwidth = rf_bandwidth; this->rf_bandwidth = rf_bandwidth;
this->m_rf_bandwidth_isSet = true;
} }
bool
SWGRtlSdrSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_low_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_gain_isSet){ isObjectUpdated = true; break;}
if(m_lo_ppm_correction_isSet){ isObjectUpdated = true; break;}
if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
if(m_dc_block_isSet){ isObjectUpdated = true; break;}
if(m_iq_imbalance_isSet){ isObjectUpdated = true; break;}
if(m_agc_isSet){ isObjectUpdated = true; break;}
if(m_no_mod_mode_isSet){ isObjectUpdated = true; break;}
if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -25,21 +25,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGRtlSdrSettings: public SWGObject { class SWGRtlSdrSettings: public SWGObject {
public: public:
SWGRtlSdrSettings(); SWGRtlSdrSettings();
SWGRtlSdrSettings(QString* json); SWGRtlSdrSettings(QString json);
virtual ~SWGRtlSdrSettings(); ~SWGRtlSdrSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGRtlSdrSettings* fromJson(QString &jsonString); SWGRtlSdrSettings* fromJson(QString jsonString);
qint32 getDevSampleRate(); qint32 getDevSampleRate();
void setDevSampleRate(qint32 dev_sample_rate); void setDevSampleRate(qint32 dev_sample_rate);
@ -84,21 +83,51 @@ public:
void setRfBandwidth(qint32 rf_bandwidth); void setRfBandwidth(qint32 rf_bandwidth);
virtual bool isSet() override;
private: private:
qint32 dev_sample_rate; qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 low_sample_rate; qint32 low_sample_rate;
bool m_low_sample_rate_isSet;
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 gain; qint32 gain;
bool m_gain_isSet;
qint32 lo_ppm_correction; qint32 lo_ppm_correction;
bool m_lo_ppm_correction_isSet;
qint32 log2_decim; qint32 log2_decim;
bool m_log2_decim_isSet;
qint32 fc_pos; qint32 fc_pos;
bool m_fc_pos_isSet;
qint32 dc_block; qint32 dc_block;
bool m_dc_block_isSet;
qint32 iq_imbalance; qint32 iq_imbalance;
bool m_iq_imbalance_isSet;
qint32 agc; qint32 agc;
bool m_agc_isSet;
qint32 no_mod_mode; qint32 no_mod_mode;
bool m_no_mod_mode_isSet;
qint32 transverter_mode; qint32 transverter_mode;
bool m_transverter_mode_isSet;
qint64 transverter_delta_frequency; qint64 transverter_delta_frequency;
bool m_transverter_delta_frequency_isSet;
qint32 rf_bandwidth; qint32 rf_bandwidth;
bool m_rf_bandwidth_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGSamplingDevice::SWGSamplingDevice(QString* json) { SWGSamplingDevice::SWGSamplingDevice(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGSamplingDevice::SWGSamplingDevice() { SWGSamplingDevice::SWGSamplingDevice() {
@ -38,21 +38,30 @@ SWGSamplingDevice::~SWGSamplingDevice() {
void void
SWGSamplingDevice::init() { SWGSamplingDevice::init() {
index = 0; index = 0;
m_index_isSet = false;
hw_type = new QString(""); hw_type = new QString("");
m_hw_type_isSet = false;
tx = 0; tx = 0;
m_tx_isSet = false;
nb_streams = 0; nb_streams = 0;
m_nb_streams_isSet = false;
stream_index = 0; stream_index = 0;
m_stream_index_isSet = false;
sequence = 0; sequence = 0;
m_sequence_isSet = false;
serial = new QString(""); serial = new QString("");
m_serial_isSet = false;
center_frequency = 0L; center_frequency = 0L;
m_center_frequency_isSet = false;
bandwidth = 0; bandwidth = 0;
m_bandwidth_isSet = false;
state = new QString(""); state = new QString("");
m_state_isSet = false;
} }
void void
SWGSamplingDevice::cleanup() { SWGSamplingDevice::cleanup() {
if(hw_type != nullptr) { if(hw_type != nullptr) {
delete hw_type; delete hw_type;
} }
@ -60,20 +69,18 @@ SWGSamplingDevice::cleanup() {
if(serial != nullptr) { if(serial != nullptr) {
delete serial; delete serial;
} }
if(state != nullptr) { if(state != nullptr) {
delete state; delete state;
} }
} }
SWGSamplingDevice* SWGSamplingDevice*
SWGSamplingDevice::fromJson(QString &json) { SWGSamplingDevice::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -82,52 +89,71 @@ SWGSamplingDevice::fromJson(QString &json) {
} }
void void
SWGSamplingDevice::fromJsonObject(QJsonObject &pJson) { SWGSamplingDevice::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString"); ::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&nb_streams, pJson["nbStreams"], "qint32", ""); ::SWGSDRangel::setValue(&nb_streams, pJson["nbStreams"], "qint32", "");
::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", ""); ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", "");
::SWGSDRangel::setValue(&sequence, pJson["sequence"], "qint32", ""); ::SWGSDRangel::setValue(&sequence, pJson["sequence"], "qint32", "");
::SWGSDRangel::setValue(&serial, pJson["serial"], "QString", "QString"); ::SWGSDRangel::setValue(&serial, pJson["serial"], "QString", "QString");
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", ""); ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString"); ::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString");
} }
QString QString
SWGSamplingDevice::asJson () SWGSamplingDevice::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGSamplingDevice::asJsonObject() { SWGSamplingDevice::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(m_index_isSet){
obj->insert("index", QJsonValue(index)); obj.insert("index", QJsonValue(index));
}
if(hw_type != nullptr && *hw_type != QString("")){
toJsonValue(QString("hwType"), hw_type, obj, QString("QString")); toJsonValue(QString("hwType"), hw_type, obj, QString("QString"));
}
obj->insert("tx", QJsonValue(tx)); if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx));
obj->insert("nbStreams", QJsonValue(nb_streams)); }
if(m_nb_streams_isSet){
obj->insert("streamIndex", QJsonValue(stream_index)); obj.insert("nbStreams", QJsonValue(nb_streams));
}
obj->insert("sequence", QJsonValue(sequence)); if(m_stream_index_isSet){
obj.insert("streamIndex", QJsonValue(stream_index));
}
if(m_sequence_isSet){
obj.insert("sequence", QJsonValue(sequence));
}
if(serial != nullptr && *serial != QString("")){
toJsonValue(QString("serial"), serial, obj, QString("QString")); toJsonValue(QString("serial"), serial, obj, QString("QString"));
}
obj->insert("centerFrequency", QJsonValue(center_frequency)); if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency));
obj->insert("bandwidth", QJsonValue(bandwidth)); }
if(m_bandwidth_isSet){
obj.insert("bandwidth", QJsonValue(bandwidth));
}
if(state != nullptr && *state != QString("")){
toJsonValue(QString("state"), state, obj, QString("QString")); toJsonValue(QString("state"), state, obj, QString("QString"));
}
return obj; return obj;
} }
@ -139,6 +165,7 @@ SWGSamplingDevice::getIndex() {
void void
SWGSamplingDevice::setIndex(qint32 index) { SWGSamplingDevice::setIndex(qint32 index) {
this->index = index; this->index = index;
this->m_index_isSet = true;
} }
QString* QString*
@ -148,6 +175,7 @@ SWGSamplingDevice::getHwType() {
void void
SWGSamplingDevice::setHwType(QString* hw_type) { SWGSamplingDevice::setHwType(QString* hw_type) {
this->hw_type = hw_type; this->hw_type = hw_type;
this->m_hw_type_isSet = true;
} }
qint32 qint32
@ -157,6 +185,7 @@ SWGSamplingDevice::getTx() {
void void
SWGSamplingDevice::setTx(qint32 tx) { SWGSamplingDevice::setTx(qint32 tx) {
this->tx = tx; this->tx = tx;
this->m_tx_isSet = true;
} }
qint32 qint32
@ -166,6 +195,7 @@ SWGSamplingDevice::getNbStreams() {
void void
SWGSamplingDevice::setNbStreams(qint32 nb_streams) { SWGSamplingDevice::setNbStreams(qint32 nb_streams) {
this->nb_streams = nb_streams; this->nb_streams = nb_streams;
this->m_nb_streams_isSet = true;
} }
qint32 qint32
@ -175,6 +205,7 @@ SWGSamplingDevice::getStreamIndex() {
void void
SWGSamplingDevice::setStreamIndex(qint32 stream_index) { SWGSamplingDevice::setStreamIndex(qint32 stream_index) {
this->stream_index = stream_index; this->stream_index = stream_index;
this->m_stream_index_isSet = true;
} }
qint32 qint32
@ -184,6 +215,7 @@ SWGSamplingDevice::getSequence() {
void void
SWGSamplingDevice::setSequence(qint32 sequence) { SWGSamplingDevice::setSequence(qint32 sequence) {
this->sequence = sequence; this->sequence = sequence;
this->m_sequence_isSet = true;
} }
QString* QString*
@ -193,6 +225,7 @@ SWGSamplingDevice::getSerial() {
void void
SWGSamplingDevice::setSerial(QString* serial) { SWGSamplingDevice::setSerial(QString* serial) {
this->serial = serial; this->serial = serial;
this->m_serial_isSet = true;
} }
qint64 qint64
@ -202,6 +235,7 @@ SWGSamplingDevice::getCenterFrequency() {
void void
SWGSamplingDevice::setCenterFrequency(qint64 center_frequency) { SWGSamplingDevice::setCenterFrequency(qint64 center_frequency) {
this->center_frequency = center_frequency; this->center_frequency = center_frequency;
this->m_center_frequency_isSet = true;
} }
qint32 qint32
@ -211,6 +245,7 @@ SWGSamplingDevice::getBandwidth() {
void void
SWGSamplingDevice::setBandwidth(qint32 bandwidth) { SWGSamplingDevice::setBandwidth(qint32 bandwidth) {
this->bandwidth = bandwidth; this->bandwidth = bandwidth;
this->m_bandwidth_isSet = true;
} }
QString* QString*
@ -220,8 +255,26 @@ SWGSamplingDevice::getState() {
void void
SWGSamplingDevice::setState(QString* state) { SWGSamplingDevice::setState(QString* state) {
this->state = state; this->state = state;
this->m_state_isSet = true;
} }
bool
SWGSamplingDevice::isSet(){
bool isObjectUpdated = false;
do{
if(m_index_isSet){ isObjectUpdated = true; break;}
if(hw_type != nullptr && *hw_type != QString("")){ isObjectUpdated = true; break;}
if(m_tx_isSet){ isObjectUpdated = true; break;}
if(m_nb_streams_isSet){ isObjectUpdated = true; break;}
if(m_stream_index_isSet){ isObjectUpdated = true; break;}
if(m_sequence_isSet){ isObjectUpdated = true; break;}
if(serial != nullptr && *serial != QString("")){ isObjectUpdated = true; break;}
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
if(state != nullptr && *state != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,21 +26,20 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGSamplingDevice: public SWGObject { class SWGSamplingDevice: public SWGObject {
public: public:
SWGSamplingDevice(); SWGSamplingDevice();
SWGSamplingDevice(QString* json); SWGSamplingDevice(QString json);
virtual ~SWGSamplingDevice(); ~SWGSamplingDevice();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGSamplingDevice* fromJson(QString &jsonString); SWGSamplingDevice* fromJson(QString jsonString);
qint32 getIndex(); qint32 getIndex();
void setIndex(qint32 index); void setIndex(qint32 index);
@ -73,17 +72,39 @@ public:
void setState(QString* state); void setState(QString* state);
virtual bool isSet() override;
private: private:
qint32 index; qint32 index;
bool m_index_isSet;
QString* hw_type; QString* hw_type;
bool m_hw_type_isSet;
qint32 tx; qint32 tx;
bool m_tx_isSet;
qint32 nb_streams; qint32 nb_streams;
bool m_nb_streams_isSet;
qint32 stream_index; qint32 stream_index;
bool m_stream_index_isSet;
qint32 sequence; qint32 sequence;
bool m_sequence_isSet;
QString* serial; QString* serial;
bool m_serial_isSet;
qint64 center_frequency; qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 bandwidth; qint32 bandwidth;
bool m_bandwidth_isSet;
QString* state; QString* state;
bool m_state_isSet;
}; };
} }

View File

@ -22,9 +22,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGSuccessResponse::SWGSuccessResponse(QString* json) { SWGSuccessResponse::SWGSuccessResponse(QString json) {
init(); init();
this->fromJson(*json); this->fromJson(json);
} }
SWGSuccessResponse::SWGSuccessResponse() { SWGSuccessResponse::SWGSuccessResponse() {
@ -38,18 +38,18 @@ SWGSuccessResponse::~SWGSuccessResponse() {
void void
SWGSuccessResponse::init() { SWGSuccessResponse::init() {
message = new QString(""); message = new QString("");
m_message_isSet = false;
} }
void void
SWGSuccessResponse::cleanup() { SWGSuccessResponse::cleanup() {
if(message != nullptr) { if(message != nullptr) {
delete message; delete message;
} }
} }
SWGSuccessResponse* SWGSuccessResponse*
SWGSuccessResponse::fromJson(QString &json) { SWGSuccessResponse::fromJson(QString json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,25 +58,26 @@ SWGSuccessResponse::fromJson(QString &json) {
} }
void void
SWGSuccessResponse::fromJsonObject(QJsonObject &pJson) { SWGSuccessResponse::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString"); ::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString");
} }
QString QString
SWGSuccessResponse::asJson () SWGSuccessResponse::asJson ()
{ {
QJsonObject* obj = this->asJsonObject(); QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
return QString(bytes); return QString(bytes);
} }
QJsonObject* QJsonObject
SWGSuccessResponse::asJsonObject() { SWGSuccessResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject obj;
if(message != nullptr && *message != QString("")){
toJsonValue(QString("message"), message, obj, QString("QString")); toJsonValue(QString("message"), message, obj, QString("QString"));
}
return obj; return obj;
} }
@ -88,8 +89,17 @@ SWGSuccessResponse::getMessage() {
void void
SWGSuccessResponse::setMessage(QString* message) { SWGSuccessResponse::setMessage(QString* message) {
this->message = message; this->message = message;
this->m_message_isSet = true;
} }
bool
SWGSuccessResponse::isSet(){
bool isObjectUpdated = false;
do{
if(message != nullptr && *message != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
} }

View File

@ -26,28 +26,31 @@
#include "SWGObject.h" #include "SWGObject.h"
namespace SWGSDRangel { namespace SWGSDRangel {
class SWGSuccessResponse: public SWGObject { class SWGSuccessResponse: public SWGObject {
public: public:
SWGSuccessResponse(); SWGSuccessResponse();
SWGSuccessResponse(QString* json); SWGSuccessResponse(QString json);
virtual ~SWGSuccessResponse(); ~SWGSuccessResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject* asJsonObject(); QJsonObject asJsonObject();
void fromJsonObject(QJsonObject &json); void fromJsonObject(QJsonObject json);
SWGSuccessResponse* fromJson(QString &jsonString); SWGSuccessResponse* fromJson(QString jsonString);
QString* getMessage(); QString* getMessage();
void setMessage(QString* message); void setMessage(QString* message);
virtual bool isSet() override;
private: private:
QString* message; QString* message;
bool m_message_isSet;
}; };
} }