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

# XINPUT_BATTERY_INFORMATION

> XINPUT_BATTERY_INFORMATION

# XINPUT\_BATTERY\_INFORMATION

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

<a id="syntaxSection" />

## 语法

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

<a id="membersSection" />

### 成员

*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% 之间。 |

<a id="remarksSection" />

## 备注

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

此结构由 [XInputGetBatteryInformation](/reference/input/xinputongameinput/functions/xinputgetbatteryinformation) 函数使用。

有关详细信息，请参阅 [XInputOnGameInput 包装器](/build/core-features/common/input/porting/input-porting-xinput#xinputWrapperSection)。

<a id="requirementsSection" />

## 要求

**头文件：** XInputOnGameInput.h

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

<a id="seealsoSection" />

## 另请参阅

[从 XInput 移植到 GameInput](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XInputGetBatteryInformation](/zh-CN/reference/input/xinputongameinput/functions/xinputgetbatteryinformation.md)
- [XInputOnGameInput](/zh-CN/reference/input/xinputongameinput/xinputongameinput_members.md)
- [XINPUT_GAMEPAD](/zh-CN/reference/input/xinputongameinput/structs/xinput_gamepad.md)
- [XINPUT_VIBRATION](/zh-CN/reference/input/xinputongameinput/structs/xinput_vibration.md)
- [XINPUT_CAPABILITIES](/zh-CN/reference/input/xinputongameinput/structs/xinput_capabilities.md)
