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 | Static Public Member Functions | Private Types | Private Attributes | List of all members
DeviceEnumerator Class Reference

#include <deviceenumerator.h>

Classes

struct  DeviceEnumeration
 

Public Member Functions

 DeviceEnumerator ()
 
 ~DeviceEnumerator ()
 
void enumerateRxDevices (PluginManager *pluginManager)
 
void enumerateTxDevices (PluginManager *pluginManager)
 
void enumerateMIMODevices (PluginManager *pluginManager)
 
void listRxDeviceNames (QList< QString > &list, std::vector< int > &indexes) const
 
void listTxDeviceNames (QList< QString > &list, std::vector< int > &indexes) const
 
void listMIMODeviceNames (QList< QString > &list, std::vector< int > &indexes) const
 
void changeRxSelection (int tabIndex, int deviceIndex)
 
void changeTxSelection (int tabIndex, int deviceIndex)
 
void changeMIMOSelection (int tabIndex, int deviceIndex)
 
void removeRxSelection (int tabIndex)
 
void removeTxSelection (int tabIndex)
 
void removeMIMOSelection (int tabIndex)
 
int getNbRxSamplingDevices () const
 
int getNbTxSamplingDevices () const
 
int getNbMIMOSamplingDevices () const
 
const PluginInterface::SamplingDevicegetRxSamplingDevice (int deviceIndex) const
 
const PluginInterface::SamplingDevicegetTxSamplingDevice (int deviceIndex) const
 
const PluginInterface::SamplingDevicegetMIMOSamplingDevice (int deviceIndex) const
 
PluginInterfacegetRxPluginInterface (int deviceIndex)
 
PluginInterfacegetTxPluginInterface (int deviceIndex)
 
PluginInterfacegetMIMOPluginInterface (int deviceIndex)
 
int getFileInputDeviceIndex () const
 Get Rx default device. More...
 
int getFileSinkDeviceIndex () const
 Get Tx default device. More...
 
int getTestMIMODeviceIndex () const
 Get MIMO default device. More...
 
int getRxSamplingDeviceIndex (const QString &deviceId, int sequence)
 
int getTxSamplingDeviceIndex (const QString &deviceId, int sequence)
 
int getMIMOSamplingDeviceIndex (const QString &deviceId, int sequence)
 

Static Public Member Functions

static DeviceEnumeratorinstance ()
 

Private Types

typedef std::vector< DeviceEnumerationDevicesEnumeration
 

Private Attributes

DevicesEnumeration m_rxEnumeration
 
DevicesEnumeration m_txEnumeration
 
DevicesEnumeration m_mimoEnumeration
 

Detailed Description

Definition at line 28 of file deviceenumerator.h.

Member Typedef Documentation

◆ DevicesEnumeration

Definition at line 78 of file deviceenumerator.h.

Constructor & Destructor Documentation

◆ DeviceEnumerator()

DeviceEnumerator::DeviceEnumerator ( )

Definition at line 29 of file deviceenumerator.cpp.

30 {}

◆ ~DeviceEnumerator()

DeviceEnumerator::~DeviceEnumerator ( )

Definition at line 32 of file deviceenumerator.cpp.

33 {}

Member Function Documentation

◆ changeMIMOSelection()

void DeviceEnumerator::changeMIMOSelection ( int  tabIndex,
int  deviceIndex 
)

Definition at line 172 of file deviceenumerator.cpp.

References m_mimoEnumeration.

Referenced by SamplingDeviceDialog::accept(), and SamplingDeviceControl::setSelectedDeviceIndex().

173 {
174  for (DevicesEnumeration::iterator it = m_mimoEnumeration.begin(); it != m_mimoEnumeration.end(); ++it)
175  {
176  if (it->m_samplingDevice.claimed == tabIndex) {
177  it->m_samplingDevice.claimed = -1;
178  }
179  if (it->m_index == deviceIndex) {
180  it->m_samplingDevice.claimed = tabIndex;
181  }
182  }
183 }
DevicesEnumeration m_mimoEnumeration
+ Here is the caller graph for this function:

◆ changeRxSelection()

void DeviceEnumerator::changeRxSelection ( int  tabIndex,
int  deviceIndex 
)

Definition at line 146 of file deviceenumerator.cpp.

References m_rxEnumeration.

Referenced by SamplingDeviceDialog::accept(), and SamplingDeviceControl::setSelectedDeviceIndex().

