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

#include <SWGAudioDevices.h>

+ Inheritance diagram for SWGSDRangel::SWGAudioDevices:
+ Collaboration diagram for SWGSDRangel::SWGAudioDevices:

Public Member Functions

 SWGAudioDevices ()
 
 SWGAudioDevices (QString *json)
 
virtual ~SWGAudioDevices ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGAudioDevicesfromJson (QString &jsonString) override
 
qint32 getNbInputDevices ()
 
void setNbInputDevices (qint32 nb_input_devices)
 
QList< SWGAudioInputDevice * > * getInputDevices ()
 
void setInputDevices (QList< SWGAudioInputDevice *> *input_devices)
 
qint32 getNbOutputDevices ()
 
void setNbOutputDevices (qint32 nb_output_devices)
 
QList< SWGAudioOutputDevice * > * getOutputDevices ()
 
void setOutputDevices (QList< SWGAudioOutputDevice *> *output_devices)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

qint32 nb_input_devices
 
bool m_nb_input_devices_isSet
 
QList< SWGAudioInputDevice * > * input_devices
 
bool m_input_devices_isSet
 
qint32 nb_output_devices
 
bool m_nb_output_devices_isSet
 
QList< SWGAudioOutputDevice * > * output_devices
 
bool m_output_devices_isSet
 

Detailed Description

Definition at line 34 of file SWGAudioDevices.h.

Constructor & Destructor Documentation

◆ SWGAudioDevices() [1/2]

SWGSDRangel::SWGAudioDevices::SWGAudioDevices ( )

◆ SWGAudioDevices() [2/2]

SWGSDRangel::SWGAudioDevices::SWGAudioDevices ( QString *  json)

Definition at line 25 of file SWGAudioDevices.cpp.

References fromJson(), and init().

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

◆ ~SWGAudioDevices()

SWGSDRangel::SWGAudioDevices::~SWGAudioDevices ( )
virtual

Definition at line 41 of file SWGAudioDevices.cpp.

References cleanup().

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

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGAudioDevices::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 99 of file SWGAudioDevices.cpp.

References asJsonObject().

Referenced by WebAPIRequestMapper::instanceAudioService().

100 {
101  QJsonObject* obj = this->asJsonObject();
102 
103  QJsonDocument doc(*obj);
104  QByteArray bytes = doc.toJson();
105  delete obj;
106  return QString(bytes);
107 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 110 of file SWGAudioDevices.cpp.

References input_devices, m_nb_input_devices_isSet, m_nb_output_devices_isSet, nb_input_devices, nb_output_devices, output_devices, and SWGSDRangel::toJsonArray().

Referenced by asJson().

110  {
111  QJsonObject* obj = new QJsonObject();
113  obj->insert("nbInputDevices", QJsonValue(nb_input_devices));
114  }
115  if(input_devices->size() > 0){
116  toJsonArray((QList<void*>*)input_devices, obj, "inputDevices", "SWGAudioInputDevice");
117  }
119  obj->insert("nbOutputDevices", QJsonValue(nb_output_devices));
120  }
121  if(output_devices->size() > 0){
122  toJsonArray((QList<void*>*)output_devices, obj, "outputDevices", "SWGAudioOutputDevice");
123  }
124 
125  return obj;
126 }
QList< SWGAudioOutputDevice * > * output_devices
QList< SWGAudioInputDevice * > * input_devices
void toJsonArray(QList< void *> *value, QJsonObject *output, QString innerName, QString innerType)
Definition: SWGHelpers.cpp:445
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup()

void SWGSDRangel::SWGAudioDevices::cleanup ( )

Definition at line 58 of file SWGAudioDevices.cpp.

References input_devices, and output_devices.

Referenced by ~SWGAudioDevices().

58  {
59 
60  if(input_devices != nullptr) {
61  auto arr = input_devices;
62  for(auto o: *arr) {
63  delete o;
64  }
65  delete input_devices;
66  }
67 
68  if(output_devices != nullptr) {
69  auto arr = output_devices;
70  for(auto o: *arr) {
71  delete o;
72  }
73  delete output_devices;
74  }
75 }
QList< SWGAudioOutputDevice * > * output_devices
QList< SWGAudioInputDevice * > * input_devices
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 78 of file SWGAudioDevices.cpp.

References fromJsonObject().

Referenced by SWGAudioDevices().

78  {
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 }
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::SWGAudioDevices::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 87 of file SWGAudioDevices.cpp.

References input_devices, nb_input_devices, nb_output_devices, output_devices, and SWGSDRangel::setValue().

Referenced by fromJson().

87  {
88  ::SWGSDRangel::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", "");
89 
90 
91  ::SWGSDRangel::setValue(&input_devices, pJson["inputDevices"], "QList", "SWGAudioInputDevice");
92  ::SWGSDRangel::setValue(&nb_output_devices, pJson["nbOutputDevices"], "qint32", "");
93 
94 
95  ::SWGSDRangel::setValue(&output_devices, pJson["outputDevices"], "QList", "SWGAudioOutputDevice");
96 }
QList< SWGAudioOutputDevice * > * output_devices
QList< SWGAudioInputDevice * > * input_devices
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:

◆ getInputDevices()

QList< SWGAudioInputDevice * > * SWGSDRangel::SWGAudioDevices::getInputDevices ( )

Definition at line 139 of file SWGAudioDevices.cpp.

References input_devices.

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

139  {
140  return input_devices;
141 }
QList< SWGAudioInputDevice * > * input_devices
+ Here is the caller graph for this function:

◆ getNbInputDevices()

