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.
Public Member Functions | Private Attributes | List of all members
SWGSDRangel::SWGDeviceConfig Class Reference

#include <SWGDeviceConfig.h>

+ Inheritance diagram for SWGSDRangel::SWGDeviceConfig:
+ Collaboration diagram for SWGSDRangel::SWGDeviceConfig:

Public Member Functions

 SWGDeviceConfig ()
 
 SWGDeviceConfig (QString *json)
 
virtual ~SWGDeviceConfig ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGDeviceConfigfromJson (QString &jsonString) override
 
QString * getDeviceId ()
 
void setDeviceId (QString *device_id)
 
QString * getDeviceSerial ()
 
void setDeviceSerial (QString *device_serial)
 
qint32 getDeviceSequence ()
 
void setDeviceSequence (qint32 device_sequence)
 
SWGDeviceSettingsgetConfig ()
 
void setConfig (SWGDeviceSettings *config)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

QString * device_id
 
bool m_device_id_isSet
 
QString * device_serial
 
bool m_device_serial_isSet
 
qint32 device_sequence
 
bool m_device_sequence_isSet
 
SWGDeviceSettingsconfig
 
bool m_config_isSet
 

Detailed Description

Definition at line 33 of file SWGDeviceConfig.h.

Constructor & Destructor Documentation

◆ SWGDeviceConfig() [1/2]

SWGSDRangel::SWGDeviceConfig::SWGDeviceConfig ( )

◆ SWGDeviceConfig() [2/2]

SWGSDRangel::SWGDeviceConfig::SWGDeviceConfig ( QString *  json)

Definition at line 25 of file SWGDeviceConfig.cpp.

References fromJson(), and init().

25  {
26  init();
27  this->fromJson(*json);
28 }
virtual SWGDeviceConfig * fromJson(QString &jsonString) override
+ Here is the call graph for this function:

◆ ~SWGDeviceConfig()

SWGSDRangel::SWGDeviceConfig::~SWGDeviceConfig ( )
virtual

Definition at line 41 of file SWGDeviceConfig.cpp.

References cleanup().

41  {
42  this->cleanup();
43 }
+ Here is the call graph for this function:

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGDeviceConfig::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 93 of file SWGDeviceConfig.cpp.

References asJsonObject().

