|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.jusb.UsbDeviceImp com.ibm.jusb.UsbHubImp
public class UsbHubImp
UsbHub implementation.
This must be set up before use and/or connection to the topology tree. To set up,
see UsbDeviceImp documentation
. The number of ports may
be set in the constructor, or it will default to 1. The number of ports can be dynamically
resized
if needed.
The port numbering is 1-based, not 0-based.
Field Summary | |
---|---|
static int |
USB_HUB_MAX_PORTS
|
static int |
USB_HUB_MIN_PORTS
|
Fields inherited from class com.ibm.jusb.UsbDeviceImp |
---|
CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY, DCP_QUEUE_POLICY_KEY |
Constructor Summary | |
---|---|
UsbHubImp()
Constructor. |
|
UsbHubImp(int ports)
Constructor. |
|
UsbHubImp(int ports,
UsbDeviceDescriptor desc)
Constructor. |
|
UsbHubImp(int ports,
UsbDeviceDescriptor desc,
UsbDeviceOsImp device)
Constructor. |
|
UsbHubImp(int ports,
UsbDeviceOsImp device)
Constructor. |
|
UsbHubImp(UsbDeviceDescriptor desc)
Constructor. |
|
UsbHubImp(UsbDeviceDescriptor desc,
UsbDeviceOsImp device)
Constructor. |
|
UsbHubImp(UsbDeviceOsImp device)
Constructor. |
Method Summary | |
---|---|
void |
addUsbDeviceImp(UsbDeviceImp usbDeviceImp,
byte portNumber)
Attach this device to this hub at the specified port. |
java.util.List |
getAttachedUsbDevices()
Get all attached UsbDevices. |
byte |
getNumberOfPorts()
Get the number of (downstream) ports this hub has. |
UsbPort |
getUsbPort(byte number)
Get the specified port. |
UsbPortImp |
getUsbPortImp(byte number)
Get the specified port. |
java.util.List |
getUsbPorts()
Get all the ports this hub has. |
boolean |
isRootUsbHub()
If this is the virtual root hub . |
boolean |
isUsbHub()
If this is a UsbHub. |
void |
removeUsbDeviceImp(UsbDeviceImp usbDeviceImp,
byte portNumber)
Remove the device from this hub at the specified port. |
void |
resize(int ports)
Resizes to the specified number of ports. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int USB_HUB_MIN_PORTS
public static final int USB_HUB_MAX_PORTS
Constructor Detail |
---|
public UsbHubImp()
This creates a hub with a initial number of ports set to 1.
The the number of ports is adjustable at runtime via the
resize
method.
public UsbHubImp(int ports)
This creates a hub with the specified number of ports.
The number of ports is not adjustable at runtime via the
resize
method; it will throw UnsupportedOperationException.
ports
- The initial number of ports.public UsbHubImp(UsbDeviceDescriptor desc)
This creates a hub with a initial number of ports set to 1.
The the number of ports is adjustable at runtime via the
resize
method.
desc
- This device's descriptor.public UsbHubImp(UsbDeviceOsImp device)
This creates a hub with a initial number of ports set to 1.
The the number of ports is adjustable at runtime via the
resize
method.
device
- The platform device implementaiton.public UsbHubImp(int ports, UsbDeviceDescriptor desc)
This creates a hub with the specified number of ports.
The number of ports is not adjustable at runtime via the
resize
method; it will throw UnsupportedOperationException.
ports
- The initial number of ports.desc
- This device's descriptor.public UsbHubImp(int ports, UsbDeviceOsImp device)
This creates a hub with the specified number of ports.
The number of ports is not adjustable at runtime via the
resize
method; it will throw UnsupportedOperationException.
ports
- The initial number of ports.device
- The platform device implementation.public UsbHubImp(UsbDeviceDescriptor desc, UsbDeviceOsImp device)
This creates a hub with a initial number of ports set to 1.
The the number of ports is adjustable at runtime via the
resize
method.
desc
- This device's descriptor.device
- The platform device implementaiton.public UsbHubImp(int ports, UsbDeviceDescriptor desc, UsbDeviceOsImp device)
This creates a hub with the specified number of ports.
The number of ports is not adjustable at runtime via the
resize
method; it will throw UnsupportedOperationException.
ports
- The initial number of ports.desc
- This device's descriptor.device
- The platform device implementation.Method Detail |
---|
public void resize(int ports) throws java.lang.UnsupportedOperationException
If resizing decreases the number of ports and there are devices attached to lost ports, this will remove only down to the port with a device attached. The device(s) need to be removed before the port(s)!
ports
- The total number of ports to resize to.
java.lang.UnsupportedOperationException
public void addUsbDeviceImp(UsbDeviceImp usbDeviceImp, byte portNumber) throws UsbException
usbDeviceImp
- the UsbDeviceImp to attach.portNumber
- the number (1-based) of the port to attach the device to.
UsbException
- If the port is already occupied.public void removeUsbDeviceImp(UsbDeviceImp usbDeviceImp, byte portNumber) throws java.lang.IllegalArgumentException
usbDeviceImp
- The UsbDeviceImp to remove.portNumber
- The number (1-based) of the port the device is attached to.
java.lang.IllegalArgumentException
- if the device is not already attached
to the port it is being removed from, or the port number is invalid.public boolean isUsbHub()
UsbDevice
isUsbHub
in interface UsbDevice
isUsbHub
in class UsbDeviceImp
public boolean isRootUsbHub()
UsbHub
virtual root hub
.
isRootUsbHub
in interface UsbHub
public byte getNumberOfPorts()
UsbHub
This is only the number of ports on the hub, not all ports are necessarily enabled, available, usable, or in some cases physically present. This only represents the number of downstream ports the hub claims to have. Note that all hubs have exactly one upstream port, which allows it to connect to the system (or another upstream hub). There is also a internal port which is generally only used by the hub itself. See the USB 1.1 specification sec 11.4 for details on the internal port, sec 11.5 for details on the downstream ports, and sec 11.6 for details on the upstream port.
getNumberOfPorts
in interface UsbHub
public java.util.List getUsbPorts()
UsbHub
The port numbering is 1-based.
The List will be unmodifiable.
getUsbPorts
in interface UsbHub
UsbHub.getUsbPort( byte number )
public UsbPort getUsbPort(byte number)
getUsbPort
in interface UsbHub
number
- The number (1-based) of the port to get.
public UsbPortImp getUsbPortImp(byte number)
number
- The number (1-based) of the port to get.
public java.util.List getAttachedUsbDevices()
UsbHub
The List will be unmodifiable.
getAttachedUsbDevices
in interface UsbHub
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |