> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XINPUT_BATTERY_INFORMATION

> XINPUT_BATTERY_INFORMATION

# XINPUT\_BATTERY\_INFORMATION

描述电池的类型和充电状态。

## 语法

```cpp theme={null}
typedef struct XINPUT_BATTERY_INFORMATION {  
    BYTE BatteryType;  
    BYTE BatteryLevel;  
} XINPUT_BATTERY_INFORMATION  
```

### 成员

*BatteryType*\
类型：BYTE

电池的类型，为以下值之一：

| 值 | 描述 |
| - | - |
| BATTERY\_TYPE\_DISCONNECTED | 设备未连接。 |
| BATTERY\_TYPE\_WIRED | 设备为有线设备，没有电池。 |
| BATTERY\_TYPE\_ALKALINE | 设备使用碱性电池。 |
| BATTERY\_TYPE\_NIMH | 设备使用镍氢 (NiMH) 电池。 |
| BATTERY\_TYPE\_UNKNOWN | 设备的电池类型未知。 |

*BatteryLevel*\
类型：BYTE

电池的充电状态（相对于其满充电容量），为以下值之一：

| 值 | 描述 |
| - | - |
| BATTERY\_LEVEL\_EMPTY | 电量介于 0 与 10% 之间。 |
| BATTERY\_LEVEL\_LOW | 电量介于 10% 与 40% 之间。 |
| BATTERY\_LEVEL\_MEDIUM | 电量介于 40% 与 70% 之间。 |
| BATTERY\_LEVEL\_FULL | 电量介于 70% 与 100% 之间。 |

## 备注

仅当设备具有已知的电池类型时，*BatteryLevel* 值才有效。

此结构由 [XInputGetBatteryInformation](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/functions/xinputgetbatteryinformation.md) 函数使用。

有关详细信息，请参阅 [XInputOnGameInput 包装器](https://docs.xbox.com/zh-CN/build/core-features/common/input/porting/input-porting-xinput.md#xinputWrapperSection)。

## 要求

**头文件：** XInputOnGameInput.h

**支持的平台：** XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[从 XInput 移植到 GameInput](https://docs.xbox.com/zh-CN/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [XInputGetBatteryInformation](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/functions/xinputgetbatteryinformation.md)
- [XInputOnGameInput（API 内容）](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/xinputongameinput_members.md)
- [XINPUT_GAMEPAD](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/structs/xinput_gamepad.md)
- [XINPUT_CAPABILITIES](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/structs/xinput_capabilities.md)
- [XINPUT_KEYSTROKE](https://docs.xbox.com/zh-CN/reference/input/xinputongameinput/structs/xinput_keystroke.md)
