summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sensors/blackberry/bbproximitysensor.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/sensors/blackberry/bbproximitysensor.cpp b/plugins/sensors/blackberry/bbproximitysensor.cpp
index 1e6e541c98..43a6b1634f 100644
--- a/plugins/sensors/blackberry/bbproximitysensor.cpp
+++ b/plugins/sensors/blackberry/bbproximitysensor.cpp
@@ -53,10 +53,11 @@ QString BbProximitySensor::devicePath()
bool BbProximitySensor::updateReadingFromEvent(const sensor_event_t &event, QProximityReading *reading)
{
- // TODO: I was unable to test this since the device I was testing this with did not have
- // a proximity sensor. Verify that this works, check that the units are correct
- // and that the threshold makes sense.
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;
}