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

#include <SWGPreferences.h>

+ Inheritance diagram for SWGSDRangel::SWGPreferences:
+ Collaboration diagram for SWGSDRangel::SWGPreferences:

Public Member Functions

 SWGPreferences ()
 
 SWGPreferences (QString *json)
 
virtual ~SWGPreferences ()
 
void init ()
 
void cleanup ()
 
virtual QString asJson () override
 
virtual QJsonObject * asJsonObject () override
 
virtual void fromJsonObject (QJsonObject &json) override
 
virtual SWGPreferencesfromJson (QString &jsonString) override
 
QString * getSourceType ()
 
void setSourceType (QString *source_type)
 
QString * getSourceDevice ()
 
void setSourceDevice (QString *source_device)
 
QString * getAudioType ()
 
void setAudioType (QString *audio_type)
 
QString * getAudioDevice ()
 
void setAudioDevice (QString *audio_device)
 
qint32 getSourceIndex ()
 
void setSourceIndex (qint32 source_index)
 
float getLatitude ()
 
void setLatitude (float latitude)
 
float getLongitude ()
 
void setLongitude (float longitude)
 
qint32 getConsoleMinLogLevel ()
 
void setConsoleMinLogLevel (qint32 console_min_log_level)
 
qint32 getUseLogFile ()
 
void setUseLogFile (qint32 use_log_file)
 
QString * getLogFileName ()
 
void setLogFileName (QString *log_file_name)
 
qint32 getFileMinLogLevel ()
 
void setFileMinLogLevel (qint32 file_min_log_level)
 
virtual bool isSet () override
 
- Public Member Functions inherited from SWGSDRangel::SWGObject
virtual ~SWGObject ()
 

Private Attributes

QString * source_type
 
bool m_source_type_isSet
 
QString * source_device
 
bool m_source_device_isSet
 
QString * audio_type
 
bool m_audio_type_isSet
 
QString * audio_device
 
bool m_audio_device_isSet
 
qint32 source_index
 
bool m_source_index_isSet
 
float latitude
 
bool m_latitude_isSet
 
float longitude
 
bool m_longitude_isSet
 
qint32 console_min_log_level
 
bool m_console_min_log_level_isSet
 
qint32 use_log_file
 
bool m_use_log_file_isSet
 
QString * log_file_name
 
bool m_log_file_name_isSet
 
qint32 file_min_log_level
 
bool m_file_min_log_level_isSet
 

Detailed Description

Definition at line 32 of file SWGPreferences.h.

Constructor & Destructor Documentation

◆ SWGPreferences() [1/2]

SWGSDRangel::SWGPreferences::SWGPreferences ( )

Definition at line 30 of file SWGPreferences.cpp.

References audio_device, audio_type, console_min_log_level, file_min_log_level, latitude, log_file_name, longitude, m_audio_device_isSet, m_audio_type_isSet, m_console_min_log_level_isSet, m_file_min_log_level_isSet, m_latitude_isSet, m_log_file_name_isSet, m_longitude_isSet, m_source_device_isSet, m_source_index_isSet, m_source_type_isSet, m_use_log_file_isSet, source_device, source_index, source_type, and use_log_file.

30  {
31  source_type = nullptr;
32  m_source_type_isSet = false;
33  source_device = nullptr;
34  m_source_device_isSet = false;
35  audio_type = nullptr;
36  m_audio_type_isSet = false;
37  audio_device = nullptr;
38  m_audio_device_isSet = false;
39  source_index = 0;
40  m_source_index_isSet = false;
41  latitude = 0.0f;
42  m_latitude_isSet = false;
43  longitude = 0.0f;
44  m_longitude_isSet = false;
47  use_log_file = 0;
48  m_use_log_file_isSet = false;
49  log_file_name = nullptr;
50  m_log_file_name_isSet = false;
53 }

◆ SWGPreferences() [2/2]

SWGSDRangel::SWGPreferences::SWGPreferences ( QString *  json)

Definition at line 25 of file SWGPreferences.cpp.

References fromJson(), and init().

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

◆ ~SWGPreferences()

SWGSDRangel::SWGPreferences::~SWGPreferences ( )
virtual

Definition at line 55 of file SWGPreferences.cpp.

References cleanup().

55  {
56  this->cleanup();
57 }
+ Here is the call graph for this function:

Member Function Documentation

◆ asJson()

QString SWGSDRangel::SWGPreferences::asJson ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 146 of file SWGPreferences.cpp.

References asJsonObject().

