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.
SWGLimeSdrInputSettings.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_decim = 0;
37  dc_block = 0;
38  m_dc_block_isSet = false;
39  iq_correction = 0;
40  m_iq_correction_isSet = false;
41  log2_soft_decim = 0;
43  lpf_bw = 0;
44  m_lpf_bw_isSet = false;
45  lpf_fir_enable = 0;
46  m_lpf_fir_enable_isSet = false;
47  lpf_firbw = 0;
48  m_lpf_firbw_isSet = false;
49  gain = 0;
50  m_gain_isSet = false;
51  nco_enable = 0;
52  m_nco_enable_isSet = false;
53  nco_frequency = 0;
54  m_nco_frequency_isSet = false;
55  antenna_path = 0;
56  m_antenna_path_isSet = false;
57  gain_mode = 0;
58  m_gain_mode_isSet = false;
59  lna_gain = 0;
60  m_lna_gain_isSet = false;
61  tia_gain = 0;
62  m_tia_gain_isSet = false;
63  pga_gain = 0;
64  m_pga_gain_isSet = false;
65  ext_clock = 0;
66  m_ext_clock_isSet = false;
67  ext_clock_freq = 0;
68  m_ext_clock_freq_isSet = false;
69  transverter_mode = 0;
73  file_record_name = nullptr;
75  gpio_dir = 0;
76  m_gpio_dir_isSet = false;
77  gpio_pins = 0;
78  m_gpio_pins_isSet = false;
79  use_reverse_api = 0;
81  reverse_api_address = nullptr;
83  reverse_api_port = 0;
87 }
88 
90  this->cleanup();
91 }
92 
93 void
95  center_frequency = 0L;
97  dev_sample_rate = 0;
99  log2_hard_decim = 0;
100  m_log2_hard_decim_isSet = false;
101  dc_block = 0;
102  m_dc_block_isSet = false;
103  iq_correction = 0;
104  m_iq_correction_isSet = false;
105  log2_soft_decim = 0;
106  m_log2_soft_decim_isSet = false;
107  lpf_bw = 0;
108  m_lpf_bw_isSet = false;
109  lpf_fir_enable = 0;
110  m_lpf_fir_enable_isSet = false;
111  lpf_firbw = 0;
112  m_lpf_firbw_isSet = false;
113  gain = 0;
114  m_gain_isSet = false;
115  nco_enable = 0;
116  m_nco_enable_isSet = false;
117  nco_frequency = 0;
118  m_nco_frequency_isSet = false;
119  antenna_path = 0;
120  m_antenna_path_isSet = false;
121  gain_mode = 0;
122  m_gain_mode_isSet = false;
123  lna_gain = 0;
124  m_lna_gain_isSet = false;
125  tia_gain = 0;
126  m_tia_gain_isSet = false;
127  pga_gain = 0;
128  m_pga_gain_isSet = false;
129  ext_clock = 0;
130  m_ext_clock_isSet = false;
131  ext_clock_freq = 0;
132  m_ext_clock_freq_isSet = false;
133  transverter_mode = 0;
134  m_transverter_mode_isSet = false;
137  file_record_name = new QString("");
138  m_file_record_name_isSet = false;
139  gpio_dir = 0;
140  m_gpio_dir_isSet = false;
141  gpio_pins = 0;
142  m_gpio_pins_isSet = false;
143  use_reverse_api = 0;
144  m_use_reverse_api_isSet = false;
145  reverse_api_address = new QString("");
147  reverse_api_port = 0;
148  m_reverse_api_port_isSet = false;
151 }
152 
153 void
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165 
166 
167 
168 
169 
170 
171 
172 
173 
174 
175 
176  if(file_record_name != nullptr) {
177  delete file_record_name;
178  }
179 
180 
181 
182  if(reverse_api_address != nullptr) {
183  delete reverse_api_address;
184  }
185 
186 
187 }
188 
191  QByteArray array (json.toStdString().c_str());
192  QJsonDocument doc = QJsonDocument::fromJson(array);
193  QJsonObject jsonObject = doc.object();
194  this->fromJsonObject(jsonObject);
195  return this;
196 }
197 
198 void
200  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
201 
202  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
203 
204  ::SWGSDRangel::setValue(&log2_hard_decim, pJson["log2HardDecim"], "qint32", "");
205 
206  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
207 
208  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
209 
210  ::SWGSDRangel::setValue(&log2_soft_decim, pJson["log2SoftDecim"], "qint32", "");
211 
212  ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
213 
214  ::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", "");
215 
216  ::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", "");
217 
218  ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
219 
220  ::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", "");
221 
222  ::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", "");
223 
224  ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
225 
226  ::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", "");
227 
228  ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
229 
230  ::SWGSDRangel::setValue(&tia_gain, pJson["tiaGain"], "qint32", "");
231 
232  ::SWGSDRangel::setValue(&pga_gain, pJson["pgaGain"], "qint32", "");
233 
234  ::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", "");
235 
236  ::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
237 
238  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
239 
240  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
241 
242  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
243 
244  ::SWGSDRangel::setValue(&gpio_dir, pJson["gpioDir"], "qint32", "");
245 
246  ::SWGSDRangel::setValue(&gpio_pins, pJson["gpioPins"], "qint32", "");
247 
248  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
249 
250  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
251 
252  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
253 
254  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
255 
256 }
257 
258 QString
260 {
261  QJsonObject* obj = this->asJsonObject();
262 
263  QJsonDocument doc(*obj);
264  QByteArray bytes = doc.toJson();
265  delete obj;
266  return QString(bytes);
267 }
268 
269 QJsonObject*
271  QJsonObject* obj = new QJsonObject();
273  obj->insert("centerFrequency", QJsonValue(center_frequency));
274  }
276  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
277  }
279  obj->insert("log2HardDecim", QJsonValue(log2_hard_decim));
280  }
281  if(m_dc_block_isSet){
282  obj->insert("dcBlock", QJsonValue(dc_block));
283  }
285  obj->insert("iqCorrection", QJsonValue(iq_correction));
286  }
288  obj->insert("log2SoftDecim", QJsonValue(log2_soft_decim));
289  }
290  if(m_lpf_bw_isSet){
291  obj->insert("lpfBW", QJsonValue(lpf_bw));
292  }
294  obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
295  }
296  if(m_lpf_firbw_isSet){
297  obj->insert("lpfFIRBW", QJsonValue(lpf_firbw));
298  }
299  if(m_gain_isSet){
300  obj->insert("gain", QJsonValue(gain));
301  }
302  if(m_nco_enable_isSet){
303  obj->insert("ncoEnable", QJsonValue(nco_enable));
304  }
306  obj->insert("ncoFrequency", QJsonValue(nco_frequency));
307  }
309  obj->insert("antennaPath", QJsonValue(antenna_path));
310  }
311  if(m_gain_mode_isSet){
312  obj->insert("gainMode", QJsonValue(gain_mode));
313  }
314  if(m_lna_gain_isSet){
315  obj->insert("lnaGain", QJsonValue(lna_gain));
316  }
317  if(m_tia_gain_isSet){
318  obj->insert("tiaGain", QJsonValue(tia_gain));
319  }
320  if(m_pga_gain_isSet){
321  obj->insert("pgaGain", QJsonValue(pga_gain));
322  }
323  if(m_ext_clock_isSet){
324  obj->insert("extClock", QJsonValue(ext_clock));
325  }
327  obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
328  }
330  obj->insert("transverterMode", QJsonValue(transverter_mode));
331  }
333  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
334  }
335  if(file_record_name != nullptr && *file_record_name != QString("")){
336  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
337  }
338  if(m_gpio_dir_isSet){
339  obj->insert("gpioDir", QJsonValue(gpio_dir));
340  }
341  if(m_gpio_pins_isSet){
342  obj->insert("gpioPins", QJsonValue(gpio_pins));
343  }
345  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
346  }
347  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
348  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
349  }
351  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
352  }
354  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
355  }
356 
357  return obj;
358 }
359 
360 qint64
362  return center_frequency;
363 }
364 void
366  this->center_frequency = center_frequency;
367  this->m_center_frequency_isSet = true;
368 }
369 
370 qint32
372  return dev_sample_rate;
373 }
374 void
376  this->dev_sample_rate = dev_sample_rate;
377  this->m_dev_sample_rate_isSet = true;
378 }
379 
380 qint32
382  return log2_hard_decim;
383 }
384 void
386  this->log2_hard_decim = log2_hard_decim;
387  this->m_log2_hard_decim_isSet = true;
388 }
389 
390 qint32
392  return dc_block;
393 }
394 void
396  this->dc_block = dc_block;
397  this->m_dc_block_isSet = true;
398 }
399 
400 qint32
402  return iq_correction;
403 }
404 void
406  this->iq_correction = iq_correction;
407  this->m_iq_correction_isSet = true;
408 }
409 
410 qint32
412  return log2_soft_decim;
413 }
414 void
416  this->log2_soft_decim = log2_soft_decim;
417  this->m_log2_soft_decim_isSet = true;
418 }
419 
420 qint32
422  return lpf_bw;
423 }
424 void
426  this->lpf_bw = lpf_bw;
427  this->m_lpf_bw_isSet = true;
428 }
429 
430 qint32
432  return lpf_fir_enable;
433 }
434 void
436  this->lpf_fir_enable = lpf_fir_enable;
437  this->m_lpf_fir_enable_isSet = true;
438 }
439 
440 qint32
442  return lpf_firbw;
443 }
444 void
446  this->lpf_firbw = lpf_firbw;
447  this->m_lpf_firbw_isSet = true;
448 }
449 
450 qint32
452  return gain;
453 }
454 void
456  this->gain = gain;
457  this->m_gain_isSet = true;
458 }
459 
460 qint32
462  return nco_enable;
463 }
464 void
466  this->nco_enable = nco_enable;
467  this->m_nco_enable_isSet = true;
468 }
469 
470 qint32
472  return nco_frequency;
473 }
474 void
476  this->nco_frequency = nco_frequency;
477  this->m_nco_frequency_isSet = true;
478 }
479 
480 qint32
482  return antenna_path;
483 }
484 void
486  this->antenna_path = antenna_path;
487  this->m_antenna_path_isSet = true;
488 }
489 
490 qint32
492  return gain_mode;
493 }
494 void
496  this->gain_mode = gain_mode;
497  this->m_gain_mode_isSet = true;
498 }
499 
500 qint32
502  return lna_gain;
503 }
504 void
506  this->lna_gain = lna_gain;
507  this->m_lna_gain_isSet = true;
508 }
509 
510 qint32
512  return tia_gain;
513 }
514 void
516  this->tia_gain = tia_gain;
517  this->m_tia_gain_isSet = true;
518 }
519 
520 qint32
522  return pga_gain;
523 }
524 void
526  this->pga_gain = pga_gain;
527  this->m_pga_gain_isSet = true;
528 }
529 
530 qint32
532  return ext_clock;
533 }
534 void
536  this->ext_clock = ext_clock;
537  this->m_ext_clock_isSet = true;
538 }
539 
540 qint32
542  return ext_clock_freq;
543 }
544 void
546  this->ext_clock_freq = ext_clock_freq;
547  this->m_ext_clock_freq_isSet = true;
548 }
549 
550 qint32
552  return transverter_mode;
553 }
554 void
556  this->transverter_mode = transverter_mode;
557  this->m_transverter_mode_isSet = true;
558 }
559 
560 qint64
563 }
564 void
566  this->transverter_delta_frequency = transverter_delta_frequency;
568 }
569 
570 QString*
572  return file_record_name;
573 }
574 void
576  this->file_record_name = file_record_name;
577  this->m_file_record_name_isSet = true;
578 }
579 
580 qint32
582  return gpio_dir;
583 }
584 void
586  this->gpio_dir = gpio_dir;
587  this->m_gpio_dir_isSet = true;
588 }
589 
590 qint32
592  return gpio_pins;
593 }
594 void
596  this->gpio_pins = gpio_pins;
597  this->m_gpio_pins_isSet = true;
598 }
599 
600 qint32
602  return use_reverse_api;
603 }
604 void
606  this->use_reverse_api = use_reverse_api;
607  this->m_use_reverse_api_isSet = true;
608 }
609 
610 QString*
612  return reverse_api_address;
613 }
614 void
616  this->reverse_api_address = reverse_api_address;
617  this->m_reverse_api_address_isSet = true;
618 }
619 
620 qint32
622  return reverse_api_port;
623 }
624 void
626  this->reverse_api_port = reverse_api_port;
627  this->m_reverse_api_port_isSet = true;
628 }
629 
630 qint32
633 }
634 void
636  this->reverse_api_device_index = reverse_api_device_index;
638 }
639 
640 
641 bool
643  bool isObjectUpdated = false;
644  do{
645  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
646  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
647  if(m_log2_hard_decim_isSet){ isObjectUpdated = true; break;}
648  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
649  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
650  if(m_log2_soft_decim_isSet){ isObjectUpdated = true; break;}
651  if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
652  if(m_lpf_fir_enable_isSet){ isObjectUpdated = true; break;}
653  if(m_lpf_firbw_isSet){ isObjectUpdated = true; break;}
654  if(m_gain_isSet){ isObjectUpdated = true; break;}
655  if(m_nco_enable_isSet){ isObjectUpdated = true; break;}
656  if(m_nco_frequency_isSet){ isObjectUpdated = true; break;}
657  if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
658  if(m_gain_mode_isSet){ isObjectUpdated = true; break;}
659  if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
660  if(m_tia_gain_isSet){ isObjectUpdated = true; break;}
661  if(m_pga_gain_isSet){ isObjectUpdated = true; break;}
662  if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
663  if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
664  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
665  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
666  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
667  if(m_gpio_dir_isSet){ isObjectUpdated = true; break;}
668  if(m_gpio_pins_isSet){ isObjectUpdated = true; break;}
669  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
670  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
671  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
672  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
673  }while(false);
674  return isObjectUpdated;
675 }
676 }
677 
void setReverseApiAddress(QString *reverse_api_address)
void setDevSampleRate(qint32 dev_sample_rate)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual QJsonObject * asJsonObject() override
void setCenterFrequency(qint64 center_frequency)
void setUseReverseApi(qint32 use_reverse_api)
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setLog2SoftDecim(qint32 log2_soft_decim)
void setFileRecordName(QString *file_record_name)
virtual SWGLimeSdrInputSettings * fromJson(QString &jsonString) override
void setLog2HardDecim(qint32 log2_hard_decim)
void setTransverterMode(qint32 transverter_mode)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual void fromJsonObject(QJsonObject &json) override
void setReverseApiPort(qint32 reverse_api_port)