> ## 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](/zh-TW/reference/input/xinputongameinput/functions/xinputgetbatteryinformation) 函式使用。

如需詳細資訊，請參閱 [XInputOnGameInput 包裝函式](/zh-TW/build/core-features/common/input/porting/input-porting-xinput#xinputWrapperSection)。

<a id="requirementsSection" />

## 需求

**標頭：** XInputOnGameInput.h

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

<a id="seealsoSection" />

## 另請參閱

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


## Related topics

- [XINPUT_BATTERY_INFORMATION](/reference/input/xinputongameinput/structs/xinput_battery_information.md)
- [XInputGetBatteryInformation](/reference/input/xinputongameinput/functions/xinputgetbatteryinformation.md)