147 {
148  QJsonObject* obj = this->asJsonObject();
149 
150  QJsonDocument doc(*obj);
151  QByteArray bytes = doc.toJson();
152  delete obj;
153  return QString(bytes);
154 }
virtual QJsonObject * asJsonObject() override
+ Here is the call graph for this function:

◆ asJsonObject()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 157 of file SWGPreferences.cpp.

References audio_device, audio_type, console_min_log_level, file_min_log_level, latitude, log_file_name, longitude, m_console_min_log_level_isSet, m_file_min_log_level_isSet, m_latitude_isSet, m_longitude_isSet, m_source_index_isSet, m_use_log_file_isSet, source_device, source_index, source_type, SWGSDRangel::toJsonValue(), and use_log_file.

Referenced by asJson().

157  {
158  QJsonObject* obj = new QJsonObject();
159  if(source_type != nullptr && *source_type != QString("")){
160  toJsonValue(QString("sourceType"), source_type, obj, QString("QString"));
161  }
162  if(source_device != nullptr && *source_device != QString("")){
163  toJsonValue(QString("sourceDevice"), source_device, obj, QString("QString"));
164  }
165  if(audio_type != nullptr && *audio_type != QString("")){
166  toJsonValue(QString("audioType"), audio_type, obj, QString("QString"));
167  }
168  if(audio_device != nullptr && *audio_device != QString("")){
169  toJsonValue(QString("audioDevice"), audio_device, obj, QString("QString"));
170  }
172  obj->insert("sourceIndex", QJsonValue(source_index));
173  }
174  if(m_latitude_isSet){
175  obj->insert("latitude", QJsonValue(latitude));
176  }
177  if(m_longitude_isSet){
178  obj->insert("longitude", QJsonValue(longitude));
179  }
181  obj->insert("consoleMinLogLevel", QJsonValue(console_min_log_level));
182  }
184  obj->insert("useLogFile", QJsonValue(use_log_file));
185  }
186  if(log_file_name != nullptr && *log_file_name != QString("")){
187  toJsonValue(QString("logFileName"), log_file_name, obj, QString("QString"));
188  }
190  obj->insert("fileMinLogLevel", QJsonValue(file_min_log_level));
191  }
192 
193  return obj;
194 }
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::SWGPreferences::cleanup ( )

Definition at line 86 of file SWGPreferences.cpp.

References audio_device, audio_type, log_file_name, source_device, and source_type.

Referenced by ~SWGPreferences().

86  {
87  if(source_type != nullptr) {
88  delete source_type;
89  }
90  if(source_device != nullptr) {
91  delete source_device;
92  }
93  if(audio_type != nullptr) {
94  delete audio_type;
95  }
96  if(audio_device != nullptr) {
97  delete audio_device;
98  }
99 
100 
101 
102 
103 
104  if(log_file_name != nullptr) {
105  delete log_file_name;
106  }
107 
108 }
+ Here is the caller graph for this function:

◆ fromJson()

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

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 111 of file SWGPreferences.cpp.

References fromJsonObject().

Referenced by SWGPreferences().

111  {
112  QByteArray array (json.toStdString().c_str());
113  QJsonDocument doc = QJsonDocument::fromJson(array);
114  QJsonObject jsonObject = doc.object();
115  this->fromJsonObject(jsonObject);
116  return this;
117 }
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::SWGPreferences::fromJsonObject ( QJsonObject &  json)
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 120 of file SWGPreferences.cpp.

References audio_device, audio_type, console_min_log_level, file_min_log_level, latitude, log_file_name, longitude, SWGSDRangel::setValue(), source_device, source_index, source_type, and use_log_file.

Referenced by fromJson().

120  {
121  ::SWGSDRangel::setValue(&source_type, pJson["sourceType"], "QString", "QString");
122 
123  ::SWGSDRangel::setValue(&source_device, pJson["sourceDevice"], "QString", "QString");
124 
125  ::SWGSDRangel::setValue(&audio_type, pJson["audioType"], "QString", "QString");
126 
127  ::SWGSDRangel::setValue(&audio_device, pJson["audioDevice"], "QString", "QString");
128 
129  ::SWGSDRangel::setValue(&source_index, pJson["sourceIndex"], "qint32", "");
130 
131  ::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", "");
132 
133  ::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", "");
134 
135  ::SWGSDRangel::setValue(&console_min_log_level, pJson["consoleMinLogLevel"], "qint32", "");
136 
137  ::SWGSDRangel::setValue(&use_log_file, pJson["useLogFile"], "qint32", "");
138 
139  ::SWGSDRangel::setValue(&log_file_name, pJson["logFileName"], "QString", "QString");
140 
141  ::SWGSDRangel::setValue(&file_min_log_level, pJson["fileMinLogLevel"], "qint32", "");
142 
143 }
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:

