org.halfdog.io.parport
Class ParPort

java.lang.Object
  extended byorg.halfdog.io.parport.ParPort
Direct Known Subclasses:
LinuxParPort, WindowsParPort

public abstract class ParPort
extends java.lang.Object

Interface for parallel port access. System specific implementations of this interface grant access to the parallel port avoiding ioctls or port write commands.
Warning: Writing data into the control register will put the data as is into the reg, setting a bit high may result in a low level on the corresponding output line. This is because some lines are inverted. You have to xor the value with CTRL_INVERT to get an electrical high for each logical 1 bit. The current version of this driver is in project 7


Field Summary
static int CTRL_AUTOFEED
           
static int CTRL_DIRECTION
           
static int CTRL_INIT
           
static int CTRL_INVERT
           
static int CTRL_SELECT
           
static int CTRL_STROBE
          Control flags to set the control lines with the writeStatus method.
static byte PPORT_RDATA
           
static byte PPORT_RSTATUS
           
static byte PPORT_SEQUENCE
           
static byte PPORT_WCTRL
           
static byte PPORT_WDATA
           
static int STATUS_ACKN
           
static int STATUS_BUSY
           
static int STATUS_ERROR
           
static int STATUS_INVERT
           
static int STATUS_NOPAPER
           
static int STATUS_SELECT
           
 
Constructor Summary
ParPort()
           
 
Method Summary
static ParPort createPort(java.lang.String dev)
          Get a parallel port object matching the current os
abstract  Sequence createSequence()
           
abstract  byte[] doSequence(Sequence seq)
           
abstract  byte read()
           
abstract  byte readStatus()
           
abstract  void write(byte b)
           
abstract  void writeControl(byte b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PPORT_WDATA

public static final byte PPORT_WDATA
See Also:
Constant Field Values

PPORT_WCTRL

public static final byte PPORT_WCTRL
See Also:
Constant Field Values

PPORT_RDATA

public static final byte PPORT_RDATA
See Also:
Constant Field Values

PPORT_RSTATUS

public static final byte PPORT_RSTATUS
See Also:
Constant Field Values

PPORT_SEQUENCE

public static final byte PPORT_SEQUENCE
See Also:
Constant Field Values

CTRL_STROBE

public static final int CTRL_STROBE
Control flags to set the control lines with the writeStatus method. If a flag is set the corresponding line is set to 5V, no matter if signal has to be internally inverted or not.

See Also:
Constant Field Values

CTRL_AUTOFEED

public static final int CTRL_AUTOFEED
See Also:
Constant Field Values

CTRL_INIT

public static final int CTRL_INIT
See Also:
Constant Field Values

CTRL_SELECT

public static final int CTRL_SELECT
See Also:
Constant Field Values

CTRL_DIRECTION

public static final int CTRL_DIRECTION
See Also:
Constant Field Values

STATUS_ERROR

public static final int STATUS_ERROR
See Also:
Constant Field Values

STATUS_SELECT

public static final int STATUS_SELECT
See Also:
Constant Field Values

STATUS_NOPAPER

public static final int STATUS_NOPAPER
See Also:
Constant Field Values

STATUS_ACKN

public static final int STATUS_ACKN
See Also:
Constant Field Values

STATUS_BUSY

public static final int STATUS_BUSY
See Also:
Constant Field Values

CTRL_INVERT

public static final int CTRL_INVERT
See Also:
Constant Field Values

STATUS_INVERT

public static final int STATUS_INVERT
See Also:
Constant Field Values
Constructor Detail

ParPort

public ParPort()
Method Detail

createPort

public static ParPort createPort(java.lang.String dev)
                          throws java.io.IOException
Get a parallel port object matching the current os

Throws:
java.io.IOException

read

public abstract byte read()
                   throws java.io.IOException
Throws:
java.io.IOException

write

public abstract void write(byte b)
                    throws java.io.IOException
Throws:
java.io.IOException

readStatus

public abstract byte readStatus()
                         throws java.io.IOException
Throws:
java.io.IOException

writeControl

public abstract void writeControl(byte b)
                           throws java.io.IOException
Throws:
java.io.IOException

createSequence

public abstract Sequence createSequence()

doSequence

public abstract byte[] doSequence(Sequence seq)
                           throws java.io.IOException
Throws:
java.io.IOException