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.
SWGAudioOutputDevice.cpp
Go to the documentation of this file.
1 
14 #include "SWGAudioOutputDevice.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  name = nullptr;
32  m_name_isSet = false;
33  index = 0;
34  m_index_isSet = false;
35  sample_rate = 0;
36  m_sample_rate_isSet = false;
41  copy_to_udp = 0;
42  m_copy_to_udp_isSet = false;
43  udp_uses_rtp = 0;
44  m_udp_uses_rtp_isSet = false;
45  udp_channel_mode = 0;
51  udp_address = nullptr;
52  m_udp_address_isSet = false;
53  udp_port = 0;
54  m_udp_port_isSet = false;
55 }
56 
58  this->cleanup();
59 }
60 
61 void
63  name = new QString("");
64  m_name_isSet = false;
65  index = 0;
66  m_index_isSet = false;
67  sample_rate = 0;
68  m_sample_rate_isSet = false;
73  copy_to_udp = 0;
74  m_copy_to_udp_isSet = false;
75  udp_uses_rtp = 0;
76  m_udp_uses_rtp_isSet = false;
77  udp_channel_mode = 0;
83  udp_address = new QString("");
84  m_udp_address_isSet = false;
85  udp_port = 0;
86  m_udp_port_isSet = false;
87 }
88 
89 void
91  if(name != nullptr) {
92  delete name;
93  }
94 
95 
96 
97 
98 
99 
100 
101 
102 
103  if(udp_address != nullptr) {
104  delete udp_address;
105  }
106 
107 }
108 
111  QByteArray array (json.toStdString().c_str());
112  QJsonDocument doc = QJsonDocument::fromJson(array);
113  QJsonObject jsonObject = doc.object();
114  this->fromJsonObject(jsonObject);
115  return this;
116 }
117 
118 void
120  ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
121 
122  ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
123 
124  ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
125 
126  ::SWGSDRangel::setValue(&is_system_default, pJson["isSystemDefault"], "qint32", "");
127 
128  ::SWGSDRangel::setValue(&default_unregistered, pJson["defaultUnregistered"], "qint32", "");
129 
130  ::SWGSDRangel::setValue(&copy_to_udp, pJson["copyToUDP"], "qint32", "");
131 
132  ::SWGSDRangel::setValue(&udp_uses_rtp, pJson["udpUsesRTP"], "qint32", "");
133 
134  ::SWGSDRangel::setValue(&udp_channel_mode, pJson["udpChannelMode"], "qint32", "");
135 
136  ::SWGSDRangel::setValue(&udp_channel_codec, pJson["udpChannelCodec"], "qint32", "");
137 
138  ::SWGSDRangel::setValue(&udp_decimation_factor, pJson["udpDecimationFactor"], "qint32", "");
139 
140  ::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString");
141 
142  ::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", "");
143 
144 }
145 
146 QString
148 {
149  QJsonObject* obj = this->asJsonObject();
150 
151  QJsonDocument doc(*obj);
152  QByteArray bytes = doc.toJson();
153  delete obj;
154  return QString(bytes);
155 }
156 
157 QJsonObject*
159  QJsonObject* obj = new QJsonObject();
160  if(name != nullptr && *name != QString("")){
161  toJsonValue(QString("name"), name, obj, QString("QString"));
162  }
163  if(m_index_isSet){
164  obj->insert("index", QJsonValue(index));
165  }
167  obj->insert("sampleRate", QJsonValue(sample_rate));
168  }
170  obj->insert("isSystemDefault", QJsonValue(is_system_default));
171  }
173  obj->insert("defaultUnregistered", QJsonValue(default_unregistered));
174  }
176  obj->insert("copyToUDP", QJsonValue(copy_to_udp));
177  }
179  obj->insert("udpUsesRTP", QJsonValue(udp_uses_rtp));
180  }
182  obj->insert("udpChannelMode", QJsonValue(udp_channel_mode));
183  }
185  obj->insert("udpChannelCodec", QJsonValue(udp_channel_codec));
186  }
188  obj->insert("udpDecimationFactor", QJsonValue(udp_decimation_factor));
189  }
190  if(udp_address != nullptr && *udp_address != QString("")){
191  toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString"));
192  }
193  if(m_udp_port_isSet){
194  obj->insert("udpPort", QJsonValue(udp_port));
195  }
196 
197  return obj;
198 }
199 
200 QString*
202  return name;
203 }
204 void
206  this->name = name;
207  this->m_name_isSet = true;
208 }
209 
210 qint32
212  return index;
213 }
214 void
216  this->index = index;
217  this->m_index_isSet = true;
218 }
219 
220 qint32
222  return sample_rate;
223 }
224 void
226  this->sample_rate = sample_rate;
227  this->m_sample_rate_isSet = true;
228 }
229 
230 qint32
232  return is_system_default;
233 }
234 void
236  this->is_system_default = is_system_default;
237  this->m_is_system_default_isSet = true;
238 }
239 
240 qint32
242  return default_unregistered;
243 }
244 void
246  this->default_unregistered = default_unregistered;
247  this->m_default_unregistered_isSet = true;
248 }
249 
250 qint32
252  return copy_to_udp;
253 }
254 void
256  this->copy_to_udp = copy_to_udp;
257  this->m_copy_to_udp_isSet = true;
258 }
259 
260 qint32
262  return udp_uses_rtp;
263 }
264 void
266  this->udp_uses_rtp = udp_uses_rtp;
267  this->m_udp_uses_rtp_isSet = true;
268 }
269 
270 qint32
272  return udp_channel_mode;
273 }
274 void
276  this->udp_channel_mode = udp_channel_mode;
277  this->m_udp_channel_mode_isSet = true;
278 }
279 
280 qint32
282  return udp_channel_codec;
283 }
284 void
286  this->udp_channel_codec = udp_channel_codec;
287  this->m_udp_channel_codec_isSet = true;
288 }
289 
290 qint32
292  return udp_decimation_factor;
293 }
294 void
296  this->udp_decimation_factor = udp_decimation_factor;
297  this->m_udp_decimation_factor_isSet = true;
298 }
299 
300 QString*
302  return udp_address;
303 }
304 void
306  this->udp_address = udp_address;
307  this->m_udp_address_isSet = true;
308 }
309 
310 qint32
312  return udp_port;
313 }
314 void
316  this->udp_port = udp_port;
317  this->m_udp_port_isSet = true;
318 }
319 
320 
321 bool
323  bool isObjectUpdated = false;
324  do{
325  if(name != nullptr && *name != QString("")){ isObjectUpdated = true; break;}
326  if(m_index_isSet){ isObjectUpdated = true; break;}
327  if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
328  if(m_is_system_default_isSet){ isObjectUpdated = true; break;}
329  if(m_default_unregistered_isSet){ isObjectUpdated = true; break;}
330  if(m_copy_to_udp_isSet){ isObjectUpdated = true; break;}
331  if(m_udp_uses_rtp_isSet){ isObjectUpdated = true; break;}
332  if(m_udp_channel_mode_isSet){ isObjectUpdated = true; break;}
333  if(m_udp_channel_codec_isSet){ isObjectUpdated = true; break;}
334  if(m_udp_decimation_factor_isSet){ isObjectUpdated = true; break;}
335  if(udp_address != nullptr && *udp_address != QString("")){ isObjectUpdated = true; break;}
336  if(m_udp_port_isSet){ isObjectUpdated = true; break;}
337  }while(false);
338  return isObjectUpdated;
339 }
340 }
341 
virtual void fromJsonObject(QJsonObject &json) override
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setIsSystemDefault(qint32 is_system_default)
void setUdpAddress(QString *udp_address)
void setUdpDecimationFactor(qint32 udp_decimation_factor)
virtual SWGAudioOutputDevice * fromJson(QString &jsonString) override
void setUdpChannelCodec(qint32 udp_channel_codec)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setDefaultUnregistered(qint32 default_unregistered)
void setUdpUsesRtp(qint32 udp_uses_rtp)
virtual QJsonObject * asJsonObject() override
void setUdpChannelMode(qint32 udp_channel_mode)