Loading...
Searching...
No Matches
context.hpp
/*
* Copyright (c) 2019 Analog Devices Inc.
*
* This file is part of libm2k
* (see http://www.github.com/analogdevicesinc/libm2k).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CONTEXT_HPP
#define CONTEXT_HPP
#include <libm2k/m2kglobal.hpp>
#include <libm2k/utils/enums.hpp>
#include <libm2k/utils/utils.hpp>
#include <libm2k/enums.hpp>
#include <string>
#include <vector>
#include <memory>
extern "C" {
struct iio_context;
}
namespace libm2k {
namespace analog {
class DMM;
}
namespace context {
class M2k;
class Generic;
class LIBM2K_API Context {
public:
virtual ~Context() {}
virtual void reset() = 0;
virtual void deinitialize() = 0;
virtual std::string getUri() = 0;
virtual libm2k::analog::DMM* getDMM(unsigned int index) = 0;
virtual libm2k::analog::DMM* getDMM(std::string name) = 0;
virtual std::vector<libm2k::analog::DMM*> getAllDmm() = 0;
virtual std::vector<std::string> getAvailableContextAttributes() = 0;
virtual std::string getContextAttributeValue(std::string attr) = 0;
virtual std::string getContextDescription() = 0;
virtual std::string getSerialNumber() = 0;
virtual std::unordered_set<std::string> getAllDevices() const = 0;
virtual void logAllAttributes() const = 0;
virtual M2k* toM2k() = 0;
virtual Generic* toGeneric() = 0;
virtual unsigned int getDmmCount() = 0;
virtual std::string getFirmwareVersion() = 0;
virtual const struct libm2k::IIO_CONTEXT_VERSION getIioContextVersion() = 0;
virtual struct iio_context *getIioContext() = 0;
virtual void setTimeout(unsigned int timeout) = 0;
};
}
}
#endif // CONTEXT_HPP
libm2k::analog::DMM
Controls the digital multimeter.
Definition dmm.hpp:45
libm2k::context::Context
Controls the IIO context.
Definition context.hpp:52
libm2k::context::M2k
Controls the ADALM2000.
Definition m2k.hpp:55
enums.hpp
Generic M2K enumerations.
libm2k::context::Context::getDMM
virtual libm2k::analog::DMM * getDMM(unsigned int index)=0
Retrieve the DMM object at a certain index.
libm2k::context::Context::getAllDevices
virtual std::unordered_set< std::string > getAllDevices() const =0
Retrieve all the available devices.
libm2k::context::Context::getFirmwareVersion
virtual std::string getFirmwareVersion()=0
Retrieve the firmware version of the current context.
libm2k::context::Context::getContextDescription
virtual std::string getContextDescription()=0
Retrieve a detailed context description.
libm2k::context::Context::getIioContext
virtual struct iio_context * getIioContext()=0
libm2k::context::Context::getAvailableContextAttributes
virtual std::vector< std::string > getAvailableContextAttributes()=0
Retrieve all the available context attributes.
libm2k::context::Context::getUri
virtual std::string getUri()=0
Get the URI of the current context.
libm2k::context::Context::setTimeout
virtual void setTimeout(unsigned int timeout)=0
Set a timeout for I/O operations.
libm2k::context::Context::logAllAttributes
virtual void logAllAttributes() const =0
Log all the attributes.
libm2k::context::Context::toGeneric
virtual Generic * toGeneric()=0
Convert the current context to Generic context, if possible.
libm2k::context::Context::toM2k
virtual M2k * toM2k()=0
Convert the current context to M2k context, if possible.
libm2k::context::Context::getDmmCount
virtual unsigned int getDmmCount()=0
Retrieve the number of DMM objects.
libm2k::context::Context::getDMM
virtual libm2k::analog::DMM * getDMM(std::string name)=0
Retrieve the DMM object which has the provided name.
libm2k::context::Context::getSerialNumber
virtual std::string getSerialNumber()=0
Retrieve the current context serial number.
libm2k::context::Context::getIioContextVersion
virtual const struct libm2k::IIO_CONTEXT_VERSION getIioContextVersion()=0
libm2k::context::Context::getAllDmm
virtual std::vector< libm2k::analog::DMM * > getAllDmm()=0
Retrieve all the DMM objects.
libm2k::context::Context::getContextAttributeValue
virtual std::string getContextAttributeValue(std::string attr)=0
Retrieve the value of one context attribute.
libm2k::IIO_CONTEXT_VERSION
The version of the backend.
Definition enums.hpp:261