1b957b9d63c88efd3a961759424987b99219adeedMathias Agopian/* 2b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * Copyright (C) 2010 The Android Open Source Project 3b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * 4b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 5b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * you may not use this file except in compliance with the License. 6b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * You may obtain a copy of the License at 7b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * 8b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 9b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * 10b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * Unless required by applicable law or agreed to in writing, software 11b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 12b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * See the License for the specific language governing permissions and 14b957b9d63c88efd3a961759424987b99219adeedMathias Agopian * limitations under the License. 15b957b9d63c88efd3a961759424987b99219adeedMathias Agopian */ 16b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 17b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#ifndef ANDROID_GUI_SENSOR_MANAGER_H 18b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#define ANDROID_GUI_SENSOR_MANAGER_H 19b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 20b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <stdint.h> 21b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <sys/types.h> 22b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 23de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian#include <binder/IBinder.h> 24de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian 25b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <utils/Errors.h> 26b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <utils/RefBase.h> 27b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <utils/Singleton.h> 28b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <utils/Vector.h> 29b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 30b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#include <gui/SensorEventQueue.h> 31b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 32b957b9d63c88efd3a961759424987b99219adeedMathias Agopian// ---------------------------------------------------------------------------- 33b957b9d63c88efd3a961759424987b99219adeedMathias Agopian// Concrete types for the NDK 34b957b9d63c88efd3a961759424987b99219adeedMathias Agopianstruct ASensorManager { }; 35b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 36b957b9d63c88efd3a961759424987b99219adeedMathias Agopian// ---------------------------------------------------------------------------- 37b957b9d63c88efd3a961759424987b99219adeedMathias Agopiannamespace android { 38b957b9d63c88efd3a961759424987b99219adeedMathias Agopian// ---------------------------------------------------------------------------- 39b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 40b957b9d63c88efd3a961759424987b99219adeedMathias Agopianclass ISensorServer; 41b957b9d63c88efd3a961759424987b99219adeedMathias Agopianclass Sensor; 42b957b9d63c88efd3a961759424987b99219adeedMathias Agopianclass SensorEventQueue; 43b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 44b957b9d63c88efd3a961759424987b99219adeedMathias Agopian// ---------------------------------------------------------------------------- 45b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 46de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopianclass SensorManager : 47de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian public ASensorManager, 48de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian public Singleton<SensorManager> 49b957b9d63c88efd3a961759424987b99219adeedMathias Agopian{ 50b957b9d63c88efd3a961759424987b99219adeedMathias Agopianpublic: 51b957b9d63c88efd3a961759424987b99219adeedMathias Agopian SensorManager(); 52b957b9d63c88efd3a961759424987b99219adeedMathias Agopian ~SensorManager(); 53b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 541bf797857e025e8a71db86fb9e79765a767ec1ebMathias Agopian ssize_t getSensorList(Sensor const* const** list) const; 551bf797857e025e8a71db86fb9e79765a767ec1ebMathias Agopian Sensor const* getDefaultSensor(int type); 56b957b9d63c88efd3a961759424987b99219adeedMathias Agopian sp<SensorEventQueue> createEventQueue(); 57b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 58b957b9d63c88efd3a961759424987b99219adeedMathias Agopianprivate: 59de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian // DeathRecipient interface 60de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian void sensorManagerDied(); 61de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian 62de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian status_t assertStateLocked() const; 63de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian 64de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopianprivate: 65de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian mutable Mutex mLock; 66de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian mutable sp<ISensorServer> mSensorServer; 67de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian mutable Sensor const** mSensorList; 68de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian mutable Vector<Sensor> mSensors; 69de6c44e90681cbdb754e55721953fc828ec8e2aaMathias Agopian mutable sp<IBinder::DeathRecipient> mDeathObserver; 70b957b9d63c88efd3a961759424987b99219adeedMathias Agopian}; 71b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 72b957b9d63c88efd3a961759424987b99219adeedMathias Agopian// ---------------------------------------------------------------------------- 73b957b9d63c88efd3a961759424987b99219adeedMathias Agopian}; // namespace android 74b957b9d63c88efd3a961759424987b99219adeedMathias Agopian 75b957b9d63c88efd3a961759424987b99219adeedMathias Agopian#endif // ANDROID_GUI_SENSOR_MANAGER_H 76