• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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_VOLATEG_H
17 #define ACTION_VOLATEG_H
18 
19 #include "ithermal_action.h"
20 #ifdef DRIVERS_INTERFACE_BATTERY_ENABLE
21 #include "v2_0/types.h"
22 #endif
23 
24 namespace OHOS {
25 namespace PowerMgr {
26 #ifdef DRIVERS_INTERFACE_BATTERY_ENABLE
27 using namespace OHOS::HDI::Battery::V2_0;
28 #endif
29 class ActionVoltage : public IThermalAction {
30 public:
31     ActionVoltage(const std::string& actionName);
32     ~ActionVoltage() = default;
33 
34     void InitParams(const std::string& protocol) override;
35     void SetStrict(bool enable) override;
36     void SetEnableEvent(bool enable) override;
37     void AddActionValue(uint32_t actionId, std::string value) override;
38     void ExecuteInner() override;
39     void ResetActionValue() override;
40     int32_t SetVoltage(int32_t voltage);
41     int32_t WriteMockNode(int32_t mockValue);
42     static void ExecuteVoltageLimit();
43 private:
44     uint32_t GetActionValue();
45     std::vector<uint32_t> valueList_;
46     uint32_t lastValue_ {0};
47     std::string protocol_;
48 #ifdef DRIVERS_INTERFACE_BATTERY_ENABLE
49     static std::vector<ChargingLimit> chargeLimitList_;
50 #endif
51 };
52 } // namespace PowerMgr
53 } // namespace OHOS
54 #endif // ACTION_CPU_H
55