libiio
0.25
Library for interfacing with IIO devices
|
Data Structures | |
struct | iio_context |
Contains the representation of an IIO context. More... | |
Functions | |
__api __check_ret struct iio_context * | iio_create_default_context (void) |
Create a context from local or remote IIO devices. More... | |
__api __check_ret struct iio_context * | iio_create_local_context (void) |
Create a context from local IIO devices (Linux only) More... | |
__api __check_ret struct iio_context * | iio_create_xml_context (const char *xml_file) |
Create a context from a XML file. More... | |
__api __check_ret struct iio_context * | iio_create_xml_context_mem (const char *xml, size_t len) |
Create a context from XML data in memory. More... | |
__api __check_ret struct iio_context * | iio_create_network_context (const char *host) |
Create a context from the network. More... | |
__api __check_ret struct iio_context * | iio_create_context_from_uri (const char *uri) |
Create a context from a URI description. More... | |
__api __check_ret struct iio_context * | iio_context_clone (const struct iio_context *ctx) |
Duplicate a pre-existing IIO context. More... | |
__api void | iio_context_destroy (struct iio_context *ctx) |
Destroy the given context. More... | |
__api __check_ret int | iio_context_get_version (const struct iio_context *ctx, unsigned int *major, unsigned int *minor, char git_tag[8]) |
Get the version of the backend in use. More... | |
__api __check_ret __pure const char * | iio_context_get_xml (const struct iio_context *ctx) |
Obtain a XML representation of the given context. More... | |
__api __check_ret __pure const char * | iio_context_get_name (const struct iio_context *ctx) |
Get the name of the given context. More... | |
__api __check_ret __pure const char * | iio_context_get_description (const struct iio_context *ctx) |
Get a description of the given context. More... | |
__api __check_ret __pure unsigned int | iio_context_get_attrs_count (const struct iio_context *ctx) |
Get the number of context-specific attributes. More... | |
__api __check_ret int | iio_context_get_attr (const struct iio_context *ctx, unsigned int index, const char **name, const char **value) |
Retrieve the name and value of a context-specific attribute. More... | |
__api __check_ret const char * | iio_context_get_attr_value (const struct iio_context *ctx, const char *name) |
Retrieve the value of a context-specific attribute. More... | |
__api __check_ret __pure unsigned int | iio_context_get_devices_count (const struct iio_context *ctx) |
Enumerate the devices found in the given context. More... | |
__api __check_ret __pure struct iio_device * | iio_context_get_device (const struct iio_context *ctx, unsigned int index) |
Get the device present at the given index. More... | |
__api __check_ret __pure struct iio_device * | iio_context_find_device (const struct iio_context *ctx, const char *name) |
Try to find a device structure by its ID, label or name. More... | |
__api __check_ret int | iio_context_set_timeout (struct iio_context *ctx, unsigned int timeout_ms) |
Set a timeout for I/O operations. More... | |
__api __check_ret struct iio_context* iio_context_clone | ( | const struct iio_context * | ctx | ) |
Duplicate a pre-existing IIO context.
ctx | A pointer to an iio_context structure |
NOTE: This function is not supported on 'usb:' contexts, since libusb can only claim the interface once. "Function not implemented" is the expected errno. Any context which is cloned, must be destroyed via calling iio_context_destroy()
__api void iio_context_destroy | ( | struct iio_context * | ctx | ) |
Destroy the given context.
ctx | A pointer to an iio_context structure |
NOTE: After that function, the iio_context pointer shall be invalid.
__api __check_ret __pure struct iio_device* iio_context_find_device | ( | const struct iio_context * | ctx, |
const char * | name | ||
) |
Try to find a device structure by its ID, label or name.
ctx | A pointer to an iio_context structure |
name | A NULL-terminated string corresponding to the ID, label or name of the device to search for |
__api __check_ret int iio_context_get_attr | ( | const struct iio_context * | ctx, |
unsigned int | index, | ||
const char ** | name, | ||
const char ** | value | ||
) |
Retrieve the name and value of a context-specific attribute.
ctx | A pointer to an iio_context structure |
index | The index corresponding to the attribute |
name | A pointer to a const char * pointer (NULL accepted) |
value | A pointer to a const char * pointer (NULL accepted) |
Introduced in version 0.9.
__api __check_ret const char* iio_context_get_attr_value | ( | const struct iio_context * | ctx, |
const char * | name | ||
) |
Retrieve the value of a context-specific attribute.
ctx | A pointer to an iio_context structure |
name | The name of the context attribute to read |
Introduced in version 0.9.
__api __check_ret __pure unsigned int iio_context_get_attrs_count | ( | const struct iio_context * | ctx | ) |
Get the number of context-specific attributes.
ctx | A pointer to an iio_context structure |
Introduced in version 0.9.
__api __check_ret __pure const char* iio_context_get_description | ( | const struct iio_context * | ctx | ) |
Get a description of the given context.
ctx | A pointer to an iio_context structure |
NOTE:The returned string will contain human-readable information about the current context.
__api __check_ret __pure struct iio_device* iio_context_get_device | ( | const struct iio_context * | ctx, |
unsigned int | index | ||
) |
Get the device present at the given index.
ctx | A pointer to an iio_context structure |
index | The index corresponding to the device |
__api __check_ret __pure unsigned int iio_context_get_devices_count | ( | const struct iio_context * | ctx | ) |
Enumerate the devices found in the given context.
ctx | A pointer to an iio_context structure |
__api __check_ret __pure const char* iio_context_get_name | ( | const struct iio_context * | ctx | ) |
Get the name of the given context.
ctx | A pointer to an iio_context structure |
NOTE:The returned string will be local, xml or network when the context has been created with the local, xml and network backends respectively.
__api __check_ret int iio_context_get_version | ( | const struct iio_context * | ctx, |
unsigned int * | major, | ||
unsigned int * | minor, | ||
char | git_tag[8] | ||
) |
Get the version of the backend in use.
ctx | A pointer to an iio_context structure |
major | A pointer to an unsigned integer (NULL accepted) |
minor | A pointer to an unsigned integer (NULL accepted) |
git_tag | A pointer to a 8-characters buffer (NULL accepted) |
__api __check_ret __pure const char* iio_context_get_xml | ( | const struct iio_context * | ctx | ) |
Obtain a XML representation of the given context.
ctx | A pointer to an iio_context structure |
__api __check_ret int iio_context_set_timeout | ( | struct iio_context * | ctx, |
unsigned int | timeout_ms | ||
) |
Set a timeout for I/O operations.
ctx | A pointer to an iio_context structure |
timeout_ms | 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. |
__api __check_ret struct iio_context* iio_create_context_from_uri | ( | const char * | uri | ) |
Create a context from a URI description.
uri | A URI describing the context location |
NOTE: The following URIs are supported based on compile time backend support:
Serial backend, "serial:"
Requires:
For example "serial:/dev/ttyUSB0,115200" or "serial:/dev/ttyUSB0,115200,8n1"
__api __check_ret struct iio_context* iio_create_default_context | ( | void | ) |
Create a context from local or remote IIO devices.
NOTE: This function will create a context with the URI provided in the IIOD_REMOTE environment variable. If not set, a local context will be created instead.
__api __check_ret struct iio_context* iio_create_local_context | ( | void | ) |
Create a context from local IIO devices (Linux only)
__api __check_ret struct iio_context* iio_create_network_context | ( | const char * | host | ) |
Create a context from the network.
host | Hostname, IPv4 or IPv6 address where the IIO Daemon is running |
__api __check_ret struct iio_context* iio_create_xml_context | ( | const char * | xml_file | ) |
Create a context from a XML file.
xml_file | Path to the XML file to open |
NOTE: The format of the XML must comply to the one returned by iio_context_get_xml.
__api __check_ret struct iio_context* iio_create_xml_context_mem | ( | const char * | xml, |
size_t | len | ||
) |
Create a context from XML data in memory.
xml | Pointer to the XML data in memory |
len | Length of the XML string in memory (excluding the final \0) |
NOTE: The format of the XML must comply to the one returned by iio_context_get_xml