libm2k
context.hpp
1 /*
2  * Copyright (c) 2019 Analog Devices Inc.
3  *
4  * This file is part of libm2k
5  * (see http://www.github.com/analogdevicesinc/libm2k).
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 2.1 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef CONTEXT_HPP
23 #define CONTEXT_HPP
24 
25 #include <libm2k/m2kglobal.hpp>
26 #include <libm2k/utils/enums.hpp>
27 #include <libm2k/utils/utils.hpp>
28 #include <libm2k/enums.hpp>
29 #include <string>
30 #include <vector>
31 #include <memory>
32 
33 extern "C" {
34  struct iio_context;
35 }
36 
37 namespace libm2k {
38 namespace analog {
39  class DMM;
40 }
41 
42 namespace context {
43 class Lidar;
44 class M2k;
45 class Generic;
46 
53 class LIBM2K_API Context {
54 public:
58  virtual ~Context() {}
59 
60 
64  virtual void reset() = 0;
65 
66 
70  virtual void deinitialize() = 0;
71 
72 
77  virtual std::string getUri() = 0;
78 
79 
86  virtual libm2k::analog::DMM* getDMM(unsigned int index) = 0;
87 
88 
95  virtual libm2k::analog::DMM* getDMM(std::string name) = 0;
96 
97 
102  virtual std::vector<libm2k::analog::DMM*> getAllDmm() = 0;
103 
104 
109  virtual std::vector<std::string> getAvailableContextAttributes() = 0;
110 
111 
118  virtual std::string getContextAttributeValue(std::string attr) = 0;
119 
120 
125  virtual std::string getContextDescription() = 0;
126 
127 
132  virtual std::string getSerialNumber() = 0;
133 
134 
139  virtual std::unordered_set<std::string> getAllDevices() const = 0;
140 
141 
146  virtual void logAllAttributes() const = 0;
147 
148 
154  virtual M2k* toM2k() = 0;
155 
156 
162  virtual Lidar* toLidar() = 0;
163 
164 
170  virtual Generic* toGeneric() = 0;
171 
172 
177  virtual unsigned int getDmmCount() = 0;
178 
179 
184  virtual std::string getFirmwareVersion() = 0;
185 
186 
191  virtual const struct libm2k::IIO_CONTEXT_VERSION getIioContextVersion() = 0;
192 
193 
198  virtual struct iio_context *getIioContext() = 0;
199 
200 
205  virtual void setTimeout(unsigned int timeout) = 0;
206 
207 };
208 }
209 }
210 
211 #endif // CONTEXT_HPP
Controls the digital multimeter.
Definition: dmm.hpp:45
Controls the ADALM2000.
Definition: m2k.hpp:54
The version of the backend.
Definition: enums.hpp:226
Controls the IIO context.
Definition: context.hpp:53
Generic M2K enumerations.