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.
SWGLocalInputReport.cpp
Go to the documentation of this file.
1 
14 #include "SWGLocalInputReport.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;
35 }
36 
38  this->cleanup();
39 }
40 
41 void
43  center_frequency = 0;
45  sample_rate = 0;
46  m_sample_rate_isSet = false;
47 }
48 
49 void
51 
52 
53 }
54 
57  QByteArray array (json.toStdString().c_str());
58  QJsonDocument doc = QJsonDocument::fromJson(array);
59  QJsonObject jsonObject = doc.object();
60  this->fromJsonObject(jsonObject);
61  return this;
62 }
63 
64 void
66  ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint32", "");
67 
68  ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
69 
70 }
71 
72 QString
74 {
75  QJsonObject* obj = this->asJsonObject();
76 
77  QJsonDocument doc(*obj);
78  QByteArray bytes = doc.toJson();
79  delete obj;
80  return QString(bytes);
81 }
82 
83 QJsonObject*
85  QJsonObject* obj = new QJsonObject();
87  obj->insert("centerFrequency", QJsonValue(center_frequency));
88  }
90  obj->insert("sampleRate", QJsonValue(sample_rate));
91  }
92 
93  return obj;
94 }
95 
96 qint32
98  return center_frequency;
99 }
100 void
102  this->center_frequency = center_frequency;
103  this->m_center_frequency_isSet = true;
104 }
105 
106 qint32
108  return sample_rate;
109 }
110 void
112  this->sample_rate = sample_rate;
113  this->m_sample_rate_isSet = true;
114 }
115 
116 
117 bool
119  bool isObjectUpdated = false;
120  do{
121  if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
122  if(m_sample_rate_isSet){ isObjectUpdated = true; break;}
123  }while(false);
124  return isObjectUpdated;
125 }
126 }
127 
virtual QJsonObject * asJsonObject() override
virtual QString asJson() override
void setSampleRate(qint32 sample_rate)
void setCenterFrequency(qint32 center_frequency)
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
virtual void fromJsonObject(QJsonObject &json) override
virtual SWGLocalInputReport * fromJson(QString &jsonString) override