public class USBDevice extends Object
When using this class, a USB device is attached to a USB host. According to the USB protocol specifications, a device contains one or more configurations, a configuration contains one or more interfaces, and an interface contains one or more endpoints.
SystemCapability.Usb#USB_MANAGER| 构造器 | 说明 |
|---|---|
USBDevice(String deviceName,
int vendorId,
int productId,
int classId,
int subClassId,
int protocolId,
String manufacturerName,
String productName,
String version,
String serialNumber) |
A constructor used to create a
USBDevice. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
USBConfig |
getConfiguration(int index) |
Get a
USBConfig instance of this device by index. |
int |
getConfigurationCount() |
Get the number of configurations of this device.
|
int |
getDeviceClass() |
Gets the
Class field of a USB device. |
int |
getDeviceId() |
Gets the
Id field of a USB device. |
static int |
getDeviceId(String name) |
Gets the
Id field of the USB device. |
String |
getDeviceName() |
Get the
Name field of a USB device. |
static String |
getDeviceName(int id) |
Get the
Name field of a USB device. |
int |
getDeviceProtocol() |
Get the
Protocol field of a USB device. |
int |
getDeviceSubclass() |
Get the
SubClass field of a USB device. |
USBInterface |
getInterface(int index) |
Get an interface instance of this device by index.
|
int |
getInterfaceCount() |
Get the number of interfaces of this device.
|
String |
getManufacturerName() |
Get the manufacturer string of this device.
|
int |
getProductId() |
Get the
ProductId field of a USB device. |
String |
getProductName() |
Get the
ProductName field of a USB device. |
String |
getSerialNumber() |
Get the
SerialNumber field of a USB device. |
int |
getVendorId() |
Get the
VendorId field of a USB device. |
String |
getVersion() |
Get the
Version field of a USB device. |
void |
setConfigurations(USBConfig[] configs) |
Sets configurations of this device.
|
void |
setInterfaces(USBInterface[] interfaces) |
Sets interfaces for a local object.
|
public USBDevice(String deviceName, int vendorId, int productId, int classId, int subClassId, int protocolId, String manufacturerName, String productName, String version, String serialNumber)
USBDevice.deviceName - Indicates the name of the USB device, which is usually determined by the low layer.vendorId - Indicates the vendor ID of the USB device, which is assigned by the USB-IF.productId - Indicates the product ID of the USB device, which is assigned by the USB-IF.classId - Indicates the class code of the USB device, which is assigned by the USB-IF.subClassId - Indicates the subclass code of the USB device, which is assigned by the USB-IF.protocolId - Indicates the protocol code of the USB device, which is assigned by the USB-IF.manufacturerName - Indicates the manufacturer name of the USB device.productName - Indicates the product name of the USB device.version - Indicates the version number of the USB device.serialNumber - Indicates the serial number of the USB device.public int getDeviceClass()
Class field of a USB device.Class field.public int getDeviceId()
Id field of a USB device.Id field.public static int getDeviceId(String name)
Id field of the USB device.name - Name of the USB device.Id field.public String getDeviceName()
Name field of a USB device.Name field.public static String getDeviceName(int id)
Name field of a USB device.id - Id of the USB device.Name field.public int getDeviceProtocol()
Protocol field of a USB device.Protocol field.public int getDeviceSubclass()
SubClass field of a USB device.SubClass field.public void setInterfaces(USBInterface[] interfaces)
interfaces - Indicates the array of a USBInterface object.public USBInterface getInterface(int index)
index - Indicates the interface index.public int getInterfaceCount()
public String getManufacturerName()
public int getProductId()
ProductId field of a USB device.ProductId field.public String getProductName()
ProductName field of a USB device.ProductName field.public String getSerialNumber()
SerialNumber field of a USB device.SerialNumber field.public int getVendorId()
VendorId field of a USB device.VendorId field.public String getVersion()
Version field of a USB device.Version field.public USBConfig getConfiguration(int index)
USBConfig instance of this device by index.index - Indicates the configuration index.USBConfig object.public int getConfigurationCount()
public void setConfigurations(USBConfig[] configs)
configs - Indicates the array of a USBConfig object.