com.ibm.jusb.os
Class DefaultUsbPipeOsImp

java.lang.Object
  extended by com.ibm.jusb.os.DefaultUsbPipeOsImp
All Implemented Interfaces:
UsbPipeOsImp
Direct Known Subclasses:
DefaultUsbControlPipeOsImp, LinuxPipeOsImp

public class DefaultUsbPipeOsImp
extends java.lang.Object
implements UsbPipeOsImp

Default UsbPipeOsImp implementation.

This is an optional class that handles all methods. Those methods may be overridden by the implementation if desired. The implementation does not have to extend this abstract class. The default behavior is to throw an UsbException for all methods.

Author:
Dan Streetman

Field Summary
static java.lang.String HOST_CONTROLLER_OPEN_STRING
           
static java.lang.String HOST_CONTROLLER_SUBMIT_STRING
           
static java.lang.String OPEN_STRING
           
static java.lang.String SUBMIT_STRING
           
 
Constructor Summary
DefaultUsbPipeOsImp()
          Constructor.
DefaultUsbPipeOsImp(boolean open)
          Constructor.
DefaultUsbPipeOsImp(java.lang.String open, java.lang.String submit)
          Constructor.
 
Method Summary
 void abortAllSubmissions()
          Stop all submissions in progress.
 void asyncSubmit(java.util.List list)
          Asynchronously submits a List of UsbIrpImps to the platform implementation.
 void asyncSubmit(UsbIrpImp irp)
          Asynchronously submits this UsbIrpImp to the platform implementation.
 void close()
          Close this pipe.
 void open()
          Open this pipe.
 void syncSubmit(java.util.List list)
          Synchronously submits a List of UsbIrpImps to the platform implementation.
 void syncSubmit(UsbIrpImp irp)
          Synchronously submits this UsbIrpImp to the platform implementation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_STRING

public static final java.lang.String OPEN_STRING
See Also:
Constant Field Values

SUBMIT_STRING

public static final java.lang.String SUBMIT_STRING
See Also:
Constant Field Values

HOST_CONTROLLER_OPEN_STRING

public static final java.lang.String HOST_CONTROLLER_OPEN_STRING
See Also:
Constant Field Values

HOST_CONTROLLER_SUBMIT_STRING

public static final java.lang.String HOST_CONTROLLER_SUBMIT_STRING
See Also:
Constant Field Values
Constructor Detail

DefaultUsbPipeOsImp

public DefaultUsbPipeOsImp()
Constructor.

This defaults to not allow opening (or use, obviously).


DefaultUsbPipeOsImp

public DefaultUsbPipeOsImp(java.lang.String open,
                           java.lang.String submit)
Constructor.

Parameters:
open - The String to use in UsbExceptions thrown in open().
submit - The String to use in UsbExceptions thrown in submit methods.

DefaultUsbPipeOsImp

public DefaultUsbPipeOsImp(boolean open)
Constructor.

If this is true, opening is allowed.

Parameters:
open - If this should allow opening.
Method Detail

open

public void open()
          throws UsbException
Open this pipe.

If allowOpen is true, this does nothing, otherwise this throws UsbException using the String specified by getOpenString. The implementation can override this method if appropriate.

Specified by:
open in interface UsbPipeOsImp
Throws:
UsbException - If allowOpen is false.

close

public void close()
Close this pipe.

By default, this does nothing. The implementation can override this method if appropriate.

Specified by:
close in interface UsbPipeOsImp

syncSubmit

public void syncSubmit(UsbIrpImp irp)
                throws UsbException
Synchronously submits this UsbIrpImp to the platform implementation.

This is implemented using asyncSubmit(UsbIrpImp).

Specified by:
syncSubmit in interface UsbPipeOsImp
Parameters:
irp - the UsbIrpImp to use for this submission.
Throws:
UsbException - If the data transfer was unsuccessful.

asyncSubmit

public void asyncSubmit(UsbIrpImp irp)
                 throws UsbException
Asynchronously submits this UsbIrpImp to the platform implementation.

By default, this throws UsbException with the String defined by getSubmitString. The implementation should override (at least) this method.

Specified by:
asyncSubmit in interface UsbPipeOsImp
Parameters:
irp - the UsbIrpImp to use for this submission.
Throws:
UsbException - If the initial submission was unsuccessful.

syncSubmit

public void syncSubmit(java.util.List list)
                throws UsbException
Synchronously submits a List of UsbIrpImps to the platform implementation.

This is implemented using syncSubmit(UsbIrpImp). If any UsbException occurrs, it is thrown immediately and no further UsbIrpImps are submitted nor modified.

Specified by:
syncSubmit in interface UsbPipeOsImp
Parameters:
list - the UsbIrpImps to use for this submission.
Throws:
UsbException - If one of the UsbIrpImps failed.

asyncSubmit

public void asyncSubmit(java.util.List list)
                 throws UsbException
Asynchronously submits a List of UsbIrpImps to the platform implementation.

This is implemented using asyncSubmit(UsbIrpImp). If any UsbException occurrs, it is thrown immediately and no further UsbIrpImps are submitted or modified.

Specified by:
asyncSubmit in interface UsbPipeOsImp
Parameters:
list - The List of UsbIrpImps.
Throws:
UsbException - If one of the UsbIrpImps was not accepted by the implementation.

abortAllSubmissions

public void abortAllSubmissions()
Stop all submissions in progress.

By default, this does nothing. The implementation should override this method.

Specified by:
abortAllSubmissions in interface UsbPipeOsImp