libiio 1.0
Library for interfacing with IIO devices
Loading...
Searching...
No Matches
Functions to read IIO events
Collaboration diagram for Functions to read IIO events:

Data Structures

struct  iio_event
 Represents a IIO event. More...
 

Functions

__api __check_ret const struct iio_channeliio_event_get_channel (const struct iio_event *event, const struct iio_device *dev, bool diff)
 Get a pointer to the IIO channel that corresponds to this event.
 
__api __check_ret struct iio_event_stream * iio_device_create_event_stream (const struct iio_device *dev)
 Create an events stream for the given IIO device.
 
__api void iio_event_stream_destroy (struct iio_event_stream *stream)
 Destroy the given event stream.
 
__api int iio_event_stream_read (struct iio_event_stream *stream, struct iio_event *out_event, bool nonblock)
 Read an event from the event stream.
 

Detailed Description

Function Documentation

◆ iio_device_create_event_stream()

__api __check_ret struct iio_event_stream * iio_device_create_event_stream ( const struct iio_device dev)

Create an events stream for the given IIO device.

Parameters
devA pointer to an iio_device structure
Returns
On success, a pointer to an iio_event_stream structure
On failure, a pointer-encoded error is returned

◆ iio_event_get_channel()

__api __check_ret const struct iio_channel * iio_event_get_channel ( const struct iio_event event,
const struct iio_device dev,
bool  diff 
)

Get a pointer to the IIO channel that corresponds to this event.

Parameters
eventA pointer to an iio_event structure
devA pointer to the iio_device structure that delivered the event
diffIf set, retrieve the differential channel
Returns
On success, a pointer to an iio_channel structure
On error, NULL is returned
Here is the call graph for this function:

◆ iio_event_stream_destroy()

__api void iio_event_stream_destroy ( struct iio_event_stream *  stream)

Destroy the given event stream.

Parameters
streamA pointer to an iio_event_stream structure

◆ iio_event_stream_read()

__api int iio_event_stream_read ( struct iio_event_stream *  stream,
struct iio_event out_event,
bool  nonblock 
)

Read an event from the event stream.

Parameters
streamA pointer to an iio_event_stream structure
out_eventAn pointer to an iio_event structure, that will be filled by this function.
nonblockif True, the operation won't block and return -EBUSY if there is currently no event in the queue.
Returns
On success, 0 is returned
On error, a negative errno code is returned.

NOTE: it is possible to stop a blocking call of iio_event_stream_read by calling iio_event_stream_destroy in a different thread or signal handler. In that case, iio_event_stream_read will return -EINTR.