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.
SWGSoapySDRInputSettings.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  l_oppm_tenths = 0;
34  m_l_oppm_tenths_isSet = false;
35  dev_sample_rate = 0;
37  log2_decim = 0;
38  m_log2_decim_isSet = false;
39  fc_pos = 0;
40  m_fc_pos_isSet = false;
45  transverter_mode = 0;
49  file_record_name = nullptr;
51  antenna = nullptr;
52  m_antenna_isSet = false;
53  bandwidth = 0;
54  m_bandwidth_isSet = false;
55  tunable_elements = nullptr;
57  global_gain = 0;
58  m_global_gain_isSet = false;
59  individual_gains = nullptr;
61  auto_gain = 0;
62  m_auto_gain_isSet = false;
67  dc_correction = nullptr;
68  m_dc_correction_isSet = false;
69  iq_correction = nullptr;
70  m_iq_correction_isSet = false;
71  stream_arg_settings = nullptr;
73  device_arg_settings = nullptr;
75  use_reverse_api = 0;
77  reverse_api_address = nullptr;
79  reverse_api_port = 0;
83 }
84 
86  this->cleanup();
87 }
88 
89 void
91  center_frequency = 0L;
93  l_oppm_tenths = 0;
94  m_l_oppm_tenths_isSet = false;
95  dev_sample_rate = 0;
97  log2_decim = 0;
98  m_log2_decim_isSet = false;
99  fc_pos = 0;
100  m_fc_pos_isSet = false;
101  soft_dc_correction = 0;
103  soft_iq_correction = 0;
105  transverter_mode = 0;
106  m_transverter_mode_isSet = false;
109  file_record_name = new QString("");
110  m_file_record_name_isSet = false;
111  antenna = new QString("");
112  m_antenna_isSet = false;
113  bandwidth = 0;
114  m_bandwidth_isSet = false;
115  tunable_elements = new QList<SWGArgValue*>();
116  m_tunable_elements_isSet = false;
117  global_gain = 0;
118  m_global_gain_isSet = false;
119  individual_gains = new QList<SWGArgValue*>();
120  m_individual_gains_isSet = false;
121  auto_gain = 0;
122  m_auto_gain_isSet = false;
123  auto_dc_correction = 0;
125  auto_iq_correction = 0;
127  dc_correction = new SWGComplex();
128  m_dc_correction_isSet = false;
129  iq_correction = new SWGComplex();
130  m_iq_correction_isSet = false;
131  stream_arg_settings = new QList<SWGArgValue*>();
133  device_arg_settings = new QList<SWGArgValue*>();
135  use_reverse_api = 0;
136  m_use_reverse_api_isSet = false;
137  reverse_api_address = new QString("");
139  reverse_api_port = 0;
140  m_reverse_api_port_isSet = false;
143 }
144 
145 void
147 
148 
149 
150 
151 
152 
153 
154 
155 
156  if(file_record_name != nullptr) {
157  delete file_record_name;
158  }
159  if(antenna != nullptr) {
160  delete antenna;
161  }
162 
163  if(tunable_elements != nullptr) {
164  auto arr = tunable_elements;
165  for(auto o: *arr) {
166  delete o;
167  }
168  delete tunable_elements;
169  }
170 
171  if(individual_gains != nullptr) {
172  auto arr = individual_gains;
173  for(auto o: *arr) {
174  delete o;
175  }
176  delete individual_gains;
177  }
178 
179 
180 
181  if(dc_correction != nullptr) {
182  delete dc_correction;
183  }
184  if(iq_correction != nullptr) {
185  delete iq_correction;
186  }
187  if(stream_arg_settings != nullptr) {
188  auto arr = stream_arg_settings;
189  for(auto o: *arr) {
190  delete o;
191  }
192  delete stream_arg_settings;
193  }
194  if(device_arg_settings != nullptr) {
195  auto arr = device_arg_settings;
196  for(auto o: *arr) {
197  delete o;
198  }
199  delete device_arg_settings;
200  }
201 
202  if(reverse_api_address != nullptr) {
203  delete reverse_api_address;
204  }
205 
206 
207 }
208 
211  QByteArray array (json.toStdString().c_str());
212  QJsonDocument doc = QJsonDocument::fromJson(array);
213  QJsonObject jsonObject = doc.object();
214  this->fromJsonObject(jsonObject);
215  return this;
216 }
217 
218 void
220  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
221 
222  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
223 
224  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
225 
226  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
227 
228  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
229 
230  ::SWGSDRangel::setValue(&soft_dc_correction, pJson["softDCCorrection"], "qint32", "");
231 
232  ::SWGSDRangel::setValue(&soft_iq_correction, pJson["softIQCorrection"], "qint32", "");
233 
234  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
235 
236  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
237 
238  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
239 
240  ::SWGSDRangel::setValue(&antenna, pJson["antenna"], "QString", "QString");
241 
242  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
243 
244 
245  ::SWGSDRangel::setValue(&tunable_elements, pJson["tunableElements"], "QList", "SWGArgValue");
246  ::SWGSDRangel::setValue(&global_gain, pJson["globalGain"], "qint32", "");
247 
248 
249  ::SWGSDRangel::setValue(&individual_gains, pJson["individualGains"], "QList", "SWGArgValue");
250  ::SWGSDRangel::setValue(&auto_gain, pJson["autoGain"], "qint32", "");
251 
252  ::SWGSDRangel::setValue(&auto_dc_correction, pJson["autoDCCorrection"], "qint32", "");
253 
254  ::SWGSDRangel::setValue(&auto_iq_correction, pJson["autoIQCorrection"], "qint32", "");
255 
256  ::SWGSDRangel::setValue(&dc_correction, pJson["dcCorrection"], "SWGComplex", "SWGComplex");
257 
258  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "SWGComplex", "SWGComplex");
259 
260 
261  ::SWGSDRangel::setValue(&stream_arg_settings, pJson["streamArgSettings"], "QList", "SWGArgValue");
262 
263  ::SWGSDRangel::setValue(&device_arg_settings, pJson["deviceArgSettings"], "QList", "SWGArgValue");
264  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
265 
266  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
267 
268  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
269 
270  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
271 
272 }
273 
274 QString
276 {
277  QJsonObject* obj = this->asJsonObject();
278 
279  QJsonDocument doc(*obj);
280  QByteArray bytes = doc.toJson();
281  delete obj;
282  return QString(bytes);
283 }
284 
285 QJsonObject*
287  QJsonObject* obj = new QJsonObject();
289  obj->insert("centerFrequency", QJsonValue(center_frequency));
290  }
292  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
293  }
295  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
296  }
297  if(m_log2_decim_isSet){
298  obj->insert("log2Decim", QJsonValue(log2_decim));
299  }
300  if(m_fc_pos_isSet){
301  obj->insert("fcPos", QJsonValue(fc_pos));
302  }
304  obj->insert("softDCCorrection", QJsonValue(soft_dc_correction));
305  }
307  obj->insert("softIQCorrection", QJsonValue(soft_iq_correction));
308  }
310  obj->insert("transverterMode", QJsonValue(transverter_mode));
311  }
313  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
314  }
315  if(file_record_name != nullptr && *file_record_name != QString("")){
316  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
317  }
318  if(antenna != nullptr && *antenna != QString("")){
319  toJsonValue(QString("antenna"), antenna, obj, QString("QString"));
320  }
321  if(m_bandwidth_isSet){
322  obj->insert("bandwidth", QJsonValue(bandwidth));
323  }
324  if(tunable_elements->size() > 0){
325  toJsonArray((QList<void*>*)tunable_elements, obj, "tunableElements", "SWGArgValue");
326  }
328  obj->insert("globalGain", QJsonValue(global_gain));
329  }
330  if(individual_gains->size() > 0){
331  toJsonArray((QList<void*>*)individual_gains, obj, "individualGains", "SWGArgValue");
332  }
333  if(m_auto_gain_isSet){
334  obj->insert("autoGain", QJsonValue(auto_gain));
335  }
337  obj->insert("autoDCCorrection", QJsonValue(auto_dc_correction));
338  }
340  obj->insert("autoIQCorrection", QJsonValue(auto_iq_correction));
341  }
342  if((dc_correction != nullptr) && (dc_correction->isSet())){
343  toJsonValue(QString("dcCorrection"), dc_correction, obj, QString("SWGComplex"));
344  }
345  if((iq_correction != nullptr) && (iq_correction->isSet())){
346  toJsonValue(QString("iqCorrection"), iq_correction, obj, QString("SWGComplex"));
347  }
348  if(stream_arg_settings->size() > 0){
349  toJsonArray((QList<void*>*)stream_arg_settings, obj, "streamArgSettings", "SWGArgValue");
350  }
351  if(device_arg_settings->size() > 0){
352  toJsonArray((QList<void*>*)device_arg_settings, obj, "deviceArgSettings", "SWGArgValue");
353  }
355  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
356  }
357  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
358  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
359  }
361  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
362  }
364  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
365  }
366 
367  return obj;
368 }
369 
370 qint64
372  return center_frequency;
373 }
374 void
376  this->center_frequency = center_frequency;
377  this->m_center_frequency_isSet = true;
378 }
379 
380 qint32
382  return l_oppm_tenths;
383 }
384 void
386  this->l_oppm_tenths = l_oppm_tenths;
387  this->m_l_oppm_tenths_isSet = true;
388 }
389 
390 qint32
392  return dev_sample_rate;
393 }
394 void
396  this->dev_sample_rate = dev_sample_rate;
397  this->m_dev_sample_rate_isSet = true;
398 }
399 
400 qint32
402  return log2_decim;
403 }
404 void
406  this->log2_decim = log2_decim;
407  this->m_log2_decim_isSet = true;
408 }
409 
410 qint32
412  return fc_pos;
413 }
414 void
416  this->fc_pos = fc_pos;
417  this->m_fc_pos_isSet = true;
418 }
419 
420 qint32
422  return soft_dc_correction;
423 }
424 void
426  this->soft_dc_correction = soft_dc_correction;
427  this->m_soft_dc_correction_isSet = true;
428 }
429 
430 qint32
432  return soft_iq_correction;
433 }
434 void
436  this->soft_iq_correction = soft_iq_correction;
437  this->m_soft_iq_correction_isSet = true;
438 }
439 
440 qint32
442  return transverter_mode;
443 }
444 void
446  this->transverter_mode = transverter_mode;
447  this->m_transverter_mode_isSet = true;
448 }
449 
450 qint64
453 }
454 void
456  this->transverter_delta_frequency = transverter_delta_frequency;
458 }
459 
460 QString*
462  return file_record_name;
463 }
464 void
466  this->file_record_name = file_record_name;
467  this->m_file_record_name_isSet = true;
468 }
469 
470 QString*
472  return antenna;
473 }
474 void
476  this->antenna = antenna;
477  this->m_antenna_isSet = true;
478 }
479 
480 qint32
482  return bandwidth;
483 }
484 void
486  this->bandwidth = bandwidth;
487  this->m_bandwidth_isSet = true;
488 }
489 
490 QList<SWGArgValue*>*
492  return tunable_elements;
493 }
494 void
496  this->tunable_elements = tunable_elements;
497  this->m_tunable_elements_isSet = true;
498 }
499 
500 qint32
502  return global_gain;
503 }
504 void
506  this->global_gain = global_gain;
507  this->m_global_gain_isSet = true;
508 }
509 
510 QList<SWGArgValue*>*
512  return individual_gains;
513 }
514 void
516  this->individual_gains = individual_gains;
517  this->m_individual_gains_isSet = true;
518 }
519 
520 qint32
522  return auto_gain;
523 }
524 void
526  this->auto_gain = auto_gain;
527  this->m_auto_gain_isSet = true;
528 }
529 
530 qint32
532  return auto_dc_correction;
533 }
534 void
536  this->auto_dc_correction = auto_dc_correction;
537  this->m_auto_dc_correction_isSet = true;
538 }
539 
540 qint32
542  return auto_iq_correction;
543 }
544 void
546  this->auto_iq_correction = auto_iq_correction;
547  this->m_auto_iq_correction_isSet = true;
548 }
549 
550 SWGComplex*
552  return dc_correction;
553 }
554 void
556  this->dc_correction = dc_correction;
557  this->m_dc_correction_isSet = true;
558 }
559 
560 SWGComplex*
562  return iq_correction;
563 }
564 void
566  this->iq_correction = iq_correction;
567  this->m_iq_correction_isSet = true;
568 }
569 
570 QList<SWGArgValue*>*
572  return stream_arg_settings;
573 }
574 void
576  this->stream_arg_settings = stream_arg_settings;
577  this->m_stream_arg_settings_isSet = true;
578 }
579 
580 QList<SWGArgValue*>*
582  return device_arg_settings;
583 }
584 void
586  this->device_arg_settings = device_arg_settings;
587  this->m_device_arg_settings_isSet = true;
588 }
589 
590 qint32
592  return use_reverse_api;
593 }
594 void
596  this->use_reverse_api = use_reverse_api;
597  this->m_use_reverse_api_isSet = true;
598 }
599 
600 QString*
602  return reverse_api_address;
603 }
604 void
606  this->reverse_api_address = reverse_api_address;
607  this->m_reverse_api_address_isSet = true;
608 }
609 
610 qint32
612  return reverse_api_port;
613 }
614 void
616  this->reverse_api_port = reverse_api_port;
617  this->m_reverse_api_port_isSet = true;
618 }
619 
620 qint32
623 }
624 void
626  this->reverse_api_device_index = reverse_api_device_index;
628 }
629 
630 
631 bool
633  bool isObjectUpdated = false;
634  do{
635  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
636  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
637  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
638  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
639  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
640  if(m_soft_dc_correction_isSet){ isObjectUpdated = true; break;}
641  if(m_soft_iq_correction_isSet){ isObjectUpdated = true; break;}
642  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
643  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
644  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
645  if(antenna != nullptr && *antenna != QString("")){ isObjectUpdated = true; break;}
646  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
647  if(tunable_elements->size() > 0){ isObjectUpdated = true; break;}
648  if(m_global_gain_isSet){ isObjectUpdated = true; break;}
649  if(individual_gains->size() > 0){ isObjectUpdated = true; break;}
650  if(m_auto_gain_isSet){ isObjectUpdated = true; break;}
651  if(m_auto_dc_correction_isSet){ isObjectUpdated = true; break;}
652  if(m_auto_iq_correction_isSet){ isObjectUpdated = true; break;}
653  if(dc_correction != nullptr && dc_correction->isSet()){ isObjectUpdated = true; break;}
654  if(iq_correction != nullptr && iq_correction->isSet()){ isObjectUpdated = true; break;}
655  if(stream_arg_settings->size() > 0){ isObjectUpdated = true; break;}
656  if(device_arg_settings->size() > 0){ isObjectUpdated = true; break;}
657  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
658  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
659  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
660  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
661  }while(false);
662  return isObjectUpdated;
663 }
664 }
665 
void setAutoDcCorrection(qint32 auto_dc_correction)
virtual void fromJsonObject(QJsonObject &json) override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setTransverterMode(qint32 transverter_mode)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setCenterFrequency(qint64 center_frequency)
void setIndividualGains(QList< SWGArgValue *> *individual_gains)
void setSoftIqCorrection(qint32 soft_iq_correction)
void setAutoIqCorrection(qint32 auto_iq_correction)
void setSoftDcCorrection(qint32 soft_dc_correction)
virtual bool isSet() override
Definition: SWGComplex.cpp:118
void setStreamArgSettings(QList< SWGArgValue *> *stream_arg_settings)
virtual QJsonObject * asJsonObject() override
void setIqCorrection(SWGComplex *iq_correction)
virtual SWGSoapySDRInputSettings * fromJson(QString &jsonString) override
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setReverseApiAddress(QString *reverse_api_address)
void setDeviceArgSettings(QList< SWGArgValue *> *device_arg_settings)
void setDcCorrection(SWGComplex *dc_correction)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setTunableElements(QList< SWGArgValue *> *tunable_elements)
void toJsonArray(QList< void *> *value, QJsonObject *output, QString innerName, QString innerType)
Definition: SWGHelpers.cpp:445
void setFileRecordName(QString *file_record_name)
void setReverseApiPort(qint32 reverse_api_port)