context.jl

AdalmPluto.libIIO_jl.C_iio_context_cloneMethod
C_iio_context_clone(context)

Duplicate a pre-existing IIO context.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure

Returns

  • On success, A pointer to an iio_context structure
  • On failure, throws an error if the assertions are enabled, or NULL otherwise.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_find_deviceMethod
C_iio_context_find_device(context, name)

Try to find a device structure by its name of ID.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure
  • name::String : A NULL-terminated string corresponding to the name or the ID of the device to search for

Returns

  • On success, a pointer to an iio_device structure
  • If the name or ID does not correspond to any known device, an error is thrown if the assertions are enabled, or NULL otherwise.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_get_attrMethod
C_iio_context_get_attr(context, index)

Retrieve the name and value of a context-specific attribute.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure
  • index::UInt32 : The index corresponding to the attribute

Returns

  • On success, (0, name::String, value::String) is returned.
  • On error, (errno, "", "") is returned, where errno is a negative code.

Introduced in version 0.9.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_get_attr_valueMethod
C_iio_context_get_attr_value(context, name)

Retrieve the value of a context-specific attribute.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure
  • name::String : The name of the context attribute to read

Returns

  • On success, a NULL-terminated string.
  • If the name does not correspond to any attribute and the assertions are enabled, throws an error.
  • If the name does not correspond to any attribute and the assertions are disabled, returns an empty string.

Introduced in version 0.9.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_get_deviceMethod
C_iio_context_get_device(context, index)

Get the device present at the given index.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure
  • index::UInt32 : The index corresponding to the device

Returns

  • On success, a pointer to an iio_device structure
  • If the index is invalid and the assertions are enabled, an error is thrown.
  • If the index is invalid and the assertions are disabled, NULL is returned.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_get_nameMethod
C_iio_context_get_name(context)

Get the name of the given context.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure

Returns

  • A NULL-terminated string

NOTE

The returned string will be local, xml or network when the context has been created with the local, xml and network backends respectively.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_get_versionMethod
C_iio_context_get_version(context)

Get the version of the backend in use.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure

Returns

  • ret::Int : 0 if no errors, negative error code otherwise
  • major::Int : The major version
  • minor::Int : The minor version
  • git_tag::String : The git tag

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_context_set_timeoutMethod
C_iio_context_set_timeout(context, timeout_ms)

Set a timeout for I/O operations.

Parameters

  • context::Ptr{iio_context} : A pointer to an iio_context structure
  • timeout_ms::UInt32 : 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.

Returns

  • On success, 0 is returned
  • On error, a negative errno code is returned

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_create_context_from_uriMethod
C_iio_create_context_from_uri(uri)

Create a context from a URI description.

Parameters

  • uri::String : A URI describing the context location

Returns

  • On success, a pointer to a iio_context structure
  • On failure, if the assertions are enabled, an error is thrown.
  • On failure, if the assertions are disabled, NULL is returned.

NOTE

The following URIs are supported based on compile time backend support:

  • Local backend, "local:": Does not have an address part. For example "local:"

  • XML backend, "xml:" Requires a path to the XML file for the address part. For example "xml:/home/user/file.xml"

  • Network backend, "ip:" Requires a hostname, IPv4, or IPv6 to connect to a specific running IIO Daemon or no address part for automatic discovery when library is compiled with ZeroConf support. For example "ip:192.168.2.1", or "ip:localhost", or "ip:" or "ip:plutosdr.local"

  • USB backend, "usb:" When more than one usb device is attached, requires bus, address, and interface parts separated with a dot. For example "usb:3.32.5". Where there is only one USB device attached, the shorthand "usb:" can be used.

  • Serial backend, "serial:" requires :

    • a port (/dev/ttyUSB0),
    • baud_rate (default 115200)
    • serial port configuration
      • data bits (5 6 7 8 9)
      • parity ('n' none, 'o' odd, 'e' even, 'm' mark, 's' space)
      • stop bits (1 2)
      • flow control ('' none, 'x' Xon Xoff, 'r' RTSCTS, 'd' DTRDSR)
    • For example "serial:/dev/ttyUSB0,115200" or "serial:/dev/ttyUSB0,115200,8n1"

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_create_default_contextMethod
C_iio_create_default_context()

Create a context from local or remote IIO devices.

Returns

  • On success, A pointer to an iio_context structure
  • On failure, if the assertions are enabled, an error is thrown
  • On failure, if the assertions are disabled, NULL is returned

NOTE

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.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_create_network_contextMethod
C_iio_create_network_context(host)

Create a context from the network.

Parameters

  • host::String : Hostname, IPv4 or IPv6 address where the IIO Daemon is running

Returns

  • On success, A pointer to an iio_context structure
  • On failure, if the assertions are enabled, an error is thrown.
  • On failure, if the assertions are disabled, NULL is returned.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_create_xml_contextMethod
C_iio_create_xml_context(xml_file)

Create a context from a XML file.

Parameters

  • xml_file::String : Path to the XML file to open

Returns

  • On success, A pointer to an iio_context structure
  • On failure, if the assertions are enabled, an error is thrown.
  • On failure, if the assertions are disabled, NULL is returned.

NOTE

The format of the XML must comply to the one returned by iio_context_get_xml.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_create_xml_context_memMethod
C_iio_create_xml_context_mem(xml, length)

Create a context from XML data in memory.

Parameters

  • xml::String : Pointer to the XML data in memory
  • length::UInt : Length of the XML string in memory (excluding the final )

Returns

  • On success, A pointer to an iio_context structure
  • On failure, if the assertions are enabled, an error is thrown.
  • On failure, if the assertions are disabled, NULL is returned.

NOTE

The format of the XML must comply to the one returned by iio_context_get_xml

libIIO documentation

source