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.
SWGRemoteSourceReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGRemoteSourceReport.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  queue_length = 0;
32  m_queue_length_isSet = false;
33  queue_size = 0;
34  m_queue_size_isSet = false;
35  samples_count = 0;
36  m_samples_count_isSet = false;
41  tv_sec = 0;
42  m_tv_sec_isSet = false;
43  tv_u_sec = 0;
44  m_tv_u_sec_isSet = false;
47  nb_fec_blocks = 0;
48  m_nb_fec_blocks_isSet = false;
49  center_freq = 0;
50  m_center_freq_isSet = false;
51  sample_rate = 0;
52  m_sample_rate_isSet = false;
57 }
58 
60  this->cleanup();
61 }
62 
63 void
65  queue_length = 0;
66  m_queue_length_isSet = false;
67  queue_size = 0;
68  m_queue_size_isSet = false;
69  samples_count = 0;
70  m_samples_count_isSet = false;
75  tv_sec = 0;
76  m_tv_sec_isSet = false;
77  tv_u_sec = 0;
78  m_tv_u_sec_isSet = false;
81  nb_fec_blocks = 0;
82  m_nb_fec_blocks_isSet = false;
83  center_freq = 0;
84  m_center_freq_isSet = false;
85  sample_rate = 0;
86  m_sample_rate_isSet = false;
91 }
92 
93 void
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 }
109 
112  QByteArray array (json.toStdString().c_str());
113  QJsonDocument doc = QJsonDocument::fromJson(array);
114  QJsonObject jsonObject = doc.object();
115  this->fromJsonObject(jsonObject);
116  return this;
117 }
118 
119 void
121  ::SWGSDRangel::setValue(&queue_length, pJson["queueLength"], "qint32", "");
122 
123  ::SWGSDRangel::setValue(&queue_size, pJson["queueSize"], "qint32", "");
124 
125  ::SWGSDRangel::setValue(&samples_count, pJson["samplesCount"], "qint32", "");
126 
127  ::SWGSDRangel::setValue(&correctable_errors_count, pJson["correctableErrorsCount"], "qint32", "");
128 
129  ::SWGSDRangel::setValue(&uncorrectable_errors_count, pJson["uncorrectableErrorsCount"], "qint32", "");
130 
131  ::SWGSDRangel::setValue(&tv_sec, pJson["tvSec"], "qint32", "");
132 
133  ::SWGSDRangel::setValue(&tv_u_sec, pJson["tvUSec"], "qint32", "");
134 
135  ::SWGSDRangel::setValue(&nb_original_blocks, pJson["nbOriginalBlocks"], "qint32", "");
136 
137  ::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", "");
138 
139  ::SWGSDRangel::setValue(&center_freq, pJson["centerFreq"], "qint32", "");
140 
141  ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
142 
143  ::SWGSDRangel::setValue(&device_center_freq, pJson["deviceCenterFreq"], "qint32", "");
144 
145  ::SWGSDRangel::setValue(&device_sample_rate, pJson["deviceSampleRate"], "qint32", "");
146 
147 }
148 
149 QString
151 {
152  QJsonObject* obj = this->asJsonObject();
153 
154  QJsonDocument doc(*obj);
155  QByteArray bytes = doc.toJson();
156  delete obj;
157  return QString(bytes);
158 }
159 
160 QJsonObject*
162  QJsonObject* obj = new QJsonObject();
164  obj->insert("queueLength", QJsonValue(queue_length));
165  }
166  if(m_queue_size_isSet){
167  obj->insert("queueSize", QJsonValue(queue_size));
168  }
170  obj->insert("samplesCount", QJsonValue(samples_count));
171  }
173  obj->insert("correctableErrorsCount", QJsonValue(correctable_errors_count));
174  }
176  obj->insert("uncorrectableErrorsCount", QJsonValue(uncorrectable_errors_count));
177  }
178  if(m_tv_sec_isSet){
179  obj->insert("tvSec", QJsonValue(tv_sec));
180  }
181  if(m_tv_u_sec_isSet){
182  obj->insert("tvUSec", QJsonValue(tv_u_sec));
183  }
185  obj->insert("nbOriginalBlocks", QJsonValue(nb_original_blocks));
186  }
188  obj->insert("nbFECBlocks", QJsonValue(nb_fec_blocks));
189  }
191  obj->insert("centerFreq", QJsonValue(center_freq));
192  }
194  obj->insert("sampleRate", QJsonValue(sample_rate));
195  }
197  obj->insert("deviceCenterFreq", QJsonValue(device_center_freq));
198  }
200  obj->insert("deviceSampleRate", QJsonValue(device_sample_rate));
201  }
202 
203  return obj;
204 }
205 
206 qint32
208  return queue_length;
209 }
210 void
212  this->queue_length = queue_length;
213  this->m_queue_length_isSet = true;
214 }
215 
216 qint32
218  return queue_size;
219 }
220 void
222  this->queue_size = queue_size;
223  this->m_queue_size_isSet = true;
224 }
225 
226 qint32
228  return samples_count;
229 }
230 void
232  this->samples_count = samples_count;
233  this->m_samples_count_isSet = true;
234 }
235 
236 qint32
239 }
240 void
242  this->correctable_errors_count = correctable_errors_count;
244 }
245 
246 qint32
249 }
250 void
252  this->uncorrectable_errors_count = uncorrectable_errors_count;
254 }
255 
256 qint32
258  return tv_sec;
259 }
260 void
262  this->tv_sec = tv_sec;
263  this->m_tv_sec_isSet = true;
264 }
265 
266 qint32
268  return tv_u_sec;
269 }
270 void
272  this->tv_u_sec = tv_u_sec;
273  this->m_tv_u_sec_isSet = true;
274 }
275 
276 qint32
278  return nb_original_blocks;
279 }
280 void
282  this->nb_original_blocks = nb_original_blocks;
283  this->m_nb_original_blocks_isSet = true;
284 }
285 
286 qint32
288  return nb_fec_blocks;
289 }
290 void
292  this->nb_fec_blocks = nb_fec_blocks;
293  this->m_nb_fec_blocks_isSet = true;
294 }
295 
296 qint32
298  return center_freq;
299 }
300 void
302  this->center_freq = center_freq;
303  this->m_center_freq_isSet = true;
304 }
305 
306 qint32
308  return sample_rate;
309 }
310 void
312  this->sample_rate = sample_rate;
313  this->m_sample_rate_isSet = true;
314 }
315 
316 qint32
318  return device_center_freq;
319 }
320 void
322  this->device_center_freq = device_center_freq;
323  this->m_device_center_freq_isSet = true;
324 }
325 
326 qint32
328  return device_sample_rate;
329 }
330 void
332  this->device_sample_rate = device_sample_rate;
333  this->m_device_sample_rate_isSet = true;
334 }
335 
336 
337 bool
339  bool isObjectUpdated = false;
340  do{
341  if(m_queue_length_isSet){ isObjectUpdated = true; break;}
342  if(m_queue_size_isSet){ isObjectUpdated = true; break;}
343  if(m_samples_count_isSet){ isObjectUpdated = true; break;}
344  if(m_correctable_errors_count_isSet){ isObjectUpdated = true; break;}
345  if(m_uncorrectable_errors_count_isSet){ isObjectUpdated = true; break;}
346  if(m_tv_sec_isSet){ isObjectUpdated = true; break;}
347  if(m_tv_u_sec_isSet){ isObjectUpdated = true; break;}
348  if(m_nb_original_blocks_isSet){ isObjectUpdated = true; break;}
349  if(m_nb_fec_blocks_isSet){ isObjectUpdated = true; break;}
350  if(m_center_freq_isSet){ isObjectUpdated = true; break;}
351  if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
352  if(m_device_center_freq_isSet){ isObjectUpdated = true; break;}
353  if(m_device_sample_rate_isSet){ isObjectUpdated = true; break;}
354  }while(false);
355  return isObjectUpdated;
356 }
357 }
358 
void setDeviceCenterFreq(qint32 device_center_freq)
void setSamplesCount(qint32 samples_count)
void setCorrectableErrorsCount(qint32 correctable_errors_count)
virtual SWGRemoteSourceReport * fromJson(QString &jsonString) override
void setUncorrectableErrorsCount(qint32 uncorrectable_errors_count)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setNbOriginalBlocks(qint32 nb_original_blocks)
virtual void fromJsonObject(QJsonObject &json) override
void setNbFecBlocks(qint32 nb_fec_blocks)
virtual QJsonObject * asJsonObject() override
void setDeviceSampleRate(qint32 device_sample_rate)