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.
SWGFreeDVDemodSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGFreeDVDemodSettings.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  volume = 0.0f;
34  m_volume_isSet = false;
35  volume_in = 0.0f;
36  m_volume_in_isSet = false;
37  span_log2 = 0;
38  m_span_log2_isSet = false;
39  audio_mute = 0;
40  m_audio_mute_isSet = false;
41  agc = 0;
42  m_agc_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  use_reverse_api = 0;
53  reverse_api_address = nullptr;
55  reverse_api_port = 0;
61 }
62 
64  this->cleanup();
65 }
66 
67 void
71  volume = 0.0f;
72  m_volume_isSet = false;
73  volume_in = 0.0f;
74  m_volume_in_isSet = false;
75  span_log2 = 0;
76  m_span_log2_isSet = false;
77  audio_mute = 0;
78  m_audio_mute_isSet = false;
79  agc = 0;
80  m_agc_isSet = false;
81  rgb_color = 0;
82  m_rgb_color_isSet = false;
83  title = new QString("");
84  m_title_isSet = false;
85  audio_device_name = new QString("");
87  free_dv_mode = 0;
88  m_free_dv_mode_isSet = false;
89  use_reverse_api = 0;
91  reverse_api_address = new QString("");
93  reverse_api_port = 0;
99 }
100 
101 void
103 
104 
105 
106 
107 
108 
109 
110  if(title != nullptr) {
111  delete title;
112  }
113  if(audio_device_name != nullptr) {
114  delete audio_device_name;
115  }
116 
117 
118  if(reverse_api_address != nullptr) {
119  delete reverse_api_address;
120  }
121 
122 
123 
124 }
125 
128  QByteArray array (json.toStdString().c_str());
129  QJsonDocument doc = QJsonDocument::fromJson(array);
130  QJsonObject jsonObject = doc.object();
131  this->fromJsonObject(jsonObject);
132  return this;
133 }
134 
135 void
137  ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
138 
139  ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", "");
140 
141  ::SWGSDRangel::setValue(&volume_in, pJson["volumeIn"], "float", "");
142 
143  ::SWGSDRangel::setValue(&span_log2, pJson["spanLog2"], "qint32", "");
144 
145  ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
146 
147  ::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", "");
148 
149  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
150 
151  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
152 
153  ::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
154 
155  ::SWGSDRangel::setValue(&free_dv_mode, pJson["freeDVMode"], "qint32", "");
156 
157  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
160 
161  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
162 
163  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
164 
165  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
166 
167 }
168 
169 QString
171 {
172  QJsonObject* obj = this->asJsonObject();
173 
174  QJsonDocument doc(*obj);
175  QByteArray bytes = doc.toJson();
176  delete obj;
177  return QString(bytes);
178 }
179 
180 QJsonObject*
182  QJsonObject* obj = new QJsonObject();
184  obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
185  }
186  if(m_volume_isSet){
187  obj->insert("volume", QJsonValue(volume));
188  }
189  if(m_volume_in_isSet){
190  obj->insert("volumeIn", QJsonValue(volume_in));
191  }
192  if(m_span_log2_isSet){
193  obj->insert("spanLog2", QJsonValue(span_log2));
194  }
195  if(m_audio_mute_isSet){
196  obj->insert("audioMute", QJsonValue(audio_mute));
197  }
198  if(m_agc_isSet){
199  obj->insert("agc", QJsonValue(agc));
200  }
201  if(m_rgb_color_isSet){
202  obj->insert("rgbColor", QJsonValue(rgb_color));
203  }
204  if(title != nullptr && *title != QString("")){
205  toJsonValue(QString("title"), title, obj, QString("QString"));
206  }
207  if(audio_device_name != nullptr && *audio_device_name != QString("")){
208  toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
209  }
211  obj->insert("freeDVMode", QJsonValue(free_dv_mode));
212  }
214  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
215  }
216  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
217  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
218  }
220  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
221  }
223  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
224  }
226  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
227  }
228 
229  return obj;
230 }
231 
232 qint64
234  return input_frequency_offset;
235 }
236 void
238  this->input_frequency_offset = input_frequency_offset;
239  this->m_input_frequency_offset_isSet = true;
240 }
241 
242 float
244  return volume;
245 }
246 void
248  this->volume = volume;
249  this->m_volume_isSet = true;
250 }
251 
252 float
254  return volume_in;
255 }
256 void
258  this->volume_in = volume_in;
259  this->m_volume_in_isSet = true;
260 }
261 
262 qint32
264  return span_log2;
265 }
266 void
268  this->span_log2 = span_log2;
269  this->m_span_log2_isSet = true;
270 }
271 
272 qint32
274  return audio_mute;
275 }
276 void
278  this->audio_mute = audio_mute;
279  this->m_audio_mute_isSet = true;
280 }
281 
282 qint32
284  return agc;
285 }
286 void
288  this->agc = agc;
289  this->m_agc_isSet = true;
290 }
291 
292 qint32
294  return rgb_color;
295 }
296 void
298  this->rgb_color = rgb_color;
299  this->m_rgb_color_isSet = true;
300 }
301 
302 QString*
304  return title;
305 }
306 void
308  this->title = title;
309  this->m_title_isSet = true;
310 }
311 
312 QString*
314  return audio_device_name;
315 }
316 void
318  this->audio_device_name = audio_device_name;
319  this->m_audio_device_name_isSet = true;
320 }
321 
322 qint32
324  return free_dv_mode;
325 }
326 void
328  this->free_dv_mode = free_dv_mode;
329  this->m_free_dv_mode_isSet = true;
330 }
331 
332 qint32
334  return use_reverse_api;
335 }
336 void
338  this->use_reverse_api = use_reverse_api;
339  this->m_use_reverse_api_isSet = true;
340 }
341 
342 QString*
344  return reverse_api_address;
345 }
346 void
348  this->reverse_api_address = reverse_api_address;
349  this->m_reverse_api_address_isSet = true;
350 }
351 
352 qint32
354  return reverse_api_port;
355 }
356 void
358  this->reverse_api_port = reverse_api_port;
359  this->m_reverse_api_port_isSet = true;
360 }
361 
362 qint32
365 }
366 void
368  this->reverse_api_device_index = reverse_api_device_index;
370 }
371 
372 qint32
375 }
376 void
378  this->reverse_api_channel_index = reverse_api_channel_index;
380 }
381 
382 
383 bool
385  bool isObjectUpdated = false;
386  do{
387  if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
388  if(m_volume_isSet){ isObjectUpdated = true; break;}
389  if(m_volume_in_isSet){ isObjectUpdated = true; break;}
390  if(m_span_log2_isSet){ isObjectUpdated = true; break;}
391  if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
392  if(m_agc_isSet){ isObjectUpdated = true; break;}
393  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
394  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
395  if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
396  if(m_free_dv_mode_isSet){ isObjectUpdated = true; break;}
397  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
398  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
399  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
400  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
401  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
402  }while(false);
403  return isObjectUpdated;
404 }
405 }
406 
void setAudioDeviceName(QString *audio_device_name)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual QJsonObject * asJsonObject() override
virtual SWGFreeDVDemodSettings * fromJson(QString &jsonString) override
void setReverseApiPort(qint32 reverse_api_port)
void setInputFrequencyOffset(qint64 input_frequency_offset)
void setReverseApiAddress(QString *reverse_api_address)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual void fromJsonObject(QJsonObject &json) override
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)