blob: d3d88748ee78e2654c7eccaf395a2e022f52d7d6 [file] [log] [blame]
Peiyong Lin56960752022-09-30 21:52:52 +00001/*
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
23namespace aidl {
24namespace android {
25namespace hardware {
26namespace thermal {
27namespace impl {
28namespace example {
29
30class 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;
TeYuan Wang2bbd1ec2023-12-11 14:55:39 -080049
Peiyong Lin56960752022-09-30 21:52:52 +000050 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
TeYuan Wang2bbd1ec2023-12-11 14:55:39 -080057 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
Peiyong Lin56960752022-09-30 21:52:52 +000064 private:
Xiang Wangd43e8732023-02-07 12:10:33 -080065 std::mutex thermal_callback_mutex_;
66 std::vector<std::shared_ptr<IThermalChangedCallback>> thermal_callbacks_;
TeYuan Wang2bbd1ec2023-12-11 14:55:39 -080067 std::mutex cdev_callback_mutex_;
68 std::vector<std::shared_ptr<ICoolingDeviceChangedCallback>> cdev_callbacks_;
Peiyong Lin56960752022-09-30 21:52:52 +000069};
70
71} // namespace example
72} // namespace impl
73} // namespace thermal
74} // namespace hardware
75} // namespace android
76} // namespace aidl