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 ndk::ScopedAStatus registerThermalChangedCallbackWithType( 50 const std::shared_ptr<IThermalChangedCallback>& in_callback, 51 TemperatureType in_type) override; 52 53 ndk::ScopedAStatus unregisterThermalChangedCallback( 54 const std::shared_ptr<IThermalChangedCallback>& in_callback) override; 55 56 private: 57 std::mutex thermal_callback_mutex_; 58 std::vector<std::shared_ptr<IThermalChangedCallback>> thermal_callbacks_; 59 }; 60 61 } // namespace example 62 } // namespace impl 63 } // namespace thermal 64 } // namespace hardware 65 } // namespace android 66 } // namespace aidl 67