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.
SWGGain.cpp
Go to the documentation of this file.
1 
14 #include "SWGGain.h"
15 
16 #include "SWGHelpers.h"
17 
18 #include <QJsonDocument>
19 #include <QJsonArray>
20 #include <QObject>
21 #include <QDebug>
22 
23 namespace SWGSDRangel {
24 
25 SWGGain::SWGGain(QString* json) {
26  init();
27  this->fromJson(*json);
28 }
29 
31  gain_cb = 0;
32  m_gain_cb_isSet = false;
33 }
34 
36  this->cleanup();
37 }
38 
39 void
41  gain_cb = 0;
42  m_gain_cb_isSet = false;
43 }
44 
45 void
47 
48 }
49 
50 SWGGain*
51 SWGGain::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 SWGGain::fromJsonObject(QJsonObject &pJson) {
61  ::SWGSDRangel::setValue(&gain_cb, pJson["gainCB"], "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_gain_cb_isSet){
80  obj->insert("gainCB", QJsonValue(gain_cb));
81  }
82 
83  return obj;
84 }
85 
86 qint32
88  return gain_cb;
89 }
90 void
92  this->gain_cb = gain_cb;
93  this->m_gain_cb_isSet = true;
94 }
95 
96 
97 bool
99  bool isObjectUpdated = false;
100  do{
101  if(m_gain_cb_isSet){ isObjectUpdated = true; break;}
102  }while(false);
103  return isObjectUpdated;
104 }
105 }
106 
virtual QJsonObject * asJsonObject() override
Definition: SWGGain.cpp:77
virtual SWGGain * fromJson(QString &jsonString) override
Definition: SWGGain.cpp:51
void setGainCb(qint32 gain_cb)
Definition: SWGGain.cpp:91
virtual void fromJsonObject(QJsonObject &json) override
Definition: SWGGain.cpp:60
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
qint32 getGainCb()
Definition: SWGGain.cpp:87
virtual ~SWGGain()
Definition: SWGGain.cpp:35
virtual QString asJson() override
Definition: SWGGain.cpp:66
virtual bool isSet() override
Definition: SWGGain.cpp:98