• 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 ACTION_VOLATEG_H
17 #define ACTION_VOLATEG_H
18 
19 #include "ithermal_action.h"
20 #include "v1_1/types.h"
21 
22 namespace OHOS {
23 namespace PowerMgr {
24 using namespace OHOS::HDI::Battery::V1_1;
25 class ActionVoltage : public IThermalAction {
26 public:
27     ActionVoltage(const std::string& actionName);
28     ~ActionVoltage() = default;
29 
30     void InitParams(const std::string& protocol) override;
31     virtual void SetStrict(bool flag) override;
32     virtual void SetEnableEvent(bool enable) override;
33     virtual void AddActionValue(std::string value) override;
34     virtual void Execute() override;
35     int32_t SetVoltage(int32_t voltage);
36     int32_t WriteMockNode(int32_t mockValue);
37     static void ExecuteVoltageLimit();
38 private:
39     std::vector<uint32_t> valueList_;
40     bool flag_;
41     bool enableEvent_ = false;
42     uint32_t lastValue_;
43     std::string protocol_;
44     static std::vector<ChargingLimit> chargeLimitList_;
45 };
46 } // namespace PowerMgr
47 } // namespace OHOS
48 #endif // ACTION_CPU_H
49