1 /* 2 * Copyright (C) 2016 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 CHRE_PLATFORM_LINUX_PLATFORM_SENSOR_BASE_H_ 18 #define CHRE_PLATFORM_LINUX_PLATFORM_SENSOR_BASE_H_ 19 20 #include "chre_api/chre/sensor.h" 21 22 namespace chre { 23 24 /** 25 * Storage for the Linux implementation of the PlatformSensor class. 26 */ 27 class PlatformSensorBase { 28 public: 29 /** 30 * Initializes the members of PlatformSensorBase. 31 */ initBase(struct chreSensorInfo * sensorInfo,uint32_t sensorHandle)32 void initBase(struct chreSensorInfo *sensorInfo, uint32_t sensorHandle) { 33 mSensorInfo = sensorInfo; 34 mSensorHandle = sensorHandle; 35 } 36 37 //! The sensor information for this sensor. 38 struct chreSensorInfo *mSensorInfo; 39 40 //! The sensor handle for this sensor. 41 uint32_t mSensorHandle; 42 43 /** 44 * Sets the sensor information of this sensor in the CHRE API format. 45 * 46 * @param sensorInfo Information about this sensor. 47 */ setSensorInfo(struct chreSensorInfo * sensorInfo)48 void setSensorInfo(struct chreSensorInfo *sensorInfo) { 49 mSensorInfo = sensorInfo; 50 } 51 setSensorHandle(uint32_t sensorHandle)52 void setSensorHandle(uint32_t sensorHandle) { 53 mSensorHandle = sensorHandle; 54 } 55 getSensorHandle()56 uint32_t getSensorHandle() const { 57 return mSensorHandle; 58 } 59 }; 60 61 } // namespace chre 62 63 #endif // CHRE_PLATFORM_LINUX_PLATFORM_SENSOR_BASE_H_ 64