public class UsbInterface
extends Object implements Parcelable
| java.lang.Object | |
| android.hardware.usb.UsbInterface | |
代表UsbDevice上的接口的UsbDevice 。 USB设备可以具有一个或多个接口,每个接口提供与其他接口分离的不同功能块。 一个接口将有一个或多个UsbEndpoint ,这是主机通过设备传输数据的通道。
有关与USB硬件通信的更多信息,请阅读 USB开发人员指南。
Inherited constants |
|---|
android.os.Parcelable
|
Fields |
|
|---|---|
public static final Creator<UsbInterface> |
CREATOR |
公共方法(Public methods) |
|
|---|---|
int |
describeContents() 描述此Parcelable实例的封送表示中包含的特殊对象的种类。 |
int |
getAlternateSetting() 返回接口的bAlternateSetting字段。 |
UsbEndpoint |
getEndpoint(int index) 返回给定索引处的 |
int |
getEndpointCount() 返回此接口包含的数量 |
int |
getId() 返回接口的bInterfaceNumber字段。 |
int |
getInterfaceClass() 返回接口的类字段。 |
int |
getInterfaceProtocol() 返回接口的协议字段。 |
int |
getInterfaceSubclass() 返回接口的子类字段。 |
String |
getName() 返回接口的名称。 |
String |
toString() 返回对象的字符串表示形式。 |
void |
writeToParcel(Parcel parcel, int flags) 将此对象平铺到一个包裹中。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
android.os.Parcelable
|
|
int describeContents ()
描述此Parcelable实例的封送表示中包含的特殊对象的种类。 例如,如果对象将在writeToParcel(Parcel, int)的输出中包含writeToParcel(Parcel, int) ,则此方法的返回值必须包含CONTENTS_FILE_DESCRIPTOR位。
| 返回(Returns) | |
|---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
int getAlternateSetting ()
返回接口的bAlternateSetting字段。 这是一个整数,与ID一起唯一标识设备上的接口。 setInterface(UsbInterface)可用于在具有相同ID但不同备用设置的两个接口之间切换。
| 返回(Returns) | |
|---|---|
int |
the interface's alternate setting |
UsbEndpoint getEndpoint (int index)
返回给定索引处的 UsbEndpoint 。
| 参数(Parameters) | |
|---|---|
index |
int
|
| 返回(Returns) | |
|---|---|
UsbEndpoint |
the endpoint |
int getEndpointCount ()
返回此接口包含的数量 UsbEndpoint 。
| 返回(Returns) | |
|---|---|
int |
the number of endpoints |
int getId ()
返回接口的bInterfaceNumber字段。 这是一个整数,与替代设置一起唯一标识设备上的接口。
| 返回(Returns) | |
|---|---|
int |
the interface's ID |
int getInterfaceClass ()
返回接口的类字段。 一些有用的USB类常量可以在UsbConstants找到
| 返回(Returns) | |
|---|---|
int |
the interface's class |
int getInterfaceProtocol ()
返回接口的协议字段。
| 返回(Returns) | |
|---|---|
int |
the interface's protocol |
int getInterfaceSubclass ()
返回接口的子类字段。
| 返回(Returns) | |
|---|---|
int |
the interface's subclass |
String toString ()
返回对象的字符串表示形式。 一般来说, toString方法返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。
类Object的toString方法将返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:
getClass().getName() + '@' + Integer.toHexString(hashCode())
| 返回(Returns) | |
|---|---|
String |
a string representation of the object. |
void writeToParcel (Parcel parcel, int flags)
将此对象平铺到一个包裹中。
| 参数(Parameters) | |
|---|---|
parcel |
Parcel: The Parcel in which the object should be written. |
flags |
int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. |