94 {
95  QJsonObject* obj = this->asJsonObject();
96 
97  QJsonDocument doc(*obj);
98  QByteArray bytes = doc.toJson();
99  delete obj;
100  return QString(bytes);
101 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:

◆ asJsonObject()

QJsonObject * SWGSDRangel::SWGDeviceConfig::asJsonObject ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 104 of file SWGDeviceConfig.cpp.

References device_id, device_sequence, device_serial, m_device_sequence_isSet, and SWGSDRangel::toJsonValue().

Referenced by asJson().

104  {
105  QJsonObject* obj = new QJsonObject();
106  if(device_id != nullptr && *device_id != QString("")){
107  toJsonValue(QString("deviceId"), device_id, obj, QString("QString"));
108  }
109  if(device_serial != nullptr && *device_serial != QString("")){
110  toJsonValue(QString("deviceSerial"), device_serial, obj, QString("QString"));
111  }
113  obj->insert("deviceSequence", QJsonValue(device_sequence));
114  }
115  if((config != nullptr) && (config->isSet())){
116  toJsonValue(QString("config"), config, obj, QString("SWGDeviceSettings"));
117  }
118 
119  return obj;
120 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGDeviceConfig::cleanup ( )

Definition at line 58 of file SWGDeviceConfig.cpp.

References config, device_id, and device_serial.

Referenced by ~SWGDeviceConfig().

58  {
59  if(device_id != nullptr) {
60  delete device_id;
61  }
62  if(device_serial != nullptr) {
63  delete device_serial;
64  }
65 
66  if(config != nullptr) {
67  delete config;
68  }
69 }
SWGDeviceSettings * config
+ Here is the caller graph for this function:

◆ fromJson()

SWGDeviceConfig * SWGSDRangel::SWGDeviceConfig::fromJson ( QString &  jsonString)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 72 of file SWGDeviceConfig.cpp.

References fromJsonObject().

Referenced by SWGDeviceConfig().

72  {
73  QByteArray array (json.toStdString().c_str());
74  QJsonDocument doc = QJsonDocument::fromJson(array);
75  QJsonObject jsonObject = doc.object();
76  this->fromJsonObject(jsonObject);
77  return this;
78 }
virtual void fromJsonObject(QJsonObject &json) override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromJsonObject()

void SWGSDRangel::SWGDeviceConfig::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 81 of file SWGDeviceConfig.cpp.

References device_id, device_sequence, device_serial, and SWGSDRangel::setValue().

Referenced by fromJson().

81  {
82  ::SWGSDRangel::setValue(&device_id, pJson["deviceId"], "QString", "QString");
83 
84  ::SWGSDRangel::setValue(&device_serial, pJson["deviceSerial"], "QString", "QString");
85 
86  ::SWGSDRangel::setValue(&device_sequence, pJson["deviceSequence"], "qint32", "");
87 
88  ::SWGSDRangel::setValue(&config, pJson["config"], "SWGDeviceSettings", "SWGDeviceSettings");
89 
90 }
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getConfig()

SWGDeviceSettings * SWGSDRangel::SWGDeviceConfig::getConfig ( )

Definition at line 153 of file SWGDeviceConfig.cpp.

References config.

153  {
154  return config;
155 }
SWGDeviceSettings * config

◆ getDeviceId()

QString * SWGSDRangel::SWGDeviceConfig::getDeviceId ( )

Definition at line 123 of file SWGDeviceConfig.cpp.

References device_id.

123  {
124  return device_id;
125 }

◆ getDeviceSequence()

qint32 SWGSDRangel::SWGDeviceConfig::getDeviceSequence ( )

Definition at line 143 of file SWGDeviceConfig.cpp.

References device_sequence.

143  {
144  return device_sequence;
145 }

◆ getDeviceSerial()

QString * SWGSDRangel::SWGDeviceConfig::getDeviceSerial ( )

Definition at line 133 of file SWGDeviceConfig.cpp.

References device_serial.

133  {
134  return device_serial;
135 }

◆ init()

void SWGSDRangel::SWGDeviceConfig::init ( )

Definition at line 46 of file SWGDeviceConfig.cpp.

References device_id, device_sequence, device_serial, m_config_isSet, m_device_id_isSet, m_device_sequence_isSet, and m_device_serial_isSet.

Referenced by SWGDeviceConfig().

46  {
47  device_id = new QString("");
48  m_device_id_isSet = false;
49  device_serial = new QString("");
50  m_device_serial_isSet = false;
51  device_sequence = 0;
53  config = new SWGDeviceSettings();
54  m_config_isSet = false;
55 }
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGDeviceConfig::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 164 of file SWGDeviceConfig.cpp.

References device_id, device_serial, and m_device_sequence_isSet.

164  {
165  bool isObjectUpdated = false;
166  do{
167  if(device_id != nullptr && *device_id != QString("")){ isObjectUpdated = true; break;}
168  if(device_serial != nullptr && *device_serial != QString("")){ isObjectUpdated = true; break;}
169  if(m_device_sequence_isSet){ isObjectUpdated = true; break;}
170  if(config != nullptr && config->isSet()){ isObjectUpdated = true; break;}
171  }while(false);
172  return isObjectUpdated;
173 }

◆ setConfig()

void SWGSDRangel::SWGDeviceConfig::setConfig ( SWGDeviceSettings config)

Definition at line 157 of file SWGDeviceConfig.cpp.

References config, and m_config_isSet.

157  {
158  this->config = config;
159  this->m_config_isSet = true;
160 }
SWGDeviceSettings * config

◆ setDeviceId()

void SWGSDRangel::SWGDeviceConfig::setDeviceId ( QString *  device_id)

Definition at line 127 of file SWGDeviceConfig.cpp.

References device_id, and m_device_id_isSet.

127  {
128  this->device_id = device_id;
129  this->m_device_id_isSet = true;
130 }

◆ setDeviceSequence()

void SWGSDRangel::SWGDeviceConfig::setDeviceSequence ( qint32  device_sequence)

Definition at line 147 of file SWGDeviceConfig.cpp.

References device_sequence, and m_device_sequence_isSet.

147  {
149  this->m_device_sequence_isSet = true;
150 }

◆ setDeviceSerial()

void SWGSDRangel::SWGDeviceConfig::setDeviceSerial ( QString *  device_serial)

Definition at line 137 of file SWGDeviceConfig.cpp.

References device_serial, and m_device_serial_isSet.

137  {
139  this->m_device_serial_isSet = true;
140 }

Member Data Documentation

◆ config

SWGDeviceSettings* SWGSDRangel::SWGDeviceConfig::config
private

Definition at line 71 of file SWGDeviceConfig.h.

Referenced by cleanup(), getConfig(), and setConfig().

◆ device_id

QString* SWGSDRangel::SWGDeviceConfig::device_id
private

◆ device_sequence

qint32 SWGSDRangel::SWGDeviceConfig::device_sequence
private

◆ device_serial

QString* SWGSDRangel::SWGDeviceConfig::device_serial
private

◆ m_config_isSet

bool SWGSDRangel::SWGDeviceConfig::m_config_isSet
private

Definition at line 72 of file SWGDeviceConfig.h.

Referenced by init(), setConfig(), and SWGDeviceConfig().

◆ m_device_id_isSet

bool SWGSDRangel::SWGDeviceConfig::m_device_id_isSet
private

Definition at line 63 of file SWGDeviceConfig.h.

Referenced by init(), setDeviceId(), and SWGDeviceConfig().

◆ m_device_sequence_isSet

bool SWGSDRangel::SWGDeviceConfig::m_device_sequence_isSet
private

Definition at line 69 of file SWGDeviceConfig.h.

Referenced by asJsonObject(), init(), isSet(), setDeviceSequence(), and SWGDeviceConfig().

◆ m_device_serial_isSet

bool SWGSDRangel::SWGDeviceConfig::m_device_serial_isSet
private

Definition at line 66 of file SWGDeviceConfig.h.

Referenced by init(), setDeviceSerial(), and SWGDeviceConfig().


The documentation for this class was generated from the following files: