summaryrefslogtreecommitdiff
path: root/src/plugins/sensors
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2013-03-19 10:13:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-21 00:00:46 +0100
commit81bba03023e72d7d470acaac14250c392319b389 (patch)
tree9906d84ccf81b316a538090b522f222d21934228 /src/plugins/sensors
parent35eb5a9a114b1bd48783e91b63c37bbefba98bd4 (diff)
downloadqtsensors-81bba03023e72d7d470acaac14250c392319b389.tar.gz
iOS: remove unnecessary test for accelerometer available
The accelerometer is always available, so no need to check for this. Change-Id: I79411ff023c4350c5b31d4fad048484db2b2fe43 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.mm31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/plugins/sensors/ios/iosaccelerometer.mm b/src/plugins/sensors/ios/iosaccelerometer.mm
index a01e418..a815c40 100644
--- a/src/plugins/sensors/ios/iosaccelerometer.mm
+++ b/src/plugins/sensors/ios/iosaccelerometer.mm
@@ -75,23 +75,20 @@ char const * const IOSAccelerometer::id("ios.accelerometer");
-(void)startAccelerometer
{
CMMotionManager *motionManager = [QIOSMotionManager sharedManager];
-
- if (motionManager.deviceMotionAvailable) {
- [motionManager startAccelerometerUpdatesToQueue:m_updateQueue withHandler:^(CMAccelerometerData *data, NSError *error) {
- dispatch_async(dispatch_get_main_queue(), ^{
- Q_UNUSED(error);
- CMAcceleration acc = data.acceleration;
- // Convert from G to m/s2, and flip axes:
- const qreal G = 9.8066;
- qreal x = qreal(acc.x) * G * -1;
- qreal y = qreal(acc.y) * G * -1;
- qreal z = qreal(acc.z) * G * -1;
- // Convert from NSTimeInterval to microseconds:
- quint64 timestamp = quint64(data.timestamp * 1000000);
- m_qiosAccelerometer->readingsChanged(timestamp, x, y, z);
- });
- }];
- }
+ [motionManager startAccelerometerUpdatesToQueue:m_updateQueue withHandler:^(CMAccelerometerData *data, NSError *error) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ Q_UNUSED(error);
+ CMAcceleration acc = data.acceleration;
+ // Convert from G to m/s2, and flip axes:
+ const qreal G = 9.8066;
+ qreal x = qreal(acc.x) * G * -1;
+ qreal y = qreal(acc.y) * G * -1;
+ qreal z = qreal(acc.z) * G * -1;
+ // Convert from NSTimeInterval to microseconds:
+ quint64 timestamp = quint64(data.timestamp * 1000000);
+ m_qiosAccelerometer->readingsChanged(timestamp, x, y, z);
+ });
+ }];
}
-(void)stopAccelerometer