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

# IGameInputDevice::GetFeatureReportInfo

> 检索设备定义的原始功能报告的说明。

检索设备定义的原始功能报告的说明。

## 语法

```cpp theme={null}
uint32_t GetFeatureReportInfo(
    uint32_t infoArrayCount,
    GameInputRawDeviceReportInfo* infoArray
);
```

### 参数

*infoArrayCount*   \_In\_\
类型：uint32\_t

*infoArray* 中的元素数量。若要检索所有功能报告，请传递 [GetFeatureReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md) 返回的值。

*infoArray*   \_Out\_writes\_to\_opt\_(infoArrayCount, return)\
类型：[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\*

指向数组的指针，该数组为每个功能报告接收一个结构。可以为 `nullptr`，在这种情况下不会写入任何内容，并且方法返回 0。

### 返回值

类型：uint32\_t

写入 *infoArray* 的元素数量。该值为 *infoArrayCount* 与设备上功能报告数量中的较小者；如果 *infoArray* 为 `nullptr` 或设备没有功能报告，则为 0。

## 备注

每个元素都是一个 [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) 结构，其 `kind` 成员为 `GameInputRawFeatureReport`，`id` 成员为设备定义的报告 ID，`size` 成员为报告数据的大小（以字节为单位）。

调用 [GetFeatureReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md) 获取功能报告的数量，分配该大小的数组，然后调用 `GetFeatureReportInfo` 填充该数组。如果 *infoArrayCount* 小于功能报告的数量，则只写入前 *infoArrayCount* 个元素。在设备保持连接期间，设备的功能报告不会更改，因此你可以只查询一次并缓存结果。

将元素的 `id` 成员用作 [GetRawDeviceFeature](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md) 的 *reportId* 参数以读取报告；或者将其与 `GameInputRawFeatureReport` 一起用作 [CreateRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md) 的 *reportId* 参数，以创建可通过 [SetRawDeviceFeature](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md) 发送的报告。`size` 成员给出报告数据的字节数。

以下示例演示如何检索设备的功能报告。

```cpp theme={null}
uint32_t reportCount = device->GetFeatureReportCount();
std::vector<GameInputRawDeviceReportInfo> reports(reportCount);
reports.resize(device->GetFeatureReportInfo(reportCount, reports.data()));

for (const GameInputRawDeviceReportInfo& report : reports)
{
    Microsoft::WRL::ComPtr<IGameInputRawDeviceReport> feature;
    if (SUCCEEDED(device->GetRawDeviceFeature(report.id, &feature)))
    {
        // Read the report data with GetRawDataSize and GetRawData.
    }
}
```

## 要求

**头文件：** GameInput.h

**库：** gameinput.lib

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

## 另请参阅

[GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[GetFeatureReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)\
[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\
[GameInputRawDeviceReportKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputrawdevicereportkind.md)\
[IGameInputRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\
[GetRawDeviceFeature](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)\
[SetRawDeviceFeature](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)\
[CreateRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md)\
[GameInput 高级主题](https://docs.xbox.com/zh-CN/build/core-features/common/input/advanced/input-advanced-topics.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本历史

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


## Related topics

- [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)
- [IGameInputDevice::GetFeatureReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)
- [IGameInputDevice::GetRawDeviceFeature](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)
- [IGameInputDevice::SetRawDeviceFeature](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
