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

#include <SWGDeviceSet.h>

+ Inheritance diagram for SWGSDRangel::SWGDeviceSet:
+ Collaboration diagram for SWGSDRangel::SWGDeviceSet:

Public Member Functions

 SWGDeviceSet ()
 
 SWGDeviceSet (QString *json)
 
virtual ~SWGDeviceSet ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGDeviceSetfromJson (QString &jsonString) override
 
SWGSamplingDevicegetSamplingDevice ()
 
void setSamplingDevice (SWGSamplingDevice *sampling_device)
 
qint32 getChannelcount ()
 
void setChannelcount (qint32 channelcount)
 
QList< SWGChannel * > * getChannels ()
 
void setChannels (QList< SWGChannel *> *channels)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

SWGSamplingDevicesampling_device
 
bool m_sampling_device_isSet
 
qint32 channelcount
 
bool m_channelcount_isSet
 
QList< SWGChannel * > * channels
 
bool m_channels_isSet
 

Detailed Description

Definition at line 34 of file SWGDeviceSet.h.

Constructor & Destructor Documentation

◆ SWGDeviceSet() [1/2]

SWGSDRangel::SWGDeviceSet::SWGDeviceSet ( )

Definition at line 30 of file SWGDeviceSet.cpp.

References channelcount, channels, m_channelcount_isSet, m_channels_isSet, m_sampling_device_isSet, and sampling_device.

