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.
SWGBFMDemodSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGBFMDemodSettings.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  volume = 0.0f;
38  m_volume_isSet = false;
39  squelch = 0.0f;
40  m_squelch_isSet = false;
41  audio_stereo = 0;
42  m_audio_stereo_isSet = false;
43  lsb_stereo = 0;
44  m_lsb_stereo_isSet = false;
45  show_pilot = 0;
46  m_show_pilot_isSet = false;
47  rds_active = 0;
48  m_rds_active_isSet = false;
49  rgb_color = 0;
50  m_rgb_color_isSet = false;
51  title = nullptr;
52  m_title_isSet = false;
53  audio_device_name = nullptr;
55  use_reverse_api = 0;
57  reverse_api_address = nullptr;
59  reverse_api_port = 0;
65 }
66 
68  this->cleanup();
69 }
70 
71 void
75  rf_bandwidth = 0.0f;
76  m_rf_bandwidth_isSet = false;
77  af_bandwidth = 0.0f;
78  m_af_bandwidth_isSet = false;
79  volume = 0.0f;
80  m_volume_isSet = false;
81  squelch = 0.0f;
82  m_squelch_isSet = false;
83  audio_stereo = 0;
84  m_audio_stereo_isSet = false;
85  lsb_stereo = 0;
86  m_lsb_stereo_isSet = false;
87  show_pilot = 0;
88  m_show_pilot_isSet = false;
89  rds_active = 0;
90  m_rds_active_isSet = false;
91  rgb_color = 0;
92  m_rgb_color_isSet = false;
93  title = new QString("");
94  m_title_isSet = false;
95  audio_device_name = new QString("");
97  use_reverse_api = 0;
99  reverse_api_address = new QString("");
101  reverse_api_port = 0;
102  m_reverse_api_port_isSet = false;
107 }
108 
109 void
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121  if(title != nullptr) {
122  delete title;
123  }
124  if(audio_device_name != nullptr) {
125  delete audio_device_name;
126  }
127 
128  if(reverse_api_address != nullptr) {
129  delete reverse_api_address;
130  }
131 
132 
133 
134 }
135 
138  QByteArray array (json.toStdString().c_str());
139  QJsonDocument doc = QJsonDocument::fromJson(array);
140  QJsonObject jsonObject = doc.object();
141  this->fromJsonObject(jsonObject);
142  return this;
143 }
144 
145 void
147  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
148 
149  ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
150 
151  ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
152 
153  ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
154 
155  ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", "");
156 
157  ::SWGSDRangel::setValue(&audio_stereo, pJson["audioStereo"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&lsb_stereo, pJson["lsbStereo"], "qint32", "");
160 
161  ::SWGSDRangel::setValue(&show_pilot, pJson["showPilot"], "qint32", "");
162 
163  ::SWGSDRangel::setValue(&rds_active, pJson["rdsActive"], "qint32", "");
164 
165  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
166 
167  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
168 
169  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
170 
171  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
172 
173  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
174 
175  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
176 
177  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
178 
179  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
180 
181 }
182 
183 QString
185 {
186  QJsonObject* obj = this->asJsonObject();
187 
188  QJsonDocument doc(*obj);
189  QByteArray bytes = doc.toJson();
190  delete obj;
191  return QString(bytes);
192 }
193 
194 QJsonObject*
196  QJsonObject* obj = new QJsonObject();
198  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
199  }
201  obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
202  }
204  obj->insert("afBandwidth", QJsonValue(af_bandwidth));
205  }
206  if(m_volume_isSet){
207  obj->insert("volume", QJsonValue(volume));
208  }
209  if(m_squelch_isSet){
210  obj->insert("squelch", QJsonValue(squelch));
211  }
213  obj->insert("audioStereo", QJsonValue(audio_stereo));
214  }
215  if(m_lsb_stereo_isSet){
216  obj->insert("lsbStereo", QJsonValue(lsb_stereo));
217  }
218  if(m_show_pilot_isSet){
219  obj->insert("showPilot", QJsonValue(show_pilot));
220  }
221  if(m_rds_active_isSet){
222  obj->insert("rdsActive", QJsonValue(rds_active));
223  }
224  if(m_rgb_color_isSet){
225  obj->insert("rgbColor", QJsonValue(rgb_color));
226  }
227  if(title != nullptr && *title != QString("")){
228  toJsonValue(QString("title"), title, obj, QString("QString"));
229  }
230  if(audio_device_name != nullptr && *audio_device_name != QString("")){
231  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
232  }
234  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
235  }
236  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
237  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
238  }
240  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
241  }
243  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
244  }
246  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
247  }
248 
249  return obj;
250 }
251 
252 qint64
254  return input_frequency_offset;
255 }
256 void
258  this->input_frequency_offset = input_frequency_offset;
259  this->m_input_frequency_offset_isSet = true;
260 }
261 
262 float
264  return rf_bandwidth;
265 }
266 void
268  this->rf_bandwidth = rf_bandwidth;
269  this->m_rf_bandwidth_isSet = true;
270 }
271 
272 float
274  return af_bandwidth;
275 }
276 void
278  this->af_bandwidth = af_bandwidth;
279  this->m_af_bandwidth_isSet = true;
280 }
281 
282 float
284  return volume;
285 }
286 void
288  this->volume = volume;
289  this->m_volume_isSet = true;
290 }
291 
292 float
294  return squelch;
295 }
296 void
298  this->squelch = squelch;
299  this->m_squelch_isSet = true;
300 }
301 
302 qint32
304  return audio_stereo;
305 }
306 void
308  this->audio_stereo = audio_stereo;
309  this->m_audio_stereo_isSet = true;
310 }
311 
312 qint32
314  return lsb_stereo;
315 }
316 void
318  this->lsb_stereo = lsb_stereo;
319  this->m_lsb_stereo_isSet = true;
320 }
321 
322 qint32
324  return show_pilot;
325 }
326 void
328  this->show_pilot = show_pilot;
329  this->m_show_pilot_isSet = true;
330 }
331 
332 qint32
334  return rds_active;
335 }
336 void
338  this->rds_active = rds_active;
339  this->m_rds_active_isSet = true;
340 }
341 
342 qint32
344  return rgb_color;
345 }
346 void
348  this->rgb_color = rgb_color;
349  this->m_rgb_color_isSet = true;
350 }
351 
352 QString*
354  return title;
355 }
356 void
358  this->title = title;
359  this->m_title_isSet = true;
360 }
361 
362 QString*
364  return audio_device_name;
365 }
366 void
368  this->audio_device_name = audio_device_name;
369  this->m_audio_device_name_isSet = true;
370 }
371 
372 qint32
374  return use_reverse_api;
375 }
376 void
378  this->use_reverse_api = use_reverse_api;
379  this->m_use_reverse_api_isSet = true;
380 }
381 
382 QString*
384  return reverse_api_address;
385 }
386 void
388  this->reverse_api_address = reverse_api_address;
389  this->m_reverse_api_address_isSet = true;
390 }
391 
392 qint32
394  return reverse_api_port;
395 }
396 void
398  this->reverse_api_port = reverse_api_port;
399  this->m_reverse_api_port_isSet = true;
400 }
401 
402 qint32
405 }
406 void
408  this->reverse_api_device_index = reverse_api_device_index;
410 }
411 
412 qint32
415 }
416 void
418  this->reverse_api_channel_index = reverse_api_channel_index;
420 }
421 
422 
423 bool
425  bool isObjectUpdated = false;
426  do{
427  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
428  if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
429  if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
430  if(m_volume_isSet){ isObjectUpdated = true; break;}
431  if(m_squelch_isSet){ isObjectUpdated = true; break;}
432  if(m_audio_stereo_isSet){ isObjectUpdated = true; break;}
433  if(m_lsb_stereo_isSet){ isObjectUpdated = true; break;}
434  if(m_show_pilot_isSet){ isObjectUpdated = true; break;}
435  if(m_rds_active_isSet){ isObjectUpdated = true; break;}
436  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
437  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
438  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
439  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
440  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
441  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
442  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
443  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
444  }while(false);
445  return isObjectUpdated;
446 }
447 }
448 
virtual QJsonObject * asJsonObject() override
void setReverseApiPort(qint32 reverse_api_port)
void setUseReverseApi(qint32 use_reverse_api)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual void fromJsonObject(QJsonObject &json) override
void setAudioDeviceName(QString *audio_device_name)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual QString asJson() override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiAddress(QString *reverse_api_address)
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setAudioStereo(qint32 audio_stereo)
virtual SWGBFMDemodSettings * fromJson(QString &jsonString) override
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setAfBandwidth(float af_bandwidth)
void setRfBandwidth(float rf_bandwidth)