Skip to main content
HidOutputReport class

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.

Syntax


var hidOutputReport = createOutputReport();
var hidOutputReport = createOutputReport(uInt16);

public sealed class HidOutputReport

Public NotInheritable Class HidOutputReport

public ref class HidOutputReport sealed 

Members

The HidOutputReport class has these types of members:

Methods

The HidOutputReport class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
GetBooleanControl Retrieves the boolean control associated with the given usagePage and usageId.
GetBooleanControlByDescription Retrieves the boolean control associated with the given controlDescription.
GetNumericControl Retrieves the numeric control associated with the given usagePage and usageId.
GetNumericControlByDescription Retrieves the numeric control associated with the given controlDescription.

 

Properties

The HidOutputReport class has these properties.

PropertyAccess typeDescription

Data

Read/write

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

Id

Read-only

Retrieves the identifier associated with a given output report.

 

Remarks

The following example demonstrates how a Windows Store 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");
            }
        }
    }
}

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0 [for Xbox, see UWP features that aren't yet supported on Xbox]

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Devices.HumanInterfaceDevice
Windows::Devices::HumanInterfaceDevice [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Devices.HumanInterfaceDevice
Windows::Devices::HumanInterfaceDevice [C++]

Metadata

Windows.winmd

Attributes

[ DualApiPartition()]
[ MarshalingBehavior(Agile)]
[ Version(0x06030000)]

See also

Object