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.
SWGDSDDemodReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGDSDDemodReport.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;
37  squelch = 0;
38  m_squelch_isSet = false;
39  pll_locked = 0;
40  m_pll_locked_isSet = false;
41  slot1_on = 0;
42  m_slot1_on_isSet = false;
43  slot2_on = 0;
44  m_slot2_on_isSet = false;
45  sync_type = nullptr;
46  m_sync_type_isSet = false;
47  in_level = 0;
48  m_in_level_isSet = false;
49  carier_position = 0;
53  sync_rate = 0;
54  m_sync_rate_isSet = false;
55  status_text = nullptr;
56  m_status_text_isSet = false;
57 }
58 
60  this->cleanup();
61 }
62 
63 void
65  channel_power_db = 0.0f;
71  squelch = 0;
72  m_squelch_isSet = false;
73  pll_locked = 0;
74  m_pll_locked_isSet = false;
75  slot1_on = 0;
76  m_slot1_on_isSet = false;
77  slot2_on = 0;
78  m_slot2_on_isSet = false;
79  sync_type = new QString("");
80  m_sync_type_isSet = false;
81  in_level = 0;
82  m_in_level_isSet = false;
83  carier_position = 0;
87  sync_rate = 0;
88  m_sync_rate_isSet = false;
89  status_text = new QString("");
90  m_status_text_isSet = false;
91 }
92 
93 void
95 
96 
97 
98 
99 
100 
101 
102  if(sync_type != nullptr) {
103  delete sync_type;
104  }
105 
106 
107 
108 
109  if(status_text != nullptr) {
110  delete status_text;
111  }
112 }
113 
116  QByteArray array (json.toStdString().c_str());
117  QJsonDocument doc = QJsonDocument::fromJson(array);
118  QJsonObject jsonObject = doc.object();
119  this->fromJsonObject(jsonObject);
120  return this;
121 }
122 
123 void
125  ::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
126 
127  ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", "");
128 
129  ::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
130 
131  ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "qint32", "");
132 
133  ::SWGSDRangel::setValue(&pll_locked, pJson["pllLocked"], "qint32", "");
134 
135  ::SWGSDRangel::setValue(&slot1_on, pJson["slot1On"], "qint32", "");
136 
137  ::SWGSDRangel::setValue(&slot2_on, pJson["slot2On"], "qint32", "");
138 
139  ::SWGSDRangel::setValue(&sync_type, pJson["syncType"], "QString", "QString");
140 
141  ::SWGSDRangel::setValue(&in_level, pJson["inLevel"], "qint32", "");
142 
143  ::SWGSDRangel::setValue(&carier_position, pJson["carierPosition"], "qint32", "");
144 
145  ::SWGSDRangel::setValue(&zero_crossing_position, pJson["zeroCrossingPosition"], "qint32", "");
146 
147  ::SWGSDRangel::setValue(&sync_rate, pJson["syncRate"], "qint32", "");
148 
149  ::SWGSDRangel::setValue(&status_text, pJson["statusText"], "QString", "QString");
150 
151 }
152 
153 QString
155 {
156  QJsonObject* obj = this->asJsonObject();
157 
158  QJsonDocument doc(*obj);
159  QByteArray bytes = doc.toJson();
160  delete obj;
161  return QString(bytes);
162 }
163 
164 QJsonObject*
166  QJsonObject* obj = new QJsonObject();
168  obj->insert("channelPowerDB", QJsonValue(channel_power_db));
169  }
171  obj->insert("audioSampleRate", QJsonValue(audio_sample_rate));
172  }
174  obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
175  }
176  if(m_squelch_isSet){
177  obj->insert("squelch", QJsonValue(squelch));
178  }
179  if(m_pll_locked_isSet){
180  obj->insert("pllLocked", QJsonValue(pll_locked));
181  }
182  if(m_slot1_on_isSet){
183  obj->insert("slot1On", QJsonValue(slot1_on));
184  }
185  if(m_slot2_on_isSet){
186  obj->insert("slot2On", QJsonValue(slot2_on));
187  }
188  if(sync_type != nullptr && *sync_type != QString("")){
189  toJsonValue(QString("syncType"), sync_type, obj, QString("QString"));
190  }
191  if(m_in_level_isSet){
192  obj->insert("inLevel", QJsonValue(in_level));
193  }
195  obj->insert("carierPosition", QJsonValue(carier_position));
196  }
198  obj->insert("zeroCrossingPosition", QJsonValue(zero_crossing_position));
199  }
200  if(m_sync_rate_isSet){
201  obj->insert("syncRate", QJsonValue(sync_rate));
202  }
203  if(status_text != nullptr && *status_text != QString("")){
204  toJsonValue(QString("statusText"), status_text, obj, QString("QString"));
205  }
206 
207  return obj;
208 }
209 
210 float
212  return channel_power_db;
213 }
214 void
216  this->channel_power_db = channel_power_db;
217  this->m_channel_power_db_isSet = true;
218 }
219 
220 qint32
222  return audio_sample_rate;
223 }
224 void
226  this->audio_sample_rate = audio_sample_rate;
227  this->m_audio_sample_rate_isSet = true;
228 }
229 
230 qint32
232  return channel_sample_rate;
233 }
234 void
236  this->channel_sample_rate = channel_sample_rate;
237  this->m_channel_sample_rate_isSet = true;
238 }
239 
240 qint32
242  return squelch;
243 }
244 void
246  this->squelch = squelch;
247  this->m_squelch_isSet = true;
248 }
249 
250 qint32
252  return pll_locked;
253 }
254 void
256  this->pll_locked = pll_locked;
257  this->m_pll_locked_isSet = true;
258 }
259 
260 qint32
262  return slot1_on;
263 }
264 void
266  this->slot1_on = slot1_on;
267  this->m_slot1_on_isSet = true;
268 }
269 
270 qint32
272  return slot2_on;
273 }
274 void
276  this->slot2_on = slot2_on;
277  this->m_slot2_on_isSet = true;
278 }
279 
280 QString*
282  return sync_type;
283 }
284 void
286  this->sync_type = sync_type;
287  this->m_sync_type_isSet = true;
288 }
289 
290 qint32
292  return in_level;
293 }
294 void
296  this->in_level = in_level;
297  this->m_in_level_isSet = true;
298 }
299 
300 qint32
302  return carier_position;
303 }
304 void
306  this->carier_position = carier_position;
307  this->m_carier_position_isSet = true;
308 }
309 
310 qint32
312  return zero_crossing_position;
313 }
314 void
316  this->zero_crossing_position = zero_crossing_position;
317  this->m_zero_crossing_position_isSet = true;
318 }
319 
320 qint32
322  return sync_rate;
323 }
324 void
326  this->sync_rate = sync_rate;
327  this->m_sync_rate_isSet = true;
328 }
329 
330 QString*
332  return status_text;
333 }
334 void
336  this->status_text = status_text;
337  this->m_status_text_isSet = true;
338 }
339 
340 
341 bool
343  bool isObjectUpdated = false;
344  do{
345  if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
346  if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;}
347  if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break;}
348  if(m_squelch_isSet){ isObjectUpdated = true; break;}
349  if(m_pll_locked_isSet){ isObjectUpdated = true; break;}
350  if(m_slot1_on_isSet){ isObjectUpdated = true; break;}
351  if(m_slot2_on_isSet){ isObjectUpdated = true; break;}
352  if(sync_type != nullptr && *sync_type != QString("")){ isObjectUpdated = true; break;}
353  if(m_in_level_isSet){ isObjectUpdated = true; break;}
354  if(m_carier_position_isSet){ isObjectUpdated = true; break;}
355  if(m_zero_crossing_position_isSet){ isObjectUpdated = true; break;}
356  if(m_sync_rate_isSet){ isObjectUpdated = true; break;}
357  if(status_text != nullptr && *status_text != QString("")){ isObjectUpdated = true; break;}
358  }while(false);
359  return isObjectUpdated;
360 }
361 }
362 
virtual SWGDSDDemodReport * fromJson(QString &jsonString) override
void setPllLocked(qint32 pll_locked)
void setChannelSampleRate(qint32 channel_sample_rate)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setStatusText(QString *status_text)
void setChannelPowerDb(float channel_power_db)
virtual QJsonObject * asJsonObject() override
void setAudioSampleRate(qint32 audio_sample_rate)
void setZeroCrossingPosition(qint32 zero_crossing_position)
void setCarierPosition(qint32 carier_position)
virtual QString asJson() override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual void fromJsonObject(QJsonObject &json) override
void setSyncType(QString *sync_type)
void setSyncRate(qint32 sync_rate)