michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set sw=2 ts=8 et ft=cpp : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __HAL_SENSOR_H_ michael@0: #define __HAL_SENSOR_H_ michael@0: michael@0: #include "mozilla/Observer.h" michael@0: michael@0: namespace mozilla { michael@0: namespace hal { michael@0: michael@0: /** michael@0: * Enumeration of sensor types. They are used to specify type while michael@0: * register or unregister an observer for a sensor of given type. michael@0: */ michael@0: enum SensorType { michael@0: SENSOR_UNKNOWN = -1, michael@0: SENSOR_ORIENTATION, michael@0: SENSOR_ACCELERATION, michael@0: SENSOR_PROXIMITY, michael@0: SENSOR_LINEAR_ACCELERATION, michael@0: SENSOR_GYROSCOPE, michael@0: SENSOR_LIGHT, michael@0: NUM_SENSOR_TYPE michael@0: }; michael@0: michael@0: class SensorData; michael@0: michael@0: typedef Observer ISensorObserver; michael@0: michael@0: /** michael@0: * Enumeration of sensor accuracy types. michael@0: */ michael@0: enum SensorAccuracyType { michael@0: SENSOR_ACCURACY_UNKNOWN = -1, michael@0: SENSOR_ACCURACY_UNRELIABLE, michael@0: SENSOR_ACCURACY_LOW, michael@0: SENSOR_ACCURACY_MED, michael@0: SENSOR_ACCURACY_HIGH, michael@0: NUM_SENSOR_ACCURACY_TYPE michael@0: }; michael@0: michael@0: class SensorAccuracy; michael@0: michael@0: typedef Observer ISensorAccuracyObserver; michael@0: michael@0: } michael@0: } michael@0: michael@0: #include "ipc/IPCMessageUtils.h" michael@0: michael@0: namespace IPC { michael@0: /** michael@0: * Serializer for SensorType michael@0: */ michael@0: template <> michael@0: struct ParamTraits: michael@0: public ContiguousEnumSerializer< michael@0: mozilla::hal::SensorType, michael@0: mozilla::hal::SENSOR_UNKNOWN, michael@0: mozilla::hal::NUM_SENSOR_TYPE> { michael@0: }; michael@0: michael@0: template <> michael@0: struct ParamTraits: michael@0: public ContiguousEnumSerializer< michael@0: mozilla::hal::SensorAccuracyType, michael@0: mozilla::hal::SENSOR_ACCURACY_UNKNOWN, michael@0: mozilla::hal::NUM_SENSOR_ACCURACY_TYPE> { michael@0: michael@0: }; michael@0: } // namespace IPC michael@0: michael@0: #endif /* __HAL_SENSOR_H_ */