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.
SWGFrequency.cpp
Go to the documentation of this file.
1 
14 #include "SWGFrequency.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  frequency = 0;
32  m_frequency_isSet = false;
33 }
34 
36  this->cleanup();
37 }
38 
39 void
41  frequency = 0;
42  m_frequency_isSet = false;
43 }
44 
45 void
47 
48 }
49 
51 SWGFrequency::fromJson(QString &json) {
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 SWGFrequency::fromJsonObject(QJsonObject &pJson) {
61  ::SWGSDRangel::setValue(&frequency, pJson["frequency"], "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();
80  obj->insert("frequency", QJsonValue(frequency));
81  }
82 
83  return obj;
84 }
85 
86 qint32
88  return frequency;
89 }
90 void
92  this->frequency = frequency;
93  this->m_frequency_isSet = true;
94 }
95 
96 
97 bool
99  bool isObjectUpdated = false;
100  do{
101  if(m_frequency_isSet){ isObjectUpdated = true; break;}
102  }while(false);
103  return isObjectUpdated;
104 }
105 }
106 
virtual SWGFrequency * fromJson(QString &jsonString) override
virtual void fromJsonObject(QJsonObject &json) override
virtual QJsonObject * asJsonObject() override
virtual QString asJson() override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual bool isSet() override
void setFrequency(qint32 frequency)