sensor_get_unit()

Updated: April 19, 2023

Retrieve the sensor unit associated with a sensor handle

Synopsis:

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

Arguments:

handle
The handle that's returned from calling sensor_open().
unit
On success, this argument points to a sensor_unit_t value representing the sensor unit.

Library:

libsensor

Description:

This function retrieves the sensor unit associated with a sensor handle. For example, it can be used inside a sensor data callback function to discover which sensor unit the buffer is coming from.

Returns:

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