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.
SWGHackRFInputSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGHackRFInputSettings.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;
35  bandwidth = 0;
36  m_bandwidth_isSet = false;
37  lna_gain = 0;
38  m_lna_gain_isSet = false;
39  vga_gain = 0;
40  m_vga_gain_isSet = false;
41  log2_decim = 0;
42  m_log2_decim_isSet = false;
43  fc_pos = 0;
44  m_fc_pos_isSet = false;
45  dev_sample_rate = 0;
47  bias_t = 0;
48  m_bias_t_isSet = false;
49  lna_ext = 0;
50  m_lna_ext_isSet = false;
51  dc_block = 0;
52  m_dc_block_isSet = false;
53  iq_correction = 0;
54  m_iq_correction_isSet = false;
55  file_record_name = nullptr;
57  use_reverse_api = 0;
59  reverse_api_address = nullptr;
61  reverse_api_port = 0;
65 }
66 
68  this->cleanup();
69 }
70 
71 void
73  center_frequency = 0L;
75  l_oppm_tenths = 0;
76  m_l_oppm_tenths_isSet = false;
77  bandwidth = 0;
78  m_bandwidth_isSet = false;
79  lna_gain = 0;
80  m_lna_gain_isSet = false;
81  vga_gain = 0;
82  m_vga_gain_isSet = false;
83  log2_decim = 0;
84  m_log2_decim_isSet = false;
85  fc_pos = 0;
86  m_fc_pos_isSet = false;
87  dev_sample_rate = 0;
89  bias_t = 0;
90  m_bias_t_isSet = false;
91  lna_ext = 0;
92  m_lna_ext_isSet = false;
93  dc_block = 0;
94  m_dc_block_isSet = false;
95  iq_correction = 0;
96  m_iq_correction_isSet = false;
97  file_record_name = new QString("");
99  use_reverse_api = 0;
100  m_use_reverse_api_isSet = false;
101  reverse_api_address = new QString("");
103  reverse_api_port = 0;
104  m_reverse_api_port_isSet = false;
107 }
108 
109 void
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123  if(file_record_name != nullptr) {
124  delete file_record_name;
125  }
126 
127  if(reverse_api_address != nullptr) {
128  delete reverse_api_address;
129  }
130 
131 
132 }
133 
136  QByteArray array (json.toStdString().c_str());
137  QJsonDocument doc = QJsonDocument::fromJson(array);
138  QJsonObject jsonObject = doc.object();
139  this->fromJsonObject(jsonObject);
140  return this;
141 }
142 
143 void
145  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
146 
147  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
148 
149  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
150 
151  ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
152 
153  ::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", "");
154 
155  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
156 
157  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
160 
161  ::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
162 
163  ::SWGSDRangel::setValue(&lna_ext, pJson["lnaExt"], "qint32", "");
164 
165  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
166 
167  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "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 }
180 
181 QString
183 {
184  QJsonObject* obj = this->asJsonObject();
185 
186  QJsonDocument doc(*obj);
187  QByteArray bytes = doc.toJson();
188  delete obj;
189  return QString(bytes);
190 }
191 
192 QJsonObject*
194  QJsonObject* obj = new QJsonObject();
196  obj->insert("centerFrequency", QJsonValue(center_frequency));
197  }
199  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
200  }
201  if(m_bandwidth_isSet){
202  obj->insert("bandwidth", QJsonValue(bandwidth));
203  }
204  if(m_lna_gain_isSet){
205  obj->insert("lnaGain", QJsonValue(lna_gain));
206  }
207  if(m_vga_gain_isSet){
208  obj->insert("vgaGain", QJsonValue(vga_gain));
209  }
210  if(m_log2_decim_isSet){
211  obj->insert("log2Decim", QJsonValue(log2_decim));
212  }
213  if(m_fc_pos_isSet){
214  obj->insert("fcPos", QJsonValue(fc_pos));
215  }
217  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
218  }
219  if(m_bias_t_isSet){
220  obj->insert("biasT", QJsonValue(bias_t));
221  }
222  if(m_lna_ext_isSet){
223  obj->insert("lnaExt", QJsonValue(lna_ext));
224  }
225  if(m_dc_block_isSet){
226  obj->insert("dcBlock", QJsonValue(dc_block));
227  }
229  obj->insert("iqCorrection", QJsonValue(iq_correction));
230  }
231  if(file_record_name != nullptr && *file_record_name != QString("")){
232  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
233  }
235  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
236  }
237  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
238  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
239  }
241  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
242  }
244  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
245  }
246 
247  return obj;
248 }
249 
250 qint64
252  return center_frequency;
253 }
254 void
256  this->center_frequency = center_frequency;
257  this->m_center_frequency_isSet = true;
258 }
259 
260 qint32
262  return l_oppm_tenths;
263 }
264 void
266  this->l_oppm_tenths = l_oppm_tenths;
267  this->m_l_oppm_tenths_isSet = true;
268 }
269 
270 qint32
272  return bandwidth;
273 }
274 void
276  this->bandwidth = bandwidth;
277  this->m_bandwidth_isSet = true;
278 }
279 
280 qint32
282  return lna_gain;
283 }
284 void
286  this->lna_gain = lna_gain;
287  this->m_lna_gain_isSet = true;
288 }
289 
290 qint32
292  return vga_gain;
293 }
294 void
296  this->vga_gain = vga_gain;
297  this->m_vga_gain_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 fc_pos;
313 }
314 void
316  this->fc_pos = fc_pos;
317  this->m_fc_pos_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 bias_t;
333 }
334 void
336  this->bias_t = bias_t;
337  this->m_bias_t_isSet = true;
338 }
339 
340 qint32
342  return lna_ext;
343 }
344 void
346  this->lna_ext = lna_ext;
347  this->m_lna_ext_isSet = true;
348 }
349 
350 qint32
352  return dc_block;
353 }
354 void
356  this->dc_block = dc_block;
357  this->m_dc_block_isSet = true;
358 }
359 
360 qint32
362  return iq_correction;
363 }
364 void
366  this->iq_correction = iq_correction;
367  this->m_iq_correction_isSet = true;
368 }
369 
370 QString*
372  return file_record_name;
373 }
374 void
376  this->file_record_name = file_record_name;
377  this->m_file_record_name_isSet = true;
378 }
379 
380 qint32
382  return use_reverse_api;
383 }
384 void
386  this->use_reverse_api = use_reverse_api;
387  this->m_use_reverse_api_isSet = true;
388 }
389 
390 QString*
392  return reverse_api_address;
393 }
394 void
396  this->reverse_api_address = reverse_api_address;
397  this->m_reverse_api_address_isSet = true;
398 }
399 
400 qint32
402  return reverse_api_port;
403 }
404 void
406  this->reverse_api_port = reverse_api_port;
407  this->m_reverse_api_port_isSet = true;
408 }
409 
410 qint32
413 }
414 void
416  this->reverse_api_device_index = reverse_api_device_index;
418 }
419 
420 
421 bool
423  bool isObjectUpdated = false;
424  do{
425  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
426  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
427  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
428  if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
429  if(m_vga_gain_isSet){ isObjectUpdated = true; break;}
430  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
431  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
432  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
433  if(m_bias_t_isSet){ isObjectUpdated = true; break;}
434  if(m_lna_ext_isSet){ isObjectUpdated = true; break;}
435  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
436  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
437  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
438  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
439  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
440  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
441  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
442  }while(false);
443  return isObjectUpdated;
444 }
445 }
446 
virtual void fromJsonObject(QJsonObject &json) override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setReverseApiAddress(QString *reverse_api_address)
void setFileRecordName(QString *file_record_name)
void setUseReverseApi(qint32 use_reverse_api)
virtual QJsonObject * asJsonObject() override
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)
virtual SWGHackRFInputSettings * fromJson(QString &jsonString) override
void setDevSampleRate(qint32 dev_sample_rate)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)