1 /*
2  * Copyright (c) 2023-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 INTERFACES_INNER_API_DEVICE_SETTINGS_INCLUDE_POWER_POLICY_H
17 #define INTERFACES_INNER_API_DEVICE_SETTINGS_INCLUDE_POWER_POLICY_H
18 
19 #include "message_parcel.h"
20 
21 namespace OHOS {
22 namespace EDM {
23 enum class PowerScene : uint32_t {
24     TIME_OUT = 0,
25 };
26 
27 enum class PowerPolicyAction : uint32_t {
28     NONE = 0,
29     AUTO_SUSPEND,
30     FORCE_SUSPEND,
31     HIBERNATE,
32     SHUTDOWN,
33 };
34 
35 class PowerPolicy {
36 public:
37     bool Marshalling(MessageParcel &parcel) const;
38     static bool Unmarshalling(MessageParcel &parcel, PowerPolicy &powerPolicy);
39 
40     void SetDelayTime(uint32_t delayTime);
41     bool SetPowerPolicyAction(uint32_t action);
42 
43     [[nodiscard]] PowerPolicyAction GetPowerPolicyAction() const;
44     [[nodiscard]] uint32_t GetDealyTime() const;
45 
46 private:
47     PowerPolicyAction powerPolicyAction_ = PowerPolicyAction::AUTO_SUSPEND;
48     uint32_t delayTime_ = 0;
49 };
50 } // namespace EDM
51 } // namespace OHOS
52 
53 #endif // INTERFACES_INNER_API_DEVICE_SETTINGS_INCLUDE_POWER_POLICY_H
54