com.mcreations.usb.windows
Class WindowsHubOsImp

java.lang.Object
  extended by com.ibm.jusb.UsbDeviceImp
      extended by com.mcreations.usb.windows.WindowsHubOsImp
All Implemented Interfaces:
UsbDeviceOsImp, UsbIrpImp.UsbIrpImpListener, EventListener, UsbDevice, UsbHub

public class WindowsHubOsImp
extends UsbDeviceImp
implements UsbHub

Windows implementation of an UsbHub is just a thin wrapper around UsbHubImp.

Author:
Kambiz Darabi

Field Summary
 
Fields inherited from class com.ibm.jusb.UsbDeviceImp
CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY, createShortPacketException, DCP_QUEUE_POLICY_KEY, disconnected, listTable, queueManager, queueSubmissions, submissionCount
 
Constructor Summary
WindowsHubOsImp(usb_device device)
           
 
Method Summary
 void asyncSubmit(List list)
          Submit a List of UsbControlIrps asynchronously to the Default Control Pipe.
 void asyncSubmit(UsbControlIrpImp irp)
          Asynchronously submit a control request.
 void asyncSubmit(UsbIrpImp irp)
          Asynchronously submit a UsbControlIrpImp.
 List getAttachedUsbDevices()
          Get all attached UsbDevices.
 usb_device getDevice()
           
 byte getNumberOfPorts()
          Get the number of (downstream) ports this hub has.
 String getString(byte index)
          Get the String from the specified string descriptor.
 UsbDeviceOsImp getUsbDeviceOsImp()
           
 UsbPort getUsbPort(byte number)
          Get a specific UsbPort by port number.
 List getUsbPorts()
          Get all the ports this hub has.
 boolean isRootUsbHub()
          If this is the virtual root hub.
 void syncSubmit(List list)
          Submit a List of UsbControlIrps synchronously to the Default Control Pipe.
 void syncSubmit(UsbControlIrpImp irp)
          Synchronously submit a control request.
 void syncSubmit(UsbIrpImp irp)
          Synchronously submit a UsbIrpImp.
 
Methods inherited from class com.ibm.jusb.UsbDeviceImp
addRunnable, addUsbConfigurationImp, addUsbDeviceListener, asyncSubmit, connect, containsUsbConfiguration, createUsbControlIrp, disconnect, fireEvent, getActiveUsbConfiguration, getActiveUsbConfigurationImp, getActiveUsbConfigurationNumber, getCachedUsbStringDescriptor, getLangId, getManufacturerString, getParentUsbPort, getParentUsbPortImp, getProductString, getSerialNumberString, getSpeed, getUsbConfiguration, getUsbConfigurationImp, getUsbConfigurations, getUsbDeviceDescriptor, getUsbStringDescriptor, isConfigured, isUsbHub, queueList, queueUsbControlIrpImp, removeUsbDeviceListener, requestUsbStringDescriptor, setActiveUsbConfigurationNumber, setCachedUsbStringDescriptor, setParentUsbPortImp, setPolicies, setSpeed, setupUsbControlIrpImp, setUsbDeviceDescriptor, setUsbDeviceOsImp, submitUsbControlIrpImpFromQueue, syncSubmit, usbControlIrpListToUsbControlIrpImpList, usbControlIrpToUsbControlIrpImp, usbIrpImpComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.usb.UsbDevice
addUsbDeviceListener, asyncSubmit, asyncSubmit, containsUsbConfiguration, createUsbControlIrp, getActiveUsbConfiguration, getActiveUsbConfigurationNumber, getManufacturerString, getParentUsbPort, getProductString, getSerialNumberString, getSpeed, getString, getUsbConfiguration, getUsbConfigurations, getUsbDeviceDescriptor, getUsbStringDescriptor, isConfigured, isUsbHub, removeUsbDeviceListener, syncSubmit, syncSubmit
 

Constructor Detail

WindowsHubOsImp

public WindowsHubOsImp(usb_device device)
Method Detail

getNumberOfPorts

public byte getNumberOfPorts()
Description copied from interface: UsbHub
Get the number of (downstream) ports this hub has.

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.

Specified by:
getNumberOfPorts in interface UsbHub
Returns:
The number of (downstream) ports for this hub.

getUsbPorts

public List getUsbPorts()
Description copied from interface: UsbHub
Get all the ports this hub has.

The port numbering is 1-based.

The List will be unmodifiable.

Specified by:
getUsbPorts in interface UsbHub
Returns:
All ports this hub has.
See Also:
UsbHub.getUsbPort( byte number )

getUsbPort

public UsbPort getUsbPort(byte number)
Description copied from interface: UsbHub
Get a specific UsbPort by port number.

This gets the UsbPort with the specified number. The port numbering is 1-based (not 0-based), and the max port number is 255. See the USB 1.1 specification table 11.8 offset 7.