◆ getAudioDevice()

QString * SWGSDRangel::SWGPreferences::getAudioDevice ( )

Definition at line 227 of file SWGPreferences.cpp.

References audio_device.

227  {
228  return audio_device;
229 }

◆ getAudioType()

QString * SWGSDRangel::SWGPreferences::getAudioType ( )

Definition at line 217 of file SWGPreferences.cpp.

References audio_type.

217  {
218  return audio_type;
219 }

◆ getConsoleMinLogLevel()

qint32 SWGSDRangel::SWGPreferences::getConsoleMinLogLevel ( )

Definition at line 267 of file SWGPreferences.cpp.

References console_min_log_level.

267  {
268  return console_min_log_level;
269 }

◆ getFileMinLogLevel()

qint32 SWGSDRangel::SWGPreferences::getFileMinLogLevel ( )

Definition at line 297 of file SWGPreferences.cpp.

References file_min_log_level.

297  {
298  return file_min_log_level;
299 }

◆ getLatitude()

float SWGSDRangel::SWGPreferences::getLatitude ( )

Definition at line 247 of file SWGPreferences.cpp.

References latitude.

247  {
248  return latitude;
249 }

◆ getLogFileName()

QString * SWGSDRangel::SWGPreferences::getLogFileName ( )

Definition at line 287 of file SWGPreferences.cpp.

References log_file_name.

287  {
288  return log_file_name;
289 }

◆ getLongitude()

float SWGSDRangel::SWGPreferences::getLongitude ( )

Definition at line 257 of file SWGPreferences.cpp.

References longitude.

257  {
258  return longitude;
259 }

◆ getSourceDevice()

QString * SWGSDRangel::SWGPreferences::getSourceDevice ( )

Definition at line 207 of file SWGPreferences.cpp.

References source_device.

207  {
208  return source_device;
209 }

◆ getSourceIndex()

qint32 SWGSDRangel::SWGPreferences::getSourceIndex ( )

Definition at line 237 of file SWGPreferences.cpp.

References source_index.

237  {
238  return source_index;
239 }

◆ getSourceType()

QString * SWGSDRangel::SWGPreferences::getSourceType ( )

Definition at line 197 of file SWGPreferences.cpp.

References source_type.

197  {
198  return source_type;
199 }

◆ getUseLogFile()

qint32 SWGSDRangel::SWGPreferences::getUseLogFile ( )

Definition at line 277 of file SWGPreferences.cpp.

References use_log_file.

277  {
278  return use_log_file;
279 }

◆ init()

void SWGSDRangel::SWGPreferences::init ( )

Definition at line 60 of file SWGPreferences.cpp.

References audio_device, audio_type, console_min_log_level, file_min_log_level, latitude, log_file_name, longitude, m_audio_device_isSet, m_audio_type_isSet, m_console_min_log_level_isSet, m_file_min_log_level_isSet, m_latitude_isSet, m_log_file_name_isSet, m_longitude_isSet, m_source_device_isSet, m_source_index_isSet, m_source_type_isSet, m_use_log_file_isSet, source_device, source_index, source_type, and use_log_file.

Referenced by SWGPreferences(), and WebAPIAdapterBase::webapiFormatPreferences().

60  {
61  source_type = new QString("");
62  m_source_type_isSet = false;
63  source_device = new QString("");
64  m_source_device_isSet = false;
65  audio_type = new QString("");
66  m_audio_type_isSet = false;
67  audio_device = new QString("");
68  m_audio_device_isSet = false;
69  source_index = 0;
70  m_source_index_isSet = false;
71  latitude = 0.0f;
72  m_latitude_isSet = false;
73  longitude = 0.0f;
74  m_longitude_isSet = false;
77  use_log_file = 0;
78  m_use_log_file_isSet = false;
79  log_file_name = new QString("");
80  m_log_file_name_isSet = false;
83 }
+ Here is the caller graph for this function:

◆ isSet()

bool SWGSDRangel::SWGPreferences::isSet ( )
overridevirtual

Reimplemented from SWGSDRangel::SWGObject.

Definition at line 308 of file SWGPreferences.cpp.

