Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_ACCELEROMETER_ACCELEROMETER_TYPES_H_ | 5 #ifndef UI_ACCELEROMETER_ACCELEROMETER_TYPES_H_ |
| 6 #define UI_ACCELEROMETER_ACCELEROMETER_TYPES_H_ | 6 #define UI_ACCELEROMETER_ACCELEROMETER_TYPES_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/accelerometer/ui_accelerometer_export.h" | 9 #include "ui/accelerometer/ui_accelerometer_export.h" |
| 10 #include "ui/gfx/geometry/vector3d_f.h" | 10 #include "ui/gfx/geometry/vector3d_f.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 return data_[source].reading; | 58 return data_[source].reading; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void Set(AccelerometerSource source, float x, float y, float z) { | 61 void Set(AccelerometerSource source, float x, float y, float z) { |
| 62 data_[source].present = true; | 62 data_[source].present = true; |
| 63 data_[source].reading.set_x(x); | 63 data_[source].reading.set_x(x); |
| 64 data_[source].reading.set_y(y); | 64 data_[source].reading.set_y(y); |
| 65 data_[source].reading.set_z(z); | 65 data_[source].reading.set_z(z); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // A reading is considered stable if its deviation from gravity is small. This | |
| 69 // returns false if the deviation is too higher, or if |source| is not present | |
| 70 // in the update. | |
| 71 bool IsReadingStable(AccelerometerSource source) const; | |
|
flackr
2014/12/12 20:46:06
I don't think this should be a part of the Acceler
jonross
2015/01/06 19:56:10
Moved to chromeos/accelerometer/accelerometer_read
| |
| 72 | |
| 68 protected: | 73 protected: |
| 69 AccelerometerReading data_[ACCELEROMETER_SOURCE_COUNT]; | 74 AccelerometerReading data_[ACCELEROMETER_SOURCE_COUNT]; |
| 70 | 75 |
| 71 DISALLOW_COPY_AND_ASSIGN(AccelerometerUpdate); | 76 DISALLOW_COPY_AND_ASSIGN(AccelerometerUpdate); |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } // namespace ui | 79 } // namespace ui |
| 75 | 80 |
| 76 #endif // UI_ACCELEROMETER_ACCELEROMETER_TYPES_H_ | 81 #endif // UI_ACCELEROMETER_ACCELEROMETER_TYPES_H_ |
| OLD | NEW |