30  {
31  sampling_device = nullptr;
33  channelcount = 0;
34  m_channelcount_isSet = false;
35  channels = nullptr;
36  m_channels_isSet = false;
37 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66

◆ SWGDeviceSet() [2/2]

SWGSDRangel::SWGDeviceSet::SWGDeviceSet ( QString *  json)

Definition at line 25 of file SWGDeviceSet.cpp.

References fromJson(), and init().

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

◆ ~SWGDeviceSet()

SWGSDRangel::SWGDeviceSet::~SWGDeviceSet ( )
virtual

Definition at line 39 of file SWGDeviceSet.cpp.

References cleanup().

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

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGDeviceSet::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 88 of file SWGDeviceSet.cpp.

References asJsonObject().

Referenced by WebAPIRequestMapper::devicesetService().

89 {
90  QJsonObject* obj = this->asJsonObject();
91 
92  QJsonDocument doc(*obj);
93  QByteArray bytes = doc.toJson();
94  delete obj;
95  return QString(bytes);
96 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 99 of file SWGDeviceSet.cpp.

References channelcount, channels, SWGSDRangel::SWGSamplingDevice::isSet(), m_channelcount_isSet, sampling_device, SWGSDRangel::toJsonArray(), and SWGSDRangel::toJsonValue().

Referenced by asJson().

99  {
100  QJsonObject* obj = new QJsonObject();
101  if((sampling_device != nullptr) && (sampling_device->isSet())){
102  toJsonValue(QString("samplingDevice"), sampling_device, obj, QString("SWGSamplingDevice"));
103  }
105  obj->insert("channelcount", QJsonValue(channelcount));
106  }
107  if(channels->size() > 0){
108  toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannel");
109  }
110 
111  return obj;
112 }
void toJsonValue(QString name, void *value, QJsonObject *output, QString type)
Definition: SWGHelpers.cpp:383
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
void toJsonArray(QList< void *> *value, QJsonObject *output, QString innerName, QString innerType)
Definition: SWGHelpers.cpp:445
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGDeviceSet::cleanup ( )

Definition at line 54 of file SWGDeviceSet.cpp.

References channels, and sampling_device.

Referenced by ~SWGDeviceSet().

54  {
55  if(sampling_device != nullptr) {
56  delete sampling_device;
57  }
58 
59  if(channels != nullptr) {
60  auto arr = channels;
61  for(auto o: *arr) {
62  delete o;
63  }
64  delete channels;
65  }
66 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 69 of file SWGDeviceSet.cpp.

References fromJsonObject().

Referenced by SWGDeviceSet().

69  {
70  QByteArray array (json.toStdString().c_str());
71  QJsonDocument doc = QJsonDocument::fromJson(array);
72  QJsonObject jsonObject = doc.object();
73  this->fromJsonObject(jsonObject);
74  return this;
75 }
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::SWGDeviceSet::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 78 of file SWGDeviceSet.cpp.

References channelcount, channels, sampling_device, and SWGSDRangel::setValue().

Referenced by fromJson().

78  {
79  ::SWGSDRangel::setValue(&sampling_device, pJson["samplingDevice"], "SWGSamplingDevice", "SWGSamplingDevice");
80 
81  ::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
82 
83 
84  ::SWGSDRangel::setValue(&channels, pJson["channels"], "QList", "SWGChannel");
85 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChannelcount()

qint32 SWGSDRangel::SWGDeviceSet::getChannelcount ( )

Definition at line 125 of file SWGDeviceSet.cpp.

References channelcount.

Referenced by WebAPIAdapterGUI::getDeviceSet(), and WebAPIAdapterSrv::getDeviceSet().

125  {
126  return channelcount;
127 }
+ Here is the caller graph for this function:

◆ getChannels()

QList< SWGChannel * > * SWGSDRangel::SWGDeviceSet::getChannels ( )

Definition at line 135 of file SWGDeviceSet.cpp.

References channels.

Referenced by WebAPIAdapterGUI::getDeviceSet(), and WebAPIAdapterSrv::getDeviceSet().

135  {
136  return channels;
137 }
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66
+ Here is the caller graph for this function:

◆ getSamplingDevice()

SWGSamplingDevice * SWGSDRangel::SWGDeviceSet::getSamplingDevice ( )

Definition at line 115 of file SWGDeviceSet.cpp.

References sampling_device.

Referenced by WebAPIAdapterGUI::getDeviceSet(), and WebAPIAdapterSrv::getDeviceSet().

115  {
116  return sampling_device;
117 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
+ Here is the caller graph for this function:

◆ init()

void SWGSDRangel::SWGDeviceSet::init ( )

Definition at line 44 of file SWGDeviceSet.cpp.

References channelcount, channels, m_channelcount_isSet, m_channels_isSet, m_sampling_device_isSet, and sampling_device.

Referenced by WebAPIAdapterGUI::getDeviceSet(), WebAPIAdapterSrv::getDeviceSet(), and SWGDeviceSet().

44  {
45  sampling_device = new SWGSamplingDevice();
47  channelcount = 0;
48  m_channelcount_isSet = false;
49  channels = new QList<SWGChannel*>();
50  m_channels_isSet = false;
51 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGDeviceSet::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 146 of file SWGDeviceSet.cpp.

References channels, SWGSDRangel::SWGSamplingDevice::isSet(), m_channelcount_isSet, and sampling_device.

146  {
147  bool isObjectUpdated = false;
148  do{
149  if(sampling_device != nullptr && sampling_device->isSet()){ isObjectUpdated = true; break;}
150  if(m_channelcount_isSet){ isObjectUpdated = true; break;}
151  if(channels->size() > 0){ isObjectUpdated = true; break;}
152  }while(false);
153  return isObjectUpdated;
154 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66
+ Here is the call graph for this function:

◆ setChannelcount()

void SWGSDRangel::SWGDeviceSet::setChannelcount ( qint32  channelcount)

Definition at line 129 of file SWGDeviceSet.cpp.

References channelcount, and m_channelcount_isSet.

Referenced by WebAPIAdapterGUI::getDeviceSet(), and WebAPIAdapterSrv::getDeviceSet().

129  {
130  this->channelcount = channelcount;
131  this->m_channelcount_isSet = true;
132 }
+ Here is the caller graph for this function:

◆ setChannels()

void SWGSDRangel::SWGDeviceSet::setChannels ( QList< SWGChannel *> *  channels)

Definition at line 139 of file SWGDeviceSet.cpp.

References channels, and m_channels_isSet.

139  {
140  this->channels = channels;
141  this->m_channels_isSet = true;
142 }
QList< SWGChannel * > * channels
Definition: SWGDeviceSet.h:66

◆ setSamplingDevice()

void SWGSDRangel::SWGDeviceSet::setSamplingDevice ( SWGSamplingDevice sampling_device)

Definition at line 119 of file SWGDeviceSet.cpp.

References m_sampling_device_isSet, and sampling_device.

119  {
121  this->m_sampling_device_isSet = true;
122 }
SWGSamplingDevice * sampling_device
Definition: SWGDeviceSet.h:60

Member Data Documentation

◆ channelcount

qint32 SWGSDRangel::SWGDeviceSet::channelcount
private

◆ channels

QList<SWGChannel*>* SWGSDRangel::SWGDeviceSet::channels
private

◆ m_channelcount_isSet

bool SWGSDRangel::SWGDeviceSet::m_channelcount_isSet
private

Definition at line 64 of file SWGDeviceSet.h.

Referenced by asJsonObject(), init(), isSet(), setChannelcount(), and SWGDeviceSet().

◆ m_channels_isSet

bool SWGSDRangel::SWGDeviceSet::m_channels_isSet
private

Definition at line 67 of file SWGDeviceSet.h.

Referenced by init(), setChannels(), and SWGDeviceSet().

◆ m_sampling_device_isSet

bool SWGSDRangel::SWGDeviceSet::m_sampling_device_isSet
private

Definition at line 61 of file SWGDeviceSet.h.

Referenced by init(), setSamplingDevice(), and SWGDeviceSet().

◆ sampling_device

SWGSamplingDevice* SWGSDRangel::SWGDeviceSet::sampling_device
private

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