HidDevice.GetInputReportAsync HidDevice.GetInputReportAsync HidDevice.GetInputReportAsync HidDevice.GetInputReportAsync HidDevice.GetInputReportAsync Method

Definition

Overloads

GetInputReportAsync() GetInputReportAsync() GetInputReportAsync() GetInputReportAsync() GetInputReportAsync()

Asynchronously retrieves the default, or first, input report from the given HID device.

GetInputReportAsync(UInt16) GetInputReportAsync(UInt16) GetInputReportAsync(UInt16) GetInputReportAsync(UInt16) GetInputReportAsync(UInt16)

Asynchronously retrieves an input report, identified by the reportId parameter, from the given HID device.

GetInputReportAsync() GetInputReportAsync() GetInputReportAsync() GetInputReportAsync() GetInputReportAsync()

Asynchronously retrieves the default, or first, input report from the given HID device.

public : IAsyncOperation<HidInputReport> GetInputReportAsync()
IAsyncOperation<HidInputReport> GetInputReportAsync() const;
public IAsyncOperation<HidInputReport> GetInputReportAsync()
Public Function GetInputReportAsync() As IAsyncOperation(Of HidInputReport)
Windows.Devices.HumanInterfaceDevice.HidDevice.getInputReportAsync().done( /* Your success and error handlers */ );

Returns

Examples

Here, we retrieve an input report (inputReport) and get the content of the report in the handler for the InputReportReceived event, triggered when the asynchronous call completes.

HidInputReport inputReport = await device.GetInputReportAsync();
.
.
.
private void InputReportReceived(
    HidDevice sender, 
    HidInputReportReceivedEventArgs args)
    {
        HidInputReport inputReport = args.Report;
        IBuffer buffer = inputReport.Data;
        DataReader dr = DataReader.FromBuffer(buffer);
        byte[] bytes = new byte[inputReport.Data.Length];
        dr.ReadBytes(bytes);

        String inputReportContent = 
           System.Text.Encoding.ASCII.GetString(bytes);
    }

Remarks

When this method completes, the InputReportReceived event is triggered.

To access the content of the input report, you must set up a listener for the InputReportReceived event and get the Report property of HidInputReportReceivedEventArgs object in the event handler.

GetInputReportAsync(UInt16) GetInputReportAsync(UInt16) GetInputReportAsync(UInt16) GetInputReportAsync(UInt16) GetInputReportAsync(UInt16)

Asynchronously retrieves an input report, identified by the reportId parameter, from the given HID device.

public : IAsyncOperation<HidInputReport> GetInputReportAsync(unsigned short reportId)
IAsyncOperation<HidInputReport> GetInputReportAsync(UInt16 reportId) const;
public IAsyncOperation<HidInputReport> GetInputReportAsync(UInt16 reportId)
Public Function GetInputReportAsync(reportId As UInt16) As IAsyncOperation(Of HidInputReport)
Windows.Devices.HumanInterfaceDevice.HidDevice.getInputReportAsync(reportId).done( /* Your success and error handlers */ );

Parameters

reportId
UInt16 UInt16 UInt16

Identifies the requested input report.

Returns

Examples

Here, we retrieve an input report (inputReport) and get the content of the report in the handler for the InputReportReceived event, triggered when the asynchronous call completes.

HidInputReport inputReport = await device.GetInputReportAsync();
.
.
.
private void InputReportReceived(
    HidDevice sender, 
    HidInputReportReceivedEventArgs args)
    {
        HidInputReport inputReport = args.Report;
        IBuffer buffer = inputReport.Data;
        DataReader dr = DataReader.FromBuffer(buffer);
        byte[] bytes = new byte[inputReport.Data.Length];
        dr.ReadBytes(bytes);

        String inputReportContent = 
           System.Text.Encoding.ASCII.GetString(bytes);
    }

Remarks

When this method completes, the InputReportReceived event is triggered.

To access the content of the input report, you must set up a listener for the InputReportReceived event and get the Report property of HidInputReportReceivedEventArgs object in the event handler.