Package SampleMICR

Class MICR

All Implemented Interfaces:
JposBaseInterface, MICRInterface

public class MICR extends MICRProperties
Class derived from MICRProperties that implements the MICRInterface for the sample magnetic ink character recognition reader. The following commands of the sample MICR simulator will be used:
  • I: The command to open the cheque slot for MICR reading,
  • R: The command to close the cheque slot for MICR reading.
In case of a successful read, the cheque slot will be released automatically. In this case, MICR data in simplified E13B format will be retrieved by the communication handler:
< ttttttttt < aaaaaaaaaaaaaaa ; ssss LF
where
  • <: The Transit character. Will be replaced by t in property RawData due to UPOS convention,
  • ttttttttt: The left justified maximum 9 digit transit number,
  • aaaaaaaaaaaaaaa: The right justified maximum 15 digit account number, filled with spaces,
  • ;: The On-Us character. Will be replaced by o in property RawData due to UPOS convention,
  • ssss: The 4 digit special information field, for example a cheque count,
  • LF: A newline character (0Ah), used as frame terminator.
  • Constructor Details

    • MICR

      public MICR(Device dev)
      The constructor. Gets the Device object that implements the device communication as parameter. The device index used by the sample device is always 0.
      Parameters:
      dev - Instance of Device this object belongs to.
  • Method Details

    • claim

      public void claim(int timeout) throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Final part of setting claim. Can be overwritten within derived classes. This method will be called only if the following plausibility checks lead to a positive result:
      • Device has not been closed,
      • The device is not claimed,
      • ExclusiveUse dos not equal ExclusiveNo,
      • timeout is negative not equal to FOREVER.
      Specified by:
      claim in interface JposBaseInterface
      Overrides:
      claim in class JposCommonProperties
      Parameters:
      timeout - see UPOS specification, method Claim
      Throws:
      jpos.JposException - If an error occurs while claiming the device
    • release

      public void release() throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Final part of release method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:
      • Device is claimed,
      • ExclusiveUse equals ExclusiveYes: Device is not enabled.
      Specified by:
      release in interface JposBaseInterface
      Overrides:
      release in class JposCommonProperties
      Throws:
      jpos.JposException - See UPOS specification, method Release
    • handlePowerStateOnEnable

      public void handlePowerStateOnEnable() throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Will be called whenever DeviceEnabled will be set to true if power notification is enabled (PowerNotify = PN_ENABLED). Should update the PowerState property. Further processing like firing a StatusUpdateEvent is not necessary, this will be made by the framework automatically.
      Specified by:
      handlePowerStateOnEnable in interface JposBaseInterface
      Overrides:
      handlePowerStateOnEnable in class JposCommonProperties
      Throws:
      jpos.JposException - If an error occurs.
    • checkHealth

      public void checkHealth(int level) throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Final part of CheckHealth method. Can be overwritten in derived class, if necessary. Keep in mind that dvice class specific checks (e.g. check of Claimed or DeviceEnabled) must be done within derived classes. This method will be called only if the following plausibility checks lead to a positive result:
      • Device is neither enabled nor claimed.
      Specified by:
      checkHealth in interface JposBaseInterface
      Overrides:
      checkHealth in class JposCommonProperties
      Parameters:
      level - See UPOS specification, method CheckHealth
      Throws:
      jpos.JposException - See UPOS specification, method CheckHealth
    • beginInsertion

      public void beginInsertion(int timeout) throws jpos.JposException
      Description copied from interface: MICRInterface
      Final part of BeginInsertion method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:
      • Device is enabled,
      • checkBusy did not throw an exception,
      • The timeout is ≥ 0 or JPOS_FOREVER.
      If the service enters insertion mode successfully after BeginInsertion failed, e.g. due to a timeout condition during delayed asynchronous insertion handling, property InsertionMode must be set to true by the specific service implementation to avoid EndInsertion to fail.
      Specified by:
      beginInsertion in interface MICRInterface
      Overrides:
      beginInsertion in class MICRProperties
      Parameters:
      timeout - See UPOS specification, method BeginInsertion.
      Throws:
      jpos.JposException - See UPOS specification, method DisplayText.
    • endInsertion

      public void endInsertion() throws jpos.JposException
      Description copied from interface: MICRInterface
      Final part of EndInsertion method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:
      • Device is enabled,
      • checkBusy did not throw an exception,
      • Device is not in insertion mode,
      Specified by:
      endInsertion in interface MICRInterface
      Overrides:
      endInsertion in class MICRProperties
      Throws:
      jpos.JposException - See UPOS specification, method EndInsertion.
    • beginRemoval

      public void beginRemoval(int timeout) throws jpos.JposException
      Description copied from interface: MICRInterface
      Final part of BeginRemoval method. Can be overwritten within derived classes, if necessary. This method will be called only if the following plausibility checks lead to a positive result:
      • Device is enabled,
      • checkBusy did not throw an exception,
      • The timeout is ≥ 0 or JPOS_FOREVER.
      If the service enters removal mode successfully after BeginRemoval failed, e.g. due to a timeout condition during delayed asynchronous removal handling, property RemovalMode must be set to true by the specific service implementation to avoid EndRemoval to fail.
      Specified by:
      beginRemoval in interface MICRInterface
      Overrides:
      beginRemoval in class MICRProperties
      Parameters:
      timeout - See UPOS specification, method BeginRemoval.
      Throws:
      jpos.JposException - See UPOS specification, method DisplayText.