1984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian/*
2984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * Copyright (C) 2011 The Android Open Source Project
3984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian *
4984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * you may not use this file except in compliance with the License.
6984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * You may obtain a copy of the License at
7984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian *
8984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian *
10984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * Unless required by applicable law or agreed to in writing, software
11984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * See the License for the specific language governing permissions and
14984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian * limitations under the License.
15984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian */
16984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
17984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#ifndef ANDROID_ORIENTATION_SENSOR_H
18984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#define ANDROID_ORIENTATION_SENSOR_H
19984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
20984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#include <stdint.h>
21984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#include <sys/types.h>
22984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
23984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#include <gui/Sensor.h>
24984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
25984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#include "SensorInterface.h"
26984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
27984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian// ---------------------------------------------------------------------------
28984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopiannamespace android {
29984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian// ---------------------------------------------------------------------------
30984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
31984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopianclass SensorDevice;
32984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopianclass SensorFusion;
33984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
34984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopianclass OrientationSensor : public SensorInterface {
35984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    SensorDevice& mSensorDevice;
36984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    SensorFusion& mSensorFusion;
37984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
38984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopianpublic:
39984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    OrientationSensor();
40984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    virtual bool process(sensors_event_t* outEvent,
41984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian            const sensors_event_t& event);
42984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    virtual status_t activate(void* ident, bool enabled);
43984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    virtual status_t setDelay(void* ident, int handle, int64_t ns);
44984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    virtual Sensor getSensor() const;
45984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    virtual bool isVirtual() const { return true; }
46984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian};
47984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
48984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian// ---------------------------------------------------------------------------
49984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian}; // namespace android
50984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
51984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#endif // ANDROID_ORIENTATION_SENSOR_H
52