147 {
148  for (DevicesEnumeration::iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it)
149  {
150  if (it->m_samplingDevice.claimed == tabIndex) {
151  it->m_samplingDevice.claimed = -1;
152  }
153  if (it->m_index == deviceIndex) {
154  it->m_samplingDevice.claimed = tabIndex;
155  }
156  }
157 }
DevicesEnumeration m_rxEnumeration
+ Here is the caller graph for this function:

◆ changeTxSelection()

void DeviceEnumerator::changeTxSelection ( int  tabIndex,
int  deviceIndex 
)

Definition at line 159 of file deviceenumerator.cpp.

References m_txEnumeration.

Referenced by SamplingDeviceDialog::accept(), and SamplingDeviceControl::setSelectedDeviceIndex().

160 {
161  for (DevicesEnumeration::iterator it = m_txEnumeration.begin(); it != m_txEnumeration.end(); ++it)
162  {
163  if (it->m_samplingDevice.claimed == tabIndex) {
164  it->m_samplingDevice.claimed = -1;
165  }
166  if (it->m_index == deviceIndex) {
167  it->m_samplingDevice.claimed = tabIndex;
168  }
169  }
170 }
DevicesEnumeration m_txEnumeration
+ Here is the caller graph for this function:

◆ enumerateMIMODevices()

void DeviceEnumerator::enumerateMIMODevices ( PluginManager pluginManager)

Definition at line 85 of file deviceenumerator.cpp.

References PluginManager::getMIMODeviceRegistrations(), i, and m_mimoEnumeration.

Referenced by PluginManager::loadPluginsFinal().

86 {
87  m_mimoEnumeration.clear();
88  PluginAPI::SamplingDeviceRegistrations& mimoDeviceRegistrations = pluginManager->getMIMODeviceRegistrations();
89  int index = 0;
90 
91  for (int i = 0; i < mimoDeviceRegistrations.count(); i++)
92  {
93  qDebug("DeviceEnumerator::enumerateMIMODevices: %s", qPrintable(mimoDeviceRegistrations[i].m_deviceId));
94  PluginInterface::SamplingDevices samplingDevices = mimoDeviceRegistrations[i].m_plugin->enumSampleMIMO();
95 
96  for (int j = 0; j < samplingDevices.count(); j++)
97  {
98  m_mimoEnumeration.push_back(
99  DeviceEnumeration(
100  samplingDevices[j],
101  mimoDeviceRegistrations[i].m_plugin,
102  index
103  )
104  );
105  index++;
106  }
107  }
108 }
QList< SamplingDeviceRegistration > SamplingDeviceRegistrations
Definition: pluginapi.h:30
int32_t i
Definition: decimators.h:244
PluginAPI::SamplingDeviceRegistrations & getMIMODeviceRegistrations()
Definition: pluginmanager.h:73
QList< SamplingDevice > SamplingDevices
DevicesEnumeration m_mimoEnumeration
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enumerateRxDevices()

void DeviceEnumerator::enumerateRxDevices ( PluginManager pluginManager)

Definition at line 35 of file deviceenumerator.cpp.

References PluginManager::getSourceDeviceRegistrations(), i, and m_rxEnumeration.

Referenced by PluginManager::loadPluginsFinal().

36 {
37  m_rxEnumeration.clear();
38  PluginAPI::SamplingDeviceRegistrations& rxDeviceRegistrations = pluginManager->getSourceDeviceRegistrations();
39  int index = 0;
40 
41  for (int i = 0; i < rxDeviceRegistrations.count(); i++)
42  {
43  qDebug("DeviceEnumerator::enumerateRxDevices: %s", qPrintable(rxDeviceRegistrations[i].m_deviceId));
44  PluginInterface::SamplingDevices samplingDevices = rxDeviceRegistrations[i].m_plugin->enumSampleSources();
45 
46  for (int j = 0; j < samplingDevices.count(); j++)
47  {
48  m_rxEnumeration.push_back(
49  DeviceEnumeration(
50  samplingDevices[j],
51  rxDeviceRegistrations[i].m_plugin,
52  index
53  )
54  );
55  index++;
56  }
57  }
58 }
QList< SamplingDeviceRegistration > SamplingDeviceRegistrations
Definition: pluginapi.h:30
DevicesEnumeration m_rxEnumeration
int32_t i
Definition: decimators.h:244
PluginAPI::SamplingDeviceRegistrations & getSourceDeviceRegistrations()
Definition: pluginmanager.h:71
QList< SamplingDevice > SamplingDevices
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enumerateTxDevices()

