Updated: October 26, 2022

Retrieve an enumerated list of sensors available on the device


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


The maximum number of sensors to return in the array.
The type of sensors being queried. This can be any OR'ed combination of sensor_type_t.
On success, the memory pointed to by this argument contains the number of supported sensors of the specified type that are present.
A pointer to the first element in a supported_sensor_info_t array. On success, this array is updated with information about all sensors of the specified type that are present.




This function writes an array of information about supported sensors of a given type.

The sensor_info argument must point to an array which has at least num_asked elements allocated. To find the required size for this array, you can invoke this function with num_asked set to zero or sensor_info set to NULL. The required array size is then written into the memory pointed to by num_supported. You can then allocate an array of this size and invoke this function again with num_asked set to the value previously written into num_supported and sensor_info pointing to the allocated array.


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