> ## 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.

# GameInputDeviceCallback

> GameInputDeviceCallback

# GameInputDeviceCallback

用于设备连接和断开事件的、由游戏标题定义的回调。此函数通过 [IGameInput::RegisterDeviceCallback](/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback) 进行注册。此函数由注册函数中设置的条件触发。

## 语法

```cpp theme={null}
void GameInputDeviceCallback(
    GameInputCallbackToken callbackToken,
    void* context,
    IGameInputDevice* device,
    uint64_t timestamp,
    GameInputDeviceStatus currentStatus,
    GameInputDeviceStatus previousStatus
);
```

### 参数

*callbackToken*   \_In\_\
类型：GameInputCallbackToken

已注册函数的回调令牌。由 [IGameInput::RegisterDeviceCallback](/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback) 返回的令牌。

*context*   \_In\_\
类型：void\*

传递给 [IGameInput::RegisterDeviceCallback](/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback) 的上下文。

*device*   \_In\_\
类型：IGameInputDevice\*

触发回调的设备。

*timestamp*   \_In\_\
类型：uint64\_t

表示状态更改发生时间的微秒时间戳。

*currentStatus*   \_In\_\
类型：[GameInputDeviceStatus](/reference/input/gameinput/enums/gameinputdevicestatus)

设备的当前连接和输入状态。

*previousStatus*   \_In\_\
类型：[GameInputDeviceStatus](/reference/input/gameinput/enums/gameinputdevicestatus)

设备以前的连接和输入状态。

### 返回值

[输入 API 概述](/build/core-features/common/input/overviews/input-overview)\
[GameInput](/reference/input/gameinput/gameinput_members)\
[IGameInput::RegisterDeviceCallback](/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback)

## 版本历史

| 版本     | 变更  |
| ------ | --- |
| **v0** | 引入。 |


## Related topics

- [IGameInput::RegisterDeviceCallback](/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md)
- [GameInput](/zh-CN/reference/input/gameinput/gameinput_members.md)
- [GameInputDeviceStatus](/zh-CN/reference/input/gameinput/enums/gameinputdevicestatus.md)
- [IGameInput::StopCallback](/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_stopcallback.md)
- [GameInputSystemButtonCallback](/zh-CN/reference/input/gameinput/functions/gameinputsystembuttoncallback.md)
