com.ibm.jusb
Class UsbControlIrpImp

java.lang.Object
  extended by javax.usb.util.DefaultUsbIrp
      extended by com.ibm.jusb.UsbIrpImp
          extended by com.ibm.jusb.UsbControlIrpImp
All Implemented Interfaces:
UsbControlIrp, UsbIrp

public class UsbControlIrpImp
extends UsbIrpImp
implements UsbControlIrp

UsbControlIrp implementation.

This is the same as UsbIrpImp, except this contains Control-specific setup packet information.

This does not extend javax.usb.util.DefaultUsbControlIrp.

Author:
Dan Streetman

Nested Class Summary
 
Nested classes/interfaces inherited from class com.ibm.jusb.UsbIrpImp
UsbIrpImp.UsbIrpImpListener
 
Constructor Summary
UsbControlIrpImp(byte bmRequestType, byte bRequest, short wValue, short wIndex)
          Constructor.
UsbControlIrpImp(UsbControlIrp controlUsbIrp)
          Constructor.
 
Method Summary
 byte bmRequestType()
          Get the bmRequestType.
 byte bRequest()
          Get the bRequest.
static void checkUsbControlIrp(UsbControlIrp irp)
          Check the specified UsbControlIrp.
 void complete()
          Complete this submission.
 byte[] getSetupPacket()
          Get the setup packet (Control header).
 UsbDeviceImp getUsbDeviceImp()
          Get the UsbDeviceImp.
 boolean isSetConfiguration()
          If this is a SET_CONFIGURATION UsbIrp.
 boolean isSetInterface()
          If this is a SET_INTERFACE UsbIrp.
 void setUsbDeviceImp(UsbDeviceImp device)
          Set the UsbDeviceImp.
 short wIndex()
          Get the wIndex.
 short wLength()
          Get the wLength.
 short wValue()
          Get the wValue.
 
Methods inherited from class com.ibm.jusb.UsbIrpImp
checkUsbIrp, getUsbIrp, getUsbIrpImpListener, hasUsbIrp, setCreateShortPacketException, setUsbIrp, setUsbIrpImpListener
 
Methods inherited from class javax.usb.util.DefaultUsbIrp
getAcceptShortPacket, getActualLength, getData, getLength, getOffset, getUsbException, isComplete, isUsbException, setAcceptShortPacket, setActualLength, setComplete, setData, setData, setLength, setOffset, setUsbException, waitUntilComplete, waitUntilComplete
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.usb.UsbIrp
getAcceptShortPacket, getActualLength, getData, getLength, getOffset, getUsbException, isComplete, isUsbException, setAcceptShortPacket, setActualLength, setComplete, setData, setData, setLength, setOffset, setUsbException, waitUntilComplete, waitUntilComplete
 

Constructor Detail

UsbControlIrpImp

public UsbControlIrpImp(byte bmRequestType,
                        byte bRequest,
                        short wValue,
                        short wIndex)
Constructor.

Parameters:
bmRequestType - The bmRequestType.
bRequest - The bRequest.
wValue - The wValue.
wIndex - The wIndex.

UsbControlIrpImp

public UsbControlIrpImp(UsbControlIrp controlUsbIrp)
Constructor.

Parameters:
controlUsbIrp - The UsbControlIrp this should wrap.
Method Detail

bmRequestType

public byte bmRequestType()
Get the bmRequestType.

Specified by:
bmRequestType in interface UsbControlIrp
Returns:
The bmRequestType.

bRequest

public byte bRequest()
Get the bRequest.

Specified by:
bRequest in interface UsbControlIrp
Returns:
The bRequest.

wValue

public short wValue()
Get the wValue.

Specified by:
wValue in interface UsbControlIrp
Returns:
The wValue.

wIndex

public short wIndex()
Get the wIndex.

Specified by:
wIndex in interface UsbControlIrp
Returns:
The wIndex.

wLength

public short wLength()
Get the wLength.

Returns:
The wLength.

complete

public void complete()
Complete this submission.

If this is a successful set configuration request, this will set the active configuration number. If this is a successful set interface request, this will set the active setting number. Then, it will perform the superclass's complete.

Specified by:
complete in interface UsbIrp
Overrides:
complete in class UsbIrpImp

isSetConfiguration

public boolean isSetConfiguration()
If this is a SET_CONFIGURATION UsbIrp.

Returns:
If this is a SET_CONFIGURATION UsbIrp.

isSetInterface

public boolean isSetInterface()
If this is a SET_INTERFACE UsbIrp.

Returns:
If this is a SET_INTERFACE UsbIrp.

getSetupPacket

public byte[] getSetupPacket()
Get the setup packet (Control header).

This creates a new byte[] constructed using the Control-specific methods in this class. See the USB 1.1 specification section 9.3; specifically, the setup packet is constructed as such:

  1. bmRequestType
  2. bRequest
  3. wValue's LSB (Least Significant Byte)
  4. wValue's MSB (Most Significant Byte)
  5. wIndex's LSB
  6. wIndex's MSB
  7. wLength's LSB
  8. wLength's MSB

Returns:
The setup packet (Control header).

getUsbDeviceImp

public UsbDeviceImp getUsbDeviceImp()
Get the UsbDeviceImp.

Returns:
The UsbDeviceImp.

setUsbDeviceImp

public void setUsbDeviceImp(UsbDeviceImp device)
Set the UsbDeviceImp.

Parameters:
device - The UsbDeviceImp.

checkUsbControlIrp

public static void checkUsbControlIrp(UsbControlIrp irp)
                               throws java.lang.IllegalArgumentException,
                                      UsbException
Check the specified UsbControlIrp.

This may be used to check the validity of an UsbControlIrp. This will throw an IllegalArgumentException if the UsbControlIrp does not behave as specified in the UsbControlIrp interface documentation. This will throw an UsbException if the UsbControlIrp is in a state not ready for submission, such as being complete or having a UsbException.

Throws:
java.lang.IllegalArgumentException - If the UsbControlIrp is not valid.
UsbException - If the UsbControlIrp is not ready for submission.