References audio_device, audio_type, log_file_name, m_console_min_log_level_isSet, m_file_min_log_level_isSet, m_latitude_isSet, m_longitude_isSet, m_source_index_isSet, m_use_log_file_isSet, source_device, and source_type.

Referenced by SWGSDRangel::SWGInstanceConfigResponse::asJsonObject(), and SWGSDRangel::SWGInstanceConfigResponse::isSet().

308  {
309  bool isObjectUpdated = false;
310  do{
311  if(source_type != nullptr && *source_type != QString("")){ isObjectUpdated = true; break;}
312  if(source_device != nullptr && *source_device != QString("")){ isObjectUpdated = true; break;}
313  if(audio_type != nullptr && *audio_type != QString("")){ isObjectUpdated = true; break;}
314  if(audio_device != nullptr && *audio_device != QString("")){ isObjectUpdated = true; break;}
315  if(m_source_index_isSet){ isObjectUpdated = true; break;}
316  if(m_latitude_isSet){ isObjectUpdated = true; break;}
317  if(m_longitude_isSet){ isObjectUpdated = true; break;}
318  if(m_console_min_log_level_isSet){ isObjectUpdated = true; break;}
319  if(m_use_log_file_isSet){ isObjectUpdated = true; break;}
320  if(log_file_name != nullptr && *log_file_name != QString("")){ isObjectUpdated = true; break;}
321  if(m_file_min_log_level_isSet){ isObjectUpdated = true; break;}
322  }while(false);
323  return isObjectUpdated;
324 }
+ Here is the caller graph for this function:

◆ setAudioDevice()

void SWGSDRangel::SWGPreferences::setAudioDevice ( QString *  audio_device)

Definition at line 231 of file SWGPreferences.cpp.

References audio_device, and m_audio_device_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

231  {
232  this->audio_device = audio_device;
233  this->m_audio_device_isSet = true;
234 }
+ Here is the caller graph for this function:

◆ setAudioType()

void SWGSDRangel::SWGPreferences::setAudioType ( QString *  audio_type)

Definition at line 221 of file SWGPreferences.cpp.

References audio_type, and m_audio_type_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

221  {
222  this->audio_type = audio_type;
223  this->m_audio_type_isSet = true;
224 }
+ Here is the caller graph for this function:

◆ setConsoleMinLogLevel()

void SWGSDRangel::SWGPreferences::setConsoleMinLogLevel ( qint32  console_min_log_level)

Definition at line 271 of file SWGPreferences.cpp.

References console_min_log_level, and m_console_min_log_level_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

+ Here is the caller graph for this function:

◆ setFileMinLogLevel()

void SWGSDRangel::SWGPreferences::setFileMinLogLevel ( qint32  file_min_log_level)

Definition at line 301 of file SWGPreferences.cpp.

References file_min_log_level, and m_file_min_log_level_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

+ Here is the caller graph for this function:

◆ setLatitude()

void SWGSDRangel::SWGPreferences::setLatitude ( float  latitude)

Definition at line 251 of file SWGPreferences.cpp.

References latitude, and m_latitude_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

251  {
252  this->latitude = latitude;
253  this->m_latitude_isSet = true;
254 }
+ Here is the caller graph for this function:

◆ setLogFileName()

void SWGSDRangel::SWGPreferences::setLogFileName ( QString *  log_file_name)

Definition at line 291 of file SWGPreferences.cpp.

References log_file_name, and m_log_file_name_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

291  {
293  this->m_log_file_name_isSet = true;
294 }
+ Here is the caller graph for this function:

◆ setLongitude()

void SWGSDRangel::SWGPreferences::setLongitude ( float  longitude)

Definition at line 261 of file SWGPreferences.cpp.

References longitude, and m_longitude_isSet.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

261  {
262  this->longitude = longitude;
263  this->m_longitude_isSet = true;
264 }
+ Here is the caller graph for this function:

◆ setSourceDevice()

void SWGSDRangel::SWGPreferences::setSourceDevice ( QString *  source_device)

Definition at line 211 of file SWGPreferences.cpp.

References m_source_device_isSet, and source_device.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

211  {
213  this->m_source_device_isSet = true;
214 }
+ Here is the caller graph for this function:

◆ setSourceIndex()

void SWGSDRangel::SWGPreferences::setSourceIndex ( qint32  source_index)

Definition at line 241 of file SWGPreferences.cpp.

References m_source_index_isSet, and source_index.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

241  {
242  this->source_index = source_index;
243  this->m_source_index_isSet = true;
244 }
+ Here is the caller graph for this function:

◆ setSourceType()

