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.
SWGNFMModSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGNFMModSettings.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.0f;
38  m_fm_deviation_isSet = false;
39  tone_frequency = 0.0f;
40  m_tone_frequency_isSet = false;
41  volume_factor = 0.0f;
42  m_volume_factor_isSet = false;
43  channel_mute = 0;
44  m_channel_mute_isSet = false;
45  play_loop = 0;
46  m_play_loop_isSet = false;
47  ctcss_on = 0;
48  m_ctcss_on_isSet = false;
49  ctcss_index = 0;
50  m_ctcss_index_isSet = false;
51  rgb_color = 0;
52  m_rgb_color_isSet = false;
53  title = nullptr;
54  m_title_isSet = false;
55  audio_device_name = nullptr;
57  mod_af_input = 0;
58  m_mod_af_input_isSet = false;
59  use_reverse_api = 0;
61  reverse_api_address = nullptr;
63  reverse_api_port = 0;
69  cw_keyer = nullptr;
70  m_cw_keyer_isSet = false;
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.0f;
86  m_fm_deviation_isSet = false;
87  tone_frequency = 0.0f;
88  m_tone_frequency_isSet = false;
89  volume_factor = 0.0f;
90  m_volume_factor_isSet = false;
91  channel_mute = 0;
92  m_channel_mute_isSet = false;
93  play_loop = 0;
94  m_play_loop_isSet = false;
95  ctcss_on = 0;
96  m_ctcss_on_isSet = false;
97  ctcss_index = 0;
98  m_ctcss_index_isSet = false;
99  rgb_color = 0;
100  m_rgb_color_isSet = false;
101  title = new QString("");
102  m_title_isSet = false;
103  audio_device_name = new QString("");
105  mod_af_input = 0;
106  m_mod_af_input_isSet = false;
107  use_reverse_api = 0;
108  m_use_reverse_api_isSet = false;
109  reverse_api_address = new QString("");
111  reverse_api_port = 0;
112  m_reverse_api_port_isSet = false;
118  m_cw_keyer_isSet = false;
119 }
120 
121 void
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134  if(title != nullptr) {
135  delete title;
136  }
137  if(audio_device_name != nullptr) {
138  delete audio_device_name;
139  }
140 
141 
142  if(reverse_api_address != nullptr) {
143  delete reverse_api_address;
144  }
145 
146 
147 
148  if(cw_keyer != nullptr) {
149  delete cw_keyer;
150  }
151 }
152 
155  QByteArray array (json.toStdString().c_str());
156  QJsonDocument doc = QJsonDocument::fromJson(array);
157  QJsonObject jsonObject = doc.object();
158  this->fromJsonObject(jsonObject);
159  return this;
160 }
161 
162 void
164  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
165 
166  ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
167 
168  ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
169 
170  ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", "");
171 
172  ::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
173 
174  ::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
175 
176  ::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", "");
177 
178  ::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
179 
180  ::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", "");
181 
182  ::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
185 
186  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
187 
188  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
189 
190  ::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", "");
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  ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
203 
204 }
205 
206 QString
208 {
209  QJsonObject* obj = this->asJsonObject();
210 
211  QJsonDocument doc(*obj);
212  QByteArray bytes = doc.toJson();
213  delete obj;
214  return QString(bytes);
215 }
216 
217 QJsonObject*
219  QJsonObject* obj = new QJsonObject();
221  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
222  }
224  obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
225  }
227  obj->insert("afBandwidth", QJsonValue(af_bandwidth));
228  }
230  obj->insert("fmDeviation", QJsonValue(fm_deviation));
231  }
233  obj->insert("toneFrequency", QJsonValue(tone_frequency));
234  }
236  obj->insert("volumeFactor", QJsonValue(volume_factor));
237  }
239  obj->insert("channelMute", QJsonValue(channel_mute));
240  }
241  if(m_play_loop_isSet){
242  obj->insert("playLoop", QJsonValue(play_loop));
243  }
244  if(m_ctcss_on_isSet){
245  obj->insert("ctcssOn", QJsonValue(ctcss_on));
246  }
248  obj->insert("ctcssIndex", QJsonValue(ctcss_index));
249  }
250  if(m_rgb_color_isSet){
251  obj->insert("rgbColor", QJsonValue(rgb_color));
252  }
253  if(title != nullptr && *title != QString("")){
254  toJsonValue(QString("title"), title, obj, QString("QString"));
255  }
256  if(audio_device_name != nullptr && *audio_device_name != QString("")){
257  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
258  }
260  obj->insert("modAFInput", QJsonValue(mod_af_input));
261  }
263  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
264  }
265  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
266  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
267  }
269  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
270  }
272  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
273  }
275  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
276  }
277  if((cw_keyer != nullptr) && (cw_keyer->isSet())){
278  toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
279  }
280 
281  return obj;
282 }
283 
284 qint64
286  return input_frequency_offset;
287 }
288 void
290  this->input_frequency_offset = input_frequency_offset;
291  this->m_input_frequency_offset_isSet = true;
292 }
293 
294 float
296  return rf_bandwidth;
297 }
298 void
300  this->rf_bandwidth = rf_bandwidth;
301  this->m_rf_bandwidth_isSet = true;
302 }
303 
304 float
306  return af_bandwidth;
307 }
308 void
310  this->af_bandwidth = af_bandwidth;
311  this->m_af_bandwidth_isSet = true;
312 }
313 
314 float
316  return fm_deviation;
317 }
318 void
320  this->fm_deviation = fm_deviation;
321  this->m_fm_deviation_isSet = true;
322 }
323 
324 float
326  return tone_frequency;
327 }
328 void
330  this->tone_frequency = tone_frequency;
331  this->m_tone_frequency_isSet = true;
332 }
333 
334 float
336  return volume_factor;
337 }
338 void
340  this->volume_factor = volume_factor;
341  this->m_volume_factor_isSet = true;
342 }
343 
344 qint32
346  return channel_mute;
347 }
348 void
350  this->channel_mute = channel_mute;
351  this->m_channel_mute_isSet = true;
352 }
353 
354 qint32
356  return play_loop;
357 }
358 void
360  this->play_loop = play_loop;
361  this->m_play_loop_isSet = true;
362 }
363 
364 qint32
366  return ctcss_on;
367 }
368 void
370  this->ctcss_on = ctcss_on;
371  this->m_ctcss_on_isSet = true;
372 }
373 
374 qint32
376  return ctcss_index;
377 }
378 void
380  this->ctcss_index = ctcss_index;
381  this->m_ctcss_index_isSet = true;
382 }
383 
384 qint32
386  return rgb_color;
387 }
388 void
390  this->rgb_color = rgb_color;
391  this->m_rgb_color_isSet = true;
392 }
393 
394 QString*
396  return title;
397 }
398 void
400  this->title = title;
401  this->m_title_isSet = true;
402 }
403 
404 QString*
406  return audio_device_name;
407 }
408 void
410  this->audio_device_name = audio_device_name;
411  this->m_audio_device_name_isSet = true;
412 }
413 
414 qint32
416  return mod_af_input;
417 }
418 void
420  this->mod_af_input = mod_af_input;
421  this->m_mod_af_input_isSet = true;
422 }
423 
424 qint32
426  return use_reverse_api;
427 }
428 void
430  this->use_reverse_api = use_reverse_api;
431  this->m_use_reverse_api_isSet = true;
432 }
433 
434 QString*
436  return reverse_api_address;
437 }
438 void
440  this->reverse_api_address = reverse_api_address;
441  this->m_reverse_api_address_isSet = true;
442 }
443 
444 qint32
446  return reverse_api_port;
447 }
448 void
450  this->reverse_api_port = reverse_api_port;
451  this->m_reverse_api_port_isSet = true;
452 }
453 
454 qint32
457 }
458 void
460  this->reverse_api_device_index = reverse_api_device_index;
462 }
463 
464 qint32
467 }
468 void
470  this->reverse_api_channel_index = reverse_api_channel_index;
472 }
473 
476  return cw_keyer;
477 }
478 void
480  this->cw_keyer = cw_keyer;
481  this->m_cw_keyer_isSet = true;
482 }
483 
484 
485 bool
487  bool isObjectUpdated = false;
488  do{
489  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
490  if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
491  if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
492  if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
493  if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
494  if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
495  if(m_channel_mute_isSet){ isObjectUpdated = true; break;}
496  if(m_play_loop_isSet){ isObjectUpdated = true; break;}
497  if(m_ctcss_on_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_mod_af_input_isSet){ isObjectUpdated = true; break;}
503  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
504  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
505  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
506  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
507  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
508  if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
509  }while(false);
510  return isObjectUpdated;
511 }
512 }
513 
void setFmDeviation(float fm_deviation)
void setVolumeFactor(float volume_factor)
SWGCWKeyerSettings * getCwKeyer()
void setChannelMute(qint32 channel_mute)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual void fromJsonObject(QJsonObject &json) override
void setRgbColor(qint32 rgb_color)
void setReverseApiAddress(QString *reverse_api_address)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setInputFrequencyOffset(qint64 input_frequency_offset)
virtual SWGNFMModSettings * fromJson(QString &jsonString) override
void setToneFrequency(float tone_frequency)
void setReverseApiPort(qint32 reverse_api_port)
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setCtcssIndex(qint32 ctcss_index)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setUseReverseApi(qint32 use_reverse_api)
void setRfBandwidth(float rf_bandwidth)
virtual QJsonObject * asJsonObject() override
void setAudioDeviceName(QString *audio_device_name)
void setPlayLoop(qint32 play_loop)
void setModAfInput(qint32 mod_af_input)
void setAfBandwidth(float af_bandwidth)
virtual QString asJson() override