HidInputReport HidInputReport HidInputReport HidInputReport Class

Represents an input report.

Devices issue input reports to describe state changes, user-input, and other device-specific data. For example, a HID keyboard device would use an input report to signal a key press. A HID presence-sensor would use an input report to signal a presence detection event.

Syntax

Declaration

public sealed class HidInputReportpublic sealed class HidInputReportPublic NotInheritable Class HidInputReport

Remarks

The following example demonstrates how a Windows Store app built with XAML and C# uses the GetInputReportAsync method to obtain an input report.

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

Properties summary

Retrieves the currently activated Boolean controls for the given HID device.

Retrieves the data associated with a given input report.

Retrieves the identifier associated with a given input report.

Retrieves the recently transitioned Boolean controls for the given HID device.

Methods summary

Retrieves the Boolean control associated with the usagePage and usageId parameter and found in the given input report.

Retrieves the Boolean control described by the controlDescription parameter and found in the given input report.

Retrieves the numeric control associated with the usagePage and usageId parameters and found in the given input report.

Retrieves the numeric control described by the controlDescription parameter and found in the given input report.

Properties

  • ActivatedBooleanControls
    ActivatedBooleanControls
    ActivatedBooleanControls
    ActivatedBooleanControls

    Retrieves the currently activated Boolean controls for the given HID device.

    public IVectorView<HidBooleanControl> ActivatedBooleanControls { get; }public IVectorView<HidBooleanControl> ActivatedBooleanControls { get; }Public ReadOnly Property ActivatedBooleanControls As IVectorView<HidBooleanControl>

    Property Value

    • A collection of Boolean controls.

  • Data
    Data
    Data
    Data

    Retrieves the data associated with a given input report.

    public IBuffer Data { get; }public IBuffer Data { get; }Public ReadOnly Property Data As IBuffer

    Property Value

  • Id
    Id
    Id
    Id

    Retrieves the identifier associated with a given input report.

    public ushort Id { get; }public ushort Id { get; }Public ReadOnly Property Id As ushort

    Property Value

    • ushort
      ushort
      ushort
      ushort

      The input report identifier.

  • TransitionedBooleanControls
    TransitionedBooleanControls
    TransitionedBooleanControls
    TransitionedBooleanControls

    Retrieves the recently transitioned Boolean controls for the given HID device.

    public IVectorView<HidBooleanControl> TransitionedBooleanControls { get; }public IVectorView<HidBooleanControl> TransitionedBooleanControls { get; }Public ReadOnly Property TransitionedBooleanControls As IVectorView<HidBooleanControl>

    Property Value

    • A collection of Boolean controls.

Methods

  • GetBooleanControl(System.UInt16,System.UInt16)
    GetBooleanControl(System.UInt16,System.UInt16)
    GetBooleanControl(System.UInt16,System.UInt16)
    GetBooleanControl(System.UInt16,System.UInt16)

    Retrieves the Boolean control associated with the usagePage and usageId parameter and found in the given input report.

    public HidBooleanControl GetBooleanControl(System.UInt16 usagePage,System.UInt16 usageId)public HidBooleanControl GetBooleanControl(System.UInt16 usagePage,System.UInt16 usageId)Public Function GetBooleanControl(usagePage As System.UInt16,usageId As System.UInt16) As HidBooleanControl

    Parameters

    • usagePage
      System.UInt16
      System.UInt16
      System.UInt16
      System.UInt16

      The usage page of the top-level collection for the given HID device.

    • usageId
      System.UInt16
      System.UInt16
      System.UInt16
      System.UInt16

      The usage identifier of the top-level collection for the given HID device.

    Returns

  • GetBooleanControlByDescription(Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription)
    GetBooleanControlByDescription(Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription)
    GetBooleanControlByDescription(Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription)
    GetBooleanControlByDescription(Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription)

    Retrieves the Boolean control described by the controlDescription parameter and found in the given input report.

    public HidBooleanControl GetBooleanControlByDescription(Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription controlDescription)public HidBooleanControl GetBooleanControlByDescription(Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription controlDescription)Public Function GetBooleanControlByDescription(controlDescription As Windows.Devices.HumanInterfaceDevice.HidBooleanControlDescription) As HidBooleanControl

    Parameters

    Returns

  • GetNumericControl(System.UInt16,System.UInt16)
    GetNumericControl(System.UInt16,System.UInt16)
    GetNumericControl(System.UInt16,System.UInt16)
    GetNumericControl(System.UInt16,System.UInt16)

    Retrieves the numeric control associated with the usagePage and usageId parameters and found in the given input report.

    public HidNumericControl GetNumericControl(System.UInt16 usagePage,System.UInt16 usageId)public HidNumericControl GetNumericControl(System.UInt16 usagePage,System.UInt16 usageId)Public Function GetNumericControl(usagePage As System.UInt16,usageId As System.UInt16) As HidNumericControl

    Parameters

    • usagePage
      System.UInt16
      System.UInt16
      System.UInt16
      System.UInt16

      The usage page of the top-level collection for the given HID device.

    • usageId
      System.UInt16
      System.UInt16
      System.UInt16
      System.UInt16

      The usage identifier of the top-level collection for the given HID device.

    Returns

  • GetNumericControlByDescription(Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription)
    GetNumericControlByDescription(Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription)
    GetNumericControlByDescription(Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription)
    GetNumericControlByDescription(Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription)

    Retrieves the numeric control described by the controlDescription parameter and found in the given input report.

    public HidNumericControl GetNumericControlByDescription(Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription controlDescription)public HidNumericControl GetNumericControlByDescription(Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription controlDescription)Public Function GetNumericControlByDescription(controlDescription As Windows.Devices.HumanInterfaceDevice.HidNumericControlDescription) As HidNumericControl

    Parameters

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Devices.HumanInterfaceDevice.dll