• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HDI_THERMAL_V1_1_THERMALINTERFACEIMPL_H
17 #define HDI_THERMAL_V1_1_THERMALINTERFACEIMPL_H
18 
19 #include <mutex>
20 #include "v1_1/ithermal_interface.h"
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace Thermal {
25 namespace V1_1 {
26 class ThermalInterfaceImpl : public IThermalInterface {
27 public:
28     ThermalInterfaceImpl();
~ThermalInterfaceImpl()29     virtual ~ThermalInterfaceImpl() {}
30 
31     int32_t SetCpuFreq(int32_t freq) override;
32 
33     int32_t SetGpuFreq(int32_t freq) override;
34 
35     int32_t SetBatteryCurrent(int32_t current) override;
36 
37     int32_t GetThermalZoneInfo(HdfThermalCallbackInfo& event) override;
38 
39     int32_t IsolateCpu(int32_t num) override;
40 
41     int32_t Register(const sptr<IThermalCallback>& callbackObj) override;
42 
43     int32_t Unregister() override;
44 
45     int32_t RegisterFanCallback(const sptr<IFanCallback>& callbackObj) override;
46 
47     int32_t UnregisterFanCallback() override;
48 
49 private:
50     void StartTimerThread();
51     int32_t Init();
52     std::mutex mutex_;
53 };
54 } // V1_1
55 } // Thermal
56 } // HDI
57 } // OHOS
58 
59 #endif // HDI_THERMAL_V1_1_THERMALINTERFACEIMPL_H