public class USBInterface 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| 构造器 | 说明 |
|---|---|
USBInterface(int id,
int alternateSetting,
String name,
int Class,
int subClass,
int protocol) |
Creates a
USBInterface object. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getAlternateSetting() |
Get the
AlternateSetting field of a USB interface. |
USBEndpoint |
getEndpoint(int index) |
Get a
USBEndpoint instance of this interface by index. |
int |
getEndpointCount() |
Get the number of endpoints.
|
int |
getId() |
Get the
localId field of a USB interface. |
int |
getInterfaceClass() |
Get the
InterfaceClass field of a USB interface. |
int |
getInterfaceProtocol() |
Get the
InterfaceProtocol field of a USB interface. |
int |
getInterfaceSubclass() |
Get the
InterfaceSubclass field of a USB interface. |
String |
getName() |
Get the
localName field of a USB interface. |
void |
setEndpoints(USBEndpoint[] endpoints) |
Sets the endpoints list for a local
USBEndpoint object. |
String |
toString() |
Returns a string representation of the object.
|
public USBInterface(int id,
int alternateSetting,
String name,
int Class,
int subClass,
int protocol)
USBInterface object.id - Indicates the ID of an interface.alternateSetting - Indicates the alternative configuration of the interface.name - Indicates the interface name.class - Indicates the interface class.subClass - Indicates the interface subclass.protocol - Indicates the protocol supported by the interface.public int getAlternateSetting()
AlternateSetting field of a USB interface.AlternateSetting field.public int getId()
localId field of a USB interface.InterfaceId field.public int getInterfaceClass()
InterfaceClass field of a USB interface.InterfaceClass field.public int getInterfaceProtocol()
InterfaceProtocol field of a USB interface.InterfaceProtocol field.public int getInterfaceSubclass()
InterfaceSubclass field of a USB interface.InterfaceSubclass field.public String getName()
localName field of a USB interface.InterfaceName field.public USBEndpoint getEndpoint(int index)
USBEndpoint instance of this interface by index.index - Indicates the endpoint index.USBEndpoint instance.public int getEndpointCount()
public void setEndpoints(USBEndpoint[] endpoints)
USBEndpoint object.endpoints - Indicates the endpoints of the interface.public String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())