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 M2k;
44 class Generic;
45 
52 class LIBM2K_API Context {
53 public:
57  virtual ~Context() {}
58 
59 
63  virtual void reset() = 0;
64 
65 
69  virtual void deinitialize() = 0;
70 
71 
76  virtual std::string getUri() = 0;
77 
78 
85  virtual libm2k::analog::DMM* getDMM(unsigned int index) = 0;
86 
87 
94  virtual libm2k::analog::DMM* getDMM(std::string name) = 0;
95 
96 
101  virtual std::vector<libm2k::analog::DMM*> getAllDmm() = 0;
102 
103 
108  virtual std::vector<std::string> getAvailableContextAttributes() = 0;
109 
110 
117  virtual std::string getContextAttributeValue(std::string attr) = 0;
118 
119 
124  virtual std::string getContextDescription() = 0;
125 
126 
131  virtual std::string getSerialNumber() = 0;
132 
133 
138  virtual std::unordered_set<std::string> getAllDevices() const = 0;
139 
140 
145  virtual void logAllAttributes() const = 0;
146 
147 
153  virtual M2k* toM2k() = 0;
154 
155 
161  virtual Generic* toGeneric() = 0;
162 
163 
168  virtual unsigned int getDmmCount() = 0;
169 
170 
175  virtual std::string getFirmwareVersion() = 0;
176 
177 
182  virtual const struct libm2k::IIO_CONTEXT_VERSION getIioContextVersion() = 0;
183 
184 
189  virtual struct iio_context *getIioContext() = 0;
190 
191 
196  virtual void setTimeout(unsigned int timeout) = 0;
197 
198 };
199 }
200 }
201 
202 #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:261
Controls the IIO context.
Definition: context.hpp:52
Generic M2K enumerations.