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.
SWGLocalSinkSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGLocalSinkSettings.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 
33  rgb_color = 0;
34  m_rgb_color_isSet = false;
35  title = nullptr;
36  m_title_isSet = false;
37  log2_decim = 0;
38  m_log2_decim_isSet = false;
41  use_reverse_api = 0;
43  reverse_api_address = nullptr;
45  reverse_api_port = 0;
51 }
52 
54  this->cleanup();
55 }
56 
57 void
61  rgb_color = 0;
62  m_rgb_color_isSet = false;
63  title = new QString("");
64  m_title_isSet = false;
65  log2_decim = 0;
66  m_log2_decim_isSet = false;
69  use_reverse_api = 0;
71  reverse_api_address = new QString("");
73  reverse_api_port = 0;
79 }
80 
81 void
83 
84 
85  if(title != nullptr) {
86  delete title;
87  }
88 
89 
90 
91  if(reverse_api_address != nullptr) {
92  delete reverse_api_address;
93  }
94 
95 
96 
97 }
98 
101  QByteArray array (json.toStdString().c_str());
102  QJsonDocument doc = QJsonDocument::fromJson(array);
103  QJsonObject jsonObject = doc.object();
104  this->fromJsonObject(jsonObject);
105  return this;
106 }
107 
108 void
110  ::SWGSDRangel::setValue(&local_device_index, pJson["localDeviceIndex"], "qint32", "");
111 
112  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
113 
114  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
115 
116  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
117 
118  ::SWGSDRangel::setValue(&filter_chain_hash, pJson["filterChainHash"], "qint32", "");
119 
120  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
121 
122  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
123 
124  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
125 
126  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
127 
128  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
129 
130 }
131 
132 QString
134 {
135  QJsonObject* obj = this->asJsonObject();
136 
137  QJsonDocument doc(*obj);
138  QByteArray bytes = doc.toJson();
139  delete obj;
140  return QString(bytes);
141 }
142 
143 QJsonObject*
145  QJsonObject* obj = new QJsonObject();
147  obj->insert("localDeviceIndex", QJsonValue(local_device_index));
148  }
149  if(m_rgb_color_isSet){
150  obj->insert("rgbColor", QJsonValue(rgb_color));
151  }
152  if(title != nullptr && *title != QString("")){
153  toJsonValue(QString("title"), title, obj, QString("QString"));
154  }
155  if(m_log2_decim_isSet){
156  obj->insert("log2Decim", QJsonValue(log2_decim));
157  }
159  obj->insert("filterChainHash", QJsonValue(filter_chain_hash));
160  }
162  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
163  }
164  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
165  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
166  }
168  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
169  }
171  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
172  }
174  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
175  }
176 
177  return obj;
178 }
179 
180 qint32
182  return local_device_index;
183 }
184 void
186  this->local_device_index = local_device_index;
187  this->m_local_device_index_isSet = true;
188 }
189 
190 qint32
192  return rgb_color;
193 }
194 void
196  this->rgb_color = rgb_color;
197  this->m_rgb_color_isSet = true;
198 }
199 
200 QString*
202  return title;
203 }
204 void
206  this->title = title;
207  this->m_title_isSet = true;
208 }
209 
210 qint32
212  return log2_decim;
213 }
214 void
216  this->log2_decim = log2_decim;
217  this->m_log2_decim_isSet = true;
218 }
219 
220 qint32
222  return filter_chain_hash;
223 }
224 void
226  this->filter_chain_hash = filter_chain_hash;
227  this->m_filter_chain_hash_isSet = true;
228 }
229 
230 qint32
232  return use_reverse_api;
233 }
234 void
236  this->use_reverse_api = use_reverse_api;
237  this->m_use_reverse_api_isSet = true;
238 }
239 
240 QString*
242  return reverse_api_address;
243 }
244 void
246  this->reverse_api_address = reverse_api_address;
247  this->m_reverse_api_address_isSet = true;
248 }
249 
250 qint32
252  return reverse_api_port;
253 }
254 void
256  this->reverse_api_port = reverse_api_port;
257  this->m_reverse_api_port_isSet = true;
258 }
259 
260 qint32
263 }
264 void
266  this->reverse_api_device_index = reverse_api_device_index;
268 }
269 
270 qint32
273 }
274 void
276  this->reverse_api_channel_index = reverse_api_channel_index;
278 }
279 
280 
281 bool
283  bool isObjectUpdated = false;
284  do{
285  if(m_local_device_index_isSet){ isObjectUpdated = true; break;}
286  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
287  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
288  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
289  if(m_filter_chain_hash_isSet){ isObjectUpdated = true; break;}
290  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
291  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
292  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
293  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
294  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
295  }while(false);
296  return isObjectUpdated;
297 }
298 }
299 
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
void setLocalDeviceIndex(qint32 local_device_index)
virtual void fromJsonObject(QJsonObject &json) override
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setReverseApiAddress(QString *reverse_api_address)
virtual QJsonObject * asJsonObject() override
void setUseReverseApi(qint32 use_reverse_api)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual SWGLocalSinkSettings * fromJson(QString &jsonString) override
void setReverseApiPort(qint32 reverse_api_port)
void setFilterChainHash(qint32 filter_chain_hash)