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.
Classes | Public Member Functions | Public Attributes | List of all members
DeviceUserArgs Struct Reference

#include <deviceuserargs.h>

Classes

struct  Args
 

Public Member Functions

QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
QString findUserArgs (const QString &id, int sequence)
 
void addDeviceArgs (const QString &id, int sequence, const QString &args)
 Will not add if it exists for same reference. More...
 
void addOrUpdateDeviceArgs (const QString &id, int sequence, const QString &args)
 Add or update if it exists for same reference. More...
 
void updateDeviceArgs (const QString &id, int sequence, const QString &args)
 Will not update if reference does not exist. More...
 
void deleteDeviceArgs (const QString &id, int sequence)
 
const QList< Args > & getArgsByDevice () const
 

Public Attributes

QList< Argsm_argsByDevice
 args corresponding to a device More...
 

Detailed Description

Definition at line 27 of file deviceuserargs.h.

Member Function Documentation

◆ addDeviceArgs()

void DeviceUserArgs::addDeviceArgs ( const QString &  id,
int  sequence,
const QString &  args 
)

Will not add if it exists for same reference.

Definition at line 81 of file deviceuserargs.cpp.

References i, and m_argsByDevice.

Referenced by DeviceUserArgsDialog::on_importDevice_clicked().

82 {
83  int i = 0;
84 
85  for (; i < m_argsByDevice.size(); i++)
86  {
87  if ((m_argsByDevice.at(i).m_id == id) && (m_argsByDevice.at(i).m_sequence == sequence)) {
88  break;
89  }
90  }
91 
92  if (i == m_argsByDevice.size()) {
93  m_argsByDevice.push_back(Args(id, sequence, deviceArgs));
94  }
95 }
QList< Args > m_argsByDevice
args corresponding to a device
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ addOrUpdateDeviceArgs()

void DeviceUserArgs::addOrUpdateDeviceArgs ( const QString &  id,
int  sequence,
const QString &  args 
)

Add or update if it exists for same reference.

Definition at line 97 of file deviceuserargs.cpp.

References i, and m_argsByDevice.

98 {
99  int i = 0;
100 
101  for (; i < m_argsByDevice.size(); i++)
102  {
103  if ((m_argsByDevice.at(i).m_id == id) && (m_argsByDevice.at(i).m_sequence == sequence)) {
104  m_argsByDevice[i].m_args = deviceArgs;
105  }
106  }
107 
108  if (i == m_argsByDevice.size()) {
109  m_argsByDevice.push_back(Args(id, sequence, deviceArgs));
110  }
111 }
QList< Args > m_argsByDevice
args corresponding to a device
int32_t i
Definition: decimators.h:244

◆ deleteDeviceArgs()

void DeviceUserArgs::deleteDeviceArgs ( const QString &  id,
int  sequence 
)

Definition at line 125 of file deviceuserargs.cpp.

References i, and m_argsByDevice.

Referenced by DeviceUserArgsDialog::on_deleteArgs_clicked().

126 {
127  int i = 0;
128 
129  for (; i < m_argsByDevice.size(); i++)
130  {
131  if ((m_argsByDevice.at(i).m_id == id) && (m_argsByDevice.at(i).m_sequence == sequence))
132  {
133  m_argsByDevice.takeAt(i);
134  return;
135  }
136  }
137 }
QList< Args > m_argsByDevice
args corresponding to a device
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ deserialize()

bool DeviceUserArgs::deserialize ( const QByteArray &  data)

Definition at line 45 of file deviceuserargs.cpp.

References SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_argsByDevice, and SimpleDeserializer::readBlob().

Referenced by MainSettings::load().

46 {
47  SimpleDeserializer d(data);
48 
49  if (!d.isValid()) {
50  return false;
51  }
52 
53  if(d.getVersion() == 1)
54  {
55  QByteArray data;
56 
57  d.readBlob(1, &data);
58  QDataStream readStream(&data, QIODevice::ReadOnly);
59  readStream >> m_argsByDevice;
60 
61  return true;
62  }
63  else
64  {
65  return false;
66  }
67 }
QList< Args > m_argsByDevice
args corresponding to a device
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findUserArgs()

QString DeviceUserArgs::findUserArgs ( const QString &  id,
int  sequence 
)

Definition at line 69 of file deviceuserargs.cpp.

References i, and m_argsByDevice.

Referenced by MainWindow::addMIMODevice(), MainCore::addSinkDevice(), MainWindow::addSinkDevice(), MainCore::addSourceDevice(), MainWindow::addSourceDevice(), MainWindow::sampleMIMOChanged(), MainWindow::sampleSinkChanged(), and MainWindow::sampleSourceChanged().

70 {
71  for (int i = 0; i < m_argsByDevice.size(); i++)
72  {
73  if ((m_argsByDevice.at(i).m_id == id) && (m_argsByDevice.at(i).m_sequence == sequence)) {
74  return m_argsByDevice.at(i).m_args;
75  }
76  }
77 
78  return "";
79 }
QList< Args > m_argsByDevice
args corresponding to a device
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ getArgsByDevice()

const QList<Args>& DeviceUserArgs::getArgsByDevice ( ) const
inline

Definition at line 58 of file deviceuserargs.h.

Referenced by DeviceUserArgsDialog::displayArgsByDevice().

58 { return m_argsByDevice; }
QList< Args > m_argsByDevice
args corresponding to a device
+ Here is the caller graph for this function:

◆ serialize()

QByteArray DeviceUserArgs::serialize ( ) const

Definition at line 35 of file deviceuserargs.cpp.

References SimpleSerializer::final(), m_argsByDevice, and SimpleSerializer::writeBlob().

Referenced by MainSettings::save().

36 {
37  SimpleSerializer s(1);
38  QByteArray data;
39  QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
40  *stream << m_argsByDevice;
41  s.writeBlob(1, data);
42  return s.final();
43 }
QList< Args > m_argsByDevice
args corresponding to a device
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateDeviceArgs()

void DeviceUserArgs::updateDeviceArgs ( const QString &  id,
int  sequence,
const QString &  args 
)

Will not update if reference does not exist.

Definition at line 113 of file deviceuserargs.cpp.

References i, and m_argsByDevice.

Referenced by DeviceUserArgsDialog::on_argStringEdit_editingFinished().

114 {
115  int i = 0;
116 
117  for (; i < m_argsByDevice.size(); i++)
118  {
119  if ((m_argsByDevice.at(i).m_id == id) && (m_argsByDevice.at(i).m_sequence == sequence)) {
120  m_argsByDevice[i].m_args = deviceArgs;
121  }
122  }
123 }
QList< Args > m_argsByDevice
args corresponding to a device
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_argsByDevice

QList<Args> DeviceUserArgs::m_argsByDevice

args corresponding to a device

Definition at line 60 of file deviceuserargs.h.

Referenced by addDeviceArgs(), addOrUpdateDeviceArgs(), deleteDeviceArgs(), deserialize(), findUserArgs(), serialize(), and updateDeviceArgs().


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