1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-04-13 06:58:35 -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
sdrbase/resources/webapi/doc/html2
swagger/sdrangel
README.md
code
html2
.swagger-codegen
index.html
qt5
.swagger-codegen
client
SWGAudioDevice.cppSWGAudioDevice.hSWGAudioDevices.cppSWGAudioDevices.hSWGAudioDevicesSelect.cppSWGAudioDevicesSelect.hSWGCWKeyerSettings.cppSWGCWKeyerSettings.hSWGChannel.cppSWGChannel.hSWGChannelListItem.cppSWGChannelListItem.hSWGChannelSettings.cppSWGChannelSettings.hSWGDVSeralDevices.cppSWGDVSeralDevices.hSWGDVSerialDevice.cppSWGDVSerialDevice.hSWGDeviceListItem.cppSWGDeviceListItem.hSWGDeviceSet.cppSWGDeviceSet.hSWGDeviceSetApi.cppSWGDeviceSetApi.hSWGDeviceSetList.cppSWGDeviceSetList.hSWGDeviceSettings.cppSWGDeviceSettings.hSWGDeviceState.cppSWGDeviceState.hSWGErrorResponse.cppSWGErrorResponse.hSWGFileSourceSettings.cppSWGFileSourceSettings.hSWGHackRFInputSettings.cppSWGHackRFInputSettings.hSWGHackRFOutputSettings.cppSWGHackRFOutputSettings.hSWGHelpers.cppSWGHelpers.hSWGHttpRequest.cppSWGHttpRequest.hSWGInstanceApi.cppSWGInstanceApi.hSWGInstanceChannelsResponse.cppSWGInstanceChannelsResponse.hSWGInstanceDevicesResponse.cppSWGInstanceDevicesResponse.hSWGInstanceSummaryResponse.cppSWGInstanceSummaryResponse.hSWGLimeSdrInputSettings.cppSWGLimeSdrInputSettings.hSWGLimeSdrOutputSettings.cppSWGLimeSdrOutputSettings.hSWGLocationInformation.cppSWGLocationInformation.hSWGLoggingInfo.cppSWGLoggingInfo.hSWGModelFactory.hSWGNFMDemodSettings.cppSWGNFMDemodSettings.hSWGNFMModSettings.cppSWGNFMModSettings.hSWGObject.hSWGPresetExport.cppSWGPresetExport.hSWGPresetGroup.cppSWGPresetGroup.hSWGPresetIdentifier.cppSWGPresetIdentifier.hSWGPresetImport.cppSWGPresetImport.hSWGPresetItem.cppSWGPresetItem.hSWGPresetTransfer.cppSWGPresetTransfer.hSWGPresets.cppSWGPresets.hSWGRtlSdrSettings.cppSWGRtlSdrSettings.hSWGSamplingDevice.cppSWGSamplingDevice.hSWGSuccessResponse.cppSWGSuccessResponse.h

File diff suppressed because one or more lines are too long

View File

