• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 ACTION_CHARGER_H
17 #define ACTION_CHARGER_H
18 
19 #include "ithermal_action.h"
20 #include "v1_2/types.h"
21 
22 namespace OHOS {
23 namespace PowerMgr {
24 using namespace OHOS::HDI::Battery::V1_2;
25 class ActionCharger : public IThermalAction {
26 public:
27     ActionCharger(const std::string& actionName);
28     ~ActionCharger() = default;
29 
30     void InitParams(const std::string& protocol) override;
31     void SetStrict(bool enable) override;
32     void SetEnableEvent(bool enable) override;
33     void AddActionValue(std::string value) override;
34     void Execute() override;
35     int32_t ChargerRequest(int32_t current);
36     int32_t WriteSimValue(int32_t simValue);
37     static void ExecuteCurrentLimit();
38 private:
39     uint32_t GetActionValue();
40     std::vector<uint32_t> valueList_;
41     uint32_t lastValue_ {0};
42     std::string protocol_;
43     static std::vector<ChargingLimit> chargeLimitList_;
44 };
45 } // namespace PowerMgr
46 } // namespace OHOS
47 #endif // ACTION_CPU_H
48