sensor_open()

Updated: May 06, 2022

Request a handle to access a logical sensor unit

Synopsis:

#include <sensor/sensor_api.h>
sensor_error_t sensor_open(sensor_unit_t unit,
                           sensor_access_mode_t mode,
                           sensor_handle_t *handle)

Arguments:

unit
The logical sensor unit to open, represented as a sensor_unit_t value.
mode
The desired access mode. See sensor_access_mode_t for details.
handle
A pointer to memory for storing a sensor handle if access is granted.

Library:

libsensor

Description:

If the given sensor unit is available, this function provides a handle for accessing it.

Note:

There is a limit on the number of handles that can be opened on a given logical sensor unit. If this limit is exceeded, this function fails and returns SENSOR_EAGAIN.

Returns:

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