HidOutputReport HidOutputReport HidOutputReport HidOutputReport Class

Definition

Represents an output report.

Hosts issue output reports to request changes on the device. For example, a host could issue a request to a keyboard to turn an LED on or off.

public : sealed class HidOutputReport : IHidOutputReport
public sealed class HidOutputReport : IHidOutputReport
Public NotInheritable Class HidOutputReport Implements IHidOutputReport
// 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 CreateOutputReport method to create an output report. This example then uses the SendOutputReportAsync method to send the report to the device.

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

Data Data Data Data

Retrieves, or sets, the data associated with a given output report.

public : IBuffer Data { get; set; }
public IBuffer Data { get; set; }
Public ReadWrite Property Data As IBuffer
var iBuffer = hidOutputReport.data;
hidOutputReport.data = iBuffer;
Value
IBuffer IBuffer IBuffer IBuffer

The output report data.

Id Id Id Id

Retrieves the identifier associated with a given output report.

public : ushort Id { get; }
public ushort Id { get; }
Public ReadOnly Property Id As ushort
var ushort = hidOutputReport.id;
Value
ushort ushort ushort ushort

The output report identifier.

Methods

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

Retrieves the boolean control associated with the given usagePage and usageId.

public : HidBooleanControl GetBooleanControl(unsigned short usagePage, unsigned short usageId)
public HidBooleanControl GetBooleanControl(UInt16 usagePage, UInt16 usageId)
Public Function GetBooleanControl(usagePage As UInt16, usageId As UInt16) As HidBooleanControl
var hidBooleanControl = hidOutputReport.getBooleanControl(usagePage, usageId);
Parameters
usagePage
unsigned short UInt16 UInt16 UInt16

The usage page associated with the given control.

usageId
unsigned short UInt16 UInt16 UInt16

The usage identifier associated with the given control.

Returns

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

Retrieves the boolean control associated with the given controlDescription.

public : HidBooleanControl GetBooleanControlByDescription(HidBooleanControlDescription controlDescription)
public HidBooleanControl GetBooleanControlByDescription(HidBooleanControlDescription controlDescription)
Public Function GetBooleanControlByDescription(controlDescription As HidBooleanControlDescription) As HidBooleanControl
var hidBooleanControl = hidOutputReport.getBooleanControlByDescription(controlDescription);
Parameters
Returns

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

Retrieves the numeric control associated with the given usagePage and usageId.

public : HidNumericControl GetNumericControl(unsigned short usagePage, unsigned short usageId)
public HidNumericControl GetNumericControl(UInt16 usagePage, UInt16 usageId)
Public Function GetNumericControl(usagePage As UInt16, usageId As UInt16) As HidNumericControl
var hidNumericControl = hidOutputReport.getNumericControl(usagePage, usageId);
Parameters
usagePage
unsigned short UInt16 UInt16 UInt16

The usage page associated with the given control.

usageId
unsigned short UInt16 UInt16 UInt16

The usage identifier associated with the given control.

Returns

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

Retrieves the numeric control associated with the given controlDescription.

public : HidNumericControl GetNumericControlByDescription(HidNumericControlDescription controlDescription)
public HidNumericControl GetNumericControlByDescription(HidNumericControlDescription controlDescription)
Public Function GetNumericControlByDescription(controlDescription As HidNumericControlDescription) As HidNumericControl
var hidNumericControl = hidOutputReport.getNumericControlByDescription(controlDescription);
Parameters
Returns