qint32 SWGSDRangel::SWGAudioDevices::getNbInputDevices ( )

Definition at line 129 of file SWGAudioDevices.cpp.

References nb_input_devices.

129  {
130  return nb_input_devices;
131 }

◆ getNbOutputDevices()

qint32 SWGSDRangel::SWGAudioDevices::getNbOutputDevices ( )

Definition at line 149 of file SWGAudioDevices.cpp.

References nb_output_devices.

149  {
150  return nb_output_devices;
151 }

◆ getOutputDevices()

QList< SWGAudioOutputDevice * > * SWGSDRangel::SWGAudioDevices::getOutputDevices ( )

Definition at line 159 of file SWGAudioDevices.cpp.

References output_devices.

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

159  {
160  return output_devices;
161 }
QList< SWGAudioOutputDevice * > * output_devices
+ Here is the caller graph for this function:

◆ init()

void SWGSDRangel::SWGAudioDevices::init ( )

Definition at line 46 of file SWGAudioDevices.cpp.

References input_devices, m_input_devices_isSet, m_nb_input_devices_isSet, m_nb_output_devices_isSet, m_output_devices_isSet, nb_input_devices, nb_output_devices, and output_devices.

Referenced by WebAPIAdapterGUI::instanceAudioGet(), WebAPIAdapterSrv::instanceAudioGet(), and SWGAudioDevices().

46  {
47  nb_input_devices = 0;
49  input_devices = new QList<SWGAudioInputDevice*>();
50  m_input_devices_isSet = false;
53  output_devices = new QList<SWGAudioOutputDevice*>();
54  m_output_devices_isSet = false;
55 }
QList< SWGAudioOutputDevice * > * output_devices
QList< SWGAudioInputDevice * > * input_devices
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGAudioDevices::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 170 of file SWGAudioDevices.cpp.

References input_devices, m_nb_input_devices_isSet, m_nb_output_devices_isSet, and output_devices.

170  {
171  bool isObjectUpdated = false;
172  do{
173  if(m_nb_input_devices_isSet){ isObjectUpdated = true; break;}
174  if(input_devices->size() > 0){ isObjectUpdated = true; break;}
175  if(m_nb_output_devices_isSet){ isObjectUpdated = true; break;}
176  if(output_devices->size() > 0){ isObjectUpdated = true; break;}
177  }while(false);
178  return isObjectUpdated;
179 }
QList< SWGAudioOutputDevice * > * output_devices
QList< SWGAudioInputDevice * > * input_devices

◆ setInputDevices()

void SWGSDRangel::SWGAudioDevices::setInputDevices ( QList< SWGAudioInputDevice *> *  input_devices)

Definition at line 143 of file SWGAudioDevices.cpp.

References input_devices, and m_input_devices_isSet.

143  {
145  this->m_input_devices_isSet = true;
146 }
QList< SWGAudioInputDevice * > * input_devices

◆ setNbInputDevices()

void SWGSDRangel::SWGAudioDevices::setNbInputDevices ( qint32  nb_input_devices)

Definition at line 133 of file SWGAudioDevices.cpp.

References m_nb_input_devices_isSet, and nb_input_devices.

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

133  {
135  this->m_nb_input_devices_isSet = true;
136 }
+ Here is the caller graph for this function:

◆ setNbOutputDevices()

void SWGSDRangel::SWGAudioDevices::setNbOutputDevices ( qint32  nb_output_devices)

Definition at line 153 of file SWGAudioDevices.cpp.

References m_nb_output_devices_isSet, and nb_output_devices.

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

+ Here is the caller graph for this function:

◆ setOutputDevices()

void SWGSDRangel::SWGAudioDevices::setOutputDevices ( QList< SWGAudioOutputDevice *> *  output_devices)

Definition at line 163 of file SWGAudioDevices.cpp.

References m_output_devices_isSet, and output_devices.

163  {
165  this->m_output_devices_isSet = true;
166 }
QList< SWGAudioOutputDevice * > * output_devices

Member Data Documentation

◆ input_devices

QList<SWGAudioInputDevice*>* SWGSDRangel::SWGAudioDevices::input_devices
private

◆ m_input_devices_isSet

bool SWGSDRangel::SWGAudioDevices::m_input_devices_isSet
private

Definition at line 67 of file SWGAudioDevices.h.

Referenced by init(), setInputDevices(), and SWGAudioDevices().

◆ m_nb_input_devices_isSet

bool SWGSDRangel::SWGAudioDevices::m_nb_input_devices_isSet
private

Definition at line 64 of file SWGAudioDevices.h.

Referenced by asJsonObject(), init(), isSet(), setNbInputDevices(), and SWGAudioDevices().

◆ m_nb_output_devices_isSet

bool SWGSDRangel::SWGAudioDevices::m_nb_output_devices_isSet
private

Definition at line 70 of file SWGAudioDevices.h.

Referenced by asJsonObject(), init(), isSet(), setNbOutputDevices(), and SWGAudioDevices().

◆ m_output_devices_isSet

bool SWGSDRangel::SWGAudioDevices::m_output_devices_isSet
private

Definition at line 73 of file SWGAudioDevices.h.

Referenced by init(), setOutputDevices(), and SWGAudioDevices().

◆ nb_input_devices

qint32 SWGSDRangel::SWGAudioDevices::nb_input_devices
private

◆ nb_output_devices

qint32 SWGSDRangel::SWGAudioDevices::nb_output_devices
private

◆ output_devices

QList<SWGAudioOutputDevice*>* SWGSDRangel::SWGAudioDevices::output_devices
private

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