sensor_enable_event()

Updated: May 06, 2022

Register a sigevent to be signaled when an event occurs

Synopsis:

#include <sensor/sensor_api.h>
sensor_error_t sensor_enable_event(sensor_handle_t handle,
                                   sensor_event_t event,
                                   sensor_eventmode_t mode,
                                   sensor_eventkey_t *key,
                                   struct sigevent *sigev)

Arguments:

handle
The handle that's returned from calling sensor_open().
event
A sensor_event_t value indicating the event with sensor data to use.
mode
A sensor_eventmode_t value indicating the mode of the callback.
key
A pointer to a sensor_eventkey_t containing a unique key associated with the event.
sigev
The sigevent to be signaled when the event occurs.

Library:

libsensor

Description:

This function registers a sigevent to be signaled when the specified event occurs. The mode is ignored for status events. For more information, see the sensor_register_data_callback() note about the limit on the number of data callbacks.

Returns:

SENSOR_EOK when the function successfully completes, otherwise another sensor_error_t value that provides the reason that the call failed.