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 0000000000000000000000000000000000000000..184c6ec18571bbbcbfee29c3bb33742f6246b1c2 --- /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 0000000000000000000000000000000000000000..bd7d764ac00815ef7cfdb3c2468d699867247b0e --- /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 0000000000000000000000000000000000000000..f4c6b6fe3d39532530b462b1e6b46e5b19db0da9 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryCallback.idl @@ -0,0 +1,65 @@ +/* + * 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 电池信息的回调。 + * + * 服务创建此回调对象后,可以调用{@link IBatteryInterface}的接口注册回调,从而订阅电池信息的变化。 + * + * @since 3.1 + */ +[callback] interface IBatteryCallback { + + /** + * @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 new file mode 100644 index 0000000000000000000000000000000000000000..873cca929c9e9fdfb53b072f832d2081e471fb4f --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl @@ -0,0 +1,230 @@ +/* + * 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 获取、订阅电池信息的接口。 + * + * 服务获取此对象后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.1 + */ +interface IBatteryInterface { + /** + * @brief 注册电池信息的回调。 + * + * @param event 输入参数,服务注册的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + Register([in] IBatteryCallback event); + + /** + * @brief 取消注册电池信息的回调。 + * + * @return HDF_SUCCESS 表示取消注册成功。 + * + * @since 3.1 + */ + UnRegister(); + + /** + * @brief 设置电池信息节点的路径。 + * + * @param path 输入参数,电池信息节点的路径。 + * + * @return HDF_SUCCESS 表示路径设置成功。 + * + * @since 3.1 + */ + ChangePath([in] String path); + + /** + * @brief 获取电池的电量百分比。 + * + * @param capacity 输出参数,表示电量的百分比值。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetCapacity([out] int capacity); + + /** + * @brief 获取电池的电压,单位微伏。 + * + * @param voltage 输出参数,表示电池的电压。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetVoltage([out] int voltage); + + /** + * @brief 获取电池的充电温度,单位0.1摄氏度。 + * + * @param temperature 输出参数,表示电池温度。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetTemperature([out] int temperature); + + /** + * @brief 获取电池的健康状态。 + * + * @param healthState 输出参数,表示电池健康状态。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryHealthState + * + * @since 3.1 + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief 获取充电设备类型。 + * + * @param pluggedType 输出参数,表示充电设备类型。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryPluggedType + * + * @since 3.1 + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief 获取充电状态。 + * + * @param chargeState 输出参数,表示充电状态。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see BatteryChargeState + * + * @since 3.1 + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief 获取是否支持电池或者电池是否在位。 + * + * @param present 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetPresent([out] boolean present); + + /** + * @brief 获取电池的技术型号。 + * + * @param technology 输出参数,当前电池技术型号。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetTechnology([out] String technology); + + /** + * @brief 获取电池的总容量。 + * + * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief 获取电池的平均电流。 + * + * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief 获取电池的电流。 + * + * @param curNow 输出参数,表示电池的实时电流,单位毫安。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief 获取电池的剩余容量。 + * + * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @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 new file mode 100644 index 0000000000000000000000000000000000000000..527c1cf49b69d7fddb03a91fa0528f293d0f102c --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_0/Types.idl @@ -0,0 +1,140 @@ +/* + * 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 电池的健康状态。 + * + * @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 电池的充电状态。 + * + * @since 3.1 + */ +enum BatteryChargeState +{ + /** 表示电池充电状态未知。 */ + CHARGE_STATE_NONE = 0, + /** 表示电池充电状态为使能状态。 */ + CHARGE_STATE_ENABLE, + /** 表示电池充电状态为停止状态。 */ + CHARGE_STATE_DISABLE, + /** 表示电池充电状态为已充满状态。 */ + CHARGE_STATE_FULL, + /** 预留。 */ + CHARGE_STATE_RESERVED, +}; + +/** + * @brief 电池的充电设备类型。 + * + * @since 3.1 + */ +enum BatteryPluggedType +{ + /** 表示连接充电器类型未知。 */ + PLUGGED_TYPE_NONE = 0, + /** 表示连接的充电器类型为交流充电器。 */ + PLUGGED_TYPE_AC, + /** 表示连接的充电器类型为USB充电器。 */ + PLUGGED_TYPE_USB, + /** 表示连接的充电器类型为无线充电器。 */ + PLUGGED_TYPE_WIRELESS, + /** 预留。 */ + PLUGGED_TYPE_BUTT +}; + +/** + * @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/bundle.json b/zh-cn/device_api/hdi/power/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..e0b25b0acbb669cbb0a53895e68552c321984931 --- /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 0000000000000000000000000000000000000000..7e0c94961b217c172eaf0a66b4bff5ae785d0e35 --- /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 0000000000000000000000000000000000000000..a7aa87ff03b14daf943b68250c9a8e2113048c42 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerHdiCallback.idl @@ -0,0 +1,68 @@ +/* + * 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 休眠/唤醒状态的回调。 + * + * 服务创建此回调对象后,可以调用{@link IPowerInterface}的接口注册回调,从而订阅休眠/唤醒状态的变化。 + * + * @since 3.1 + */ +[callback] interface IPowerHdiCallback { + /** + * @brief 休眠状态的回调方法。 + * + * 当设备进入休眠状态时,将通过此方法通知给服务。 + * + * @since 3.1 + */ + OnSuspend(); + + /** + * @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 new file mode 100644 index 0000000000000000000000000000000000000000..85e5308889a307f6ebb31e7eaf62d0a543a944bd --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl @@ -0,0 +1,125 @@ +/* + * 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 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 服务获取此对象后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + * + * @since 3.1 + */ +interface IPowerInterface { + /** + * @brief 注册休眠/唤醒状态的回调。 + * + * @param ipowerHdiCallback 输入参数,服务注册的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see IPowerHdiCallback + * + * @since 3.1 + */ + RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback); + + /** + * @brief 执行设备休眠操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + StartSuspend(); + + /** + * @brief 执行设备唤醒操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + StopSuspend(); + + /** + * @brief 执行设备强制休眠操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + ForceSuspend(); + + /** + * @brief 打开运行锁,阻止休眠。 + * + * @param name 输入参数,运行锁的名称。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + SuspendBlock([in] String name); + + /** + * @brief 关闭运行锁,取消阻止休眠。 + * + * @param name 输入参数,运行锁的名称。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + SuspendUnblock([in] String name); + + /** + * @brief 获取电源的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 new file mode 100644 index 0000000000000000000000000000000000000000..9300c3ffe18dee608324210fbb2f41a80c5a88e6 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_0/PowerTypes.idl @@ -0,0 +1,89 @@ +/* + * 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 枚举电源命令的参数。 + * + * @since 3.1 + */ +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 枚举电源状态回调的参数。 + * + * @since 3.1 + */ +enum PowerHdfCallbackCmd { + /** 休眠回调的命令参数。 */ + CMD_ON_SUSPEND = 0, + /** 唤醒回调的命令参数。 */ + CMD_ON_WAKEUP, +}; + +/** + * @brief 枚举电源的状态。 + * + * @since 3.1 + */ +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 0000000000000000000000000000000000000000..6e30395a27f54bcb6aefd2adb4b54f4dff075552 --- /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 0000000000000000000000000000000000000000..0a33f8ec0cfd370f8b8e331578a21d9c052a9d55 --- /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 0000000000000000000000000000000000000000..53bbcb25399fb89a0143cf1da9d80c3e64e9a2b6 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalCallback.idl @@ -0,0 +1,64 @@ +/* + * 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 订阅设备发热状态的回调。 + * + * 服务创建此回调对象后,可以调用{@link IThermalInterface}的接口注册回调,从而订阅设备发热状态的变化。 + * + * @since 3.1 + */ +[callback] interface IThermalCallback { + /** + * @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 new file mode 100644 index 0000000000000000000000000000000000000000..d06046e8f028feb140ce80bfa84589f0318df3bf --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl @@ -0,0 +1,119 @@ +/* + * 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 设备温度管理、控制及订阅接口。 + * + * 服务获取此对象后,可以调用相关的接口管理、控制和订阅设备温度。 + * + * @since 3.1 + */ +interface IThermalInterface { + /** + * @brief 设置CPU频率。 + * + * @param freq 输入参数,设置CPU频率的值。 + * + * @return HDF_SUCCESS 表示设置成功。 + * + * @since 3.1 + */ + SetCpuFreq([in] int freq); + + /** + * @brief 设置GPU频率。 + * + * @param freq 输入参数,设置GPU频率的值。 + * + * @return HDF_SUCCESS 表示设置成功。 + * + * @since 3.1 + */ + SetGpuFreq([in] int freq); + + /** + * @brief 设置充电电流。 + * + * @param current 输入参数,充电电流,单位毫安。 + * + * @return HDF_SUCCESS 表示设置成功 + * + * @since 3.1 + */ + SetBatteryCurrent([in] int current); + + /** + * @brief 获取设备发热的信息。 + * + * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see HdfThermalCallbackInfo + * + * @since 3.1 + */ + GetThermalZoneInfo([out] struct HdfThermalCallbackInfo event); + + /** + * @brief 注册设备发热状态的回调。 + * + * @param callbackObj 输入参数,服务注册的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see IThermalCallback + * + * @since 3.1 + */ + Register([in] IThermalCallback callbackObj); + + /** + * @brief 取消注册设备发热状态的回调。 + * + * @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 new file mode 100644 index 0000000000000000000000000000000000000000..554d29941e0d7eb57566fd38d85cb882d0295621 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_0/ThermalTypes.idl @@ -0,0 +1,63 @@ +/* + * 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 设备发热的信息。 + * + * @since 3.1 + */ +struct ThermalZoneInfo { + /** 发热器件的类型。 */ + String type; + /** 器件的温度值。 */ + int temp; +}; + +/** + * @brief 设备发热的信息列表。 + * + * @since 3.1 + */ +struct HdfThermalCallbackInfo { + /** 设备发热的信息列表。 */ + List info; +}; +/** @} */