1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @addtogroup battery 18 * @{ 19 * 20 * @brief Provides APIs for obtaining and subscribing to battery information. 21 * 22 * After obtaining an object or proxy of this module, the battery service can invoke related APIs to obtain and 23 * subscribe to battery information. 24 * 25 * @since 3.1 26 * @version 1.0 27 */ 28 29/** 30 * @file Types.idl 31 * 32 * @brief Enumerates data types related to battery information. 33 * 34 * Such data types include the health status, charging status, charging device type, and battery information structure. 35 * 36 * @since 3.1 37 * @version 1.0 38 */ 39package ohos.hdi.battery.v1_0; 40 41 42/** 43 * @brief Enumerates the battery health status. 44 * 45 * @since 3.1 46 */ 47enum BatteryHealthState 48{ 49 /** Unknown state */ 50 BATTERY_HEALTH_UNKNOWN = 0, 51 /** Normal state */ 52 BATTERY_HEALTH_GOOD, 53 /** Overheated state */ 54 BATTERY_HEALTH_OVERHEAT, 55 /** Overvoltage state */ 56 BATTERY_HEALTH_OVERVOLTAGE, 57 /** Cool state */ 58 BATTERY_HEALTH_COLD, 59 /** Exhausted state */ 60 BATTERY_HEALTH_DEAD, 61 /** Reserved */ 62 BATTERY_HEALTH_RESERVED, 63}; 64 65/** 66 * @brief Enumerates the battery charging status. 67 * 68 * @since 3.1 69 */ 70enum BatteryChargeState 71{ 72 /** Unknown state */ 73 CHARGE_STATE_NONE = 0, 74 /** Charging enabled state */ 75 CHARGE_STATE_ENABLE, 76 /** Charging disabled state */ 77 CHARGE_STATE_DISABLE, 78 /** Battery full state */ 79 CHARGE_STATE_FULL, 80 /** Reserved */ 81 CHARGE_STATE_RESERVED, 82}; 83 84/** 85 * @brief Enumerates the charging device type. 86 * 87 * @since 3.1 88 */ 89enum BatteryPluggedType 90{ 91 /** Unknown type */ 92 PLUGGED_TYPE_NONE = 0, 93 /** AC charger */ 94 PLUGGED_TYPE_AC, 95 /** USB charger */ 96 PLUGGED_TYPE_USB, 97 /** Wireless charger */ 98 PLUGGED_TYPE_WIRELESS, 99 /** Reserved */ 100 PLUGGED_TYPE_BUTT 101}; 102 103/** 104 * @brief Defines the battery information. 105 * 106 * @since 3.1 107 */ 108struct BatteryInfo { 109 /** Battery percentage */ 110 int capacity; 111 /** Battery voltage */ 112 int voltage; 113 /** Battery temperature */ 114 int temperature; 115 /** Battery health status */ 116 int healthState; 117 /** Charging device type */ 118 int pluggedType; 119 /** Maximum charging current */ 120 int pluggedMaxCurrent; 121 /** Maximum charging voltage */ 122 int pluggedMaxVoltage; 123 /** Charging status */ 124 int chargeState; 125 /** Number of battery charging times */ 126 int chargeCounter; 127 /** Total battery capacity */ 128 int totalEnergy; 129 /** Average battery current */ 130 int curAverage; 131 /** Real-time battery current */ 132 int curNow; 133 /** Remaining battery capacity */ 134 int remainEnergy; 135 /** Whether the battery is supported or whether the battery is present */ 136 byte present; 137 /** Battery technology */ 138 String technology; 139}; 140/** @} */ 141