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.
SWGXtrxOutputSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGXtrxOutputSettings.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  dev_sample_rate = 0;
35  log2_hard_interp = 0;
37  log2_soft_interp = 0;
39  lpf_bw = 0;
40  m_lpf_bw_isSet = false;
41  gain = 0;
42  m_gain_isSet = false;
43  nco_enable = 0;
44  m_nco_enable_isSet = false;
45  nco_frequency = 0;
46  m_nco_frequency_isSet = false;
47  antenna_path = 0;
48  m_antenna_path_isSet = false;
49  ext_clock = 0;
50  m_ext_clock_isSet = false;
51  ext_clock_freq = 0;
52  m_ext_clock_freq_isSet = false;
53  pwrmode = 0;
54  m_pwrmode_isSet = false;
55  use_reverse_api = 0;
57  reverse_api_address = nullptr;
59  reverse_api_port = 0;
63 }
64 
66  this->cleanup();
67 }
68 
69 void
71  center_frequency = 0L;
73  dev_sample_rate = 0;
75  log2_hard_interp = 0;
77  log2_soft_interp = 0;
79  lpf_bw = 0;
80  m_lpf_bw_isSet = false;
81  gain = 0;
82  m_gain_isSet = false;
83  nco_enable = 0;
84  m_nco_enable_isSet = false;
85  nco_frequency = 0;
86  m_nco_frequency_isSet = false;
87  antenna_path = 0;
88  m_antenna_path_isSet = false;
89  ext_clock = 0;
90  m_ext_clock_isSet = false;
91  ext_clock_freq = 0;
92  m_ext_clock_freq_isSet = false;
93  pwrmode = 0;
94  m_pwrmode_isSet = false;
95  use_reverse_api = 0;
97  reverse_api_address = new QString("");
99  reverse_api_port = 0;
100  m_reverse_api_port_isSet = false;
103 }
104 
105 void
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120  if(reverse_api_address != nullptr) {
121  delete reverse_api_address;
122  }
123 
124 
125 }
126 
129  QByteArray array (json.toStdString().c_str());
130  QJsonDocument doc = QJsonDocument::fromJson(array);
131  QJsonObject jsonObject = doc.object();
132  this->fromJsonObject(jsonObject);
133  return this;
134 }
135 
136 void
138  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
139 
140  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
141 
142  ::SWGSDRangel::setValue(&log2_hard_interp, pJson["log2HardInterp"], "qint32", "");
143 
144  ::SWGSDRangel::setValue(&log2_soft_interp, pJson["log2SoftInterp"], "qint32", "");
145 
146  ::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
147 
148  ::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
149 
150  ::SWGSDRangel::setValue(&nco_enable, pJson["ncoEnable"], "qint32", "");
151 
152  ::SWGSDRangel::setValue(&nco_frequency, pJson["ncoFrequency"], "qint32", "");
153 
154  ::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
155 
156  ::SWGSDRangel::setValue(&ext_clock, pJson["extClock"], "qint32", "");
157 
158  ::SWGSDRangel::setValue(&ext_clock_freq, pJson["extClockFreq"], "qint32", "");
159 
160  ::SWGSDRangel::setValue(&pwrmode, pJson["pwrmode"], "qint32", "");
161 
162  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
163 
164  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
165 
166  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
167 
168  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
169 
170 }
171 
172 QString
174 {
175  QJsonObject* obj = this->asJsonObject();
176 
177  QJsonDocument doc(*obj);
178  QByteArray bytes = doc.toJson();
179  delete obj;
180  return QString(bytes);
181 }
182 
183 QJsonObject*
185  QJsonObject* obj = new QJsonObject();
187  obj->insert("centerFrequency", QJsonValue(center_frequency));
188  }
190  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
191  }
193  obj->insert("log2HardInterp", QJsonValue(log2_hard_interp));
194  }
196  obj->insert("log2SoftInterp", QJsonValue(log2_soft_interp));
197  }
198  if(m_lpf_bw_isSet){
199  obj->insert("lpfBW", QJsonValue(lpf_bw));
200  }
201  if(m_gain_isSet){
202  obj->insert("gain", QJsonValue(gain));
203  }
204  if(m_nco_enable_isSet){
205  obj->insert("ncoEnable", QJsonValue(nco_enable));
206  }
208  obj->insert("ncoFrequency", QJsonValue(nco_frequency));
209  }
211  obj->insert("antennaPath", QJsonValue(antenna_path));
212  }
213  if(m_ext_clock_isSet){
214  obj->insert("extClock", QJsonValue(ext_clock));
215  }
217  obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
218  }
219  if(m_pwrmode_isSet){
220  obj->insert("pwrmode", QJsonValue(pwrmode));
221  }
223  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
224  }
225  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
226  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
227  }
229  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
230  }
232  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
233  }
234 
235  return obj;
236 }
237 
238 qint64
240  return center_frequency;
241 }
242 void
244  this->center_frequency = center_frequency;
245  this->m_center_frequency_isSet = true;
246 }
247 
248 qint32
250  return dev_sample_rate;
251 }
252 void
254  this->dev_sample_rate = dev_sample_rate;
255  this->m_dev_sample_rate_isSet = true;
256 }
257 
258 qint32
260  return log2_hard_interp;
261 }
262 void
264  this->log2_hard_interp = log2_hard_interp;
265  this->m_log2_hard_interp_isSet = true;
266 }
267 
268 qint32
270  return log2_soft_interp;
271 }
272 void
274  this->log2_soft_interp = log2_soft_interp;
275  this->m_log2_soft_interp_isSet = true;
276 }
277 
278 qint32
280  return lpf_bw;
281 }
282 void
284  this->lpf_bw = lpf_bw;
285  this->m_lpf_bw_isSet = true;
286 }
287 
288 qint32
290  return gain;
291 }
292 void
294  this->gain = gain;
295  this->m_gain_isSet = true;
296 }
297 
298 qint32
300  return nco_enable;
301 }
302 void
304  this->nco_enable = nco_enable;
305  this->m_nco_enable_isSet = true;
306 }
307 
308 qint32
310  return nco_frequency;
311 }
312 void
314  this->nco_frequency = nco_frequency;
315  this->m_nco_frequency_isSet = true;
316 }
317 
318 qint32
320  return antenna_path;
321 }
322 void
324  this->antenna_path = antenna_path;
325  this->m_antenna_path_isSet = true;
326 }
327 
328 qint32
330  return ext_clock;
331 }
332 void
334  this->ext_clock = ext_clock;
335  this->m_ext_clock_isSet = true;
336 }
337 
338 qint32
340  return ext_clock_freq;
341 }
342 void
344  this->ext_clock_freq = ext_clock_freq;
345  this->m_ext_clock_freq_isSet = true;
346 }
347 
348 qint32
350  return pwrmode;
351 }
352 void
354  this->pwrmode = pwrmode;
355  this->m_pwrmode_isSet = true;
356 }
357 
358 qint32
360  return use_reverse_api;
361 }
362 void
364  this->use_reverse_api = use_reverse_api;
365  this->m_use_reverse_api_isSet = true;
366 }
367 
368 QString*
370  return reverse_api_address;
371 }
372 void
374  this->reverse_api_address = reverse_api_address;
375  this->m_reverse_api_address_isSet = true;
376 }
377 
378 qint32
380  return reverse_api_port;
381 }
382 void
384  this->reverse_api_port = reverse_api_port;
385  this->m_reverse_api_port_isSet = true;
386 }
387 
388 qint32
391 }
392 void
394  this->reverse_api_device_index = reverse_api_device_index;
396 }
397 
398 
399 bool
401  bool isObjectUpdated = false;
402  do{
403  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
404  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
405  if(m_log2_hard_interp_isSet){ isObjectUpdated = true; break;}
406  if(m_log2_soft_interp_isSet){ isObjectUpdated = true; break;}
407  if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
408  if(m_gain_isSet){ isObjectUpdated = true; break;}
409  if(m_nco_enable_isSet){ isObjectUpdated = true; break;}
410  if(m_nco_frequency_isSet){ isObjectUpdated = true; break;}
411  if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
412  if(m_ext_clock_isSet){ isObjectUpdated = true; break;}
413  if(m_ext_clock_freq_isSet){ isObjectUpdated = true; break;}
414  if(m_pwrmode_isSet){ isObjectUpdated = true; break;}
415  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
416  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
417  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
418  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
419  }while(false);
420  return isObjectUpdated;
421 }
422 }
423 
virtual SWGXtrxOutputSettings * fromJson(QString &jsonString) override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setExtClockFreq(qint32 ext_clock_freq)
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiPort(qint32 reverse_api_port)
virtual void fromJsonObject(QJsonObject &json) override
void setNcoFrequency(qint32 nco_frequency)
void setLog2SoftInterp(qint32 log2_soft_interp)
void setLog2HardInterp(qint32 log2_hard_interp)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setDevSampleRate(qint32 dev_sample_rate)
virtual QJsonObject * asJsonObject() override
void setReverseApiAddress(QString *reverse_api_address)
void setCenterFrequency(qint64 center_frequency)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)