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.
SWGFileSourceSettings.cpp
Go to the documentation of this file.
1 
14 #include "SWGFileSourceSettings.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  file_name = nullptr;
32  m_file_name_isSet = false;
33  loop = 0;
34  m_loop_isSet = false;
35  log2_interp = 0;
36  m_log2_interp_isSet = false;
39  gain_db = 0;
40  m_gain_db_isSet = false;
41  rgb_color = 0;
42  m_rgb_color_isSet = false;
43  title = nullptr;
44  m_title_isSet = false;
45  use_reverse_api = 0;
47  reverse_api_address = nullptr;
49  reverse_api_port = 0;
55 }
56 
58  this->cleanup();
59 }
60 
61 void
63  file_name = new QString("");
64  m_file_name_isSet = false;
65  loop = 0;
66  m_loop_isSet = false;
67  log2_interp = 0;
68  m_log2_interp_isSet = false;
71  gain_db = 0;
72  m_gain_db_isSet = false;
73  rgb_color = 0;
74  m_rgb_color_isSet = false;
75  title = new QString("");
76  m_title_isSet = false;
77  use_reverse_api = 0;
79  reverse_api_address = new QString("");
81  reverse_api_port = 0;
87 }
88 
89 void
91  if(file_name != nullptr) {
92  delete file_name;
93  }
94 
95 
96 
97 
98 
99  if(title != nullptr) {
100  delete title;
101  }
102 
103  if(reverse_api_address != nullptr) {
104  delete reverse_api_address;
105  }
106 
107 
108 
109 }
110 
113  QByteArray array (json.toStdString().c_str());
114  QJsonDocument doc = QJsonDocument::fromJson(array);
115  QJsonObject jsonObject = doc.object();
116  this->fromJsonObject(jsonObject);
117  return this;
118 }
119 
120 void
122  ::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString");
123 
124  ::SWGSDRangel::setValue(&loop, pJson["loop"], "qint32", "");
125 
126  ::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "qint32", "");
127 
128  ::SWGSDRangel::setValue(&filter_chain_hash, pJson["filterChainHash"], "qint32", "");
129 
130  ::SWGSDRangel::setValue(&gain_db, pJson["gainDB"], "qint32", "");
131 
132  ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
133 
134  ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
135 
136  ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
137 
138  ::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
139 
140  ::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
141 
142  ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
143 
144  ::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
145 
146 }
147 
148 QString
150 {
151  QJsonObject* obj = this->asJsonObject();
152 
153  QJsonDocument doc(*obj);
154  QByteArray bytes = doc.toJson();
155  delete obj;
156  return QString(bytes);
157 }
158 
159 QJsonObject*
161  QJsonObject* obj = new QJsonObject();
162  if(file_name != nullptr && *file_name != QString("")){
163  toJsonValue(QString("fileName"), file_name, obj, QString("QString"));
164  }
165  if(m_loop_isSet){
166  obj->insert("loop", QJsonValue(loop));
167  }
169  obj->insert("log2Interp", QJsonValue(log2_interp));
170  }
172  obj->insert("filterChainHash", QJsonValue(filter_chain_hash));
173  }
174  if(m_gain_db_isSet){
175  obj->insert("gainDB", QJsonValue(gain_db));
176  }
177  if(m_rgb_color_isSet){
178  obj->insert("rgbColor", QJsonValue(rgb_color));
179  }
180  if(title != nullptr && *title != QString("")){
181  toJsonValue(QString("title"), title, obj, QString("QString"));
182  }
184  obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
185  }
186  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
187  toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
188  }
190  obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
191  }
193  obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
194  }
196  obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
197  }
198 
199  return obj;
200 }
201 
202 QString*
204  return file_name;
205 }
206 void
208  this->file_name = file_name;
209  this->m_file_name_isSet = true;
210 }
211 
212 qint32
214  return loop;
215 }
216 void
218  this->loop = loop;
219  this->m_loop_isSet = true;
220 }
221 
222 qint32
224  return log2_interp;
225 }
226 void
228  this->log2_interp = log2_interp;
229  this->m_log2_interp_isSet = true;
230 }
231 
232 qint32
234  return filter_chain_hash;
235 }
236 void
238  this->filter_chain_hash = filter_chain_hash;
239  this->m_filter_chain_hash_isSet = true;
240 }
241 
242 qint32
244  return gain_db;
245 }
246 void
248  this->gain_db = gain_db;
249  this->m_gain_db_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 use_reverse_api;
275 }
276 void
278  this->use_reverse_api = use_reverse_api;
279  this->m_use_reverse_api_isSet = true;
280 }
281 
282 QString*
284  return reverse_api_address;
285 }
286 void
288  this->reverse_api_address = reverse_api_address;
289  this->m_reverse_api_address_isSet = true;
290 }
291 
292 qint32
294  return reverse_api_port;
295 }
296 void
298  this->reverse_api_port = reverse_api_port;
299  this->m_reverse_api_port_isSet = true;
300 }
301 
302 qint32
305 }
306 void
308  this->reverse_api_device_index = reverse_api_device_index;
310 }
311 
312 qint32
315 }
316 void
318  this->reverse_api_channel_index = reverse_api_channel_index;
320 }
321 
322 
323 bool
325  bool isObjectUpdated = false;
326  do{
327  if(file_name != nullptr && *file_name != QString("")){ isObjectUpdated = true; break;}
328  if(m_loop_isSet){ isObjectUpdated = true; break;}
329  if(m_log2_interp_isSet){ isObjectUpdated = true; break;}
330  if(m_filter_chain_hash_isSet){ isObjectUpdated = true; break;}
331  if(m_gain_db_isSet){ isObjectUpdated = true; break;}
332  if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
333  if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
334  if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
335  if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
336  if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
337  if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
338  if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
339  }while(false);
340  return isObjectUpdated;
341 }
342 }
343 
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual QJsonObject * asJsonObject() override
void setFilterChainHash(qint32 filter_chain_hash)
void setReverseApiPort(qint32 reverse_api_port)
virtual SWGFileSourceSettings * fromJson(QString &jsonString) override
void setReverseApiAddress(QString *reverse_api_address)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setUseReverseApi(qint32 use_reverse_api)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
virtual void fromJsonObject(QJsonObject &json) override
void setReverseApiChannelIndex(qint32 reverse_api_channel_index)