diff --git a/power/bundle.json b/power/bundle.json index 645696077e9c1cd357724c0412bde3e8711dea61..764f6962ca712f99b1715f59750d29671891c911 100644 --- a/power/bundle.json +++ b/power/bundle.json @@ -30,7 +30,8 @@ "build": { "sub_component": [ "//drivers/interface/power/v1_0:power_idl_target", - "//drivers/interface/power/v1_2:power_idl_target" + "//drivers/interface/power/v1_2:power_idl_target", + "//drivers/interface/power/v1_3:power_idl_target" ], "test": [ ], @@ -82,6 +83,30 @@ ], "header_base": "//drivers/interface/power" } + }, + { + "name": "//drivers/interface/power/v1_3:libpower_proxy_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/power" + } + }, + { + "name": "//drivers/interface/power/v1_3:libpower_stub_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/power" + } + }, + { + "name": "//drivers/interface/power/v1_3:power_idl_headers_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/power" + } } ] } diff --git a/power/v1_3/BUILD.gn b/power/v1_3/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..206a8e4f7593b81dcac5cf3ab08510bf4d40fb77 --- /dev/null +++ b/power/v1_3/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/components/hdi/hdi.gni") +if (defined(ohos_lite)) { + group("libpower_proxy_1.3") { + deps = [] + public_configs = [] + } +} else { + hdi("power") { + module_name = "power_interface_service" + + proxy_deps = [ "../v1_2:libpower_proxy_1.2" ] + stub_deps = [ "../v1_2:libpower_stub_1.2" ] + + sources = [ + "IPowerHdiCallbackExt.idl", + "IPowerInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_power" + } +} diff --git a/power/v1_3/IPowerHdiCallbackExt.idl b/power/v1_3/IPowerHdiCallbackExt.idl new file mode 100644 index 0000000000000000000000000000000000000000..09cc2f104d5a90bd2e0542de29498a832dfd9752 --- /dev/null +++ b/power/v1_3/IPowerHdiCallbackExt.idl @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup power + * @{ + * + * @brief Provides APIs for subscribing to the suspend/wakeup state with a tag. + * and managing running locks. + * + * After obtaining an object or proxy of this module, the power service can invoke related APIs to subscribe to the + * suspend/wakeup state. + * + * @since 6.0 + * @version 1.0 + */ + + /** + * @file IPowerHdiCallbackExt.idl + * + * @brief Provides the callbacks of the suspend/wakeup state with a tag. + * + * The power module provides callbacks for the power service to obtain the suspend/wakeup state with a tag. + * + * @since 6.0 + * @version 1.0 + */ + +package ohos.hdi.power.v1_3; + +/** + * @brief Represents the callbacks of the suspend/wakeup state with a tag. + * + * After creating a callback object, the power service can call {@link IPowerInterface} to subscribe to the + * suspend/wakeup state changes. + * + * This callback must be registered via RegisterPowerCallbackExt and unregistered via UnRegisterRunningLockCallback + * at {@link IPowerInterface}. + * + * @since 6.0 + * @version 1.0 + */ +[callback] interface IPowerHdiCallbackExt { + /** + * @brief Callback of the suspend state with a tag. + * + * This callback is used to notify the power service when the device enters the suspend state with a tag, and is + * an enhancement to old version interface OnSuspend. + * + * @param tag The suspend tag + * + * @since 6.0 + * @version 1.0 + */ + OnSuspendWithTag([in] String tag); + + /** + * @brief Callback of the wakeup state with a tag. + * + * This callback is used to notify the power service when the device enters the wakeup state with a tag, and is. + * an enhancement to old version interface OnWakeup. + * + * @param tag The wakeup tag + * + * @since 6.0 + * @version 1.0 + */ + OnWakeupWithTag([in] String tag); +} +/** @} */ diff --git a/power/v1_3/IPowerInterface.idl b/power/v1_3/IPowerInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..c6a1d0029e7e5a13d0f280a8b92db15fdca0a24b --- /dev/null +++ b/power/v1_3/IPowerInterface.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup power + * @{ + * + * @brief Provides APIs for performing suspend/wakeup operations, subscribing to the suspend/wakeup state, + * and managing running locks. + * + * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform + * suspend/wakeup operations, subscribe to the suspend/wakeup state, and manage running locks. + * + * @since 3.1 + * @version 1.1 + */ + +/** + * @file IPowerInterface.idl + * + * @brief Provides APIs for performing suspend/wakeup operations, subscribing to the suspend/wakeup state, + * and managing running locks. + * + * + * + * @since 3.1 + * @version 1.1 + */ + +package ohos.hdi.power.v1_3; + +import ohos.hdi.power.v1_2.IPowerInterface; +import ohos.hdi.power.v1_3.IPowerHdiCallbackExt; + +/** + * @brief Represents APIs for performing suspend/wakeup operations, subscribing to the suspend/wakeup state, + * and managing running locks. + * + * + * + * @since 3.1 + * @version 1.1 + */ +interface IPowerInterface extends ohos.hdi.power.v1_2.IPowerInterface { + /** + * @brief Registers the power callback of the suspend/wakeup state with a tag. + * + * @param ipowerHdiCallback Callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see IPowerHdiCallbackExt + * + * @since 6.0 + * @version 1.0 + */ + RegisterPowerCallbackExt([in] IPowerHdiCallbackExt ipowerHdiCallback); + + /** + * @brief Unregisters the power callback of the suspend/wakeup state with a tag. + * + * @param ipowerHdiCallback Callback to unregister. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see IPowerHdiCallbackExt + * + * @since 6.0 + * @version 1.0 + */ + UnRegisterPowerCallbackExt([in] IPowerHdiCallbackExt ipowerHdiCallback); +} +/** @} */ \ No newline at end of file