|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ibm.jusb.UsbPipeImp
public class UsbPipeImp
UsbPipe platform-independent implementation.
This must be set up before use.
UsbEndpointImp must be set either in the
constructor or by its setter.UsbPipeOsImp may optionally be set either in the
constructor or by its setter.
If not set, it defaults to a DefaultUsbPipeOsImp.
| Field Summary | |
|---|---|
protected boolean |
abortInProgress
|
static String |
CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY
|
protected boolean |
createShortPacketException
|
protected UsbPipeListenerImp |
listenerImp
|
protected Hashtable |
listTable
|
static String |
PIPE_BULK_QUEUE_POLICY_KEY
|
static String |
PIPE_CONTROL_QUEUE_POLICY_KEY
|
static String |
PIPE_INTERRUPT_QUEUE_POLICY_KEY
|
static String |
PIPE_ISOCHRONOUS_QUEUE_POLICY_KEY
|
protected RunnableManager |
queueManager
|
protected boolean |
queueSubmissions
|
protected List |
submissionList
|
| Constructor Summary | |
|---|---|
UsbPipeImp()
Constructor. |
|
UsbPipeImp(UsbEndpointImp ep)
Constructor. |
|
UsbPipeImp(UsbEndpointImp ep,
UsbPipeOsImp pipe)
Constructor. |
|
UsbPipeImp(UsbPipeOsImp pipe)
Constructor. |
|
| Method Summary | |
|---|---|
void |
abortAllSubmissions()
Stop all submissions in progress. |
protected void |
addRunnable(Runnable r)
Add a Runnable to the queueManager. |
void |
addUsbPipeListener(UsbPipeListener listener)
Register's the listener object for UsbPipeEvent |
UsbIrp |
asyncSubmit(byte[] data)
Asynchonously submits this byte[] array to the UsbPipe. |
void |
asyncSubmit(List list)
Asynchronous submission using a List of UsbIrps. |
void |
asyncSubmit(UsbIrp usbIrp)
Asynchronous submission using a UsbIrp. |
protected void |
checkActive()
Check if this pipe is active. |
protected void |
checkDisconnected()
Check if this device is disconnected. |
protected void |
checkOpen()
Check if this pipe is open. |
void |
close()
Closes this UsbPipe. |
UsbControlIrp |
createUsbControlIrp(byte bmRequestType,
byte bRequest,
short wValue,
short wIndex)
Create a UsbControlIrp. |
UsbIrp |
createUsbIrp()
Create a UsbIrp. |
protected UsbIrpImp |
createUsbIrpImp()
Get a uniquely-numbered UsbIrpImp |
protected void |
fireEvent(UsbIrpImp usbIrpImp)
Fire an event for the specified UsbIrpImp. |
UsbEndpoint |
getUsbEndpoint()
Get this pipe's UsbEndpoint. |
UsbEndpointImp |
getUsbEndpointImp()
|
UsbPipeOsImp |
getUsbPipeOsImp()
|
boolean |
isActive()
If this pipe is active. |
protected boolean |
isDisconnected()
|
protected boolean |
isInDirection(UsbIrpImp irp)
Return if this is an in-direction pipe (or UsbIrp in the case of control pipes). |
boolean |
isOpen()
If this pipe is open. |
void |
open()
Opens this UsbPipe. |
protected void |
queueList(List list)
Queue a List of UsbIrpImps. |
protected void |
queueUsbIrpImp(UsbIrpImp usbIrpImp)
Queue a UsbIrpImp |
void |
removeUsbPipeListener(UsbPipeListener listener)
Removes the listener object from the listener list |
protected void |
setPolicies()
Set the policies, if defined |
void |
setupUsbIrpImp(UsbIrpImp irp)
|
void |
setUsbEndpointImp(UsbEndpointImp ep)
Set the UsbEndpointImp. |
void |
setUsbPipeOsImp(UsbPipeOsImp pipe)
|
protected void |
submitUsbIrpImpFromQueue(UsbIrpImp usbIrpImp)
Submit a UsbIrpImp from the queueManager. |
int |
syncSubmit(byte[] data)
Synchonously submits this byte[] array to the UsbPipe. |
void |
syncSubmit(List list)
Synchronous submission using a List of UsbIrps. |
void |
syncSubmit(UsbIrp usbIrp)
Synchronous submission using a UsbIrp. |
void |
usbIrpImpComplete(UsbIrpImp irp)
Indicate that a specific UsbIrpImp has completed. |
protected List |
usbIrpListToUsbIrpImpList(List list)
|
protected UsbIrpImp |
usbIrpToUsbIrpImp(UsbIrp irp)
Convert a UsbIrp to UsbIrpImp. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected UsbPipeListenerImp listenerImp
protected RunnableManager queueManager
protected boolean queueSubmissions
protected boolean abortInProgress
protected boolean createShortPacketException
protected Hashtable listTable
protected List submissionList
public static final String PIPE_CONTROL_QUEUE_POLICY_KEY
public static final String PIPE_INTERRUPT_QUEUE_POLICY_KEY
public static final String PIPE_ISOCHRONOUS_QUEUE_POLICY_KEY
public static final String PIPE_BULK_QUEUE_POLICY_KEY
public static final String CREATE_SHORT_PACKET_EXCEPTION_POLICY_KEY
| Constructor Detail |
|---|
public UsbPipeImp()
public UsbPipeImp(UsbEndpointImp ep)
ep - The UsbEndpointImp.public UsbPipeImp(UsbPipeOsImp pipe)
pipe - The platform-dependent pipe implementation.
public UsbPipeImp(UsbEndpointImp ep,
UsbPipeOsImp pipe)
ep - The UsbEndpointImp.pipe - The platform-dependent pipe implementation.| Method Detail |
|---|
public UsbPipeOsImp getUsbPipeOsImp()
public void setUsbPipeOsImp(UsbPipeOsImp pipe)
pipe - The UsbPipeOsImp to usepublic boolean isActive()
UsbPipe
This pipe is active only if it belongs to an
active configuration and
interface setting, otherwise it is inactive.
This UsbPipe cannot be used if inactive.
isActive in interface UsbPipepublic boolean isOpen()
UsbPipe
This is true after a sucessful open
until a successful close.
If this pipe is not active, this returns false.
isOpen in interface UsbPipepublic UsbEndpoint getUsbEndpoint()
UsbPipe
getUsbEndpoint in interface UsbPipepublic UsbEndpointImp getUsbEndpointImp()
public void setUsbEndpointImp(UsbEndpointImp ep)
This will also set this on the parent UsbEndpointImp. This also sets up this pipe's queueing policy if the user defined one in the properties file.
ep - The UsbEndpointImp
public void open()
throws UsbException,
UsbNotActiveException,
UsbNotClaimedException,
UsbDisconnectedException
open in interface UsbPipeUsbException - If the UsbPipe could not be opened.
UsbNotActiveException - If the config or interface setting is not active.
UsbNotClaimedException - If the interface is not claimed.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public void close()
throws UsbException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
close in interface UsbPipeUsbException - If the UsbPipe could not be closed.
UsbNotActiveException - If the UsbPipe is not active.
UsbNotOpenException - If the UsbPipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public int syncSubmit(byte[] data)
throws UsbException,
IllegalArgumentException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
syncSubmit in interface UsbPipedata - The buffer to use.
UsbException - If an error occurs.
IllegalArgumentException - If the data is null.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public UsbIrp asyncSubmit(byte[] data)
throws UsbException,
IllegalArgumentException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
asyncSubmit in interface UsbPipedata - The buffer to use.
UsbException - If an error occurs.
IllegalArgumentException - If the data is null.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public void syncSubmit(UsbIrp usbIrp)
throws UsbException,
IllegalArgumentException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
syncSubmit in interface UsbPipeusbIrp - A UsbIrp to use for the submission.
UsbException - If an error occurs.
IllegalArgumentException - If the UsbIrp is not valid.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public void asyncSubmit(UsbIrp usbIrp)
throws UsbException,
IllegalArgumentException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
asyncSubmit in interface UsbPipeusbIrp - The UsbIrp to use for the submission.
UsbException - If an error occurs.
IllegalArgumentException - If the UsbIrp is not valid.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public void syncSubmit(List list)
throws UsbException,
IllegalArgumentException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
syncSubmit in interface UsbPipelist - The List of UsbIrps.
UsbException - If an error occurs.
IllegalArgumentException - If the list is empty or contains any non-UsbIrp objects, or those UsbIrp(s) are invalid.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public void asyncSubmit(List list)
throws UsbException,
IllegalArgumentException,
UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
asyncSubmit in interface UsbPipelist - The List of UsbIrps.
UsbException - If an error occurs.
IllegalArgumentException - If the list is empty or contains any non-UsbIrp objects, or those UsbIrp(s) are invalid.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.
public void abortAllSubmissions()
throws UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
abortAllSubmissions in interface UsbPipeUsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this pipe (device) has been disconnected.public UsbIrp createUsbIrp()
createUsbIrp in interface UsbPipe
public UsbControlIrp createUsbControlIrp(byte bmRequestType,
byte bRequest,
short wValue,
short wIndex)
createUsbControlIrp in interface UsbPipebmRequestType - The bmRequestType.bRequest - The bRequest.wValue - The wValue.wIndex - The wIndex.
public void usbIrpImpComplete(UsbIrpImp irp)
This is called after isComplete() is set to true.
usbIrpImpComplete in interface UsbIrpImp.UsbIrpImpListenerirp - The UsbIrpImp that completed.public void addUsbPipeListener(UsbPipeListener listener)
addUsbPipeListener in interface UsbPipelistener - the UsbPipeListener instancepublic void removeUsbPipeListener(UsbPipeListener listener)
removeUsbPipeListener in interface UsbPipelistener - the UsbPipeListener instancepublic void setupUsbIrpImp(UsbIrpImp irp)
protected void fireEvent(UsbIrpImp usbIrpImp)
Note that any submission of a byte[] will not have a wrapped UsbIrp, but to ease implementation, the UsbIrpImp generated by this implementation to manage the byte[] will be included in the event. This means this implementation will never use the non-UsbIrp constructors from the UsbPipeEvent classes.
usbIrpImp - The UsbIrpImp to fire an event for.
protected UsbIrpImp usbIrpToUsbIrpImp(UsbIrp irp)
throws UsbException,
IllegalArgumentException
irp - The UsbIrp to convert.
UsbException - If the UsbIrp is not ready for submission.
IllegalArgumentException - If the UsbIrp is not valid.
protected List usbIrpListToUsbIrpImpList(List list)
throws UsbException,
IllegalArgumentException
UsbException
IllegalArgumentException
protected void checkDisconnected()
throws UsbDisconnectedException
UsbDisconnectedException - If this device is disconnected.protected boolean isDisconnected()
protected void checkActive()
throws UsbNotActiveException,
UsbDisconnectedException
UsbNotActiveException - If the pipe is not active.
UsbDisconnectedException - If this device is disconnected.
protected void checkOpen()
throws UsbNotActiveException,
UsbNotOpenException,
UsbDisconnectedException
A pipe must be active to be open.
UsbNotActiveException - If the pipe is not active.
UsbNotOpenException - If the pipe is not open.
UsbDisconnectedException - If this device is disconnected.protected UsbIrpImp createUsbIrpImp()
protected void addRunnable(Runnable r)
r - The Runnable to add.protected void submitUsbIrpImpFromQueue(UsbIrpImp usbIrpImp)
usbIrpImp - The UsbIrpImp to submit.protected void queueUsbIrpImp(UsbIrpImp usbIrpImp)
usbIrpImp - The UsbIrpImp to queue.protected void queueList(List list)
list - The List of UsbIrpImps to queue.protected void setPolicies()
protected boolean isInDirection(UsbIrpImp irp)
irp - The UsbIrpImp.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||