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_AIDL_SERVICE_AIDL_THERMAL_UTILS_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_AIDL_SERVICE_AIDL_THERMAL_UTILS_H_ 19 20 #include <aidl/android/hardware/thermal/BnThermalChangedCallback.h> 21 #include <aidl/android/hardware/thermal/IThermal.h> 22 23 #include "thermal_types.h" 24 25 namespace android { 26 namespace hardware { 27 namespace aidl_thermal_utils { 28 29 // ThermalChangedCallback implements the AIDL thermal changed callback 30 // interface, IThermalChangedCallback, to be registered for thermal status 31 // change. 32 class ThermalChangedCallback 33 : public aidl::android::hardware::thermal::BnThermalChangedCallback { 34 public: 35 explicit ThermalChangedCallback( 36 google_camera_hal::NotifyThrottlingFunc notify_throttling); 37 virtual ~ThermalChangedCallback() = default; 38 39 // Override functions in HidlThermalChangedCallback. 40 ndk::ScopedAStatus notifyThrottling( 41 const aidl::android::hardware::thermal::Temperature& temperature) override; 42 // End of override functions in HidlThermalChangedCallback. 43 44 private: 45 const google_camera_hal::NotifyThrottlingFunc notify_throttling_; 46 47 status_t ConvertToHalTemperatureType( 48 const aidl::android::hardware::thermal::TemperatureType& 49 aidl_temperature_type, 50 google_camera_hal::TemperatureType* hal_temperature_type); 51 52 status_t ConvertToHalThrottlingSeverity( 53 const aidl::android::hardware::thermal::ThrottlingSeverity& 54 aidl_throttling_severity, 55 google_camera_hal::ThrottlingSeverity* hal_throttling_severity); 56 57 status_t ConvertToHalTemperature( 58 const aidl::android::hardware::thermal::Temperature& aidl_temperature, 59 google_camera_hal::Temperature* hal_temperature); 60 }; 61 62 status_t ConvertToAidlTemperatureType( 63 const google_camera_hal::TemperatureType& hal_temperature_type, 64 aidl::android::hardware::thermal::TemperatureType* aidl_temperature_type); 65 66 } // namespace aidl_thermal_utils 67 } // namespace hardware 68 } // namespace android 69 70 #endif // HARDWARE_GOOGLE_CAMERA_HAL_AIDL_SERVICE_AIDL_THERMAL_UTILS_H_