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.
SWGChannelReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGChannelReport.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  channel_type = nullptr;
32  m_channel_type_isSet = false;
33  direction = 0;
34  m_direction_isSet = false;
35  am_demod_report = nullptr;
37  am_mod_report = nullptr;
38  m_am_mod_report_isSet = false;
39  atv_mod_report = nullptr;
40  m_atv_mod_report_isSet = false;
41  bfm_demod_report = nullptr;
43  dsd_demod_report = nullptr;
45  file_source_report = nullptr;
47  free_dv_demod_report = nullptr;
49  free_dv_mod_report = nullptr;
51  freq_tracker_report = nullptr;
53  nfm_demod_report = nullptr;
55  nfm_mod_report = nullptr;
56  m_nfm_mod_report_isSet = false;
57  ssb_demod_report = nullptr;
59  remote_source_report = nullptr;
61  ssb_mod_report = nullptr;
62  m_ssb_mod_report_isSet = false;
63  udp_source_report = nullptr;
65  udp_sink_report = nullptr;
67  wfm_demod_report = nullptr;
69  wfm_mod_report = nullptr;
70  m_wfm_mod_report_isSet = false;
71 }
72 
74  this->cleanup();
75 }
76 
77 void
79  channel_type = new QString("");
80  m_channel_type_isSet = false;
81  direction = 0;
82  m_direction_isSet = false;
86  m_am_mod_report_isSet = false;
88  m_atv_mod_report_isSet = false;
102  m_nfm_demod_report_isSet = false;
104  m_nfm_mod_report_isSet = false;
106  m_ssb_demod_report_isSet = false;
110  m_ssb_mod_report_isSet = false;
114  m_udp_sink_report_isSet = false;
116  m_wfm_demod_report_isSet = false;
118  m_wfm_mod_report_isSet = false;
119 }
120 
121 void
123  if(channel_type != nullptr) {
124  delete channel_type;
125  }
126 
127  if(am_demod_report != nullptr) {
128  delete am_demod_report;
129  }
130  if(am_mod_report != nullptr) {
131  delete am_mod_report;
132  }
133  if(atv_mod_report != nullptr) {
134  delete atv_mod_report;
135  }
136  if(bfm_demod_report != nullptr) {
137  delete bfm_demod_report;
138  }
139  if(dsd_demod_report != nullptr) {
140  delete dsd_demod_report;
141  }
142  if(file_source_report != nullptr) {
143  delete file_source_report;
144  }
145  if(free_dv_demod_report != nullptr) {
146  delete free_dv_demod_report;
147  }
148  if(free_dv_mod_report != nullptr) {
149  delete free_dv_mod_report;
150  }
151  if(freq_tracker_report != nullptr) {
152  delete freq_tracker_report;
153  }
154  if(nfm_demod_report != nullptr) {
155  delete nfm_demod_report;
156  }
157  if(nfm_mod_report != nullptr) {
158  delete nfm_mod_report;
159  }
160  if(ssb_demod_report != nullptr) {
161  delete ssb_demod_report;
162  }
163  if(remote_source_report != nullptr) {
164  delete remote_source_report;
165  }
166  if(ssb_mod_report != nullptr) {
167  delete ssb_mod_report;
168  }
169  if(udp_source_report != nullptr) {
170  delete udp_source_report;
171  }
172  if(udp_sink_report != nullptr) {
173  delete udp_sink_report;
174  }
175  if(wfm_demod_report != nullptr) {
176  delete wfm_demod_report;
177  }
178  if(wfm_mod_report != nullptr) {
179  delete wfm_mod_report;
180  }
181 }
182 
185  QByteArray array (json.toStdString().c_str());
186  QJsonDocument doc = QJsonDocument::fromJson(array);
187  QJsonObject jsonObject = doc.object();
188  this->fromJsonObject(jsonObject);
189  return this;
190 }
191 
192 void
193 SWGChannelReport::fromJsonObject(QJsonObject &pJson) {
194  ::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString");
195 
196  ::SWGSDRangel::setValue(&direction, pJson["direction"], "qint32", "");
197 
198  ::SWGSDRangel::setValue(&am_demod_report, pJson["AMDemodReport"], "SWGAMDemodReport", "SWGAMDemodReport");
199 
200  ::SWGSDRangel::setValue(&am_mod_report, pJson["AMModReport"], "SWGAMModReport", "SWGAMModReport");
201 
202  ::SWGSDRangel::setValue(&atv_mod_report, pJson["ATVModReport"], "SWGATVModReport", "SWGATVModReport");
203 
204  ::SWGSDRangel::setValue(&bfm_demod_report, pJson["BFMDemodReport"], "SWGBFMDemodReport", "SWGBFMDemodReport");
205 
206  ::SWGSDRangel::setValue(&dsd_demod_report, pJson["DSDDemodReport"], "SWGDSDDemodReport", "SWGDSDDemodReport");
207 
208  ::SWGSDRangel::setValue(&file_source_report, pJson["FileSourceReport"], "SWGFileSourceReport", "SWGFileSourceReport");
209 
210  ::SWGSDRangel::setValue(&free_dv_demod_report, pJson["FreeDVDemodReport"], "SWGFreeDVDemodReport", "SWGFreeDVDemodReport");
211 
212  ::SWGSDRangel::setValue(&free_dv_mod_report, pJson["FreeDVModReport"], "SWGFreeDVModReport", "SWGFreeDVModReport");
213 
214  ::SWGSDRangel::setValue(&freq_tracker_report, pJson["FreqTrackerReport"], "SWGFreqTrackerReport", "SWGFreqTrackerReport");
215 
216  ::SWGSDRangel::setValue(&nfm_demod_report, pJson["NFMDemodReport"], "SWGNFMDemodReport", "SWGNFMDemodReport");
217 
218  ::SWGSDRangel::setValue(&nfm_mod_report, pJson["NFMModReport"], "SWGNFMModReport", "SWGNFMModReport");
219 
220  ::SWGSDRangel::setValue(&ssb_demod_report, pJson["SSBDemodReport"], "SWGSSBDemodReport", "SWGSSBDemodReport");
221 
222  ::SWGSDRangel::setValue(&remote_source_report, pJson["RemoteSourceReport"], "SWGRemoteSourceReport", "SWGRemoteSourceReport");
223 
224  ::SWGSDRangel::setValue(&ssb_mod_report, pJson["SSBModReport"], "SWGSSBModReport", "SWGSSBModReport");
225 
226  ::SWGSDRangel::setValue(&udp_source_report, pJson["UDPSourceReport"], "SWGUDPSourceReport", "SWGUDPSourceReport");
227 
228  ::SWGSDRangel::setValue(&udp_sink_report, pJson["UDPSinkReport"], "SWGUDPSinkReport", "SWGUDPSinkReport");
229 
230  ::SWGSDRangel::setValue(&wfm_demod_report, pJson["WFMDemodReport"], "SWGWFMDemodReport", "SWGWFMDemodReport");
231 
232  ::SWGSDRangel::setValue(&wfm_mod_report, pJson["WFMModReport"], "SWGWFMModReport", "SWGWFMModReport");
233 
234 }
235 
236 QString
238 {
239  QJsonObject* obj = this->asJsonObject();
240 
241  QJsonDocument doc(*obj);
242  QByteArray bytes = doc.toJson();
243  delete obj;
244  return QString(bytes);
245 }
246 
247 QJsonObject*
249  QJsonObject* obj = new QJsonObject();
250  if(channel_type != nullptr && *channel_type != QString("")){
251  toJsonValue(QString("channelType"), channel_type, obj, QString("QString"));
252  }
253  if(m_direction_isSet){
254  obj->insert("direction", QJsonValue(direction));
255  }
256  if((am_demod_report != nullptr) && (am_demod_report->isSet())){
257  toJsonValue(QString("AMDemodReport"), am_demod_report, obj, QString("SWGAMDemodReport"));
258  }
259  if((am_mod_report != nullptr) && (am_mod_report->isSet())){
260  toJsonValue(QString("AMModReport"), am_mod_report, obj, QString("SWGAMModReport"));
261  }
262  if((atv_mod_report != nullptr) && (atv_mod_report->isSet())){
263  toJsonValue(QString("ATVModReport"), atv_mod_report, obj, QString("SWGATVModReport"));
264  }
265  if((bfm_demod_report != nullptr) && (bfm_demod_report->isSet())){
266  toJsonValue(QString("BFMDemodReport"), bfm_demod_report, obj, QString("SWGBFMDemodReport"));
267  }
268  if((dsd_demod_report != nullptr) && (dsd_demod_report->isSet())){
269  toJsonValue(QString("DSDDemodReport"), dsd_demod_report, obj, QString("SWGDSDDemodReport"));
270  }
271  if((file_source_report != nullptr) && (file_source_report->isSet())){
272  toJsonValue(QString("FileSourceReport"), file_source_report, obj, QString("SWGFileSourceReport"));
273  }
274  if((free_dv_demod_report != nullptr) && (free_dv_demod_report->isSet())){
275  toJsonValue(QString("FreeDVDemodReport"), free_dv_demod_report, obj, QString("SWGFreeDVDemodReport"));
276  }
277  if((free_dv_mod_report != nullptr) && (free_dv_mod_report->isSet())){
278  toJsonValue(QString("FreeDVModReport"), free_dv_mod_report, obj, QString("SWGFreeDVModReport"));
279  }
280  if((freq_tracker_report != nullptr) && (freq_tracker_report->isSet())){
281  toJsonValue(QString("FreqTrackerReport"), freq_tracker_report, obj, QString("SWGFreqTrackerReport"));
282  }
283  if((nfm_demod_report != nullptr) && (nfm_demod_report->isSet())){
284  toJsonValue(QString("NFMDemodReport"), nfm_demod_report, obj, QString("SWGNFMDemodReport"));
285  }
286  if((nfm_mod_report != nullptr) && (nfm_mod_report->isSet())){
287  toJsonValue(QString("NFMModReport"), nfm_mod_report, obj, QString("SWGNFMModReport"));
288  }
289  if((ssb_demod_report != nullptr) && (ssb_demod_report->isSet())){
290  toJsonValue(QString("SSBDemodReport"), ssb_demod_report, obj, QString("SWGSSBDemodReport"));
291  }
292  if((remote_source_report != nullptr) && (remote_source_report->isSet())){
293  toJsonValue(QString("RemoteSourceReport"), remote_source_report, obj, QString("SWGRemoteSourceReport"));
294  }
295  if((ssb_mod_report != nullptr) && (ssb_mod_report->isSet())){
296  toJsonValue(QString("SSBModReport"), ssb_mod_report, obj, QString("SWGSSBModReport"));
297  }
298  if((udp_source_report != nullptr) && (udp_source_report->isSet())){
299  toJsonValue(QString("UDPSourceReport"), udp_source_report, obj, QString("SWGUDPSourceReport"));
300  }
301  if((udp_sink_report != nullptr) && (udp_sink_report->isSet())){
302  toJsonValue(QString("UDPSinkReport"), udp_sink_report, obj, QString("SWGUDPSinkReport"));
303  }
304  if((wfm_demod_report != nullptr) && (wfm_demod_report->isSet())){
305  toJsonValue(QString("WFMDemodReport"), wfm_demod_report, obj, QString("SWGWFMDemodReport"));
306  }
307  if((wfm_mod_report != nullptr) && (wfm_mod_report->isSet())){
308  toJsonValue(QString("WFMModReport"), wfm_mod_report, obj, QString("SWGWFMModReport"));
309  }
310 
311  return obj;
312 }
313 
314 QString*
316  return channel_type;
317 }
318 void
320  this->channel_type = channel_type;
321  this->m_channel_type_isSet = true;
322 }
323 
324 qint32
326  return direction;
327 }
328 void
330  this->direction = direction;
331  this->m_direction_isSet = true;
332 }
333 
336  return am_demod_report;
337 }
338 void
340  this->am_demod_report = am_demod_report;
341  this->m_am_demod_report_isSet = true;
342 }
343 
346  return am_mod_report;
347 }
348 void
350  this->am_mod_report = am_mod_report;
351  this->m_am_mod_report_isSet = true;
352 }
353 
356  return atv_mod_report;
357 }
358 void
360  this->atv_mod_report = atv_mod_report;
361  this->m_atv_mod_report_isSet = true;
362 }
363 
366  return bfm_demod_report;
367 }
368 void
370  this->bfm_demod_report = bfm_demod_report;
371  this->m_bfm_demod_report_isSet = true;
372 }
373 
376  return dsd_demod_report;
377 }
378 void
380  this->dsd_demod_report = dsd_demod_report;
381  this->m_dsd_demod_report_isSet = true;
382 }
383 
386  return file_source_report;
387 }
388 void
390  this->file_source_report = file_source_report;
391  this->m_file_source_report_isSet = true;
392 }
393 
396  return free_dv_demod_report;
397 }
398 void
400  this->free_dv_demod_report = free_dv_demod_report;
401  this->m_free_dv_demod_report_isSet = true;
402 }
403 
406  return free_dv_mod_report;
407 }
408 void
410  this->free_dv_mod_report = free_dv_mod_report;
411  this->m_free_dv_mod_report_isSet = true;
412 }
413 
416  return freq_tracker_report;
417 }
418 void
420  this->freq_tracker_report = freq_tracker_report;
421  this->m_freq_tracker_report_isSet = true;
422 }
423 
426  return nfm_demod_report;
427 }
428 void
430  this->nfm_demod_report = nfm_demod_report;
431  this->m_nfm_demod_report_isSet = true;
432 }
433 
436  return nfm_mod_report;
437 }
438 void
440  this->nfm_mod_report = nfm_mod_report;
441  this->m_nfm_mod_report_isSet = true;
442 }
443 
446  return ssb_demod_report;
447 }
448 void
450  this->ssb_demod_report = ssb_demod_report;
451  this->m_ssb_demod_report_isSet = true;
452 }
453 
456  return remote_source_report;
457 }
458 void
460  this->remote_source_report = remote_source_report;
461  this->m_remote_source_report_isSet = true;
462 }
463 
466  return ssb_mod_report;
467 }
468 void
470  this->ssb_mod_report = ssb_mod_report;
471  this->m_ssb_mod_report_isSet = true;
472 }
473 
476  return udp_source_report;
477 }
478 void
480  this->udp_source_report = udp_source_report;
481  this->m_udp_source_report_isSet = true;
482 }
483 
486  return udp_sink_report;
487 }
488 void
490  this->udp_sink_report = udp_sink_report;
491  this->m_udp_sink_report_isSet = true;
492 }
493 
496  return wfm_demod_report;
497 }
498 void
500  this->wfm_demod_report = wfm_demod_report;
501  this->m_wfm_demod_report_isSet = true;
502 }
503 
506  return wfm_mod_report;
507 }
508 void
510  this->wfm_mod_report = wfm_mod_report;
511  this->m_wfm_mod_report_isSet = true;
512 }
513 
514 
515 bool
517  bool isObjectUpdated = false;
518  do{
519  if(channel_type != nullptr && *channel_type != QString("")){ isObjectUpdated = true; break;}
520  if(m_direction_isSet){ isObjectUpdated = true; break;}
521  if(am_demod_report != nullptr && am_demod_report->isSet()){ isObjectUpdated = true; break;}
522  if(am_mod_report != nullptr && am_mod_report->isSet()){ isObjectUpdated = true; break;}
523  if(atv_mod_report != nullptr && atv_mod_report->isSet()){ isObjectUpdated = true; break;}
524  if(bfm_demod_report != nullptr && bfm_demod_report->isSet()){ isObjectUpdated = true; break;}
525  if(dsd_demod_report != nullptr && dsd_demod_report->isSet()){ isObjectUpdated = true; break;}
526  if(file_source_report != nullptr && file_source_report->isSet()){ isObjectUpdated = true; break;}
527  if(free_dv_demod_report != nullptr && free_dv_demod_report->isSet()){ isObjectUpdated = true; break;}
528  if(free_dv_mod_report != nullptr && free_dv_mod_report->isSet()){ isObjectUpdated = true; break;}
529  if(freq_tracker_report != nullptr && freq_tracker_report->isSet()){ isObjectUpdated = true; break;}
530  if(nfm_demod_report != nullptr && nfm_demod_report->isSet()){ isObjectUpdated = true; break;}
531  if(nfm_mod_report != nullptr && nfm_mod_report->isSet()){ isObjectUpdated = true; break;}
532  if(ssb_demod_report != nullptr && ssb_demod_report->isSet()){ isObjectUpdated = true; break;}
533  if(remote_source_report != nullptr && remote_source_report->isSet()){ isObjectUpdated = true; break;}
534  if(ssb_mod_report != nullptr && ssb_mod_report->isSet()){ isObjectUpdated = true; break;}
535  if(udp_source_report != nullptr && udp_source_report->isSet()){ isObjectUpdated = true; break;}
536  if(udp_sink_report != nullptr && udp_sink_report->isSet()){ isObjectUpdated = true; break;}
537  if(wfm_demod_report != nullptr && wfm_demod_report->isSet()){ isObjectUpdated = true; break;}
538  if(wfm_mod_report != nullptr && wfm_mod_report->isSet()){ isObjectUpdated = true; break;}
539  }while(false);
540  return isObjectUpdated;
541 }
542 }
543 
void setSsbModReport(SWGSSBModReport *ssb_mod_report)
SWGSSBDemodReport * getSsbDemodReport()
SWGSSBModReport * getSsbModReport()
void setSsbDemodReport(SWGSSBDemodReport *ssb_demod_report)
SWGBFMDemodReport * getBfmDemodReport()
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setFreqTrackerReport(SWGFreqTrackerReport *freq_tracker_report)
virtual bool isSet() override
SWGBFMDemodReport * bfm_demod_report
void setFreeDvModReport(SWGFreeDVModReport *free_dv_mod_report)
SWGFileSourceReport * getFileSourceReport()
void setRemoteSourceReport(SWGRemoteSourceReport *remote_source_report)
SWGUDPSourceReport * udp_source_report
virtual bool isSet() override
SWGFreqTrackerReport * getFreqTrackerReport()
SWGWFMDemodReport * wfm_demod_report
void setDsdDemodReport(SWGDSDDemodReport *dsd_demod_report)
SWGAMDemodReport * getAmDemodReport()
SWGNFMModReport * getNfmModReport()
SWGNFMDemodReport * getNfmDemodReport()
SWGDSDDemodReport * getDsdDemodReport()
SWGUDPSinkReport * udp_sink_report
SWGSSBDemodReport * ssb_demod_report
SWGFreqTrackerReport * freq_tracker_report
void setUdpSinkReport(SWGUDPSinkReport *udp_sink_report)
virtual SWGChannelReport * fromJson(QString &jsonString) override
SWGFileSourceReport * file_source_report
virtual bool isSet() override
void setChannelType(QString *channel_type)
void setAtvModReport(SWGATVModReport *atv_mod_report)
SWGWFMDemodReport * getWfmDemodReport()
virtual QJsonObject * asJsonObject() override
void setWfmModReport(SWGWFMModReport *wfm_mod_report)
void setBfmDemodReport(SWGBFMDemodReport *bfm_demod_report)
void setWfmDemodReport(SWGWFMDemodReport *wfm_demod_report)
SWGRemoteSourceReport * getRemoteSourceReport()
SWGFreeDVModReport * free_dv_mod_report
SWGAMDemodReport * am_demod_report
virtual bool isSet() override
SWGWFMModReport * getWfmModReport()
void setFileSourceReport(SWGFileSourceReport *file_source_report)
SWGUDPSinkReport * getUdpSinkReport()
virtual void fromJsonObject(QJsonObject &json) override
void setFreeDvDemodReport(SWGFreeDVDemodReport *free_dv_demod_report)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
SWGATVModReport * getAtvModReport()
SWGRemoteSourceReport * remote_source_report
SWGFreeDVDemodReport * free_dv_demod_report
SWGNFMDemodReport * nfm_demod_report
virtual QString asJson() override
SWGFreeDVModReport * getFreeDvModReport()
void setAmDemodReport(SWGAMDemodReport *am_demod_report)
virtual bool isSet() override
SWGUDPSourceReport * getUdpSourceReport()
void setNfmDemodReport(SWGNFMDemodReport *nfm_demod_report)
virtual bool isSet() override
void setNfmModReport(SWGNFMModReport *nfm_mod_report)
virtual bool isSet() override
void setDirection(qint32 direction)
void setAmModReport(SWGAMModReport *am_mod_report)
SWGDSDDemodReport * dsd_demod_report
void setUdpSourceReport(SWGUDPSourceReport *udp_source_report)
SWGFreeDVDemodReport * getFreeDvDemodReport()
virtual bool isSet() override