1f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian/*
2f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * Copyright (C) 2010 The Android Open Source Project
3f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian *
4f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * you may not use this file except in compliance with the License.
6f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * You may obtain a copy of the License at
7f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian *
8f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian *
10f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * Unless required by applicable law or agreed to in writing, software
11f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * See the License for the specific language governing permissions and
14f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian * limitations under the License.
15f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian */
16f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
17f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#ifndef ANDROID_GRAVITY_SENSOR_H
18f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#define ANDROID_GRAVITY_SENSOR_H
19f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
20f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include <stdint.h>
21f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include <sys/types.h>
22f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
23f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include <gui/Sensor.h>
24f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
25f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include "SensorInterface.h"
26f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
27f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// ---------------------------------------------------------------------------
28f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopiannamespace android {
29f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// ---------------------------------------------------------------------------
30f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
31984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopianclass SensorDevice;
32984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopianclass SensorFusion;
33984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
34f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianclass GravitySensor : public SensorInterface {
35f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    SensorDevice& mSensorDevice;
36984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    SensorFusion& mSensorFusion;
37f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    Sensor mAccelerometer;
38f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
39f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianpublic:
40f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    GravitySensor(sensor_t const* list, size_t count);
41f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    virtual bool process(sensors_event_t* outEvent,
42f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian            const sensors_event_t& event);
43f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    virtual status_t activate(void* ident, bool enabled);
44f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    virtual status_t setDelay(void* ident, int handle, int64_t ns);
45f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    virtual Sensor getSensor() const;
46f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    virtual bool isVirtual() const { return true; }
47f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian};
48f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
49f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// ---------------------------------------------------------------------------
50f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian}; // namespace android
51f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
52f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#endif // ANDROID_GRAVITY_SENSOR_H
53