• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 THERMAL_ACTION_MANAGER_H
17 #define THERMAL_ACTION_MANAGER_H
18 
19 #include <string>
20 #include <vector>
21 #include <map>
22 #include <list>
23 
24 #include "ithermal_action.h"
25 #include "action_thermal_level.h"
26 
27 namespace OHOS {
28 namespace PowerMgr {
29 struct ActionItem {
30     std::string name;
31     std::string params;
32     bool strict = false;
33 };
34 
35 class ThermalActionManager {
36 public:
37     using ThermalActionMap = std::map<std::string, std::shared_ptr<IThermalAction>>;
38     bool Init();
39     void SubscribeThermalLevelCallback(const sptr<IThermalLevelCallback> &callback);
40     void UnSubscribeThermalLevelCallback(const sptr<IThermalLevelCallback> &callback);
41     uint32_t GetThermalLevel();
SetActionItem(std::vector<ActionItem> vActionItem)42     void SetActionItem(std::vector<ActionItem> vActionItem)
43     {
44         vActionItem_ = vActionItem;
45     }
GetActionMap()46     ThermalActionMap GetActionMap()
47     {
48         return actionMap_;
49     }
GetActionThermalLevelObj()50     std::shared_ptr<ActionThermalLevel> GetActionThermalLevelObj()
51     {
52         return actionThermalLevel_;
53     }
54 
55     int32_t CreateActionMockFile();
56 private:
57     ThermalActionMap actionMap_;
58     std::vector<std::string> actionNameList_;
59     std::shared_ptr<ActionThermalLevel> actionThermalLevel_;
60     std::vector<ActionItem> vActionItem_;
61 };
62 } // namespace PowerMgr
63 } // namespace OHOS
64 #endif // THERMAL_ACTION_MANAGER_H