harmony 鸿蒙ohbattery_info.h

  • 2025-06-12
  • 浏览 (3)

ohbattery_info.h

Overview

Declares the battery APIs that are used to obtain the current battery capacity and power supply type and define common battery events.

Library: libohbattery_info.so

System capability: SystemCapability.PowerManager.BatteryManager.Core

Since: 13

Related module: OH_BatteryInfo

Summary

Enums

Name Description
BatteryInfo_BatteryPluggedType {
PLUGGED_TYPE_NONE , PLUGGED_TYPE_AC , PLUGGED_TYPE_USB , PLUGGED_TYPE_WIRELESS , PLUGGED_TYPE_BUTT }
Defines the plug type.

Functions

Name Description
int32_t OH_BatteryInfo_GetCapacity () Obtains the current battery capacity.
BatteryInfo_BatteryPluggedTypeOH_BatteryInfo_GetPluggedType () Obtains the plug type.

Variables

Name Description
static const char* COMMON_EVENT_KEY_CAPACITY = “soc” Common event indicating a battery capacity change.
static const char* COMMON_EVENT_KEY_CHARGE_STATE = “chargeState” Common event indicating a charging status change.
static const char* COMMON_EVENT_KEY_PLUGGED_TYPE = “pluggedType” Common event indicating a plug type change.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Basic Services Kit

harmony 鸿蒙DeviceInfo

harmony 鸿蒙InitSync

harmony 鸿蒙OH_Print

harmony 鸿蒙OsAccount

harmony 鸿蒙Pasteboard

harmony 鸿蒙Print_Margin

harmony 鸿蒙Print_PageSize

harmony 鸿蒙Print_PrintAttributes

harmony 鸿蒙Print_PrintDocCallback

0  赞