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.
SWGBladeRF1OutputSettings.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  vga1 = 0;
36  m_vga1_isSet = false;
37  vga2 = 0;
38  m_vga2_isSet = false;
39  bandwidth = 0;
40  m_bandwidth_isSet = false;
41  log2_interp = 0;
42  m_log2_interp_isSet = false;
43  xb200 = 0;
44  m_xb200_isSet = false;
45  xb200_path = 0;
46  m_xb200_path_isSet = false;
47  xb200_filter = 0;
48  m_xb200_filter_isSet = false;
49  use_reverse_api = 0;
51  reverse_api_address = nullptr;
53  reverse_api_port = 0;
57 }
58 
60  this->cleanup();
61 }
62 
63 void
65  center_frequency = 0L;
67  dev_sample_rate = 0;
69  vga1 = 0;
70  m_vga1_isSet = false;
71  vga2 = 0;
72  m_vga2_isSet = false;
73  bandwidth = 0;
74  m_bandwidth_isSet = false;
75  log2_interp = 0;
76  m_log2_interp_isSet = false;
77  xb200 = 0;
78  m_xb200_isSet = false;
79  xb200_path = 0;
80  m_xb200_path_isSet = false;
81  xb200_filter = 0;
82  m_xb200_filter_isSet = false;
83  use_reverse_api = 0;
85  reverse_api_address = new QString("");
87  reverse_api_port = 0;
91 }
92 
93 void
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105  if(reverse_api_address != nullptr) {
106  delete reverse_api_address;
107  }
108 
109 
110 }
111 
114  QByteArray array (json.toStdString().c_str());
115  QJsonDocument doc = QJsonDocument::fromJson(array);
116  QJsonObject jsonObject = doc.object();
117  this->fromJsonObject(jsonObject);
118  return this;
119 }
120 
121 void
123  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
124 
125  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
126 
127  ::SWGSDRangel::setValue(&vga1, pJson["vga1"], "qint32", "");
128 
129  ::SWGSDRangel::setValue(&vga2, pJson["vga2"], "qint32", "");
130 
131  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
132 
133  ::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "qint32", "");
134 
135  ::SWGSDRangel::setValue(&xb200, pJson["xb200"], "qint32", "");
136 
137  ::SWGSDRangel::setValue(&xb200_path, pJson["xb200Path"], "qint32", "");
138 
139  ::SWGSDRangel::setValue(&xb200_filter, pJson["xb200Filter"], "qint32", "");
140 
141  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
142 
143  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
144 
145  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
146 
147  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
148 
149 }
150 
151 QString
153 {
154  QJsonObject* obj = this->asJsonObject();
155 
156  QJsonDocument doc(*obj);
157  QByteArray bytes = doc.toJson();
158  delete obj;
159  return QString(bytes);
160 }
161 
162 QJsonObject*
164  QJsonObject* obj = new QJsonObject();
166  obj->insert("centerFrequency", QJsonValue(center_frequency));
167  }
169  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
170  }
171  if(m_vga1_isSet){
172  obj->insert("vga1", QJsonValue(vga1));
173  }
174  if(m_vga2_isSet){
175  obj->insert("vga2", QJsonValue(vga2));
176  }
177  if(m_bandwidth_isSet){
178  obj->insert("bandwidth", QJsonValue(bandwidth));
179  }
181  obj->insert("log2Interp", QJsonValue(log2_interp));
182  }
183  if(m_xb200_isSet){
184  obj->insert("xb200", QJsonValue(xb200));
185  }
186  if(m_xb200_path_isSet){
187  obj->insert("xb200Path", QJsonValue(xb200_path));
188  }
190  obj->insert("xb200Filter", QJsonValue(xb200_filter));
191  }
193  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
194  }
195  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
196  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
197  }
199  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
200  }
202  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
203  }
204 
205  return obj;
206 }
207 
208 qint64
210  return center_frequency;
211 }
212 void
214  this->center_frequency = center_frequency;
215  this->m_center_frequency_isSet = true;
216 }
217 
218 qint32
220  return dev_sample_rate;
221 }
222 void
224  this->dev_sample_rate = dev_sample_rate;
225  this->m_dev_sample_rate_isSet = true;
226 }
227 
228 qint32
230  return vga1;
231 }
232 void
234  this->vga1 = vga1;
235  this->m_vga1_isSet = true;
236 }
237 
238 qint32
240  return vga2;
241 }
242 void
244  this->vga2 = vga2;
245  this->m_vga2_isSet = true;
246 }
247 
248 qint32
250  return bandwidth;
251 }
252 void
254  this->bandwidth = bandwidth;
255  this->m_bandwidth_isSet = true;
256 }
257 
258 qint32
260  return log2_interp;
261 }
262 void
264  this->log2_interp = log2_interp;
265  this->m_log2_interp_isSet = true;
266 }
267 
268 qint32
270  return xb200;
271 }
272 void
274  this->xb200 = xb200;
275  this->m_xb200_isSet = true;
276 }
277 
278 qint32
280  return xb200_path;
281 }
282 void
284  this->xb200_path = xb200_path;
285  this->m_xb200_path_isSet = true;
286 }
287 
288 qint32
290  return xb200_filter;
291 }
292 void
294  this->xb200_filter = xb200_filter;
295  this->m_xb200_filter_isSet = true;
296 }
297 
298 qint32
300  return use_reverse_api;
301 }
302 void
304  this->use_reverse_api = use_reverse_api;
305  this->m_use_reverse_api_isSet = true;
306 }
307 
308 QString*
310  return reverse_api_address;
311 }
312 void
314  this->reverse_api_address = reverse_api_address;
315  this->m_reverse_api_address_isSet = true;
316 }
317 
318 qint32
320  return reverse_api_port;
321 }
322 void
324  this->reverse_api_port = reverse_api_port;
325  this->m_reverse_api_port_isSet = true;
326 }
327 
328 qint32
331 }
332 void
334  this->reverse_api_device_index = reverse_api_device_index;
336 }
337 
338 
339 bool
341  bool isObjectUpdated = false;
342  do{
343  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
344  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
345  if(m_vga1_isSet){ isObjectUpdated = true; break;}
346  if(m_vga2_isSet){ isObjectUpdated = true; break;}
347  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
348  if(m_log2_interp_isSet){ isObjectUpdated = true; break;}
349  if(m_xb200_isSet){ isObjectUpdated = true; break;}
350  if(m_xb200_path_isSet){ isObjectUpdated = true; break;}
351  if(m_xb200_filter_isSet){ isObjectUpdated = true; break;}
352  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
353  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
354  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
355  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
356  }while(false);
357  return isObjectUpdated;
358 }
359 }
360 
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual SWGBladeRF1OutputSettings * fromJson(QString &jsonString) override
void setReverseApiAddress(QString *reverse_api_address)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual QJsonObject * asJsonObject() override
virtual void fromJsonObject(QJsonObject &json) override