@ -65,20 +65,24 @@ swagger project start -m
<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
cd /opt/install/swagger
wget https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar
sudo apt-get install maven # do this once to install maven
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
#!/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>`
@ -128,4 +132,4 @@ Detailed instructions [here](https://swagger.io/docs/swagger-tools/#download-33)
- Open the `dist/index.html` file with a browser
- Say you started the node server on 127.0.0.1 port 8081 as in the example above (see: "Edit files with Swagger" paragraph)
- In the "Explore" box at the top type: `http://127.0.0.1:8081/api/swagger/swagger.yaml`
- Hit enter or click on the "Explore" button
- Hit enter or click on the "Explore" button

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

@ -12,7 +12,7 @@
/*
* SWGDeviceSet.h
*
*
* Sampling device and its associated channels
*/
@ -28,21 +28,20 @@
#include "SWGObject.h"
namespace SWGSDRangel {
class SWGDeviceSet: public SWGObject {
public:
SWGDeviceSet();
SWGDeviceSet(QString* json);
virtual ~SWGDeviceSet();
SWGDeviceSet(QString json);
~SWGDeviceSet();
void init();
void cleanup();
QString asJson ();
QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject &json);
SWGDeviceSet* fromJson(QString &jsonString);
QJsonObject asJsonObject();
void fromJsonObject(QJsonObject json);
SWGDeviceSet* fromJson(QString jsonString);
SWGSamplingDevice* getSamplingDevice();
void setSamplingDevice(SWGSamplingDevice* sampling_device);
@ -54,10 +53,18 @@ public:
void setChannels(QList<SWGChannel*>* channels);
virtual bool isSet() override;
private:
SWGSamplingDevice* sampling_device;
bool m_sampling_device_isSet;
qint32 channelcount;
bool m_channelcount_isSet;
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));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "DELETE");
@ -51,7 +51,7 @@ SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetChannelDeleteCallback);
@ -59,7 +59,7 @@ SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_
}
void
SWGDeviceSetApi::devicesetChannelDeleteCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetChannelDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -76,12 +76,16 @@ SWGDeviceSetApi::devicesetChannelDeleteCallback(HttpRequestWorker * worker) {
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater();
emit devicesetChannelDeleteSignal(output);
emit devicesetChannelDeleteSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelDeleteSignal(output);
} else {
emit devicesetChannelDeleteSignalE(output, error_type, error_str);
emit devicesetChannelDeleteSignalEFull(worker, error_type, error_str);
}
}
void
SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSettings body) {
SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSettings& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel");
@ -89,10 +93,11 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "POST");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "POST");
QString output = body.asJson();
input.request_body.append(output);
@ -103,7 +108,7 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetChannelPostCallback);
@ -111,7 +116,7 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
}
void
SWGDeviceSetApi::devicesetChannelPostCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetChannelPostCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -128,8 +133,12 @@ SWGDeviceSetApi::devicesetChannelPostCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit devicesetChannelPostSignal(output);
emit devicesetChannelPostSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelPostSignal(output);
} else {
emit devicesetChannelPostSignalE(output, error_type, error_str);
emit devicesetChannelPostSignalEFull(worker, error_type, error_str);
}
}
void
@ -143,8 +152,8 @@ SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 cha
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -155,7 +164,7 @@ SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 cha
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetChannelSettingsGetCallback);
@ -163,7 +172,7 @@ SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 cha
}
void
SWGDeviceSetApi::devicesetChannelSettingsGetCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetChannelSettingsGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -180,12 +189,16 @@ SWGDeviceSetApi::devicesetChannelSettingsGetCallback(HttpRequestWorker * worker)
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater();
emit devicesetChannelSettingsGetSignal(output);
emit devicesetChannelSettingsGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelSettingsGetSignal(output);
} else {
emit devicesetChannelSettingsGetSignalE(output, error_type, error_str);
emit devicesetChannelSettingsGetSignalEFull(worker, error_type, error_str);
}
}
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;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
@ -195,10 +208,11 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson();
input.request_body.append(output);
@ -209,7 +223,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetChannelSettingsPatchCallback);
@ -217,7 +231,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
}
void
SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -234,12 +248,16 @@ SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(HttpRequestWorker * worke
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater();
emit devicesetChannelSettingsPatchSignal(output);
emit devicesetChannelSettingsPatchSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelSettingsPatchSignal(output);
} else {
emit devicesetChannelSettingsPatchSignalE(output, error_type, error_str);
emit devicesetChannelSettingsPatchSignalEFull(worker, error_type, error_str);
}
}
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;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings");
@ -249,10 +267,11 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
fullPath.replace(channel_indexPathParam, stringValue(channel_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -263,7 +282,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetChannelSettingsPutCallback);
@ -271,7 +290,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
}
void
SWGDeviceSetApi::devicesetChannelSettingsPutCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetChannelSettingsPutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -288,12 +307,16 @@ SWGDeviceSetApi::devicesetChannelSettingsPutCallback(HttpRequestWorker * worker)
SWGChannelSettings* output = static_cast<SWGChannelSettings*>(create(json, QString("SWGChannelSettings")));
worker->deleteLater();
emit devicesetChannelSettingsPutSignal(output);
emit devicesetChannelSettingsPutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetChannelSettingsPutSignal(output);
} else {
emit devicesetChannelSettingsPutSignalE(output, error_type, error_str);
emit devicesetChannelSettingsPutSignalEFull(worker, error_type, error_str);
}
}
void
SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body) {
SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device");
@ -301,10 +324,11 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem b
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -315,7 +339,7 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem b
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDevicePutCallback);
@ -323,7 +347,7 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem b
}
void
SWGDeviceSetApi::devicesetDevicePutCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDevicePutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -340,8 +364,12 @@ SWGDeviceSetApi::devicesetDevicePutCallback(HttpRequestWorker * worker) {
SWGDeviceListItem* output = static_cast<SWGDeviceListItem*>(create(json, QString("SWGDeviceListItem")));
worker->deleteLater();
emit devicesetDevicePutSignal(output);
emit devicesetDevicePutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDevicePutSignal(output);
} else {
emit devicesetDevicePutSignalE(output, error_type, error_str);
emit devicesetDevicePutSignalEFull(worker, error_type, error_str);
}
}
void
@ -353,8 +381,8 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "DELETE");
@ -365,7 +393,7 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDeviceRunDeleteCallback);
@ -373,7 +401,7 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index) {
}
void
SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -390,8 +418,12 @@ SWGDeviceSetApi::devicesetDeviceRunDeleteCallback(HttpRequestWorker * worker) {
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
worker->deleteLater();
emit devicesetDeviceRunDeleteSignal(output);
emit devicesetDeviceRunDeleteSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceRunDeleteSignal(output);
} else {
emit devicesetDeviceRunDeleteSignalE(output, error_type, error_str);
emit devicesetDeviceRunDeleteSignalEFull(worker, error_type, error_str);
}
}
void
@ -403,8 +435,8 @@ SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -415,7 +447,7 @@ SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDeviceRunGetCallback);
@ -423,7 +455,7 @@ SWGDeviceSetApi::devicesetDeviceRunGet(qint32 device_set_index) {
}
void
SWGDeviceSetApi::devicesetDeviceRunGetCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDeviceRunGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -440,8 +472,12 @@ SWGDeviceSetApi::devicesetDeviceRunGetCallback(HttpRequestWorker * worker) {
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
worker->deleteLater();
emit devicesetDeviceRunGetSignal(output);
emit devicesetDeviceRunGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceRunGetSignal(output);
} else {
emit devicesetDeviceRunGetSignalE(output, error_type, error_str);
emit devicesetDeviceRunGetSignalEFull(worker, error_type, error_str);
}
}
void
@ -453,8 +489,8 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "POST");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "POST");
@ -465,7 +501,7 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDeviceRunPostCallback);
@ -473,7 +509,7 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index) {
}
void
SWGDeviceSetApi::devicesetDeviceRunPostCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDeviceRunPostCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -490,8 +526,12 @@ SWGDeviceSetApi::devicesetDeviceRunPostCallback(HttpRequestWorker * worker) {
SWGDeviceState* output = static_cast<SWGDeviceState*>(create(json, QString("SWGDeviceState")));
worker->deleteLater();
emit devicesetDeviceRunPostSignal(output);
emit devicesetDeviceRunPostSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceRunPostSignal(output);
} else {
emit devicesetDeviceRunPostSignalE(output, error_type, error_str);
emit devicesetDeviceRunPostSignalEFull(worker, error_type, error_str);
}
}
void
@ -503,8 +543,8 @@ SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -515,7 +555,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDeviceSettingsGetCallback);
@ -523,7 +563,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsGet(qint32 device_set_index) {
}
void
SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -540,12 +580,16 @@ SWGDeviceSetApi::devicesetDeviceSettingsGetCallback(HttpRequestWorker * worker)
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
worker->deleteLater();
emit devicesetDeviceSettingsGetSignal(output);
emit devicesetDeviceSettingsGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceSettingsGetSignal(output);
} else {
emit devicesetDeviceSettingsGetSignalE(output, error_type, error_str);
emit devicesetDeviceSettingsGetSignalEFull(worker, error_type, error_str);
}
}
void
SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings body) {
SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
@ -553,10 +597,11 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson();
input.request_body.append(output);
@ -567,7 +612,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback);
@ -575,7 +620,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
}
void
SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -592,12 +637,16 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatchCallback(HttpRequestWorker * worker
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
worker->deleteLater();
emit devicesetDeviceSettingsPatchSignal(output);
emit devicesetDeviceSettingsPatchSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceSettingsPatchSignal(output);
} else {
emit devicesetDeviceSettingsPatchSignalE(output, error_type, error_str);
emit devicesetDeviceSettingsPatchSignalEFull(worker, error_type, error_str);
}
}
void
SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings body) {
SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/device/settings");
@ -605,10 +654,11 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -619,7 +669,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetDeviceSettingsPutCallback);
@ -627,7 +677,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
}
void
SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -644,8 +694,12 @@ SWGDeviceSetApi::devicesetDeviceSettingsPutCallback(HttpRequestWorker * worker)
SWGDeviceSettings* output = static_cast<SWGDeviceSettings*>(create(json, QString("SWGDeviceSettings")));
worker->deleteLater();
emit devicesetDeviceSettingsPutSignal(output);
emit devicesetDeviceSettingsPutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetDeviceSettingsPutSignal(output);
} else {
emit devicesetDeviceSettingsPutSignalE(output, error_type, error_str);
emit devicesetDeviceSettingsPutSignalEFull(worker, error_type, error_str);
}
}
void
@ -657,8 +711,8 @@ SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PATCH");
@ -669,7 +723,7 @@ SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetFocusPatchCallback);
@ -677,7 +731,7 @@ SWGDeviceSetApi::devicesetFocusPatch(qint32 device_set_index) {
}
void
SWGDeviceSetApi::devicesetFocusPatchCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetFocusPatchCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -694,8 +748,12 @@ SWGDeviceSetApi::devicesetFocusPatchCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit devicesetFocusPatchSignal(output);
emit devicesetFocusPatchSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetFocusPatchSignal(output);
} else {
emit devicesetFocusPatchSignalE(output, error_type, error_str);
emit devicesetFocusPatchSignalEFull(worker, error_type, error_str);
}
}
void
@ -707,8 +765,8 @@ SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
fullPath.replace(device_set_indexPathParam, stringValue(device_set_index));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -719,7 +777,7 @@ SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::devicesetGetCallback);
@ -727,7 +785,7 @@ SWGDeviceSetApi::devicesetGet(qint32 device_set_index) {
}
void
SWGDeviceSetApi::devicesetGetCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::devicesetGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -744,8 +802,12 @@ SWGDeviceSetApi::devicesetGetCallback(HttpRequestWorker * worker) {
SWGDeviceSet* output = static_cast<SWGDeviceSet*>(create(json, QString("SWGDeviceSet")));
worker->deleteLater();
emit devicesetGetSignal(output);
emit devicesetGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit devicesetGetSignal(output);
} else {
emit devicesetGetSignalE(output, error_type, error_str);
emit devicesetGetSignalEFull(worker, error_type, error_str);
}
}
void
@ -755,8 +817,8 @@ SWGDeviceSetApi::instanceDeviceSetDelete() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "DELETE");
@ -767,7 +829,7 @@ SWGDeviceSetApi::instanceDeviceSetDelete() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::instanceDeviceSetDeleteCallback);
@ -775,7 +837,7 @@ SWGDeviceSetApi::instanceDeviceSetDelete() {
}
void
SWGDeviceSetApi::instanceDeviceSetDeleteCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::instanceDeviceSetDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -792,8 +854,12 @@ SWGDeviceSetApi::instanceDeviceSetDeleteCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit instanceDeviceSetDeleteSignal(output);
emit instanceDeviceSetDeleteSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeviceSetDeleteSignal(output);
} else {
emit instanceDeviceSetDeleteSignalE(output, error_type, error_str);
emit instanceDeviceSetDeleteSignalEFull(worker, error_type, error_str);
}
}
void
@ -802,17 +868,17 @@ SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset");
if (fullPath.indexOf("?") > 0)
if (fullPath.indexOf("?") > 0)
fullPath.append("&");
else
else
fullPath.append("?");
fullPath.append(QUrl::toPercentEncoding("tx"))
.append("=")
.append(QUrl::toPercentEncoding(stringValue(tx)));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "POST");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "POST");
@ -823,7 +889,7 @@ SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGDeviceSetApi::instanceDeviceSetPostCallback);
@ -831,7 +897,7 @@ SWGDeviceSetApi::instanceDeviceSetPost(qint32 tx) {
}
void
SWGDeviceSetApi::instanceDeviceSetPostCallback(HttpRequestWorker * worker) {
SWGDeviceSetApi::instanceDeviceSetPostCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -848,8 +914,12 @@ SWGDeviceSetApi::instanceDeviceSetPostCallback(HttpRequestWorker * worker) {
SWGSuccessResponse* output = static_cast<SWGSuccessResponse*>(create(json, QString("SWGSuccessResponse")));
worker->deleteLater();
emit instanceDeviceSetPostSignal(output);
emit instanceDeviceSetPostSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeviceSetPostSignal(output);
} else {
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;
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 devicesetChannelSettingsPatch(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 devicesetChannelSettingsPatch(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 devicesetDeviceRunDelete(qint32 device_set_index);
void devicesetDeviceRunGet(qint32 device_set_index);
void devicesetDeviceRunPost(qint32 device_set_index);
void devicesetDeviceSettingsGet(qint32 device_set_index);
void devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings body);
void devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings body);
void devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDeviceSettings& body);
void devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSettings& body);
void devicesetFocusPatch(qint32 device_set_index);
void devicesetGet(qint32 device_set_index);
void instanceDeviceSetDelete();
void instanceDeviceSetPost(qint32 tx);
private:
void devicesetChannelDeleteCallback (HttpRequestWorker * worker);
void devicesetChannelPostCallback (HttpRequestWorker * worker);
void devicesetChannelSettingsGetCallback (HttpRequestWorker * worker);
void devicesetChannelSettingsPatchCallback (HttpRequestWorker * worker);
void devicesetChannelSettingsPutCallback (HttpRequestWorker * worker);
void devicesetDevicePutCallback (HttpRequestWorker * worker);
void devicesetDeviceRunDeleteCallback (HttpRequestWorker * worker);
void devicesetDeviceRunGetCallback (HttpRequestWorker * worker);
void devicesetDeviceRunPostCallback (HttpRequestWorker * worker);
void devicesetDeviceSettingsGetCallback (HttpRequestWorker * worker);
void devicesetDeviceSettingsPatchCallback (HttpRequestWorker * worker);
void devicesetDeviceSettingsPutCallback (HttpRequestWorker * worker);
void devicesetFocusPatchCallback (HttpRequestWorker * worker);
void devicesetGetCallback (HttpRequestWorker * worker);
void instanceDeviceSetDeleteCallback (HttpRequestWorker * worker);
void instanceDeviceSetPostCallback (HttpRequestWorker * worker);
void devicesetChannelDeleteCallback (SWGHttpRequestWorker * worker);
void devicesetChannelPostCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsGetCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsPatchCallback (SWGHttpRequestWorker * worker);
void devicesetChannelSettingsPutCallback (SWGHttpRequestWorker * worker);
void devicesetDevicePutCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunDeleteCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunGetCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceRunPostCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceSettingsGetCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceSettingsPatchCallback (SWGHttpRequestWorker * worker);
void devicesetDeviceSettingsPutCallback (SWGHttpRequestWorker * worker);
void devicesetFocusPatchCallback (SWGHttpRequestWorker * worker);
void devicesetGetCallback (SWGHttpRequestWorker * worker);
void instanceDeviceSetDeleteCallback (SWGHttpRequestWorker * worker);
void instanceDeviceSetPostCallback (SWGHttpRequestWorker * worker);
signals:
void devicesetChannelDeleteSignal(SWGChannelSettings* summary);
@ -109,6 +109,23 @@ signals:
void instanceDeviceSetDeleteSignalE(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 {
SWGDeviceSetList::SWGDeviceSetList(QString* json) {
SWGDeviceSetList::SWGDeviceSetList(QString json) {
init();
this->fromJson(*json);
this->fromJson(json);
}
SWGDeviceSetList::SWGDeviceSetList() {
@ -38,18 +38,20 @@ SWGDeviceSetList::~SWGDeviceSetList() {
void
SWGDeviceSetList::init() {
devicesetcount = 0;
m_devicesetcount_isSet = false;
devicesetfocus = 0;
m_devicesetfocus_isSet = false;
device_sets = new QList<SWGDeviceSet*>();
m_device_sets_isSet = false;
}
void
SWGDeviceSetList::cleanup() {
if(device_sets != nullptr) {
QList<SWGDeviceSet*>* arr = device_sets;
foreach(SWGDeviceSet* o, *arr) {
if(device_sets != nullptr) {
auto arr = device_sets;
for(auto o: *arr) {
delete o;
}
delete device_sets;
@ -57,7 +59,7 @@ SWGDeviceSetList::cleanup() {
}
SWGDeviceSetList*
SWGDeviceSetList::fromJson(QString &json) {
SWGDeviceSetList::fromJson(QString json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
@ -66,35 +68,36 @@ SWGDeviceSetList::fromJson(QString &json) {
}
void
SWGDeviceSetList::fromJsonObject(QJsonObject &pJson) {
SWGDeviceSetList::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&devicesetcount, pJson["devicesetcount"], "qint32", "");
::SWGSDRangel::setValue(&devicesetfocus, pJson["devicesetfocus"], "qint32", "");
::SWGSDRangel::setValue(&device_sets, pJson["deviceSets"], "QList", "SWGDeviceSet");
::SWGSDRangel::setValue(&device_sets, pJson["deviceSets"], "QList", "SWGDeviceSet");
}
QString
SWGDeviceSetList::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject*
QJsonObject
SWGDeviceSetList::asJsonObject() {
QJsonObject* obj = new QJsonObject();
obj->insert("devicesetcount", QJsonValue(devicesetcount));
obj->insert("devicesetfocus", QJsonValue(devicesetfocus));
QJsonArray device_setsJsonArray;
toJsonArray((QList<void*>*)device_sets, &device_setsJsonArray, "device_sets", "SWGDeviceSet");
obj->insert("deviceSets", device_setsJsonArray);
QJsonObject obj;
if(m_devicesetcount_isSet){
obj.insert("devicesetcount", QJsonValue(devicesetcount));
}
if(m_devicesetfocus_isSet){
obj.insert("devicesetfocus", QJsonValue(devicesetfocus));
}
if(device_sets->size() > 0){
toJsonArray((QList<void*>*)device_sets, obj, "deviceSets", "SWGDeviceSet");
}
return obj;
}
@ -106,6 +109,7 @@ SWGDeviceSetList::getDevicesetcount() {
void
SWGDeviceSetList::setDevicesetcount(qint32 devicesetcount) {
this->devicesetcount = devicesetcount;
this->m_devicesetcount_isSet = true;
}
qint32
@ -115,6 +119,7 @@ SWGDeviceSetList::getDevicesetfocus() {
void
SWGDeviceSetList::setDevicesetfocus(qint32 devicesetfocus) {
this->devicesetfocus = devicesetfocus;
this->m_devicesetfocus_isSet = true;
}
QList<SWGDeviceSet*>*
@ -124,8 +129,19 @@ SWGDeviceSetList::getDeviceSets() {
void
SWGDeviceSetList::setDeviceSets(QList<SWGDeviceSet*>* 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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

@ -12,7 +12,7 @@
/*
* SWGHackRFOutputSettings.h
*
*
* HackRF
*/
@ -25,21 +25,20 @@
#include "SWGObject.h"
namespace SWGSDRangel {
class SWGHackRFOutputSettings: public SWGObject {
public:
SWGHackRFOutputSettings();
SWGHackRFOutputSettings(QString* json);
virtual ~SWGHackRFOutputSettings();
SWGHackRFOutputSettings(QString json);
~SWGHackRFOutputSettings();
void init();
void cleanup();
QString asJson ();
QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject &json);
SWGHackRFOutputSettings* fromJson(QString &jsonString);
QJsonObject asJsonObject();
void fromJsonObject(QJsonObject json);
SWGHackRFOutputSettings* fromJson(QString jsonString);
qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency);
@ -66,15 +65,33 @@ public:
void setLnaExt(qint32 lna_ext);
virtual bool isSet() override;
private:
qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 l_oppm_tenths;
bool m_l_oppm_tenths_isSet;
qint32 bandwidth;
bool m_bandwidth_isSet;
qint32 vga_gain;
bool m_vga_gain_isSet;
qint32 log2_interp;
bool m_log2_interp_isSet;
qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 bias_t;
bool m_bias_t_isSet;
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) {
float *val = static_cast<float*>(value);
*val = obj.toDouble();
*val = static_cast<float>(obj.toDouble());
}
else if(QStringLiteral("double").compare(type) == 0) {
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) {
QString **val = static_cast<QString**>(value);
if(val != nullptr) {
if(!obj.isNull()) {
// create a new value and return
delete *val;
*val = new QString(obj.toString());
(*val)->clear();
(*val)->append(obj.toString());
return;
}
else {
// set target to nullptr
delete *val;
*val = nullptr;
(*val)->clear();
}
}
else {
qDebug() << "Can't set value because the target pointer is nullptr";
}
}
else if (QStringLiteral("QDateTime").compare(type) == 0) {
QDateTime **val = static_cast<QDateTime**>(value);
@ -73,13 +66,13 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(val != nullptr) {
if(!obj.isNull()) {
// create a new value and return
delete *val;
if(*val != nullptr) delete *val;
*val = new QDateTime(QDateTime::fromString(obj.toString(), Qt::ISODate));
return;
}
else {
// set target to nullptr
delete *val;
if(*val != nullptr) delete *val;
*val = nullptr;
}
}
@ -93,13 +86,13 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(val != nullptr) {
if(!obj.isNull()) {
// create a new value and return
delete *val;
if(*val != nullptr) delete *val;
*val = new QDate(QDate::fromString(obj.toString(), Qt::ISODate));
return;
}
else {
// set target to nullptr
delete *val;
if(*val != nullptr) delete *val;
*val = nullptr;
}
}
@ -113,14 +106,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
if(val != nullptr) {
if(!obj.isNull()) {
// create a new value and return
delete *val;
if(*val != nullptr) delete *val;
*val = new QByteArray(QByteArray::fromBase64(QByteArray::fromStdString(obj.toString().toStdString())));
return;
}
else {
// set target to nullptr
delete *val;
if(*val != nullptr) delete *val;
*val = nullptr;
}
}
@ -131,144 +124,441 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
else if(type.startsWith("SWG") && obj.isObject()) {
// complex type
QJsonObject jsonObj = obj.toObject();
SWGObject * so = (SWGObject*)::SWGSDRangel::create(type);
SWGObject * so = (SWGObject*)::SWGSDRangel::create(complexType);
if(so != nullptr) {
so->fromJsonObject(jsonObj);
SWGObject **val = static_cast<SWGObject**>(value);
delete *val;
if(*val != nullptr) delete *val;
*val = so;
}
}
else if(type.startsWith("QList") && QString("").compare(complexType) != 0 && obj.isArray()) {
// list of values
QList<void*>* output = new QList<void*>();
QJsonArray arr = obj.toArray();
foreach (const QJsonValue & jval, arr) {
if(complexType.startsWith("SWG")) {
// it's an object
SWGObject * val = (SWGObject*)create(complexType);
QJsonObject t = jval.toObject();
val->fromJsonObject(t);
output->append(val);
if(complexType.startsWith("SWG")) {
auto output = reinterpret_cast<QList<SWGObject *> **> (value);
for (auto item : **output) {
if(item != nullptr) delete item;
}
else {
// primitives
if(QStringLiteral("qint32").compare(complexType) == 0) {
qint32 val;
setValue(&val, jval, QStringLiteral("qint32"), QStringLiteral(""));
output->append((void*)&val);
}
else if(QStringLiteral("qint64").compare(complexType) == 0) {
qint64 val;
setValue(&val, jval, QStringLiteral("qint64"), QStringLiteral(""));
output->append((void*)&val);
}
else if(QStringLiteral("bool").compare(complexType) == 0) {
bool val;
setValue(&val, jval, QStringLiteral("bool"), QStringLiteral(""));
output->append((void*)&val);
}
else if(QStringLiteral("float").compare(complexType) == 0) {
float val;
setValue(&val, jval, QStringLiteral("float"), QStringLiteral(""));
output->append((void*)&val);
}
else if(QStringLiteral("double").compare(complexType) == 0) {
double val;
setValue(&val, jval, QStringLiteral("double"), QStringLiteral(""));
output->append((void*)&val);
}
else if(QStringLiteral("QString").compare(complexType) == 0) {
QString * val = new QString();
setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
output->append((void*)val);
}
else if(QStringLiteral("QDate").compare(complexType) == 0) {
QDate * val = new QDate();
setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
output->append((void*)val);
}
else if(QStringLiteral("QDateTime").compare(complexType) == 0) {
QDateTime * val = new QDateTime();
setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
output->append((void*)val);
(*output)->clear();
QJsonArray arr = obj.toArray();
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;
::SWGSDRangel::setValue(&val, jval, QStringLiteral("qint32"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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;
::SWGSDRangel::setValue(&val, jval, QStringLiteral("qint64"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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;
::SWGSDRangel::setValue(&val, jval, QStringLiteral("bool"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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;
::SWGSDRangel::setValue(&val, jval, QStringLiteral("float"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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;
::SWGSDRangel::setValue(&val, jval, QStringLiteral("double"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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();
::SWGSDRangel::setValue(&val, jval, QStringLiteral("QString"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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();
::SWGSDRangel::setValue(&val, jval, QStringLiteral("QDate"), QStringLiteral(""));
(*output)->push_back(val);
}
}
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();
::SWGSDRangel::setValue(&val, jval, QStringLiteral("QDateTime"), QStringLiteral(""));
(*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
toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
toJsonValue(QString name, void* value, QJsonObject& output, QString type) {
if(value == nullptr) {
return;
}
if(type.startsWith("SWG")) {
SWGObject *swgObject = reinterpret_cast<SWGObject *>(value);
if(swgObject != nullptr) {
QJsonObject* o = (*swgObject).asJsonObject();
if(name != nullptr) {
output->insert(name, *o);
delete o;
SWGObject *SWGobject = reinterpret_cast<SWGObject *>(value);
if(SWGobject != nullptr) {
QJsonObject o = SWGobject->asJsonObject();
if(!name.isNull()) {
output.insert(name, o);
}
else {
output->empty();
foreach(QString key, o->keys()) {
output->insert(key, o->value(key));
output.empty();
for(QString key : o.keys()) {
output.insert(key, o.value(key));
}
}
}
}
else if(QStringLiteral("QString").compare(type) == 0) {
QString* str = static_cast<QString*>(value);
output->insert(name, QJsonValue(*str));
output.insert(name, QJsonValue(*str));
}
else if(QStringLiteral("qint32").compare(type) == 0) {
qint32* str = static_cast<qint32*>(value);
output->insert(name, QJsonValue(*str));
output.insert(name, QJsonValue(*str));
}
else if(QStringLiteral("qint64").compare(type) == 0) {
qint64* str = static_cast<qint64*>(value);
output->insert(name, QJsonValue(*str));
output.insert(name, QJsonValue(*str));
}
else if(QStringLiteral("bool").compare(type) == 0) {
bool* str = static_cast<bool*>(value);
output->insert(name, QJsonValue(*str));
output.insert(name, QJsonValue(*str));
}
else if(QStringLiteral("float").compare(type) == 0) {
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) {
double* str = static_cast<double*>(value);
output->insert(name, QJsonValue(*str));
output.insert(name, QJsonValue(*str));
}
else if(QStringLiteral("QDate").compare(type) == 0) {
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) {
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) {
QByteArray* byteArray = static_cast<QByteArray*>(value);
output->insert(name, QJsonValue(QString(byteArray->toBase64())));
output.insert(name, QJsonValue(QString(byteArray->toBase64())));
}
}
void
toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString innerType) {
foreach(void* obj, *value) {
QJsonObject element;
toJsonValue(nullptr, obj, &element, innerType);
output->append(element);
toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString innerType) {
if(value == nullptr) {
return;
}
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

View File

@ -10,16 +10,19 @@
* Do not edit the class manually.
*/
#ifndef SWGHELPERS_H
#define SWGHELPERS_H
#ifndef SWG_HELPERS_H
#define SWG_HELPERS_H
#include <QJsonValue>
#include <QList>
#include <QMap>
namespace SWGSDRangel {
void setValue(void* value, QJsonValue obj, QString type, QString complexType);
void toJsonArray(QList<void*>* value, QJsonArray* output, QString innerName, QString innerType);
void toJsonValue(QString name, void* value, QJsonObject* output, QString type);
void toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString innerType);
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);
QString stringValue(QString* 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 {
HttpRequestInput::HttpRequestInput() {
SWGHttpRequestInput::SWGHttpRequestInput() {
initialize();
}
HttpRequestInput::HttpRequestInput(QString v_url_str, QString v_http_method) {
SWGHttpRequestInput::SWGHttpRequestInput(QString v_url_str, QString v_http_method) {
initialize();
url_str = v_url_str;
http_method = v_http_method;
}
void HttpRequestInput::initialize() {
void SWGHttpRequestInput::initialize() {
var_layout = NOT_SET;
url_str = "";
http_method = "GET";
}
void HttpRequestInput::add_var(QString key, QString value) {
void SWGHttpRequestInput::add_var(QString key, QString 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;
file.variable_name = variable_name;
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)
{
qsrand(QDateTime::currentDateTime().toTime_t());
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
bool need_utf_encoding = false;
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);
}
void HttpRequestWorker::execute(HttpRequestInput *input) {
void SWGHttpRequestWorker::execute(SWGHttpRequestInput *input) {
// reset variables
@ -262,6 +262,9 @@ void HttpRequestWorker::execute(HttpRequestInput *input) {
// prepare connection
QNetworkRequest request = QNetworkRequest(QUrl(input->url_str));
if (SWGHttpRequestWorker::sslDefaultConfiguration != nullptr) {
request.setSslConfiguration(*SWGHttpRequestWorker::sslDefaultConfiguration);
}
request.setRawHeader("User-Agent", "Swagger-Client");
foreach(QString key, input->headers.keys()) {
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();
if (error_type == QNetworkReply::NoError) {
response = reply->readAll();
}
else {
error_str = reply->errorString();
}
response = reply->readAll();
error_str = reply->errorString();
reply->deleteLater();
emit on_execution_finished(this);
}
QSslConfiguration* SWGHttpRequestWorker::sslDefaultConfiguration;
}

View File

@ -16,8 +16,8 @@
*
**/
#ifndef HTTPREQUESTWORKER_H
#define HTTPREQUESTWORKER_H
#ifndef SWG_HTTPREQUESTWORKER_H
#define SWG_HTTPREQUESTWORKER_H
#include <QObject>
#include <QString>
@ -25,10 +25,12 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
enum HttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART};
namespace SWGSDRangel {
enum SWGHttpRequestVarLayout {NOT_SET, ADDRESS, URL_ENCODED, MULTIPART};
class SWGHttpRequestInputFileElement {
public:
@ -40,19 +42,19 @@ public:
};
class HttpRequestInput {
class SWGHttpRequestInput {
public:
QString url_str;
QString http_method;
HttpRequestVarLayout var_layout;
SWGHttpRequestVarLayout var_layout;
QMap<QString, QString> vars;
QMap<QString, QString> headers;
QList<SWGHttpRequestInputFileElement> files;
QByteArray request_body;
HttpRequestInput();
HttpRequestInput(QString v_url_str, QString v_http_method);
SWGHttpRequestInput();
SWGHttpRequestInput(QString v_url_str, QString v_http_method);
void initialize();
void add_var(QString key, QString value);
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
public:
@ -68,14 +70,15 @@ public:
QNetworkReply::NetworkError error_type;
QString error_str;
explicit HttpRequestWorker(QObject *parent = 0);
virtual ~HttpRequestWorker();
explicit SWGHttpRequestWorker(QObject *parent = 0);
virtual ~SWGHttpRequestWorker();
QString http_attribute_encode(QString attribute_name, QString input);
void execute(HttpRequestInput *input);
void execute(SWGHttpRequestInput *input);
static QSslConfiguration* sslDefaultConfiguration;
signals:
void on_execution_finished(HttpRequestWorker *worker);
void on_execution_finished(SWGHttpRequestWorker *worker);
private:
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();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -47,7 +47,7 @@ SWGInstanceApi::instanceAudioGet() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceAudioGetCallback);
@ -55,7 +55,7 @@ SWGInstanceApi::instanceAudioGet() {
}
void
SWGInstanceApi::instanceAudioGetCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceAudioGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -72,21 +72,26 @@ SWGInstanceApi::instanceAudioGetCallback(HttpRequestWorker * worker) {
SWGAudioDevices* output = static_cast<SWGAudioDevices*>(create(json, QString("SWGAudioDevices")));
worker->deleteLater();
emit instanceAudioGetSignal(output);
emit instanceAudioGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceAudioGetSignal(output);
} else {
emit instanceAudioGetSignalE(output, error_type, error_str);
emit instanceAudioGetSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect body) {
SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/audio");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson();
input.request_body.append(output);
@ -97,7 +102,7 @@ SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceAudioPatchCallback);
@ -105,7 +110,7 @@ SWGInstanceApi::instanceAudioPatch(SWGAudioDevicesSelect body) {
}
void
SWGInstanceApi::instanceAudioPatchCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceAudioPatchCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -122,8 +127,12 @@ SWGInstanceApi::instanceAudioPatchCallback(HttpRequestWorker * worker) {
SWGAudioDevicesSelect* output = static_cast<SWGAudioDevicesSelect*>(create(json, QString("SWGAudioDevicesSelect")));
worker->deleteLater();
emit instanceAudioPatchSignal(output);
emit instanceAudioPatchSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceAudioPatchSignal(output);
} else {
emit instanceAudioPatchSignalE(output, error_type, error_str);
emit instanceAudioPatchSignalEFull(worker, error_type, error_str);
}
}
void
@ -132,17 +141,17 @@ SWGInstanceApi::instanceChannels(qint32 tx) {
fullPath.append(this->host).append(this->basePath).append("/sdrangel/channels");
if (fullPath.indexOf("?") > 0)
if (fullPath.indexOf("?") > 0)
fullPath.append("&");
else
else
fullPath.append("?");
fullPath.append(QUrl::toPercentEncoding("tx"))
.append("=")
.append(QUrl::toPercentEncoding(stringValue(tx)));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -153,7 +162,7 @@ SWGInstanceApi::instanceChannels(qint32 tx) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceChannelsCallback);
@ -161,7 +170,7 @@ SWGInstanceApi::instanceChannels(qint32 tx) {
}
void
SWGInstanceApi::instanceChannelsCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceChannelsCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -178,8 +187,12 @@ SWGInstanceApi::instanceChannelsCallback(HttpRequestWorker * worker) {
SWGInstanceChannelsResponse* output = static_cast<SWGInstanceChannelsResponse*>(create(json, QString("SWGInstanceChannelsResponse")));
worker->deleteLater();
emit instanceChannelsSignal(output);
emit instanceChannelsSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceChannelsSignal(output);
} else {
emit instanceChannelsSignalE(output, error_type, error_str);
emit instanceChannelsSignalEFull(worker, error_type, error_str);
}
}
void
@ -188,17 +201,17 @@ SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) {
fullPath.append(this->host).append(this->basePath).append("/sdrangel/dvserial");
if (fullPath.indexOf("?") > 0)
if (fullPath.indexOf("?") > 0)
fullPath.append("&");
else
else
fullPath.append("?");
fullPath.append(QUrl::toPercentEncoding("dvserial"))
.append("=")
.append(QUrl::toPercentEncoding(stringValue(dvserial)));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PATCH");
@ -209,7 +222,7 @@ SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceDVSerialPatchCallback);
@ -217,7 +230,7 @@ SWGInstanceApi::instanceDVSerialPatch(qint32 dvserial) {
}
void
SWGInstanceApi::instanceDVSerialPatchCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceDVSerialPatchCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -234,8 +247,12 @@ SWGInstanceApi::instanceDVSerialPatchCallback(HttpRequestWorker * worker) {
SWGDVSeralDevices* output = static_cast<SWGDVSeralDevices*>(create(json, QString("SWGDVSeralDevices")));
worker->deleteLater();
emit instanceDVSerialPatchSignal(output);
emit instanceDVSerialPatchSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDVSerialPatchSignal(output);
} else {
emit instanceDVSerialPatchSignalE(output, error_type, error_str);
emit instanceDVSerialPatchSignalEFull(worker, error_type, error_str);
}
}
void
@ -245,8 +262,8 @@ SWGInstanceApi::instanceDelete() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "DELETE");
@ -257,7 +274,7 @@ SWGInstanceApi::instanceDelete() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceDeleteCallback);
@ -265,7 +282,7 @@ SWGInstanceApi::instanceDelete() {
}
void
SWGInstanceApi::instanceDeleteCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -282,8 +299,12 @@ SWGInstanceApi::instanceDeleteCallback(HttpRequestWorker * worker) {
SWGInstanceSummaryResponse* output = static_cast<SWGInstanceSummaryResponse*>(create(json, QString("SWGInstanceSummaryResponse")));
worker->deleteLater();
emit instanceDeleteSignal(output);
emit instanceDeleteSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeleteSignal(output);
} else {
emit instanceDeleteSignalE(output, error_type, error_str);
emit instanceDeleteSignalEFull(worker, error_type, error_str);
}
}
void
@ -293,8 +314,8 @@ SWGInstanceApi::instanceDeviceSetsGet() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -305,7 +326,7 @@ SWGInstanceApi::instanceDeviceSetsGet() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceDeviceSetsGetCallback);
@ -313,7 +334,7 @@ SWGInstanceApi::instanceDeviceSetsGet() {
}
void
SWGInstanceApi::instanceDeviceSetsGetCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceDeviceSetsGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -330,8 +351,12 @@ SWGInstanceApi::instanceDeviceSetsGetCallback(HttpRequestWorker * worker) {
SWGDeviceSetList* output = static_cast<SWGDeviceSetList*>(create(json, QString("SWGDeviceSetList")));
worker->deleteLater();
emit instanceDeviceSetsGetSignal(output);
emit instanceDeviceSetsGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDeviceSetsGetSignal(output);
} else {
emit instanceDeviceSetsGetSignalE(output, error_type, error_str);
emit instanceDeviceSetsGetSignalEFull(worker, error_type, error_str);
}
}
void
@ -340,17 +365,17 @@ SWGInstanceApi::instanceDevices(qint32 tx) {
fullPath.append(this->host).append(this->basePath).append("/sdrangel/devices");
if (fullPath.indexOf("?") > 0)
if (fullPath.indexOf("?") > 0)
fullPath.append("&");
else
else
fullPath.append("?");
fullPath.append(QUrl::toPercentEncoding("tx"))
.append("=")
.append(QUrl::toPercentEncoding(stringValue(tx)));
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -361,7 +386,7 @@ SWGInstanceApi::instanceDevices(qint32 tx) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceDevicesCallback);
@ -369,7 +394,7 @@ SWGInstanceApi::instanceDevices(qint32 tx) {
}
void
SWGInstanceApi::instanceDevicesCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceDevicesCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -386,8 +411,12 @@ SWGInstanceApi::instanceDevicesCallback(HttpRequestWorker * worker) {
SWGInstanceDevicesResponse* output = static_cast<SWGInstanceDevicesResponse*>(create(json, QString("SWGInstanceDevicesResponse")));
worker->deleteLater();
emit instanceDevicesSignal(output);
emit instanceDevicesSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceDevicesSignal(output);
} else {
emit instanceDevicesSignalE(output, error_type, error_str);
emit instanceDevicesSignalEFull(worker, error_type, error_str);
}
}
void
@ -397,8 +426,8 @@ SWGInstanceApi::instanceLocationGet() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -409,7 +438,7 @@ SWGInstanceApi::instanceLocationGet() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceLocationGetCallback);
@ -417,7 +446,7 @@ SWGInstanceApi::instanceLocationGet() {
}
void
SWGInstanceApi::instanceLocationGetCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceLocationGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -434,21 +463,26 @@ SWGInstanceApi::instanceLocationGetCallback(HttpRequestWorker * worker) {
SWGLocationInformation* output = static_cast<SWGLocationInformation*>(create(json, QString("SWGLocationInformation")));
worker->deleteLater();
emit instanceLocationGetSignal(output);
emit instanceLocationGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLocationGetSignal(output);
} else {
emit instanceLocationGetSignalE(output, error_type, error_str);
emit instanceLocationGetSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instanceLocationPut(SWGLocationInformation body) {
SWGInstanceApi::instanceLocationPut(SWGLocationInformation& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/location");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -459,7 +493,7 @@ SWGInstanceApi::instanceLocationPut(SWGLocationInformation body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceLocationPutCallback);
@ -467,7 +501,7 @@ SWGInstanceApi::instanceLocationPut(SWGLocationInformation body) {
}
void
SWGInstanceApi::instanceLocationPutCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceLocationPutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -484,8 +518,12 @@ SWGInstanceApi::instanceLocationPutCallback(HttpRequestWorker * worker) {
SWGLocationInformation* output = static_cast<SWGLocationInformation*>(create(json, QString("SWGLocationInformation")));
worker->deleteLater();
emit instanceLocationPutSignal(output);
emit instanceLocationPutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLocationPutSignal(output);
} else {
emit instanceLocationPutSignalE(output, error_type, error_str);
emit instanceLocationPutSignalEFull(worker, error_type, error_str);
}
}
void
@ -495,8 +533,8 @@ SWGInstanceApi::instanceLoggingGet() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -507,7 +545,7 @@ SWGInstanceApi::instanceLoggingGet() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceLoggingGetCallback);
@ -515,7 +553,7 @@ SWGInstanceApi::instanceLoggingGet() {
}
void
SWGInstanceApi::instanceLoggingGetCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceLoggingGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -532,21 +570,26 @@ SWGInstanceApi::instanceLoggingGetCallback(HttpRequestWorker * worker) {
SWGLoggingInfo* output = static_cast<SWGLoggingInfo*>(create(json, QString("SWGLoggingInfo")));
worker->deleteLater();
emit instanceLoggingGetSignal(output);
emit instanceLoggingGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLoggingGetSignal(output);
} else {
emit instanceLoggingGetSignalE(output, error_type, error_str);
emit instanceLoggingGetSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo body) {
SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/logging");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -557,7 +600,7 @@ SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceLoggingPutCallback);
@ -565,7 +608,7 @@ SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo body) {
}
void
SWGInstanceApi::instanceLoggingPutCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceLoggingPutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -582,21 +625,26 @@ SWGInstanceApi::instanceLoggingPutCallback(HttpRequestWorker * worker) {
SWGLoggingInfo* output = static_cast<SWGLoggingInfo*>(create(json, QString("SWGLoggingInfo")));
worker->deleteLater();
emit instanceLoggingPutSignal(output);
emit instanceLoggingPutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceLoggingPutSignal(output);
} else {
emit instanceLoggingPutSignalE(output, error_type, error_str);
emit instanceLoggingPutSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier body) {
SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "DELETE");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "DELETE");
QString output = body.asJson();
input.request_body.append(output);
@ -607,7 +655,7 @@ SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetDeleteCallback);
@ -615,7 +663,7 @@ SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier body) {
}
void
SWGInstanceApi::instancePresetDeleteCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetDeleteCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -632,21 +680,26 @@ SWGInstanceApi::instancePresetDeleteCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater();
emit instancePresetDeleteSignal(output);
emit instancePresetDeleteSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetDeleteSignal(output);
} else {
emit instancePresetDeleteSignalE(output, error_type, error_str);
emit instancePresetDeleteSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instancePresetFilePost(SWGPresetExport body) {
SWGInstanceApi::instancePresetFilePost(SWGPresetExport& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "POST");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "POST");
QString output = body.asJson();
input.request_body.append(output);
@ -657,7 +710,7 @@ SWGInstanceApi::instancePresetFilePost(SWGPresetExport body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetFilePostCallback);
@ -665,7 +718,7 @@ SWGInstanceApi::instancePresetFilePost(SWGPresetExport body) {
}
void
SWGInstanceApi::instancePresetFilePostCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetFilePostCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -682,21 +735,26 @@ SWGInstanceApi::instancePresetFilePostCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater();
emit instancePresetFilePostSignal(output);
emit instancePresetFilePostSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetFilePostSignal(output);
} else {
emit instancePresetFilePostSignalE(output, error_type, error_str);
emit instancePresetFilePostSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instancePresetFilePut(SWGPresetImport body) {
SWGInstanceApi::instancePresetFilePut(SWGPresetImport& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset/file");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -707,7 +765,7 @@ SWGInstanceApi::instancePresetFilePut(SWGPresetImport body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetFilePutCallback);
@ -715,7 +773,7 @@ SWGInstanceApi::instancePresetFilePut(SWGPresetImport body) {
}
void
SWGInstanceApi::instancePresetFilePutCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetFilePutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -732,8 +790,12 @@ SWGInstanceApi::instancePresetFilePutCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater();
emit instancePresetFilePutSignal(output);
emit instancePresetFilePutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetFilePutSignal(output);
} else {
emit instancePresetFilePutSignalE(output, error_type, error_str);
emit instancePresetFilePutSignalEFull(worker, error_type, error_str);
}
}
void
@ -743,8 +805,8 @@ SWGInstanceApi::instancePresetGet() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -755,7 +817,7 @@ SWGInstanceApi::instancePresetGet() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetGetCallback);
@ -763,7 +825,7 @@ SWGInstanceApi::instancePresetGet() {
}
void
SWGInstanceApi::instancePresetGetCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetGetCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -780,21 +842,26 @@ SWGInstanceApi::instancePresetGetCallback(HttpRequestWorker * worker) {
SWGPresets* output = static_cast<SWGPresets*>(create(json, QString("SWGPresets")));
worker->deleteLater();
emit instancePresetGetSignal(output);
emit instancePresetGetSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetGetSignal(output);
} else {
emit instancePresetGetSignalE(output, error_type, error_str);
emit instancePresetGetSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instancePresetPatch(SWGPresetTransfer body) {
SWGInstanceApi::instancePresetPatch(SWGPresetTransfer& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PATCH");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PATCH");
QString output = body.asJson();
input.request_body.append(output);
@ -805,7 +872,7 @@ SWGInstanceApi::instancePresetPatch(SWGPresetTransfer body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetPatchCallback);
@ -813,7 +880,7 @@ SWGInstanceApi::instancePresetPatch(SWGPresetTransfer body) {
}
void
SWGInstanceApi::instancePresetPatchCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetPatchCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -830,21 +897,26 @@ SWGInstanceApi::instancePresetPatchCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater();
emit instancePresetPatchSignal(output);
emit instancePresetPatchSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetPatchSignal(output);
} else {
emit instancePresetPatchSignalE(output, error_type, error_str);
emit instancePresetPatchSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instancePresetPost(SWGPresetTransfer body) {
SWGInstanceApi::instancePresetPost(SWGPresetTransfer& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "POST");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "POST");
QString output = body.asJson();
input.request_body.append(output);
@ -855,7 +927,7 @@ SWGInstanceApi::instancePresetPost(SWGPresetTransfer body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetPostCallback);
@ -863,7 +935,7 @@ SWGInstanceApi::instancePresetPost(SWGPresetTransfer body) {
}
void
SWGInstanceApi::instancePresetPostCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetPostCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -880,21 +952,26 @@ SWGInstanceApi::instancePresetPostCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater();
emit instancePresetPostSignal(output);
emit instancePresetPostSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetPostSignal(output);
} else {
emit instancePresetPostSignalE(output, error_type, error_str);
emit instancePresetPostSignalEFull(worker, error_type, error_str);
}
}
void
SWGInstanceApi::instancePresetPut(SWGPresetTransfer body) {
SWGInstanceApi::instancePresetPut(SWGPresetTransfer& body) {
QString fullPath;
fullPath.append(this->host).append(this->basePath).append("/sdrangel/preset");
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "PUT");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "PUT");
QString output = body.asJson();
input.request_body.append(output);
@ -905,7 +982,7 @@ SWGInstanceApi::instancePresetPut(SWGPresetTransfer body) {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instancePresetPutCallback);
@ -913,7 +990,7 @@ SWGInstanceApi::instancePresetPut(SWGPresetTransfer body) {
}
void
SWGInstanceApi::instancePresetPutCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instancePresetPutCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -930,8 +1007,12 @@ SWGInstanceApi::instancePresetPutCallback(HttpRequestWorker * worker) {
SWGPresetIdentifier* output = static_cast<SWGPresetIdentifier*>(create(json, QString("SWGPresetIdentifier")));
worker->deleteLater();
emit instancePresetPutSignal(output);
emit instancePresetPutSignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instancePresetPutSignal(output);
} else {
emit instancePresetPutSignalE(output, error_type, error_str);
emit instancePresetPutSignalEFull(worker, error_type, error_str);
}
}
void
@ -941,8 +1022,8 @@ SWGInstanceApi::instanceSummary() {
HttpRequestWorker *worker = new HttpRequestWorker();
HttpRequestInput input(fullPath, "GET");
SWGHttpRequestWorker *worker = new SWGHttpRequestWorker();
SWGHttpRequestInput input(fullPath, "GET");
@ -953,7 +1034,7 @@ SWGInstanceApi::instanceSummary() {
}
connect(worker,
&HttpRequestWorker::on_execution_finished,
&SWGHttpRequestWorker::on_execution_finished,
this,
&SWGInstanceApi::instanceSummaryCallback);
@ -961,7 +1042,7 @@ SWGInstanceApi::instanceSummary() {
}
void
SWGInstanceApi::instanceSummaryCallback(HttpRequestWorker * worker) {
SWGInstanceApi::instanceSummaryCallback(SWGHttpRequestWorker * worker) {
QString msg;
QString error_str = worker->error_str;
QNetworkReply::NetworkError error_type = worker->error_type;
@ -978,8 +1059,12 @@ SWGInstanceApi::instanceSummaryCallback(HttpRequestWorker * worker) {
SWGInstanceSummaryResponse* output = static_cast<SWGInstanceSummaryResponse*>(create(json, QString("SWGInstanceSummaryResponse")));
worker->deleteLater();
emit instanceSummarySignal(output);
emit instanceSummarySignalE(output, error_type, error_str);
if (worker->error_type == QNetworkReply::NoError) {
emit instanceSummarySignal(output);
} else {
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;
void instanceAudioGet();
void instanceAudioPatch(SWGAudioDevicesSelect body);
void instanceAudioPatch(SWGAudioDevicesSelect& body);
void instanceChannels(qint32 tx);
void instanceDVSerialPatch(qint32 dvserial);
void instanceDelete();
void instanceDeviceSetsGet();
void instanceDevices(qint32 tx);
void instanceLocationGet();
void instanceLocationPut(SWGLocationInformation body);
void instanceLocationPut(SWGLocationInformation& body);
void instanceLoggingGet();
void instanceLoggingPut(SWGLoggingInfo body);
void instancePresetDelete(SWGPresetIdentifier body);
void instancePresetFilePost(SWGPresetExport body);
void instancePresetFilePut(SWGPresetImport body);
void instanceLoggingPut(SWGLoggingInfo& body);
void instancePresetDelete(SWGPresetIdentifier& body);
void instancePresetFilePost(SWGPresetExport& body);
void instancePresetFilePut(SWGPresetImport& body);
void instancePresetGet();
void instancePresetPatch(SWGPresetTransfer body);
void instancePresetPost(SWGPresetTransfer body);
void instancePresetPut(SWGPresetTransfer body);
void instancePresetPatch(SWGPresetTransfer& body);
void instancePresetPost(SWGPresetTransfer& body);
void instancePresetPut(SWGPresetTransfer& body);
void instanceSummary();
private:
void instanceAudioGetCallback (HttpRequestWorker * worker);
void instanceAudioPatchCallback (HttpRequestWorker * worker);
void instanceChannelsCallback (HttpRequestWorker * worker);
void instanceDVSerialPatchCallback (HttpRequestWorker * worker);
void instanceDeleteCallback (HttpRequestWorker * worker);
void instanceDeviceSetsGetCallback (HttpRequestWorker * worker);
void instanceDevicesCallback (HttpRequestWorker * worker);
void instanceLocationGetCallback (HttpRequestWorker * worker);
void instanceLocationPutCallback (HttpRequestWorker * worker);
void instanceLoggingGetCallback (HttpRequestWorker * worker);
void instanceLoggingPutCallback (HttpRequestWorker * worker);
void instancePresetDeleteCallback (HttpRequestWorker * worker);
void instancePresetFilePostCallback (HttpRequestWorker * worker);
void instancePresetFilePutCallback (HttpRequestWorker * worker);
void instancePresetGetCallback (HttpRequestWorker * worker);
void instancePresetPatchCallback (HttpRequestWorker * worker);
void instancePresetPostCallback (HttpRequestWorker * worker);
void instancePresetPutCallback (HttpRequestWorker * worker);
void instanceSummaryCallback (HttpRequestWorker * worker);
void instanceAudioGetCallback (SWGHttpRequestWorker * worker);
void instanceAudioPatchCallback (SWGHttpRequestWorker * worker);
void instanceChannelsCallback (SWGHttpRequestWorker * worker);
void instanceDVSerialPatchCallback (SWGHttpRequestWorker * worker);
void instanceDeleteCallback (SWGHttpRequestWorker * worker);
void instanceDeviceSetsGetCallback (SWGHttpRequestWorker * worker);
void instanceDevicesCallback (SWGHttpRequestWorker * worker);
void instanceLocationGetCallback (SWGHttpRequestWorker * worker);
void instanceLocationPutCallback (SWGHttpRequestWorker * worker);
void instanceLoggingGetCallback (SWGHttpRequestWorker * worker);
void instanceLoggingPutCallback (SWGHttpRequestWorker * worker);
void instancePresetDeleteCallback (SWGHttpRequestWorker * worker);
void instancePresetFilePostCallback (SWGHttpRequestWorker * worker);
void instancePresetFilePutCallback (SWGHttpRequestWorker * worker);
void instancePresetGetCallback (SWGHttpRequestWorker * worker);
void instancePresetPatchCallback (SWGHttpRequestWorker * worker);
void instancePresetPostCallback (SWGHttpRequestWorker * worker);
void instancePresetPutCallback (SWGHttpRequestWorker * worker);
void instanceSummaryCallback (SWGHttpRequestWorker * worker);
signals:
void instanceAudioGetSignal(SWGAudioDevices* summary);
@ -129,6 +129,26 @@ signals:
void instancePresetPutSignalE(SWGPresetIdentifier* 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 {
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse(QString* json) {
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse(QString json) {
init();
this->fromJson(*json);
this->fromJson(json);
}
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse() {
@ -38,16 +38,17 @@ SWGInstanceChannelsResponse::~SWGInstanceChannelsResponse() {
void
SWGInstanceChannelsResponse::init() {
channelcount = 0;
m_channelcount_isSet = false;
channels = new QList<SWGChannelListItem*>();
m_channels_isSet = false;
}
void
SWGInstanceChannelsResponse::cleanup() {
if(channels != nullptr) {
QList<SWGChannelListItem*>* arr = channels;
foreach(SWGChannelListItem* o, *arr) {
if(channels != nullptr) {
auto arr = channels;
for(auto o: *arr) {
delete o;
}
delete channels;
@ -55,7 +56,7 @@ SWGInstanceChannelsResponse::cleanup() {
}
SWGInstanceChannelsResponse*
SWGInstanceChannelsResponse::fromJson(QString &json) {
SWGInstanceChannelsResponse::fromJson(QString json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
@ -64,32 +65,31 @@ SWGInstanceChannelsResponse::fromJson(QString &json) {
}
void
SWGInstanceChannelsResponse::fromJsonObject(QJsonObject &pJson) {
SWGInstanceChannelsResponse::fromJsonObject(QJsonObject pJson) {
::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannelListItem");
::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannelListItem");
}
QString
SWGInstanceChannelsResponse::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject*
QJsonObject
SWGInstanceChannelsResponse::asJsonObject() {
QJsonObject* obj = new QJsonObject();
obj->insert("channelcount", QJsonValue(channelcount));
QJsonArray channelsJsonArray;
toJsonArray((QList<void*>*)channels, &channelsJsonArray, "channels", "SWGChannelListItem");
obj->insert("channels", channelsJsonArray);
QJsonObject obj;
if(m_channelcount_isSet){
obj.insert("channelcount", QJsonValue(channelcount));
}
if(channels->size() > 0){
toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannelListItem");
}
return obj;
}
@ -101,6 +101,7 @@ SWGInstanceChannelsResponse::getChannelcount() {
void
SWGInstanceChannelsResponse::setChannelcount(qint32 channelcount) {
this->channelcount = channelcount;
this->m_channelcount_isSet = true;
}
QList<SWGChannelListItem*>*
@ -110,8 +111,18 @@ SWGInstanceChannelsResponse::getChannels() {
void
SWGInstanceChannelsResponse::setChannels(QList<SWGChannelListItem*>* 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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

@ -171,13 +171,12 @@ namespace SWGSDRangel {
}
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")) {
return new QString();
}
auto val = static_cast<SWGObject*>(create(type));
if(val != nullptr) {
return val->fromJson(json);
}
return nullptr;
}

View File

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

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

View File

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

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

View File

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

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

View File

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

@ -12,7 +12,7 @@
/*
* SWGSamplingDevice.h
*
*
* Information about a logical device available from an attached hardware device that can be used as a sampling device
*/
@ -26,21 +26,20 @@
#include "SWGObject.h"
namespace SWGSDRangel {
class SWGSamplingDevice: public SWGObject {
public:
SWGSamplingDevice();
SWGSamplingDevice(QString* json);
virtual ~SWGSamplingDevice();
SWGSamplingDevice(QString json);
~SWGSamplingDevice();
void init();
void cleanup();
QString asJson ();
QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject &json);
SWGSamplingDevice* fromJson(QString &jsonString);
QJsonObject asJsonObject();
void fromJsonObject(QJsonObject json);
SWGSamplingDevice* fromJson(QString jsonString);
qint32 getIndex();
void setIndex(qint32 index);
@ -73,17 +72,39 @@ public:
void setState(QString* state);
virtual bool isSet() override;
private:
qint32 index;
bool m_index_isSet;
QString* hw_type;
bool m_hw_type_isSet;
qint32 tx;
bool m_tx_isSet;
qint32 nb_streams;
bool m_nb_streams_isSet;
qint32 stream_index;
bool m_stream_index_isSet;
qint32 sequence;
bool m_sequence_isSet;
QString* serial;
bool m_serial_isSet;
qint64 center_frequency;
bool m_center_frequency_isSet;
qint32 bandwidth;
bool m_bandwidth_isSet;
QString* state;
bool m_state_isSet;
};
}

View File

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

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