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.
SWGFreeDVModSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGFreeDVModSettings.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  tone_frequency = 0.0f;
34  m_tone_frequency_isSet = false;
35  volume_factor = 0.0f;
36  m_volume_factor_isSet = false;
37  span_log2 = 0;
38  m_span_log2_isSet = false;
39  audio_mute = 0;
40  m_audio_mute_isSet = false;
41  play_loop = 0;
42  m_play_loop_isSet = false;
43  rgb_color = 0;
44  m_rgb_color_isSet = false;
45  title = nullptr;
46  m_title_isSet = false;
47  audio_device_name = nullptr;
49  free_dv_mode = 0;
50  m_free_dv_mode_isSet = false;
51  mod_af_input = 0;
52  m_mod_af_input_isSet = false;
55  use_reverse_api = 0;
57  reverse_api_address = nullptr;
59  reverse_api_port = 0;
65  cw_keyer = nullptr;
66  m_cw_keyer_isSet = false;
67 }
68 
70  this->cleanup();
71 }
72 
73 void
77  tone_frequency = 0.0f;
78  m_tone_frequency_isSet = false;
79  volume_factor = 0.0f;
80  m_volume_factor_isSet = false;
81  span_log2 = 0;
82  m_span_log2_isSet = false;
83  audio_mute = 0;
84  m_audio_mute_isSet = false;
85  play_loop = 0;
86  m_play_loop_isSet = false;
87  rgb_color = 0;
88  m_rgb_color_isSet = false;
89  title = new QString("");
90  m_title_isSet = false;
91  audio_device_name = new QString("");
93  free_dv_mode = 0;
94  m_free_dv_mode_isSet = false;
95  mod_af_input = 0;
96  m_mod_af_input_isSet = false;
99  use_reverse_api = 0;
100  m_use_reverse_api_isSet = false;
101  reverse_api_address = new QString("");
103  reverse_api_port = 0;
104  m_reverse_api_port_isSet = false;
110  m_cw_keyer_isSet = false;
111 }
112 
113 void
115 
116 
117 
118 
119 
120 
121 
122  if(title != nullptr) {
123  delete title;
124  }
125  if(audio_device_name != nullptr) {
126  delete audio_device_name;
127  }
128 
129 
130 
131 
132  if(reverse_api_address != nullptr) {
133  delete reverse_api_address;
134  }
135 
136 
137 
138  if(cw_keyer != nullptr) {
139  delete cw_keyer;
140  }
141 }
142 
145  QByteArray array (json.toStdString().c_str());
146  QJsonDocument doc = QJsonDocument::fromJson(array);
147  QJsonObject jsonObject = doc.object();
148  this->fromJsonObject(jsonObject);
149  return this;
150 }
151 
152 void
154  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
155 
156  ::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
157 
158  ::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
159 
160  ::SWGSDRangel::setValue(&span_log2, pJson["spanLog2"], "qint32", "");
161 
162  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
163 
164  ::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
165 
166  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
169 
170  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
171 
172  ::SWGSDRangel::setValue(&free_dv_mode, pJson["freeDVMode"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", "");
175 
176  ::SWGSDRangel::setValue(&gauge_input_else_modem, pJson["gaugeInputElseModem"], "qint32", "");
177 
178  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
179 
180  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
181 
182  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
185 
186  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
187 
188  ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
189 
190 }
191 
192 QString
194 {
195  QJsonObject* obj = this->asJsonObject();
196 
197  QJsonDocument doc(*obj);
198  QByteArray bytes = doc.toJson();
199  delete obj;
200  return QString(bytes);
201 }
202 
203 QJsonObject*
205  QJsonObject* obj = new QJsonObject();
207  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
208  }
210  obj->insert("toneFrequency", QJsonValue(tone_frequency));
211  }
213  obj->insert("volumeFactor", QJsonValue(volume_factor));
214  }
215  if(m_span_log2_isSet){
216  obj->insert("spanLog2", QJsonValue(span_log2));
217  }
218  if(m_audio_mute_isSet){
219  obj->insert("audioMute", QJsonValue(audio_mute));
220  }
221  if(m_play_loop_isSet){
222  obj->insert("playLoop", QJsonValue(play_loop));
223  }
224  if(m_rgb_color_isSet){
225  obj->insert("rgbColor", QJsonValue(rgb_color));
226  }
227  if(title != nullptr && *title != QString("")){
228  toJsonValue(QString("title"), title, obj, QString("QString"));
229  }
230  if(audio_device_name != nullptr && *audio_device_name != QString("")){
231  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
232  }
234  obj->insert("freeDVMode", QJsonValue(free_dv_mode));
235  }
237  obj->insert("modAFInput", QJsonValue(mod_af_input));
238  }
240  obj->insert("gaugeInputElseModem", QJsonValue(gauge_input_else_modem));
241  }
243  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
244  }
245  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
246  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
247  }
249  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
250  }
252  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
253  }
255  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
256  }
257  if((cw_keyer != nullptr) && (cw_keyer->isSet())){
258  toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
259  }
260 
261  return obj;
262 }
263 
264 qint64
266  return input_frequency_offset;
267 }
268 void
270  this->input_frequency_offset = input_frequency_offset;
271  this->m_input_frequency_offset_isSet = true;
272 }
273 
274 float
276  return tone_frequency;
277 }
278 void
280  this->tone_frequency = tone_frequency;
281  this->m_tone_frequency_isSet = true;
282 }
283 
284 float
286  return volume_factor;
287 }
288 void
290  this->volume_factor = volume_factor;
291  this->m_volume_factor_isSet = true;
292 }
293 
294 qint32
296  return span_log2;
297 }
298 void
300  this->span_log2 = span_log2;
301  this->m_span_log2_isSet = true;
302 }
303 
304 qint32
306  return audio_mute;
307 }
308 void
310  this->audio_mute = audio_mute;
311  this->m_audio_mute_isSet = true;
312 }
313 
314 qint32
316  return play_loop;
317 }
318 void
320  this->play_loop = play_loop;
321  this->m_play_loop_isSet = true;
322 }
323 
324 qint32
326  return rgb_color;
327 }
328 void
330  this->rgb_color = rgb_color;
331  this->m_rgb_color_isSet = true;
332 }
333 
334 QString*
336  return title;
337 }
338 void
340  this->title = title;
341  this->m_title_isSet = true;
342 }
343 
344 QString*
346  return audio_device_name;
347 }
348 void
350  this->audio_device_name = audio_device_name;
351  this->m_audio_device_name_isSet = true;
352 }
353 
354 qint32
356  return free_dv_mode;
357 }
358 void
360  this->free_dv_mode = free_dv_mode;
361  this->m_free_dv_mode_isSet = true;
362 }
363 
364 qint32
366  return mod_af_input;
367 }
368 void
370  this->mod_af_input = mod_af_input;
371  this->m_mod_af_input_isSet = true;
372 }
373 
374 qint32
376  return gauge_input_else_modem;
377 }
378 void
380  this->gauge_input_else_modem = gauge_input_else_modem;
381  this->m_gauge_input_else_modem_isSet = true;
382 }
383 
384 qint32
386  return use_reverse_api;
387 }
388 void
390  this->use_reverse_api = use_reverse_api;
391  this->m_use_reverse_api_isSet = true;
392 }
393 
394 QString*
396  return reverse_api_address;
397 }
398 void
400  this->reverse_api_address = reverse_api_address;
401  this->m_reverse_api_address_isSet = true;
402 }
403 
404 qint32
406  return reverse_api_port;
407 }
408 void
410  this->reverse_api_port = reverse_api_port;
411  this->m_reverse_api_port_isSet = true;
412 }
413 
414 qint32
417 }
418 void
420  this->reverse_api_device_index = reverse_api_device_index;
422 }
423 
424 qint32
427 }
428 void
430  this->reverse_api_channel_index = reverse_api_channel_index;
432 }
433 
436  return cw_keyer;
437 }
438 void
440  this->cw_keyer = cw_keyer;
441  this->m_cw_keyer_isSet = true;
442 }
443 
444 
445 bool
447  bool isObjectUpdated = false;
448  do{
449  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
450  if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
451  if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
452  if(m_span_log2_isSet){ isObjectUpdated = true; break;}
453  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
454  if(m_play_loop_isSet){ isObjectUpdated = true; break;}
455  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
456  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
457  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
458  if(m_free_dv_mode_isSet){ isObjectUpdated = true; break;}
459  if(m_mod_af_input_isSet){ isObjectUpdated = true; break;}
460  if(m_gauge_input_else_modem_isSet){ isObjectUpdated = true; break;}
461  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
462  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
463  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
464  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
465  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
466  if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
467  }while(false);
468  return isObjectUpdated;
469 }
470 }
471 
void setVolumeFactor(float volume_factor)
void setAudioDeviceName(QString *audio_device_name)
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setReverseApiPort(qint32 reverse_api_port)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiAddress(QString *reverse_api_address)
void setGaugeInputElseModem(qint32 gauge_input_else_modem)
void setToneFrequency(float tone_frequency)
virtual QJsonObject * asJsonObject() override
void setInputFrequencyOffset(qint64 input_frequency_offset)
virtual void fromJsonObject(QJsonObject &json) override
void setFreeDvMode(qint32 free_dv_mode)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setModAfInput(qint32 mod_af_input)
virtual SWGFreeDVModSettings * fromJson(QString &jsonString) override