1 /* 2 * Copyright (C) 2022 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 #pragma once 18 19 #include <set> 20 21 #include <aidl/android/hardware/thermal/BnThermal.h> 22 23 namespace aidl { 24 namespace android { 25 namespace hardware { 26 namespace thermal { 27 namespace impl { 28 namespace example { 29 30 class Thermal : public BnThermal { 31 public: 32 ndk::ScopedAStatus getCoolingDevices(std::vector<CoolingDevice>* out_devices) override; 33 ndk::ScopedAStatus getCoolingDevicesWithType(CoolingType in_type, 34 std::vector<CoolingDevice>* out_devices) override; 35 36 ndk::ScopedAStatus getTemperatures(std::vector<Temperature>* out_temperatures) override; 37 ndk::ScopedAStatus getTemperaturesWithType(TemperatureType in_type, 38 std::vector<Temperature>* out_temperatures) override; 39 40 ndk::ScopedAStatus getTemperatureThresholds( 41 std::vector<TemperatureThreshold>* out_temperatureThresholds) override; 42 43 ndk::ScopedAStatus getTemperatureThresholdsWithType( 44 TemperatureType in_type, 45 std::vector<TemperatureThreshold>* out_temperatureThresholds) override; 46 47 ndk::ScopedAStatus registerThermalChangedCallback( 48 const std::shared_ptr<IThermalChangedCallback>& in_callback) override; 49 50 ndk::ScopedAStatus registerThermalChangedCallbackWithType( 51 const std::shared_ptr<IThermalChangedCallback>& in_callback, 52 TemperatureType in_type) override; 53 54 ndk::ScopedAStatus unregisterThermalChangedCallback( 55 const std::shared_ptr<IThermalChangedCallback>& in_callback) override; 56 57 ndk::ScopedAStatus registerCoolingDeviceChangedCallbackWithType( 58 const std::shared_ptr<ICoolingDeviceChangedCallback>& in_callback, 59 CoolingType in_type) override; 60 61 ndk::ScopedAStatus unregisterCoolingDeviceChangedCallback( 62 const std::shared_ptr<ICoolingDeviceChangedCallback>& in_callback) override; 63 64 private: 65 std::mutex thermal_callback_mutex_; 66 std::vector<std::shared_ptr<IThermalChangedCallback>> thermal_callbacks_; 67 std::mutex cdev_callback_mutex_; 68 std::vector<std::shared_ptr<ICoolingDeviceChangedCallback>> cdev_callbacks_; 69 }; 70 71 } // namespace example 72 } // namespace impl 73 } // namespace thermal 74 } // namespace hardware 75 } // namespace android 76 } // namespace aidl 77