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#include <stdint.h> 18f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include <sys/types.h> 19f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 20f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include <cutils/log.h> 21f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 22f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian#include "SensorInterface.h" 23f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 24f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopiannamespace android { 25f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// --------------------------------------------------------------------------- 26f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 27f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianSensorInterface::~SensorInterface() 28f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian{ 29f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 30f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 31f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// --------------------------------------------------------------------------- 32f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 33f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianHardwareSensor::HardwareSensor(const sensor_t& sensor) 34f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian : mSensorDevice(SensorDevice::getInstance()), 35724d91d778e71c8186399f4955de14b54812b3edAravind Akella mSensor(&sensor, mSensorDevice.getHalDeviceVersion()) 36f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian{ 37c7839e897646ece32894d3b7d1685c3880d949feSteve Block ALOGI("%s", sensor.name); 38f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 39f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 40f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianHardwareSensor::~HardwareSensor() { 41f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 42f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 43f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianbool HardwareSensor::process(sensors_event_t* outEvent, 44f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian const sensors_event_t& event) { 45f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian *outEvent = event; 46f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian return true; 47f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 48f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 4950b66767f6c5635430483393e17d15969dfe2f05Mathias Agopianstatus_t HardwareSensor::activate(void* ident, bool enabled) { 5050b66767f6c5635430483393e17d15969dfe2f05Mathias Agopian return mSensorDevice.activate(ident, mSensor.getHandle(), enabled); 51f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 52f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 53724d91d778e71c8186399f4955de14b54812b3edAravind Akellastatus_t HardwareSensor::batch(void* ident, int handle, int flags, 54724d91d778e71c8186399f4955de14b54812b3edAravind Akella int64_t samplingPeriodNs, int64_t maxBatchReportLatencyNs) { 55724d91d778e71c8186399f4955de14b54812b3edAravind Akella return mSensorDevice.batch(ident, mSensor.getHandle(), flags, samplingPeriodNs, 56724d91d778e71c8186399f4955de14b54812b3edAravind Akella maxBatchReportLatencyNs); 57724d91d778e71c8186399f4955de14b54812b3edAravind Akella} 58724d91d778e71c8186399f4955de14b54812b3edAravind Akella 59724d91d778e71c8186399f4955de14b54812b3edAravind Akellastatus_t HardwareSensor::flush(void* ident, int handle) { 60724d91d778e71c8186399f4955de14b54812b3edAravind Akella return mSensorDevice.flush(ident, handle); 61724d91d778e71c8186399f4955de14b54812b3edAravind Akella} 62724d91d778e71c8186399f4955de14b54812b3edAravind Akella 63f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianstatus_t HardwareSensor::setDelay(void* ident, int handle, int64_t ns) { 64f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian return mSensorDevice.setDelay(ident, handle, ns); 65f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 66f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 67ac9a96da65f6eae4513654adaad8a457d1c1575cMathias Agopianvoid HardwareSensor::autoDisable(void *ident, int handle) { 68ac9a96da65f6eae4513654adaad8a457d1c1575cMathias Agopian mSensorDevice.autoDisable(ident, handle); 694c01b1ad80e084f0cd1057f89fdd1fcedf19dd96Jaikumar Ganesh} 704c01b1ad80e084f0cd1057f89fdd1fcedf19dd96Jaikumar Ganesh 71f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianSensor HardwareSensor::getSensor() const { 72f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian return mSensor; 73f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 74f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 75f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 76f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// --------------------------------------------------------------------------- 77f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian}; // namespace android 78