> ## 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::SetRawDeviceFeature

> 生の機能レポートをデバイスに送信します。

生の機能レポートをデバイスに送信します。

## 構文

```cpp theme={null}
HRESULT SetRawDeviceFeature(
    IGameInputRawDeviceReport* report
);
```

### パラメーター

*report*   \_In\_\
型: [IGameInputRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\*

送信する機能レポート。`GameInputRawFeatureReport` を指定して [CreateRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md) を呼び出して作成し、[IGameInputRawDeviceReport::SetRawData](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/methods/igameinputrawdevicereport_setrawdata.md) を呼び出してデータを格納します。

### 戻り値

型: HRESULT

レポートがデバイスに送信された場合は `S_OK` を返します。デバイスが集約デバイスの場合は `GAMEINPUT_E_AGGREGATE_OPERATION_NOT_SUPPORTED` を返し、レポートを送信できない場合はその他のエラー コードを返します。

## 解説

`SetRawDeviceFeature` メソッドは、機能レポートをデバイスに書き込みます。レポート ID はレポートの [GameInputRawDeviceReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) から取得され、ペイロードは [IGameInputRawDeviceReport::SetRawData](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/methods/igameinputrawdevicereport_setrawdata.md) で設定されたデータです。

デバイスが定義する機能レポートと、それぞれのサイズを調べるには、[GetFeatureReportCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md) と [GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md) を使用します。現在、機能レポートは HID デバイスに対して公開されています。HID デバイスの場合、レポート データの最初のバイトはレポート ID です。

`SetRawDeviceFeature` は配信のためにレポートをキューに入れ、デバイスがレポートを処理するのを待たずに戻ります。成功の戻り値は、レポートが送信されたことを意味し、デバイスがレポートを受け入れたことを意味するものではありません。新しい状態を確認するには、[GetRawDeviceFeature](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md) を呼び出してレポートを読み戻します。

```cpp theme={null}
Microsoft::WRL::ComPtr<IGameInputRawDeviceReport> report;
if (SUCCEEDED(device->CreateRawDeviceReport(reportId, GameInputRawFeatureReport, &report)))
{
    // The first byte of a HID feature report is the report ID.
    uint8_t data[] = { static_cast<uint8_t>(reportId), 0x01, 0x00 };
    if (report->SetRawData(sizeof(data), data))
    {
        device->SetRawDeviceFeature(report.Get());
    }
}
```

GameInput API の中級および高度なユース ケースについては、「[GameInput の高度なトピック](https://docs.xbox.com/ja-jp/build/core-features/common/input/advanced/input-advanced-topics.md)」を参照してください。

## 要件

**ヘッダー:** GameInput.h

**ライブラリ:** gameinput.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、XBOX Series 本体

## 関連項目

[GameInput の概要](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-overview.md)\
[GetRawDeviceFeature](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)\
[GetFeatureReportCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)\
[GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md)\
[CreateRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md)\
[IGameInputRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\
[IGameInputDevice](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## バージョン履歴

| バージョン | 変更内容 |
| - | - |
| **v4** | 再導入されました。 |
| **v1** | 削除されました。 |
| **v0** | 導入されました (未実装)。 |

## 付録: 以前のバージョン

### v0

GameInput v0 では、このメソッドは同じシグネチャで宣言されていましたが、実装されていませんでした。詳細については、[IGameInputDevice::SetRawDeviceFeature (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md) を参照してください。


## Related topics

- [IGameInputDevice::SetRawDeviceFeature (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)
- [GameInputRawDeviceReportKind](https://docs.xbox.com/ja-jp/reference/input/gameinput/enums/gameinputrawdevicereportkind.md)
- [GameInput API メンバー](https://docs.xbox.com/ja-jp/reference/input/gameinput/gameinput_members.md)
- [IGameInputDevice::GetRawDeviceFeature](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)
- [IGameInputDevice::GetFeatureReportCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)
