sensor_get_supported_sensors()

Retrieve an enumerated list of sensors available on the device

Synopsis:

#include <sensor/sensor_api.h>
sensor_error_t sensor_get_supported_sensors(uint32_t num_asked,
                                            uint32_t type_mask,
                                            uint32_t *num_supported,
                                            supported_sensor_info_t *sensor_info)

Arguments:

num_asked
The maximum number of sensors to return in the array.
type_mask
The type of sensors of interest for this query. This can be any OR'ed combination of sensor_type_t.
num_supported
On success, this is set to the number of supported sensors of the specified type that are present.
sensor_info
A pointer to the first element in a supported_sensor_info_t array. The array is updated with the information on the sensors of the specified type that are present.

Library:

libsensor

Description:

An array of information on each supported sensor is returned on success in sensor_info.

Ensure that the sensor_info argument points to an array which has at least num_asked elements allocated. To determine an appropriate size for this array, you can invoke this function in presizing mode by setting the num_asked argument to zero or the sensor_info argument to NULL. When the function is invoked in this presizing mode, the maximum array size required is returned in the num_supported argument. You can then allocate an array of the appropriate size and invoke the function again with the num_asked argument set to the value returned previously in the num_supported argument.

Returns:

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