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.
SWGNFMDemodSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGNFMDemodSettings.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  af_bandwidth = 0.0f;
36  m_af_bandwidth_isSet = false;
37  fm_deviation = 0;
38  m_fm_deviation_isSet = false;
39  squelch_gate = 0;
40  m_squelch_gate_isSet = false;
41  delta_squelch = 0;
42  m_delta_squelch_isSet = false;
43  squelch = 0.0f;
44  m_squelch_isSet = false;
45  volume = 0.0f;
46  m_volume_isSet = false;
47  ctcss_on = 0;
48  m_ctcss_on_isSet = false;
49  high_pass = 0;
50  m_high_pass_isSet = false;
51  audio_mute = 0;
52  m_audio_mute_isSet = false;
53  ctcss_index = 0;
54  m_ctcss_index_isSet = false;
55  rgb_color = 0;
56  m_rgb_color_isSet = false;
57  title = nullptr;
58  m_title_isSet = false;
59  audio_device_name = nullptr;
61  use_reverse_api = 0;
63  reverse_api_address = nullptr;
65  reverse_api_port = 0;
71 }
72 
74  this->cleanup();
75 }
76 
77 void
81  rf_bandwidth = 0.0f;
82  m_rf_bandwidth_isSet = false;
83  af_bandwidth = 0.0f;
84  m_af_bandwidth_isSet = false;
85  fm_deviation = 0;
86  m_fm_deviation_isSet = false;
87  squelch_gate = 0;
88  m_squelch_gate_isSet = false;
89  delta_squelch = 0;
90  m_delta_squelch_isSet = false;
91  squelch = 0.0f;
92  m_squelch_isSet = false;
93  volume = 0.0f;
94  m_volume_isSet = false;
95  ctcss_on = 0;
96  m_ctcss_on_isSet = false;
97  high_pass = 0;
98  m_high_pass_isSet = false;
99  audio_mute = 0;
100  m_audio_mute_isSet = false;
101  ctcss_index = 0;
102  m_ctcss_index_isSet = false;
103  rgb_color = 0;
104  m_rgb_color_isSet = false;
105  title = new QString("");
106  m_title_isSet = false;
107  audio_device_name = new QString("");
109  use_reverse_api = 0;
110  m_use_reverse_api_isSet = false;
111  reverse_api_address = new QString("");
113  reverse_api_port = 0;
114  m_reverse_api_port_isSet = false;
119 }
120 
121 void
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136  if(title != nullptr) {
137  delete title;
138  }
139  if(audio_device_name != nullptr) {
140  delete audio_device_name;
141  }
142 
143  if(reverse_api_address != nullptr) {
144  delete reverse_api_address;
145  }
146 
147 
148 
149 }
150 
153  QByteArray array (json.toStdString().c_str());
154  QJsonDocument doc = QJsonDocument::fromJson(array);
155  QJsonObject jsonObject = doc.object();
156  this->fromJsonObject(jsonObject);
157  return this;
158 }
159 
160 void
162  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
163 
164  ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
165 
166  ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
167 
168  ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&delta_squelch, pJson["deltaSquelch"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", "");
175 
176  ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
177 
178  ::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", "");
179 
180  ::SWGSDRangel::setValue(&high_pass, pJson["highPass"], "qint32", "");
181 
182  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", "");
185 
186  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
187 
188  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
189 
190  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
191 
192  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
193 
194  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
195 
196  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
197 
198  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
199 
200  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
201 
202 }
203 
204 QString
206 {
207  QJsonObject* obj = this->asJsonObject();
208 
209  QJsonDocument doc(*obj);
210  QByteArray bytes = doc.toJson();
211  delete obj;
212  return QString(bytes);
213 }
214 
215 QJsonObject*
217  QJsonObject* obj = new QJsonObject();
219  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
220  }
222  obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
223  }
225  obj->insert("afBandwidth", QJsonValue(af_bandwidth));
226  }
228  obj->insert("fmDeviation", QJsonValue(fm_deviation));
229  }
231  obj->insert("squelchGate", QJsonValue(squelch_gate));
232  }
234  obj->insert("deltaSquelch", QJsonValue(delta_squelch));
235  }
236  if(m_squelch_isSet){
237  obj->insert("squelch", QJsonValue(squelch));
238  }
239  if(m_volume_isSet){
240  obj->insert("volume", QJsonValue(volume));
241  }
242  if(m_ctcss_on_isSet){
243  obj->insert("ctcssOn", QJsonValue(ctcss_on));
244  }
245  if(m_high_pass_isSet){
246  obj->insert("highPass", QJsonValue(high_pass));
247  }
248  if(m_audio_mute_isSet){
249  obj->insert("audioMute", QJsonValue(audio_mute));
250  }
252  obj->insert("ctcssIndex", QJsonValue(ctcss_index));
253  }
254  if(m_rgb_color_isSet){
255  obj->insert("rgbColor", QJsonValue(rgb_color));
256  }
257  if(title != nullptr && *title != QString("")){
258  toJsonValue(QString("title"), title, obj, QString("QString"));
259  }
260  if(audio_device_name != nullptr && *audio_device_name != QString("")){
261  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
262  }
264  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
265  }
266  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
267  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
268  }
270  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
271  }
273  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
274  }
276  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
277  }
278 
279  return obj;
280 }
281 
282 qint64
284  return input_frequency_offset;
285 }
286 void
288  this->input_frequency_offset = input_frequency_offset;
289  this->m_input_frequency_offset_isSet = true;
290 }
291 
292 float
294  return rf_bandwidth;
295 }
296 void
298  this->rf_bandwidth = rf_bandwidth;
299  this->m_rf_bandwidth_isSet = true;
300 }
301 
302 float
304  return af_bandwidth;
305 }
306 void
308  this->af_bandwidth = af_bandwidth;
309  this->m_af_bandwidth_isSet = true;
310 }
311 
312 qint32
314  return fm_deviation;
315 }
316 void
318  this->fm_deviation = fm_deviation;
319  this->m_fm_deviation_isSet = true;
320 }
321 
322 qint32
324  return squelch_gate;
325 }
326 void
328  this->squelch_gate = squelch_gate;
329  this->m_squelch_gate_isSet = true;
330 }
331 
332 qint32
334  return delta_squelch;
335 }
336 void
338  this->delta_squelch = delta_squelch;
339  this->m_delta_squelch_isSet = true;
340 }
341 
342 float
344  return squelch;
345 }
346 void
348  this->squelch = squelch;
349  this->m_squelch_isSet = true;
350 }
351 
352 float
354  return volume;
355 }
356 void
358  this->volume = volume;
359  this->m_volume_isSet = true;
360 }
361 
362 qint32
364  return ctcss_on;
365 }
366 void
368  this->ctcss_on = ctcss_on;
369  this->m_ctcss_on_isSet = true;
370 }
371 
372 qint32
374  return high_pass;
375 }
376 void
378  this->high_pass = high_pass;
379  this->m_high_pass_isSet = true;
380 }
381 
382 qint32
384  return audio_mute;
385 }
386 void
388  this->audio_mute = audio_mute;
389  this->m_audio_mute_isSet = true;
390 }
391 
392 qint32
394  return ctcss_index;
395 }
396 void
398  this->ctcss_index = ctcss_index;
399  this->m_ctcss_index_isSet = true;
400 }
401 
402 qint32
404  return rgb_color;
405 }
406 void
408  this->rgb_color = rgb_color;
409  this->m_rgb_color_isSet = true;
410 }
411 
412 QString*
414  return title;
415 }
416 void
418  this->title = title;
419  this->m_title_isSet = true;
420 }
421 
422 QString*
424  return audio_device_name;
425 }
426 void
428  this->audio_device_name = audio_device_name;
429  this->m_audio_device_name_isSet = true;
430 }
431 
432 qint32
434  return use_reverse_api;
435 }
436 void
438  this->use_reverse_api = use_reverse_api;
439  this->m_use_reverse_api_isSet = true;
440 }
441 
442 QString*
444  return reverse_api_address;
445 }
446 void
448  this->reverse_api_address = reverse_api_address;
449  this->m_reverse_api_address_isSet = true;
450 }
451 
452 qint32
454  return reverse_api_port;
455 }
456 void
458  this->reverse_api_port = reverse_api_port;
459  this->m_reverse_api_port_isSet = true;
460 }
461 
462 qint32
465 }
466 void
468  this->reverse_api_device_index = reverse_api_device_index;
470 }
471 
472 qint32
475 }
476 void
478  this->reverse_api_channel_index = reverse_api_channel_index;
480 }
481 
482 
483 bool
485  bool isObjectUpdated = false;
486  do{
487  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
488  if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
489  if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
490  if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
491  if(m_squelch_gate_isSet){ isObjectUpdated = true; break;}
492  if(m_delta_squelch_isSet){ isObjectUpdated = true; break;}
493  if(m_squelch_isSet){ isObjectUpdated = true; break;}
494  if(m_volume_isSet){ isObjectUpdated = true; break;}
495  if(m_ctcss_on_isSet){ isObjectUpdated = true; break;}
496  if(m_high_pass_isSet){ isObjectUpdated = true; break;}
497  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
498  if(m_ctcss_index_isSet){ isObjectUpdated = true; break;}
499  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
500  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
501  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
502  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
503  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
504  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
505  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
506  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
507  }while(false);
508  return isObjectUpdated;
509 }
510 }
511 
virtual QString asJson() override
virtual void fromJsonObject(QJsonObject &json) override
void setUseReverseApi(qint32 use_reverse_api)
void setAfBandwidth(float af_bandwidth)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual QJsonObject * asJsonObject() override
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setSquelchGate(qint32 squelch_gate)
virtual SWGNFMDemodSettings * fromJson(QString &jsonString) override
void setDeltaSquelch(qint32 delta_squelch)
void setReverseApiAddress(QString *reverse_api_address)
void setRfBandwidth(float rf_bandwidth)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setAudioDeviceName(QString *audio_device_name)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setCtcssIndex(qint32 ctcss_index)
void setReverseApiPort(qint32 reverse_api_port)
void setFmDeviation(qint32 fm_deviation)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)