com.ibm.jusb
Class UsbControlPipeImp

java.lang.Object
  extended by com.ibm.jusb.UsbPipeImp
      extended by com.ibm.jusb.UsbControlPipeImp
All Implemented Interfaces:
UsbIrpImp.UsbIrpImpListener, EventListener, UsbPipe

public class UsbControlPipeImp
extends UsbPipeImp
implements UsbPipe

UsbPipe platform-independent implementation for Control-type pipes.

Author:
Dan Streetman

Field Summary
 
Fields inherited from class com.ibm.jusb.UsbPipeImp
abortInProgress, CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY, createShortPacketException, listenerImp, listTable, PIPE_BULK_QUEUE_POLICY_KEY, PIPE_CONTROL_QUEUE_POLICY_KEY, PIPE_INTERRUPT_QUEUE_POLICY_KEY, PIPE_ISOCHRONOUS_QUEUE_POLICY_KEY, queueManager, queueSubmissions, submissionList
 
Constructor Summary
UsbControlPipeImp()
          Constructor.
UsbControlPipeImp(UsbControlPipeOsImp pipe)
          Constructor.
UsbControlPipeImp(UsbEndpointImp ep)
          Constructor.
UsbControlPipeImp(UsbEndpointImp ep, UsbControlPipeOsImp pipe)
          Constructor.
 
Method Summary
 UsbIrp asyncSubmit(byte[] data)
          Control pipes cannot handle raw byte[] submissions.
 int syncSubmit(byte[] data)
          Control pipes cannot handle raw byte[] submissions.
protected  UsbIrpImp usbIrpToUsbIrpImp(UsbIrp irp)
          Convert a UsbControlIrp to UsbControlIrpImp.
 
Methods inherited from class com.ibm.jusb.UsbPipeImp
abortAllSubmissions, addRunnable, addUsbPipeListener, asyncSubmit, asyncSubmit, checkActive, checkDisconnected, checkOpen, close, createUsbControlIrp, createUsbIrp, createUsbIrpImp, fireEvent, getUsbEndpoint, getUsbEndpointImp, getUsbPipeOsImp, isActive, isDisconnected, isInDirection, isOpen, open, queueList, queueUsbIrpImp, removeUsbPipeListener, setPolicies, setupUsbIrpImp, setUsbEndpointImp, setUsbPipeOsImp, submitUsbIrpImpFromQueue, syncSubmit, syncSubmit, usbIrpImpComplete, usbIrpListToUsbIrpImpList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.usb.UsbPipe
abortAllSubmissions, addUsbPipeListener, asyncSubmit, asyncSubmit, close, createUsbControlIrp, createUsbIrp, getUsbEndpoint, isActive, isOpen, open, removeUsbPipeListener, syncSubmit, syncSubmit
 

Constructor Detail

UsbControlPipeImp

public UsbControlPipeImp()
Constructor.


UsbControlPipeImp

public UsbControlPipeImp(UsbEndpointImp ep)
Constructor.

Parameters:
ep - The UsbEndpointImp.

UsbControlPipeImp

public UsbControlPipeImp(UsbControlPipeOsImp pipe)
Constructor.

Parameters:
pipe - The platform-dependent pipe implementation.

UsbControlPipeImp

public UsbControlPipeImp(UsbEndpointImp ep,
                         UsbControlPipeOsImp pipe)
Constructor.

Parameters:
ep - The UsbEndpointImp.
pipe - The platform-dependent pipe implementation.
Method Detail

syncSubmit

public int syncSubmit(byte[] data)
               throws UsbException
Control pipes cannot handle raw byte[] submissions.

Since Control pipes require a setup packet, raw byte[]s are disallowed. This will throw UsbException.

Specified by:
syncSubmit in interface UsbPipe
Overrides:
syncSubmit in class UsbPipeImp
Parameters:
data - The buffer to use.
Returns:
The number of bytes actually transferred.
Throws:
UsbException - Raw byte[]s cannot be used on Control pipes.

asyncSubmit

public UsbIrp asyncSubmit(byte[] data)
                   throws UsbException
Control pipes cannot handle raw byte[] submissions.

Since Control pipes require a setup packet, raw byte[]s are disallowed. This will throw UsbException.

Specified by:
asyncSubmit in interface UsbPipe
Overrides:
asyncSubmit in class UsbPipeImp
Parameters:
data - The buffer to use.
Returns:
A UsbIrp representing the submission.
Throws:
UsbException - Raw byte[]s cannot be used on Control pipes.

usbIrpToUsbIrpImp

protected UsbIrpImp usbIrpToUsbIrpImp(UsbIrp irp)
                               throws UsbException
Convert a UsbControlIrp to UsbControlIrpImp.

If the UsbIrp is not a UsbControlIrp, a UsbException is thrown. This does not use the superclass method.

Overrides:
usbIrpToUsbIrpImp in class UsbPipeImp
Parameters:
irp - The UsbControlIrp to convert.
Throws:
UsbException - If the UsbIrp is not ready for submission.


Copyright © 2012 LSST. All Rights Reserved.