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::SWGPresetTransfer Class Reference

#include <SWGPresetTransfer.h>

+ Inheritance diagram for SWGSDRangel::SWGPresetTransfer:
+ Collaboration diagram for SWGSDRangel::SWGPresetTransfer:

Public Member Functions

 SWGPresetTransfer ()
 
 SWGPresetTransfer (QString *json)
 
virtual ~SWGPresetTransfer ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGPresetTransferfromJson (QString &jsonString) override
 
qint32 getDeviceSetIndex ()
 
void setDeviceSetIndex (qint32 device_set_index)
 
SWGPresetIdentifiergetPreset ()
 
void setPreset (SWGPresetIdentifier *preset)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

qint32 device_set_index
 
bool m_device_set_index_isSet
 
SWGPresetIdentifierpreset
 
bool m_preset_isSet
 

Detailed Description

Definition at line 32 of file SWGPresetTransfer.h.

Constructor & Destructor Documentation

◆ SWGPresetTransfer() [1/2]

SWGSDRangel::SWGPresetTransfer::SWGPresetTransfer ( )

◆ SWGPresetTransfer() [2/2]

SWGSDRangel::SWGPresetTransfer::SWGPresetTransfer ( QString *  json)

Definition at line 25 of file SWGPresetTransfer.cpp.

References fromJson(), and init().

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

◆ ~SWGPresetTransfer()

SWGSDRangel::SWGPresetTransfer::~SWGPresetTransfer ( )
virtual

Definition at line 37 of file SWGPresetTransfer.cpp.

References cleanup().

37  {
38  this->cleanup();
39 }
+ Here is the call graph for this function:

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGPresetTransfer::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 75 of file SWGPresetTransfer.cpp.

References asJsonObject().

Referenced by SWGSDRangel::SWGInstanceApi::instancePresetPatch(), SWGSDRangel::SWGInstanceApi::instancePresetPost(), and SWGSDRangel::SWGInstanceApi::instancePresetPut().

76 {
77  QJsonObject* obj = this->asJsonObject();
78 
79  QJsonDocument doc(*obj);
80  QByteArray bytes = doc.toJson();
81  delete obj;
82  return QString(bytes);
83 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 86 of file SWGPresetTransfer.cpp.

References device_set_index, SWGSDRangel::SWGPresetIdentifier::isSet(), m_device_set_index_isSet, preset, and SWGSDRangel::toJsonValue().

Referenced by asJson().

86  {
87  QJsonObject* obj = new QJsonObject();
89  obj->insert("deviceSetIndex", QJsonValue(device_set_index));
90  }
91  if((preset != nullptr) && (preset->isSet())){
92  toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier"));
93  }
94 
95  return obj;
96 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
SWGPresetIdentifier * preset
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGPresetTransfer::cleanup ( )

Definition at line 50 of file SWGPresetTransfer.cpp.

References preset.

Referenced by ~SWGPresetTransfer().

50  {
51 
52  if(preset != nullptr) {
53  delete preset;
54  }
55 }
SWGPresetIdentifier * preset
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 58 of file SWGPresetTransfer.cpp.

References fromJsonObject().

Referenced by WebAPIRequestMapper::instancePresetService(), and SWGPresetTransfer().

58  {
59  QByteArray array (json.toStdString().c_str());
60  QJsonDocument doc = QJsonDocument::fromJson(array);
61  QJsonObject jsonObject = doc.object();
62  this->fromJsonObject(jsonObject);
63  return this;
64 }
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::SWGPresetTransfer::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 67 of file SWGPresetTransfer.cpp.

References device_set_index, preset, and SWGSDRangel::setValue().

Referenced by fromJson().

67  {
68  ::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", "");
69 
70  ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
71 
72 }
SWGPresetIdentifier * preset
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:

◆ getDeviceSetIndex()

qint32 SWGSDRangel::SWGPresetTransfer::getDeviceSetIndex ( )

◆ getPreset()

SWGPresetIdentifier * SWGSDRangel::SWGPresetTransfer::getPreset ( )

◆ init()

void SWGSDRangel::SWGPresetTransfer::init ( )

Definition at line 42 of file SWGPresetTransfer.cpp.

References device_set_index, m_device_set_index_isSet, m_preset_isSet, and preset.

Referenced by SWGPresetTransfer().

42  {
43  device_set_index = 0;
45  preset = new SWGPresetIdentifier();
46  m_preset_isSet = false;
47 }
SWGPresetIdentifier * preset
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGPresetTransfer::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 120 of file SWGPresetTransfer.cpp.

References SWGSDRangel::SWGPresetIdentifier::isSet(), m_device_set_index_isSet, and preset.

120  {
121  bool isObjectUpdated = false;
122  do{
123  if(m_device_set_index_isSet){ isObjectUpdated = true; break;}
124  if(preset != nullptr && preset->isSet()){ isObjectUpdated = true; break;}
125  }while(false);
126  return isObjectUpdated;
127 }
SWGPresetIdentifier * preset
+ Here is the call graph for this function:

◆ setDeviceSetIndex()

void SWGSDRangel::SWGPresetTransfer::setDeviceSetIndex ( qint32  device_set_index)

Definition at line 103 of file SWGPresetTransfer.cpp.

References device_set_index, and m_device_set_index_isSet.

◆ setPreset()

void SWGSDRangel::SWGPresetTransfer::setPreset ( SWGPresetIdentifier preset)

Definition at line 113 of file SWGPresetTransfer.cpp.

References m_preset_isSet, and preset.

113  {
114  this->preset = preset;
115  this->m_preset_isSet = true;
116 }
SWGPresetIdentifier * preset

Member Data Documentation

◆ device_set_index

qint32 SWGSDRangel::SWGPresetTransfer::device_set_index
private

◆ m_device_set_index_isSet

bool SWGSDRangel::SWGPresetTransfer::m_device_set_index_isSet
private

Definition at line 56 of file SWGPresetTransfer.h.

Referenced by asJsonObject(), init(), isSet(), setDeviceSetIndex(), and SWGPresetTransfer().

◆ m_preset_isSet

bool SWGSDRangel::SWGPresetTransfer::m_preset_isSet
private

Definition at line 59 of file SWGPresetTransfer.h.

Referenced by init(), setPreset(), and SWGPresetTransfer().

◆ preset

SWGPresetIdentifier* SWGSDRangel::SWGPresetTransfer::preset
private

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