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.
SWGPlutoSdrInputSettings.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  l_oppm_tenths = 0;
36  m_l_oppm_tenths_isSet = false;
37  lpf_fir_enable = 0;
38  m_lpf_fir_enable_isSet = false;
39  lpf_firbw = 0;
40  m_lpf_firbw_isSet = false;
43  lpf_fir_gain = 0;
44  m_lpf_fir_gain_isSet = false;
45  fc_pos = 0;
46  m_fc_pos_isSet = false;
47  dc_block = 0;
48  m_dc_block_isSet = false;
49  iq_correction = 0;
50  m_iq_correction_isSet = false;
51  hw_bbdc_block = 0;
52  m_hw_bbdc_block_isSet = false;
53  hw_rfdc_block = 0;
54  m_hw_rfdc_block_isSet = false;
55  hw_iq_correction = 0;
57  log2_decim = 0;
58  m_log2_decim_isSet = false;
59  lpf_bw = 0;
60  m_lpf_bw_isSet = false;
61  gain = 0;
62  m_gain_isSet = false;
63  antenna_path = 0;
64  m_antenna_path_isSet = false;
65  gain_mode = 0;
66  m_gain_mode_isSet = false;
67  transverter_mode = 0;
71  file_record_name = nullptr;
73  use_reverse_api = 0;
75  reverse_api_address = nullptr;
77  reverse_api_port = 0;
81 }
82 
84  this->cleanup();
85 }
86 
87 void
89  center_frequency = 0L;
91  dev_sample_rate = 0;
93  l_oppm_tenths = 0;
94  m_l_oppm_tenths_isSet = false;
95  lpf_fir_enable = 0;
96  m_lpf_fir_enable_isSet = false;
97  lpf_firbw = 0;
98  m_lpf_firbw_isSet = false;
101  lpf_fir_gain = 0;
102  m_lpf_fir_gain_isSet = false;
103  fc_pos = 0;
104  m_fc_pos_isSet = false;
105  dc_block = 0;
106  m_dc_block_isSet = false;
107  iq_correction = 0;
108  m_iq_correction_isSet = false;
109  hw_bbdc_block = 0;
110  m_hw_bbdc_block_isSet = false;
111  hw_rfdc_block = 0;
112  m_hw_rfdc_block_isSet = false;
113  hw_iq_correction = 0;
114  m_hw_iq_correction_isSet = false;
115  log2_decim = 0;
116  m_log2_decim_isSet = false;
117  lpf_bw = 0;
118  m_lpf_bw_isSet = false;
119  gain = 0;
120  m_gain_isSet = false;
121  antenna_path = 0;
122  m_antenna_path_isSet = false;
123  gain_mode = 0;
124  m_gain_mode_isSet = false;
125  transverter_mode = 0;
126  m_transverter_mode_isSet = false;
129  file_record_name = new QString("");
130  m_file_record_name_isSet = false;
131  use_reverse_api = 0;
132  m_use_reverse_api_isSet = false;
133  reverse_api_address = new QString("");
135  reverse_api_port = 0;
136  m_reverse_api_port_isSet = false;
139 }
140 
141 void
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163  if(file_record_name != nullptr) {
164  delete file_record_name;
165  }
166 
167  if(reverse_api_address != nullptr) {
168  delete reverse_api_address;
169  }
170 
171 
172 }
173 
176  QByteArray array (json.toStdString().c_str());
177  QJsonDocument doc = QJsonDocument::fromJson(array);
178  QJsonObject jsonObject = doc.object();
179  this->fromJsonObject(jsonObject);
180  return this;
181 }
182 
183 void
185  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
186 
187  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
188 
189  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
190 
191  ::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", "");
192 
193  ::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", "");
194 
195  ::SWGSDRangel::setValue(&lpf_fi_rlog2_decim, pJson["lpfFIRlog2Decim"], "qint32", "");
196 
197  ::SWGSDRangel::setValue(&lpf_fir_gain, pJson["lpfFIRGain"], "qint32", "");
198 
199  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
200 
201  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
202 
203  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
204 
205  ::SWGSDRangel::setValue(&hw_bbdc_block, pJson["hwBBDCBlock"], "qint32", "");
206 
207  ::SWGSDRangel::setValue(&hw_rfdc_block, pJson["hwRFDCBlock"], "qint32", "");
208 
209  ::SWGSDRangel::setValue(&hw_iq_correction, pJson["hwIQCorrection"], "qint32", "");
210 
211  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
212 
213  ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
214 
215  ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
216 
217  ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
218 
219  ::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", "");
220 
221  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
222 
223  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
224 
225  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
226 
227  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
228 
229  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
230 
231  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
232 
233  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
234 
235 }
236 
237 QString
239 {
240  QJsonObject* obj = this->asJsonObject();
241 
242  QJsonDocument doc(*obj);
243  QByteArray bytes = doc.toJson();
244  delete obj;
245  return QString(bytes);
246 }
247 
248 QJsonObject*
250  QJsonObject* obj = new QJsonObject();
252  obj->insert("centerFrequency", QJsonValue(center_frequency));
253  }
255  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
256  }
258  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
259  }
261  obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
262  }
263  if(m_lpf_firbw_isSet){
264  obj->insert("lpfFIRBW", QJsonValue(lpf_firbw));
265  }
267  obj->insert("lpfFIRlog2Decim", QJsonValue(lpf_fi_rlog2_decim));
268  }
270  obj->insert("lpfFIRGain", QJsonValue(lpf_fir_gain));
271  }
272  if(m_fc_pos_isSet){
273  obj->insert("fcPos", QJsonValue(fc_pos));
274  }
275  if(m_dc_block_isSet){
276  obj->insert("dcBlock", QJsonValue(dc_block));
277  }
279  obj->insert("iqCorrection", QJsonValue(iq_correction));
280  }
282  obj->insert("hwBBDCBlock", QJsonValue(hw_bbdc_block));
283  }
285  obj->insert("hwRFDCBlock", QJsonValue(hw_rfdc_block));
286  }
288  obj->insert("hwIQCorrection", QJsonValue(hw_iq_correction));
289  }
290  if(m_log2_decim_isSet){
291  obj->insert("log2Decim", QJsonValue(log2_decim));
292  }
293  if(m_lpf_bw_isSet){
294  obj->insert("lpfBW", QJsonValue(lpf_bw));
295  }
296  if(m_gain_isSet){
297  obj->insert("gain", QJsonValue(gain));
298  }
300  obj->insert("antennaPath", QJsonValue(antenna_path));
301  }
302  if(m_gain_mode_isSet){
303  obj->insert("gainMode", QJsonValue(gain_mode));
304  }
306  obj->insert("transverterMode", QJsonValue(transverter_mode));
307  }
309  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
310  }
311  if(file_record_name != nullptr && *file_record_name != QString("")){
312  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
313  }
315  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
316  }
317  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
318  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
319  }
321  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
322  }
324  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
325  }
326 
327  return obj;
328 }
329 
330 qint64
332  return center_frequency;
333 }
334 void
336  this->center_frequency = center_frequency;
337  this->m_center_frequency_isSet = true;
338 }
339 
340 qint32
342  return dev_sample_rate;
343 }
344 void
346  this->dev_sample_rate = dev_sample_rate;
347  this->m_dev_sample_rate_isSet = true;
348 }
349 
350 qint32
352  return l_oppm_tenths;
353 }
354 void
356  this->l_oppm_tenths = l_oppm_tenths;
357  this->m_l_oppm_tenths_isSet = true;
358 }
359 
360 qint32
362  return lpf_fir_enable;
363 }
364 void
366  this->lpf_fir_enable = lpf_fir_enable;
367  this->m_lpf_fir_enable_isSet = true;
368 }
369 
370 qint32
372  return lpf_firbw;
373 }
374 void
376  this->lpf_firbw = lpf_firbw;
377  this->m_lpf_firbw_isSet = true;
378 }
379 
380 qint32
382  return lpf_fi_rlog2_decim;
383 }
384 void
386  this->lpf_fi_rlog2_decim = lpf_fi_rlog2_decim;
387  this->m_lpf_fi_rlog2_decim_isSet = true;
388 }
389 
390 qint32
392  return lpf_fir_gain;
393 }
394 void
396  this->lpf_fir_gain = lpf_fir_gain;
397  this->m_lpf_fir_gain_isSet = true;
398 }
399 
400 qint32
402  return fc_pos;
403 }
404 void
406  this->fc_pos = fc_pos;
407  this->m_fc_pos_isSet = true;
408 }
409 
410 qint32
412  return dc_block;
413 }
414 void
416  this->dc_block = dc_block;
417  this->m_dc_block_isSet = true;
418 }
419 
420 qint32
422  return iq_correction;
423 }
424 void
426  this->iq_correction = iq_correction;
427  this->m_iq_correction_isSet = true;
428 }
429 
430 qint32
432  return hw_bbdc_block;
433 }
434 void
436  this->hw_bbdc_block = hw_bbdc_block;
437  this->m_hw_bbdc_block_isSet = true;
438 }
439 
440 qint32
442  return hw_rfdc_block;
443 }
444 void
446  this->hw_rfdc_block = hw_rfdc_block;
447  this->m_hw_rfdc_block_isSet = true;
448 }
449 
450 qint32
452  return hw_iq_correction;
453 }
454 void
456  this->hw_iq_correction = hw_iq_correction;
457  this->m_hw_iq_correction_isSet = true;
458 }
459 
460 qint32
462  return log2_decim;
463 }
464 void
466  this->log2_decim = log2_decim;
467  this->m_log2_decim_isSet = true;
468 }
469 
470 qint32
472  return lpf_bw;
473 }
474 void
476  this->lpf_bw = lpf_bw;
477  this->m_lpf_bw_isSet = true;
478 }
479 
480 qint32
482  return gain;
483 }
484 void
486  this->gain = gain;
487  this->m_gain_isSet = true;
488 }
489 
490 qint32
492  return antenna_path;
493 }
494 void
496  this->antenna_path = antenna_path;
497  this->m_antenna_path_isSet = true;
498 }
499 
500 qint32
502  return gain_mode;
503 }
504 void
506  this->gain_mode = gain_mode;
507  this->m_gain_mode_isSet = true;
508 }
509 
510 qint32
512  return transverter_mode;
513 }
514 void
516  this->transverter_mode = transverter_mode;
517  this->m_transverter_mode_isSet = true;
518 }
519 
520 qint64
523 }
524 void
526  this->transverter_delta_frequency = transverter_delta_frequency;
528 }
529 
530 QString*
532  return file_record_name;
533 }
534 void
536  this->file_record_name = file_record_name;
537  this->m_file_record_name_isSet = true;
538 }
539 
540 qint32
542  return use_reverse_api;
543 }
544 void
546  this->use_reverse_api = use_reverse_api;
547  this->m_use_reverse_api_isSet = true;
548 }
549 
550 QString*
552  return reverse_api_address;
553 }
554 void
556  this->reverse_api_address = reverse_api_address;
557  this->m_reverse_api_address_isSet = true;
558 }
559 
560 qint32
562  return reverse_api_port;
563 }
564 void
566  this->reverse_api_port = reverse_api_port;
567  this->m_reverse_api_port_isSet = true;
568 }
569 
570 qint32
573 }
574 void
576  this->reverse_api_device_index = reverse_api_device_index;
578 }
579 
580 
581 bool
583  bool isObjectUpdated = false;
584  do{
585  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
586  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
587  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
588  if(m_lpf_fir_enable_isSet){ isObjectUpdated = true; break;}
589  if(m_lpf_firbw_isSet){ isObjectUpdated = true; break;}
590  if(m_lpf_fi_rlog2_decim_isSet){ isObjectUpdated = true; break;}
591  if(m_lpf_fir_gain_isSet){ isObjectUpdated = true; break;}
592  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
593  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
594  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
595  if(m_hw_bbdc_block_isSet){ isObjectUpdated = true; break;}
596  if(m_hw_rfdc_block_isSet){ isObjectUpdated = true; break;}
597  if(m_hw_iq_correction_isSet){ isObjectUpdated = true; break;}
598  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
599  if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
600  if(m_gain_isSet){ isObjectUpdated = true; break;}
601  if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
602  if(m_gain_mode_isSet){ isObjectUpdated = true; break;}
603  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
604  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
605  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
606  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
607  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
608  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
609  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
610  }while(false);
611  return isObjectUpdated;
612 }
613 }
614 
virtual QJsonObject * asJsonObject() override
virtual SWGPlutoSdrInputSettings * fromJson(QString &jsonString) override
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 setHwIqCorrection(qint32 hw_iq_correction)
void setLpfFiRlog2Decim(qint32 lpf_fi_rlog2_decim)
void setReverseApiPort(qint32 reverse_api_port)
void setFileRecordName(QString *file_record_name)
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setCenterFrequency(qint64 center_frequency)
virtual void fromJsonObject(QJsonObject &json) override
void setTransverterMode(qint32 transverter_mode)