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.
SWGBladeRF1InputSettings.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  dev_sample_rate = 0;
35  lna_gain = 0;
36  m_lna_gain_isSet = false;
37  vga1 = 0;
38  m_vga1_isSet = false;
39  vga2 = 0;
40  m_vga2_isSet = false;
41  bandwidth = 0;
42  m_bandwidth_isSet = false;
43  log2_decim = 0;
44  m_log2_decim_isSet = false;
45  fc_pos = 0;
46  m_fc_pos_isSet = false;
47  xb200 = 0;
48  m_xb200_isSet = false;
49  xb200_path = 0;
50  m_xb200_path_isSet = false;
51  xb200_filter = 0;
52  m_xb200_filter_isSet = false;
53  dc_block = 0;
54  m_dc_block_isSet = false;
55  iq_correction = 0;
56  m_iq_correction_isSet = false;
57  file_record_name = nullptr;
59  use_reverse_api = 0;
61  reverse_api_address = nullptr;
63  reverse_api_port = 0;
67 }
68 
70  this->cleanup();
71 }
72 
73 void
75  center_frequency = 0L;
77  dev_sample_rate = 0;
79  lna_gain = 0;
80  m_lna_gain_isSet = false;
81  vga1 = 0;
82  m_vga1_isSet = false;
83  vga2 = 0;
84  m_vga2_isSet = false;
85  bandwidth = 0;
86  m_bandwidth_isSet = false;
87  log2_decim = 0;
88  m_log2_decim_isSet = false;
89  fc_pos = 0;
90  m_fc_pos_isSet = false;
91  xb200 = 0;
92  m_xb200_isSet = false;
93  xb200_path = 0;
94  m_xb200_path_isSet = false;
95  xb200_filter = 0;
96  m_xb200_filter_isSet = false;
97  dc_block = 0;
98  m_dc_block_isSet = false;
99  iq_correction = 0;
100  m_iq_correction_isSet = false;
101  file_record_name = new QString("");
102  m_file_record_name_isSet = false;
103  use_reverse_api = 0;
104  m_use_reverse_api_isSet = false;
105  reverse_api_address = new QString("");
107  reverse_api_port = 0;
108  m_reverse_api_port_isSet = false;
111 }
112 
113 void
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128  if(file_record_name != nullptr) {
129  delete file_record_name;
130  }
131 
132  if(reverse_api_address != nullptr) {
133  delete reverse_api_address;
134  }
135 
136 
137 }
138 
141  QByteArray array (json.toStdString().c_str());
142  QJsonDocument doc = QJsonDocument::fromJson(array);
143  QJsonObject jsonObject = doc.object();
144  this->fromJsonObject(jsonObject);
145  return this;
146 }
147 
148 void
150  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
151 
152  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
153 
154  ::SWGSDRangel::setValue(&lna_gain, pJson["lnaGain"], "qint32", "");
155 
156  ::SWGSDRangel::setValue(&vga1, pJson["vga1"], "qint32", "");
157 
158  ::SWGSDRangel::setValue(&vga2, pJson["vga2"], "qint32", "");
159 
160  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
161 
162  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
163 
164  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
165 
166  ::SWGSDRangel::setValue(&xb200, pJson["xb200"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&xb200_path, pJson["xb200Path"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&xb200_filter, pJson["xb200Filter"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
175 
176  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
177 
178  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
179 
180  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
181 
182  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
183 
184  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
185 
186 }
187 
188 QString
190 {
191  QJsonObject* obj = this->asJsonObject();
192 
193  QJsonDocument doc(*obj);
194  QByteArray bytes = doc.toJson();
195  delete obj;
196  return QString(bytes);
197 }
198 
199 QJsonObject*
201  QJsonObject* obj = new QJsonObject();
203  obj->insert("centerFrequency", QJsonValue(center_frequency));
204  }
206  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
207  }
208  if(m_lna_gain_isSet){
209  obj->insert("lnaGain", QJsonValue(lna_gain));
210  }
211  if(m_vga1_isSet){
212  obj->insert("vga1", QJsonValue(vga1));
213  }
214  if(m_vga2_isSet){
215  obj->insert("vga2", QJsonValue(vga2));
216  }
217  if(m_bandwidth_isSet){
218  obj->insert("bandwidth", QJsonValue(bandwidth));
219  }
220  if(m_log2_decim_isSet){
221  obj->insert("log2Decim", QJsonValue(log2_decim));
222  }
223  if(m_fc_pos_isSet){
224  obj->insert("fcPos", QJsonValue(fc_pos));
225  }
226  if(m_xb200_isSet){
227  obj->insert("xb200", QJsonValue(xb200));
228  }
229  if(m_xb200_path_isSet){
230  obj->insert("xb200Path", QJsonValue(xb200_path));
231  }
233  obj->insert("xb200Filter", QJsonValue(xb200_filter));
234  }
235  if(m_dc_block_isSet){
236  obj->insert("dcBlock", QJsonValue(dc_block));
237  }
239  obj->insert("iqCorrection", QJsonValue(iq_correction));
240  }
241  if(file_record_name != nullptr && *file_record_name != QString("")){
242  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
243  }
245  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
246  }
247  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
248  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
249  }
251  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
252  }
254  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
255  }
256 
257  return obj;
258 }
259 
260 qint64
262  return center_frequency;
263 }
264 void
266  this->center_frequency = center_frequency;
267  this->m_center_frequency_isSet = true;
268 }
269 
270 qint32
272  return dev_sample_rate;
273 }
274 void
276  this->dev_sample_rate = dev_sample_rate;
277  this->m_dev_sample_rate_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 vga1;
293 }
294 void
296  this->vga1 = vga1;
297  this->m_vga1_isSet = true;
298 }
299 
300 qint32
302  return vga2;
303 }
304 void
306  this->vga2 = vga2;
307  this->m_vga2_isSet = true;
308 }
309 
310 qint32
312  return bandwidth;
313 }
314 void
316  this->bandwidth = bandwidth;
317  this->m_bandwidth_isSet = true;
318 }
319 
320 qint32
322  return log2_decim;
323 }
324 void
326  this->log2_decim = log2_decim;
327  this->m_log2_decim_isSet = true;
328 }
329 
330 qint32
332  return fc_pos;
333 }
334 void
336  this->fc_pos = fc_pos;
337  this->m_fc_pos_isSet = true;
338 }
339 
340 qint32
342  return xb200;
343 }
344 void
346  this->xb200 = xb200;
347  this->m_xb200_isSet = true;
348 }
349 
350 qint32
352  return xb200_path;
353 }
354 void
356  this->xb200_path = xb200_path;
357  this->m_xb200_path_isSet = true;
358 }
359 
360 qint32
362  return xb200_filter;
363 }
364 void
366  this->xb200_filter = xb200_filter;
367  this->m_xb200_filter_isSet = true;
368 }
369 
370 qint32
372  return dc_block;
373 }
374 void
376  this->dc_block = dc_block;
377  this->m_dc_block_isSet = true;
378 }
379 
380 qint32
382  return iq_correction;
383 }
384 void
386  this->iq_correction = iq_correction;
387  this->m_iq_correction_isSet = true;
388 }
389 
390 QString*
392  return file_record_name;
393 }
394 void
396  this->file_record_name = file_record_name;
397  this->m_file_record_name_isSet = true;
398 }
399 
400 qint32
402  return use_reverse_api;
403 }
404 void
406  this->use_reverse_api = use_reverse_api;
407  this->m_use_reverse_api_isSet = true;
408 }
409 
410 QString*
412  return reverse_api_address;
413 }
414 void
416  this->reverse_api_address = reverse_api_address;
417  this->m_reverse_api_address_isSet = true;
418 }
419 
420 qint32
422  return reverse_api_port;
423 }
424 void
426  this->reverse_api_port = reverse_api_port;
427  this->m_reverse_api_port_isSet = true;
428 }
429 
430 qint32
433 }
434 void
436  this->reverse_api_device_index = reverse_api_device_index;
438 }
439 
440 
441 bool
443  bool isObjectUpdated = false;
444  do{
445  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
446  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
447  if(m_lna_gain_isSet){ isObjectUpdated = true; break;}
448  if(m_vga1_isSet){ isObjectUpdated = true; break;}
449  if(m_vga2_isSet){ isObjectUpdated = true; break;}
450  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
451  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
452  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
453  if(m_xb200_isSet){ isObjectUpdated = true; break;}
454  if(m_xb200_path_isSet){ isObjectUpdated = true; break;}
455  if(m_xb200_filter_isSet){ isObjectUpdated = true; break;}
456  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
457  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
458  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
459  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
460  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
461  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
462  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
463  }while(false);
464  return isObjectUpdated;
465 }
466 }
467 
void setReverseApiAddress(QString *reverse_api_address)
virtual void fromJsonObject(QJsonObject &json) override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setFileRecordName(QString *file_record_name)
virtual QJsonObject * asJsonObject() override
void setReverseApiPort(qint32 reverse_api_port)
void setCenterFrequency(qint64 center_frequency)
virtual SWGBladeRF1InputSettings * fromJson(QString &jsonString) override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25