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.
SWGLimeSdrOutputSettings.cpp
Go to the documentation of this file.
1 
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 
31  center_frequency = 0L;
33  dev_sample_rate = 0;
35  log2_hard_interp = 0;
37  log2_soft_interp = 0;
39  lpf_bw = 0;
40  m_lpf_bw_isSet = false;
41  lpf_fir_enable = 0;
42  m_lpf_fir_enable_isSet = false;
43  lpf_firbw = 0;
44  m_lpf_firbw_isSet = false;
45  gain = 0;
46  m_gain_isSet = false;
47  nco_enable = 0;
48  m_nco_enable_isSet = false;
49  nco_frequency = 0;
50  m_nco_frequency_isSet = false;
51  antenna_path = 0;
52  m_antenna_path_isSet = false;
53  ext_clock = 0;
54  m_ext_clock_isSet = false;
55  ext_clock_freq = 0;
56  m_ext_clock_freq_isSet = false;
57  transverter_mode = 0;
61  gpio_dir = 0;
62  m_gpio_dir_isSet = false;
63  gpio_pins = 0;
64  m_gpio_pins_isSet = false;
65  use_reverse_api = 0;
67  reverse_api_address = nullptr;
69  reverse_api_port = 0;
73 }
74 
76  this->cleanup();
77 }
78 
79 void
81  center_frequency = 0L;
83  dev_sample_rate = 0;
85  log2_hard_interp = 0;
87  log2_soft_interp = 0;
89  lpf_bw = 0;
90  m_lpf_bw_isSet = false;
91  lpf_fir_enable = 0;
92  m_lpf_fir_enable_isSet = false;
93  lpf_firbw = 0;
94  m_lpf_firbw_isSet = false;
95  gain = 0;
96  m_gain_isSet = false;
97  nco_enable = 0;
98  m_nco_enable_isSet = false;
99  nco_frequency = 0;
100  m_nco_frequency_isSet = false;
101  antenna_path = 0;
102  m_antenna_path_isSet = false;
103  ext_clock = 0;
104  m_ext_clock_isSet = false;
105  ext_clock_freq = 0;
106  m_ext_clock_freq_isSet = false;
107  transverter_mode = 0;
108  m_transverter_mode_isSet = false;
111  gpio_dir = 0;
112  m_gpio_dir_isSet = false;
113  gpio_pins = 0;
114  m_gpio_pins_isSet = false;
115  use_reverse_api = 0;
116  m_use_reverse_api_isSet = false;
117  reverse_api_address = new QString("");
119  reverse_api_port = 0;
120  m_reverse_api_port_isSet = false;
123 }
124 
125 void
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145  if(reverse_api_address != nullptr) {
146  delete reverse_api_address;
147  }
148 
149 
150 }
151 
154  QByteArray array (json.toStdString().c_str());
155  QJsonDocument doc = QJsonDocument::fromJson(array);
156  QJsonObject jsonObject = doc.object();
157  this->fromJsonObject(jsonObject);
158  return this;
159 }
160 
161 void
163  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
164 
165  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
166 
167  ::SWGSDRangel::setValue(&log2_hard_interp, pJson["log2HardInterp"], "qint32", "");
168 
169  ::SWGSDRangel::setValue(&log2_soft_interp, pJson["log2SoftInterp"], "qint32", "");
170 
171  ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
172 
173  ::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", "");
174 
175  ::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", "");
176 
177  ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
178 
179  ::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", "");
180 
181  ::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", "");
182 
183  ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
184 
185  ::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", "");
186 
187  ::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
188 
189  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
190 
191  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
192 
193  ::SWGSDRangel::setValue(&gpio_dir, pJson["gpioDir"], "qint32", "");
194 
195  ::SWGSDRangel::setValue(&gpio_pins, pJson["gpioPins"], "qint32", "");
196 
197  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
198 
199  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
200 
201  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
202 
203  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
204 
205 }
206 
207 QString
209 {
210  QJsonObject* obj = this->asJsonObject();
211 
212  QJsonDocument doc(*obj);
213  QByteArray bytes = doc.toJson();
214  delete obj;
215  return QString(bytes);
216 }
217 
218 QJsonObject*
220  QJsonObject* obj = new QJsonObject();
222  obj->insert("centerFrequency", QJsonValue(center_frequency));
223  }
225  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
226  }
228  obj->insert("log2HardInterp", QJsonValue(log2_hard_interp));
229  }
231  obj->insert("log2SoftInterp", QJsonValue(log2_soft_interp));
232  }
233  if(m_lpf_bw_isSet){
234  obj->insert("lpfBW", QJsonValue(lpf_bw));
235  }
237  obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
238  }
239  if(m_lpf_firbw_isSet){
240  obj->insert("lpfFIRBW", QJsonValue(lpf_firbw));
241  }
242  if(m_gain_isSet){
243  obj->insert("gain", QJsonValue(gain));
244  }
245  if(m_nco_enable_isSet){
246  obj->insert("ncoEnable", QJsonValue(nco_enable));
247  }
249  obj->insert("ncoFrequency", QJsonValue(nco_frequency));
250  }
252  obj->insert("antennaPath", QJsonValue(antenna_path));
253  }
254  if(m_ext_clock_isSet){
255  obj->insert("extClock", QJsonValue(ext_clock));
256  }
258  obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
259  }
261  obj->insert("transverterMode", QJsonValue(transverter_mode));
262  }
264  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
265  }
266  if(m_gpio_dir_isSet){
267  obj->insert("gpioDir", QJsonValue(gpio_dir));
268  }
269  if(m_gpio_pins_isSet){
270  obj->insert("gpioPins", QJsonValue(gpio_pins));
271  }
273  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
274  }
275  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
276  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
277  }
279  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
280  }
282  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
283  }
284 
285  return obj;
286 }
287 
288 qint64
290  return center_frequency;
291 }
292 void
294  this->center_frequency = center_frequency;
295  this->m_center_frequency_isSet = true;
296 }
297 
298 qint32
300  return dev_sample_rate;
301 }
302 void
304  this->dev_sample_rate = dev_sample_rate;
305  this->m_dev_sample_rate_isSet = true;
306 }
307 
308 qint32
310  return log2_hard_interp;
311 }
312 void
314  this->log2_hard_interp = log2_hard_interp;
315  this->m_log2_hard_interp_isSet = true;
316 }
317 
318 qint32
320  return log2_soft_interp;
321 }
322 void
324  this->log2_soft_interp = log2_soft_interp;
325  this->m_log2_soft_interp_isSet = true;
326 }
327 
328 qint32
330  return lpf_bw;
331 }
332 void
334  this->lpf_bw = lpf_bw;
335  this->m_lpf_bw_isSet = true;
336 }
337 
338 qint32
340  return lpf_fir_enable;
341 }
342 void
344  this->lpf_fir_enable = lpf_fir_enable;
345  this->m_lpf_fir_enable_isSet = true;
346 }
347 
348 qint32
350  return lpf_firbw;
351 }
352 void
354  this->lpf_firbw = lpf_firbw;
355  this->m_lpf_firbw_isSet = true;
356 }
357 
358 qint32
360  return gain;
361 }
362 void
364  this->gain = gain;
365  this->m_gain_isSet = true;
366 }
367 
368 qint32
370  return nco_enable;
371 }
372 void
374  this->nco_enable = nco_enable;
375  this->m_nco_enable_isSet = true;
376 }
377 
378 qint32
380  return nco_frequency;
381 }
382 void
384  this->nco_frequency = nco_frequency;
385  this->m_nco_frequency_isSet = true;
386 }
387 
388 qint32
390  return antenna_path;
391 }
392 void
394  this->antenna_path = antenna_path;
395  this->m_antenna_path_isSet = true;
396 }
397 
398 qint32
400  return ext_clock;
401 }
402 void
404  this->ext_clock = ext_clock;
405  this->m_ext_clock_isSet = true;
406 }
407 
408 qint32
410  return ext_clock_freq;
411 }
412 void
414  this->ext_clock_freq = ext_clock_freq;
415  this->m_ext_clock_freq_isSet = true;
416 }
417 
418 qint32
420  return transverter_mode;
421 }
422 void
424  this->transverter_mode = transverter_mode;
425  this->m_transverter_mode_isSet = true;
426 }
427 
428 qint64
431 }
432 void
434  this->transverter_delta_frequency = transverter_delta_frequency;
436 }
437 
438 qint32
440  return gpio_dir;
441 }
442 void
444  this->gpio_dir = gpio_dir;
445  this->m_gpio_dir_isSet = true;
446 }
447 
448 qint32
450  return gpio_pins;
451 }
452 void
454  this->gpio_pins = gpio_pins;
455  this->m_gpio_pins_isSet = true;
456 }
457 
458 qint32
460  return use_reverse_api;
461 }
462 void
464  this->use_reverse_api = use_reverse_api;
465  this->m_use_reverse_api_isSet = true;
466 }
467 
468 QString*
470  return reverse_api_address;
471 }
472 void
474  this->reverse_api_address = reverse_api_address;
475  this->m_reverse_api_address_isSet = true;
476 }
477 
478 qint32
480  return reverse_api_port;
481 }
482 void
484  this->reverse_api_port = reverse_api_port;
485  this->m_reverse_api_port_isSet = true;
486 }
487 
488 qint32
491 }
492 void
494  this->reverse_api_device_index = reverse_api_device_index;
496 }
497 
498 
499 bool
501  bool isObjectUpdated = false;
502  do{
503  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
504  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
505  if(m_log2_hard_interp_isSet){ isObjectUpdated = true; break;}
506  if(m_log2_soft_interp_isSet){ isObjectUpdated = true; break;}
507  if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
508  if(m_lpf_fir_enable_isSet){ isObjectUpdated = true; break;}
509  if(m_lpf_firbw_isSet){ isObjectUpdated = true; break;}
510  if(m_gain_isSet){ isObjectUpdated = true; break;}
511  if(m_nco_enable_isSet){ isObjectUpdated = true; break;}
512  if(m_nco_frequency_isSet){ isObjectUpdated = true; break;}
513  if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
514  if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
515  if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
516  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
517  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
518  if(m_gpio_dir_isSet){ isObjectUpdated = true; break;}
519  if(m_gpio_pins_isSet){ isObjectUpdated = true; break;}
520  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
521  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
522  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
523  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
524  }while(false);
525  return isObjectUpdated;
526 }
527 }
528 
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiAddress(QString *reverse_api_address)
void setLog2SoftInterp(qint32 log2_soft_interp)
virtual QJsonObject * asJsonObject() override
virtual SWGLimeSdrOutputSettings * fromJson(QString &jsonString) override
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setLog2HardInterp(qint32 log2_hard_interp)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual void fromJsonObject(QJsonObject &json) override
void setReverseApiPort(qint32 reverse_api_port)
void setCenterFrequency(qint64 center_frequency)
void setTransverterMode(qint32 transverter_mode)