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.
SWGXtrxInputSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGXtrxInputSettings.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 
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  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  gain_mode = 0;
54  m_gain_mode_isSet = false;
55  lna_gain = 0;
56  m_lna_gain_isSet = false;
57  tia_gain = 0;
58  m_tia_gain_isSet = false;
59  pga_gain = 0;
60  m_pga_gain_isSet = false;
61  ext_clock = 0;
62  m_ext_clock_isSet = false;
63  ext_clock_freq = 0;
64  m_ext_clock_freq_isSet = false;
65  pwrmode = 0;
66  m_pwrmode_isSet = false;
67  file_record_name = nullptr;
69  use_reverse_api = 0;
71  reverse_api_address = nullptr;
73  reverse_api_port = 0;
77 }
78 
80  this->cleanup();
81 }
82 
83 void
85  center_frequency = 0L;
87  dev_sample_rate = 0;
89  log2_hard_decim = 0;
91  dc_block = 0;
92  m_dc_block_isSet = false;
93  iq_correction = 0;
94  m_iq_correction_isSet = false;
95  log2_soft_decim = 0;
97  lpf_bw = 0;
98  m_lpf_bw_isSet = false;
99  gain = 0;
100  m_gain_isSet = false;
101  nco_enable = 0;
102  m_nco_enable_isSet = false;
103  nco_frequency = 0;
104  m_nco_frequency_isSet = false;
105  antenna_path = 0;
106  m_antenna_path_isSet = false;
107  gain_mode = 0;
108  m_gain_mode_isSet = false;
109  lna_gain = 0;
110  m_lna_gain_isSet = false;
111  tia_gain = 0;
112  m_tia_gain_isSet = false;
113  pga_gain = 0;
114  m_pga_gain_isSet = false;
115  ext_clock = 0;
116  m_ext_clock_isSet = false;
117  ext_clock_freq = 0;
118  m_ext_clock_freq_isSet = false;
119  pwrmode = 0;
120  m_pwrmode_isSet = false;
121  file_record_name = new QString("");
122  m_file_record_name_isSet = false;
123  use_reverse_api = 0;
124  m_use_reverse_api_isSet = false;
125  reverse_api_address = new QString("");
127  reverse_api_port = 0;
128  m_reverse_api_port_isSet = false;
131 }
132 
133 void
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153  if(file_record_name != nullptr) {
154  delete file_record_name;
155  }
156 
157  if(reverse_api_address != nullptr) {
158  delete reverse_api_address;
159  }
160 
161 
162 }
163 
166  QByteArray array (json.toStdString().c_str());
167  QJsonDocument doc = QJsonDocument::fromJson(array);
168  QJsonObject jsonObject = doc.object();
169  this->fromJsonObject(jsonObject);
170  return this;
171 }
172 
173 void
175  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
176 
177  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
178 
179  ::SWGSDRangel::setValue(&log2_hard_decim, pJson["log2HardDecim"], "qint32", "");
180 
181  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
182 
183  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
184 
185  ::SWGSDRangel::setValue(&log2_soft_decim, pJson["log2SoftDecim"], "qint32", "");
186 
187  ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
188 
189  ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
190 
191  ::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", "");
192 
193  ::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", "");
194 
195  ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
196 
197  ::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", "");
198 
199  ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
200 
201  ::SWGSDRangel::setValue(&tia_gain, pJson["tiaGain"], "qint32", "");
202 
203  ::SWGSDRangel::setValue(&pga_gain, pJson["pgaGain"], "qint32", "");
204 
205  ::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", "");
206 
207  ::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
208 
209  ::SWGSDRangel::setValue(&pwrmode, pJson["pwrmode"], "qint32", "");
210 
211  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
212 
213  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
214 
215  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
216 
217  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
218 
219  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
220 
221 }
222 
223 QString
225 {
226  QJsonObject* obj = this->asJsonObject();
227 
228  QJsonDocument doc(*obj);
229  QByteArray bytes = doc.toJson();
230  delete obj;
231  return QString(bytes);
232 }
233 
234 QJsonObject*
236  QJsonObject* obj = new QJsonObject();
238  obj->insert("centerFrequency", QJsonValue(center_frequency));
239  }
241  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
242  }
244  obj->insert("log2HardDecim", QJsonValue(log2_hard_decim));
245  }
246  if(m_dc_block_isSet){
247  obj->insert("dcBlock", QJsonValue(dc_block));
248  }
250  obj->insert("iqCorrection", QJsonValue(iq_correction));
251  }
253  obj->insert("log2SoftDecim", QJsonValue(log2_soft_decim));
254  }
255  if(m_lpf_bw_isSet){
256  obj->insert("lpfBW", QJsonValue(lpf_bw));
257  }
258  if(m_gain_isSet){
259  obj->insert("gain", QJsonValue(gain));
260  }
261  if(m_nco_enable_isSet){
262  obj->insert("ncoEnable", QJsonValue(nco_enable));
263  }
265  obj->insert("ncoFrequency", QJsonValue(nco_frequency));
266  }
268  obj->insert("antennaPath", QJsonValue(antenna_path));
269  }
270  if(m_gain_mode_isSet){
271  obj->insert("gainMode", QJsonValue(gain_mode));
272  }
273  if(m_lna_gain_isSet){
274  obj->insert("lnaGain", QJsonValue(lna_gain));
275  }
276  if(m_tia_gain_isSet){
277  obj->insert("tiaGain", QJsonValue(tia_gain));
278  }
279  if(m_pga_gain_isSet){
280  obj->insert("pgaGain", QJsonValue(pga_gain));
281  }
282  if(m_ext_clock_isSet){
283  obj->insert("extClock", QJsonValue(ext_clock));
284  }
286  obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
287  }
288  if(m_pwrmode_isSet){
289  obj->insert("pwrmode", QJsonValue(pwrmode));
290  }
291  if(file_record_name != nullptr && *file_record_name != QString("")){
292  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
293  }
295  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
296  }
297  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
298  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
299  }
301  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
302  }
304  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
305  }
306 
307  return obj;
308 }
309 
310 qint64
312  return center_frequency;
313 }
314 void
316  this->center_frequency = center_frequency;
317  this->m_center_frequency_isSet = true;
318 }
319 
320 qint32
322  return dev_sample_rate;
323 }
324 void
326  this->dev_sample_rate = dev_sample_rate;
327  this->m_dev_sample_rate_isSet = true;
328 }
329 
330 qint32
332  return log2_hard_decim;
333 }
334 void
336  this->log2_hard_decim = log2_hard_decim;
337  this->m_log2_hard_decim_isSet = true;
338 }
339 
340 qint32
342  return dc_block;
343 }
344 void
346  this->dc_block = dc_block;
347  this->m_dc_block_isSet = true;
348 }
349 
350 qint32
352  return iq_correction;
353 }
354 void
356  this->iq_correction = iq_correction;
357  this->m_iq_correction_isSet = true;
358 }
359 
360 qint32
362  return log2_soft_decim;
363 }
364 void
366  this->log2_soft_decim = log2_soft_decim;
367  this->m_log2_soft_decim_isSet = true;
368 }
369 
370 qint32
372  return lpf_bw;
373 }
374 void
376  this->lpf_bw = lpf_bw;
377  this->m_lpf_bw_isSet = true;
378 }
379 
380 qint32
382  return gain;
383 }
384 void
386  this->gain = gain;
387  this->m_gain_isSet = true;
388 }
389 
390 qint32
392  return nco_enable;
393 }
394 void
396  this->nco_enable = nco_enable;
397  this->m_nco_enable_isSet = true;
398 }
399 
400 qint32
402  return nco_frequency;
403 }
404 void
406  this->nco_frequency = nco_frequency;
407  this->m_nco_frequency_isSet = true;
408 }
409 
410 qint32
412  return antenna_path;
413 }
414 void
416  this->antenna_path = antenna_path;
417  this->m_antenna_path_isSet = true;
418 }
419 
420 qint32
422  return gain_mode;
423 }
424 void
426  this->gain_mode = gain_mode;
427  this->m_gain_mode_isSet = true;
428 }
429 
430 qint32
432  return lna_gain;
433 }
434 void
436  this->lna_gain = lna_gain;
437  this->m_lna_gain_isSet = true;
438 }
439 
440 qint32
442  return tia_gain;
443 }
444 void
446  this->tia_gain = tia_gain;
447  this->m_tia_gain_isSet = true;
448 }
449 
450 qint32
452  return pga_gain;
453 }
454 void
456  this->pga_gain = pga_gain;
457  this->m_pga_gain_isSet = true;
458 }
459 
460 qint32
462  return ext_clock;
463 }
464 void
466  this->ext_clock = ext_clock;
467  this->m_ext_clock_isSet = true;
468 }
469 
470 qint32
472  return ext_clock_freq;
473 }
474 void
476  this->ext_clock_freq = ext_clock_freq;
477  this->m_ext_clock_freq_isSet = true;
478 }
479 
480 qint32
482  return pwrmode;
483 }
484 void
486  this->pwrmode = pwrmode;
487  this->m_pwrmode_isSet = true;
488 }
489 
490 QString*
492  return file_record_name;
493 }
494 void
496  this->file_record_name = file_record_name;
497  this->m_file_record_name_isSet = true;
498 }
499 
500 qint32
502  return use_reverse_api;
503 }
504 void
506  this->use_reverse_api = use_reverse_api;
507  this->m_use_reverse_api_isSet = true;
508 }
509 
510 QString*
512  return reverse_api_address;
513 }
514 void
516  this->reverse_api_address = reverse_api_address;
517  this->m_reverse_api_address_isSet = true;
518 }
519 
520 qint32
522  return reverse_api_port;
523 }
524 void
526  this->reverse_api_port = reverse_api_port;
527  this->m_reverse_api_port_isSet = true;
528 }
529 
530 qint32
533 }
534 void
536  this->reverse_api_device_index = reverse_api_device_index;
538 }
539 
540 
541 bool
543  bool isObjectUpdated = false;
544  do{
545  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
546  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
547  if(m_log2_hard_decim_isSet){ isObjectUpdated = true; break;}
548  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
549  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
550  if(m_log2_soft_decim_isSet){ isObjectUpdated = true; break;}
551  if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
552  if(m_gain_isSet){ isObjectUpdated = true; break;}
553  if(m_nco_enable_isSet){ isObjectUpdated = true; break;}
554  if(m_nco_frequency_isSet){ isObjectUpdated = true; break;}
555  if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
556  if(m_gain_mode_isSet){ isObjectUpdated = true; break;}
557  if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
558  if(m_tia_gain_isSet){ isObjectUpdated = true; break;}
559  if(m_pga_gain_isSet){ isObjectUpdated = true; break;}
560  if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
561  if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
562  if(m_pwrmode_isSet){ isObjectUpdated = true; break;}
563  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
564  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
565  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
566  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
567  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
568  }while(false);
569  return isObjectUpdated;
570 }
571 }
572 
void setFileRecordName(QString *file_record_name)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setAntennaPath(qint32 antenna_path)
virtual SWGXtrxInputSettings * fromJson(QString &jsonString) override
void setCenterFrequency(qint64 center_frequency)
void setDevSampleRate(qint32 dev_sample_rate)
void setReverseApiPort(qint32 reverse_api_port)
void setExtClockFreq(qint32 ext_clock_freq)
void setIqCorrection(qint32 iq_correction)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiAddress(QString *reverse_api_address)
void setLog2HardDecim(qint32 log2_hard_decim)
virtual QJsonObject * asJsonObject() override
virtual void fromJsonObject(QJsonObject &json) override
void setNcoFrequency(qint32 nco_frequency)
void setLog2SoftDecim(qint32 log2_soft_decim)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)