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/**
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.IPowerRunningLockCallback;
45import ohos.hdi.power.v1_1.IPowerHdiCallback;
46import ohos.hdi.power.v1_1.PowerTypes;
47import ohos.hdi.power.v1_1.RunningLockTypes;
48
49/**
50 * @brief Represents APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
51 * and managing running locks.
52 *
53 *
54 *
55 * @since 3.1
56 */
57interface IPowerInterface {
58    /**
59     * @brief Registers the callback of the hibernation/wakeup status.
60     *
61     * @param ipowerHdiCallback Callback to register.
62     *
63     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
64     * @see IPowerHdiCallback
65     *
66     * @since 3.1
67     */
68    RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback);
69
70    /**
71     * @brief Hibernates a device.
72     *
73     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
74     *
75     * @since 3.1
76     */
77    StartSuspend();
78
79    /**
80     * @brief Wakes up a device.
81     *
82     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
83     *
84     * @since 3.1
85     */
86    StopSuspend();
87
88    /**
89     * @brief Forcibly hibernates a device.
90     *
91     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
92     *
93     * @since 3.1
94     */
95    ForceSuspend();
96
97    /**
98     * @brief Enables the running lock to block device hibernation.
99     *
100     * @param name Name of the running lock.
101     *
102     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
103     *
104     * @since 3.1
105     * @deprecated
106     */
107    SuspendBlock([in] String name);
108
109    /**
110     * @brief Disables the running lock to unblock device hibernation.
111     *
112     * @param name Name of the running lock.
113     *
114     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
115     *
116     * @since 3.1
117     * @deprecated
118     */
119    SuspendUnblock([in] String name);
120
121    /**
122     * @brief Obtains the power dump information.
123     *
124     * @param info Power dump information.
125     *
126     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
127     *
128     * @since 3.1
129     */
130    PowerDump([out] String info);
131
132    /**
133     * @brief Holds the running lock to block device hibernation.
134     *
135     * @param info Running lock info.
136     *
137     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful; returns <b>HDF_FAILED</b> if the
138     * running lock type conflicts with current lock.
139     *
140     * @since 4.0
141     */
142    HoldRunningLock([in] struct RunningLockInfo info);
143
144    /**
145     * @brief Unholds the running lock to unblock device hibernation.
146     *
147     * @param info Running lock info.
148     *
149     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
150     *
151     * @since 4.0
152     */
153    UnholdRunningLock([in] struct RunningLockInfo info);
154
155    /**
156     * @brief obtain system wakeup reason.
157     *
158     * @param info wakeup reason info.
159     *
160     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
161     *
162     * @since 4.1
163     */
164    GetWakeupReason([out] String reason);
165
166    /**
167     * @brief Holds the running lock to block device hibernation.
168     *
169     * @param extra Running lock info.
170     *
171     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful; returns <b>HDF_FAILED</b> if the
172     * running lock type conflicts with current lock.
173     *
174     * @since 4.1
175     * @deprecated
176     */
177    HoldRunningLockExt([in] struct RunningLockInfo info, [in] unsigned long lockid, [in] String bundleName);
178
179    /**
180     * @brief Unholds the running lock to unblock device hibernation.
181     *
182     * @param extra Running lock info.
183     *
184     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
185     *
186     * @since 4.1
187     * @deprecated
188     */
189    UnholdRunningLockExt([in] struct RunningLockInfo info, [in] unsigned long lockid, [in] String bundleName);
190
191    /**
192     * @brief Registers the callback of the running lock status.
193     *
194     * @param iPowerRunningLockCallback Callback to register.
195     *
196     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
197     * @see IPowerRunningLockCallback
198     *
199     * @since 4.1
200     * @deprecated
201     */
202    RegisterRunningLockCallback([in] IPowerRunningLockCallback iPowerRunningLockCallback);
203
204    /**
205     * @brief Unregister the callback of the running lock status.
206     *
207     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
208     *
209     * @since 4.1
210     * @deprecated
211     */
212    UnRegisterRunningLockCallback();
213}
214/** @} */
215