• 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/**
17 * @addtogroup power
18 * @{
19 *
20 * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
21 * and managing running locks.
22 *
23 * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform
24 * hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks.
25 *
26 * @since 3.1
27 * @version 1.0
28 */
29
30/**
31 * @file IPowerInterface.idl
32 *
33 * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
34 * and managing running locks.
35 *
36 *
37 *
38 * @since 3.1
39 * @version 1.0
40 */
41
42package ohos.hdi.power.v1_1;
43
44import ohos.hdi.power.v1_1.IPowerHdiCallback;
45import ohos.hdi.power.v1_1.PowerTypes;
46import ohos.hdi.power.v1_1.RunningLockTypes;
47
48/**
49 * @brief Represents APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
50 * and managing running locks.
51 *
52 *
53 *
54 * @since 3.1
55 */
56interface IPowerInterface {
57    /**
58     * @brief Registers the callback of the hibernation/wakeup status.
59     *
60     * @param ipowerHdiCallback Callback to register.
61     *
62     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
63     * @see IPowerHdiCallback
64     *
65     * @since 3.1
66     */
67    RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback);
68
69    /**
70     * @brief Hibernates a device.
71     *
72     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
73     *
74     * @since 3.1
75     */
76    StartSuspend();
77
78    /**
79     * @brief Wakes up a device.
80     *
81     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
82     *
83     * @since 3.1
84     */
85    StopSuspend();
86
87    /**
88     * @brief Forcibly hibernates a device.
89     *
90     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
91     *
92     * @since 3.1
93     */
94    ForceSuspend();
95
96    /**
97     * @brief Enables the running lock to block device hibernation.
98     *
99     * @param name Name of the running lock.
100     *
101     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
102     *
103     * @since 3.1
104     * @deprecated
105     */
106    SuspendBlock([in] String name);
107
108    /**
109     * @brief Disables the running lock to unblock device hibernation.
110     *
111     * @param name Name of the running lock.
112     *
113     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
114     *
115     * @since 3.1
116     * @deprecated
117     */
118    SuspendUnblock([in] String name);
119
120    /**
121     * @brief Obtains the power dump information.
122     *
123     * @param info Power dump information.
124     *
125     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
126     *
127     * @since 3.1
128     */
129    PowerDump([out] String info);
130
131    /**
132     * @brief Holds the running lock to block device hibernation.
133     *
134     * @param info Running lock info.
135     *
136     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful; returns <b>HDF_FAILED</b> if the
137     * running lock type conflicts with current lock.
138     *
139     * @since 4.0
140     */
141    HoldRunningLock([in] struct RunningLockInfo info);
142
143    /**
144     * @brief Unholds the running lock to unblock device hibernation.
145     *
146     * @param info Running lock info.
147     *
148     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
149     *
150     * @since 4.0
151     */
152    UnholdRunningLock([in] struct RunningLockInfo info);
153}
154/** @} */
155