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.
SWGFCDProPlusSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGFCDProPlusSettings.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  log2_decim = 0;
34  m_log2_decim_isSet = false;
35  fc_pos = 0;
36  m_fc_pos_isSet = false;
37  range_low = 0;
38  m_range_low_isSet = false;
39  lna_gain = 0;
40  m_lna_gain_isSet = false;
41  mix_gain = 0;
42  m_mix_gain_isSet = false;
43  bias_t = 0;
44  m_bias_t_isSet = false;
45  if_gain = 0;
46  m_if_gain_isSet = false;
47  if_filter_index = 0;
49  rf_filter_index = 0;
51  l_oppm_tenths = 0;
52  m_l_oppm_tenths_isSet = false;
53  dc_block = 0;
54  m_dc_block_isSet = false;
55  iq_imbalance = 0;
56  m_iq_imbalance_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  log2_decim = 0;
82  m_log2_decim_isSet = false;
83  fc_pos = 0;
84  m_fc_pos_isSet = false;
85  range_low = 0;
86  m_range_low_isSet = false;
87  lna_gain = 0;
88  m_lna_gain_isSet = false;
89  mix_gain = 0;
90  m_mix_gain_isSet = false;
91  bias_t = 0;
92  m_bias_t_isSet = false;
93  if_gain = 0;
94  m_if_gain_isSet = false;
95  if_filter_index = 0;
97  rf_filter_index = 0;
99  l_oppm_tenths = 0;
100  m_l_oppm_tenths_isSet = false;
101  dc_block = 0;
102  m_dc_block_isSet = false;
103  iq_imbalance = 0;
104  m_iq_imbalance_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(&log2_decim, pJson["log2Decim"], "qint32", "");
163 
164  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
165 
166  ::SWGSDRangel::setValue(&range_low, pJson["rangeLow"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&mix_gain, pJson["mixGain"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&if_gain, pJson["ifGain"], "qint32", "");
175 
176  ::SWGSDRangel::setValue(&if_filter_index, pJson["ifFilterIndex"], "qint32", "");
177 
178  ::SWGSDRangel::setValue(&rf_filter_index, pJson["rfFilterIndex"], "qint32", "");
179 
180  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
181 
182  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&iq_imbalance, pJson["iqImbalance"], "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  }
219  if(m_log2_decim_isSet){
220  obj->insert("log2Decim", QJsonValue(log2_decim));
221  }
222  if(m_fc_pos_isSet){
223  obj->insert("fcPos", QJsonValue(fc_pos));
224  }
225  if(m_range_low_isSet){
226  obj->insert("rangeLow", QJsonValue(range_low));
227  }
228  if(m_lna_gain_isSet){
229  obj->insert("lnaGain", QJsonValue(lna_gain));
230  }
231  if(m_mix_gain_isSet){
232  obj->insert("mixGain", QJsonValue(mix_gain));
233  }
234  if(m_bias_t_isSet){
235  obj->insert("biasT", QJsonValue(bias_t));
236  }
237  if(m_if_gain_isSet){
238  obj->insert("ifGain", QJsonValue(if_gain));
239  }
241  obj->insert("ifFilterIndex", QJsonValue(if_filter_index));
242  }
244  obj->insert("rfFilterIndex", QJsonValue(rf_filter_index));
245  }
247  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
248  }
249  if(m_dc_block_isSet){
250  obj->insert("dcBlock", QJsonValue(dc_block));
251  }
253  obj->insert("iqImbalance", QJsonValue(iq_imbalance));
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 log2_decim;
293 }
294 void
296  this->log2_decim = log2_decim;
297  this->m_log2_decim_isSet = true;
298 }
299 
300 qint32
302  return fc_pos;
303 }
304 void
306  this->fc_pos = fc_pos;
307  this->m_fc_pos_isSet = true;
308 }
309 
310 qint32
312  return range_low;
313 }
314 void
316  this->range_low = range_low;
317  this->m_range_low_isSet = true;
318 }
319 
320 qint32
322  return lna_gain;
323 }
324 void
326  this->lna_gain = lna_gain;
327  this->m_lna_gain_isSet = true;
328 }
329 
330 qint32
332  return mix_gain;
333 }
334 void
336  this->mix_gain = mix_gain;
337  this->m_mix_gain_isSet = true;
338 }
339 
340 qint32
342  return bias_t;
343 }
344 void
346  this->bias_t = bias_t;
347  this->m_bias_t_isSet = true;
348 }
349 
350 qint32
352  return if_gain;
353 }
354 void
356  this->if_gain = if_gain;
357  this->m_if_gain_isSet = true;
358 }
359 
360 qint32
362  return if_filter_index;
363 }
364 void
366  this->if_filter_index = if_filter_index;
367  this->m_if_filter_index_isSet = true;
368 }
369 
370 qint32
372  return rf_filter_index;
373 }
374 void
376  this->rf_filter_index = rf_filter_index;
377  this->m_rf_filter_index_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 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_imbalance;
403 }
404 void
406  this->iq_imbalance = iq_imbalance;
407  this->m_iq_imbalance_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_log2_decim_isSet){ isObjectUpdated = true; break;}
487  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
488  if(m_range_low_isSet){ isObjectUpdated = true; break;}
489  if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
490  if(m_mix_gain_isSet){ isObjectUpdated = true; break;}
491  if(m_bias_t_isSet){ isObjectUpdated = true; break;}
492  if(m_if_gain_isSet){ isObjectUpdated = true; break;}
493  if(m_if_filter_index_isSet){ isObjectUpdated = true; break;}
494  if(m_rf_filter_index_isSet){ isObjectUpdated = true; break;}
495  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
496  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
497  if(m_iq_imbalance_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 setRfFilterIndex(qint32 rf_filter_index)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setReverseApiPort(qint32 reverse_api_port)
void setCenterFrequency(qint64 center_frequency)
void setIfFilterIndex(qint32 if_filter_index)
void setTransverterMode(qint32 transverter_mode)
void setFileRecordName(QString *file_record_name)
virtual void fromJsonObject(QJsonObject &json) override
void setLOppmTenths(qint32 l_oppm_tenths)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual QJsonObject * asJsonObject() override
virtual SWGFCDProPlusSettings * fromJson(QString &jsonString) override
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiAddress(QString *reverse_api_address)