hal/HalSensor.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set sw=2 ts=8 et ft=cpp : */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef __HAL_SENSOR_H_
michael@0 8 #define __HAL_SENSOR_H_
michael@0 9
michael@0 10 #include "mozilla/Observer.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace hal {
michael@0 14
michael@0 15 /**
michael@0 16 * Enumeration of sensor types. They are used to specify type while
michael@0 17 * register or unregister an observer for a sensor of given type.
michael@0 18 */
michael@0 19 enum SensorType {
michael@0 20 SENSOR_UNKNOWN = -1,
michael@0 21 SENSOR_ORIENTATION,
michael@0 22 SENSOR_ACCELERATION,
michael@0 23 SENSOR_PROXIMITY,
michael@0 24 SENSOR_LINEAR_ACCELERATION,
michael@0 25 SENSOR_GYROSCOPE,
michael@0 26 SENSOR_LIGHT,
michael@0 27 NUM_SENSOR_TYPE
michael@0 28 };
michael@0 29
michael@0 30 class SensorData;
michael@0 31
michael@0 32 typedef Observer<SensorData> ISensorObserver;
michael@0 33
michael@0 34 /**
michael@0 35 * Enumeration of sensor accuracy types.
michael@0 36 */
michael@0 37 enum SensorAccuracyType {
michael@0 38 SENSOR_ACCURACY_UNKNOWN = -1,
michael@0 39 SENSOR_ACCURACY_UNRELIABLE,
michael@0 40 SENSOR_ACCURACY_LOW,
michael@0 41 SENSOR_ACCURACY_MED,
michael@0 42 SENSOR_ACCURACY_HIGH,
michael@0 43 NUM_SENSOR_ACCURACY_TYPE
michael@0 44 };
michael@0 45
michael@0 46 class SensorAccuracy;
michael@0 47
michael@0 48 typedef Observer<SensorAccuracy> ISensorAccuracyObserver;
michael@0 49
michael@0 50 }
michael@0 51 }
michael@0 52
michael@0 53 #include "ipc/IPCMessageUtils.h"
michael@0 54
michael@0 55 namespace IPC {
michael@0 56 /**
michael@0 57 * Serializer for SensorType
michael@0 58 */
michael@0 59 template <>
michael@0 60 struct ParamTraits<mozilla::hal::SensorType>:
michael@0 61 public ContiguousEnumSerializer<
michael@0 62 mozilla::hal::SensorType,
michael@0 63 mozilla::hal::SENSOR_UNKNOWN,
michael@0 64 mozilla::hal::NUM_SENSOR_TYPE> {
michael@0 65 };
michael@0 66
michael@0 67 template <>
michael@0 68 struct ParamTraits<mozilla::hal::SensorAccuracyType>:
michael@0 69 public ContiguousEnumSerializer<
michael@0 70 mozilla::hal::SensorAccuracyType,
michael@0 71 mozilla::hal::SENSOR_ACCURACY_UNKNOWN,
michael@0 72 mozilla::hal::NUM_SENSOR_ACCURACY_TYPE> {
michael@0 73
michael@0 74 };
michael@0 75 } // namespace IPC
michael@0 76
michael@0 77 #endif /* __HAL_SENSOR_H_ */

mercurial