Mathias Agopian | 589ce85 | 2010-07-13 22:21:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_GUI_SENSOR_MANAGER_H |
| 18 | #define ANDROID_GUI_SENSOR_MANAGER_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/Errors.h> |
| 24 | #include <utils/RefBase.h> |
| 25 | #include <utils/Singleton.h> |
| 26 | #include <utils/Vector.h> |
| 27 | |
| 28 | #include <gui/SensorEventQueue.h> |
| 29 | |
| 30 | // ---------------------------------------------------------------------------- |
| 31 | // Concrete types for the NDK |
| 32 | struct ASensorManager { }; |
| 33 | |
| 34 | // ---------------------------------------------------------------------------- |
| 35 | namespace android { |
| 36 | // ---------------------------------------------------------------------------- |
| 37 | |
| 38 | class ISensorServer; |
| 39 | class Sensor; |
| 40 | class SensorEventQueue; |
| 41 | |
| 42 | // ---------------------------------------------------------------------------- |
| 43 | |
| 44 | class SensorManager : public ASensorManager, public Singleton<SensorManager> |
| 45 | { |
| 46 | public: |
| 47 | SensorManager(); |
| 48 | ~SensorManager(); |
| 49 | |
Mathias Agopian | a7352c9 | 2010-07-14 23:41:37 -0700 | [diff] [blame] | 50 | ssize_t getSensorList(Sensor const* const** list) const; |
| 51 | Sensor const* getDefaultSensor(int type); |
Mathias Agopian | 589ce85 | 2010-07-13 22:21:56 -0700 | [diff] [blame] | 52 | sp<SensorEventQueue> createEventQueue(); |
| 53 | |
| 54 | private: |
| 55 | sp<ISensorServer> mSensorServer; |
Mathias Agopian | a7352c9 | 2010-07-14 23:41:37 -0700 | [diff] [blame] | 56 | Sensor const** mSensorList; |
Mathias Agopian | 589ce85 | 2010-07-13 22:21:56 -0700 | [diff] [blame] | 57 | Vector<Sensor> mSensors; |
| 58 | }; |
| 59 | |
| 60 | // ---------------------------------------------------------------------------- |
| 61 | }; // namespace android |
| 62 | |
| 63 | #endif // ANDROID_GUI_SENSOR_MANAGER_H |