HidInputReport クラス

定義

HID 入力レポートを表します。

デバイスは、状態の変更、ユーザー入力、およびその他のデバイス固有のデータを記述するために入力レポートを発行します。 たとえば、HID キーボード デバイスでは、入力レポートを使用してキーの押しを通知します。 HID プレゼンス センサーは、入力レポートを使用してプレゼンス検出イベントを通知します。

public ref class HidInputReport sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class HidInputReport final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class HidInputReport
Public NotInheritable Class HidInputReport
継承
Object Platform::Object IInspectable HidInputReport
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

注釈

次の例では、XAML と C# を使用して構築された UWP アプリで GetInputReportAsync メソッドを使用して入力レポートを取得する方法を示します。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Windows.Devices.Enumeration;
using Windows.Devices.HumanInterfaceDevice;
using Windows.Storage;
using Windows.Storage.Streams;

namespace HidSampleCS
{
    class Vendor
    {
        private async void ReadWriteToHidDevice(HidDevice device)
        {
            if (device != null)
            {
                // construct a HID output report to send to the device
                HidOutputReport outReport = device.CreateOutputReport();

                /// Initialize the data buffer and fill it in
                byte[] buffer = new byte[] { 10, 20, 30, 40 };

                DataWriter dataWriter = new DataWriter();
                dataWriter.WriteBytes(buffer);

                outReport.Data = dataWriter.DetachBuffer();

                // Send the output report asynchronously
                await device.SendOutputReportAsync(outReport);

                //
                // Sent output report successfully 
                // Now lets try read an input report 
                //
                HidInputReport inReport = await device.GetInputReportAsync();

                if (inReport != null)
                {
                    UInt16 id = inReport.Id;
                    var bytes = new byte[4];
                    DataReader dataReader = DataReader.FromBuffer(inReport.Data);
                    dataReader.ReadBytes(bytes);
                }
                else
                {
                    this.NotifyUser("Invalid input report received");
                }
            }
            else
            {
                this.NotifyUser("device is NULL");
            }
        }
    }
}

プロパティ

ActivatedBooleanControls

指定された HID デバイスの現在アクティブ化されているブール型 (Boolean) コントロールを取得します。

Data

特定の入力レポートに関連付けられているデータを取得します。

Id

指定された入力レポートに関連付けられている識別子を取得します。

TransitionedBooleanControls

特定の HID デバイスに対して最近切り替えられたブール型 (Boolean) コントロールを取得します。

メソッド

GetBooleanControl(UInt16, UInt16)

usagePage パラメーターと usageId パラメーターに関連付けられているブール型 (Boolean) のコントロールを取得し、指定された入力レポートに含まれています。

GetBooleanControlByDescription(HidBooleanControlDescription)

controlDescription パラメーターによって記述され、指定された入力レポートで見つかったブール型のコントロールを取得します。

GetNumericControl(UInt16, UInt16)

usagePage パラメーターと usageId パラメーターに関連付けられた数値コントロールを取得し、指定された入力レポートで見つかります。

GetNumericControlByDescription(HidNumericControlDescription)

controlDescription パラメーターによって記述され、指定された入力レポートで見つかった数値コントロールを取得します。

適用対象

こちらもご覧ください