void DeviceEnumerator::enumerateTxDevices ( PluginManager pluginManager)

Definition at line 60 of file deviceenumerator.cpp.

References PluginManager::getSinkDeviceRegistrations(), i, and m_txEnumeration.

Referenced by PluginManager::loadPluginsFinal().

61 {
62  m_txEnumeration.clear();
63  PluginAPI::SamplingDeviceRegistrations& txDeviceRegistrations = pluginManager->getSinkDeviceRegistrations();
64  int index = 0;
65 
66  for (int i = 0; i < txDeviceRegistrations.count(); i++)
67  {
68  qDebug("DeviceEnumerator::enumerateTxDevices: %s", qPrintable(txDeviceRegistrations[i].m_deviceId));
69  PluginInterface::SamplingDevices samplingDevices = txDeviceRegistrations[i].m_plugin->enumSampleSinks();
70 
71  for (int j = 0; j < samplingDevices.count(); j++)
72  {
73  m_txEnumeration.push_back(
74  DeviceEnumeration(
75  samplingDevices[j],
76  txDeviceRegistrations[i].m_plugin,
77  index
78  )
79  );
80  index++;
81  }
82  }
83 }
QList< SamplingDeviceRegistration > SamplingDeviceRegistrations
Definition: pluginapi.h:30
int32_t i
Definition: decimators.h:244
PluginAPI::SamplingDeviceRegistrations & getSinkDeviceRegistrations()
Definition: pluginmanager.h:72
DevicesEnumeration m_txEnumeration
QList< SamplingDevice > SamplingDevices
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFileInputDeviceIndex()

int DeviceEnumerator::getFileInputDeviceIndex ( ) const

Get Rx default device.

Definition at line 215 of file deviceenumerator.cpp.

References PluginManager::getFileInputDeviceId(), and m_rxEnumeration.

Referenced by MainCore::addSourceDevice(), and MainWindow::addSourceDevice().

216 {
217  for (DevicesEnumeration::const_iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it)
218  {
219  if (it->m_samplingDevice.id == PluginManager::getFileInputDeviceId()) {
220  return it->m_index;
221  }
222  }
223 
224  return -1;
225 }
static const QString & getFileInputDeviceId()
Definition: pluginmanager.h:83
DevicesEnumeration m_rxEnumeration
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFileSinkDeviceIndex()

int DeviceEnumerator::getFileSinkDeviceIndex ( ) const

Get Tx default device.

Definition at line 227 of file deviceenumerator.cpp.

References PluginManager::getFileSinkDeviceId(), and m_txEnumeration.

Referenced by MainCore::addSinkDevice(), and MainWindow::addSinkDevice().

228 {
229  for (DevicesEnumeration::const_iterator it = m_txEnumeration.begin(); it != m_txEnumeration.end(); ++it)
230  {
231  if (it->m_samplingDevice.id == PluginManager::getFileSinkDeviceId()) {
232  return it->m_index;
233  }
234  }
235 
236  return -1;
237 }
static const QString & getFileSinkDeviceId()
Definition: pluginmanager.h:84
DevicesEnumeration m_txEnumeration
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMIMOPluginInterface()

PluginInterface* DeviceEnumerator::getMIMOPluginInterface ( int  deviceIndex)
inline

Definition at line 56 of file deviceenumerator.h.

56 { return m_mimoEnumeration[deviceIndex].m_pluginInterface; }
DevicesEnumeration m_mimoEnumeration

◆ getMIMOSamplingDevice()

const PluginInterface::SamplingDevice* DeviceEnumerator::getMIMOSamplingDevice ( int  deviceIndex) const
inline

Definition at line 53 of file deviceenumerator.h.

Referenced by MainWindow::addMIMODevice(), DeviceUserArgsDialog::DeviceUserArgsDialog(), MainWindow::sampleMIMOChanged(), and SamplingDeviceControl::setSelectedDeviceIndex().

53 { return &m_mimoEnumeration[deviceIndex].m_samplingDevice; }
DevicesEnumeration m_mimoEnumeration
+ Here is the caller graph for this function:

◆ getMIMOSamplingDeviceIndex()

int DeviceEnumerator::getMIMOSamplingDeviceIndex ( const QString &  deviceId,
int  sequence 
)

Definition at line 275 of file deviceenumerator.cpp.

References m_mimoEnumeration.

