Bug 1371405 - Update vendored WebDriver crate; r=jgraham
[gecko.git] / hal / HalSensor.h
blob551c4271d53953c28afaefc1d7c7fc963c003724
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et ft=cpp : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __HAL_SENSOR_H_
8 #define __HAL_SENSOR_H_
10 #include "mozilla/Observer.h"
12 namespace mozilla {
13 namespace hal {
15 /**
16 * Enumeration of sensor types. They are used to specify type while
17 * register or unregister an observer for a sensor of given type.
18 * If you add or change any here, do the same in GeckoHalDefines.java.
20 enum SensorType {
21 SENSOR_UNKNOWN = -1,
22 SENSOR_ORIENTATION = 0,
23 SENSOR_ACCELERATION = 1,
24 SENSOR_PROXIMITY = 2,
25 SENSOR_LINEAR_ACCELERATION = 3,
26 SENSOR_GYROSCOPE = 4,
27 SENSOR_LIGHT = 5,
28 SENSOR_ROTATION_VECTOR = 6,
29 SENSOR_GAME_ROTATION_VECTOR = 7,
30 NUM_SENSOR_TYPE
33 class SensorData;
35 typedef Observer<SensorData> ISensorObserver;
37 /**
38 * Enumeration of sensor accuracy types.
40 enum SensorAccuracyType {
41 SENSOR_ACCURACY_UNKNOWN = -1,
42 SENSOR_ACCURACY_UNRELIABLE,
43 SENSOR_ACCURACY_LOW,
44 SENSOR_ACCURACY_MED,
45 SENSOR_ACCURACY_HIGH,
46 NUM_SENSOR_ACCURACY_TYPE
49 class SensorAccuracy;
51 typedef Observer<SensorAccuracy> ISensorAccuracyObserver;
53 } // namespace hal
54 } // namespace mozilla
56 #include "ipc/IPCMessageUtils.h"
58 namespace IPC {
59 /**
60 * Serializer for SensorType
62 template <>
63 struct ParamTraits<mozilla::hal::SensorType>:
64 public ContiguousEnumSerializer<
65 mozilla::hal::SensorType,
66 mozilla::hal::SENSOR_UNKNOWN,
67 mozilla::hal::NUM_SENSOR_TYPE> {
70 template <>
71 struct ParamTraits<mozilla::hal::SensorAccuracyType>:
72 public ContiguousEnumSerializer<
73 mozilla::hal::SensorAccuracyType,
74 mozilla::hal::SENSOR_ACCURACY_UNKNOWN,
75 mozilla::hal::NUM_SENSOR_ACCURACY_TYPE> {
78 } // namespace IPC
80 #endif /* __HAL_SENSOR_H_ */