1e41f4b71Sopenharmony_ci# ohbattery_info.h 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Overview 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciDeclares the battery APIs that are used to obtain the current battery capacity and power supply type and define common battery events. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci**Library**: libohbattery_info.so 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci**System capability**: SystemCapability.PowerManager.BatteryManager.Core 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci**Since**: 13 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci**Related module**: [OH_BatteryInfo](oh__batteryinfo.md) 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci## Summary 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci### Enums 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci| Name| Description| 23e41f4b71Sopenharmony_ci| -------- | -------- | 24e41f4b71Sopenharmony_ci| [BatteryInfo_BatteryPluggedType](oh__batteryinfo.md#batteryinfo_batterypluggedtype) {<br>PLUGGED_TYPE_NONE , PLUGGED_TYPE_AC , PLUGGED_TYPE_USB , PLUGGED_TYPE_WIRELESS , PLUGGED_TYPE_BUTT } | Defines the plug type.| 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci### Functions 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci| Name| Description| 30e41f4b71Sopenharmony_ci| -------- | -------- | 31e41f4b71Sopenharmony_ci| int32_t [OH_BatteryInfo_GetCapacity](oh__batteryinfo.md#oh_batteryinfo_getcapacity) () | Obtains the current battery capacity.| 32e41f4b71Sopenharmony_ci| [BatteryInfo_BatteryPluggedType](oh__batteryinfo.md#batteryinfo_batterypluggedtype)[OH_BatteryInfo_GetPluggedType](oh__batteryinfo.md#oh_batteryinfo_getpluggedtype) () | Obtains the plug type.| 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci### Variables 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci| Name| Description| 38e41f4b71Sopenharmony_ci| -------- | -------- | 39e41f4b71Sopenharmony_ci| static const char\* [COMMON_EVENT_KEY_CAPACITY](oh__batteryinfo.md#common_event_key_capacity) = "soc" | Common event indicating a battery capacity change.| 40e41f4b71Sopenharmony_ci| static const char\* [COMMON_EVENT_KEY_CHARGE_STATE](oh__batteryinfo.md#common_event_key_charge_state) = "chargeState" | Common event indicating a charging status change.| 41e41f4b71Sopenharmony_ci| static const char\* [COMMON_EVENT_KEY_PLUGGED_TYPE](oh__batteryinfo.md#common_event_key_plugged_type) = "pluggedType" | Common event indicating a plug type change.| 42