libiio
Classes | Functions
Functions for scanning available contexts

Classes

struct  iio_scan
 Structure holding scanning information. More...
 

Functions

__api __check_ret struct iio_scaniio_scan (const struct iio_context_params *params, const char *backends)
 Scan backends for IIO contexts. More...
 
__api void iio_scan_destroy (struct iio_scan *ctx)
 Destroy the given scan context. More...
 
__api __check_ret __pure size_t iio_scan_get_results_count (const struct iio_scan *ctx)
 Get number of results of a scan operation. More...
 
__api __check_ret __pure const char * iio_scan_get_description (const struct iio_scan *ctx, size_t idx)
 Get description of scanned context. More...
 
__api __check_ret __pure const char * iio_scan_get_uri (const struct iio_scan *ctx, size_t idx)
 Get URI of scanned context. More...
 

Detailed Description

Function Documentation

◆ iio_scan()

__api __check_ret struct iio_scan* iio_scan ( const struct iio_context_params params,
const char *  backends 
)

Scan backends for IIO contexts.

Parameters
paramsA pointer to a iio_context_params structure that contains context creation information; can be NULL
backendsa NULL-terminated string containing a comma-separated list of the backends to be scanned for contexts. If NULL, all the available backends are scanned.
Returns
On success, a pointer to an iio_scan structure
On failure, a pointer-encoded error is returned

NOTE: It is possible to provide backend-specific information. For instance, "local,usb=0456:*" will scan the local backend and limit scans on USB to vendor ID 0x0456, and accept all product IDs. The "usb=0456:b673" string would limit the scan to the device with this particular VID/PID. Both IDs are expected in hexadecimal, no 0x prefix needed.

◆ iio_scan_destroy()

__api void iio_scan_destroy ( struct iio_scan ctx)

Destroy the given scan context.

Parameters
ctxA pointer to an iio_scan structure

NOTE: After that function, the iio_scan pointer shall be invalid.

◆ iio_scan_get_description()

__api __check_ret __pure const char* iio_scan_get_description ( const struct iio_scan ctx,
size_t  idx 
)

Get description of scanned context.

Parameters
ctxA pointer to an iio_scan structure
idxThe index of the scanned context
Returns
On success, a pointer to a NULL-terminated string
If the index is invalid, NULL is returned

◆ iio_scan_get_results_count()

__api __check_ret __pure size_t iio_scan_get_results_count ( const struct iio_scan ctx)

Get number of results of a scan operation.

Parameters
ctxA pointer to an iio_scan structure
Returns
The number of results of the scan operation

◆ iio_scan_get_uri()

__api __check_ret __pure const char* iio_scan_get_uri ( const struct iio_scan ctx,
size_t  idx 
)

Get URI of scanned context.

Parameters
ctxA pointer to an iio_scan structure
idxThe index of the scanned context
Returns
On success, a pointer to a NULL-terminated string
If the index is invalid, NULL is returned