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.
SWGWFMModSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGWFMModSettings.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  af_bandwidth = 0.0f;
36  m_af_bandwidth_isSet = false;
37  fm_deviation = 0.0f;
38  m_fm_deviation_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  channel_mute = 0;
44  m_channel_mute_isSet = false;
45  play_loop = 0;
46  m_play_loop_isSet = false;
47  rgb_color = 0;
48  m_rgb_color_isSet = false;
49  title = nullptr;
50  m_title_isSet = false;
51  audio_device_name = nullptr;
53  mod_af_input = 0;
54  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  rf_bandwidth = 0.0f;
78  m_rf_bandwidth_isSet = false;
79  af_bandwidth = 0.0f;
80  m_af_bandwidth_isSet = false;
81  fm_deviation = 0.0f;
82  m_fm_deviation_isSet = false;
83  tone_frequency = 0.0f;
84  m_tone_frequency_isSet = false;
85  volume_factor = 0.0f;
86  m_volume_factor_isSet = false;
87  channel_mute = 0;
88  m_channel_mute_isSet = false;
89  play_loop = 0;
90  m_play_loop_isSet = false;
91  rgb_color = 0;
92  m_rgb_color_isSet = false;
93  title = new QString("");
94  m_title_isSet = false;
95  audio_device_name = new QString("");
97  mod_af_input = 0;
98  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 
123 
124  if(title != nullptr) {
125  delete title;
126  }
127  if(audio_device_name != nullptr) {
128  delete audio_device_name;
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(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
157 
158  ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
159 
160  ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", "");
161 
162  ::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
163 
164  ::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
165 
166  ::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
173 
174  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
175 
176  ::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "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("rfBandwidth", QJsonValue(rf_bandwidth));
211  }
213  obj->insert("afBandwidth", QJsonValue(af_bandwidth));
214  }
216  obj->insert("fmDeviation", QJsonValue(fm_deviation));
217  }
219  obj->insert("toneFrequency", QJsonValue(tone_frequency));
220  }
222  obj->insert("volumeFactor", QJsonValue(volume_factor));
223  }
225  obj->insert("channelMute", QJsonValue(channel_mute));
226  }
227  if(m_play_loop_isSet){
228  obj->insert("playLoop", QJsonValue(play_loop));
229  }
230  if(m_rgb_color_isSet){
231  obj->insert("rgbColor", QJsonValue(rgb_color));
232  }
233  if(title != nullptr && *title != QString("")){
234  toJsonValue(QString("title"), title, obj, QString("QString"));
235  }
236  if(audio_device_name != nullptr && *audio_device_name != QString("")){
237  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
238  }
240  obj->insert("modAFInput", QJsonValue(mod_af_input));
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 rf_bandwidth;
277 }
278 void
280  this->rf_bandwidth = rf_bandwidth;
281  this->m_rf_bandwidth_isSet = true;
282 }
283 
284 float
286  return af_bandwidth;
287 }
288 void
290  this->af_bandwidth = af_bandwidth;
291  this->m_af_bandwidth_isSet = true;
292 }
293 
294 float
296  return fm_deviation;
297 }
298 void
300  this->fm_deviation = fm_deviation;
301  this->m_fm_deviation_isSet = true;
302 }
303 
304 float
306  return tone_frequency;
307 }
308 void
310  this->tone_frequency = tone_frequency;
311  this->m_tone_frequency_isSet = true;
312 }
313 
314 float
316  return volume_factor;
317 }
318 void
320  this->volume_factor = volume_factor;
321  this->m_volume_factor_isSet = true;
322 }
323 
324 qint32
326  return channel_mute;
327 }
328 void
330  this->channel_mute = channel_mute;
331  this->m_channel_mute_isSet = true;
332 }
333 
334 qint32
336  return play_loop;
337 }
338 void
340  this->play_loop = play_loop;
341  this->m_play_loop_isSet = true;
342 }
343 
344 qint32
346  return rgb_color;
347 }
348 void
350  this->rgb_color = rgb_color;
351  this->m_rgb_color_isSet = true;
352 }
353 
354 QString*
356  return title;
357 }
358 void
360  this->title = title;
361  this->m_title_isSet = true;
362 }
363 
364 QString*
366  return audio_device_name;
367 }
368 void
370  this->audio_device_name = audio_device_name;
371  this->m_audio_device_name_isSet = true;
372 }
373 
374 qint32
376  return mod_af_input;
377 }
378 void
380  this->mod_af_input = mod_af_input;
381  this->m_mod_af_input_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_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
451  if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
452  if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
453  if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
454  if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
455  if(m_channel_mute_isSet){ isObjectUpdated = true; break;}
456  if(m_play_loop_isSet){ isObjectUpdated = true; break;}
457  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
458  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
459  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
460  if(m_mod_af_input_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 
virtual QString asJson() override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setRfBandwidth(float rf_bandwidth)
void setChannelMute(qint32 channel_mute)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setUseReverseApi(qint32 use_reverse_api)
SWGCWKeyerSettings * getCwKeyer()
void setReverseApiPort(qint32 reverse_api_port)
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setPlayLoop(qint32 play_loop)
virtual void fromJsonObject(QJsonObject &json) override
void setAudioDeviceName(QString *audio_device_name)
void setCwKeyer(SWGCWKeyerSettings *cw_keyer)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiAddress(QString *reverse_api_address)
virtual QJsonObject * asJsonObject() override
virtual SWGWFMModSettings * fromJson(QString &jsonString) override
void setFmDeviation(float fm_deviation)
void setAfBandwidth(float af_bandwidth)
void setToneFrequency(float tone_frequency)
void setModAfInput(qint32 mod_af_input)
void setVolumeFactor(float volume_factor)
void setRgbColor(qint32 rgb_color)