HidOutputReport クラス

定義

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

ホストは出力レポートを発行して、デバイスで変更を要求します。 たとえば、ホストは、LED のオンとオフを切り替える要求をキーボードに発行できます。

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

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 アプリで CreateOutputReport メソッドを使用して出力レポートを作成する方法を示します。 次に、 SendOutputReportAsync メソッドを使用して、レポートをデバイスに送信します。

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");
            }
        }
    }
}

プロパティ

Data

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

Id

特定の出力レポートに関連付けられている識別子を取得します。

メソッド

GetBooleanControl(UInt16, UInt16)

指定された usagePage と usageId に関連付けられているブール型コントロール を取得します

GetBooleanControlByDescription(HidBooleanControlDescription)

指定された controlDescription に関連付けられているブール型のコントロールを取得します。

GetNumericControl(UInt16, UInt16)

指定された usagePage と usageId に関連付けられている数値コントロール を取得します

GetNumericControlByDescription(HidNumericControlDescription)

指定された controlDescription に関連付けられている数値コントロールを取得します。

適用対象

こちらもご覧ください