context.jl
AdalmPluto.libIIO_jl.C_iio_context_cloneAdalmPluto.libIIO_jl.C_iio_context_destroyAdalmPluto.libIIO_jl.C_iio_context_find_deviceAdalmPluto.libIIO_jl.C_iio_context_get_attrAdalmPluto.libIIO_jl.C_iio_context_get_attr_valueAdalmPluto.libIIO_jl.C_iio_context_get_attrs_countAdalmPluto.libIIO_jl.C_iio_context_get_descriptionAdalmPluto.libIIO_jl.C_iio_context_get_deviceAdalmPluto.libIIO_jl.C_iio_context_get_devices_countAdalmPluto.libIIO_jl.C_iio_context_get_nameAdalmPluto.libIIO_jl.C_iio_context_get_versionAdalmPluto.libIIO_jl.C_iio_context_get_xmlAdalmPluto.libIIO_jl.C_iio_context_set_timeoutAdalmPluto.libIIO_jl.C_iio_create_context_from_uriAdalmPluto.libIIO_jl.C_iio_create_default_contextAdalmPluto.libIIO_jl.C_iio_create_local_contextAdalmPluto.libIIO_jl.C_iio_create_network_contextAdalmPluto.libIIO_jl.C_iio_create_xml_contextAdalmPluto.libIIO_jl.C_iio_create_xml_context_mem
AdalmPluto.libIIO_jl.C_iio_context_clone — MethodC_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.
AdalmPluto.libIIO_jl.C_iio_context_destroy — MethodC_iio_context_destroy(context)Destroy the given context.
Parameters
context::Ptr{iio_context}: A pointer to an iio_context structure
NOTE
After that function, the iio_context pointer shall be invalid.
AdalmPluto.libIIO_jl.C_iio_context_find_device — MethodC_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 structurename::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.
AdalmPluto.libIIO_jl.C_iio_context_get_attr — MethodC_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 structureindex::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.
AdalmPluto.libIIO_jl.C_iio_context_get_attr_value — MethodC_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 structurename::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.
AdalmPluto.libIIO_jl.C_iio_context_get_attrs_count — MethodC_iio_context_get_attrs_count(context)Get the number of context-specific attributes.
Parameters
context::Ptr{iio_context}: A pointer to an iio_context structure
Returns
- The number of context-specific attributes
Introduced in version 0.9.
AdalmPluto.libIIO_jl.C_iio_context_get_description — MethodC_iio_context_get_description(context)Get a description 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 contain human-readable information about the current context.
AdalmPluto.libIIO_jl.C_iio_context_get_device — MethodC_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 structureindex::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.
AdalmPluto.libIIO_jl.C_iio_context_get_devices_count — MethodC_iio_context_get_devices_count(context)Enumerate the devices found in the given context.
Parameters
context::Ptr{iio_context}: A pointer to an iio_context structure
Returns
- The number of devices found
AdalmPluto.libIIO_jl.C_iio_context_get_name — MethodC_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.
AdalmPluto.libIIO_jl.C_iio_context_get_version — MethodC_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 otherwisemajor::Int: The major versionminor::Int: The minor versiongit_tag::String: The git tag
AdalmPluto.libIIO_jl.C_iio_context_get_xml — MethodC_iio_context_get_xml(context)Obtain a XML representation of the given context.
Parameters
context::Ptr{iio_context}: A pointer to an iio_context structure
Returns
- A NULL-terminated string
AdalmPluto.libIIO_jl.C_iio_context_set_timeout — MethodC_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 structuretimeout_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
AdalmPluto.libIIO_jl.C_iio_create_context_from_uri — MethodC_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 ('