sensor_get_physical_property()

Updated: April 19, 2023

Retrieve one or more physical properties of the sensor

Synopsis:

#include <sensor/sensor_api.h>
#define sensor_get_physical_property(handle,
                                    args...)

Arguments:

handle
The handle returned by a call to sensor_open().
args
A series of property-value pairs where each value must be a pointer to a variable of the expected type.

Library:

libsensor

Description:

This function retrieves one or more physical properties of the given sensor. For the args argument, you can provide one or more property-value pairs using a sensor_physprop_t value as the name of the property and a pointer to the correct type for the value, such as a uint32_t or double value.

CAUTION:

The compiler performs no type-checking. Therefore, the value you provide for each property must match the expected data type. Mismatches can cause undefined behavior and application crashes.

You can specify multiple property-value pairs by delimiting their arguments with commas as follows:
 sensor_get_physical_property( sensor_handle,
                               SENSOR_PHYSPROP_HORIZONTALFOV, &horizFov,
                               SENSOR_PHYSPROP_VERTICALFOV, &vertFov );

Returns:

SENSOR_EOK when the function successfully completes, otherwise another sensor_error_t value that provides the reason why the call failed. This function returns SENSOR_EOPNOTSUPP if the property is not supported for the specified sensor.