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.
SWGSSBDemodSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGSSBDemodSettings.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  low_cutoff = 0.0f;
36  m_low_cutoff_isSet = false;
37  volume = 0.0f;
38  m_volume_isSet = false;
39  span_log2 = 0;
40  m_span_log2_isSet = false;
41  audio_binaural = 0;
42  m_audio_binaural_isSet = false;
45  dsb = 0;
46  m_dsb_isSet = false;
47  audio_mute = 0;
48  m_audio_mute_isSet = false;
49  agc = 0;
50  m_agc_isSet = false;
51  agc_clamping = 0;
52  m_agc_clamping_isSet = false;
53  agc_time_log2 = 0;
54  m_agc_time_log2_isSet = false;
59  rgb_color = 0;
60  m_rgb_color_isSet = false;
61  title = nullptr;
62  m_title_isSet = false;
63  audio_device_name = nullptr;
65  use_reverse_api = 0;
67  reverse_api_address = nullptr;
69  reverse_api_port = 0;
75 }
76 
78  this->cleanup();
79 }
80 
81 void
85  rf_bandwidth = 0.0f;
86  m_rf_bandwidth_isSet = false;
87  low_cutoff = 0.0f;
88  m_low_cutoff_isSet = false;
89  volume = 0.0f;
90  m_volume_isSet = false;
91  span_log2 = 0;
92  m_span_log2_isSet = false;
93  audio_binaural = 0;
94  m_audio_binaural_isSet = false;
97  dsb = 0;
98  m_dsb_isSet = false;
99  audio_mute = 0;
100  m_audio_mute_isSet = false;
101  agc = 0;
102  m_agc_isSet = false;
103  agc_clamping = 0;
104  m_agc_clamping_isSet = false;
105  agc_time_log2 = 0;
106  m_agc_time_log2_isSet = false;
109  agc_threshold_gate = 0;
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  use_reverse_api = 0;
118  m_use_reverse_api_isSet = false;
119  reverse_api_address = new QString("");
121  reverse_api_port = 0;
122  m_reverse_api_port_isSet = false;
127 }
128 
129 void
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146  if(title != nullptr) {
147  delete title;
148  }
149  if(audio_device_name != nullptr) {
150  delete audio_device_name;
151  }
152 
153  if(reverse_api_address != nullptr) {
154  delete reverse_api_address;
155  }
156 
157 
158 
159 }
160 
163  QByteArray array (json.toStdString().c_str());
164  QJsonDocument doc = QJsonDocument::fromJson(array);
165  QJsonObject jsonObject = doc.object();
166  this->fromJsonObject(jsonObject);
167  return this;
168 }
169 
170 void
172  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
173 
174  ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
175 
176  ::SWGSDRangel::setValue(&low_cutoff, pJson["lowCutoff"], "float", "");
177 
178  ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
179 
180  ::SWGSDRangel::setValue(&span_log2, pJson["spanLog2"], "qint32", "");
181 
182  ::SWGSDRangel::setValue(&audio_binaural, pJson["audioBinaural"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&audio_flip_channels, pJson["audioFlipChannels"], "qint32", "");
185 
186  ::SWGSDRangel::setValue(&dsb, pJson["dsb"], "qint32", "");
187 
188  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
189 
190  ::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", "");
191 
192  ::SWGSDRangel::setValue(&agc_clamping, pJson["agcClamping"], "qint32", "");
193 
194  ::SWGSDRangel::setValue(&agc_time_log2, pJson["agcTimeLog2"], "qint32", "");
195 
196  ::SWGSDRangel::setValue(&agc_power_threshold, pJson["agcPowerThreshold"], "qint32", "");
197 
198  ::SWGSDRangel::setValue(&agc_threshold_gate, pJson["agcThresholdGate"], "qint32", "");
199 
200  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
201 
202  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
203 
204  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
205 
206  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
207 
208  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
209 
210  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
211 
212  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
213 
214  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
215 
216 }
217 
218 QString
220 {
221  QJsonObject* obj = this->asJsonObject();
222 
223  QJsonDocument doc(*obj);
224  QByteArray bytes = doc.toJson();
225  delete obj;
226  return QString(bytes);
227 }
228 
229 QJsonObject*
231  QJsonObject* obj = new QJsonObject();
233  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
234  }
236  obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
237  }
238  if(m_low_cutoff_isSet){
239  obj->insert("lowCutoff", QJsonValue(low_cutoff));
240  }
241  if(m_volume_isSet){
242  obj->insert("volume", QJsonValue(volume));
243  }
244  if(m_span_log2_isSet){
245  obj->insert("spanLog2", QJsonValue(span_log2));
246  }
248  obj->insert("audioBinaural", QJsonValue(audio_binaural));
249  }
251  obj->insert("audioFlipChannels", QJsonValue(audio_flip_channels));
252  }
253  if(m_dsb_isSet){
254  obj->insert("dsb", QJsonValue(dsb));
255  }
256  if(m_audio_mute_isSet){
257  obj->insert("audioMute", QJsonValue(audio_mute));
258  }
259  if(m_agc_isSet){
260  obj->insert("agc", QJsonValue(agc));
261  }
263  obj->insert("agcClamping", QJsonValue(agc_clamping));
264  }
266  obj->insert("agcTimeLog2", QJsonValue(agc_time_log2));
267  }
269  obj->insert("agcPowerThreshold", QJsonValue(agc_power_threshold));
270  }
272  obj->insert("agcThresholdGate", QJsonValue(agc_threshold_gate));
273  }
274  if(m_rgb_color_isSet){
275  obj->insert("rgbColor", QJsonValue(rgb_color));
276  }
277  if(title != nullptr && *title != QString("")){
278  toJsonValue(QString("title"), title, obj, QString("QString"));
279  }
280  if(audio_device_name != nullptr && *audio_device_name != QString("")){
281  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
282  }
284  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
285  }
286  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
287  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
288  }
290  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
291  }
293  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
294  }
296  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
297  }
298 
299  return obj;
300 }
301 
302 qint64
304  return input_frequency_offset;
305 }
306 void
308  this->input_frequency_offset = input_frequency_offset;
309  this->m_input_frequency_offset_isSet = true;
310 }
311 
312 float
314  return rf_bandwidth;
315 }
316 void
318  this->rf_bandwidth = rf_bandwidth;
319  this->m_rf_bandwidth_isSet = true;
320 }
321 
322 float
324  return low_cutoff;
325 }
326 void
328  this->low_cutoff = low_cutoff;
329  this->m_low_cutoff_isSet = true;
330 }
331 
332 float
334  return volume;
335 }
336 void
338  this->volume = volume;
339  this->m_volume_isSet = true;
340 }
341 
342 qint32
344  return span_log2;
345 }
346 void
348  this->span_log2 = span_log2;
349  this->m_span_log2_isSet = true;
350 }
351 
352 qint32
354  return audio_binaural;
355 }
356 void
358  this->audio_binaural = audio_binaural;
359  this->m_audio_binaural_isSet = true;
360 }
361 
362 qint32
364  return audio_flip_channels;
365 }
366 void
368  this->audio_flip_channels = audio_flip_channels;
369  this->m_audio_flip_channels_isSet = true;
370 }
371 
372 qint32
374  return dsb;
375 }
376 void
378  this->dsb = dsb;
379  this->m_dsb_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 agc;
395 }
396 void
398  this->agc = agc;
399  this->m_agc_isSet = true;
400 }
401 
402 qint32
404  return agc_clamping;
405 }
406 void
408  this->agc_clamping = agc_clamping;
409  this->m_agc_clamping_isSet = true;
410 }
411 
412 qint32
414  return agc_time_log2;
415 }
416 void
418  this->agc_time_log2 = agc_time_log2;
419  this->m_agc_time_log2_isSet = true;
420 }
421 
422 qint32
424  return agc_power_threshold;
425 }
426 void
428  this->agc_power_threshold = agc_power_threshold;
429  this->m_agc_power_threshold_isSet = true;
430 }
431 
432 qint32
434  return agc_threshold_gate;
435 }
436 void
438  this->agc_threshold_gate = agc_threshold_gate;
439  this->m_agc_threshold_gate_isSet = true;
440 }
441 
442 qint32
444  return rgb_color;
445 }
446 void
448  this->rgb_color = rgb_color;
449  this->m_rgb_color_isSet = true;
450 }
451 
452 QString*
454  return title;
455 }
456 void
458  this->title = title;
459  this->m_title_isSet = true;
460 }
461 
462 QString*
464  return audio_device_name;
465 }
466 void
468  this->audio_device_name = audio_device_name;
469  this->m_audio_device_name_isSet = true;
470 }
471 
472 qint32
474  return use_reverse_api;
475 }
476 void
478  this->use_reverse_api = use_reverse_api;
479  this->m_use_reverse_api_isSet = true;
480 }
481 
482 QString*
484  return reverse_api_address;
485 }
486 void
488  this->reverse_api_address = reverse_api_address;
489  this->m_reverse_api_address_isSet = true;
490 }
491 
492 qint32
494  return reverse_api_port;
495 }
496 void
498  this->reverse_api_port = reverse_api_port;
499  this->m_reverse_api_port_isSet = true;
500 }
501 
502 qint32
505 }
506 void
508  this->reverse_api_device_index = reverse_api_device_index;
510 }
511 
512 qint32
515 }
516 void
518  this->reverse_api_channel_index = reverse_api_channel_index;
520 }
521 
522 
523 bool
525  bool isObjectUpdated = false;
526  do{
527  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
528  if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
529  if(m_low_cutoff_isSet){ isObjectUpdated = true; break;}
530  if(m_volume_isSet){ isObjectUpdated = true; break;}
531  if(m_span_log2_isSet){ isObjectUpdated = true; break;}
532  if(m_audio_binaural_isSet){ isObjectUpdated = true; break;}
533  if(m_audio_flip_channels_isSet){ isObjectUpdated = true; break;}
534  if(m_dsb_isSet){ isObjectUpdated = true; break;}
535  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
536  if(m_agc_isSet){ isObjectUpdated = true; break;}
537  if(m_agc_clamping_isSet){ isObjectUpdated = true; break;}
538  if(m_agc_time_log2_isSet){ isObjectUpdated = true; break;}
539  if(m_agc_power_threshold_isSet){ isObjectUpdated = true; break;}
540  if(m_agc_threshold_gate_isSet){ isObjectUpdated = true; break;}
541  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
542  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
543  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
544  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
545  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
546  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
547  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
548  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
549  }while(false);
550  return isObjectUpdated;
551 }
552 }
553 
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setAudioBinaural(qint32 audio_binaural)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual QString asJson() override
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
virtual SWGSSBDemodSettings * fromJson(QString &jsonString) override
void setAgcClamping(qint32 agc_clamping)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual QJsonObject * asJsonObject() override
void setAudioDeviceName(QString *audio_device_name)
void setAgcThresholdGate(qint32 agc_threshold_gate)
void setAgcPowerThreshold(qint32 agc_power_threshold)
void setRfBandwidth(float rf_bandwidth)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setUseReverseApi(qint32 use_reverse_api)
void setAudioFlipChannels(qint32 audio_flip_channels)
void setAgcTimeLog2(qint32 agc_time_log2)
void setReverseApiAddress(QString *reverse_api_address)
virtual void fromJsonObject(QJsonObject &json) override
void setReverseApiPort(qint32 reverse_api_port)