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_ROTATION_VECTOR_SENSOR_H
18f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#define ANDROID_ROTATION_VECTOR_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 "SensorDevice.h"
26f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include "SensorInterface.h"
27f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
28984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#include "Fusion.h"
29984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian#include "SensorFusion.h"
30984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian
31f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// ---------------------------------------------------------------------------
32f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopiannamespace android {
33f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// ---------------------------------------------------------------------------
34f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
35f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianclass RotationVectorSensor : public SensorInterface {
36f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian    SensorDevice& mSensorDevice;
37984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    SensorFusion& mSensorFusion;
38f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
39f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianpublic:
40984826cc158193e61e3a00359ef4f6699c7d748aMathias Agopian    RotationVectorSensor();
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
493301542828febc768e1df42892cfac4992c35474Mathias Agopianclass GyroDriftSensor : public SensorInterface {
503301542828febc768e1df42892cfac4992c35474Mathias Agopian    SensorDevice& mSensorDevice;
513301542828febc768e1df42892cfac4992c35474Mathias Agopian    SensorFusion& mSensorFusion;
523301542828febc768e1df42892cfac4992c35474Mathias Agopian
533301542828febc768e1df42892cfac4992c35474Mathias Agopianpublic:
543301542828febc768e1df42892cfac4992c35474Mathias Agopian    GyroDriftSensor();
553301542828febc768e1df42892cfac4992c35474Mathias Agopian    virtual bool process(sensors_event_t* outEvent,
563301542828febc768e1df42892cfac4992c35474Mathias Agopian            const sensors_event_t& event);
573301542828febc768e1df42892cfac4992c35474Mathias Agopian    virtual status_t activate(void* ident, bool enabled);
583301542828febc768e1df42892cfac4992c35474Mathias Agopian    virtual status_t setDelay(void* ident, int handle, int64_t ns);
593301542828febc768e1df42892cfac4992c35474Mathias Agopian    virtual Sensor getSensor() const;
603301542828febc768e1df42892cfac4992c35474Mathias Agopian    virtual bool isVirtual() const { return true; }
613301542828febc768e1df42892cfac4992c35474Mathias Agopian};
623301542828febc768e1df42892cfac4992c35474Mathias Agopian
63f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// ---------------------------------------------------------------------------
64f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian}; // namespace android
65f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian
66f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#endif // ANDROID_ROTATION_VECTOR_SENSOR_H
67