comm
Interface ParallelPortInterface

All Known Implementing Classes:
ParallelPort

public interface ParallelPortInterface

User: lyon Date: Jul 30, 2006 Time: 7:47:21 AM Copyright DocJava, Inc. 2005.


Field Summary
static int LPT_MODE_ANY
          Uses the best available mode.
static int LPT_MODE_ECP
          Extended Capabilities Port mode.
static int LPT_MODE_EPP
          Extended Parallel Port mode.
static int LPT_MODE_NIBBLE
          Bidirectional 4-bits-at-a-time mode.
static int LPT_MODE_PS2
          Bidirectional byte-at-a-time mode.
static int LPT_MODE_SPP
          Unidrectional compatibility mode.
 
Method Summary
 void addEventListener(ParallelPortEventListener listener)
          Adds a listener for parallel port events.
 int getMode()
           
 int getOutputBufferFree()
           
 boolean isPaperOut()
           
 boolean isPrinterBusy()
           
 boolean isPrinterError()
           
 boolean isPrinterSelected()
           
 boolean isPrinterTimedOut()
           
 void notifyOnBuffer(boolean notify)
          Instructs the port to notify its listener in the case of the output buffer being empty.
 void notifyOnError(boolean notify)
          Instructs the port to notify its listener in the case of port errors.
 void removeEventListener()
          Removes the parallel port event listener.
 void restart()
          Restart the printer after an error has occurred.
 int setMode(int mode)
           
 void suspend()
          Suspend output.
 

Field Detail

LPT_MODE_ANY

static final int LPT_MODE_ANY
Uses the best available mode.

See Also:
Constant Field Values

LPT_MODE_SPP

static final int LPT_MODE_SPP
Unidrectional compatibility mode.

See Also:
Constant Field Values

LPT_MODE_PS2

static final int LPT_MODE_PS2
Bidirectional byte-at-a-time mode.

See Also:
Constant Field Values

LPT_MODE_EPP

static final int LPT_MODE_EPP
Extended Parallel Port mode.

See Also:
Constant Field Values

LPT_MODE_ECP

static final int LPT_MODE_ECP
Extended Capabilities Port mode.

See Also:
Constant Field Values

LPT_MODE_NIBBLE

static final int LPT_MODE_NIBBLE
Bidirectional 4-bits-at-a-time mode.

See Also:
Constant Field Values
Method Detail

addEventListener

void addEventListener(ParallelPortEventListener listener)
                      throws java.util.TooManyListenersException
Adds a listener for parallel port events. Only one listener per ParallelPort is allowed at a time.

Parameters:
listener - the listener to add
Throws:
java.util.TooManyListenersException

removeEventListener

void removeEventListener()
Removes the parallel port event listener. This method is automatically called when the port is closed.


notifyOnError

void notifyOnError(boolean notify)
Instructs the port to notify its listener in the case of port errors.

Parameters:
notify - true to notify in case of error, false otherwise

notifyOnBuffer

void notifyOnBuffer(boolean notify)
Instructs the port to notify its listener in the case of the output buffer being empty.

Parameters:
notify - true to notify in case of empty buffer, false otherwise

getOutputBufferFree

int getOutputBufferFree()
Returns:
the number of available bytes in the output buffer.

isPaperOut

boolean isPaperOut()
Returns:
true if the port is in the Out Of Paper state.

isPrinterBusy

boolean isPrinterBusy()
Returns:
true if the port is in the Printer Busy state.

isPrinterSelected

boolean isPrinterSelected()
Returns:
true if the printer is in the selected state.

isPrinterTimedOut

boolean isPrinterTimedOut()
Returns:
true if the printer has timed out.

isPrinterError

boolean isPrinterError()
Returns:
true if the printer has encountered an error.

restart

void restart()
Restart the printer after an error has occurred.


suspend

void suspend()
Suspend output.


getMode

int getMode()
Returns:
the currently configured mode: one of LPT_MODE_ANY, LPT_MODE_SPP, LPT_MODE_PS2, LPT_MODE_EPP, or LPT_MODE_ECP.

setMode

int setMode(int mode)
            throws UnsupportedCommOperationException
Parameters:
mode - one of LPT_MODE_ANY, LPT_MODE_SPP, LPT_MODE_PS2, LPT_MODE_EPP, or LPT_MODE_ECP
Returns:
the printer port mode.
Throws:
UnsupportedCommOperationException - if the mode is not supported by the driver