interfacedescriptor.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 112 行
JAVA
112 行
/*
* $Id: InterfaceDescriptor.java,v 1.1 2003/11/25 11:41:20 epr Exp $
*/
package org.jnode.driver.usb;
/**
* @author Ewout Prangsma (epr@users.sourceforge.net)
*/
public final class InterfaceDescriptor extends AbstractDescriptor {
private String intfName;
/**
* Initialize a new instance
*/
public InterfaceDescriptor() {
super(USB_DT_INTERFACE_SIZE);
}
/**
* @param data
* @param ofs
* @param len
*/
public InterfaceDescriptor(byte[] data, int ofs, int len) {
super(data, ofs, len);
}
/**
* Gets the number of this interface.
*/
public final int getInterfaceNumber() {
return getByte(2);
}
/**
* Gets the alternate setting for the interface number.
*/
public final int getAlternateSetting() {
return getByte(3);
}
/**
* Gets the number of endpoints
*/
public final int getNumEndPoints() {
return getByte(4);
}
/**
* Gets the class of this interface.
*/
public final int getInterfaceClass() {
return getByte(5);
}
/**
* Gets the subclass of this interface.
*/
public final int getInterfaceSubClass() {
return getByte(6);
}
/**
* Gets the protocol of this interface.
*/
public final int getInterfaceProtocol() {
return getByte(7);
}
/**
* Gets the index of string descriptor describing this interface.
*/
public final int getInterfaceStringIndex() {
return getByte(8);
}
/**
* Gets the name of this interface in the default language.
*/
public final String getInterfaceName() {
return intfName;
}
/**
* Load all strings with the default Language ID.
* @param dev
*/
final void loadStrings(USBDevice dev)
throws USBException {
final int iIdx = getInterfaceStringIndex();
if (iIdx > 0) {
intfName = dev.getString(iIdx, 0);
}
}
/**
* Convert to a String representation
* @see java.lang.Object#toString()
*/
public final String toString() {
return "INTF[ifnum:" + getInterfaceNumber() +
", altst:" + getAlternateSetting() +
", #ep:" + getNumEndPoints() +
", iclass:" + getInterfaceClass() +
", isubcls:" + getInterfaceSubClass() +
", iprot:" + getInterfaceProtocol() +
", name:" + ((intfName != null) ? intfName : ("%" + getInterfaceStringIndex())) + "]";
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?