void SWGSDRangel::SWGPreferences::setSourceType ( QString *  source_type)

Definition at line 201 of file SWGPreferences.cpp.

References m_source_type_isSet, and source_type.

201  {
202  this->source_type = source_type;
203  this->m_source_type_isSet = true;
204 }

◆ setUseLogFile()

void SWGSDRangel::SWGPreferences::setUseLogFile ( qint32  use_log_file)

Definition at line 281 of file SWGPreferences.cpp.

References m_use_log_file_isSet, and use_log_file.

Referenced by WebAPIAdapterBase::webapiFormatPreferences().

281  {
282  this->use_log_file = use_log_file;
283  this->m_use_log_file_isSet = true;
284 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ audio_device

QString* SWGSDRangel::SWGPreferences::audio_device
private

◆ audio_type

QString* SWGSDRangel::SWGPreferences::audio_type
private

◆ console_min_log_level

qint32 SWGSDRangel::SWGPreferences::console_min_log_level
private

◆ file_min_log_level

qint32 SWGSDRangel::SWGPreferences::file_min_log_level
private

◆ latitude

float SWGSDRangel::SWGPreferences::latitude
private

◆ log_file_name

QString* SWGSDRangel::SWGPreferences::log_file_name
private

◆ longitude

float SWGSDRangel::SWGPreferences::longitude
private

◆ m_audio_device_isSet

bool SWGSDRangel::SWGPreferences::m_audio_device_isSet
private

Definition at line 92 of file SWGPreferences.h.

Referenced by init(), setAudioDevice(), and SWGPreferences().

◆ m_audio_type_isSet

bool SWGSDRangel::SWGPreferences::m_audio_type_isSet
private

Definition at line 89 of file SWGPreferences.h.

Referenced by init(), setAudioType(), and SWGPreferences().

◆ m_console_min_log_level_isSet

bool SWGSDRangel::SWGPreferences::m_console_min_log_level_isSet
private

Definition at line 104 of file SWGPreferences.h.

Referenced by asJsonObject(), init(), isSet(), setConsoleMinLogLevel(), and SWGPreferences().

◆ m_file_min_log_level_isSet

bool SWGSDRangel::SWGPreferences::m_file_min_log_level_isSet
private

Definition at line 113 of file SWGPreferences.h.

Referenced by asJsonObject(), init(), isSet(), setFileMinLogLevel(), and SWGPreferences().

◆ m_latitude_isSet

bool SWGSDRangel::SWGPreferences::m_latitude_isSet
private

Definition at line 98 of file SWGPreferences.h.

Referenced by asJsonObject(), init(), isSet(), setLatitude(), and SWGPreferences().

◆ m_log_file_name_isSet

bool SWGSDRangel::SWGPreferences::m_log_file_name_isSet
private

Definition at line 110 of file SWGPreferences.h.

Referenced by init(), setLogFileName(), and SWGPreferences().

◆ m_longitude_isSet

bool SWGSDRangel::SWGPreferences::m_longitude_isSet
private

Definition at line 101 of file SWGPreferences.h.

Referenced by asJsonObject(), init(), isSet(), setLongitude(), and SWGPreferences().

◆ m_source_device_isSet

bool SWGSDRangel::SWGPreferences::m_source_device_isSet
private

Definition at line 86 of file SWGPreferences.h.

Referenced by init(), setSourceDevice(), and SWGPreferences().

◆ m_source_index_isSet

bool SWGSDRangel::SWGPreferences::m_source_index_isSet
private

Definition at line 95 of file SWGPreferences.h.

Referenced by asJsonObject(), init(), isSet(), setSourceIndex(), and SWGPreferences().

◆ m_source_type_isSet

bool SWGSDRangel::SWGPreferences::m_source_type_isSet
private

Definition at line 83 of file SWGPreferences.h.

Referenced by init(), setSourceType(), and SWGPreferences().

◆ m_use_log_file_isSet

bool SWGSDRangel::SWGPreferences::m_use_log_file_isSet
private

Definition at line 107 of file SWGPreferences.h.

Referenced by asJsonObject(), init(), isSet(), setUseLogFile(), and SWGPreferences().

◆ source_device

QString* SWGSDRangel::SWGPreferences::source_device
private

◆ source_index

qint32 SWGSDRangel::SWGPreferences::source_index
private

◆ source_type

QString* SWGSDRangel::SWGPreferences::source_type
private

◆ use_log_file

qint32 SWGSDRangel::SWGPreferences::use_log_file
private

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