SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
SWGKiwiSDRReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGKiwiSDRReport.h"
15 
16 #include "SWGHelpers.h"
17 
18 #include <QJsonDocument>
19 #include <QJsonArray>
20 #include <QObject>
21 #include <QDebug>
22 
23 namespace SWGSDRangel {
24 
26  init();
27  this->fromJson(*json);
28 }
29 
31  status = 0;
32  m_status_isSet = false;
33 }
34 
36  this->cleanup();
37 }
38 
39 void
41  status = 0;
42  m_status_isSet = false;
43 }
44 
45 void
47 
48 }
49 
52  QByteArray array (json.toStdString().c_str());
53  QJsonDocument doc = QJsonDocument::fromJson(array);
54  QJsonObject jsonObject = doc.object();
55  this->fromJsonObject(jsonObject);
56  return this;
57 }
58 
59 void
60 SWGKiwiSDRReport::fromJsonObject(QJsonObject &pJson) {
61  ::SWGSDRangel::setValue(&status, pJson["status"], "qint32", "");
62 
63 }
64 
65 QString
67 {
68  QJsonObject* obj = this->asJsonObject();
69 
70  QJsonDocument doc(*obj);
71  QByteArray bytes = doc.toJson();
72  delete obj;
73  return QString(bytes);
74 }
75 
76 QJsonObject*
78  QJsonObject* obj = new QJsonObject();
79  if(m_status_isSet){
80  obj->insert("status", QJsonValue(status));
81  }
82 
83  return obj;
84 }
85 
86 qint32
88  return status;
89 }
90 void
92  this->status = status;
93  this->m_status_isSet = true;
94 }
95 
96 
97 bool
99  bool isObjectUpdated = false;
100  do{
101  if(m_status_isSet){ isObjectUpdated = true; break;}
102  }while(false);
103  return isObjectUpdated;
104 }
105 }
106 
virtual QJsonObject * asJsonObject() override
virtual bool isSet() override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual SWGKiwiSDRReport * fromJson(QString &jsonString) override
virtual void fromJsonObject(QJsonObject &json) override
virtual QString asJson() override