com.ibm.dse.services.checkreader
Class CheckReader

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.checkreader.CheckReader

public class CheckReader
extends Service
implements CheckReaderInterface, AmperReaderListener

This is a service base class providing access to a magnetic/optical check reader using the Amper Standard protocol. The working mode can be synchronous or asynchronous.

See Also:
Serialized Form

Field Summary
static java.lang.String baudRateAttrib
          The baudRate service attribute.
static java.lang.String checkLinkAttrib
          The checkLink service attribute.
static java.lang.String COMPID
          The component identification for tracing.
static java.lang.String dataBitsAttrib
          The dataBits service attribute.
static java.lang.String even
          The parity even value.
static java.lang.String none
          The parity none value.
static java.lang.String odd
          The parity odd value.
static java.lang.String parityAttrib
          The parity service attribute.
static java.lang.String portAttrib
          The port service attribute.
static java.lang.String resetAttrib
          The reset service attribute.
static java.lang.String stopBitsAttrib
          The stopBits service attribute.
static java.lang.String timeoutAttrib
          The timeout service attribute.
static java.lang.String traceAttrib
          The trace service attribute.
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Fields inherited from interface com.ibm.dse.services.checkreader.CheckReaderInterface
BAD_CHARACTER_EVENT, CANCEL_EVENT, COMPLETED_EVENT, MALFUNCTION_EVENT, TIMEOUT_EVENT, UNKNOWN_EVENT
 
Constructor Summary
CheckReader()
          This constructor creates a CheckReader object.
CheckReader(java.lang.String aName)
          This constructor creates a CheckReader object.
 
Method Summary
 void cancel()
          Cancels the read function.
 void close()
          Closes the serial communications port.
 java.lang.String getDataRead()
          Gets the data read from the device.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a CheckReader object with the aTag attributes.
 void open()
          Opens and initializes the serial communications port.
 void read()
          Reads the data from the device in asynchronous mode.
 void readAndUnformat(Context aContext, FormatElement aFormat)
          Reads the data from the device in asynchronous mode and unformats it.
 java.lang.String readAndWait()
          Reads the data from the device in synchronous mode.
 void readAndWaitAndUnformat(Context aContext, FormatElement aFormat)
          Reads the data from the device in synchronous mode and unformats it.
 void readCompleted(int retCode, java.lang.String retMsg)
          Processes the return code and the data when read is complete.
 java.lang.String toString()
          Returns a visual representation of this object.
 
Methods inherited from class com.ibm.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, terminate, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

portAttrib

public static final java.lang.String portAttrib
The port service attribute.

baudRateAttrib

public static final java.lang.String baudRateAttrib
The baudRate service attribute.

dataBitsAttrib

public static final java.lang.String dataBitsAttrib
The dataBits service attribute.

stopBitsAttrib

public static final java.lang.String stopBitsAttrib
The stopBits service attribute.

parityAttrib

public static final java.lang.String parityAttrib
The parity service attribute.

timeoutAttrib

public static final java.lang.String timeoutAttrib
The timeout service attribute.

checkLinkAttrib

public static final java.lang.String checkLinkAttrib
The checkLink service attribute.

traceAttrib

public static final java.lang.String traceAttrib
The trace service attribute.

resetAttrib

public static final java.lang.String resetAttrib
The reset service attribute.

none

public static final java.lang.String none
The parity none value.

odd

public static final java.lang.String odd
The parity odd value.

even

public static final java.lang.String even
The parity even value.

COMPID

public static final java.lang.String COMPID
The component identification for tracing.
Constructor Detail

CheckReader

public CheckReader()
This constructor creates a CheckReader object.

CheckReader

public CheckReader(java.lang.String aName)
            throws java.io.IOException
This constructor creates a CheckReader object.
Parameters:
aName - java.lang.String
Throws:
java.io.IOException. -  
Method Detail

cancel

public void cancel()
            throws DSECheckReaderException
Cancels the read function.
Specified by:
cancel in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  

close

public void close()
           throws DSECheckReaderException
Closes the serial communications port.
Specified by:
close in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  

getDataRead

public java.lang.String getDataRead()
Gets the data read from the device.
Specified by:
getDataRead in interface CheckReaderInterface
Returns:
java.lang.String

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException
Initializes a CheckReader object with the aTag attributes.
Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag Contains the name and attributes of the object to be created.
Returns:
Object - An instance of CheckReader.
Throws:
java.io.IOException - The object can not be created.

open

public void open()
          throws DSECheckReaderException
Opens and initializes the serial communications port.
Specified by:
open in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  

read

public void read()
          throws DSECheckReaderException
Reads the data from the device in asynchronous mode.
Specified by:
read in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  

readAndUnformat

public void readAndUnformat(Context aContext,
                            FormatElement aFormat)
                     throws DSECheckReaderException
Reads the data from the device in asynchronous mode and unformats it.
Specified by:
readAndUnformat in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  

readAndWait

public java.lang.String readAndWait()
                             throws DSECheckReaderException
Reads the data from the device in synchronous mode.
Specified by:
readAndWait in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  

readAndWaitAndUnformat

public void readAndWaitAndUnformat(Context aContext,
                                   FormatElement aFormat)
                            throws DSEInvalidArgumentException,
                                   DSEInvalidRequestException,
                                   DSECheckReaderException
Reads the data from the device in synchronous mode and unformats it.
Specified by:
readAndWaitAndUnformat in interface CheckReaderInterface
Throws:
com.ibm.dse.services.checkreader.DSECheckReaderException. -  
com.ibm.dse.base.DSEInvalidArgumentException. -  
com.ibm.dse.base.DSEInvalidRequestException. -  

readCompleted

public void readCompleted(int retCode,
                          java.lang.String retMsg)
Processes the return code and the data when read is complete.
Specified by:
readCompleted in interface AmperReaderListener
Parameters:
retCode - int.
retMsg - String.

toString

public java.lang.String toString()
Returns a visual representation of this object.
Overrides:
toString in class Service
Returns:
java.lang.String - The object visual representation.