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.
SWGPerseusSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGPerseusSettings.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  adc_dither = 0;
40  m_adc_dither_isSet = false;
41  adc_preamp = 0;
42  m_adc_preamp_isSet = false;
43  wide_band = 0;
44  m_wide_band_isSet = false;
45  transverter_mode = 0;
49  file_record_name = nullptr;
51  attenuator = 0;
52  m_attenuator_isSet = false;
53  use_reverse_api = 0;
55  reverse_api_address = nullptr;
57  reverse_api_port = 0;
61 }
62 
64  this->cleanup();
65 }
66 
67 void
69  center_frequency = 0L;
71  l_oppm_tenths = 0;
72  m_l_oppm_tenths_isSet = false;
75  log2_decim = 0;
76  m_log2_decim_isSet = false;
77  adc_dither = 0;
78  m_adc_dither_isSet = false;
79  adc_preamp = 0;
80  m_adc_preamp_isSet = false;
81  wide_band = 0;
82  m_wide_band_isSet = false;
83  transverter_mode = 0;
87  file_record_name = new QString("");
89  attenuator = 0;
90  m_attenuator_isSet = false;
91  use_reverse_api = 0;
93  reverse_api_address = new QString("");
95  reverse_api_port = 0;
99 }
100 
101 void
103 
104 
105 
106 
107 
108 
109 
110 
111 
112  if(file_record_name != nullptr) {
113  delete file_record_name;
114  }
115 
116 
117  if(reverse_api_address != nullptr) {
118  delete reverse_api_address;
119  }
120 
121 
122 }
123 
126  QByteArray array (json.toStdString().c_str());
127  QJsonDocument doc = QJsonDocument::fromJson(array);
128  QJsonObject jsonObject = doc.object();
129  this->fromJsonObject(jsonObject);
130  return this;
131 }
132 
133 void
135  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
136 
137  ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
138 
139  ::SWGSDRangel::setValue(&dev_sample_rate_index, pJson["devSampleRateIndex"], "qint32", "");
140 
141  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
142 
143  ::SWGSDRangel::setValue(&adc_dither, pJson["adcDither"], "qint32", "");
144 
145  ::SWGSDRangel::setValue(&adc_preamp, pJson["adcPreamp"], "qint32", "");
146 
147  ::SWGSDRangel::setValue(&wide_band, pJson["wideBand"], "qint32", "");
148 
149  ::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
150 
151  ::SWGSDRangel::setValue(&transverter_delta_frequency, pJson["transverterDeltaFrequency"], "qint64", "");
152 
153  ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
154 
155  ::SWGSDRangel::setValue(&attenuator, pJson["attenuator"], "qint32", "");
156 
157  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
160 
161  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
162 
163  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
164 
165 }
166 
167 QString
169 {
170  QJsonObject* obj = this->asJsonObject();
171 
172  QJsonDocument doc(*obj);
173  QByteArray bytes = doc.toJson();
174  delete obj;
175  return QString(bytes);
176 }
177 
178 QJsonObject*
180  QJsonObject* obj = new QJsonObject();
182  obj->insert("centerFrequency", QJsonValue(center_frequency));
183  }
185  obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
186  }
188  obj->insert("devSampleRateIndex", QJsonValue(dev_sample_rate_index));
189  }
190  if(m_log2_decim_isSet){
191  obj->insert("log2Decim", QJsonValue(log2_decim));
192  }
193  if(m_adc_dither_isSet){
194  obj->insert("adcDither", QJsonValue(adc_dither));
195  }
196  if(m_adc_preamp_isSet){
197  obj->insert("adcPreamp", QJsonValue(adc_preamp));
198  }
199  if(m_wide_band_isSet){
200  obj->insert("wideBand", QJsonValue(wide_band));
201  }
203  obj->insert("transverterMode", QJsonValue(transverter_mode));
204  }
206  obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
207  }
208  if(file_record_name != nullptr && *file_record_name != QString("")){
209  toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
210  }
211  if(m_attenuator_isSet){
212  obj->insert("attenuator", QJsonValue(attenuator));
213  }
215  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
216  }
217  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
218  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
219  }
221  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
222  }
224  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
225  }
226 
227  return obj;
228 }
229 
230 qint64
232  return center_frequency;
233 }
234 void
236  this->center_frequency = center_frequency;
237  this->m_center_frequency_isSet = true;
238 }
239 
240 qint32
242  return l_oppm_tenths;
243 }
244 void
246  this->l_oppm_tenths = l_oppm_tenths;
247  this->m_l_oppm_tenths_isSet = true;
248 }
249 
250 qint32
252  return dev_sample_rate_index;
253 }
254 void
256  this->dev_sample_rate_index = dev_sample_rate_index;
257  this->m_dev_sample_rate_index_isSet = true;
258 }
259 
260 qint32
262  return log2_decim;
263 }
264 void
266  this->log2_decim = log2_decim;
267  this->m_log2_decim_isSet = true;
268 }
269 
270 qint32
272  return adc_dither;
273 }
274 void
276  this->adc_dither = adc_dither;
277  this->m_adc_dither_isSet = true;
278 }
279 
280 qint32
282  return adc_preamp;
283 }
284 void
286  this->adc_preamp = adc_preamp;
287  this->m_adc_preamp_isSet = true;
288 }
289 
290 qint32
292  return wide_band;
293 }
294 void
296  this->wide_band = wide_band;
297  this->m_wide_band_isSet = true;
298 }
299 
300 qint32
302  return transverter_mode;
303 }
304 void
306  this->transverter_mode = transverter_mode;
307  this->m_transverter_mode_isSet = true;
308 }
309 
310 qint64
313 }
314 void
316  this->transverter_delta_frequency = transverter_delta_frequency;
318 }
319 
320 QString*
322  return file_record_name;
323 }
324 void
326  this->file_record_name = file_record_name;
327  this->m_file_record_name_isSet = true;
328 }
329 
330 qint32
332  return attenuator;
333 }
334 void
336  this->attenuator = attenuator;
337  this->m_attenuator_isSet = true;
338 }
339 
340 qint32
342  return use_reverse_api;
343 }
344 void
346  this->use_reverse_api = use_reverse_api;
347  this->m_use_reverse_api_isSet = true;
348 }
349 
350 QString*
352  return reverse_api_address;
353 }
354 void
356  this->reverse_api_address = reverse_api_address;
357  this->m_reverse_api_address_isSet = true;
358 }
359 
360 qint32
362  return reverse_api_port;
363 }
364 void
366  this->reverse_api_port = reverse_api_port;
367  this->m_reverse_api_port_isSet = true;
368 }
369 
370 qint32
373 }
374 void
376  this->reverse_api_device_index = reverse_api_device_index;
378 }
379 
380 
381 bool
383  bool isObjectUpdated = false;
384  do{
385  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
386  if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
387  if(m_dev_sample_rate_index_isSet){ isObjectUpdated = true; break;}
388  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
389  if(m_adc_dither_isSet){ isObjectUpdated = true; break;}
390  if(m_adc_preamp_isSet){ isObjectUpdated = true; break;}
391  if(m_wide_band_isSet){ isObjectUpdated = true; break;}
392  if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
393  if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
394  if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
395  if(m_attenuator_isSet){ isObjectUpdated = true; break;}
396  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
397  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
398  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
399  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
400  }while(false);
401  return isObjectUpdated;
402 }
403 }
404 
void setLOppmTenths(qint32 l_oppm_tenths)
virtual QString asJson() override
virtual SWGPerseusSettings * fromJson(QString &jsonString) override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setTransverterMode(qint32 transverter_mode)
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiPort(qint32 reverse_api_port)
void setAdcPreamp(qint32 adc_preamp)
void setDevSampleRateIndex(qint32 dev_sample_rate_index)
void setReverseApiAddress(QString *reverse_api_address)
virtual void fromJsonObject(QJsonObject &json) override
void setAdcDither(qint32 adc_dither)
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setCenterFrequency(qint64 center_frequency)
void setFileRecordName(QString *file_record_name)
void setLog2Decim(qint32 log2_decim)
void setAttenuator(qint32 attenuator)
virtual QJsonObject * asJsonObject() override