Loading...
Searching...
No Matches
ContextBuilder
Context

Creates/destroys the context. More...

Collaboration diagram for ContextBuilder:

## Functions

LIBM2K_API M2k * | libm2k::context::m2kOpen (const char *uri)
| Open an ADALM2000 based on a given uri.
LIBM2K_API M2k * | libm2k::context::m2kOpen (struct iio_context *ctx, const char *uri)
| Open an ADALM2000 based on an existing iio_context and uri.
LIBM2K_API M2k * | libm2k::context::m2kOpen ()
| Open an ADALM2000.
LIBM2K_API std::vector< struct libm2k::CONTEXT_INFO * > | libm2k::context::getContextsInfo ()
| List the information about all available contexts.
LIBM2K_API std::vector< std::string > | libm2k::context::getAllContexts ()
| List all available contexts.
LIBM2K_API void | libm2k::context::contextClose (Context *ctx, bool deinit=true)
| Destroy the given context.
LIBM2K_API void | libm2k::context::contextCloseAll ()
| Close all the devices.
LIBM2K_API std::string | libm2k::context::getVersion ()
| Get library version.
LIBM2K_API void | libm2k::context::enableLogging (bool enable)
| Enable/disable the logging system.

## Detailed Description

Creates/destroys the context.

## Function Documentation

## contextClose()

LIBM2K_API void libm2k::context::contextClose | ( | Context * | ctx,
|  | bool | deinit = true )

Destroy the given context.

Parameters

  ctx | The context to be destroyed
  deinit | If deinit is set to false, running contexts won't be affected

## enableLogging()

LIBM2K_API void libm2k::context::enableLogging | ( | bool | enable | ) |

Enable/disable the logging system.

Parameters

  enable | If true enable, otherwise disable

## getAllContexts()

LIBM2K_API std::vector< std::string > libm2k::context::getAllContexts | ( |  | ) |

List all available contexts.

Returns
  A list containing the available contexts

## getContextsInfo()

LIBM2K_API std::vector< struct libm2k::CONTEXT_INFO * > libm2k::context::getContextsInfo | ( |  | ) |

List the information about all available contexts.

Returns
  A list containing the info about available contexts

## getVersion()

LIBM2K_API std::string libm2k::context::getVersion | ( |  | ) |

Get library version.

Returns
  a string containing the libm2k version

## m2kOpen() [1/3]

LIBM2K_API M2k * libm2k::context::m2kOpen | ( |  | ) |

Open an ADALM2000.

Returns
  M2k object or nullptr if no ADALM2000 was found/available

Note
  this will try to open USB connected devices

## m2kOpen() [2/3]

LIBM2K_API M2k * libm2k::context::m2kOpen | ( | const char * | uri | ) |

Open an ADALM2000 based on a given uri.

Parameters

  uri | Describe the location of the context

Returns
  M2k object or nullptr if no ADALM2000 was found/available

Note
  the uri can be something similar to: "ip:192.168.2.1" or "usb:1.6.5"

## m2kOpen() [3/3]

LIBM2K_API M2k * libm2k::context::m2kOpen | ( | struct iio_context * | ctx,
|  | const char * | uri )

Open an ADALM2000 based on an existing iio_context and uri.

Parameters

  ctx | A pointer to an iio_context structure
  uri | Describe the location of the context

Returns
  M2k object or nullptr if no ADALM2000 was found/available

Note
  the uri can be something similar to: "ip:192.168.2.1" or "usb:1.6.5"