# Battery and Charging ## Modules to Import ``` import batteryInfo from '@ohos.batteryinfo.d.ts' ``` ## BatteryInfo Describes battery information.

Name

Readable/Writable

Type

Description

batterySOC

Read-only

number

Battery state of charge (SoC) of the current device

chargingStatus

Read-only

BatteryChargeState

Battery charging status of the current device

healthStatus

Read-only

BatteryHealthState

Battery health state of the current device

pluggedType

Read-only

BatteryPluggedType

Charger type of the current device

voltage

Read-only

number

Battery voltage of the current device

technology

Read-only

string

Battery technology of the current device

batteryTemperature

Read-only

number

Battery temperature of the current device

- Example ``` import batteryInfo from '@ohos.batteryInfo'; var batterySoc = batteryInfo.batterySOC; ``` ## Enums ## BatteryPluggedType Enumerates charger types.

Name

Default Value

Description

NONE

0

Unknown type

AC

1

AC charger

USB

2

USB charger

WIRELESS

3

Wireless charger

## BatteryChargeState Enumerates battery charging states.

Name

Default Value

Description

NONE

0

Unknown state

ENABLE

1

The battery is being charged.

DISABLE

2

The battery is not being charged.

FULL

3

The battery is fully charged.

## BatteryHealthState Enumerates battery health states.

Name

Default Value

Description

UNKNOWN

0

Unknown state

GOOD

1

The battery is in healthy state.

OVERHEAT

2

The battery is overheated.

OVERVOLTAGE

3

The battery voltage is over high.

COLD

4

The battery temperature is low.

DEAD

5

The battery is dead.