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.
SWGLimeSdrOutputReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGLimeSdrOutputReport.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  success = 0;
32  m_success_isSet = false;
33  stream_active = 0;
34  m_stream_active_isSet = false;
35  fifo_size = 0;
36  m_fifo_size_isSet = false;
37  fifo_fill = 0;
38  m_fifo_fill_isSet = false;
39  underrun_count = 0;
40  m_underrun_count_isSet = false;
41  overrun_count = 0;
42  m_overrun_count_isSet = false;
45  link_rate = 0.0f;
46  m_link_rate_isSet = false;
47  hw_timestamp = 0;
48  m_hw_timestamp_isSet = false;
49  temperature = 0.0f;
50  m_temperature_isSet = false;
51  gpio_dir = 0;
52  m_gpio_dir_isSet = false;
53  gpio_pins = 0;
54  m_gpio_pins_isSet = false;
55 }
56 
58  this->cleanup();
59 }
60 
61 void
63  success = 0;
64  m_success_isSet = false;
65  stream_active = 0;
66  m_stream_active_isSet = false;
67  fifo_size = 0;
68  m_fifo_size_isSet = false;
69  fifo_fill = 0;
70  m_fifo_fill_isSet = false;
71  underrun_count = 0;
72  m_underrun_count_isSet = false;
73  overrun_count = 0;
74  m_overrun_count_isSet = false;
77  link_rate = 0.0f;
78  m_link_rate_isSet = false;
79  hw_timestamp = 0;
80  m_hw_timestamp_isSet = false;
81  temperature = 0.0f;
82  m_temperature_isSet = false;
83  gpio_dir = 0;
84  m_gpio_dir_isSet = false;
85  gpio_pins = 0;
86  m_gpio_pins_isSet = false;
87 }
88 
89 void
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 }
104 
107  QByteArray array (json.toStdString().c_str());
108  QJsonDocument doc = QJsonDocument::fromJson(array);
109  QJsonObject jsonObject = doc.object();
110  this->fromJsonObject(jsonObject);
111  return this;
112 }
113 
114 void
116  ::SWGSDRangel::setValue(&success, pJson["success"], "qint32", "");
117 
118  ::SWGSDRangel::setValue(&stream_active, pJson["streamActive"], "qint32", "");
119 
120  ::SWGSDRangel::setValue(&fifo_size, pJson["fifoSize"], "qint32", "");
121 
122  ::SWGSDRangel::setValue(&fifo_fill, pJson["fifoFill"], "qint32", "");
123 
124  ::SWGSDRangel::setValue(&underrun_count, pJson["underrunCount"], "qint32", "");
125 
126  ::SWGSDRangel::setValue(&overrun_count, pJson["overrunCount"], "qint32", "");
127 
128  ::SWGSDRangel::setValue(&dropped_packets_count, pJson["droppedPacketsCount"], "qint32", "");
129 
130  ::SWGSDRangel::setValue(&link_rate, pJson["linkRate"], "float", "");
131 
132  ::SWGSDRangel::setValue(&hw_timestamp, pJson["hwTimestamp"], "qint32", "");
133 
134  ::SWGSDRangel::setValue(&temperature, pJson["temperature"], "float", "");
135 
136  ::SWGSDRangel::setValue(&gpio_dir, pJson["gpioDir"], "qint32", "");
137 
138  ::SWGSDRangel::setValue(&gpio_pins, pJson["gpioPins"], "qint32", "");
139 
140 }
141 
142 QString
144 {
145  QJsonObject* obj = this->asJsonObject();
146 
147  QJsonDocument doc(*obj);
148  QByteArray bytes = doc.toJson();
149  delete obj;
150  return QString(bytes);
151 }
152 
153 QJsonObject*
155  QJsonObject* obj = new QJsonObject();
156  if(m_success_isSet){
157  obj->insert("success", QJsonValue(success));
158  }
160  obj->insert("streamActive", QJsonValue(stream_active));
161  }
162  if(m_fifo_size_isSet){
163  obj->insert("fifoSize", QJsonValue(fifo_size));
164  }
165  if(m_fifo_fill_isSet){
166  obj->insert("fifoFill", QJsonValue(fifo_fill));
167  }
169  obj->insert("underrunCount", QJsonValue(underrun_count));
170  }
172  obj->insert("overrunCount", QJsonValue(overrun_count));
173  }
175  obj->insert("droppedPacketsCount", QJsonValue(dropped_packets_count));
176  }
177  if(m_link_rate_isSet){
178  obj->insert("linkRate", QJsonValue(link_rate));
179  }
181  obj->insert("hwTimestamp", QJsonValue(hw_timestamp));
182  }
184  obj->insert("temperature", QJsonValue(temperature));
185  }
186  if(m_gpio_dir_isSet){
187  obj->insert("gpioDir", QJsonValue(gpio_dir));
188  }
189  if(m_gpio_pins_isSet){
190  obj->insert("gpioPins", QJsonValue(gpio_pins));
191  }
192 
193  return obj;
194 }
195 
196 qint32
198  return success;
199 }
200 void
202  this->success = success;
203  this->m_success_isSet = true;
204 }
205 
206 qint32
208  return stream_active;
209 }
210 void
212  this->stream_active = stream_active;
213  this->m_stream_active_isSet = true;
214 }
215 
216 qint32
218  return fifo_size;
219 }
220 void
222  this->fifo_size = fifo_size;
223  this->m_fifo_size_isSet = true;
224 }
225 
226 qint32
228  return fifo_fill;
229 }
230 void
232  this->fifo_fill = fifo_fill;
233  this->m_fifo_fill_isSet = true;
234 }
235 
236 qint32
238  return underrun_count;
239 }
240 void
242  this->underrun_count = underrun_count;
243  this->m_underrun_count_isSet = true;
244 }
245 
246 qint32
248  return overrun_count;
249 }
250 void
252  this->overrun_count = overrun_count;
253  this->m_overrun_count_isSet = true;
254 }
255 
256 qint32
258  return dropped_packets_count;
259 }
260 void
262  this->dropped_packets_count = dropped_packets_count;
263  this->m_dropped_packets_count_isSet = true;
264 }
265 
266 float
268  return link_rate;
269 }
270 void
272  this->link_rate = link_rate;
273  this->m_link_rate_isSet = true;
274 }
275 
276 qint32
278  return hw_timestamp;
279 }
280 void
282  this->hw_timestamp = hw_timestamp;
283  this->m_hw_timestamp_isSet = true;
284 }
285 
286 float
288  return temperature;
289 }
290 void
292  this->temperature = temperature;
293  this->m_temperature_isSet = true;
294 }
295 
296 qint32
298  return gpio_dir;
299 }
300 void
302  this->gpio_dir = gpio_dir;
303  this->m_gpio_dir_isSet = true;
304 }
305 
306 qint32
308  return gpio_pins;
309 }
310 void
312  this->gpio_pins = gpio_pins;
313  this->m_gpio_pins_isSet = true;
314 }
315 
316 
317 bool
319  bool isObjectUpdated = false;
320  do{
321  if(m_success_isSet){ isObjectUpdated = true; break;}
322  if(m_stream_active_isSet){ isObjectUpdated = true; break;}
323  if(m_fifo_size_isSet){ isObjectUpdated = true; break;}
324  if(m_fifo_fill_isSet){ isObjectUpdated = true; break;}
325  if(m_underrun_count_isSet){ isObjectUpdated = true; break;}
326  if(m_overrun_count_isSet){ isObjectUpdated = true; break;}
327  if(m_dropped_packets_count_isSet){ isObjectUpdated = true; break;}
328  if(m_link_rate_isSet){ isObjectUpdated = true; break;}
329  if(m_hw_timestamp_isSet){ isObjectUpdated = true; break;}
330  if(m_temperature_isSet){ isObjectUpdated = true; break;}
331  if(m_gpio_dir_isSet){ isObjectUpdated = true; break;}
332  if(m_gpio_pins_isSet){ isObjectUpdated = true; break;}
333  }while(false);
334  return isObjectUpdated;
335 }
336 }
337 
void setDroppedPacketsCount(qint32 dropped_packets_count)
void setUnderrunCount(qint32 underrun_count)
virtual void fromJsonObject(QJsonObject &json) override
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual SWGLimeSdrOutputReport * fromJson(QString &jsonString) override
virtual QJsonObject * asJsonObject() override