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, WindowsPipeOsImp

public class DefaultUsbPipeOsImp
extends 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
protected  boolean allowOpen
           
static String HOST_CONTROLLER_OPEN_STRING
           
static String HOST_CONTROLLER_SUBMIT_STRING
           
static String OPEN_STRING
           
protected  String openString
           
static String SUBMIT_STRING
           
protected  String submitString
           
 
Constructor Summary
DefaultUsbPipeOsImp()
          Constructor.
DefaultUsbPipeOsImp(boolean open)
          Constructor.
DefaultUsbPipeOsImp(String open, String submit)
          Constructor.
 
Method Summary
 void abortAllSubmissions()
          Stop all submissions in progress.
protected  boolean allowOpen()
          If this allows opening.
 void asyncSubmit(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.
protected  String getOpenString()
          Get the String to use in UsbExceptions thrown in open().
protected  String getSubmitString()
          Get the String to use in UsbExceptions thrown in all submit methods.
 void open()
          Open this pipe.
 void syncSubmit(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowOpen

protected boolean allowOpen

openString

protected String openString

submitString

protected String submitString

OPEN_STRING

public static final String OPEN_STRING
See Also:
Constant Field Values

SUBMIT_STRING

public static final String SUBMIT_STRING
See Also:
Constant Field Values

HOST_CONTROLLER_OPEN_STRING

public static final String HOST_CONTROLLER_OPEN_STRING
See Also:
Constant Field Values

HOST_CONTROLLER_SUBMIT_STRING

public static final 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(String open,
                           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(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(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

allowOpen

protected boolean allowOpen()
If this allows opening.

Returns:
If this allows opening.

getOpenString

protected String getOpenString()
Get the String to use in UsbExceptions thrown in open().

Returns:
The String to use in open() UsbExceptions.

getSubmitString

protected String getSubmitString()
Get the String to use in UsbExceptions thrown in all submit methods.

Returns:
The String to use in submission UsbExceptions.


Copyright © 2012 LSST. All Rights Reserved.