1/* 2 * Copyright (C) 2014 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 PRESSURE_SENSOR_H 18#define PRESSURE_SENSOR_H 19 20#include <stdint.h> 21#include <errno.h> 22#include <sys/cdefs.h> 23#include <sys/types.h> 24 25#include <stdint.h> 26#include <errno.h> 27#include <sys/cdefs.h> 28#include <sys/types.h> 29#include <poll.h> 30#include <utils/Vector.h> 31#include <utils/KeyedVector.h> 32 33#include "sensors.h" 34#include "SensorBase.h" 35#include "InputEventReader.h" 36 37class PressureSensor : public SensorBase { 38 39public: 40 PressureSensor(const char *sysfs_path); 41 virtual ~PressureSensor(); 42 43 virtual int getFd() const; 44 virtual int enable(int32_t handle, int enabled); 45 virtual int setDelay(int32_t handle, int64_t ns); 46 virtual int getEnable(int32_t handle); 47 virtual int64_t getDelay(int32_t handle); 48 virtual int64_t getMinDelay() { return mMinDelay; } 49 // only applicable to primary 50 virtual int readEvents(sensors_event_t *data, int count) { return 0; } 51 52 void fillList(struct sensor_t *list); 53 // default is integrated for secondary bus 54 int isIntegrated() { return (1); } 55 56private: 57 char sensor_name[200]; 58 59 struct sysfs_attrbs { 60 char *pressure_enable; 61 char *pressure_rate; 62 } pressureSysFs; 63 64 int pressure_fd; 65 int64_t mDelay; 66 int64_t mMinDelay; 67 int mEnable; 68 char* pathP; 69 const char* mSysfsPath; 70 71 int inv_init_sysfs_attributes(void); 72}; 73 74/*****************************************************************************/ 75 76#endif // PRESSURE_SENSOR_H 77