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.
SWGAirspySettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGAirspySettings.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  l_oppm_tenths = 0;
34  m_l_oppm_tenths_isSet = false;
37  lna_gain = 0;
38  m_lna_gain_isSet = false;
39  mixer_gain = 0;
40  m_mixer_gain_isSet = false;
41  vga_gain = 0;
42  m_vga_gain_isSet = false;
43  lna_agc = 0;
44  m_lna_agc_isSet = false;
45  mixer_agc = 0;
46  m_mixer_agc_isSet = false;
47  log2_decim = 0;
48  m_log2_decim_isSet = false;
49  fc_pos = 0;
50  m_fc_pos_isSet = false;
51  bias_t = 0;
52  m_bias_t_isSet = false;
53  dc_block = 0;
54  m_dc_block_isSet = false;
55  iq_correction = 0;
56  m_iq_correction_isSet = false;
57  transverter_mode = 0;
61  file_record_name = nullptr;
63  use_reverse_api = 0;
65  reverse_api_address = nullptr;
67  reverse_api_port = 0;
71 }
72 
74  this->cleanup();
75 }
76 
77 void
79  center_frequency = 0L;
81  l_oppm_tenths = 0;
82  m_l_oppm_tenths_isSet = false;
85  lna_gain = 0;
86  m_lna_gain_isSet = false;
87  mixer_gain = 0;
88  m_mixer_gain_isSet = false;
89  vga_gain = 0;
90  m_vga_gain_isSet = false;
91  lna_agc = 0;
92  m_lna_agc_isSet = false;
93  mixer_agc = 0;
94  m_mixer_agc_isSet = false;
95  log2_decim = 0;
96  m_log2_decim_isSet = false;
97  fc_pos = 0;
98  m_fc_pos_isSet = false;
99  bias_t = 0;
100  m_bias_t_isSet = false;
101  dc_block = 0;
102  m_dc_block_isSet = false;
103  iq_correction = 0;
104  m_iq_correction_isSet = false;
105  transverter_mode = 0;
106  m_transverter_mode_isSet = false;
109  file_record_name = new QString("");
110  m_file_record_name_isSet = false;
111  use_reverse_api = 0;
112  m_use_reverse_api_isSet = false;
113  reverse_api_address = new QString("");
115  reverse_api_port = 0;
116  m_reverse_api_port_isSet = false;
119 }
120 
121 void
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138  if(file_record_name != nullptr) {
139  delete file_record_name;
140  }
141 
142  if(reverse_api_address != nullptr) {
143  delete reverse_api_address;
144  }
145 
146 
147 }
148 
151  QByteArray array (json.toStdString().c_str());
152  QJsonDocument doc = QJsonDocument::fromJson(array);
153  QJsonObject jsonObject = doc.object();
154  this->fromJsonObject(jsonObject);
155  return this;
156 }
157 
158 void
160  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
161 
162  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
163 
164  ::SWGSDRangel::setValue(&dev_sample_rate_index, pJson["devSampleRateIndex"], "qint32", "");
165 
166  ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&mixer_gain, pJson["mixerGain"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&lna_agc, pJson["lnaAGC"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&mixer_agc, pJson["mixerAGC"], "qint32", "");
175 
176  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
177 
178  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
179 
180  ::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
181 
182  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
185 
186  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
187 
188  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
189 
190  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
191 
192  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
193 
194  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
195 
196  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
197 
198  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
199 
200 }
201 
202 QString
204 {
205  QJsonObject* obj = this->asJsonObject();
206 
207  QJsonDocument doc(*obj);
208  QByteArray bytes = doc.toJson();
209  delete obj;
210  return QString(bytes);
211 }
212 
213 QJsonObject*
215  QJsonObject* obj = new QJsonObject();
217  obj->insert("centerFrequency", QJsonValue(center_frequency));
218  }
220  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
221  }
223  obj->insert("devSampleRateIndex", QJsonValue(dev_sample_rate_index));
224  }
225  if(m_lna_gain_isSet){
226  obj->insert("lnaGain", QJsonValue(lna_gain));
227  }
228  if(m_mixer_gain_isSet){
229  obj->insert("mixerGain", QJsonValue(mixer_gain));
230  }
231  if(m_vga_gain_isSet){
232  obj->insert("vgaGain", QJsonValue(vga_gain));
233  }
234  if(m_lna_agc_isSet){
235  obj->insert("lnaAGC", QJsonValue(lna_agc));
236  }
237  if(m_mixer_agc_isSet){
238  obj->insert("mixerAGC", QJsonValue(mixer_agc));
239  }
240  if(m_log2_decim_isSet){
241  obj->insert("log2Decim", QJsonValue(log2_decim));
242  }
243  if(m_fc_pos_isSet){
244  obj->insert("fcPos", QJsonValue(fc_pos));
245  }
246  if(m_bias_t_isSet){
247  obj->insert("biasT", QJsonValue(bias_t));
248  }
249  if(m_dc_block_isSet){
250  obj->insert("dcBlock", QJsonValue(dc_block));
251  }
253  obj->insert("iqCorrection", QJsonValue(iq_correction));
254  }
256  obj->insert("transverterMode", QJsonValue(transverter_mode));
257  }
259  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
260  }
261  if(file_record_name != nullptr && *file_record_name != QString("")){
262  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
263  }
265  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
266  }
267  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
268  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
269  }
271  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
272  }
274  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
275  }
276 
277  return obj;
278 }
279 
280 qint64
282  return center_frequency;
283 }
284 void
286  this->center_frequency = center_frequency;
287  this->m_center_frequency_isSet = true;
288 }
289 
290 qint32
292  return l_oppm_tenths;
293 }
294 void
296  this->l_oppm_tenths = l_oppm_tenths;
297  this->m_l_oppm_tenths_isSet = true;
298 }
299 
300 qint32
302  return dev_sample_rate_index;
303 }
304 void
306  this->dev_sample_rate_index = dev_sample_rate_index;
307  this->m_dev_sample_rate_index_isSet = true;
308 }
309 
310 qint32
312  return lna_gain;
313 }
314 void
316  this->lna_gain = lna_gain;
317  this->m_lna_gain_isSet = true;
318 }
319 
320 qint32
322  return mixer_gain;
323 }
324 void
326  this->mixer_gain = mixer_gain;
327  this->m_mixer_gain_isSet = true;
328 }
329 
330 qint32
332  return vga_gain;
333 }
334 void
336  this->vga_gain = vga_gain;
337  this->m_vga_gain_isSet = true;
338 }
339 
340 qint32
342  return lna_agc;
343 }
344 void
346  this->lna_agc = lna_agc;
347  this->m_lna_agc_isSet = true;
348 }
349 
350 qint32
352  return mixer_agc;
353 }
354 void
356  this->mixer_agc = mixer_agc;
357  this->m_mixer_agc_isSet = true;
358 }
359 
360 qint32
362  return log2_decim;
363 }
364 void
366  this->log2_decim = log2_decim;
367  this->m_log2_decim_isSet = true;
368 }
369 
370 qint32
372  return fc_pos;
373 }
374 void
376  this->fc_pos = fc_pos;
377  this->m_fc_pos_isSet = true;
378 }
379 
380 qint32
382  return bias_t;
383 }
384 void
386  this->bias_t = bias_t;
387  this->m_bias_t_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 transverter_mode;
413 }
414 void
416  this->transverter_mode = transverter_mode;
417  this->m_transverter_mode_isSet = true;
418 }
419 
420 qint64
423 }
424 void
426  this->transverter_delta_frequency = transverter_delta_frequency;
428 }
429 
430 QString*
432  return file_record_name;
433 }
434 void
436  this->file_record_name = file_record_name;
437  this->m_file_record_name_isSet = true;
438 }
439 
440 qint32
442  return use_reverse_api;
443 }
444 void
446  this->use_reverse_api = use_reverse_api;
447  this->m_use_reverse_api_isSet = true;
448 }
449 
450 QString*
452  return reverse_api_address;
453 }
454 void
456  this->reverse_api_address = reverse_api_address;
457  this->m_reverse_api_address_isSet = true;
458 }
459 
460 qint32
462  return reverse_api_port;
463 }
464 void
466  this->reverse_api_port = reverse_api_port;
467  this->m_reverse_api_port_isSet = true;
468 }
469 
470 qint32
473 }
474 void
476  this->reverse_api_device_index = reverse_api_device_index;
478 }
479 
480 
481 bool
483  bool isObjectUpdated = false;
484  do{
485  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
486  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
487  if(m_dev_sample_rate_index_isSet){ isObjectUpdated = true; break;}
488  if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
489  if(m_mixer_gain_isSet){ isObjectUpdated = true; break;}
490  if(m_vga_gain_isSet){ isObjectUpdated = true; break;}
491  if(m_lna_agc_isSet){ isObjectUpdated = true; break;}
492  if(m_mixer_agc_isSet){ isObjectUpdated = true; break;}
493  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
494  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
495  if(m_bias_t_isSet){ isObjectUpdated = true; break;}
496  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
497  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
498  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
499  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
500  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
501  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
502  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
503  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
504  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
505  }while(false);
506  return isObjectUpdated;
507 }
508 }
509 
void setLOppmTenths(qint32 l_oppm_tenths)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setMixerAgc(qint32 mixer_agc)
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setLog2Decim(qint32 log2_decim)
void setCenterFrequency(qint64 center_frequency)
void setTransverterMode(qint32 transverter_mode)
void setIqCorrection(qint32 iq_correction)
void setReverseApiAddress(QString *reverse_api_address)
virtual SWGAirspySettings * fromJson(QString &jsonString) override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setDevSampleRateIndex(qint32 dev_sample_rate_index)
virtual QString asJson() override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setFileRecordName(QString *file_record_name)
virtual void fromJsonObject(QJsonObject &json) override
void setUseReverseApi(qint32 use_reverse_api)
void setMixerGain(qint32 mixer_gain)
virtual QJsonObject * asJsonObject() override
void setReverseApiPort(qint32 reverse_api_port)