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.
SWGFreqTrackerSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGFreqTrackerSettings.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 
33  rf_bandwidth = 0.0f;
34  m_rf_bandwidth_isSet = false;
35  log2_decim = 0;
36  m_log2_decim_isSet = false;
37  squelch = 0.0f;
38  m_squelch_isSet = false;
39  rgb_color = 0;
40  m_rgb_color_isSet = false;
41  title = nullptr;
42  m_title_isSet = false;
43  alpha_ema = 0.0f;
44  m_alpha_ema_isSet = false;
45  tracking = 0;
46  m_tracking_isSet = false;
47  tracker_type = 0;
48  m_tracker_type_isSet = false;
49  pll_psk_order = 0;
50  m_pll_psk_order_isSet = false;
51  rrc = 0;
52  m_rrc_isSet = false;
53  rrc_rolloff = 0;
54  m_rrc_rolloff_isSet = false;
55  squelch_gate = 0;
56  m_squelch_gate_isSet = false;
57  use_reverse_api = 0;
59  reverse_api_address = nullptr;
61  reverse_api_port = 0;
67 }
68 
70  this->cleanup();
71 }
72 
73 void
77  rf_bandwidth = 0.0f;
78  m_rf_bandwidth_isSet = false;
79  log2_decim = 0;
80  m_log2_decim_isSet = false;
81  squelch = 0.0f;
82  m_squelch_isSet = false;
83  rgb_color = 0;
84  m_rgb_color_isSet = false;
85  title = new QString("");
86  m_title_isSet = false;
87  alpha_ema = 0.0f;
88  m_alpha_ema_isSet = false;
89  tracking = 0;
90  m_tracking_isSet = false;
91  tracker_type = 0;
92  m_tracker_type_isSet = false;
93  pll_psk_order = 0;
94  m_pll_psk_order_isSet = false;
95  rrc = 0;
96  m_rrc_isSet = false;
97  rrc_rolloff = 0;
98  m_rrc_rolloff_isSet = false;
99  squelch_gate = 0;
100  m_squelch_gate_isSet = false;
101  use_reverse_api = 0;
102  m_use_reverse_api_isSet = false;
103  reverse_api_address = new QString("");
105  reverse_api_port = 0;
106  m_reverse_api_port_isSet = false;
111 }
112 
113 void
115 
116 
117 
118 
119 
120  if(title != nullptr) {
121  delete title;
122  }
123 
124 
125 
126 
127 
128 
129 
130 
131  if(reverse_api_address != nullptr) {
132  delete reverse_api_address;
133  }
134 
135 
136 
137 }
138 
141  QByteArray array (json.toStdString().c_str());
142  QJsonDocument doc = QJsonDocument::fromJson(array);
143  QJsonObject jsonObject = doc.object();
144  this->fromJsonObject(jsonObject);
145  return this;
146 }
147 
148 void
150  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
151 
152  ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
153 
154  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
155 
156  ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", "");
157 
158  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
159 
160  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
161 
162  ::SWGSDRangel::setValue(&alpha_ema, pJson["alphaEMA"], "float", "");
163 
164  ::SWGSDRangel::setValue(&tracking, pJson["tracking"], "qint32", "");
165 
166  ::SWGSDRangel::setValue(&tracker_type, pJson["trackerType"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&pll_psk_order, pJson["pllPskOrder"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&rrc, pJson["rrc"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&rrc_rolloff, pJson["rrcRolloff"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "qint32", "");
175 
176  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
177 
178  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
179 
180  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
181 
182  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
185 
186 }
187 
188 QString
190 {
191  QJsonObject* obj = this->asJsonObject();
192 
193  QJsonDocument doc(*obj);
194  QByteArray bytes = doc.toJson();
195  delete obj;
196  return QString(bytes);
197 }
198 
199 QJsonObject*
201  QJsonObject* obj = new QJsonObject();
203  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
204  }
206  obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
207  }
208  if(m_log2_decim_isSet){
209  obj->insert("log2Decim", QJsonValue(log2_decim));
210  }
211  if(m_squelch_isSet){
212  obj->insert("squelch", QJsonValue(squelch));
213  }
214  if(m_rgb_color_isSet){
215  obj->insert("rgbColor", QJsonValue(rgb_color));
216  }
217  if(title != nullptr && *title != QString("")){
218  toJsonValue(QString("title"), title, obj, QString("QString"));
219  }
220  if(m_alpha_ema_isSet){
221  obj->insert("alphaEMA", QJsonValue(alpha_ema));
222  }
223  if(m_tracking_isSet){
224  obj->insert("tracking", QJsonValue(tracking));
225  }
227  obj->insert("trackerType", QJsonValue(tracker_type));
228  }
230  obj->insert("pllPskOrder", QJsonValue(pll_psk_order));
231  }
232  if(m_rrc_isSet){
233  obj->insert("rrc", QJsonValue(rrc));
234  }
236  obj->insert("rrcRolloff", QJsonValue(rrc_rolloff));
237  }
239  obj->insert("squelchGate", QJsonValue(squelch_gate));
240  }
242  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
243  }
244  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
245  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
246  }
248  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
249  }
251  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
252  }
254  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
255  }
256 
257  return obj;
258 }
259 
260 qint64
262  return input_frequency_offset;
263 }
264 void
266  this->input_frequency_offset = input_frequency_offset;
267  this->m_input_frequency_offset_isSet = true;
268 }
269 
270 float
272  return rf_bandwidth;
273 }
274 void
276  this->rf_bandwidth = rf_bandwidth;
277  this->m_rf_bandwidth_isSet = true;
278 }
279 
280 qint32
282  return log2_decim;
283 }
284 void
286  this->log2_decim = log2_decim;
287  this->m_log2_decim_isSet = true;
288 }
289 
290 float
292  return squelch;
293 }
294 void
296  this->squelch = squelch;
297  this->m_squelch_isSet = true;
298 }
299 
300 qint32
302  return rgb_color;
303 }
304 void
306  this->rgb_color = rgb_color;
307  this->m_rgb_color_isSet = true;
308 }
309 
310 QString*
312  return title;
313 }
314 void
316  this->title = title;
317  this->m_title_isSet = true;
318 }
319 
320 float
322  return alpha_ema;
323 }
324 void
326  this->alpha_ema = alpha_ema;
327  this->m_alpha_ema_isSet = true;
328 }
329 
330 qint32
332  return tracking;
333 }
334 void
336  this->tracking = tracking;
337  this->m_tracking_isSet = true;
338 }
339 
340 qint32
342  return tracker_type;
343 }
344 void
346  this->tracker_type = tracker_type;
347  this->m_tracker_type_isSet = true;
348 }
349 
350 qint32
352  return pll_psk_order;
353 }
354 void
356  this->pll_psk_order = pll_psk_order;
357  this->m_pll_psk_order_isSet = true;
358 }
359 
360 qint32
362  return rrc;
363 }
364 void
366  this->rrc = rrc;
367  this->m_rrc_isSet = true;
368 }
369 
370 qint32
372  return rrc_rolloff;
373 }
374 void
376  this->rrc_rolloff = rrc_rolloff;
377  this->m_rrc_rolloff_isSet = true;
378 }
379 
380 qint32
382  return squelch_gate;
383 }
384 void
386  this->squelch_gate = squelch_gate;
387  this->m_squelch_gate_isSet = true;
388 }
389 
390 qint32
392  return use_reverse_api;
393 }
394 void
396  this->use_reverse_api = use_reverse_api;
397  this->m_use_reverse_api_isSet = true;
398 }
399 
400 QString*
402  return reverse_api_address;
403 }
404 void
406  this->reverse_api_address = reverse_api_address;
407  this->m_reverse_api_address_isSet = true;
408 }
409 
410 qint32
412  return reverse_api_port;
413 }
414 void
416  this->reverse_api_port = reverse_api_port;
417  this->m_reverse_api_port_isSet = true;
418 }
419 
420 qint32
423 }
424 void
426  this->reverse_api_device_index = reverse_api_device_index;
428 }
429 
430 qint32
433 }
434 void
436  this->reverse_api_channel_index = reverse_api_channel_index;
438 }
439 
440 
441 bool
443  bool isObjectUpdated = false;
444  do{
445  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
446  if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
447  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
448  if(m_squelch_isSet){ isObjectUpdated = true; break;}
449  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
450  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
451  if(m_alpha_ema_isSet){ isObjectUpdated = true; break;}
452  if(m_tracking_isSet){ isObjectUpdated = true; break;}
453  if(m_tracker_type_isSet){ isObjectUpdated = true; break;}
454  if(m_pll_psk_order_isSet){ isObjectUpdated = true; break;}
455  if(m_rrc_isSet){ isObjectUpdated = true; break;}
456  if(m_rrc_rolloff_isSet){ isObjectUpdated = true; break;}
457  if(m_squelch_gate_isSet){ isObjectUpdated = true; break;}
458  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
459  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
460  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
461  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
462  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
463  }while(false);
464  return isObjectUpdated;
465 }
466 }
467 
virtual void fromJsonObject(QJsonObject &json) override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setReverseApiPort(qint32 reverse_api_port)
virtual QJsonObject * asJsonObject() override
virtual SWGFreqTrackerSettings * fromJson(QString &jsonString) override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiAddress(QString *reverse_api_address)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setInputFrequencyOffset(qint64 input_frequency_offset)