blob: cd892851f74d7ad3b1b4a4a524e4bc7a9241c803 [file] [log] [blame]
Mathias Agopian589ce852010-07-13 22:21:56 -07001/*
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#include <stdint.h>
18#include <sys/types.h>
19
20#include <utils/Errors.h>
21#include <utils/RefBase.h>
22#include <utils/Singleton.h>
23
24#include <gui/ISensorServer.h>
25#include <gui/ISensorEventConnection.h>
26#include <gui/Sensor.h>
27#include <gui/SensorManager.h>
28#include <gui/SensorEventQueue.h>
29
30// ----------------------------------------------------------------------------
31namespace android {
32// ----------------------------------------------------------------------------
33
34ANDROID_SINGLETON_STATIC_INSTANCE(SensorManager)
35
36SensorManager::SensorManager()
37 : mSensorList(0)
38{
39 mSensors = mSensorServer->getSensorList();
40 // TODO: needs implementation
41}
42
43SensorManager::~SensorManager()
44{
45 // TODO: needs implementation
46}
47
48ssize_t SensorManager::getSensorList(Sensor** list) const
49{
50 *list = mSensorList;
51 return mSensors.size();
52}
53
54Sensor* SensorManager::getDefaultSensor(int type)
55{
56 // TODO: needs implementation
57 return mSensorList;
58}
59
60sp<SensorEventQueue> SensorManager::createEventQueue()
61{
62 sp<SensorEventQueue> result = new SensorEventQueue(
63 mSensorServer->createSensorEventConnection());
64 return result;
65}
66
67// ----------------------------------------------------------------------------
68}; // namespace android