diff --git a/en/device_api/hdi/battery/bundle.json b/en/device_api/hdi/battery/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..184c6ec18571bbbcbfee29c3bb33742f6246b1c2 --- /dev/null +++ b/en/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/en/device_api/hdi/battery/v1_0/BUILD.gn b/en/device_api/hdi/battery/v1_0/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bd7d764ac00815ef7cfdb3c2468d699867247b0e --- /dev/null +++ b/en/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/en/device_api/hdi/battery/v1_0/IBatteryCallback.idl b/en/device_api/hdi/battery/v1_0/IBatteryCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..23bc7a61e284486a6368caf4c1c5d565a20e3a04 --- /dev/null +++ b/en/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 Provides APIs for obtaining and subscribing to battery information. + * + * The battery module provides APIs for the battery service to obtain and subscribe to battery information. + * After obtaining an object or proxy of this module, the battery service can invoke related APIs to obtain and subscribe to battery information. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryCallback.idl + * + * @brief Provides the callback of battery information. + * + * The battery module provides a callback for the battery service to subscribe to battery information changes. + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.battery.v1_0; + +import ohos.hdi.battery.v1_0.Types; + +/** + * @brief Represents the callback of battery information. + * + * After creating a callback object, the battery service can call {@link IBatteryInterface} to register a callback to subscribe to battery information changes. + * + * @since 3.1 + */ +[callback] interface IBatteryCallback { + + /** + * @brief Callback of battery information changes. + * + * + * + * @param event Battery information, such as the battery level, voltage, and health status. + * @see BatteryInfo + * + * @since 3.1 + */ + Update([in] struct BatteryInfo event); +} +/** @} */ diff --git a/en/device_api/hdi/battery/v1_0/IBatteryInterface.idl b/en/device_api/hdi/battery/v1_0/IBatteryInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..e6275308d8ca1b6afcddedfb3061630fcf99b03a --- /dev/null +++ b/en/device_api/hdi/battery/v1_0/IBatteryInterface.idl @@ -0,0 +1,229 @@ +/* + * 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 Provides APIs for obtaining and subscribing to battery information. + * + * After obtaining an object or proxy of this module, the battery service can invoke related APIs to obtain and subscribe to battery information. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryInterface.idl + * + * @brief Provides APIs for obtaining and subscribing to battery information. + * + * After obtaining an object or proxy of this module, the battery service can invoke related APIs to obtain and subscribe to battery information. + * + * @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 Represents APIs for obtaining and subscribing to battery information. + * + * + * + * @since 3.1 + */ +interface IBatteryInterface { + /** + * @brief Registers the callback of battery information. + * + * @param event Callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + Register([in] IBatteryCallback event); + + /** + * @brief Unregisters the callback of battery information. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + UnRegister(); + + /** + * @brief Sets the path of the battery information node. + * + * @param path Path of the battery information node. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + ChangePath([in] String path); + + /** + * @brief Obtains the battery percentage. + * + * @param capacity Battery percentage. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetCapacity([out] int capacity); + + /** + * @brief Obtains the battery voltage. + * + * @param voltage Battery voltage, in microvolts. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetVoltage([out] int voltage); + + /** + * @brief Obtains the battery temperature during charging. The unit is 0.1°C. + * + * @param temperature Battery temperature. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetTemperature([out] int temperature); + + /** + * @brief Obtains the battery health status. + * + * @param healthState Battery health status. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see BatteryHealthState + * + * @since 3.1 + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief Obtains the type of the charging device. + * + * @param pluggedType Type of the charging device. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see BatteryPluggedType + * + * @since 3.1 + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief Obtains the charging status. + * + * @param chargeState Battery charging status. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see BatteryChargeState + * + * @since 3.1 + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief Checks whether the battery is supported or present. + * + * @param present Whether battery is supported or present. The value **true** indicates that the battery is supported or present, and the value **false** indicates the opposite. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetPresent([out] boolean present); + + /** + * @brief Obtains the battery technology of the current device. + * + * @param technology Battery technology of the current device. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetTechnology([out] String technology); + + /** + * @brief Obtains the total battery capacity. + * + * @param totalEnergy Total battery capacity, in mA. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief Obtains the average battery current. + * + * @param totalEnergy Average battery current, in mA. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief Obtains the battery current. + * + * @param curNow Battery current, in mA. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief Obtains the remaining battery capacity. + * + * @param remainEnergy Remaining battery capacity, in mA. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @brief Obtains all battery information. + * + * @param info Battery information. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see BatteryInfo + * + * @since 3.1 + */ + GetBatteryInfo([out] struct BatteryInfo info); +} +/** @} */ diff --git a/en/device_api/hdi/battery/v1_0/Types.idl b/en/device_api/hdi/battery/v1_0/Types.idl new file mode 100644 index 0000000000000000000000000000000000000000..76978f2a75723327f8e69772dccf636351bf995f --- /dev/null +++ b/en/device_api/hdi/battery/v1_0/Types.idl @@ -0,0 +1,139 @@ +/* + * 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 Provides APIs for obtaining and subscribing to battery information. + * + * After obtaining an object or proxy of this module, the battery service can invoke related APIs to obtain and subscribe to battery information. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file Types.idl + * + * @brief Enumerates data types related to battery information. + * + * Such data types include the health status, charging status, charging device type, and battery information structure. + * + * @since 3.1 + * @version 1.0 + */ +package ohos.hdi.battery.v1_0; + + +/** + * @brief Enumerates the battery health status. + * + * @since 3.1 + */ +enum BatteryHealthState +{ + /** Unknown state */ + BATTERY_HEALTH_UNKNOWN = 0, + /** Normal state */ + BATTERY_HEALTH_GOOD, + /** Overheated state */ + BATTERY_HEALTH_OVERHEAT, + /** Overvoltage state */ + BATTERY_HEALTH_OVERVOLTAGE, + /** Cool state */ + BATTERY_HEALTH_COLD, + /** Exhausted state */ + BATTERY_HEALTH_DEAD, + /** Reserved */ + BATTERY_HEALTH_RESERVED, +}; + +/** + * @brief Enumerates the battery charging status. + * + * @since 3.1 + */ +enum BatteryChargeState +{ + /** Unknown state */ + CHARGE_STATE_NONE = 0, + /** Charging enabled state */ + CHARGE_STATE_ENABLE, + /** Charging disabled state */ + CHARGE_STATE_DISABLE, + /** Battery full state */ + CHARGE_STATE_FULL, + /** Reserved */ + CHARGE_STATE_RESERVED, +}; + +/** + * @brief Enumerates the charging device type. + * + * @since 3.1 + */ +enum BatteryPluggedType +{ + /** Unknown type */ + PLUGGED_TYPE_NONE = 0, + /** AC charger */ + PLUGGED_TYPE_AC, + /** USB charger */ + PLUGGED_TYPE_USB, + /** Wireless charger */ + PLUGGED_TYPE_WIRELESS, + /** Reserved */ + PLUGGED_TYPE_BUTT +}; + +/** + * @brief Defines the battery information. + * + * @since 3.1 + */ +struct BatteryInfo { + /** Battery percentage */ + int capacity; + /** Battery voltage */ + int voltage; + /** Battery temperature */ + int temperature; + /** Battery health status */ + int healthState; + /** Charging device type */ + int pluggedType; + /** Maximum charging current */ + int pluggedMaxCurrent; + /** Maximum charging voltage */ + int pluggedMaxVoltage; + /** Charging status */ + int chargeState; + /** Number of battery charging times */ + int chargeCounter; + /** Total battery capacity */ + int totalEnergy; + /** Average battery current */ + int curAverage; + /** Real-time battery current */ + int curNow; + /** Remaining battery capacity */ + int remainEnergy; + /** Whether the battery is supported or whether the battery is present */ + byte present; + /** Battery technology */ + String technology; +}; +/** @} */ diff --git a/en/device_api/hdi/power/bundle.json b/en/device_api/hdi/power/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..e0b25b0acbb669cbb0a53895e68552c321984931 --- /dev/null +++ b/en/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/en/device_api/hdi/power/v1_0/BUILD.gn b/en/device_api/hdi/power/v1_0/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7e0c94961b217c172eaf0a66b4bff5ae785d0e35 --- /dev/null +++ b/en/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/en/device_api/hdi/power/v1_0/IPowerHdiCallback.idl b/en/device_api/hdi/power/v1_0/IPowerHdiCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..02bcfec5563332602b0f488c2ffcd2c30c88f551 --- /dev/null +++ b/en/device_api/hdi/power/v1_0/IPowerHdiCallback.idl @@ -0,0 +1,67 @@ +/* + * 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 Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, and managing running locks. + * + * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks. + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file IPowerHdiCallback.idl + * + * @brief Provides the callbacks of the hibernation/wakeup status. + * + * The power module provides callbacks for the power service to obtain the hibernation/wakeup status. + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_0; + +/** + * @brief Represents the callbacks of the hibernation/wakeup status. + * + * After creating a callback object, the power service can call {@link IPowerInterface} to register a callback to subscribe to hibernation/wakeup status changes. + * + * @since 3.1 + */ +[callback] interface IPowerHdiCallback { + /** + * @brief Callback of the hibernation state. + * + * This callback is used to notify the power service when the device enters the hibernation state. + * + * @since 3.1 + */ + OnSuspend(); + + /** + * @brief Callback of the wakeup state. + * + * This callback is used to notify the power service when the device enters the wakeup state. + * + * @since 3.1 + */ + OnWakeup(); +} +/** @} */ diff --git a/en/device_api/hdi/power/v1_0/IPowerInterface.idl b/en/device_api/hdi/power/v1_0/IPowerInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..945fddcd284fadba7be816d3b9b0dbc92f9cd55e --- /dev/null +++ b/en/device_api/hdi/power/v1_0/IPowerInterface.idl @@ -0,0 +1,124 @@ +/* + * 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 Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, and managing running locks. + * + * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IPowerInterface.idl + * + * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, and managing running locks. + * + * + * + * @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 Represents APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, and managing running locks. + * + * + * + * @since 3.1 + */ +interface IPowerInterface { + /** + * @brief Registers the callback of the hibernation/wakeup status. + * + * @param ipowerHdiCallback Callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see IPowerHdiCallback + * + * @since 3.1 + */ + RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback); + + /** + * @brief Hibernates a device. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + StartSuspend(); + + /** + * @brief Wakes up a device. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + StopSuspend(); + + /** + * @brief Forcibly hibernates a device. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + ForceSuspend(); + + /** + * @brief Enables the running lock to block device hibernation. + * + * @param name Name of the running lock. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + SuspendBlock([in] String name); + + /** + * @brief Disables the running lock to unblock device hibernation. + * + * @param name Name of the running lock. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + SuspendUnblock([in] String name); + + /** + * @brief Obtains the power dump information. + * + * @param info Power dump information. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + PowerDump([out] String info); +} +/** @} */ diff --git a/en/device_api/hdi/power/v1_0/PowerTypes.idl b/en/device_api/hdi/power/v1_0/PowerTypes.idl new file mode 100644 index 0000000000000000000000000000000000000000..cbf8fee6188cfe474ca42b48d882d9d1df231183 --- /dev/null +++ b/en/device_api/hdi/power/v1_0/PowerTypes.idl @@ -0,0 +1,88 @@ +/* + * 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 Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, and managing running locks. + * + * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file PowerTypes.idl + * + * @brief Enumerates data types related to power management. + * + * Such data types include command parameters, callback parameters, and system status. + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_0; + +/** + * @brief Enumerates command parameters for power management. + * + * @since 3.1 + */ +enum PowerHdfCmd { + /** Command parameter for registering a callback of the power status */ + CMD_REGISTER_CALLBCK = 0, + /** Command parameter for hibernating the device */ + CMD_START_SUSPEND, + /** Command parameter for waking up the device */ + CMD_STOP_SUSPEND, + /** Command parameter for forcibly hibernating the device */ + CMD_FORCE_SUSPEND, + /** Command parameter for opening the running lock */ + CMD_SUSPEND_BLOCK, + /** Command parameter for closing the running lock*/ + CMD_SUSPEND_UNBLOCK, + /** Command parameter for dumping */ + CMD_DUMP, +}; + +/** + * @brief Enumerates command parameters for the power status callback. + * + * @since 3.1 + */ +enum PowerHdfCallbackCmd { + /** Command parameter for the hibernation callback */ + CMD_ON_SUSPEND = 0, + /** Command parameter for the wakeup callback */ + CMD_ON_WAKEUP, +}; + +/** + * @brief Enumerates the power status. + * + * @since 3.1 + */ +enum PowerHdfState { + /** Awake state */ + AWAKE = 0, + /** Inactive state */ + INACTIVE, + /** Sleep state */ + SLEEP, +}; +/** @} */ diff --git a/en/device_api/hdi/thermal/bundle.json b/en/device_api/hdi/thermal/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..6e30395a27f54bcb6aefd2adb4b54f4dff075552 --- /dev/null +++ b/en/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/en/device_api/hdi/thermal/v1_0/BUILD.gn b/en/device_api/hdi/thermal/v1_0/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0a33f8ec0cfd370f8b8e331578a21d9c052a9d55 --- /dev/null +++ b/en/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/en/device_api/hdi/thermal/v1_0/IThermalCallback.idl b/en/device_api/hdi/thermal/v1_0/IThermalCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..8b7616639ddac51f49687f4fa0667eafbc9b6a51 --- /dev/null +++ b/en/device_api/hdi/thermal/v1_0/IThermalCallback.idl @@ -0,0 +1,62 @@ +/* + * 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 Provides APIs for managing, controlling, and subscribing to the device temperature. + * + * The thermal module provides APIs for the thermal service to manage, control, and subscribe to the device temperature. + * After obtaining an object or proxy of this module, the thermal service can invoke related APIs to manage, control, and subscribe to the device temperature. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IThermalCallback.idl + * + * @brief Provides the callback of device temperature changes. + * + * The thermal module provides the callback for the thermal service to obtain device temperature changes. + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.thermal.v1_0; + +import ohos.hdi.thermal.v1_0.ThermalTypes; + +/** + * @brief Represents the callback of thermal status changes. + * + * After creating a callback object, the thermal service can call {@link IThermalInterface} to register a callback to subscribe to thermal status changes. + * + * @since 3.1 + */ +[callback] interface IThermalCallback { + /** + * @brief Callback of thermal status changes. + * + * @param event Thermal information of the device, including the device type and temperature. + * @see HdfThermalCallbackInfo + * + * @since 3.1 + */ + OnThermalDataEvent([in] struct HdfThermalCallbackInfo event); +} +/** @} */ diff --git a/en/device_api/hdi/thermal/v1_0/IThermalInterface.idl b/en/device_api/hdi/thermal/v1_0/IThermalInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..b540a2cdd23f860f3ac1894a58fa6364b49fca92 --- /dev/null +++ b/en/device_api/hdi/thermal/v1_0/IThermalInterface.idl @@ -0,0 +1,118 @@ +/* + * 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 Provides APIs for managing, controlling, and subscribing to the device temperature. + * + * After obtaining an object or proxy of this module, the thermal service can invoke related APIs to manage, control, and subscribe to the device temperature. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IThermalInterface.idl + * + * @brief Provides APIs for managing, controlling, and subscribing to the device temperature. + * + * + * + * @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 Represents APIs for managing, controlling, and subscribing to the device temperature. + * + * + * + * @since 3.1 + */ +interface IThermalInterface { + /** + * @brief Sets the CPU frequency. + * + * @param freq CPU frequency to set. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + SetCpuFreq([in] int freq); + + /** + * @brief Sets the GPU frequency. + * + * @param freq GPU frequency to set. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + SetGpuFreq([in] int freq); + + /** + * @brief Sets the charging current. + * + * @param current Charging current, in mA. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + SetBatteryCurrent([in] int current); + + /** + * @brief Obtains the thermal information of the device. + * + * @param event Thermal information of the device, including the device type and temperature. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see HdfThermalCallbackInfo + * + * @since 3.1 + */ + GetThermalZoneInfo([out] struct HdfThermalCallbackInfo event); + + /** + * @brief Registers the callback of the device thermal status. + * + * @param callbackObj Callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see IThermalCallback + * + * @since 3.1 + */ + Register([in] IThermalCallback callbackObj); + + /** + * @brief Registers the callback of the device thermal status. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 3.1 + */ + Unregister(); +} +/** @} */ diff --git a/en/device_api/hdi/thermal/v1_0/ThermalTypes.idl b/en/device_api/hdi/thermal/v1_0/ThermalTypes.idl new file mode 100644 index 0000000000000000000000000000000000000000..323e2cd4554809957075af29c1d2a359492fdd66 --- /dev/null +++ b/en/device_api/hdi/thermal/v1_0/ThermalTypes.idl @@ -0,0 +1,62 @@ +/* + * 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 Provides APIs for managing, controlling, and subscribing to the device temperature. + * + * After obtaining an object or proxy of this module, the thermal service can invoke related APIs to manage, control, and subscribe to the device temperature. + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file ThermalTypes.idl + * + * @brief Enumerates data types related to thermal management. + * + * Such data types include thermal information and thermal information list. + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.thermal.v1_0; + +/** + * @brief Defines the device thermal information. + * + * @since 3.1 + */ +struct ThermalZoneInfo { + /** Device type */ + String type; + /** Device temperature */ + int temp; +}; + +/** + * @brief Defines the device thermal information list. + * + * @since 3.1 + */ +struct HdfThermalCallbackInfo { + /** Device thermal information list */ + List info; +}; +/** @} */