libm2k
Loading...
Searching...
No Matches
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
33extern "C" {
34 struct iio_context;
35}
36
37namespace libm2k {
38namespace analog {
39 class DMM;
40}
41
42namespace context {
43class M2k;
44class Generic;
45
52class LIBM2K_API Context {
53public:
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 IIO context.
Definition context.hpp:52
Controls the ADALM2000.
Definition m2k.hpp:55
Generic M2K enumerations.
virtual libm2k::analog::DMM * getDMM(unsigned int index)=0
Retrieve the DMM object at a certain index.
virtual std::unordered_set< std::string > getAllDevices() const =0
Retrieve all the available devices.
virtual std::string getFirmwareVersion()=0
Retrieve the firmware version of the current context.
virtual std::string getContextDescription()=0
Retrieve a detailed context description.
virtual struct iio_context * getIioContext()=0
virtual std::vector< std::string > getAvailableContextAttributes()=0
Retrieve all the available context attributes.
virtual std::string getUri()=0
Get the URI of the current context.
virtual void setTimeout(unsigned int timeout)=0
Set a timeout for I/O operations.
virtual void logAllAttributes() const =0
Log all the attributes.
virtual Generic * toGeneric()=0
Convert the current context to Generic context, if possible.
virtual M2k * toM2k()=0
Convert the current context to M2k context, if possible.
virtual unsigned int getDmmCount()=0
Retrieve the number of DMM objects.
virtual libm2k::analog::DMM * getDMM(std::string name)=0
Retrieve the DMM object which has the provided name.
virtual std::string getSerialNumber()=0
Retrieve the current context serial number.
virtual std::vector< libm2k::analog::DMM * > getAllDmm()=0
Retrieve all the DMM objects.
virtual std::string getContextAttributeValue(std::string attr)=0
Retrieve the value of one context attribute.
The version of the backend.
Definition enums.hpp:261