My Project
Loading...
Searching...
No Matches
Functions to read IIO events

Classes

struct  iio_event
 Represents a IIO event. More...

Functions

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.
struct iio_event_stream * iio_device_create_event_stream (const struct iio_device *dev)
 Create an events stream for the given IIO device.
void iio_event_stream_destroy (struct iio_event_stream *stream)
 Destroy the given event stream.
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()

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()

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

◆ iio_event_stream_destroy()

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()

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.