summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensors/blackberry/bborientationsensor.cpp
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2013-01-09 13:57:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-23 18:33:03 +0100
commit1831170d56f32530e64bbd5484a6c2cc9e1817ca (patch)
tree3499dfc2e46b97d72b17a6cfc1087add660e6e8a /src/plugins/sensors/blackberry/bborientationsensor.cpp
parent02285d735e7d3bd8ddfb61b7ea5e16da4ad522d1 (diff)
Add API for duplicate skipping
Duplicate skipping enables omitting reading values that are very similar to the previous one, thus saving processing power. Implement this for the Blackberry backend. Change-Id: Ic608d8ca795b5a2e0bca5a75a62e8005c283c620 Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/plugins/sensors/blackberry/bborientationsensor.cpp')
-rw-r--r--src/plugins/sensors/blackberry/bborientationsensor.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/plugins/sensors/blackberry/bborientationsensor.cpp b/src/plugins/sensors/blackberry/bborientationsensor.cpp
index 68ed735b..3d9d120c 100644
--- a/src/plugins/sensors/blackberry/bborientationsensor.cpp
+++ b/src/plugins/sensors/blackberry/bborientationsensor.cpp
@@ -44,6 +44,9 @@ BbOrientationSensor::BbOrientationSensor(QSensor *sensor)
: BbSensorBackend<QOrientationReading>(devicePath(), SENSOR_TYPE_ORIENTATION, sensor)
{
setDescription(QLatin1String("Device orientation"));
+
+ // Orientation rarely changes, so enable skipping of duplicates by default
+ sensor->setSkipDuplicates(true);
}
QString BbOrientationSensor::devicePath()
@@ -51,19 +54,6 @@ QString BbOrientationSensor::devicePath()
return QLatin1String("/dev/sensor/orientation");
}
-void BbOrientationSensor::start()
-{
- BbSensorBackend<QOrientationReading>::start();
-
- // Orientation rarely changes, so enable skiping of duplicates
- sensor_devctl_skipdupevent_u deviceSkip;
- deviceSkip.tx.enable = 1;
- const int result = devctl(deviceFile().handle(), DCMD_SENSOR_SKIPDUPEVENT, &deviceSkip,
- sizeof(deviceSkip), NULL);
- if (result != EOK)
- perror("Enabling duplicate skipping for orientation sensor failed");
-}
-
void BbOrientationSensor::additionalDeviceInit()
{
// When querying the OS service for the range, it gives us the angles, which we don't need.