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.
SWGXtrxOutputReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGXtrxOutputReport.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  success = 0;
32  m_success_isSet = false;
33  fifo_size = 0;
34  m_fifo_size_isSet = false;
35  fifo_fill = 0;
36  m_fifo_fill_isSet = false;
37  temperature = 0.0f;
38  m_temperature_isSet = false;
39  gps_lock = 0;
40  m_gps_lock_isSet = false;
41 }
42 
44  this->cleanup();
45 }
46 
47 void
49  success = 0;
50  m_success_isSet = false;
51  fifo_size = 0;
52  m_fifo_size_isSet = false;
53  fifo_fill = 0;
54  m_fifo_fill_isSet = false;
55  temperature = 0.0f;
56  m_temperature_isSet = false;
57  gps_lock = 0;
58  m_gps_lock_isSet = false;
59 }
60 
61 void
63 
64 
65 
66 
67 
68 }
69 
72  QByteArray array (json.toStdString().c_str());
73  QJsonDocument doc = QJsonDocument::fromJson(array);
74  QJsonObject jsonObject = doc.object();
75  this->fromJsonObject(jsonObject);
76  return this;
77 }
78 
79 void
81  ::SWGSDRangel::setValue(&success, pJson["success"], "qint32", "");
82 
83  ::SWGSDRangel::setValue(&fifo_size, pJson["fifoSize"], "qint32", "");
84 
85  ::SWGSDRangel::setValue(&fifo_fill, pJson["fifoFill"], "qint32", "");
86 
87  ::SWGSDRangel::setValue(&temperature, pJson["temperature"], "float", "");
88 
89  ::SWGSDRangel::setValue(&gps_lock, pJson["gpsLock"], "qint32", "");
90 
91 }
92 
93 QString
95 {
96  QJsonObject* obj = this->asJsonObject();
97 
98  QJsonDocument doc(*obj);
99  QByteArray bytes = doc.toJson();
100  delete obj;
101  return QString(bytes);
102 }
103 
104 QJsonObject*
106  QJsonObject* obj = new QJsonObject();
107  if(m_success_isSet){
108  obj->insert("success", QJsonValue(success));
109  }
110  if(m_fifo_size_isSet){
111  obj->insert("fifoSize", QJsonValue(fifo_size));
112  }
113  if(m_fifo_fill_isSet){
114  obj->insert("fifoFill", QJsonValue(fifo_fill));
115  }
117  obj->insert("temperature", QJsonValue(temperature));
118  }
119  if(m_gps_lock_isSet){
120  obj->insert("gpsLock", QJsonValue(gps_lock));
121  }
122 
123  return obj;
124 }
125 
126 qint32
128  return success;
129 }
130 void
132  this->success = success;
133  this->m_success_isSet = true;
134 }
135 
136 qint32
138  return fifo_size;
139 }
140 void
142  this->fifo_size = fifo_size;
143  this->m_fifo_size_isSet = true;
144 }
145 
146 qint32
148  return fifo_fill;
149 }
150 void
152  this->fifo_fill = fifo_fill;
153  this->m_fifo_fill_isSet = true;
154 }
155 
156 float
158  return temperature;
159 }
160 void
162  this->temperature = temperature;
163  this->m_temperature_isSet = true;
164 }
165 
166 qint32
168  return gps_lock;
169 }
170 void
172  this->gps_lock = gps_lock;
173  this->m_gps_lock_isSet = true;
174 }
175 
176 
177 bool
179  bool isObjectUpdated = false;
180  do{
181  if(m_success_isSet){ isObjectUpdated = true; break;}
182  if(m_fifo_size_isSet){ isObjectUpdated = true; break;}
183  if(m_fifo_fill_isSet){ isObjectUpdated = true; break;}
184  if(m_temperature_isSet){ isObjectUpdated = true; break;}
185  if(m_gps_lock_isSet){ isObjectUpdated = true; break;}
186  }while(false);
187  return isObjectUpdated;
188 }
189 }
190 
virtual void fromJsonObject(QJsonObject &json) override
virtual QString asJson() override
virtual SWGXtrxOutputReport * fromJson(QString &jsonString) override
void setTemperature(float temperature)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual QJsonObject * asJsonObject() override