SensorManager.h revision 589ce85ee4174829cfedce91b6b2509d2a4002eb
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
32struct ASensorManager { };
33
34// ----------------------------------------------------------------------------
35namespace android {
36// ----------------------------------------------------------------------------
37
38class ISensorServer;
39class Sensor;
40class SensorEventQueue;
41
42// ----------------------------------------------------------------------------
43
44class SensorManager : public ASensorManager, public Singleton<SensorManager>
45{
46public:
47    SensorManager();
48    ~SensorManager();
49
50    ssize_t getSensorList(Sensor**) const;
51    Sensor* getDefaultSensor(int type);
52    sp<SensorEventQueue> createEventQueue();
53
54private:
55    sp<ISensorServer> mSensorServer;
56    Sensor* mSensorList;
57    Vector<Sensor> mSensors;
58};
59
60// ----------------------------------------------------------------------------
61}; // namespace android
62
63#endif // ANDROID_GUI_SENSOR_MANAGER_H
64