From 4e3173b69bd8506f9c9bfb1ef4ecd02477335dba Mon Sep 17 00:00:00 2001 From: aqxyjay Date: Thu, 2 Jun 2022 09:35:37 +0800 Subject: [PATCH 1/2] add battery/power/thermal hdi api docs Signed-off-by: aqxyjay --- zh-cn/device_api/hdi/battery/bundle.json | 42 ++++ zh-cn/device_api/hdi/battery/v1_0/BUILD.gn | 34 ++++ .../hdi/battery/v1_0/IBatteryCallback.idl | 52 +++++ .../hdi/battery/v1_0/IBatteryInterface.idl | 188 ++++++++++++++++++ zh-cn/device_api/hdi/battery/v1_0/Types.idl | 129 ++++++++++++ zh-cn/device_api/hdi/power/bundle.json | 42 ++++ zh-cn/device_api/hdi/power/v1_0/BUILD.gn | 34 ++++ .../hdi/power/v1_0/IPowerHdiCallback.idl | 51 +++++ .../hdi/power/v1_0/IPowerInterface.idl | 102 ++++++++++ .../device_api/hdi/power/v1_0/PowerTypes.idl | 80 ++++++++ zh-cn/device_api/hdi/thermal/bundle.json | 42 ++++ zh-cn/device_api/hdi/thermal/v1_0/BUILD.gn | 34 ++++ .../hdi/thermal/v1_0/IThermalCallback.idl | 51 +++++ .../hdi/thermal/v1_0/IThermalInterface.idl | 98 +++++++++ .../hdi/thermal/v1_0/ThermalTypes.idl | 54 +++++ 15 files changed, 1033 insertions(+) create mode 100644 zh-cn/device_api/hdi/battery/bundle.json create mode 100644 zh-cn/device_api/hdi/battery/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_0/Types.idl create mode 100644 zh-cn/device_api/hdi/power/bundle.json create mode 100644 zh-cn/device_api/hdi/power/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl create mode 100644 zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl create mode 100644 zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl create mode 100644 zh-cn/device_api/hdi/thermal/bundle.json create mode 100644 zh-cn/device_api/hdi/thermal/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl create mode 100644 zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl create mode 100644 zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl diff --git a/zh-cn/device_api/hdi/battery/bundle.json b/zh-cn/device_api/hdi/battery/bundle.json new file mode 100644 index 00000000..184c6ec1 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/bundle.json @@ -0,0 +1,42 @@ +{ + "name": "battery_device_driver_interface", + "description": "battery device driver interface", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "battery_device_driver_interface", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "675KB", + "ram": "1024KB", + "deps": { + "components": [ + "ipc", + "device_driver_framework", + "hiviewdfx_hilog_native", + "utils_base" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/interface/battery/v1_0:libbattery_proxy_1.0" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/battery/v1_0:libbattery_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/battery" + } + } + ] + } + } + } \ No newline at end of file diff --git a/zh-cn/device_api/hdi/battery/v1_0/BUILD.gn b/zh-cn/device_api/hdi/battery/v1_0/BUILD.gn new file mode 100644 index 00000000..bd7d764a --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022 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("//drivers/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libbattery_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("battery") { + module_name = "battery_interface_service" + + sources = [ + "IBatteryCallback.idl", + "IBatteryInterface.idl", + "Types.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "battery_device_driver" + } +} diff --git a/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl new file mode 100644 index 00000000..5f1eed9c --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2022 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 battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryCallback.idl + * + * @brief 订阅电池信息的回调接口。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.battery.v1_0; + +import ohos.hdi.battery.v1_0.Types; + +/** + * @brief 订阅电池信息的回调。 + */ +[callback] interface IBatteryCallback { + + /** + * @brief 订阅电池信息回调方法。 + * + * @param event 电池信息,如电量,电压,健康状态等。 + * @see BatteryInfo + */ + Update([in] struct BatteryInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl new file mode 100644 index 00000000..356552a7 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2022 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 battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryInterface.idl + * + * @brief 获取、订阅电池信息的接口。 + * + * @since 3.1 + * @version 1.0 + */ +package ohos.hdi.battery.v1_0; + +import ohos.hdi.battery.v1_0.Types; +import ohos.hdi.battery.v1_0.IBatteryCallback; + +/** + * @brief 获取、订阅电池信息的接口。 + */ +interface IBatteryInterface { + /** + * @brief 订阅电池信息变化。 + * + * @param event 输入参数, 注册回调类型{@link IBatteryCallback}。 + * + * @return HDF_SUCCESS 表示注册成功。 + */ + Register([in] IBatteryCallback event); + + /** + * @brief 取消订阅电池信息变化。 + * + * @return HDF_SUCCESS 表示取消订阅成功。 + */ + UnRegister(); + + /** + * @brief 设置电池信息节点的路径。 + * + * @param path 输入参数, 电池信息节点的路径。 + * + * @return HDF_SUCCESS 表示路径设置成功。 + */ + ChangePath([in] String path); + + /** + * @brief 获取电池的电量百分比。 + * + * @param capacity 输出参数, 表示电量的百分比值。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetCapacity([out] int capacity); + + /** + * @brief 获取电池的电压,单位微伏。 + * + * @param voltage 输出参数, 表示电池的电压。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetVoltage([out] int voltage); + + /** + * @brief 获取电池的充电温度,单位0.1摄氏度。 + * + * @param temperature 输出参数, 表示电池温度。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetTemperature([out] int temperature); + + /** + * @brief 获取电池的健康状态。 + * + * @param healthState 输出参数, 表示电池健康状态。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryHealthState + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief 获取充电设备类型。 + * + * @param pluggedType 输出参数, 表示充电设备类型。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryPluggedType + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief 获取充电状态。 + * + * @param chargeState 输出参数, 表示充电状态。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryChargeState + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief 获取是否支持电池或者电池是否在位。 + * + * @param present 输出参数, 表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetPresent([out] boolean present); + + /** + * @brief 获取当前电池的技术型号。 + * + * @param technology 输出参数, 当前电池技术型号。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetTechnology([out] String technology); + + /** + * @brief 获取当前电池的总容量,单位毫安时。 + * + * @param totalEnergy 输出参数,表示电池的总容量。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief 获取当前电池的平均电流,单位毫安。 + * + * @param totalEnergy 输出参数,表示电池的平均电流。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief 获取当前电池的电流,单位毫安。 + * + * @param curNow 输出参数,表示电池的实时电流。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief 获取当前电池的剩余容量,单位毫安时。 + * + * @param remainEnergy 输出参数,表示电池的剩余容量。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @brief 获取当前电池的全部信息。 + * + * @param info 输出参数,电池的全部信息。 + * + * @return HDF_SUCCESS 表示获取成功。 + */ + GetBatteryInfo([out] struct BatteryInfo info); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_0/Types.idl b/zh-cn/device_api/hdi/battery/v1_0/Types.idl new file mode 100644 index 00000000..1ae95aab --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/Types.idl @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2022 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 battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file Types.idl + * + * @brief 电池信息相关数据类型。 + * + * 电池信息中使用的数据类型, 包括健康状态,充电状态,充电设备类型和电池信息结构。 + * + * @since 3.1 + * @version 1.0 + */ +package ohos.hdi.battery.v1_0; + + +/** + * @brief 电池的健康状态 + */ +enum BatteryHealthState +{ + /** 表示电池健康状态未知 */ + BATTERY_HEALTH_UNKNOWN = 0, + /** 表示电池健康状态为正常 */ + BATTERY_HEALTH_GOOD, + /** 表示电池健康状态为过热 */ + BATTERY_HEALTH_OVERHEAT, + /** 表示电池健康状态为过压 */ + BATTERY_HEALTH_OVERVOLTAGE, + /** 表示电池健康状态为低温 */ + BATTERY_HEALTH_COLD, + /** 表示电池健康状态为僵死 */ + BATTERY_HEALTH_DEAD, + /** 保留位 */ + BATTERY_HEALTH_RESERVED, +}; + +/** + * @brief 电池的充电状态 + */ +enum BatteryChargeState +{ + /** 表示电池充电状态未知 */ + CHARGE_STATE_NONE = 0, + /** 表示电池充电状态为使能状态 */ + CHARGE_STATE_ENABLE, + /** 表示电池充电状态为停止状态 */ + CHARGE_STATE_DISABLE, + /** 表示电池充电状态为已充满状态 */ + CHARGE_STATE_FULL, + /** 保留位 */ + CHARGE_STATE_RESERVED, +}; + +/** + * @brief 电池的充电设备类型 + */ +enum BatteryPluggedType +{ + /** 表示连接充电器类型未知 */ + PLUGGED_TYPE_NONE = 0, + /** 表示连接的充电器类型为交流充电器 */ + PLUGGED_TYPE_AC, + /** 表示连接的充电器类型为USB */ + PLUGGED_TYPE_USB, + /** 表示连接的充电器类型为无线充电器 */ + PLUGGED_TYPE_WIRELESS, + /** 截止位 */ + PLUGGED_TYPE_BUTT +}; + +/** + * @brief 电池相关信息 + */ +struct BatteryInfo { + /** 表示电池的电量百分比 */ + int capacity; + /** 表示电池的电压 */ + int voltage; + /** 表示电池的温度 */ + int temperature; + /** 表示电池的健康状态 */ + int healthState; + /** 表示电池的充电设备类型 */ + int pluggedType; + /** 表示电池的最大充电电流 */ + int pluggedMaxCurrent; + /** 表示电池的最大充电电压 */ + int pluggedMaxVoltage; + /** 表示电池的充电状态 */ + int chargeState; + /** 表示电池的充电次数 */ + int chargeCounter; + /** 表示电池的总容量 */ + int totalEnergy; + /** 表示电池的平均电流 */ + int curAverage; + /** 表示电池的实时电流 */ + int curNow; + /** 表示电池的剩余容量 */ + int remainEnergy; + /** 表示是否支持电池或者电池是否在位 */ + byte present; + /** 表示电池的技术型号 */ + String technology; +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/power/bundle.json b/zh-cn/device_api/hdi/power/bundle.json new file mode 100644 index 00000000..e0b25b0a --- /dev/null +++ b/zh-cn/device_api/hdi/power/bundle.json @@ -0,0 +1,42 @@ +{ + "name": "power_device_driver_interface", + "description": "power device driver interface", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "power_device_driver_interface", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "675KB", + "ram": "1024KB", + "deps": { + "components": [ + "ipc", + "device_driver_framework", + "hiviewdfx_hilog_native", + "utils_base" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/interface/power/v1_0:libpower_proxy_1.0" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/power/v1_0:libpower_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/power" + } + } + ] + } + } + } \ No newline at end of file diff --git a/zh-cn/device_api/hdi/power/v1_0/BUILD.gn b/zh-cn/device_api/hdi/power/v1_0/BUILD.gn new file mode 100644 index 00000000..7e0c9496 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2021 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("//drivers/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libpower_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("power") { + module_name = "power_interface_service" + + sources = [ + "IPowerHdiCallback.idl", + "IPowerInterface.idl", + "PowerTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "power_device_driver" + } +} diff --git a/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl b/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl new file mode 100644 index 00000000..07a26788 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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 提供休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file IPowerHdiCallback.idl + * + * @brief 订阅休眠唤醒状态的回调。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_0; + +/** + * @brief 订阅休眠唤醒状态的回调。 + */ +[callback] interface IPowerHdiCallback { + /** + * @brief 休眠状态的回调接口。 + */ + OnSuspend(); + + /** + * @brief 唤醒状态的回调接口。 + */ + OnWakeup(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl new file mode 100644 index 00000000..ca0d1988 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2022 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 提供休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file IPowerInterface.idl + * + * @brief 休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_0; + +import ohos.hdi.power.v1_0.IPowerHdiCallback; +import ohos.hdi.power.v1_0.PowerTypes; + +/** + * @brief 休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + */ +interface IPowerInterface { + /** + * @brief 订阅休眠唤醒状态。 + * + * @param ipowerHdiCallback 输入参数, 注册的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see IPowerHdiCallback + */ + RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback); + + /** + * @brief 执行设备休眠操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + */ + StartSuspend(); + + /** + * @brief 执行设备唤醒操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + */ + StopSuspend(); + + /** + * @brief 执行设备强制休眠操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + */ + ForceSuspend(); + + /** + * @brief 打开运行锁,阻止休眠。 + * + * @param name 输入参数, 运行锁的名称。 + * + * @return HDF_SUCCESS 表示操作成功。 + */ + SuspendBlock([in] String name); + + /** + * @brief 关闭运行锁,取消阻止休眠。 + * + * @param name 输入参数, 运行锁的名称。 + * + * @return HDF_SUCCESS 表示操作成功。 + */ + SuspendUnblock([in] String name); + + /** + * @brief 获取电源的Dump信息。 + * + * @param info 输出参数, 电源的Dump信息。 + * + * @return HDF_SUCCESS 表示操作成功。 + */ + PowerDump([out] String info); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl b/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl new file mode 100644 index 00000000..2999c09e --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2022 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 提供休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file PowerTypes.idl + * + * @brief 电源相关的数据类型。 + * + * 电源管理中使用的数据类型, 包括命令参数、回调参数和系统状态。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_0; + +/** + * @brief 电源的枚举命令参数。 + */ +enum PowerHdfCmd { + /** 订阅状态的命令参数 */ + CMD_REGISTER_CALLBCK = 0, + /** 休眠的命令参数 */ + CMD_START_SUSPEND, + /** 唤醒的命令参数 */ + CMD_STOP_SUSPEND, + /** 强制休眠的命令参数 */ + CMD_FORCE_SUSPEND, + /** 打开运行锁的命令参数 */ + CMD_SUSPEND_BLOCK, + /** 关闭运行锁的命令参数 */ + CMD_SUSPEND_UNBLOCK, + /** Dump的命令参数 */ + CMD_DUMP, +}; + +/** + * @brief 电源状态回调的枚举参数。 + */ +enum PowerHdfCallbackCmd { + /** 休眠回调的命令参数 */ + CMD_ON_SUSPEND = 0, + /** 唤醒回调的命令参数 */ + CMD_ON_WAKEUP, +}; + +/** + * @brief 电源的状态。 + */ +enum PowerHdfState { + /** 唤醒状态 */ + AWAKE = 0, + /** 非活动状态 */ + INACTIVE, + /** 休眠状态 */ + SLEEP, +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/bundle.json b/zh-cn/device_api/hdi/thermal/bundle.json new file mode 100644 index 00000000..6e30395a --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/bundle.json @@ -0,0 +1,42 @@ +{ + "name": "thermal_device_driver_interface", + "description": "thermal device driver interface", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "thermal_device_driver_interface", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "675KB", + "ram": "1024KB", + "deps": { + "components": [ + "ipc", + "device_driver_framework", + "hiviewdfx_hilog_native", + "utils_base" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/interface/thermal/v1_0:libthermal_proxy_1.0" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/thermal/v1_0:libthermal_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/thermal" + } + } + ] + } + } + } \ No newline at end of file diff --git a/zh-cn/device_api/hdi/thermal/v1_0/BUILD.gn b/zh-cn/device_api/hdi/thermal/v1_0/BUILD.gn new file mode 100644 index 00000000..0a33f8ec --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022 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("//drivers/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libthermal_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("thermal") { + module_name = "thermal_interface_service" + + sources = [ + "IThermalCallback.idl", + "IThermalInterface.idl", + "ThermalTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "thermal_device_driver" + } +} diff --git a/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl b/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl new file mode 100644 index 00000000..0f9c5d4a --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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 thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file IThermalCallback.idl + * + * @brief 订阅设备发热状态的回调。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.thermal.v1_0; + +import ohos.hdi.thermal.v1_0.ThermalTypes; + +/** + * @brief 订阅设备发热状态的回调。 + */ +[callback] interface IThermalCallback { + /** + * @brief 设备发热状态变化的回调接口。 + * + * @param event 输入参数, 设备发热信息。 + * @see HdfThermalCallbackInfo + */ + OnThermalDataEvent([in] struct HdfThermalCallbackInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl new file mode 100644 index 00000000..e2395513 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2022 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 thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IThermalInterface.idl + * + * @brief 温度管理、控制及订阅接口。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.thermal.v1_0; + +import ohos.hdi.thermal.v1_0.ThermalTypes; +import ohos.hdi.thermal.v1_0.IThermalCallback; + +/** + * @brief 温度管理、控制及订阅接口。 + */ +interface IThermalInterface { + /** + * @brief 设置CPU频率。 + * + * @param freq 输入参数,设置CPU频率的值。 + * + * @return HDF_SUCCESS 表示设置成功。 + */ + SetCpuFreq([in] int freq); + + /** + * @brief 设置GPU频率。 + * + * @param freq 输入参数,设置GPU频率的值。 + * + * @return HDF_SUCCESS 表示设置成功。 + */ + SetGpuFreq([in] int freq); + + /** + * @brief 设置充电电流,单位毫安。 + * + * @param current 输入参数,充电电流。 + * + * @return HDF_SUCCESS 表示设置成功 + */ + SetBatteryCurrent([in] int current); + + /** + * @brief 获取设备发热的信息。 + * + * @param event 输出参数, 设备发热信息。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see HdfThermalCallbackInfo + */ + GetThermalZoneInfo([out] struct HdfThermalCallbackInfo event); + + /** + * @brief 订阅设备发热状态。 + * + * @param callbackObj 输入参数, 发热状态回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see IThermalCallback + */ + Register([in] IThermalCallback callbackObj); + + /** + * @brief 取消订阅设备发热状态。 + * + * @return HDF_SUCCESS 表示取消成功 + */ + Unregister(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl b/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl new file mode 100644 index 00000000..a151c68d --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 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 thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file ThermalTypes.idl + * + * @brief 设备发热状态相关的数据类型。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.thermal.v1_0; + +/** + * @brief 设备发热的信息。 + */ +struct ThermalZoneInfo { + /** 发热器件的类型 */ + String type; + /** 期间的温度值 */ + int temp; +}; + +/** + * @brief 设备发热的信息列表。 + */ +struct HdfThermalCallbackInfo { + /** 设备发热的信息列表 */ + List info; +}; +/** @} */ -- Gitee From d354ba1a821839b5829f4b46689a6c6d2bb34638 Mon Sep 17 00:00:00 2001 From: aqxyjay Date: Tue, 7 Jun 2022 18:19:45 +0800 Subject: [PATCH 2/2] modify as review Signed-off-by: aqxyjay --- .../hdi/battery/v1_0/IBatteryCallback.idl | 19 +++- .../hdi/battery/v1_0/IBatteryInterface.idl | 88 ++++++++++++++----- zh-cn/device_api/hdi/battery/v1_0/Types.idl | 83 +++++++++-------- .../hdi/power/v1_0/IPowerHdiCallback.idl | 27 ++++-- .../hdi/power/v1_0/IPowerInterface.idl | 41 +++++++-- .../device_api/hdi/power/v1_0/PowerTypes.idl | 29 +++--- .../hdi/thermal/v1_0/IThermalCallback.idl | 27 ++++-- .../hdi/thermal/v1_0/IThermalInterface.idl | 39 ++++++-- .../hdi/thermal/v1_0/ThermalTypes.idl | 17 +++- 9 files changed, 264 insertions(+), 106 deletions(-) diff --git a/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl index 5f1eed9c..f4c6b6fe 100644 --- a/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl @@ -19,6 +19,9 @@ * * @brief 提供获取、订阅电池信息的接口。 * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * * @since 3.1 * @version 1.0 */ @@ -26,7 +29,9 @@ /** * @file IBatteryCallback.idl * - * @brief 订阅电池信息的回调接口。 + * @brief 电池信息的回调。 + * + * 电池模块为电池服务提供的订阅电池信息变化的回调。 * * @since 3.1 * @version 1.0 @@ -37,15 +42,23 @@ package ohos.hdi.battery.v1_0; import ohos.hdi.battery.v1_0.Types; /** - * @brief 订阅电池信息的回调。 + * @brief 电池信息的回调。 + * + * 服务创建此回调对象后,可以调用{@link IBatteryInterface}的接口注册回调,从而订阅电池信息的变化。 + * + * @since 3.1 */ [callback] interface IBatteryCallback { /** - * @brief 订阅电池信息回调方法。 + * @brief 电池信息的回调方法。 + * + * 当电池信息发生变化时,将通过此方法的参数返回给服务。 * * @param event 电池信息,如电量,电压,健康状态等。 * @see BatteryInfo + * + * @since 3.1 */ Update([in] struct BatteryInfo event); } diff --git a/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl index 356552a7..873cca92 100644 --- a/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl @@ -19,6 +19,9 @@ * * @brief 提供获取、订阅电池信息的接口。 * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * * @since 3.1 * @version 1.0 */ @@ -28,6 +31,8 @@ * * @brief 获取、订阅电池信息的接口。 * + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * * @since 3.1 * @version 1.0 */ @@ -38,150 +43,187 @@ import ohos.hdi.battery.v1_0.IBatteryCallback; /** * @brief 获取、订阅电池信息的接口。 + * + * 服务获取此对象后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.1 */ interface IBatteryInterface { /** - * @brief 订阅电池信息变化。 + * @brief 注册电池信息的回调。 * - * @param event 输入参数, 注册回调类型{@link IBatteryCallback}。 + * @param event 输入参数,服务注册的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 */ Register([in] IBatteryCallback event); /** - * @brief 取消订阅电池信息变化。 + * @brief 取消注册电池信息的回调。 * - * @return HDF_SUCCESS 表示取消订阅成功。 + * @return HDF_SUCCESS 表示取消注册成功。 + * + * @since 3.1 */ UnRegister(); /** * @brief 设置电池信息节点的路径。 * - * @param path 输入参数, 电池信息节点的路径。 + * @param path 输入参数,电池信息节点的路径。 * * @return HDF_SUCCESS 表示路径设置成功。 + * + * @since 3.1 */ ChangePath([in] String path); /** * @brief 获取电池的电量百分比。 * - * @param capacity 输出参数, 表示电量的百分比值。 + * @param capacity 输出参数,表示电量的百分比值。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetCapacity([out] int capacity); /** * @brief 获取电池的电压,单位微伏。 * - * @param voltage 输出参数, 表示电池的电压。 + * @param voltage 输出参数,表示电池的电压。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetVoltage([out] int voltage); /** * @brief 获取电池的充电温度,单位0.1摄氏度。 * - * @param temperature 输出参数, 表示电池温度。 + * @param temperature 输出参数,表示电池温度。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetTemperature([out] int temperature); /** * @brief 获取电池的健康状态。 * - * @param healthState 输出参数, 表示电池健康状态。 + * @param healthState 输出参数,表示电池健康状态。 * * @return HDF_SUCCESS 表示获取成功。 * @see BatteryHealthState + * + * @since 3.1 */ GetHealthState([out] enum BatteryHealthState healthState); /** * @brief 获取充电设备类型。 * - * @param pluggedType 输出参数, 表示充电设备类型。 + * @param pluggedType 输出参数,表示充电设备类型。 * * @return HDF_SUCCESS 表示获取成功。 * @see BatteryPluggedType + * + * @since 3.1 */ GetPluggedType([out] enum BatteryPluggedType pluggedType); /** * @brief 获取充电状态。 * - * @param chargeState 输出参数, 表示充电状态。 + * @param chargeState 输出参数,表示充电状态。 * * @return HDF_SUCCESS 表示获取成功。 * @see BatteryChargeState + * + * @since 3.1 */ GetChargeState([out] enum BatteryChargeState chargeState); /** * @brief 获取是否支持电池或者电池是否在位。 * - * @param present 输出参数, 表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * @param present 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetPresent([out] boolean present); /** - * @brief 获取当前电池的技术型号。 + * @brief 获取电池的技术型号。 * - * @param technology 输出参数, 当前电池技术型号。 + * @param technology 输出参数,当前电池技术型号。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetTechnology([out] String technology); /** - * @brief 获取当前电池的总容量,单位毫安时。 + * @brief 获取电池的总容量。 * - * @param totalEnergy 输出参数,表示电池的总容量。 + * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetTotalEnergy([out] int totalEnergy); /** - * @brief 获取当前电池的平均电流,单位毫安。 + * @brief 获取电池的平均电流。 * - * @param totalEnergy 输出参数,表示电池的平均电流。 + * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetCurrentAverage([out] int curAverage); /** - * @brief 获取当前电池的电流,单位毫安。 + * @brief 获取电池的电流。 * - * @param curNow 输出参数,表示电池的实时电流。 + * @param curNow 输出参数,表示电池的实时电流,单位毫安。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetCurrentNow([out] int curNow); /** - * @brief 获取当前电池的剩余容量,单位毫安时。 + * @brief 获取电池的剩余容量。 * - * @param remainEnergy 输出参数,表示电池的剩余容量。 + * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 */ GetRemainEnergy([out] int remainEnergy); /** - * @brief 获取当前电池的全部信息。 + * @brief 获取电池的全部信息。 * * @param info 输出参数,电池的全部信息。 * * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryInfo + * + * @since 3.1 */ GetBatteryInfo([out] struct BatteryInfo info); } diff --git a/zh-cn/device_api/hdi/battery/v1_0/Types.idl b/zh-cn/device_api/hdi/battery/v1_0/Types.idl index 1ae95aab..527c1cf4 100644 --- a/zh-cn/device_api/hdi/battery/v1_0/Types.idl +++ b/zh-cn/device_api/hdi/battery/v1_0/Types.idl @@ -19,6 +19,9 @@ * * @brief 提供获取、订阅电池信息的接口。 * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取电池信息、订阅电池信息的变化。 + * * @since 3.1 * @version 1.0 */ @@ -28,7 +31,7 @@ * * @brief 电池信息相关数据类型。 * - * 电池信息中使用的数据类型, 包括健康状态,充电状态,充电设备类型和电池信息结构。 + * 电池信息中使用的数据类型,包括健康状态、充电状态、充电设备类型和电池信息结构。 * * @since 3.1 * @version 1.0 @@ -37,93 +40,101 @@ package ohos.hdi.battery.v1_0; /** - * @brief 电池的健康状态 + * @brief 电池的健康状态。 + * + * @since 3.1 */ enum BatteryHealthState { - /** 表示电池健康状态未知 */ + /** 表示电池健康状态未知。 */ BATTERY_HEALTH_UNKNOWN = 0, - /** 表示电池健康状态为正常 */ + /** 表示电池健康状态为正常。 */ BATTERY_HEALTH_GOOD, - /** 表示电池健康状态为过热 */ + /** 表示电池健康状态为过热。 */ BATTERY_HEALTH_OVERHEAT, - /** 表示电池健康状态为过压 */ + /** 表示电池健康状态为过压。 */ BATTERY_HEALTH_OVERVOLTAGE, - /** 表示电池健康状态为低温 */ + /** 表示电池健康状态为低温。 */ BATTERY_HEALTH_COLD, - /** 表示电池健康状态为僵死 */ + /** 表示电池健康状态为耗尽。 */ BATTERY_HEALTH_DEAD, - /** 保留位 */ + /** 预留。 */ BATTERY_HEALTH_RESERVED, }; /** - * @brief 电池的充电状态 + * @brief 电池的充电状态。 + * + * @since 3.1 */ enum BatteryChargeState { - /** 表示电池充电状态未知 */ + /** 表示电池充电状态未知。 */ CHARGE_STATE_NONE = 0, - /** 表示电池充电状态为使能状态 */ + /** 表示电池充电状态为使能状态。 */ CHARGE_STATE_ENABLE, - /** 表示电池充电状态为停止状态 */ + /** 表示电池充电状态为停止状态。 */ CHARGE_STATE_DISABLE, - /** 表示电池充电状态为已充满状态 */ + /** 表示电池充电状态为已充满状态。 */ CHARGE_STATE_FULL, - /** 保留位 */ + /** 预留。 */ CHARGE_STATE_RESERVED, }; /** - * @brief 电池的充电设备类型 + * @brief 电池的充电设备类型。 + * + * @since 3.1 */ enum BatteryPluggedType { - /** 表示连接充电器类型未知 */ + /** 表示连接充电器类型未知。 */ PLUGGED_TYPE_NONE = 0, - /** 表示连接的充电器类型为交流充电器 */ + /** 表示连接的充电器类型为交流充电器。 */ PLUGGED_TYPE_AC, - /** 表示连接的充电器类型为USB */ + /** 表示连接的充电器类型为USB充电器。 */ PLUGGED_TYPE_USB, - /** 表示连接的充电器类型为无线充电器 */ + /** 表示连接的充电器类型为无线充电器。 */ PLUGGED_TYPE_WIRELESS, - /** 截止位 */ + /** 预留。 */ PLUGGED_TYPE_BUTT }; /** - * @brief 电池相关信息 + * @brief 电池相关信息。 + * + * @since 3.1 */ struct BatteryInfo { - /** 表示电池的电量百分比 */ + /** 表示电池的电量百分比。 */ int capacity; - /** 表示电池的电压 */ + /** 表示电池的电压。 */ int voltage; /** 表示电池的温度 */ int temperature; - /** 表示电池的健康状态 */ + /** 表示电池的健康状态。 */ int healthState; - /** 表示电池的充电设备类型 */ + /** 表示电池的充电设备类型。 */ int pluggedType; - /** 表示电池的最大充电电流 */ + /** 表示电池的最大充电电流。 */ int pluggedMaxCurrent; - /** 表示电池的最大充电电压 */ + /** 表示电池的最大充电电压。 */ int pluggedMaxVoltage; - /** 表示电池的充电状态 */ + /** 表示电池的充电状态。 */ int chargeState; - /** 表示电池的充电次数 */ + /** 表示电池的充电次数。 */ int chargeCounter; - /** 表示电池的总容量 */ + /** 表示电池的总容量。 */ int totalEnergy; - /** 表示电池的平均电流 */ + /** 表示电池的平均电流。 */ int curAverage; - /** 表示电池的实时电流 */ + /** 表示电池的实时电流。 */ int curNow; - /** 表示电池的剩余容量 */ + /** 表示电池的剩余容量。 */ int remainEnergy; - /** 表示是否支持电池或者电池是否在位 */ + /** 表示是否支持电池或者电池是否在位。 */ byte present; - /** 表示电池的技术型号 */ + /** 表示电池的技术型号。 */ String technology; }; /** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl b/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl index 07a26788..a7aa87ff 100644 --- a/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl @@ -17,7 +17,10 @@ * @addtogroup power * @{ * - * @brief 提供休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 * * @since 3.1 * @version 1.0 @@ -26,7 +29,9 @@ /** * @file IPowerHdiCallback.idl * - * @brief 订阅休眠唤醒状态的回调。 + * @brief 休眠/唤醒状态的回调。 + * + * 电源模块为电源服务提供的订阅休眠/唤醒状态的回调。 * * @since 3.1 * @version 1.0 @@ -35,16 +40,28 @@ package ohos.hdi.power.v1_0; /** - * @brief 订阅休眠唤醒状态的回调。 + * @brief 休眠/唤醒状态的回调。 + * + * 服务创建此回调对象后,可以调用{@link IPowerInterface}的接口注册回调,从而订阅休眠/唤醒状态的变化。 + * + * @since 3.1 */ [callback] interface IPowerHdiCallback { /** - * @brief 休眠状态的回调接口。 + * @brief 休眠状态的回调方法。 + * + * 当设备进入休眠状态时,将通过此方法通知给服务。 + * + * @since 3.1 */ OnSuspend(); /** - * @brief 唤醒状态的回调接口。 + * @brief 唤醒状态的回调方法。 + * + * 当设备进入唤醒状态时,将通过此方法通知给服务。 + * + * @since 3.1 */ OnWakeup(); } diff --git a/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl index ca0d1988..85e53088 100644 --- a/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl @@ -17,16 +17,21 @@ * @addtogroup power * @{ * - * @brief 提供休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 * * @since 3.1 * @version 1.0 */ - /** +/** * @file IPowerInterface.idl * - * @brief 休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * @brief 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 * * @since 3.1 * @version 1.0 @@ -38,16 +43,22 @@ import ohos.hdi.power.v1_0.IPowerHdiCallback; import ohos.hdi.power.v1_0.PowerTypes; /** - * @brief 休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * @brief 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 服务获取此对象后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + * + * @since 3.1 */ interface IPowerInterface { /** - * @brief 订阅休眠唤醒状态。 + * @brief 注册休眠/唤醒状态的回调。 * - * @param ipowerHdiCallback 输入参数, 注册的回调。 + * @param ipowerHdiCallback 输入参数,服务注册的回调。 * * @return HDF_SUCCESS 表示注册成功。 * @see IPowerHdiCallback + * + * @since 3.1 */ RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback); @@ -55,6 +66,8 @@ interface IPowerInterface { * @brief 执行设备休眠操作。 * * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 */ StartSuspend(); @@ -62,6 +75,8 @@ interface IPowerInterface { * @brief 执行设备唤醒操作。 * * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 */ StopSuspend(); @@ -69,33 +84,41 @@ interface IPowerInterface { * @brief 执行设备强制休眠操作。 * * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 */ ForceSuspend(); /** * @brief 打开运行锁,阻止休眠。 * - * @param name 输入参数, 运行锁的名称。 + * @param name 输入参数,运行锁的名称。 * * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 */ SuspendBlock([in] String name); /** * @brief 关闭运行锁,取消阻止休眠。 * - * @param name 输入参数, 运行锁的名称。 + * @param name 输入参数,运行锁的名称。 * * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 */ SuspendUnblock([in] String name); /** * @brief 获取电源的Dump信息。 * - * @param info 输出参数, 电源的Dump信息。 + * @param info 输出参数,电源的Dump信息。 * * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 */ PowerDump([out] String info); } diff --git a/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl b/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl index 2999c09e..9300c3ff 100644 --- a/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl +++ b/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl @@ -17,7 +17,10 @@ * @addtogroup power * @{ * - * @brief 提供休眠唤醒操作、订阅休眠唤醒状态、运行锁管理的接口。 + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 * * @since 3.1 * @version 1.0 @@ -28,7 +31,7 @@ * * @brief 电源相关的数据类型。 * - * 电源管理中使用的数据类型, 包括命令参数、回调参数和系统状态。 + * 电源管理中使用的数据类型,包括命令参数、回调参数和系统状态。 * * @since 3.1 * @version 1.0 @@ -37,7 +40,9 @@ package ohos.hdi.power.v1_0; /** - * @brief 电源的枚举命令参数。 + * @brief 枚举电源命令的参数。 + * + * @since 3.1 */ enum PowerHdfCmd { /** 订阅状态的命令参数 */ @@ -57,24 +62,28 @@ enum PowerHdfCmd { }; /** - * @brief 电源状态回调的枚举参数。 + * @brief 枚举电源状态回调的参数。 + * + * @since 3.1 */ enum PowerHdfCallbackCmd { - /** 休眠回调的命令参数 */ + /** 休眠回调的命令参数。 */ CMD_ON_SUSPEND = 0, - /** 唤醒回调的命令参数 */ + /** 唤醒回调的命令参数。 */ CMD_ON_WAKEUP, }; /** - * @brief 电源的状态。 + * @brief 枚举电源的状态。 + * + * @since 3.1 */ enum PowerHdfState { - /** 唤醒状态 */ + /** 唤醒状态。 */ AWAKE = 0, - /** 非活动状态 */ + /** 非活动状态。 */ INACTIVE, - /** 休眠状态 */ + /** 休眠状态。 */ SLEEP, }; /** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl b/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl index 0f9c5d4a..53bbcb25 100644 --- a/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl @@ -19,14 +19,19 @@ * * @brief 提供设备温度管理、控制及订阅接口。 * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * * @since 3.1 * @version 1.0 */ - /** +/** * @file IThermalCallback.idl * - * @brief 订阅设备发热状态的回调。 + * @brief 设备发热状态的回调。 + * + * 热模块为热服务提供的设备发热状态的回调。 * * @since 3.1 * @version 1.0 @@ -38,14 +43,22 @@ import ohos.hdi.thermal.v1_0.ThermalTypes; /** * @brief 订阅设备发热状态的回调。 + * + * 服务创建此回调对象后,可以调用{@link IThermalInterface}的接口注册回调,从而订阅设备发热状态的变化。 + * + * @since 3.1 */ [callback] interface IThermalCallback { /** - * @brief 设备发热状态变化的回调接口。 - * - * @param event 输入参数, 设备发热信息。 - * @see HdfThermalCallbackInfo - */ + * @brief 设备发热状态变化的回调方法。 + * + * 当设备发热状态发生变化时,将通过此方法的参数返回给服务。 + * + * @param event 输入参数,设备发热信息,包括器件类型、器件温度。 + * @see HdfThermalCallbackInfo + * + * @since 3.1 + */ OnThermalDataEvent([in] struct HdfThermalCallbackInfo event); } /** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl index e2395513..d06046e8 100644 --- a/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl @@ -19,6 +19,9 @@ * * @brief 提供设备温度管理、控制及订阅接口。 * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * * @since 3.1 * @version 1.0 */ @@ -26,7 +29,9 @@ /** * @file IThermalInterface.idl * - * @brief 温度管理、控制及订阅接口。 + * @brief 设备温度管理、控制及订阅接口。 + * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 * * @since 3.1 * @version 1.0 @@ -38,7 +43,11 @@ import ohos.hdi.thermal.v1_0.ThermalTypes; import ohos.hdi.thermal.v1_0.IThermalCallback; /** - * @brief 温度管理、控制及订阅接口。 + * @brief 设备温度管理、控制及订阅接口。 + * + * 服务获取此对象后,可以调用相关的接口管理、控制和订阅设备温度。 + * + * @since 3.1 */ interface IThermalInterface { /** @@ -47,6 +56,8 @@ interface IThermalInterface { * @param freq 输入参数,设置CPU频率的值。 * * @return HDF_SUCCESS 表示设置成功。 + * + * @since 3.1 */ SetCpuFreq([in] int freq); @@ -56,42 +67,52 @@ interface IThermalInterface { * @param freq 输入参数,设置GPU频率的值。 * * @return HDF_SUCCESS 表示设置成功。 + * + * @since 3.1 */ SetGpuFreq([in] int freq); /** - * @brief 设置充电电流,单位毫安。 + * @brief 设置充电电流。 * - * @param current 输入参数,充电电流。 + * @param current 输入参数,充电电流,单位毫安。 * * @return HDF_SUCCESS 表示设置成功 + * + * @since 3.1 */ SetBatteryCurrent([in] int current); /** * @brief 获取设备发热的信息。 * - * @param event 输出参数, 设备发热信息。 + * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 * * @return HDF_SUCCESS 表示获取成功。 * @see HdfThermalCallbackInfo + * + * @since 3.1 */ GetThermalZoneInfo([out] struct HdfThermalCallbackInfo event); /** - * @brief 订阅设备发热状态。 + * @brief 注册设备发热状态的回调。 * - * @param callbackObj 输入参数, 发热状态回调。 + * @param callbackObj 输入参数,服务注册的回调。 * * @return HDF_SUCCESS 表示注册成功。 * @see IThermalCallback + * + * @since 3.1 */ Register([in] IThermalCallback callbackObj); /** - * @brief 取消订阅设备发热状态。 + * @brief 取消注册设备发热状态的回调。 + * + * @return HDF_SUCCESS 表示取消注册成功。 * - * @return HDF_SUCCESS 表示取消成功 + * @since 3.1 */ Unregister(); } diff --git a/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl b/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl index a151c68d..554d2994 100644 --- a/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl +++ b/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl @@ -19,15 +19,20 @@ * * @brief 提供设备温度管理、控制及订阅接口。 * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * * @since 3.1 * @version 1.0 */ - /** +/** * @file ThermalTypes.idl * * @brief 设备发热状态相关的数据类型。 * + * 热管理中使用的数据类型,包括设备发热的信息和设备发热的信息列表。 + * * @since 3.1 * @version 1.0 */ @@ -36,19 +41,23 @@ package ohos.hdi.thermal.v1_0; /** * @brief 设备发热的信息。 + * + * @since 3.1 */ struct ThermalZoneInfo { - /** 发热器件的类型 */ + /** 发热器件的类型。 */ String type; - /** 期间的温度值 */ + /** 器件的温度值。 */ int temp; }; /** * @brief 设备发热的信息列表。 + * + * @since 3.1 */ struct HdfThermalCallbackInfo { - /** 设备发热的信息列表 */ + /** 设备发热的信息列表。 */ List info; }; /** @} */ -- Gitee