OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/device_orientation/accelerometer_mac.h" | 5 #include "content/browser/device_orientation/accelerometer_mac.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/device_orientation/orientation.h" | 10 #include "content/browser/device_orientation/orientation.h" |
11 #include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h" | 11 #include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h" |
12 | 12 |
13 namespace device_orientation { | 13 namespace device_orientation { |
14 | 14 |
15 // Create a AccelerometerMac object and return NULL if no valid sensor found. | 15 // Create a AccelerometerMac object and return NULL if no valid sensor found. |
16 DataFetcher* AccelerometerMac::Create() { | 16 DataFetcher* AccelerometerMac::Create() { |
17 scoped_ptr<AccelerometerMac> accelerometer(new AccelerometerMac); | 17 scoped_ptr<AccelerometerMac> accelerometer(new AccelerometerMac); |
18 return accelerometer->Init() ? accelerometer.release() : NULL; | 18 return accelerometer->Init() ? accelerometer.release() : NULL; |
19 } | 19 } |
20 | 20 |
21 AccelerometerMac::~AccelerometerMac() { | 21 AccelerometerMac::~AccelerometerMac() { |
22 } | 22 } |
23 | 23 |
24 AccelerometerMac::AccelerometerMac() { | 24 AccelerometerMac::AccelerometerMac() { |
25 } | 25 } |
26 | 26 |
| 27 bool AccelerometerMac::GetMotion(Motion* motion) { |
| 28 // TODO(aousterh): implement this |
| 29 return false; |
| 30 } |
| 31 |
27 // Retrieve per-axis orientation values. | 32 // Retrieve per-axis orientation values. |
28 // | 33 // |
29 // Axes and angles are defined according to the W3C DeviceOrientation Draft. | 34 // Axes and angles are defined according to the W3C DeviceOrientation Draft. |
30 // See here: http://dev.w3.org/geo/api/spec-source-orientation.html | 35 // See here: http://dev.w3.org/geo/api/spec-source-orientation.html |
31 // | 36 // |
32 // Note: only beta and gamma angles are provided. Alpha is set to zero. | 37 // Note: only beta and gamma angles are provided. Alpha is set to zero. |
33 // | 38 // |
34 // Returns false in case of error. | 39 // Returns false in case of error. |
35 // | 40 // |
36 bool AccelerometerMac::GetOrientation(Orientation* orientation) { | 41 bool AccelerometerMac::GetOrientation(Orientation* orientation) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 97 |
93 return true; | 98 return true; |
94 } | 99 } |
95 | 100 |
96 bool AccelerometerMac::Init() { | 101 bool AccelerometerMac::Init() { |
97 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); | 102 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); |
98 return sudden_motion_sensor_.get() != NULL; | 103 return sudden_motion_sensor_.get() != NULL; |
99 } | 104 } |
100 | 105 |
101 } // namespace device_orientation | 106 } // namespace device_orientation |
OLD | NEW |