diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-03-18 15:23:29 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-10 22:10:52 +0200 |
commit | df5c6bf98d067edf59d7394cdf35f11a82f15844 (patch) | |
tree | 544b9c14b1dbc6d2dc67c26ed4c7a43403656183 /src/plugins/sensors | |
parent | 6d05123edf6718f6d1149104df8be111d53d68f2 (diff) | |
download | qtsensors-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.mm | 4 |
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]; } |