com.ibm.jusb
Class UsbPortImp

java.lang.Object
  extended by com.ibm.jusb.UsbPortImp
All Implemented Interfaces:
UsbPort

public class UsbPortImp
extends java.lang.Object
implements UsbPort

UsbPort implementation.

Author:
Dan Streetman

Constructor Summary
UsbPortImp(UsbHubImp hub, byte number)
          Constructor.
 
Method Summary
 void attachUsbDeviceImp(UsbDeviceImp device)
          Attaches the UsbDeviceImp to this port.
 void detachUsbDeviceImp(UsbDeviceImp device)
          Detaches the attached UsbDeviceImp from this port.
 byte getPortNumber()
          Return the number of this port.
 UsbDevice getUsbDevice()
          Get the UsbDevice attached to this UsbPort.
 UsbDeviceImp getUsbDeviceImp()
           
 UsbHub getUsbHub()
          Get the parent UsbHub.
 UsbHubImp getUsbHubImp()
           
 boolean isUsbDeviceAttached()
          If a device is attached to this port.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsbPortImp

public UsbPortImp(UsbHubImp hub,
                  byte number)
Constructor.

Parameters:
hub - The parent UsbHubImp.
number - The (1-based) port number.
Method Detail

getPortNumber

public byte getPortNumber()
Return the number of this port.

The port number is 1-based.

Specified by:
getPortNumber in interface UsbPort
Returns:
The number of this port.

getUsbHub

public UsbHub getUsbHub()
Description copied from interface: UsbPort
Get the parent UsbHub.

Specified by:
getUsbHub in interface UsbPort
Returns:
The parent UsbHub

getUsbHubImp

public UsbHubImp getUsbHubImp()
Returns:
The parent UsbHubImp

isUsbDeviceAttached

public boolean isUsbDeviceAttached()
Description copied from interface: UsbPort
If a device is attached to this port.

Specified by:
isUsbDeviceAttached in interface UsbPort
Returns:
true if a device is attached to this port

getUsbDevice

public UsbDevice getUsbDevice()
Description copied from interface: UsbPort
Get the UsbDevice attached to this UsbPort.

If no UsbDevice is attached, this returns null.

Specified by:
getUsbDevice in interface UsbPort
Returns:
The attached UsbDevice or null if none attached

getUsbDeviceImp

public UsbDeviceImp getUsbDeviceImp()
Returns:
The attached UsbDeviceImp or null if none attached

attachUsbDeviceImp

public void attachUsbDeviceImp(UsbDeviceImp device)
                        throws java.lang.IllegalArgumentException
Attaches the UsbDeviceImp to this port.

Parameters:
device - The UsbDeviceImp to attach.
Throws:
java.lang.IllegalArgumentException - If there is already a device attached.

detachUsbDeviceImp

public void detachUsbDeviceImp(UsbDeviceImp device)
                        throws java.lang.IllegalArgumentException
Detaches the attached UsbDeviceImp from this port.

Parameters:
device - the UsbDeviceImp to detach.
Throws:
java.lang.IllegalArgumentException - If the UsbDeviceImp is not already attached.