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.
SWGRemoteInputReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGRemoteInputReport.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  center_frequency = 0;
33  sample_rate = 0;
34  m_sample_rate_isSet = false;
37  remote_timestamp = nullptr;
39  min_nb_blocks = 0;
40  m_min_nb_blocks_isSet = false;
41  max_nb_recovery = 0;
43 }
44 
46  this->cleanup();
47 }
48 
49 void
51  center_frequency = 0;
53  sample_rate = 0;
54  m_sample_rate_isSet = false;
57  remote_timestamp = new QString("");
59  min_nb_blocks = 0;
60  m_min_nb_blocks_isSet = false;
61  max_nb_recovery = 0;
63 }
64 
65 void
67 
68 
69 
70  if(remote_timestamp != nullptr) {
71  delete remote_timestamp;
72  }
73 
74 
75 }
76 
79  QByteArray array (json.toStdString().c_str());
80  QJsonDocument doc = QJsonDocument::fromJson(array);
81  QJsonObject jsonObject = doc.object();
82  this->fromJsonObject(jsonObject);
83  return this;
84 }
85 
86 void
88  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint32", "");
89 
90  ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
91 
92  ::SWGSDRangel::setValue(&buffer_rw_balance, pJson["bufferRWBalance"], "qint32", "");
93 
94  ::SWGSDRangel::setValue(&remote_timestamp, pJson["remoteTimestamp"], "QString", "QString");
95 
96  ::SWGSDRangel::setValue(&min_nb_blocks, pJson["minNbBlocks"], "qint32", "");
97 
98  ::SWGSDRangel::setValue(&max_nb_recovery, pJson["maxNbRecovery"], "qint32", "");
99 
100 }
101 
102 QString
104 {
105  QJsonObject* obj = this->asJsonObject();
106 
107  QJsonDocument doc(*obj);
108  QByteArray bytes = doc.toJson();
109  delete obj;
110  return QString(bytes);
111 }
112 
113 QJsonObject*
115  QJsonObject* obj = new QJsonObject();
117  obj->insert("centerFrequency", QJsonValue(center_frequency));
118  }
120  obj->insert("sampleRate", QJsonValue(sample_rate));
121  }
123  obj->insert("bufferRWBalance", QJsonValue(buffer_rw_balance));
124  }
125  if(remote_timestamp != nullptr && *remote_timestamp != QString("")){
126  toJsonValue(QString("remoteTimestamp"), remote_timestamp, obj, QString("QString"));
127  }
129  obj->insert("minNbBlocks", QJsonValue(min_nb_blocks));
130  }
132  obj->insert("maxNbRecovery", QJsonValue(max_nb_recovery));
133  }
134 
135  return obj;
136 }
137 
138 qint32
140  return center_frequency;
141 }
142 void
144  this->center_frequency = center_frequency;
145  this->m_center_frequency_isSet = true;
146 }
147 
148 qint32
150  return sample_rate;
151 }
152 void
154  this->sample_rate = sample_rate;
155  this->m_sample_rate_isSet = true;
156 }
157 
158 qint32
160  return buffer_rw_balance;
161 }
162 void
164  this->buffer_rw_balance = buffer_rw_balance;
165  this->m_buffer_rw_balance_isSet = true;
166 }
167 
168 QString*
170  return remote_timestamp;
171 }
172 void
174  this->remote_timestamp = remote_timestamp;
175  this->m_remote_timestamp_isSet = true;
176 }
177 
178 qint32
180  return min_nb_blocks;
181 }
182 void
184  this->min_nb_blocks = min_nb_blocks;
185  this->m_min_nb_blocks_isSet = true;
186 }
187 
188 qint32
190  return max_nb_recovery;
191 }
192 void
194  this->max_nb_recovery = max_nb_recovery;
195  this->m_max_nb_recovery_isSet = true;
196 }
197 
198 
199 bool
201  bool isObjectUpdated = false;
202  do{
203  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
204  if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
205  if(m_buffer_rw_balance_isSet){ isObjectUpdated = true; break;}
206  if(remote_timestamp != nullptr && *remote_timestamp != QString("")){ isObjectUpdated = true; break;}
207  if(m_min_nb_blocks_isSet){ isObjectUpdated = true; break;}
208  if(m_max_nb_recovery_isSet){ isObjectUpdated = true; break;}
209  }while(false);
210  return isObjectUpdated;
211 }
212 }
213 
void setMinNbBlocks(qint32 min_nb_blocks)
void setRemoteTimestamp(QString *remote_timestamp)
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
virtual QJsonObject * asJsonObject() override
void setCenterFrequency(qint32 center_frequency)
void setMaxNbRecovery(qint32 max_nb_recovery)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
void setBufferRwBalance(qint32 buffer_rw_balance)
virtual void fromJsonObject(QJsonObject &json) override
virtual SWGRemoteInputReport * fromJson(QString &jsonString) override