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.
SWGHackRFOutputSettings.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  bandwidth = 0;
36  m_bandwidth_isSet = false;
37  vga_gain = 0;
38  m_vga_gain_isSet = false;
39  log2_interp = 0;
40  m_log2_interp_isSet = false;
41  fc_pos = 0;
42  m_fc_pos_isSet = false;
43  dev_sample_rate = 0;
45  bias_t = 0;
46  m_bias_t_isSet = false;
47  lna_ext = 0;
48  m_lna_ext_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  l_oppm_tenths = 0;
68  m_l_oppm_tenths_isSet = false;
69  bandwidth = 0;
70  m_bandwidth_isSet = false;
71  vga_gain = 0;
72  m_vga_gain_isSet = false;
73  log2_interp = 0;
74  m_log2_interp_isSet = false;
75  fc_pos = 0;
76  m_fc_pos_isSet = false;
77  dev_sample_rate = 0;
79  bias_t = 0;
80  m_bias_t_isSet = false;
81  lna_ext = 0;
82  m_lna_ext_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(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
126 
127  ::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
128 
129  ::SWGSDRangel::setValue(&vga_gain, pJson["vgaGain"], "qint32", "");
130 
131  ::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "qint32", "");
132 
133  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
134 
135  ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
136 
137  ::SWGSDRangel::setValue(&bias_t, pJson["biasT"], "qint32", "");
138 
139  ::SWGSDRangel::setValue(&lna_ext, pJson["lnaExt"], "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("LOppmTenths", QJsonValue(l_oppm_tenths));
170  }
171  if(m_bandwidth_isSet){
172  obj->insert("bandwidth", QJsonValue(bandwidth));
173  }
174  if(m_vga_gain_isSet){
175  obj->insert("vgaGain", QJsonValue(vga_gain));
176  }
178  obj->insert("log2Interp", QJsonValue(log2_interp));
179  }
180  if(m_fc_pos_isSet){
181  obj->insert("fcPos", QJsonValue(fc_pos));
182  }
184  obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
185  }
186  if(m_bias_t_isSet){
187  obj->insert("biasT", QJsonValue(bias_t));
188  }
189  if(m_lna_ext_isSet){
190  obj->insert("lnaExt", QJsonValue(lna_ext));
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 l_oppm_tenths;
221 }
222 void
224  this->l_oppm_tenths = l_oppm_tenths;
225  this->m_l_oppm_tenths_isSet = true;
226 }
227 
228 qint32
230  return bandwidth;
231 }
232 void
234  this->bandwidth = bandwidth;
235  this->m_bandwidth_isSet = true;
236 }
237 
238 qint32
240  return vga_gain;
241 }
242 void
244  this->vga_gain = vga_gain;
245  this->m_vga_gain_isSet = true;
246 }
247 
248 qint32
250  return log2_interp;
251 }
252 void
254  this->log2_interp = log2_interp;
255  this->m_log2_interp_isSet = true;
256 }
257 
258 qint32
260  return fc_pos;
261 }
262 void
264  this->fc_pos = fc_pos;
265  this->m_fc_pos_isSet = true;
266 }
267 
268 qint32
270  return dev_sample_rate;
271 }
272 void
274  this->dev_sample_rate = dev_sample_rate;
275  this->m_dev_sample_rate_isSet = true;
276 }
277 
278 qint32
280  return bias_t;
281 }
282 void
284  this->bias_t = bias_t;
285  this->m_bias_t_isSet = true;
286 }
287 
288 qint32
290  return lna_ext;
291 }
292 void
294  this->lna_ext = lna_ext;
295  this->m_lna_ext_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_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
345  if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
346  if(m_vga_gain_isSet){ isObjectUpdated = true; break;}
347  if(m_log2_interp_isSet){ isObjectUpdated = true; break;}
348  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
349  if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
350  if(m_bias_t_isSet){ isObjectUpdated = true; break;}
351  if(m_lna_ext_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 
virtual QJsonObject * asJsonObject() override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setUseReverseApi(qint32 use_reverse_api)
virtual SWGHackRFOutputSettings * fromJson(QString &jsonString) override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiPort(qint32 reverse_api_port)
void setDevSampleRate(qint32 dev_sample_rate)
virtual void fromJsonObject(QJsonObject &json) override
void setCenterFrequency(qint64 center_frequency)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiAddress(QString *reverse_api_address)