Package SampleMICR

Class Device

All Implemented Interfaces:
Runnable

public class Device extends JposDevice implements Runnable
Base of a JposDevice based implementation of JavaPOS MICR device service implementation for the sample device implemented in SampleMICR.tcl.

Here a full list of all device specific properties that can be changed via jpos.xml:

  • CharacterTimeout: Positive integer value, specifying the maximum delay between bytes that belong to the same frame. Default value: 20 milliseconds.
  • MinClaimTimeout: Minimum timeout in milliseconds used by method Claim to ensure correct working. Must be a positive value. If this value is too small, Claim might throw a JposException even if everything is OK if the specified timeout is less than or equal to MinClaimTimeout. Default: 200.
  • OwnPort: Integer value between 0 and 65535 specifying the TCP port used for communication with the device simulator. Default: 0 (for random port number selected by operating system).
  • PollDelay: Minimum time between status requests, in milliseconds. Status requests will be used to monitor the device state. Default: 500.
  • SubstituteCharacters: String containing the special characters named Transit, Amount, On-Us and Dash, in this order. Default: "tao-".
  • Target: The IPv4 address of the device. Must always be specified and not empty. Notation: address:port, where address is a IPv4 address and port the TCP port of the device.
  • Constructor Details

    • Device

      protected Device(String id)
      Constructor. id specifies either the COM port to be used or the server to be connected in format host:port
      Parameters:
      id - COM port or IP target address and port
  • Method Details

    • checkProperties

      public void checkProperties(jpos.config.JposEntry entry) throws jpos.JposException
      Description copied from class: JposBaseDevice
      Checks whether a JposEntry belongs to a predefined property value an if so, sets the corresponding driver value
      Overrides:
      checkProperties in class JposBaseDevice
      Parameters:
      entry - Entry to be checked, contains value to be set
      Throws:
      jpos.JposException - if a property value is invalid
    • changeDefaults

      public void changeDefaults(MICRProperties props)
      Description copied from class: JposDevice
      Change defaults of properties. Must be implemented within derived classed that support magnetic ink character recognition reader services.
      Overrides:
      changeDefaults in class JposDevice
      Parameters:
      props - Property set for setting the property defaults
    • run

      public void run()
      Communication handler, used for MICR data retrieval and status check.
      Specified by:
      run in interface Runnable
    • getMICRProperties

      public MICRProperties getMICRProperties(int index)
      Description copied from class: JposDevice
      Returns device implementation of MICRProperties.
      Overrides:
      getMICRProperties in class JposDevice
      Parameters:
      index - Device index, see constructor of JposCommonProperties.
      Returns:
      Instance of MICRProperties that matches the requirements of the corresponding device service.