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.
SWGDSDDemodSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGDSDDemodSettings.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  fm_deviation = 0.0f;
36  m_fm_deviation_isSet = false;
37  demod_gain = 0.0f;
38  m_demod_gain_isSet = false;
39  volume = 0.0f;
40  m_volume_isSet = false;
41  baud_rate = 0;
42  m_baud_rate_isSet = false;
43  squelch_gate = 0;
44  m_squelch_gate_isSet = false;
45  squelch = 0.0f;
46  m_squelch_isSet = false;
47  audio_mute = 0;
48  m_audio_mute_isSet = false;
53  slot1_on = 0;
54  m_slot1_on_isSet = false;
55  slot2_on = 0;
56  m_slot2_on_isSet = false;
57  tdma_stereo = 0;
58  m_tdma_stereo_isSet = false;
59  pll_lock = 0;
60  m_pll_lock_isSet = false;
61  rgb_color = 0;
62  m_rgb_color_isSet = false;
63  title = nullptr;
64  m_title_isSet = false;
65  audio_device_name = nullptr;
67  high_pass_filter = 0;
71  trace_stroke = 0;
72  m_trace_stroke_isSet = false;
73  trace_decay = 0;
74  m_trace_decay_isSet = false;
75  use_reverse_api = 0;
77  reverse_api_address = nullptr;
79  reverse_api_port = 0;
85 }
86 
88  this->cleanup();
89 }
90 
91 void
95  rf_bandwidth = 0.0f;
96  m_rf_bandwidth_isSet = false;
97  fm_deviation = 0.0f;
98  m_fm_deviation_isSet = false;
99  demod_gain = 0.0f;
100  m_demod_gain_isSet = false;
101  volume = 0.0f;
102  m_volume_isSet = false;
103  baud_rate = 0;
104  m_baud_rate_isSet = false;
105  squelch_gate = 0;
106  m_squelch_gate_isSet = false;
107  squelch = 0.0f;
108  m_squelch_isSet = false;
109  audio_mute = 0;
110  m_audio_mute_isSet = false;
115  slot1_on = 0;
116  m_slot1_on_isSet = false;
117  slot2_on = 0;
118  m_slot2_on_isSet = false;
119  tdma_stereo = 0;
120  m_tdma_stereo_isSet = false;
121  pll_lock = 0;
122  m_pll_lock_isSet = false;
123  rgb_color = 0;
124  m_rgb_color_isSet = false;
125  title = new QString("");
126  m_title_isSet = false;
127  audio_device_name = new QString("");
129  high_pass_filter = 0;
130  m_high_pass_filter_isSet = false;
133  trace_stroke = 0;
134  m_trace_stroke_isSet = false;
135  trace_decay = 0;
136  m_trace_decay_isSet = false;
137  use_reverse_api = 0;
138  m_use_reverse_api_isSet = false;
139  reverse_api_address = new QString("");
141  reverse_api_port = 0;
142  m_reverse_api_port_isSet = false;
147 }
148 
149 void
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165 
166 
167  if(title != nullptr) {
168  delete title;
169  }
170  if(audio_device_name != nullptr) {
171  delete audio_device_name;
172  }
173 
174 
175 
176 
177 
178  if(reverse_api_address != nullptr) {
179  delete reverse_api_address;
180  }
181 
182 
183 
184 }
185 
188  QByteArray array (json.toStdString().c_str());
189  QJsonDocument doc = QJsonDocument::fromJson(array);
190  QJsonObject jsonObject = doc.object();
191  this->fromJsonObject(jsonObject);
192  return this;
193 }
194 
195 void
197  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
198 
199  ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
200 
201  ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", "");
202 
203  ::SWGSDRangel::setValue(&demod_gain, pJson["demodGain"], "float", "");
204 
205  ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
206 
207  ::SWGSDRangel::setValue(&baud_rate, pJson["baudRate"], "qint32", "");
208 
209  ::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "qint32", "");
210 
211  ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", "");
212 
213  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
214 
215  ::SWGSDRangel::setValue(&enable_cosine_filtering, pJson["enableCosineFiltering"], "qint32", "");
216 
217  ::SWGSDRangel::setValue(&sync_or_constellation, pJson["syncOrConstellation"], "qint32", "");
218 
219  ::SWGSDRangel::setValue(&slot1_on, pJson["slot1On"], "qint32", "");
220 
221  ::SWGSDRangel::setValue(&slot2_on, pJson["slot2On"], "qint32", "");
222 
223  ::SWGSDRangel::setValue(&tdma_stereo, pJson["tdmaStereo"], "qint32", "");
224 
225  ::SWGSDRangel::setValue(&pll_lock, pJson["pllLock"], "qint32", "");
226 
227  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
228 
229  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
230 
231  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
232 
233  ::SWGSDRangel::setValue(&high_pass_filter, pJson["highPassFilter"], "qint32", "");
234 
235  ::SWGSDRangel::setValue(&trace_length_mutliplier, pJson["traceLengthMutliplier"], "qint32", "");
236 
237  ::SWGSDRangel::setValue(&trace_stroke, pJson["traceStroke"], "qint32", "");
238 
239  ::SWGSDRangel::setValue(&trace_decay, pJson["traceDecay"], "qint32", "");
240 
241  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
242 
243  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
244 
245  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
246 
247  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
248 
249  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
250 
251 }
252 
253 QString
255 {
256  QJsonObject* obj = this->asJsonObject();
257 
258  QJsonDocument doc(*obj);
259  QByteArray bytes = doc.toJson();
260  delete obj;
261  return QString(bytes);
262 }
263 
264 QJsonObject*
266  QJsonObject* obj = new QJsonObject();
268  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
269  }
271  obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
272  }
274  obj->insert("fmDeviation", QJsonValue(fm_deviation));
275  }
276  if(m_demod_gain_isSet){
277  obj->insert("demodGain", QJsonValue(demod_gain));
278  }
279  if(m_volume_isSet){
280  obj->insert("volume", QJsonValue(volume));
281  }
282  if(m_baud_rate_isSet){
283  obj->insert("baudRate", QJsonValue(baud_rate));
284  }
286  obj->insert("squelchGate", QJsonValue(squelch_gate));
287  }
288  if(m_squelch_isSet){
289  obj->insert("squelch", QJsonValue(squelch));
290  }
291  if(m_audio_mute_isSet){
292  obj->insert("audioMute", QJsonValue(audio_mute));
293  }
295  obj->insert("enableCosineFiltering", QJsonValue(enable_cosine_filtering));
296  }
298  obj->insert("syncOrConstellation", QJsonValue(sync_or_constellation));
299  }
300  if(m_slot1_on_isSet){
301  obj->insert("slot1On", QJsonValue(slot1_on));
302  }
303  if(m_slot2_on_isSet){
304  obj->insert("slot2On", QJsonValue(slot2_on));
305  }
307  obj->insert("tdmaStereo", QJsonValue(tdma_stereo));
308  }
309  if(m_pll_lock_isSet){
310  obj->insert("pllLock", QJsonValue(pll_lock));
311  }
312  if(m_rgb_color_isSet){
313  obj->insert("rgbColor", QJsonValue(rgb_color));
314  }
315  if(title != nullptr && *title != QString("")){
316  toJsonValue(QString("title"), title, obj, QString("QString"));
317  }
318  if(audio_device_name != nullptr && *audio_device_name != QString("")){
319  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
320  }
322  obj->insert("highPassFilter", QJsonValue(high_pass_filter));
323  }
325  obj->insert("traceLengthMutliplier", QJsonValue(trace_length_mutliplier));
326  }
328  obj->insert("traceStroke", QJsonValue(trace_stroke));
329  }
331  obj->insert("traceDecay", QJsonValue(trace_decay));
332  }
334  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
335  }
336  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
337  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
338  }
340  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
341  }
343  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
344  }
346  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
347  }
348 
349  return obj;
350 }
351 
352 qint64
354  return input_frequency_offset;
355 }
356 void
358  this->input_frequency_offset = input_frequency_offset;
359  this->m_input_frequency_offset_isSet = true;
360 }
361 
362 float
364  return rf_bandwidth;
365 }
366 void
368  this->rf_bandwidth = rf_bandwidth;
369  this->m_rf_bandwidth_isSet = true;
370 }
371 
372 float
374  return fm_deviation;
375 }
376 void
378  this->fm_deviation = fm_deviation;
379  this->m_fm_deviation_isSet = true;
380 }
381 
382 float
384  return demod_gain;
385 }
386 void
388  this->demod_gain = demod_gain;
389  this->m_demod_gain_isSet = true;
390 }
391 
392 float
394  return volume;
395 }
396 void
398  this->volume = volume;
399  this->m_volume_isSet = true;
400 }
401 
402 qint32
404  return baud_rate;
405 }
406 void
408  this->baud_rate = baud_rate;
409  this->m_baud_rate_isSet = true;
410 }
411 
412 qint32
414  return squelch_gate;
415 }
416 void
418  this->squelch_gate = squelch_gate;
419  this->m_squelch_gate_isSet = true;
420 }
421 
422 float
424  return squelch;
425 }
426 void
428  this->squelch = squelch;
429  this->m_squelch_isSet = true;
430 }
431 
432 qint32
434  return audio_mute;
435 }
436 void
438  this->audio_mute = audio_mute;
439  this->m_audio_mute_isSet = true;
440 }
441 
442 qint32
445 }
446 void
448  this->enable_cosine_filtering = enable_cosine_filtering;
449  this->m_enable_cosine_filtering_isSet = true;
450 }
451 
452 qint32
454  return sync_or_constellation;
455 }
456 void
458  this->sync_or_constellation = sync_or_constellation;
459  this->m_sync_or_constellation_isSet = true;
460 }
461 
462 qint32
464  return slot1_on;
465 }
466 void
468  this->slot1_on = slot1_on;
469  this->m_slot1_on_isSet = true;
470 }
471 
472 qint32
474  return slot2_on;
475 }
476 void
478  this->slot2_on = slot2_on;
479  this->m_slot2_on_isSet = true;
480 }
481 
482 qint32
484  return tdma_stereo;
485 }
486 void
488  this->tdma_stereo = tdma_stereo;
489  this->m_tdma_stereo_isSet = true;
490 }
491 
492 qint32
494  return pll_lock;
495 }
496 void
498  this->pll_lock = pll_lock;
499  this->m_pll_lock_isSet = true;
500 }
501 
502 qint32
504  return rgb_color;
505 }
506 void
508  this->rgb_color = rgb_color;
509  this->m_rgb_color_isSet = true;
510 }
511 
512 QString*
514  return title;
515 }
516 void
518  this->title = title;
519  this->m_title_isSet = true;
520 }
521 
522 QString*
524  return audio_device_name;
525 }
526 void
528  this->audio_device_name = audio_device_name;
529  this->m_audio_device_name_isSet = true;
530 }
531 
532 qint32
534  return high_pass_filter;
535 }
536 void
538  this->high_pass_filter = high_pass_filter;
539  this->m_high_pass_filter_isSet = true;
540 }
541 
542 qint32
545 }
546 void
548  this->trace_length_mutliplier = trace_length_mutliplier;
549  this->m_trace_length_mutliplier_isSet = true;
550 }
551 
552 qint32
554  return trace_stroke;
555 }
556 void
558  this->trace_stroke = trace_stroke;
559  this->m_trace_stroke_isSet = true;
560 }
561 
562 qint32
564  return trace_decay;
565 }
566 void
568  this->trace_decay = trace_decay;
569  this->m_trace_decay_isSet = true;
570 }
571 
572 qint32
574  return use_reverse_api;
575 }
576 void
578  this->use_reverse_api = use_reverse_api;
579  this->m_use_reverse_api_isSet = true;
580 }
581 
582 QString*
584  return reverse_api_address;
585 }
586 void
588  this->reverse_api_address = reverse_api_address;
589  this->m_reverse_api_address_isSet = true;
590 }
591 
592 qint32
594  return reverse_api_port;
595 }
596 void
598  this->reverse_api_port = reverse_api_port;
599  this->m_reverse_api_port_isSet = true;
600 }
601 
602 qint32
605 }
606 void
608  this->reverse_api_device_index = reverse_api_device_index;
610 }
611 
612 qint32
615 }
616 void
618  this->reverse_api_channel_index = reverse_api_channel_index;
620 }
621 
622 
623 bool
625  bool isObjectUpdated = false;
626  do{
627  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
628  if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
629  if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
630  if(m_demod_gain_isSet){ isObjectUpdated = true; break;}
631  if(m_volume_isSet){ isObjectUpdated = true; break;}
632  if(m_baud_rate_isSet){ isObjectUpdated = true; break;}
633  if(m_squelch_gate_isSet){ isObjectUpdated = true; break;}
634  if(m_squelch_isSet){ isObjectUpdated = true; break;}
635  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
636  if(m_enable_cosine_filtering_isSet){ isObjectUpdated = true; break;}
637  if(m_sync_or_constellation_isSet){ isObjectUpdated = true; break;}
638  if(m_slot1_on_isSet){ isObjectUpdated = true; break;}
639  if(m_slot2_on_isSet){ isObjectUpdated = true; break;}
640  if(m_tdma_stereo_isSet){ isObjectUpdated = true; break;}
641  if(m_pll_lock_isSet){ isObjectUpdated = true; break;}
642  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
643  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
644  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
645  if(m_high_pass_filter_isSet){ isObjectUpdated = true; break;}
646  if(m_trace_length_mutliplier_isSet){ isObjectUpdated = true; break;}
647  if(m_trace_stroke_isSet){ isObjectUpdated = true; break;}
648  if(m_trace_decay_isSet){ isObjectUpdated = true; break;}
649  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
650  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
651  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
652  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
653  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
654  }while(false);
655  return isObjectUpdated;
656 }
657 }
658 
void setSquelchGate(qint32 squelch_gate)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setTraceStroke(qint32 trace_stroke)
void setUseReverseApi(qint32 use_reverse_api)
virtual QString asJson() override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setSyncOrConstellation(qint32 sync_or_constellation)
virtual SWGDSDDemodSettings * fromJson(QString &jsonString) override
void setHighPassFilter(qint32 high_pass_filter)
void setTdmaStereo(qint32 tdma_stereo)
void setAudioDeviceName(QString *audio_device_name)
void setReverseApiAddress(QString *reverse_api_address)
void setFmDeviation(float fm_deviation)
void setTraceLengthMutliplier(qint32 trace_length_mutliplier)
void setTraceDecay(qint32 trace_decay)
void setRfBandwidth(float rf_bandwidth)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
virtual void fromJsonObject(QJsonObject &json) override
void setEnableCosineFiltering(qint32 enable_cosine_filtering)
void setReverseApiPort(qint32 reverse_api_port)
void setInputFrequencyOffset(qint64 input_frequency_offset)
virtual QJsonObject * asJsonObject() override