Loading...
Searching...
No Matches
Context

Contains the representation of a generic IIO context. More...

Collaboration diagram for Context:

## Topics

| ContextBuilder
| Creates/destroys the context.

## Classes

class | libm2k::context::Context
| Controls the IIO context. More...

## Functions

virtual std::string | libm2k::context::Context::getUri ()=0
| Get the URI of the current context.
virtual libm2k::analog::DMM * | libm2k::context::Context::getDMM (unsigned int index)=0
| Retrieve the DMM object at a certain index.
virtual libm2k::analog::DMM * | libm2k::context::Context::getDMM (std::string name)=0
| Retrieve the DMM object which has the provided name.
virtual std::vector< libm2k::analog::DMM * > | libm2k::context::Context::getAllDmm ()=0
| Retrieve all the DMM objects.
virtual std::vector< std::string > | libm2k::context::Context::getAvailableContextAttributes ()=0
| Retrieve all the available context attributes.
virtual std::string | libm2k::context::Context::getContextAttributeValue (std::string attr)=0
| Retrieve the value of one context attribute.
virtual std::string | libm2k::context::Context::getContextDescription ()=0
| Retrieve a detailed context description.
virtual std::string | libm2k::context::Context::getSerialNumber ()=0
| Retrieve the current context serial number.
virtual std::unordered_set< std::string > | libm2k::context::Context::getAllDevices () const =0
| Retrieve all the available devices.
virtual void | libm2k::context::Context::logAllAttributes () const =0
| Log all the attributes.
virtual M2k * | libm2k::context::Context::toM2k ()=0
| Convert the current context to M2k context, if possible.
virtual Generic * | libm2k::context::Context::toGeneric ()=0
| Convert the current context to Generic context, if possible.
virtual unsigned int | libm2k::context::Context::getDmmCount ()=0
| Retrieve the number of DMM objects.
virtual std::string | libm2k::context::Context::getFirmwareVersion ()=0
| Retrieve the firmware version of the current context.
virtual const struct libm2k::IIO_CONTEXT_VERSION | libm2k::context::Context::getIioContextVersion ()=0
virtual struct iio_context * | libm2k::context::Context::getIioContext ()=0
virtual void | libm2k::context::Context::setTimeout (unsigned int timeout)=0
| Set a timeout for I/O operations.

## Detailed Description

Contains the representation of a generic IIO context.

## Function Documentation

## getAllDevices()

virtual std::unordered_set< std::string > libm2k::context::Context::getAllDevices | ( |  | ) | const

pure virtual

Retrieve all the available devices.

Returns
  a list of strings containing all the devices

## getAllDmm()

virtual std::vector< libm2k::analog::DMM * > libm2k::context::Context::getAllDmm | ( |  | ) |

pure virtual

Retrieve all the DMM objects.

Returns
  A list of DMM objects

## getAvailableContextAttributes()

virtual std::vector< std::string > libm2k::context::Context::getAvailableContextAttributes | ( |  | ) |

pure virtual

Retrieve all the available context attributes.

Returns
  A list of strings containing all the context attributes

## getContextAttributeValue()

virtual std::string libm2k::context::Context::getContextAttributeValue | ( | std::string | attr | ) |

pure virtual

Retrieve the value of one context attribute.

Parameters

  attr | The name of the required attribute

Returns
  On success, return a string containing the value of the attribute

Exceptions

  On | error, throw an exception if the attribute is not found

## getContextDescription()

virtual std::string libm2k::context::Context::getContextDescription | ( |  | ) |

pure virtual

Retrieve a detailed context description.

Returns
  string containing the current context description

## getDMM() [1/2]

virtual libm2k::analog::DMM * libm2k::context::Context::getDMM | ( | std::string | name | ) |

pure virtual

Retrieve the DMM object which has the provided name.

Parameters

  name | The name corresponding to the DMM

Returns
  On success, a pointer to a DMM object
  On error, nullptr is returned

## getDMM() [2/2]

virtual libm2k::analog::DMM * libm2k::context::Context::getDMM | ( | unsigned int | index | ) |

pure virtual

Retrieve the DMM object at a certain index.

Parameters

  index | The index corresponding to the DMM

Returns
  On success, a pointer to a DMM object
  On error, nullptr is returned

## getDmmCount()

virtual unsigned int libm2k::context::Context::getDmmCount | ( |  | ) |

pure virtual

Retrieve the number of DMM objects.

Returns
  an unsigned int representing the number of DMM objects in the context

## getFirmwareVersion()

virtual std::string libm2k::context::Context::getFirmwareVersion | ( |  | ) |

pure virtual

Retrieve the firmware version of the current context.

Returns
  a string containing the firmware version

## getIioContext()

virtual struct iio_context * libm2k::context::Context::getIioContext | ( |  | ) |

pure virtual

Retrieve the iio context

Returns
  A pointer to the iio context

## getIioContextVersion()

virtual const struct libm2k::IIO_CONTEXT_VERSION libm2k::context::Context::getIioContextVersion | ( |  | ) |

pure virtual

Get the version of the backend in use

Returns
  IIO_CONTEXT_VERSION struct

## getSerialNumber()

virtual std::string libm2k::context::Context::getSerialNumber | ( |  | ) |

pure virtual

Retrieve the current context serial number.

Returns
  string containing the current context serial number

## getUri()

virtual std::string libm2k::context::Context::getUri | ( |  | ) |

pure virtual

Get the URI of the current context.

Returns
  string containing the context URI (ex: "usb:1.2.3", "ip:192.168.2.1")

## logAllAttributes()

virtual void libm2k::context::Context::logAllAttributes | ( |  | ) | const

pure virtual

Log all the attributes.

Note
  The logging system should be enabled

## setTimeout()

virtual void libm2k::context::Context::setTimeout | ( | unsigned int | timeout | ) |

pure virtual

Set a timeout for I/O operations.

Parameters

  timeout | A positive integer representing the time in milliseconds after which a timeout occurs. A value of 0 is used to specify that no timeout should occur.

## toGeneric()

virtual Generic * libm2k::context::Context::toGeneric | ( |  | ) |

pure virtual

Convert the current context to Generic context, if possible.

Returns
  On success, return the corresponding Generic object
  On error, return a nullptr

## toM2k()

virtual M2k * libm2k::context::Context::toM2k | ( |  | ) |

pure virtual

Convert the current context to M2k context, if possible.

Returns
  On success, return the corresponding M2k object
  On error, return a nullptr