HidInputReport 클래스

정의

HID 입력 보고서를 나타냅니다.

디바이스는 입력 보고서를 발행하여 상태 변경, 사용자 입력 및 기타 디바이스 관련 데이터를 설명합니다. 예를 들어 HID 키보드 디바이스는 입력 보고서를 사용하여 키 누르기 신호를 보냅니다. HID 프레즌스 센서는 입력 보고서를 사용하여 현재 상태 감지 이벤트를 신호합니다.

public ref class HidInputReport sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class HidInputReport final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class HidInputReport
Public NotInheritable Class HidInputReport
상속
Object Platform::Object IInspectable HidInputReport
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

설명

다음 예제에서는 XAML 및 C#으로 빌드된 UWP 앱 이 GetInputReportAsync 메서드를 사용하여 입력 보고서를 가져오는 방법을 보여 줍니다.

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

속성

ActivatedBooleanControls

지정된 HID 디바이스에 대해 현재 활성화된 부울 컨트롤을 가져옵니다.

Data

지정된 입력 보고서와 연결된 데이터를 가져옵니다.

Id

지정된 입력 보고서와 연결된 식별자를 가져옵니다.

TransitionedBooleanControls

지정된 HID 디바이스에 대해 최근에 전환된 부울 컨트롤을 가져옵니다.

메서드

GetBooleanControl(UInt16, UInt16)

usagePageusageId 매개 변수와 연결된 부울 컨트롤을 검색하고 지정된 입력 보고서에 있습니다.

GetBooleanControlByDescription(HidBooleanControlDescription)

controlDescription 매개 변수에서 설명한 부울 컨트롤을 검색하고 지정된 입력 보고서에서 찾습니다.

GetNumericControl(UInt16, UInt16)

usagePageusageId 매개 변수와 연결된 숫자 컨트롤을 검색하고 지정된 입력 보고서에 있습니다.

GetNumericControlByDescription(HidNumericControlDescription)

controlDescription 매개 변수에서 설명한 숫자 컨트롤을 검색하고 지정된 입력 보고서에서 찾습니다.

적용 대상

추가 정보