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.
SWGTestMiStreamSettings.cpp
Go to the documentation of this file.
1 
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  stream_index = 0;
32  m_stream_index_isSet = false;
33  center_frequency = 0;
35  frequency_shift = 0;
37  sample_rate = 0;
38  m_sample_rate_isSet = false;
39  log2_decim = 0;
40  m_log2_decim_isSet = false;
41  fc_pos = 0;
42  m_fc_pos_isSet = false;
45  amplitude_bits = 0;
46  m_amplitude_bits_isSet = false;
49  modulation = 0;
50  m_modulation_isSet = false;
51  modulation_tone = 0;
53  am_modulation = 0;
54  m_am_modulation_isSet = false;
55  fm_deviation = 0;
56  m_fm_deviation_isSet = false;
57  dc_factor = 0.0f;
58  m_dc_factor_isSet = false;
59  i_factor = 0.0f;
60  m_i_factor_isSet = false;
61  q_factor = 0.0f;
62  m_q_factor_isSet = false;
63  phase_imbalance = 0.0f;
65 }
66 
68  this->cleanup();
69 }
70 
71 void
73  stream_index = 0;
74  m_stream_index_isSet = false;
75  center_frequency = 0;
77  frequency_shift = 0;
79  sample_rate = 0;
80  m_sample_rate_isSet = false;
81  log2_decim = 0;
82  m_log2_decim_isSet = false;
83  fc_pos = 0;
84  m_fc_pos_isSet = false;
87  amplitude_bits = 0;
88  m_amplitude_bits_isSet = false;
91  modulation = 0;
92  m_modulation_isSet = false;
93  modulation_tone = 0;
95  am_modulation = 0;
96  m_am_modulation_isSet = false;
97  fm_deviation = 0;
98  m_fm_deviation_isSet = false;
99  dc_factor = 0.0f;
100  m_dc_factor_isSet = false;
101  i_factor = 0.0f;
102  m_i_factor_isSet = false;
103  q_factor = 0.0f;
104  m_q_factor_isSet = false;
105  phase_imbalance = 0.0f;
106  m_phase_imbalance_isSet = false;
107 }
108 
109 void
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 }
129 
132  QByteArray array (json.toStdString().c_str());
133  QJsonDocument doc = QJsonDocument::fromJson(array);
134  QJsonObject jsonObject = doc.object();
135  this->fromJsonObject(jsonObject);
136  return this;
137 }
138 
139 void
141  ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", "");
142 
143  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint32", "");
144 
145  ::SWGSDRangel::setValue(&frequency_shift, pJson["frequencyShift"], "qint32", "");
146 
147  ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
148 
149  ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", "");
150 
151  ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", "");
152 
153  ::SWGSDRangel::setValue(&sample_size_index, pJson["sampleSizeIndex"], "qint32", "");
154 
155  ::SWGSDRangel::setValue(&amplitude_bits, pJson["amplitudeBits"], "qint32", "");
156 
157  ::SWGSDRangel::setValue(&auto_corr_options, pJson["autoCorrOptions"], "qint32", "");
158 
159  ::SWGSDRangel::setValue(&modulation, pJson["modulation"], "qint32", "");
160 
161  ::SWGSDRangel::setValue(&modulation_tone, pJson["modulationTone"], "qint32", "");
162 
163  ::SWGSDRangel::setValue(&am_modulation, pJson["amModulation"], "qint32", "");
164 
165  ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", "");
166 
167  ::SWGSDRangel::setValue(&dc_factor, pJson["dcFactor"], "float", "");
168 
169  ::SWGSDRangel::setValue(&i_factor, pJson["iFactor"], "float", "");
170 
171  ::SWGSDRangel::setValue(&q_factor, pJson["qFactor"], "float", "");
172 
173  ::SWGSDRangel::setValue(&phase_imbalance, pJson["phaseImbalance"], "float", "");
174 
175 }
176 
177 QString
179 {
180  QJsonObject* obj = this->asJsonObject();
181 
182  QJsonDocument doc(*obj);
183  QByteArray bytes = doc.toJson();
184  delete obj;
185  return QString(bytes);
186 }
187 
188 QJsonObject*
190  QJsonObject* obj = new QJsonObject();
192  obj->insert("streamIndex", QJsonValue(stream_index));
193  }
195  obj->insert("centerFrequency", QJsonValue(center_frequency));
196  }
198  obj->insert("frequencyShift", QJsonValue(frequency_shift));
199  }
201  obj->insert("sampleRate", QJsonValue(sample_rate));
202  }
203  if(m_log2_decim_isSet){
204  obj->insert("log2Decim", QJsonValue(log2_decim));
205  }
206  if(m_fc_pos_isSet){
207  obj->insert("fcPos", QJsonValue(fc_pos));
208  }
210  obj->insert("sampleSizeIndex", QJsonValue(sample_size_index));
211  }
213  obj->insert("amplitudeBits", QJsonValue(amplitude_bits));
214  }
216  obj->insert("autoCorrOptions", QJsonValue(auto_corr_options));
217  }
218  if(m_modulation_isSet){
219  obj->insert("modulation", QJsonValue(modulation));
220  }
222  obj->insert("modulationTone", QJsonValue(modulation_tone));
223  }
225  obj->insert("amModulation", QJsonValue(am_modulation));
226  }
228  obj->insert("fmDeviation", QJsonValue(fm_deviation));
229  }
230  if(m_dc_factor_isSet){
231  obj->insert("dcFactor", QJsonValue(dc_factor));
232  }
233  if(m_i_factor_isSet){
234  obj->insert("iFactor", QJsonValue(i_factor));
235  }
236  if(m_q_factor_isSet){
237  obj->insert("qFactor", QJsonValue(q_factor));
238  }
240  obj->insert("phaseImbalance", QJsonValue(phase_imbalance));
241  }
242 
243  return obj;
244 }
245 
246 qint32
248  return stream_index;
249 }
250 void
252  this->stream_index = stream_index;
253  this->m_stream_index_isSet = true;
254 }
255 
256 qint32
258  return center_frequency;
259 }
260 void
262  this->center_frequency = center_frequency;
263  this->m_center_frequency_isSet = true;
264 }
265 
266 qint32
268  return frequency_shift;
269 }
270 void
272  this->frequency_shift = frequency_shift;
273  this->m_frequency_shift_isSet = true;
274 }
275 
276 qint32
278  return sample_rate;
279 }
280 void
282  this->sample_rate = sample_rate;
283  this->m_sample_rate_isSet = true;
284 }
285 
286 qint32
288  return log2_decim;
289 }
290 void
292  this->log2_decim = log2_decim;
293  this->m_log2_decim_isSet = true;
294 }
295 
296 qint32
298  return fc_pos;
299 }
300 void
302  this->fc_pos = fc_pos;
303  this->m_fc_pos_isSet = true;
304 }
305 
306 qint32
308  return sample_size_index;
309 }
310 void
312  this->sample_size_index = sample_size_index;
313  this->m_sample_size_index_isSet = true;
314 }
315 
316 qint32
318  return amplitude_bits;
319 }
320 void
322  this->amplitude_bits = amplitude_bits;
323  this->m_amplitude_bits_isSet = true;
324 }
325 
326 qint32
328  return auto_corr_options;
329 }
330 void
332  this->auto_corr_options = auto_corr_options;
333  this->m_auto_corr_options_isSet = true;
334 }
335 
336 qint32
338  return modulation;
339 }
340 void
342  this->modulation = modulation;
343  this->m_modulation_isSet = true;
344 }
345 
346 qint32
348  return modulation_tone;
349 }
350 void
352  this->modulation_tone = modulation_tone;
353  this->m_modulation_tone_isSet = true;
354 }
355 
356 qint32
358  return am_modulation;
359 }
360 void
362  this->am_modulation = am_modulation;
363  this->m_am_modulation_isSet = true;
364 }
365 
366 qint32
368  return fm_deviation;
369 }
370 void
372  this->fm_deviation = fm_deviation;
373  this->m_fm_deviation_isSet = true;
374 }
375 
376 float
378  return dc_factor;
379 }
380 void
382  this->dc_factor = dc_factor;
383  this->m_dc_factor_isSet = true;
384 }
385 
386 float
388  return i_factor;
389 }
390 void
392  this->i_factor = i_factor;
393  this->m_i_factor_isSet = true;
394 }
395 
396 float
398  return q_factor;
399 }
400 void
402  this->q_factor = q_factor;
403  this->m_q_factor_isSet = true;
404 }
405 
406 float
408  return phase_imbalance;
409 }
410 void
412  this->phase_imbalance = phase_imbalance;
413  this->m_phase_imbalance_isSet = true;
414 }
415 
416 
417 bool
419  bool isObjectUpdated = false;
420  do{
421  if(m_stream_index_isSet){ isObjectUpdated = true; break;}
422  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
423  if(m_frequency_shift_isSet){ isObjectUpdated = true; break;}
424  if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
425  if(m_log2_decim_isSet){ isObjectUpdated = true; break;}
426  if(m_fc_pos_isSet){ isObjectUpdated = true; break;}
427  if(m_sample_size_index_isSet){ isObjectUpdated = true; break;}
428  if(m_amplitude_bits_isSet){ isObjectUpdated = true; break;}
429  if(m_auto_corr_options_isSet){ isObjectUpdated = true; break;}
430  if(m_modulation_isSet){ isObjectUpdated = true; break;}
431  if(m_modulation_tone_isSet){ isObjectUpdated = true; break;}
432  if(m_am_modulation_isSet){ isObjectUpdated = true; break;}
433  if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
434  if(m_dc_factor_isSet){ isObjectUpdated = true; break;}
435  if(m_i_factor_isSet){ isObjectUpdated = true; break;}
436  if(m_q_factor_isSet){ isObjectUpdated = true; break;}
437  if(m_phase_imbalance_isSet){ isObjectUpdated = true; break;}
438  }while(false);
439  return isObjectUpdated;
440 }
441 }
442 
virtual SWGTestMiStreamSettings * fromJson(QString &jsonString) override
void setCenterFrequency(qint32 center_frequency)
void setSampleSizeIndex(qint32 sample_size_index)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setFrequencyShift(qint32 frequency_shift)
virtual void fromJsonObject(QJsonObject &json) override
void setModulationTone(qint32 modulation_tone)
virtual QJsonObject * asJsonObject() override
void setAutoCorrOptions(qint32 auto_corr_options)