HidDevice.GetInputReportAsync 메서드

정의

오버로드

GetInputReportAsync()

지정된 HID 디바이스에서 기본 또는 첫 번째 입력 보고서를 비동기적으로 검색합니다.

GetInputReportAsync(UInt16)

지정된 HID 디바이스에서 reportId 매개 변수로 식별되는 입력 보고서를 비동기적으로 검색합니다.

GetInputReportAsync()

지정된 HID 디바이스에서 기본 또는 첫 번째 입력 보고서를 비동기적으로 검색합니다.

public:
 virtual IAsyncOperation<HidInputReport ^> ^ GetInputReportAsync() = GetInputReportAsync;
/// [Windows.Foundation.Metadata.Overload("GetInputReportAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<HidInputReport> GetInputReportAsync();
[Windows.Foundation.Metadata.Overload("GetInputReportAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<HidInputReport> GetInputReportAsync();
function getInputReportAsync()
Public Function GetInputReportAsync () As IAsyncOperation(Of HidInputReport)

반환

HidInputReport 개체입니다.

특성

예제

여기서는 입력 보고서(inputReport)를 검색하고 비동기 호출이 완료될 때 트리거되는 InputReportReceived 이벤트에 대한 처리기에서 보고서의 콘텐츠를 가져옵니다.

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

설명

이 메서드가 완료되면 InputReportReceived 이벤트가 트리거됩니다.

입력 보고서의 콘텐츠에 액세스하려면 InputReportReceived 이벤트에 대한 수신기를 설정하고 이벤트 처리기에서 HidInputReportReceivedEventArgs 개체의 Report 속성을 가져와야 합니다.

FileAccessMode.Read 또는 FileAccessMode.ReadWrite를 사용하여 디바이스를 열어야 합니다.

적용 대상

GetInputReportAsync(UInt16)

지정된 HID 디바이스에서 reportId 매개 변수로 식별되는 입력 보고서를 비동기적으로 검색합니다.

public:
 virtual IAsyncOperation<HidInputReport ^> ^ GetInputReportAsync(unsigned short reportId) = GetInputReportAsync;
/// [Windows.Foundation.Metadata.Overload("GetInputReportByIdAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<HidInputReport> GetInputReportAsync(uint16_t const& reportId);
[Windows.Foundation.Metadata.Overload("GetInputReportByIdAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<HidInputReport> GetInputReportAsync(ushort reportId);
function getInputReportAsync(reportId)
Public Function GetInputReportAsync (reportId As UShort) As IAsyncOperation(Of HidInputReport)

매개 변수

reportId
UInt16

unsigned short

uint16_t

요청된 입력 보고서를 식별합니다.

반환

HidInputReport 개체입니다.

특성

예제

여기서는 입력 보고서(inputReport)를 검색하고 비동기 호출이 완료될 때 트리거되는 InputReportReceived 이벤트에 대한 처리기에서 보고서의 콘텐츠를 가져옵니다.

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

설명

이 메서드가 완료되면 InputReportReceived 이벤트가 트리거됩니다.

입력 보고서의 콘텐츠에 액세스하려면 InputReportReceived 이벤트에 대한 수신기를 설정하고 이벤트 처리기에서 HidInputReportReceivedEventArgs 개체의 Report 속성을 가져와야 합니다.

FileAccessMode.Read 또는 FileAccessMode.ReadWrite를 사용하여 디바이스를 열어야 합니다.

적용 대상