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.
deviceenumerator.h
Go to the documentation of this file.
1 // Copyright (C) 2016 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef SDRBASE_DEVICE_DEVICEENUMERATOR_H_
19 #define SDRBASE_DEVICE_DEVICEENUMERATOR_H_
20 
21 #include <vector>
22 
23 #include "plugin/plugininterface.h"
24 #include "export.h"
25 
26 class PluginManager;
27 
29 {
30 public:
33 
34  static DeviceEnumerator *instance();
35 
36  void enumerateRxDevices(PluginManager *pluginManager);
37  void enumerateTxDevices(PluginManager *pluginManager);
38  void enumerateMIMODevices(PluginManager *pluginManager);
39  void listRxDeviceNames(QList<QString>& list, std::vector<int>& indexes) const;
40  void listTxDeviceNames(QList<QString>& list, std::vector<int>& indexes) const;
41  void listMIMODeviceNames(QList<QString>& list, std::vector<int>& indexes) const;
42  void changeRxSelection(int tabIndex, int deviceIndex);
43  void changeTxSelection(int tabIndex, int deviceIndex);
44  void changeMIMOSelection(int tabIndex, int deviceIndex);
45  void removeRxSelection(int tabIndex);
46  void removeTxSelection(int tabIndex);
47  void removeMIMOSelection(int tabIndex);
48  int getNbRxSamplingDevices() const { return m_rxEnumeration.size(); }
49  int getNbTxSamplingDevices() const { return m_txEnumeration.size(); }
50  int getNbMIMOSamplingDevices() const { return m_mimoEnumeration.size(); }
51  const PluginInterface::SamplingDevice* getRxSamplingDevice(int deviceIndex) const { return &m_rxEnumeration[deviceIndex].m_samplingDevice; }
52  const PluginInterface::SamplingDevice* getTxSamplingDevice(int deviceIndex) const { return &m_txEnumeration[deviceIndex].m_samplingDevice; }
53  const PluginInterface::SamplingDevice* getMIMOSamplingDevice(int deviceIndex) const { return &m_mimoEnumeration[deviceIndex].m_samplingDevice; }
54  PluginInterface *getRxPluginInterface(int deviceIndex) { return m_rxEnumeration[deviceIndex].m_pluginInterface; }
55  PluginInterface *getTxPluginInterface(int deviceIndex) { return m_txEnumeration[deviceIndex].m_pluginInterface; }
56  PluginInterface *getMIMOPluginInterface(int deviceIndex) { return m_mimoEnumeration[deviceIndex].m_pluginInterface; }
57  int getFileInputDeviceIndex() const;
58  int getFileSinkDeviceIndex() const;
59  int getTestMIMODeviceIndex() const;
60  int getRxSamplingDeviceIndex(const QString& deviceId, int sequence);
61  int getTxSamplingDeviceIndex(const QString& deviceId, int sequence);
62  int getMIMOSamplingDeviceIndex(const QString& deviceId, int sequence);
63 
64 private:
66  {
69  int m_index;
70 
71  DeviceEnumeration(const PluginInterface::SamplingDevice& samplingDevice, PluginInterface *pluginInterface, int index) :
72  m_samplingDevice(samplingDevice),
73  m_pluginInterface(pluginInterface),
74  m_index(index)
75  {}
76  };
77 
78  typedef std::vector<DeviceEnumeration> DevicesEnumeration;
79 
80  DevicesEnumeration m_rxEnumeration;
81  DevicesEnumeration m_txEnumeration;
82  DevicesEnumeration m_mimoEnumeration;
83 };
84 
85 #endif /* SDRBASE_DEVICE_DEVICEENUMERATOR_H_ */
PluginInterface * getTxPluginInterface(int deviceIndex)
PluginInterface * getRxPluginInterface(int deviceIndex)
const PluginInterface::SamplingDevice * getMIMOSamplingDevice(int deviceIndex) const
DevicesEnumeration m_rxEnumeration
std::vector< DeviceEnumeration > DevicesEnumeration
DeviceEnumeration(const PluginInterface::SamplingDevice &samplingDevice, PluginInterface *pluginInterface, int index)
int getNbRxSamplingDevices() const
PluginInterface * getMIMOPluginInterface(int deviceIndex)
DevicesEnumeration m_txEnumeration
const PluginInterface::SamplingDevice * getTxSamplingDevice(int deviceIndex) const
PluginInterface::SamplingDevice m_samplingDevice
const PluginInterface::SamplingDevice * getRxSamplingDevice(int deviceIndex) const
int getNbMIMOSamplingDevices() const
#define SDRBASE_API
Definition: export.h:40
DevicesEnumeration m_mimoEnumeration
int getNbTxSamplingDevices() const