Retrieve the normalized proximity from a SENSOR_PROXIMITY_READING event.


#include <bps/sensor.h>
BPS_API float sensor_event_get_proximity_normalized(bps_event_t *event)


BlackBerry 10.0.0



The SENSOR_PROXIMITY_READING event to get the normalized proximity from.


libbps (For the qcc command, use the -l bps option to link against this library)


The sensor_event_get_proximity_normalized() function gets the proximity from the specified SENSOR_PROXIMITY_READING event and normalizes it to a value between 0.0f and 1.0f. Where 0.0f is close and 1.0f is far. The normalized proximity is a unitless value.

Note that while the proximity from an event is normalized to a value in the range of 0.0f to 1.0f, it is common that the full range of values is not seen. This is because it is difficult for many proximity sensors to register values at the top end of their range, and the normalized value is calculated against the full range of the sensor. For this reason, it is important to consider the relative change in proximity, rather than the absolute proximity values.


The proximity as a unitless measurement between 0.0f (close) and 1.0f (far) when the function completes successfully, NaN with the errno value set otherwise.

Last modified: 2014-05-14

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus