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.
SWGATVModReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGATVModReport.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_power_db = 0.0f;
35 }
36 
38  this->cleanup();
39 }
40 
41 void
43  channel_power_db = 0.0f;
47 }
48 
49 void
51 
52 
53 }
54 
56 SWGATVModReport::fromJson(QString &json) {
57  QByteArray array (json.toStdString().c_str());
58  QJsonDocument doc = QJsonDocument::fromJson(array);
59  QJsonObject jsonObject = doc.object();
60  this->fromJsonObject(jsonObject);
61  return this;
62 }
63 
64 void
65 SWGATVModReport::fromJsonObject(QJsonObject &pJson) {
66  ::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
67 
68  ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
69 
70 }
71 
72 QString
74 {
75  QJsonObject* obj = this->asJsonObject();
76 
77  QJsonDocument doc(*obj);
78  QByteArray bytes = doc.toJson();
79  delete obj;
80  return QString(bytes);
81 }
82 
83 QJsonObject*
85  QJsonObject* obj = new QJsonObject();
87  obj->insert("channelPowerDB", QJsonValue(channel_power_db));
88  }
90  obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
91  }
92 
93  return obj;
94 }
95 
96 float
98  return channel_power_db;
99 }
100 void
102  this->channel_power_db = channel_power_db;
103  this->m_channel_power_db_isSet = true;
104 }
105 
106 qint32
108  return channel_sample_rate;
109 }
110 void
112  this->channel_sample_rate = channel_sample_rate;
113  this->m_channel_sample_rate_isSet = true;
114 }
115 
116 
117 bool
119  bool isObjectUpdated = false;
120  do{
121  if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
122  if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break;}
123  }while(false);
124  return isObjectUpdated;
125 }
126 }
127 
virtual QString asJson() override
virtual QJsonObject * asJsonObject() override
virtual bool isSet() override
void setChannelSampleRate(qint32 channel_sample_rate)
virtual SWGATVModReport * fromJson(QString &jsonString) override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual void fromJsonObject(QJsonObject &json) override
void setChannelPowerDb(float channel_power_db)