HidInputReport HidInputReport HidInputReport HidInputReport HidInputReport Class

Definition

Represents a HID 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.

public : sealed class HidInputReport
struct winrt::Windows::Devices::HumanInterfaceDevice::HidInputReport
public sealed class HidInputReport
Public NotInheritable Class HidInputReport
// This class does not provide a public constructor.
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The following example demonstrates how a UWP 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

ActivatedBooleanControls ActivatedBooleanControls ActivatedBooleanControls ActivatedBooleanControls ActivatedBooleanControls

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

Data Data Data Data Data

Gets the data associated with a given input report.

Id Id Id Id Id

Gets the identifier associated with a given input report.

TransitionedBooleanControls TransitionedBooleanControls TransitionedBooleanControls TransitionedBooleanControls TransitionedBooleanControls

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

Methods

GetBooleanControl(UInt16, UInt16) GetBooleanControl(UInt16, UInt16) GetBooleanControl(UInt16, UInt16) GetBooleanControl(UInt16, UInt16) GetBooleanControl(UInt16, UInt16)

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

GetBooleanControlByDescription(HidBooleanControlDescription) GetBooleanControlByDescription(HidBooleanControlDescription) GetBooleanControlByDescription(HidBooleanControlDescription) GetBooleanControlByDescription(HidBooleanControlDescription) GetBooleanControlByDescription(HidBooleanControlDescription)

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

GetNumericControl(UInt16, UInt16) GetNumericControl(UInt16, UInt16) GetNumericControl(UInt16, UInt16) GetNumericControl(UInt16, UInt16) GetNumericControl(UInt16, UInt16)

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

GetNumericControlByDescription(HidNumericControlDescription) GetNumericControlByDescription(HidNumericControlDescription) GetNumericControlByDescription(HidNumericControlDescription) GetNumericControlByDescription(HidNumericControlDescription) GetNumericControlByDescription(HidNumericControlDescription)

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

See also