📄 portstatus.java
字号:
/*
* $Id: PortStatus.java,v 1.1 2003/11/25 11:42:24 epr Exp $
*/
package org.jnode.driver.usb.hub;
import org.jnode.driver.usb.USBPacket;
import org.jnode.util.NumberUtils;
/**
* @author Ewout Prangsma (epr@users.sourceforge.net)
*/
public class PortStatus extends USBPacket {
/**
* Initialize this instance
*/
public PortStatus() {
super(4);
}
/**
* Gets the wPortStatus field.
*/
public int getPortStatus() {
return getShort(0);
}
/**
* Are specific bits of the port status set.
* @param mask
* @return True if all of the mask bits have been set, false otherwise.
*/
public boolean getPortStatusBits(int mask) {
return ((getShort(0) & mask) == mask);
}
/**
* Gets the wPortChange field.
*/
public int getPortChange() {
return getShort(2);
}
/**
* Are specific bits of the port change set.
* @param mask
* @return True if all of the mask bits have been set, false otherwise.
*/
public boolean getPortChangeBits(int mask) {
return ((getShort(2) & mask) == mask);
}
public String toString() {
return "ST:" + NumberUtils.hex(getPortStatus(), 4) + ", CH:" + NumberUtils.hex(getPortChange(), 4);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -