1 /* 2 * Copyright (C) 2017 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_SLPI_SEE_PLATFORM_SENSOR_BASE_H_ 18 #define CHRE_PLATFORM_SLPI_SEE_PLATFORM_SENSOR_BASE_H_ 19 20 #include "chre/core/sensor_request.h" 21 #include "chre/core/sensor_type_helpers.h" 22 #include "chre/platform/slpi/see/see_helper.h" 23 24 #ifdef CHREX_SENSOR_SUPPORT 25 #include "chre/extensions/platform/vendor_sensor_types.h" 26 #endif // CHREX_SENSOR_SUPPORT 27 28 namespace chre { 29 30 //! The max length of sensorName 31 constexpr size_t kSensorNameMaxLen = 64; 32 33 /** 34 * Storage for the SLPI SEE implementation of the PlatformSensor class. 35 */ 36 class PlatformSensorBase { 37 public: 38 /** 39 * Initializes various members of PlatformSensorBase. 40 */ 41 void initBase(uint8_t sensorType, uint64_t minInterval, 42 const char *sensorName, bool passiveSupported, 43 uint16_t targetGroupMask); 44 45 //! Stores the last received sampling status from SEE for this sensor making 46 //! it easier to dedup updates that come in later from SEE. 47 SeeHelperCallbackInterface::SamplingStatusData mLastReceivedSamplingStatus{}; 48 49 //! The name (type and model) of this sensor. 50 char mSensorName[kSensorNameMaxLen]; 51 52 //! The minimum interval of this sensor. 53 uint64_t mMinInterval; 54 55 //! The group mask events from this sensor must target. 56 uint16_t mTargetGroupMask; 57 58 //! The sensor type of this sensor. 59 uint8_t mSensorType; 60 61 //! Whether this sensor supports passive sensor requests. 62 bool mPassiveSupported = false; 63 }; 64 65 } // namespace chre 66 67 #endif // CHRE_PLATFORM_SLPI_SEE_PLATFORM_SENSOR_BASE_H_ 68