If the specified port does not exist, this returns null.

Specified by:
getUsbPort in interface UsbHub
Parameters:
number - The number (1-based) of the port to get.
Returns:
The specified port, or null.

getAttachedUsbDevices

public List getAttachedUsbDevices()
Description copied from interface: UsbHub
Get all attached UsbDevices.

The List will be unmodifiable.

Specified by:
getAttachedUsbDevices in interface UsbHub
Returns:
All devices currently attached to this hub.

isRootUsbHub

public boolean isRootUsbHub()
Description copied from interface: UsbHub
If this is the virtual root hub.

Specified by:
isRootUsbHub in interface UsbHub
Returns:
If this is the virtual root hub.

asyncSubmit

public void asyncSubmit(UsbIrpImp irp)
                 throws UsbException
Asynchronously submit a UsbControlIrpImp.

Throws:
UsbException
See Also:
UsbDeviceOsImp.syncSubmit(com.ibm.jusb.UsbControlIrpImp)

asyncSubmit

public void asyncSubmit(UsbControlIrpImp irp)
                 throws UsbException
Asynchronously submit a control request.

Specified by:
asyncSubmit in interface UsbDeviceOsImp
Parameters:
irp - The UsbControlIrpImp.
Throws:
UsbException - If the submission was not accepted by the implementation.
See Also:
UsbDeviceOsImp.syncSubmit(com.ibm.jusb.UsbControlIrpImp)

syncSubmit

public void syncSubmit(UsbControlIrpImp irp)
                throws UsbException
Synchronously submit a control request.

Specified by:
syncSubmit in interface UsbDeviceOsImp
Parameters:
irp - The UsbControlIrpImp.
Throws:
UsbException - If the submission is unsuccessful.
See Also:
UsbDeviceOsImp.syncSubmit(com.ibm.jusb.UsbControlIrpImp)

syncSubmit

public void syncSubmit(UsbIrpImp irp)
                throws UsbException
Synchronously submit a UsbIrpImp.

Throws:
UsbException
See Also:
UsbDeviceOsImp.syncSubmit(com.ibm.jusb.UsbControlIrpImp)

asyncSubmit

public void asyncSubmit(List list)
                 throws UsbException,
                        IllegalArgumentException,
                        UsbDisconnectedException
Description copied from class: UsbDeviceImp
Submit a List of UsbControlIrps asynchronously to the Default Control Pipe.

All UsbControlIrps are guaranteed to be atomically (with respect to other clients of this API) submitted to the Default Control Pipe. Atomicity on a native level is implementation-dependent.

Specified by:
asyncSubmit in interface UsbDeviceOsImp
Specified by:
asyncSubmit in interface UsbDevice
Overrides:
asyncSubmit in class UsbDeviceImp
Parameters:
list - The List of UsbControlIrps.
Throws:
UsbException - If an error occurrs.
IllegalArgumentException - If one of the UsbControlIrps is invalid.
UsbDisconnectedException - If the device has been disconnected.

syncSubmit

public void syncSubmit(List list)
                throws UsbException,
                       IllegalArgumentException,
                       UsbDisconnectedException
Description copied from class: UsbDeviceImp
Submit a List of UsbControlIrps synchronously to the Default Control Pipe.

All UsbControlIrps are guaranteed to be atomically (with respect to other clients of this API) submitted to the Default Control Pipe. Atomicity on a native level is implementation-dependent.

Specified by:
syncSubmit in interface UsbDeviceOsImp
Specified by:
syncSubmit in interface UsbDevice
Overrides:
syncSubmit in class UsbDeviceImp
Parameters:
list - The List of UsbControlIrps.
Throws:
UsbException - If an error occurrs.
IllegalArgumentException - If one of the UsbControlIrps is invalid.
UsbDisconnectedException - If the device has been disconnected.

getUsbDeviceOsImp

public UsbDeviceOsImp getUsbDeviceOsImp()
Overrides:
getUsbDeviceOsImp in class UsbDeviceImp
Returns:
the associated UsbDeviceImp

getDevice

public usb_device getDevice()
Returns:
Returns the device.

getString

public String getString(byte index)
                 throws UsbException,
                        UsbEncodingException,
                        UsbDisconnectedException
Description copied from interface: UsbDevice
Get the String from the specified string descriptor.

This is a convienence method, which uses getUsbStringDescriptor(). getString().

Specified by:
getString in interface UsbDevice
Overrides:
getString in class UsbDeviceImp
Parameters:
index - The index of the string to get.
Returns:
the String from the specified STringDescriptor
Throws:
UsbException - if an error occurrs while getting the UsbStringDescriptor.
UsbEncodingException - If the string encoding is not supported.
UsbDisconnectedException - If the device has been disconnected.


Copyright © 2012 LSST. All Rights Reserved.