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.
SWGAirspyHFSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGAirspyHFSettings.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  log2_decim = 0;
38  m_log2_decim_isSet = false;
39  transverter_mode = 0;
43  band_index = 0;
44  m_band_index_isSet = false;
45  file_record_name = nullptr;
47  use_reverse_api = 0;
49  reverse_api_address = nullptr;
51  reverse_api_port = 0;
55  use_agc = 0;
56  m_use_agc_isSet = false;
57  agc_high = 0;
58  m_agc_high_isSet = false;
59  use_dsp = 0;
60  m_use_dsp_isSet = false;
61  use_lna = 0;
62  m_use_lna_isSet = false;
63  attenuator_steps = 0;
65  dc_block = 0;
66  m_dc_block_isSet = false;
67  iq_correction = 0;
68  m_iq_correction_isSet = false;
69 }
70 
72  this->cleanup();
73 }
74 
75 void
77  center_frequency = 0L;
79  l_oppm_tenths = 0;
80  m_l_oppm_tenths_isSet = false;
83  log2_decim = 0;
84  m_log2_decim_isSet = false;
85  transverter_mode = 0;
89  band_index = 0;
90  m_band_index_isSet = false;
91  file_record_name = new QString("");
93  use_reverse_api = 0;
95  reverse_api_address = new QString("");
97  reverse_api_port = 0;
101  use_agc = 0;
102  m_use_agc_isSet = false;
103  agc_high = 0;
104  m_agc_high_isSet = false;
105  use_dsp = 0;
106  m_use_dsp_isSet = false;
107  use_lna = 0;
108  m_use_lna_isSet = false;
109  attenuator_steps = 0;
110  m_attenuator_steps_isSet = false;
111  dc_block = 0;
112  m_dc_block_isSet = false;
113  iq_correction = 0;
114  m_iq_correction_isSet = false;
115 }
116 
117 void
119 
120 
121 
122 
123 
124 
125 
126  if(file_record_name != nullptr) {
127  delete file_record_name;
128  }
129 
130  if(reverse_api_address != nullptr) {
131  delete reverse_api_address;
132  }
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 }
143 
146  QByteArray array (json.toStdString().c_str());
147  QJsonDocument doc = QJsonDocument::fromJson(array);
148  QJsonObject jsonObject = doc.object();
149  this->fromJsonObject(jsonObject);
150  return this;
151 }
152 
153 void
155  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
156 
157  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&dev_sample_rate_index, pJson["devSampleRateIndex"], "qint32", "");
160 
161  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
162 
163  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
164 
165  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
166 
167  ::SWGSDRangel::setValue(&band_index, pJson["bandIndex"], "qint32", "");
168 
169  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
170 
171  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
172 
173  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
174 
175  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
176 
177  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
178 
179  ::SWGSDRangel::setValue(&use_agc, pJson["useAGC"], "qint32", "");
180 
181  ::SWGSDRangel::setValue(&agc_high, pJson["agcHigh"], "qint32", "");
182 
183  ::SWGSDRangel::setValue(&use_dsp, pJson["useDSP"], "qint32", "");
184 
185  ::SWGSDRangel::setValue(&use_lna, pJson["useLNA"], "qint32", "");
186 
187  ::SWGSDRangel::setValue(&attenuator_steps, pJson["attenuatorSteps"], "qint32", "");
188 
189  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
190 
191  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
192 
193 }
194 
195 QString
197 {
198  QJsonObject* obj = this->asJsonObject();
199 
200  QJsonDocument doc(*obj);
201  QByteArray bytes = doc.toJson();
202  delete obj;
203  return QString(bytes);
204 }
205 
206 QJsonObject*
208  QJsonObject* obj = new QJsonObject();
210  obj->insert("centerFrequency", QJsonValue(center_frequency));
211  }
213  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
214  }
216  obj->insert("devSampleRateIndex", QJsonValue(dev_sample_rate_index));
217  }
218  if(m_log2_decim_isSet){
219  obj->insert("log2Decim", QJsonValue(log2_decim));
220  }
222  obj->insert("transverterMode", QJsonValue(transverter_mode));
223  }
225  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
226  }
227  if(m_band_index_isSet){
228  obj->insert("bandIndex", QJsonValue(band_index));
229  }
230  if(file_record_name != nullptr && *file_record_name != QString("")){
231  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
232  }
234  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
235  }
236  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
237  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
238  }
240  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
241  }
243  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
244  }
245  if(m_use_agc_isSet){
246  obj->insert("useAGC", QJsonValue(use_agc));
247  }
248  if(m_agc_high_isSet){
249  obj->insert("agcHigh", QJsonValue(agc_high));
250  }
251  if(m_use_dsp_isSet){
252  obj->insert("useDSP", QJsonValue(use_dsp));
253  }
254  if(m_use_lna_isSet){
255  obj->insert("useLNA", QJsonValue(use_lna));
256  }
258  obj->insert("attenuatorSteps", QJsonValue(attenuator_steps));
259  }
260  if(m_dc_block_isSet){
261  obj->insert("dcBlock", QJsonValue(dc_block));
262  }
264  obj->insert("iqCorrection", QJsonValue(iq_correction));
265  }
266 
267  return obj;
268 }
269 
270 qint64
272  return center_frequency;
273 }
274 void
276  this->center_frequency = center_frequency;
277  this->m_center_frequency_isSet = true;
278 }
279 
280 qint32
282  return l_oppm_tenths;
283 }
284 void
286  this->l_oppm_tenths = l_oppm_tenths;
287  this->m_l_oppm_tenths_isSet = true;
288 }
289 
290 qint32
292  return dev_sample_rate_index;
293 }
294 void
296  this->dev_sample_rate_index = dev_sample_rate_index;
297  this->m_dev_sample_rate_index_isSet = true;
298 }
299 
300 qint32
302  return log2_decim;
303 }
304 void
306  this->log2_decim = log2_decim;
307  this->m_log2_decim_isSet = true;
308 }
309 
310 qint32
312  return transverter_mode;
313 }
314 void
316  this->transverter_mode = transverter_mode;
317  this->m_transverter_mode_isSet = true;
318 }
319 
320 qint64
323 }
324 void
326  this->transverter_delta_frequency = transverter_delta_frequency;
328 }
329 
330 qint32
332  return band_index;
333 }
334 void
336  this->band_index = band_index;
337  this->m_band_index_isSet = true;
338 }
339 
340 QString*
342  return file_record_name;
343 }
344 void
346  this->file_record_name = file_record_name;
347  this->m_file_record_name_isSet = true;
348 }
349 
350 qint32
352  return use_reverse_api;
353 }
354 void
356  this->use_reverse_api = use_reverse_api;
357  this->m_use_reverse_api_isSet = true;
358 }
359 
360 QString*
362  return reverse_api_address;
363 }
364 void
366  this->reverse_api_address = reverse_api_address;
367  this->m_reverse_api_address_isSet = true;
368 }
369 
370 qint32
372  return reverse_api_port;
373 }
374 void
376  this->reverse_api_port = reverse_api_port;
377  this->m_reverse_api_port_isSet = true;
378 }
379 
380 qint32
383 }
384 void
386  this->reverse_api_device_index = reverse_api_device_index;
388 }
389 
390 qint32
392  return use_agc;
393 }
394 void
396  this->use_agc = use_agc;
397  this->m_use_agc_isSet = true;
398 }
399 
400 qint32
402  return agc_high;
403 }
404 void
406  this->agc_high = agc_high;
407  this->m_agc_high_isSet = true;
408 }
409 
410 qint32
412  return use_dsp;
413 }
414 void
416  this->use_dsp = use_dsp;
417  this->m_use_dsp_isSet = true;
418 }
419 
420 qint32
422  return use_lna;
423 }
424 void
426  this->use_lna = use_lna;
427  this->m_use_lna_isSet = true;
428 }
429 
430 qint32
432  return attenuator_steps;
433 }
434 void
436  this->attenuator_steps = attenuator_steps;
437  this->m_attenuator_steps_isSet = true;
438 }
439 
440 qint32
442  return dc_block;
443 }
444 void
446  this->dc_block = dc_block;
447  this->m_dc_block_isSet = true;
448 }
449 
450 qint32
452  return iq_correction;
453 }
454 void
456  this->iq_correction = iq_correction;
457  this->m_iq_correction_isSet = true;
458 }
459 
460 
461 bool
463  bool isObjectUpdated = false;
464  do{
465  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
466  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
467  if(m_dev_sample_rate_index_isSet){ isObjectUpdated = true; break;}
468  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
469  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
470  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
471  if(m_band_index_isSet){ isObjectUpdated = true; break;}
472  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
473  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
474  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
475  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
476  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
477  if(m_use_agc_isSet){ isObjectUpdated = true; break;}
478  if(m_agc_high_isSet){ isObjectUpdated = true; break;}
479  if(m_use_dsp_isSet){ isObjectUpdated = true; break;}
480  if(m_use_lna_isSet){ isObjectUpdated = true; break;}
481  if(m_attenuator_steps_isSet){ isObjectUpdated = true; break;}
482  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
483  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
484  }while(false);
485  return isObjectUpdated;
486 }
487 }
488 
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual QString asJson() override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiAddress(QString *reverse_api_address)
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
virtual QJsonObject * asJsonObject() override
void setDevSampleRateIndex(qint32 dev_sample_rate_index)
virtual SWGAirspyHFSettings * fromJson(QString &jsonString) override
void setLOppmTenths(qint32 l_oppm_tenths)
void setIqCorrection(qint32 iq_correction)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiPort(qint32 reverse_api_port)
void setCenterFrequency(qint64 center_frequency)
void setFileRecordName(QString *file_record_name)
virtual void fromJsonObject(QJsonObject &json) override
void setTransverterMode(qint32 transverter_mode)
void setAttenuatorSteps(qint32 attenuator_steps)