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 "SensorInterface.h" 21f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 22f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopiannamespace android { 23f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// --------------------------------------------------------------------------- 24f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 25f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianSensorInterface::~SensorInterface() 26f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian{ 27f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 28f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 29f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// --------------------------------------------------------------------------- 30f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 31f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianHardwareSensor::HardwareSensor(const sensor_t& sensor) 32f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian : mSensorDevice(SensorDevice::getInstance()), 33724d91d778e71c8186399f4955de14b54812b3edAravind Akella mSensor(&sensor, mSensorDevice.getHalDeviceVersion()) 34f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian{ 35f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 36f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 37f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianHardwareSensor::~HardwareSensor() { 38f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 39f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 40f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianbool HardwareSensor::process(sensors_event_t* outEvent, 41f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian const sensors_event_t& event) { 42f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian *outEvent = event; 43f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian return true; 44f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 45f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 4650b66767f6c5635430483393e17d15969dfe2f05Mathias Agopianstatus_t HardwareSensor::activate(void* ident, bool enabled) { 4750b66767f6c5635430483393e17d15969dfe2f05Mathias Agopian return mSensorDevice.activate(ident, mSensor.getHandle(), enabled); 48f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 49f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 5092dc3fc52cf097bd105460cf377779bdcf146d62Mark Salyzynstatus_t HardwareSensor::batch(void* ident, int /*handle*/, int flags, 51724d91d778e71c8186399f4955de14b54812b3edAravind Akella int64_t samplingPeriodNs, int64_t maxBatchReportLatencyNs) { 52724d91d778e71c8186399f4955de14b54812b3edAravind Akella return mSensorDevice.batch(ident, mSensor.getHandle(), flags, samplingPeriodNs, 53724d91d778e71c8186399f4955de14b54812b3edAravind Akella maxBatchReportLatencyNs); 54724d91d778e71c8186399f4955de14b54812b3edAravind Akella} 55724d91d778e71c8186399f4955de14b54812b3edAravind Akella 56724d91d778e71c8186399f4955de14b54812b3edAravind Akellastatus_t HardwareSensor::flush(void* ident, int handle) { 57724d91d778e71c8186399f4955de14b54812b3edAravind Akella return mSensorDevice.flush(ident, handle); 58724d91d778e71c8186399f4955de14b54812b3edAravind Akella} 59724d91d778e71c8186399f4955de14b54812b3edAravind Akella 60f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopianstatus_t HardwareSensor::setDelay(void* ident, int handle, int64_t ns) { 61f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian return mSensorDevice.setDelay(ident, handle, ns); 62f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 63f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 64ac9a96da65f6eae4513654adaad8a457d1c1575cMathias Agopianvoid HardwareSensor::autoDisable(void *ident, int handle) { 65ac9a96da65f6eae4513654adaad8a457d1c1575cMathias Agopian mSensorDevice.autoDisable(ident, handle); 664c01b1ad80e084f0cd1057f89fdd1fcedf19dd96Jaikumar Ganesh} 674c01b1ad80e084f0cd1057f89fdd1fcedf19dd96Jaikumar Ganesh 68f001c92436b4a66eb7687286325ced7f10c9f917Mathias AgopianSensor HardwareSensor::getSensor() const { 69f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian return mSensor; 70f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian} 71f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 72f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian 73f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian// --------------------------------------------------------------------------- 74f001c92436b4a66eb7687286325ced7f10c9f917Mathias Agopian}; // namespace android 75