summaryrefslogtreecommitdiff
path: root/src/plugins/sensors
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2013-03-18 15:23:29 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-10 22:10:52 +0200
commitdf5c6bf98d067edf59d7394cdf35f11a82f15844 (patch)
tree544b9c14b1dbc6d2dc67c26ed4c7a43403656183 /src/plugins/sensors
parent6d05123edf6718f6d1149104df8be111d53d68f2 (diff)
downloadqtsensors-df5c6bf98d067edf59d7394cdf35f11a82f15844.tar.gz
iOS: set data rate on accelerometer before starting it
Respect user data rate settings by applying the rate just before the sensor starts Change-Id: I3da37497c574cbf94d57699c941ce2bf3b54373c Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src/plugins/sensors')
-rw-r--r--src/plugins/sensors/ios/iosaccelerometer.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/sensors/ios/iosaccelerometer.mm b/src/plugins/sensors/ios/iosaccelerometer.mm
index 47349c5..a01e418 100644
--- a/src/plugins/sensors/ios/iosaccelerometer.mm
+++ b/src/plugins/sensors/ios/iosaccelerometer.mm
@@ -124,6 +124,10 @@ IOSAccelerometer::~IOSAccelerometer()
void IOSAccelerometer::start()
{
+ // Convert from Hz to NSTimeInterval:
+ int hz = sensor()->dataRate();
+ NSTimeInterval interval = (hz == 0) ? 0 : 1. / hz;
+ [m_listener setInterval:interval];
[m_listener startAccelerometer];
}