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.
SWGSSBModSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGSSBModSettings.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  bandwidth = 0.0f;
34  m_bandwidth_isSet = false;
35  low_cutoff = 0.0f;
36  m_low_cutoff_isSet = false;
37  usb = 0;
38  m_usb_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  span_log2 = 0;
44  m_span_log2_isSet = false;
45  audio_binaural = 0;
46  m_audio_binaural_isSet = false;
49  dsb = 0;
50  m_dsb_isSet = false;
51  audio_mute = 0;
52  m_audio_mute_isSet = false;
53  play_loop = 0;
54  m_play_loop_isSet = false;
55  agc = 0;
56  m_agc_isSet = false;
57  rgb_color = 0;
58  m_rgb_color_isSet = false;
59  title = nullptr;
60  m_title_isSet = false;
61  audio_device_name = nullptr;
63  mod_af_input = 0;
64  m_mod_af_input_isSet = false;
65  use_reverse_api = 0;
67  reverse_api_address = nullptr;
69  reverse_api_port = 0;
75  cw_keyer = nullptr;
76  m_cw_keyer_isSet = false;
77 }
78 
80  this->cleanup();
81 }
82 
83 void
87  bandwidth = 0.0f;
88  m_bandwidth_isSet = false;
89  low_cutoff = 0.0f;
90  m_low_cutoff_isSet = false;
91  usb = 0;
92  m_usb_isSet = false;
93  tone_frequency = 0.0f;
94  m_tone_frequency_isSet = false;
95  volume_factor = 0.0f;
96  m_volume_factor_isSet = false;
97  span_log2 = 0;
98  m_span_log2_isSet = false;
99  audio_binaural = 0;
100  m_audio_binaural_isSet = false;
103  dsb = 0;
104  m_dsb_isSet = false;
105  audio_mute = 0;
106  m_audio_mute_isSet = false;
107  play_loop = 0;
108  m_play_loop_isSet = false;
109  agc = 0;
110  m_agc_isSet = false;
111  rgb_color = 0;
112  m_rgb_color_isSet = false;
113  title = new QString("");
114  m_title_isSet = false;
115  audio_device_name = new QString("");
117  mod_af_input = 0;
118  m_mod_af_input_isSet = false;
119  use_reverse_api = 0;
120  m_use_reverse_api_isSet = false;
121  reverse_api_address = new QString("");
123  reverse_api_port = 0;
124  m_reverse_api_port_isSet = false;
130  m_cw_keyer_isSet = false;
131 }
132 
133 void
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149  if(title != nullptr) {
150  delete title;
151  }
152  if(audio_device_name != nullptr) {
153  delete audio_device_name;
154  }
155 
156 
157  if(reverse_api_address != nullptr) {
158  delete reverse_api_address;
159  }
160 
161 
162 
163  if(cw_keyer != nullptr) {
164  delete cw_keyer;
165  }
166 }
167 
170  QByteArray array (json.toStdString().c_str());
171  QJsonDocument doc = QJsonDocument::fromJson(array);
172  QJsonObject jsonObject = doc.object();
173  this->fromJsonObject(jsonObject);
174  return this;
175 }
176 
177 void
179  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
180 
181  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "float", "");
182 
183  ::SWGSDRangel::setValue(&low_cutoff, pJson["lowCutoff"], "float", "");
184 
185  ::SWGSDRangel::setValue(&usb, pJson["usb"], "qint32", "");
186 
187  ::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
188 
189  ::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
190 
191  ::SWGSDRangel::setValue(&span_log2, pJson["spanLog2"], "qint32", "");
192 
193  ::SWGSDRangel::setValue(&audio_binaural, pJson["audioBinaural"], "qint32", "");
194 
195  ::SWGSDRangel::setValue(&audio_flip_channels, pJson["audioFlipChannels"], "qint32", "");
196 
197  ::SWGSDRangel::setValue(&dsb, pJson["dsb"], "qint32", "");
198 
199  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
200 
201  ::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
202 
203  ::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", "");
204 
205  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
206 
207  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
208 
209  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
210 
211  ::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", "");
212 
213  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
214 
215  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
216 
217  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
218 
219  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
220 
221  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
222 
223  ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
224 
225 }
226 
227 QString
229 {
230  QJsonObject* obj = this->asJsonObject();
231 
232  QJsonDocument doc(*obj);
233  QByteArray bytes = doc.toJson();
234  delete obj;
235  return QString(bytes);
236 }
237 
238 QJsonObject*
240  QJsonObject* obj = new QJsonObject();
242  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
243  }
244  if(m_bandwidth_isSet){
245  obj->insert("bandwidth", QJsonValue(bandwidth));
246  }
247  if(m_low_cutoff_isSet){
248  obj->insert("lowCutoff", QJsonValue(low_cutoff));
249  }
250  if(m_usb_isSet){
251  obj->insert("usb", QJsonValue(usb));
252  }
254  obj->insert("toneFrequency", QJsonValue(tone_frequency));
255  }
257  obj->insert("volumeFactor", QJsonValue(volume_factor));
258  }
259  if(m_span_log2_isSet){
260  obj->insert("spanLog2", QJsonValue(span_log2));
261  }
263  obj->insert("audioBinaural", QJsonValue(audio_binaural));
264  }
266  obj->insert("audioFlipChannels", QJsonValue(audio_flip_channels));
267  }
268  if(m_dsb_isSet){
269  obj->insert("dsb", QJsonValue(dsb));
270  }
271  if(m_audio_mute_isSet){
272  obj->insert("audioMute", QJsonValue(audio_mute));
273  }
274  if(m_play_loop_isSet){
275  obj->insert("playLoop", QJsonValue(play_loop));
276  }
277  if(m_agc_isSet){
278  obj->insert("agc", QJsonValue(agc));
279  }
280  if(m_rgb_color_isSet){
281  obj->insert("rgbColor", QJsonValue(rgb_color));
282  }
283  if(title != nullptr && *title != QString("")){
284  toJsonValue(QString("title"), title, obj, QString("QString"));
285  }
286  if(audio_device_name != nullptr && *audio_device_name != QString("")){
287  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
288  }
290  obj->insert("modAFInput", QJsonValue(mod_af_input));
291  }
293  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
294  }
295  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
296  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
297  }
299  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
300  }
302  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
303  }
305  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
306  }
307  if((cw_keyer != nullptr) && (cw_keyer->isSet())){
308  toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
309  }
310 
311  return obj;
312 }
313 
314 qint64
316  return input_frequency_offset;
317 }
318 void
320  this->input_frequency_offset = input_frequency_offset;
321  this->m_input_frequency_offset_isSet = true;
322 }
323 
324 float
326  return bandwidth;
327 }
328 void
330  this->bandwidth = bandwidth;
331  this->m_bandwidth_isSet = true;
332 }
333 
334 float
336  return low_cutoff;
337 }
338 void
340  this->low_cutoff = low_cutoff;
341  this->m_low_cutoff_isSet = true;
342 }
343 
344 qint32
346  return usb;
347 }
348 void
350  this->usb = usb;
351  this->m_usb_isSet = true;
352 }
353 
354 float
356  return tone_frequency;
357 }
358 void
360  this->tone_frequency = tone_frequency;
361  this->m_tone_frequency_isSet = true;
362 }
363 
364 float
366  return volume_factor;
367 }
368 void
370  this->volume_factor = volume_factor;
371  this->m_volume_factor_isSet = true;
372 }
373 
374 qint32
376  return span_log2;
377 }
378 void
380  this->span_log2 = span_log2;
381  this->m_span_log2_isSet = true;
382 }
383 
384 qint32
386  return audio_binaural;
387 }
388 void
390  this->audio_binaural = audio_binaural;
391  this->m_audio_binaural_isSet = true;
392 }
393 
394 qint32
396  return audio_flip_channels;
397 }
398 void
400  this->audio_flip_channels = audio_flip_channels;
401  this->m_audio_flip_channels_isSet = true;
402 }
403 
404 qint32
406  return dsb;
407 }
408 void
410  this->dsb = dsb;
411  this->m_dsb_isSet = true;
412 }
413 
414 qint32
416  return audio_mute;
417 }
418 void
420  this->audio_mute = audio_mute;
421  this->m_audio_mute_isSet = true;
422 }
423 
424 qint32
426  return play_loop;
427 }
428 void
430  this->play_loop = play_loop;
431  this->m_play_loop_isSet = true;
432 }
433 
434 qint32
436  return agc;
437 }
438 void
440  this->agc = agc;
441  this->m_agc_isSet = true;
442 }
443 
444 qint32
446  return rgb_color;
447 }
448 void
450  this->rgb_color = rgb_color;
451  this->m_rgb_color_isSet = true;
452 }
453 
454 QString*
456  return title;
457 }
458 void
460  this->title = title;
461  this->m_title_isSet = true;
462 }
463 
464 QString*
466  return audio_device_name;
467 }
468 void
470  this->audio_device_name = audio_device_name;
471  this->m_audio_device_name_isSet = true;
472 }
473 
474 qint32
476  return mod_af_input;
477 }
478 void
480  this->mod_af_input = mod_af_input;
481  this->m_mod_af_input_isSet = true;
482 }
483 
484 qint32
486  return use_reverse_api;
487 }
488 void
490  this->use_reverse_api = use_reverse_api;
491  this->m_use_reverse_api_isSet = true;
492 }
493 
494 QString*
496  return reverse_api_address;
497 }
498 void
500  this->reverse_api_address = reverse_api_address;
501  this->m_reverse_api_address_isSet = true;
502 }
503 
504 qint32
506  return reverse_api_port;
507 }
508 void
510  this->reverse_api_port = reverse_api_port;
511  this->m_reverse_api_port_isSet = true;
512 }
513 
514 qint32
517 }
518 void
520  this->reverse_api_device_index = reverse_api_device_index;
522 }
523 
524 qint32
527 }
528 void
530  this->reverse_api_channel_index = reverse_api_channel_index;
532 }
533 
536  return cw_keyer;
537 }
538 void
540  this->cw_keyer = cw_keyer;
541  this->m_cw_keyer_isSet = true;
542 }
543 
544 
545 bool
547  bool isObjectUpdated = false;
548  do{
549  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
550  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
551  if(m_low_cutoff_isSet){ isObjectUpdated = true; break;}
552  if(m_usb_isSet){ isObjectUpdated = true; break;}
553  if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
554  if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
555  if(m_span_log2_isSet){ isObjectUpdated = true; break;}
556  if(m_audio_binaural_isSet){ isObjectUpdated = true; break;}
557  if(m_audio_flip_channels_isSet){ isObjectUpdated = true; break;}
558  if(m_dsb_isSet){ isObjectUpdated = true; break;}
559  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
560  if(m_play_loop_isSet){ isObjectUpdated = true; break;}
561  if(m_agc_isSet){ isObjectUpdated = true; break;}
562  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
563  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
564  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
565  if(m_mod_af_input_isSet){ isObjectUpdated = true; break;}
566  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
567  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
568  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
569  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
570  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
571  if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
572  }while(false);
573  return isObjectUpdated;
574 }
575 }
576 
void setReverseApiAddress(QString *reverse_api_address)
void setSpanLog2(qint32 span_log2)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setAudioBinaural(qint32 audio_binaural)
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setToneFrequency(float tone_frequency)
void setVolumeFactor(float volume_factor)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual QJsonObject * asJsonObject() override
SWGCWKeyerSettings * getCwKeyer()
virtual QString asJson() override
void setAudioDeviceName(QString *audio_device_name)
void setUseReverseApi(qint32 use_reverse_api)
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setLowCutoff(float low_cutoff)
void setRgbColor(qint32 rgb_color)
void setPlayLoop(qint32 play_loop)
void setAudioMute(qint32 audio_mute)
void setReverseApiPort(qint32 reverse_api_port)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setAudioFlipChannels(qint32 audio_flip_channels)
virtual void fromJsonObject(QJsonObject &json) override
void setModAfInput(qint32 mod_af_input)
virtual SWGSSBModSettings * fromJson(QString &jsonString) override
void setBandwidth(float bandwidth)