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.
SWGRemoteSinkSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGRemoteSinkSettings.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  nb_fec_blocks = 0;
32  m_nb_fec_blocks_isSet = false;
33  data_address = nullptr;
34  m_data_address_isSet = false;
35  data_port = 0;
36  m_data_port_isSet = false;
37  tx_delay = 0;
38  m_tx_delay_isSet = false;
39  rgb_color = 0;
40  m_rgb_color_isSet = false;
41  title = nullptr;
42  m_title_isSet = false;
43  log2_decim = 0;
44  m_log2_decim_isSet = false;
47  use_reverse_api = 0;
49  reverse_api_address = nullptr;
51  reverse_api_port = 0;
57 }
58 
60  this->cleanup();
61 }
62 
63 void
65  nb_fec_blocks = 0;
66  m_nb_fec_blocks_isSet = false;
67  data_address = new QString("");
68  m_data_address_isSet = false;
69  data_port = 0;
70  m_data_port_isSet = false;
71  tx_delay = 0;
72  m_tx_delay_isSet = false;
73  rgb_color = 0;
74  m_rgb_color_isSet = false;
75  title = new QString("");
76  m_title_isSet = false;
77  log2_decim = 0;
78  m_log2_decim_isSet = false;
81  use_reverse_api = 0;
83  reverse_api_address = new QString("");
85  reverse_api_port = 0;
91 }
92 
93 void
95 
96  if(data_address != nullptr) {
97  delete data_address;
98  }
99 
100 
101 
102  if(title != nullptr) {
103  delete title;
104  }
105 
106 
107 
108  if(reverse_api_address != nullptr) {
109  delete reverse_api_address;
110  }
111 
112 
113 
114 }
115 
118  QByteArray array (json.toStdString().c_str());
119  QJsonDocument doc = QJsonDocument::fromJson(array);
120  QJsonObject jsonObject = doc.object();
121  this->fromJsonObject(jsonObject);
122  return this;
123 }
124 
125 void
127  ::SWGSDRangel::setValue(&nb_fec_blocks, pJson["nbFECBlocks"], "qint32", "");
128 
129  ::SWGSDRangel::setValue(&data_address, pJson["dataAddress"], "QString", "QString");
130 
131  ::SWGSDRangel::setValue(&data_port, pJson["dataPort"], "qint32", "");
132 
133  ::SWGSDRangel::setValue(&tx_delay, pJson["txDelay"], "qint32", "");
134 
135  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
136 
137  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
138 
139  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
140 
141  ::SWGSDRangel::setValue(&filter_chain_hash, pJson["filterChainHash"], "qint32", "");
142 
143  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
144 
145  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
146 
147  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
148 
149  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
150 
151  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
152 
153 }
154 
155 QString
157 {
158  QJsonObject* obj = this->asJsonObject();
159 
160  QJsonDocument doc(*obj);
161  QByteArray bytes = doc.toJson();
162  delete obj;
163  return QString(bytes);
164 }
165 
166 QJsonObject*
168  QJsonObject* obj = new QJsonObject();
170  obj->insert("nbFECBlocks", QJsonValue(nb_fec_blocks));
171  }
172  if(data_address != nullptr && *data_address != QString("")){
173  toJsonValue(QString("dataAddress"), data_address, obj, QString("QString"));
174  }
175  if(m_data_port_isSet){
176  obj->insert("dataPort", QJsonValue(data_port));
177  }
178  if(m_tx_delay_isSet){
179  obj->insert("txDelay", QJsonValue(tx_delay));
180  }
181  if(m_rgb_color_isSet){
182  obj->insert("rgbColor", QJsonValue(rgb_color));
183  }
184  if(title != nullptr && *title != QString("")){
185  toJsonValue(QString("title"), title, obj, QString("QString"));
186  }
187  if(m_log2_decim_isSet){
188  obj->insert("log2Decim", QJsonValue(log2_decim));
189  }
191  obj->insert("filterChainHash", QJsonValue(filter_chain_hash));
192  }
194  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
195  }
196  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
197  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
198  }
200  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
201  }
203  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
204  }
206  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
207  }
208 
209  return obj;
210 }
211 
212 qint32
214  return nb_fec_blocks;
215 }
216 void
218  this->nb_fec_blocks = nb_fec_blocks;
219  this->m_nb_fec_blocks_isSet = true;
220 }
221 
222 QString*
224  return data_address;
225 }
226 void
228  this->data_address = data_address;
229  this->m_data_address_isSet = true;
230 }
231 
232 qint32
234  return data_port;
235 }
236 void
238  this->data_port = data_port;
239  this->m_data_port_isSet = true;
240 }
241 
242 qint32
244  return tx_delay;
245 }
246 void
248  this->tx_delay = tx_delay;
249  this->m_tx_delay_isSet = true;
250 }
251 
252 qint32
254  return rgb_color;
255 }
256 void
258  this->rgb_color = rgb_color;
259  this->m_rgb_color_isSet = true;
260 }
261 
262 QString*
264  return title;
265 }
266 void
268  this->title = title;
269  this->m_title_isSet = true;
270 }
271 
272 qint32
274  return log2_decim;
275 }
276 void
278  this->log2_decim = log2_decim;
279  this->m_log2_decim_isSet = true;
280 }
281 
282 qint32
284  return filter_chain_hash;
285 }
286 void
288  this->filter_chain_hash = filter_chain_hash;
289  this->m_filter_chain_hash_isSet = true;
290 }
291 
292 qint32
294  return use_reverse_api;
295 }
296 void
298  this->use_reverse_api = use_reverse_api;
299  this->m_use_reverse_api_isSet = true;
300 }
301 
302 QString*
304  return reverse_api_address;
305 }
306 void
308  this->reverse_api_address = reverse_api_address;
309  this->m_reverse_api_address_isSet = true;
310 }
311 
312 qint32
314  return reverse_api_port;
315 }
316 void
318  this->reverse_api_port = reverse_api_port;
319  this->m_reverse_api_port_isSet = true;
320 }
321 
322 qint32
325 }
326 void
328  this->reverse_api_device_index = reverse_api_device_index;
330 }
331 
332 qint32
335 }
336 void
338  this->reverse_api_channel_index = reverse_api_channel_index;
340 }
341 
342 
343 bool
345  bool isObjectUpdated = false;
346  do{
347  if(m_nb_fec_blocks_isSet){ isObjectUpdated = true; break;}
348  if(data_address != nullptr && *data_address != QString("")){ isObjectUpdated = true; break;}
349  if(m_data_port_isSet){ isObjectUpdated = true; break;}
350  if(m_tx_delay_isSet){ isObjectUpdated = true; break;}
351  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
352  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
353  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
354  if(m_filter_chain_hash_isSet){ isObjectUpdated = true; break;}
355  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
356  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
357  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
358  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
359  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
360  }while(false);
361  return isObjectUpdated;
362 }
363 }
364 
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setNbFecBlocks(qint32 nb_fec_blocks)
void setFilterChainHash(qint32 filter_chain_hash)
void setDataAddress(QString *data_address)
virtual SWGRemoteSinkSettings * fromJson(QString &jsonString) override
void setReverseApiPort(qint32 reverse_api_port)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
virtual QJsonObject * asJsonObject() override
void setReverseApiAddress(QString *reverse_api_address)
virtual void fromJsonObject(QJsonObject &json) override
void setUseReverseApi(qint32 use_reverse_api)