libiio
Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
iio.Context Class Reference

iio.Context class: Contains the representation of an IIO context. More...

Inheritance diagram for iio.Context:
Inheritance graph
[legend]
Collaboration diagram for iio.Context:
Collaboration graph
[legend]

Public Member Functions

 Context (string uri=null)
 Initializes a new instance of the iio.Context class, using the provided URI. More...
 
Context clone ()
 Clone this instance. More...
 
Device get_device (string name)
 Get the iio.Device object of the specified name. More...
 
void set_timeout (uint timeout)
 Set a timeout for I/O operations. More...
 
def __init__ (self, _context=None)
 
def __del__ (self)
 
def set_timeout (self, timeout)
 
def find_device (self, name_or_id_or_label)
 
- Public Member Functions inherited from iio._IIO_Object
def __init__ (self, hdl, parent)
 
def __eq__ (self, other)
 
- Public Member Functions inherited from iio.IIOObject
void Dispose ()
 Releases all resource used by the iio.IIOObject object. More...
 

Public Attributes

readonly string xml
 A XML representation of the current context. More...
 
readonly string name
 The name of the current context. More...
 
readonly string description
 Retrieve a human-readable information string about the current context. More...
 
readonly Version library_version
 Retrieve a information about the version context. More...
 
readonly List< Devicedevices
 A List of all the IIO devices present on the current context. More...
 

Protected Member Functions

override void Destroy ()
 
- Protected Member Functions inherited from iio.IIOObject
 IIOObject (IntPtr hdl)
 

Properties

Dictionary< string, string > attrs [get]
 A Dictionary of all the attributes of the current channel. (key, value) = (name, value) More...
 
 name
 
 description
 
 xml
 
 version
 
 attrs
 
 devices
 

Detailed Description

iio.Context class: Contains the representation of an IIO context.

Contains the representation of an IIO context.

Constructor & Destructor Documentation

◆ Context()

iio.Context.Context ( string  uri = null)
inline

Initializes a new instance of the iio.Context class, using the provided URI.

For compatibility with existing code, providing an IP address or a hostname here will automatically create a network context.

Parameters
uriURI to use for the IIO context creation
Returns
an instance of the iio.Context class
Exceptions
IioLib.IIOExceptionThe IIO context could not be created.

◆ __init__()

def iio.Context.__init__ (   self,
  _context = None 
)
Initialize a new instance of the Context class, using the local or the network backend of the IIO library.

returns: type=iio.Context
    An new instance of this class

This function will create a network context if the IIOD_REMOTE
environment variable is set to the hostname where the IIOD server runs.
If set to an empty string, the server will be discovered using ZeroConf.
If the environment variable is not set, a local context will be created instead.

◆ __del__()

def iio.Context.__del__ (   self)
Destroy this context.

Member Function Documentation

◆ clone()

Context iio.Context.clone ( )
inline

Clone this instance.

◆ find_device()

def iio.Context.find_device (   self,
  name_or_id_or_label 
)
Find a IIO device by its name, ID or label.

:param name_or_id_or_label: type=str
    The name, ID or label of the device to find

returns: type=iio.Device or type=iio.Trigger
    The IIO Device

◆ get_device()

Device iio.Context.get_device ( string  name)
inline

Get the iio.Device object of the specified name.

Parameters
nameName or ID of the device to look for
Exceptions
IioLib.IIOExceptionThe IIO device with the specified name or ID could not be found in the current context.

◆ set_timeout() [1/2]

void iio.Context.set_timeout ( uint  timeout)
inline

Set a timeout for I/O operations.

Parameters
timeoutThe timeout value, in milliseconds
Exceptions
IioLib.IIOExceptionThe timeout could not be applied.

◆ set_timeout() [2/2]

def iio.Context.set_timeout (   self,
  timeout 
)
Set a timeout for I/O operations.

:param timeout: type=int
    The timeout value, in milliseconds

Member Data Documentation

◆ description

readonly string iio.Context.description

Retrieve a human-readable information string about the current context.

◆ devices

readonly List<Device> iio.Context.devices

A List of all the IIO devices present on the current context.

◆ library_version

readonly Version iio.Context.library_version

Retrieve a information about the version context.

◆ name

readonly string iio.Context.name

The name of the current context.

◆ xml

readonly string iio.Context.xml

A XML representation of the current context.

Property Documentation

◆ attrs [1/2]

Dictionary<string, string> iio.Context.attrs
get

A Dictionary of all the attributes of the current channel. (key, value) = (name, value)

◆ attrs [2/2]

iio.Context.attrs
static
Initial value:
= property(
lambda self: self._attrs,
None,
None,
"List of context-specific attributes\n\ttype=dict of str objects",
)

◆ description

iio.Context.description
static
Initial value:
= property(
lambda self: self._description,
None,
None,
"Description of this IIO context.\n\ttype=str",
)

◆ devices

iio.Context.devices
static
Initial value:
= property(
lambda self: [
Trigger(self, dev) if _d_is_trigger(dev) else Device(self, dev)
for dev in [
_get_device(self._context, x)
for x in range(0, _devices_count(self._context))
]
],
None,
None,
"List of devices contained in this context.\n\ttype=list of iio.Device and iio.Trigger objects",
)

◆ name

iio.Context.name
static
Initial value:
= property(
lambda self: self._name, None, None, "Name of this IIO context.\n\ttype=str"
)

◆ version

iio.Context.version
static
Initial value:
= property(
lambda self: self._version,
None,
None,
"Version of the backend.\n\ttype=(int, int, str)",
)

◆ xml

iio.Context.xml
static
Initial value:
= property(
lambda self: self._xml,
None,
None,
"XML representation of the current context.\n\ttype=str",
)

The documentation for this class was generated from the following files: