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.
SWGBladeRF2InputSettings.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  l_oppm_tenths = 0;
34  m_l_oppm_tenths_isSet = false;
35  dev_sample_rate = 0;
37  bandwidth = 0;
38  m_bandwidth_isSet = false;
39  gain_mode = 0;
40  m_gain_mode_isSet = false;
41  global_gain = 0;
42  m_global_gain_isSet = false;
43  bias_tee = 0;
44  m_bias_tee_isSet = false;
45  log2_decim = 0;
46  m_log2_decim_isSet = false;
47  fc_pos = 0;
48  m_fc_pos_isSet = false;
49  dc_block = 0;
50  m_dc_block_isSet = false;
51  iq_correction = 0;
52  m_iq_correction_isSet = false;
53  transverter_mode = 0;
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  l_oppm_tenths = 0;
78  m_l_oppm_tenths_isSet = false;
79  dev_sample_rate = 0;
81  bandwidth = 0;
82  m_bandwidth_isSet = false;
83  gain_mode = 0;
84  m_gain_mode_isSet = false;
85  global_gain = 0;
86  m_global_gain_isSet = false;
87  bias_tee = 0;
88  m_bias_tee_isSet = false;
89  log2_decim = 0;
90  m_log2_decim_isSet = false;
91  fc_pos = 0;
92  m_fc_pos_isSet = false;
93  dc_block = 0;
94  m_dc_block_isSet = false;
95  iq_correction = 0;
96  m_iq_correction_isSet = false;
97  transverter_mode = 0;
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(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
153 
154  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
155 
156  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
157 
158  ::SWGSDRangel::setValue(&gain_mode, pJson["gainMode"], "qint32", "");
159 
160  ::SWGSDRangel::setValue(&global_gain, pJson["globalGain"], "qint32", "");
161 
162  ::SWGSDRangel::setValue(&bias_tee, pJson["biasTee"], "qint32", "");
163 
164  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
165 
166  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&dc_block, pJson["dcBlock"], "qint32", "");
169 
170  ::SWGSDRangel::setValue(&iq_correction, pJson["iqCorrection"], "qint32", "");
171 
172  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
173 
174  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
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("LOppmTenths", QJsonValue(l_oppm_tenths));
207  }
209  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
210  }
211  if(m_bandwidth_isSet){
212  obj->insert("bandwidth", QJsonValue(bandwidth));
213  }
214  if(m_gain_mode_isSet){
215  obj->insert("gainMode", QJsonValue(gain_mode));
216  }
218  obj->insert("globalGain", QJsonValue(global_gain));
219  }
220  if(m_bias_tee_isSet){
221  obj->insert("biasTee", QJsonValue(bias_tee));
222  }
223  if(m_log2_decim_isSet){
224  obj->insert("log2Decim", QJsonValue(log2_decim));
225  }
226  if(m_fc_pos_isSet){
227  obj->insert("fcPos", QJsonValue(fc_pos));
228  }
229  if(m_dc_block_isSet){
230  obj->insert("dcBlock", QJsonValue(dc_block));
231  }
233  obj->insert("iqCorrection", QJsonValue(iq_correction));
234  }
236  obj->insert("transverterMode", QJsonValue(transverter_mode));
237  }
239  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
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 l_oppm_tenths;
273 }
274 void
276  this->l_oppm_tenths = l_oppm_tenths;
277  this->m_l_oppm_tenths_isSet = true;
278 }
279 
280 qint32
282  return dev_sample_rate;
283 }
284 void
286  this->dev_sample_rate = dev_sample_rate;
287  this->m_dev_sample_rate_isSet = true;
288 }
289 
290 qint32
292  return bandwidth;
293 }
294 void
296  this->bandwidth = bandwidth;
297  this->m_bandwidth_isSet = true;
298 }
299 
300 qint32
302  return gain_mode;
303 }
304 void
306  this->gain_mode = gain_mode;
307  this->m_gain_mode_isSet = true;
308 }
309 
310 qint32
312  return global_gain;
313 }
314 void
316  this->global_gain = global_gain;
317  this->m_global_gain_isSet = true;
318 }
319 
320 qint32
322  return bias_tee;
323 }
324 void
326  this->bias_tee = bias_tee;
327  this->m_bias_tee_isSet = true;
328 }
329 
330 qint32
332  return log2_decim;
333 }
334 void
336  this->log2_decim = log2_decim;
337  this->m_log2_decim_isSet = true;
338 }
339 
340 qint32
342  return fc_pos;
343 }
344 void
346  this->fc_pos = fc_pos;
347  this->m_fc_pos_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 qint32
372  return transverter_mode;
373 }
374 void
376  this->transverter_mode = transverter_mode;
377  this->m_transverter_mode_isSet = true;
378 }
379 
380 qint64
383 }
384 void
386  this->transverter_delta_frequency = transverter_delta_frequency;
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_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
447  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
448  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
449  if(m_gain_mode_isSet){ isObjectUpdated = true; break;}
450  if(m_global_gain_isSet){ isObjectUpdated = true; break;}
451  if(m_bias_tee_isSet){ isObjectUpdated = true; break;}
452  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
453  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
454  if(m_dc_block_isSet){ isObjectUpdated = true; break;}
455  if(m_iq_correction_isSet){ isObjectUpdated = true; break;}
456  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
457  if(m_transverter_delta_frequency_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 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 setTransverterMode(qint32 transverter_mode)
void setCenterFrequency(qint64 center_frequency)
virtual QJsonObject * asJsonObject() override
virtual void fromJsonObject(QJsonObject &json) override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setReverseApiPort(qint32 reverse_api_port)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual SWGBladeRF2InputSettings * fromJson(QString &jsonString) override