276 {
277  for (DevicesEnumeration::iterator it = m_mimoEnumeration.begin(); it != m_mimoEnumeration.end(); ++it)
278  {
279  if ((it->m_samplingDevice.id == deviceId) && (it->m_samplingDevice.sequence == sequence)) {
280  return it->m_index;
281  }
282  }
283 
284  return -1;
285 }
DevicesEnumeration m_mimoEnumeration

◆ getNbMIMOSamplingDevices()

int DeviceEnumerator::getNbMIMOSamplingDevices ( ) const
inline

Definition at line 50 of file deviceenumerator.h.

Referenced by DeviceUserArgsDialog::DeviceUserArgsDialog().

50 { return m_mimoEnumeration.size(); }
DevicesEnumeration m_mimoEnumeration
+ Here is the caller graph for this function:

◆ getNbRxSamplingDevices()

int DeviceEnumerator::getNbRxSamplingDevices ( ) const
inline

◆ getNbTxSamplingDevices()

int DeviceEnumerator::getNbTxSamplingDevices ( ) const
inline

◆ getRxPluginInterface()

PluginInterface* DeviceEnumerator::getRxPluginInterface ( int  deviceIndex)
inline

Definition at line 54 of file deviceenumerator.h.

54 { return m_rxEnumeration[deviceIndex].m_pluginInterface; }
DevicesEnumeration m_rxEnumeration

◆ getRxSamplingDevice()

const PluginInterface::SamplingDevice* DeviceEnumerator::getRxSamplingDevice ( int  deviceIndex) const
inline

◆ getRxSamplingDeviceIndex()

int DeviceEnumerator::getRxSamplingDeviceIndex ( const QString &  deviceId,
int  sequence 
)

Definition at line 251 of file deviceenumerator.cpp.

References m_rxEnumeration.

Referenced by MainWindow::MainWindow().

252 {
253  for (DevicesEnumeration::iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it)
254  {
255  if ((it->m_samplingDevice.id == deviceId) && (it->m_samplingDevice.sequence == sequence)) {
256  return it->m_index;
257  }
258  }
259 
260  return -1;
261 }
DevicesEnumeration m_rxEnumeration
+ Here is the caller graph for this function:

◆ getTestMIMODeviceIndex()

int DeviceEnumerator::getTestMIMODeviceIndex ( ) const

Get MIMO default device.

Definition at line 239 of file deviceenumerator.cpp.

References PluginManager::getTestMIMODeviceId(), and m_mimoEnumeration.

Referenced by MainWindow::addMIMODevice().

240 {
241  for (DevicesEnumeration::const_iterator it = m_mimoEnumeration.begin(); it != m_mimoEnumeration.end(); ++it)
242  {
243  if (it->m_samplingDevice.id == PluginManager::getTestMIMODeviceId()) {
244  return it->m_index;
245  }
246  }
247 
248  return -1;
249 }
static const QString & getTestMIMODeviceId()
Definition: pluginmanager.h:85
DevicesEnumeration m_mimoEnumeration
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTxPluginInterface()

PluginInterface* DeviceEnumerator::getTxPluginInterface ( int  deviceIndex)
inline

Definition at line 55 of file deviceenumerator.h.

55 { return m_txEnumeration[deviceIndex].m_pluginInterface; }
DevicesEnumeration m_txEnumeration

◆ getTxSamplingDevice()

const PluginInterface::SamplingDevice* DeviceEnumerator::getTxSamplingDevice ( int  deviceIndex) const
inline

◆ getTxSamplingDeviceIndex()

int DeviceEnumerator::getTxSamplingDeviceIndex ( const QString &  deviceId,
int  sequence 
)

Definition at line 263 of file deviceenumerator.cpp.

References m_txEnumeration.

264 {
265  for (DevicesEnumeration::iterator it = m_txEnumeration.begin(); it != m_txEnumeration.end(); ++it)
266  {
267  if ((it->m_samplingDevice.id == deviceId) && (it->m_samplingDevice.sequence == sequence)) {
268  return it->m_index;
269  }
270  }
271 
272  return -1;
273 }
DevicesEnumeration m_txEnumeration

◆ instance()

DeviceEnumerator * DeviceEnumerator::instance ( )
static

◆ listMIMODeviceNames()

void DeviceEnumerator::listMIMODeviceNames ( QList< QString > &  list,
std::vector< int > &  indexes 
) const

Definition at line 134 of file deviceenumerator.cpp.

References PluginInterface::SamplingDevice::BuiltInDevice, and m_mimoEnumeration.

Referenced by SamplingDeviceDialog::SamplingDeviceDialog().

