1c5e268c6Sopenharmony_ci/*
2c5e268c6Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at
6c5e268c6Sopenharmony_ci *
7c5e268c6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c5e268c6Sopenharmony_ci *
9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and
13c5e268c6Sopenharmony_ci * limitations under the License.
14c5e268c6Sopenharmony_ci */
15c5e268c6Sopenharmony_ci
16c5e268c6Sopenharmony_ci/**
17c5e268c6Sopenharmony_ci * @addtogroup power
18c5e268c6Sopenharmony_ci * @{
19c5e268c6Sopenharmony_ci *
20c5e268c6Sopenharmony_ci * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
21c5e268c6Sopenharmony_ci * and managing running locks.
22c5e268c6Sopenharmony_ci * 
23c5e268c6Sopenharmony_ci * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform
24c5e268c6Sopenharmony_ci * hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks.
25c5e268c6Sopenharmony_ci *
26c5e268c6Sopenharmony_ci * @since 3.1
27c5e268c6Sopenharmony_ci * @version 1.0
28c5e268c6Sopenharmony_ci */
29c5e268c6Sopenharmony_ci
30c5e268c6Sopenharmony_ci/**
31c5e268c6Sopenharmony_ci * @file IPowerInterface.idl
32c5e268c6Sopenharmony_ci *
33c5e268c6Sopenharmony_ci * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
34c5e268c6Sopenharmony_ci * and managing running locks.
35c5e268c6Sopenharmony_ci *
36c5e268c6Sopenharmony_ci * 
37c5e268c6Sopenharmony_ci *
38c5e268c6Sopenharmony_ci * @since 3.1
39c5e268c6Sopenharmony_ci * @version 1.0
40c5e268c6Sopenharmony_ci */
41c5e268c6Sopenharmony_ci
42c5e268c6Sopenharmony_cipackage ohos.hdi.power.v1_2;
43c5e268c6Sopenharmony_ci
44c5e268c6Sopenharmony_ciimport ohos.hdi.power.v1_2.IPowerRunningLockCallback;
45c5e268c6Sopenharmony_ciimport ohos.hdi.power.v1_2.IPowerHdiCallback;
46c5e268c6Sopenharmony_ciimport ohos.hdi.power.v1_2.PowerTypes;
47c5e268c6Sopenharmony_ciimport ohos.hdi.power.v1_2.RunningLockTypes;
48c5e268c6Sopenharmony_ci
49c5e268c6Sopenharmony_ci/**
50c5e268c6Sopenharmony_ci * @brief Represents APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status,
51c5e268c6Sopenharmony_ci * and managing running locks.
52c5e268c6Sopenharmony_ci *
53c5e268c6Sopenharmony_ci * 
54c5e268c6Sopenharmony_ci *
55c5e268c6Sopenharmony_ci * @since 3.1
56c5e268c6Sopenharmony_ci */
57c5e268c6Sopenharmony_ciinterface IPowerInterface {
58c5e268c6Sopenharmony_ci    /**
59c5e268c6Sopenharmony_ci     * @brief Registers the callback of the hibernation/wakeup status.
60c5e268c6Sopenharmony_ci     *
61c5e268c6Sopenharmony_ci     * @param ipowerHdiCallback Callback to register.
62c5e268c6Sopenharmony_ci     *
63c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
64c5e268c6Sopenharmony_ci     * @see IPowerHdiCallback
65c5e268c6Sopenharmony_ci     *
66c5e268c6Sopenharmony_ci     * @since 3.1
67c5e268c6Sopenharmony_ci     */
68c5e268c6Sopenharmony_ci    RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback);
69c5e268c6Sopenharmony_ci
70c5e268c6Sopenharmony_ci    /**
71c5e268c6Sopenharmony_ci     * @brief Suspend a device.
72c5e268c6Sopenharmony_ci     *
73c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
74c5e268c6Sopenharmony_ci     *
75c5e268c6Sopenharmony_ci     * @since 3.1
76c5e268c6Sopenharmony_ci     */
77c5e268c6Sopenharmony_ci    StartSuspend();
78c5e268c6Sopenharmony_ci
79c5e268c6Sopenharmony_ci    /**
80c5e268c6Sopenharmony_ci     * @brief Wakes up a device.
81c5e268c6Sopenharmony_ci     *
82c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
83c5e268c6Sopenharmony_ci     *
84c5e268c6Sopenharmony_ci     * @since 3.1
85c5e268c6Sopenharmony_ci     */
86c5e268c6Sopenharmony_ci    StopSuspend();
87c5e268c6Sopenharmony_ci
88c5e268c6Sopenharmony_ci    /**
89c5e268c6Sopenharmony_ci     * @brief Forcibly hibernates a device.
90c5e268c6Sopenharmony_ci     *
91c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
92c5e268c6Sopenharmony_ci     *
93c5e268c6Sopenharmony_ci     * @since 3.1
94c5e268c6Sopenharmony_ci     */
95c5e268c6Sopenharmony_ci    ForceSuspend();
96c5e268c6Sopenharmony_ci
97c5e268c6Sopenharmony_ci    /**
98c5e268c6Sopenharmony_ci     * @brief Enables the running lock to block device hibernation.
99c5e268c6Sopenharmony_ci     *
100c5e268c6Sopenharmony_ci     * @param name Name of the running lock.
101c5e268c6Sopenharmony_ci     *
102c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
103c5e268c6Sopenharmony_ci     *
104c5e268c6Sopenharmony_ci     * @since 3.1
105c5e268c6Sopenharmony_ci     * @deprecated
106c5e268c6Sopenharmony_ci     */
107c5e268c6Sopenharmony_ci    SuspendBlock([in] String name);
108c5e268c6Sopenharmony_ci
109c5e268c6Sopenharmony_ci    /**
110c5e268c6Sopenharmony_ci     * @brief Disables the running lock to unblock device hibernation.
111c5e268c6Sopenharmony_ci     *
112c5e268c6Sopenharmony_ci     * @param name Name of the running lock.
113c5e268c6Sopenharmony_ci     *
114c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
115c5e268c6Sopenharmony_ci     *
116c5e268c6Sopenharmony_ci     * @since 3.1
117c5e268c6Sopenharmony_ci     * @deprecated
118c5e268c6Sopenharmony_ci     */
119c5e268c6Sopenharmony_ci    SuspendUnblock([in] String name);
120c5e268c6Sopenharmony_ci
121c5e268c6Sopenharmony_ci    /**
122c5e268c6Sopenharmony_ci     * @brief Obtains the power dump information.
123c5e268c6Sopenharmony_ci     *
124c5e268c6Sopenharmony_ci     * @param info Power dump information.
125c5e268c6Sopenharmony_ci     *
126c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
127c5e268c6Sopenharmony_ci     *
128c5e268c6Sopenharmony_ci     * @since 3.1
129c5e268c6Sopenharmony_ci     */
130c5e268c6Sopenharmony_ci    PowerDump([out] String info);
131c5e268c6Sopenharmony_ci
132c5e268c6Sopenharmony_ci    /**
133c5e268c6Sopenharmony_ci     * @brief Holds the running lock to block device hibernation.
134c5e268c6Sopenharmony_ci     *
135c5e268c6Sopenharmony_ci     * @param info Running lock info.
136c5e268c6Sopenharmony_ci     *
137c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful; returns <b>HDF_FAILED</b> if the
138c5e268c6Sopenharmony_ci     * running lock type conflicts with current lock.
139c5e268c6Sopenharmony_ci     *
140c5e268c6Sopenharmony_ci     * @since 4.0
141c5e268c6Sopenharmony_ci     */
142c5e268c6Sopenharmony_ci    HoldRunningLock([in] struct RunningLockInfo info);
143c5e268c6Sopenharmony_ci
144c5e268c6Sopenharmony_ci    /**
145c5e268c6Sopenharmony_ci     * @brief Unholds the running lock to unblock device hibernation.
146c5e268c6Sopenharmony_ci     *
147c5e268c6Sopenharmony_ci     * @param info Running lock info.
148c5e268c6Sopenharmony_ci     *
149c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
150c5e268c6Sopenharmony_ci     *
151c5e268c6Sopenharmony_ci     * @since 4.0
152c5e268c6Sopenharmony_ci     */
153c5e268c6Sopenharmony_ci    UnholdRunningLock([in] struct RunningLockInfo info);
154c5e268c6Sopenharmony_ci
155c5e268c6Sopenharmony_ci    /**
156c5e268c6Sopenharmony_ci     * @brief obtain system wakeup reason.
157c5e268c6Sopenharmony_ci     *
158c5e268c6Sopenharmony_ci     * @param info wakeup reason info.
159c5e268c6Sopenharmony_ci     *
160c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
161c5e268c6Sopenharmony_ci     *
162c5e268c6Sopenharmony_ci     * @since 4.1
163c5e268c6Sopenharmony_ci     */
164c5e268c6Sopenharmony_ci    GetWakeupReason([out] String reason);
165c5e268c6Sopenharmony_ci
166c5e268c6Sopenharmony_ci    /**
167c5e268c6Sopenharmony_ci     * @brief Holds the running lock to block device hibernation.
168c5e268c6Sopenharmony_ci     *
169c5e268c6Sopenharmony_ci     * @param extra Running lock info.
170c5e268c6Sopenharmony_ci     *
171c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful; returns <b>HDF_FAILED</b> if the
172c5e268c6Sopenharmony_ci     * running lock type conflicts with current lock.
173c5e268c6Sopenharmony_ci     *
174c5e268c6Sopenharmony_ci     * @since 4.1
175c5e268c6Sopenharmony_ci     * @deprecated
176c5e268c6Sopenharmony_ci     */
177c5e268c6Sopenharmony_ci    HoldRunningLockExt([in] struct RunningLockInfo info, [in] unsigned long lockid, [in] String bundleName);
178c5e268c6Sopenharmony_ci
179c5e268c6Sopenharmony_ci    /**
180c5e268c6Sopenharmony_ci     * @brief Unholds the running lock to unblock device hibernation.
181c5e268c6Sopenharmony_ci     *
182c5e268c6Sopenharmony_ci     * @param extra Running lock info.
183c5e268c6Sopenharmony_ci     *
184c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
185c5e268c6Sopenharmony_ci     *
186c5e268c6Sopenharmony_ci     * @since 4.1
187c5e268c6Sopenharmony_ci     * @deprecated
188c5e268c6Sopenharmony_ci     */
189c5e268c6Sopenharmony_ci    UnholdRunningLockExt([in] struct RunningLockInfo info, [in] unsigned long lockid, [in] String bundleName);
190c5e268c6Sopenharmony_ci
191c5e268c6Sopenharmony_ci    /**
192c5e268c6Sopenharmony_ci     * @brief Registers the callback of the running lock status.
193c5e268c6Sopenharmony_ci     *
194c5e268c6Sopenharmony_ci     * @param iPowerRunningLockCallback Callback to register.
195c5e268c6Sopenharmony_ci     *
196c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
197c5e268c6Sopenharmony_ci     * @see IPowerRunningLockCallback
198c5e268c6Sopenharmony_ci     *
199c5e268c6Sopenharmony_ci     * @since 4.1
200c5e268c6Sopenharmony_ci     * @deprecated
201c5e268c6Sopenharmony_ci     */
202c5e268c6Sopenharmony_ci    RegisterRunningLockCallback([in] IPowerRunningLockCallback iPowerRunningLockCallback);
203c5e268c6Sopenharmony_ci
204c5e268c6Sopenharmony_ci    /**
205c5e268c6Sopenharmony_ci     * @brief Unregister the callback of the running lock status.
206c5e268c6Sopenharmony_ci     *
207c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
208c5e268c6Sopenharmony_ci     *
209c5e268c6Sopenharmony_ci     * @since 4.1
210c5e268c6Sopenharmony_ci     * @deprecated
211c5e268c6Sopenharmony_ci     */
212c5e268c6Sopenharmony_ci    UnRegisterRunningLockCallback();
213c5e268c6Sopenharmony_ci
214c5e268c6Sopenharmony_ci    /**
215c5e268c6Sopenharmony_ci     * @brief Hibernate the device.
216c5e268c6Sopenharmony_ci     *
217c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
218c5e268c6Sopenharmony_ci     *
219c5e268c6Sopenharmony_ci     * @since 5.0
220c5e268c6Sopenharmony_ci     */
221c5e268c6Sopenharmony_ci    Hibernate();
222c5e268c6Sopenharmony_ci
223c5e268c6Sopenharmony_ci    /**
224c5e268c6Sopenharmony_ci     * @brief Set suspend tag before suspend.
225c5e268c6Sopenharmony_ci     * The special sleep mode supported by the kernel and hardware is triggered by setting a special
226c5e268c6Sopenharmony_ci     * suspend tag and then triggering suspend. If the suspend tag is not set, the standard S3 sleep
227c5e268c6Sopenharmony_ci     * mode is triggered when suspend.
228c5e268c6Sopenharmony_ci     *
229c5e268c6Sopenharmony_ci     * @param tag Suspend tag.
230c5e268c6Sopenharmony_ci     *
231c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
232c5e268c6Sopenharmony_ci     *
233c5e268c6Sopenharmony_ci     * @since 5.0
234c5e268c6Sopenharmony_ci     *
235c5e268c6Sopenharmony_ci     * @version 1.0
236c5e268c6Sopenharmony_ci     */
237c5e268c6Sopenharmony_ci    SetSuspendTag([in] String tag);
238c5e268c6Sopenharmony_ci}
239c5e268c6Sopenharmony_ci/** @} */
240