From 5ed59ab19c145afd5ff7db47ee4b0c3c11f47c7a Mon Sep 17 00:00:00 2001 From: Andrew Inwood Date: Mon, 10 Mar 2014 13:58:58 -0400 Subject: BlackBerry: Update threshold for close detection The current algorithm for close detection in QProximitySensor will not work for sensors whose output is not binary (ie, close/far). The new algorithm will use the threshold of 8cm when the output is not binary. Change-Id: I2173e9afae0a2d29434e092e1afc09d1c6f5647c Reviewed-by: Bernd Weimer Reviewed-by: Fabian Bumberger --- src/plugins/sensors/blackberry/bbproximitysensor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/sensors/blackberry/bbproximitysensor.cpp b/src/plugins/sensors/blackberry/bbproximitysensor.cpp index 1177f744..2c08df41 100644 --- a/src/plugins/sensors/blackberry/bbproximitysensor.cpp +++ b/src/plugins/sensors/blackberry/bbproximitysensor.cpp @@ -54,6 +54,10 @@ QString BbProximitySensor::devicePath() bool BbProximitySensor::updateReadingFromEvent(const sensor_event_t &event, QProximityReading *reading) { const qreal minProximity = sensor()->outputRanges().first().minimum; - reading->setClose(event.proximity_s.distance <= minProximity); + const qreal maxProximity = sensor()->outputRanges().first().maximum; + // An object within 8.0 cm of the sensor is regarded as close. This is the same threshold used + // for face-detect during phone calls on BB10. + const qreal threshold = (maxProximity > 1.0) ? 8.0 : minProximity; + reading->setClose(event.proximity_s.distance <= threshold); return true; } -- cgit v1.2.3