OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_UTIL_H_ |
| 6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_UTIL_H_ |
| 7 |
| 8 #include "content/common/content_export.h" |
| 9 #include "device/generic_sensor/public/cpp/sensor_reading.h" |
| 10 #include "device/generic_sensor/public/interfaces/sensor.mojom.h" |
| 11 |
| 12 namespace blink { |
| 13 class WebDeviceOrientationData; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 |
| 18 // Angle threshold beyond which two orientation events are considered |
| 19 // sufficiently different. |
| 20 constexpr double kOrientationThreshold = 0.1; |
| 21 |
| 22 constexpr uint64_t kReadingBufferSize = |
| 23 sizeof(device::SensorReadingSharedBuffer); |
| 24 |
| 25 constexpr uint64_t kSharedBufferSizeInBytes = |
| 26 kReadingBufferSize * static_cast<uint64_t>(device::mojom::SensorType::LAST); |
| 27 |
| 28 bool IsSignificantlyDifferent(const blink::WebDeviceOrientationData& data1, |
| 29 const blink::WebDeviceOrientationData& data2); |
| 30 |
| 31 void CONTENT_EXPORT ComputeDeviceOrientationFromQuaternion(double x, |
| 32 double y, |
| 33 double z, |
| 34 double w, |
| 35 double* alpha, |
| 36 double* beta, |
| 37 double* gamma); |
| 38 |
| 39 bool CONTENT_EXPORT |
| 40 ComputeDeviceOrientationFromGravityAndGeomagnetic(double gravity_x, |
| 41 double gravity_y, |
| 42 double gravity_z, |
| 43 double geomagnetic_x, |
| 44 double geomagnetic_y, |
| 45 double geomagnetic_z, |
| 46 double* alpha, |
| 47 double* beta, |
| 48 double* gamma); |
| 49 |
| 50 } // namespace content |
| 51 |
| 52 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_UTIL_H_ |
OLD | NEW |