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.
SWGAMDemodSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGAMDemodSettings.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  squelch = 0.0f;
36  m_squelch_isSet = false;
37  volume = 0.0f;
38  m_volume_isSet = false;
39  audio_mute = 0;
40  m_audio_mute_isSet = false;
41  bandpass_enable = 0;
43  rgb_color = 0;
44  m_rgb_color_isSet = false;
45  title = nullptr;
46  m_title_isSet = false;
47  audio_device_name = nullptr;
49  pll = 0;
50  m_pll_isSet = false;
53  stream_index = 0;
54  m_stream_index_isSet = false;
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  squelch = 0.0f;
78  m_squelch_isSet = false;
79  volume = 0.0f;
80  m_volume_isSet = false;
81  audio_mute = 0;
82  m_audio_mute_isSet = false;
83  bandpass_enable = 0;
85  rgb_color = 0;
86  m_rgb_color_isSet = false;
87  title = new QString("");
88  m_title_isSet = false;
89  audio_device_name = new QString("");
91  pll = 0;
92  m_pll_isSet = false;
95  stream_index = 0;
96  m_stream_index_isSet = false;
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  if(title != nullptr) {
119  delete title;
120  }
121  if(audio_device_name != nullptr) {
122  delete audio_device_name;
123  }
124 
125 
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(&squelch, pJson["squelch"], "float", "");
152 
153  ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
154 
155  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
156 
157  ::SWGSDRangel::setValue(&bandpass_enable, pJson["bandpassEnable"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
160 
161  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
162 
163  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
164 
165  ::SWGSDRangel::setValue(&pll, pJson["pll"], "qint32", "");
166 
167  ::SWGSDRangel::setValue(&sync_am_operation, pJson["syncAMOperation"], "qint32", "");
168 
169  ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", "");
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  }
203  if(m_squelch_isSet){
204  obj->insert("squelch", QJsonValue(squelch));
205  }
206  if(m_volume_isSet){
207  obj->insert("volume", QJsonValue(volume));
208  }
209  if(m_audio_mute_isSet){
210  obj->insert("audioMute", QJsonValue(audio_mute));
211  }
213  obj->insert("bandpassEnable", QJsonValue(bandpass_enable));
214  }
215  if(m_rgb_color_isSet){
216  obj->insert("rgbColor", QJsonValue(rgb_color));
217  }
218  if(title != nullptr && *title != QString("")){
219  toJsonValue(QString("title"), title, obj, QString("QString"));
220  }
221  if(audio_device_name != nullptr && *audio_device_name != QString("")){
222  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
223  }
224  if(m_pll_isSet){
225  obj->insert("pll", QJsonValue(pll));
226  }
228  obj->insert("syncAMOperation", QJsonValue(sync_am_operation));
229  }
231  obj->insert("streamIndex", QJsonValue(stream_index));
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 squelch;
275 }
276 void
278  this->squelch = squelch;
279  this->m_squelch_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 qint32
294  return audio_mute;
295 }
296 void
298  this->audio_mute = audio_mute;
299  this->m_audio_mute_isSet = true;
300 }
301 
302 qint32
304  return bandpass_enable;
305 }
306 void
308  this->bandpass_enable = bandpass_enable;
309  this->m_bandpass_enable_isSet = true;
310 }
311 
312 qint32
314  return rgb_color;
315 }
316 void
318  this->rgb_color = rgb_color;
319  this->m_rgb_color_isSet = true;
320 }
321 
322 QString*
324  return title;
325 }
326 void
328  this->title = title;
329  this->m_title_isSet = true;
330 }
331 
332 QString*
334  return audio_device_name;
335 }
336 void
338  this->audio_device_name = audio_device_name;
339  this->m_audio_device_name_isSet = true;
340 }
341 
342 qint32
344  return pll;
345 }
346 void
348  this->pll = pll;
349  this->m_pll_isSet = true;
350 }
351 
352 qint32
354  return sync_am_operation;
355 }
356 void
358  this->sync_am_operation = sync_am_operation;
359  this->m_sync_am_operation_isSet = true;
360 }
361 
362 qint32
364  return stream_index;
365 }
366 void
368  this->stream_index = stream_index;
369  this->m_stream_index_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_squelch_isSet){ isObjectUpdated = true; break;}
430  if(m_volume_isSet){ isObjectUpdated = true; break;}
431  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
432  if(m_bandpass_enable_isSet){ isObjectUpdated = true; break;}
433  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
434  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
435  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
436  if(m_pll_isSet){ isObjectUpdated = true; break;}
437  if(m_sync_am_operation_isSet){ isObjectUpdated = true; break;}
438  if(m_stream_index_isSet){ 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 
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setAudioDeviceName(QString *audio_device_name)
virtual SWGAMDemodSettings * fromJson(QString &jsonString) override
virtual void fromJsonObject(QJsonObject &json) override
void setSyncAmOperation(qint32 sync_am_operation)
void setReverseApiAddress(QString *reverse_api_address)
virtual QJsonObject * asJsonObject() override
void setUseReverseApi(qint32 use_reverse_api)
void setBandpassEnable(qint32 bandpass_enable)
void setRfBandwidth(float rf_bandwidth)
void setInputFrequencyOffset(qint64 input_frequency_offset)
virtual QString asJson() override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setAudioMute(qint32 audio_mute)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiPort(qint32 reverse_api_port)
void setStreamIndex(qint32 stream_index)