135 {
136  for (DevicesEnumeration::const_iterator it = m_mimoEnumeration.begin(); it != m_mimoEnumeration.end(); ++it)
137  {
138  if ((it->m_samplingDevice.claimed < 0) || (it->m_samplingDevice.type == PluginInterface::SamplingDevice::BuiltInDevice))
139  {
140  list.append(it->m_samplingDevice.displayedName);
141  indexes.push_back(it->m_index);
142  }
143  }
144 }
DevicesEnumeration m_mimoEnumeration
+ Here is the caller graph for this function:

◆ listRxDeviceNames()

void DeviceEnumerator::listRxDeviceNames ( QList< QString > &  list,
std::vector< int > &  indexes 
) const

Definition at line 110 of file deviceenumerator.cpp.

References PluginInterface::SamplingDevice::BuiltInDevice, and m_rxEnumeration.

Referenced by SamplingDeviceDialog::SamplingDeviceDialog().

111 {
112  for (DevicesEnumeration::const_iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it)
113  {
114  if ((it->m_samplingDevice.claimed < 0) || (it->m_samplingDevice.type == PluginInterface::SamplingDevice::BuiltInDevice))
115  {
116  list.append(it->m_samplingDevice.displayedName);
117  indexes.push_back(it->m_index);
118  }
119  }
120 }
DevicesEnumeration m_rxEnumeration
+ Here is the caller graph for this function:

◆ listTxDeviceNames()

void DeviceEnumerator::listTxDeviceNames ( QList< QString > &  list,
std::vector< int > &  indexes 
) const

Definition at line 122 of file deviceenumerator.cpp.

References PluginInterface::SamplingDevice::BuiltInDevice, and m_txEnumeration.

Referenced by SamplingDeviceDialog::SamplingDeviceDialog().

123 {
124  for (DevicesEnumeration::const_iterator it = m_txEnumeration.begin(); it != m_txEnumeration.end(); ++it)
125  {
126  if ((it->m_samplingDevice.claimed < 0) || (it->m_samplingDevice.type == PluginInterface::SamplingDevice::BuiltInDevice))
127  {
128  list.append(it->m_samplingDevice.displayedName);
129  indexes.push_back(it->m_index);
130  }
131  }
132 }
DevicesEnumeration m_txEnumeration
+ Here is the caller graph for this function:

◆ removeMIMOSelection()

void DeviceEnumerator::removeMIMOSelection ( int  tabIndex)

Definition at line 205 of file deviceenumerator.cpp.

References m_mimoEnumeration.

206 {
207  for (DevicesEnumeration::iterator it = m_mimoEnumeration.begin(); it != m_mimoEnumeration.end(); ++it)
208  {
209  if (it->m_samplingDevice.claimed == tabIndex) {
210  it->m_samplingDevice.claimed = -1;
211  }
212  }
213 }
DevicesEnumeration m_mimoEnumeration

◆ removeRxSelection()

void DeviceEnumerator::removeRxSelection ( int  tabIndex)

Definition at line 185 of file deviceenumerator.cpp.

References m_rxEnumeration.

Referenced by SamplingDeviceControl::removeSelectedDeviceIndex().

186 {
187  for (DevicesEnumeration::iterator it = m_rxEnumeration.begin(); it != m_rxEnumeration.end(); ++it)
188  {
189  if (it->m_samplingDevice.claimed == tabIndex) {
190  it->m_samplingDevice.claimed = -1;
191  }
192  }
193 }
DevicesEnumeration m_rxEnumeration
+ Here is the caller graph for this function:

◆ removeTxSelection()

void DeviceEnumerator::removeTxSelection ( int  tabIndex)

Definition at line 195 of file deviceenumerator.cpp.

References m_txEnumeration.

Referenced by SamplingDeviceControl::removeSelectedDeviceIndex().

196 {
197  for (DevicesEnumeration::iterator it = m_txEnumeration.begin(); it != m_txEnumeration.end(); ++it)
198  {
199  if (it->m_samplingDevice.claimed == tabIndex) {
200  it->m_samplingDevice.claimed = -1;
201  }
202  }
203 }
DevicesEnumeration m_txEnumeration
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_mimoEnumeration

DevicesEnumeration DeviceEnumerator::m_mimoEnumeration
private

◆ m_rxEnumeration

DevicesEnumeration DeviceEnumerator::m_rxEnumeration
private

◆ m_txEnumeration

DevicesEnumeration DeviceEnumerator::m_txEnumeration
private

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