1 /* 2 * Copyright (C) 2019 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 HARDWARE_GOOGLE_CAMERA_HAL_COMMON_THERMAL_TYPES_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_COMMON_THERMAL_TYPES_H_ 19 20 namespace android { 21 namespace google_camera_hal { 22 23 // See the definition of 24 // ::android::hardware::thermal::V2_0::TemperatureType 25 enum class TemperatureType : int32_t { 26 kUnknown = -1, 27 kCpu = 0, 28 kGpu = 1, 29 kBattery = 2, 30 kSkin = 3, 31 kUsbPort = 4, 32 kPowerAmplifier = 5, 33 kBclVoltage = 6, 34 kBclCurrent = 7, 35 kBclPercentage = 8, 36 kNpu = 9, 37 }; 38 39 // See the definition of 40 // ::android::hardware::thermal::V2_0::ThrottlingSeverity 41 enum class ThrottlingSeverity : uint32_t { 42 kNone = 0, 43 kLight, 44 kModerate, 45 kSevere, 46 kCritical, 47 kEmergency, 48 kShutdown, 49 }; 50 51 // See the definition of 52 // ::android::hardware::thermal::V2_0::Temperature 53 struct Temperature { 54 TemperatureType type = TemperatureType::kUnknown; 55 std::string name; 56 float value = 0.0f; 57 ThrottlingSeverity throttling_status = ThrottlingSeverity::kNone; 58 }; 59 60 // Function to invoke when thermal status changes. 61 using NotifyThrottlingFunc = 62 std::function<void(const Temperature& /*temperature*/)>; 63 64 // Callback to register a thermal throttling notify function. 65 // If filter_type is true, type will be used. If filter_type is false, 66 // type will be ignored and all types will be notified. 67 using RegisterThermalChangedCallbackFunc = 68 std::function<status_t(NotifyThrottlingFunc /*notify_throttling*/, 69 bool /*filter_type*/, TemperatureType /*type*/)>; 70 71 // Unregister the thermal callback. 72 using UnregisterThermalChangedCallbackFunc = std::function<void()>; 73 74 } // namespace google_camera_hal 75 } // namespace android 76 77 #endif // HARDWARE_GOOGLE_CAMERA_HAL_COMMON_THERMAL_TYPES_H_ 78