UsbDeviceClass 类

定义

通过指定设备定义的类代码、子类代码和协议代码,使应用能够获取高级查询语法 (AQS) 字符串。 此类中的属性在对 GetDeviceClassSelector 的调用中传递。

public ref class UsbDeviceClass sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UsbDeviceClass final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class UsbDeviceClass final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UsbDeviceClass
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class UsbDeviceClass
function UsbDeviceClass()
Public NotInheritable Class UsbDeviceClass
继承
Object IInspectable UsbDeviceClass
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

此 C# 代码示例演示如何指定设备类和子类代码以获取 UsbDevice 对象。

byte deviceClass = 0xf0;
byte deviceSubclass = 0x01;

var myDevices = await
    Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(
        Windows.Devices.Usb.UsbDevice.GetDeviceClassSelector(
            new Windows.Devices.Usb.UsbDeviceClass()
            {
                ClassCode = deviceClass,
                SubclassCode = deviceSubclass
            }));

注解

可以通过指定以下任一属性集来创建 UsbDeviceClass 对象:

  • 类代码。
  • 类和子类代码。
  • 类、子类和协议代码。

构造函数

UsbDeviceClass()

创建 UsbDeviceClass 对象。

属性

ClassCode

获取或设置设备的类代码。

ProtocolCode

获取或设置设备的协议代码。

SubclassCode

获取或设置设备的子类代码。

适用于