Class Keylock

All Implemented Interfaces:
JposBaseInterface, KeylockInterface

public class Keylock extends KeylockProperties
Class implementing the KeylockInterface for the sample combi device. External and interactive Checkhealth might be implemented in a later version.
  • Constructor Details

    • Keylock

      public Keylock(int index, Device dev)
      Constructor. Gets index of Keylock to be used and an instance of Device to be used as communication object.
      Parameters:
      index - Property set used by this KeylockInterface implementation.
      dev - Instance of Device this object belongs to.
  • Method Details

    • deviceEnabled

      public void deviceEnabled(boolean enable) throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Final part of setting DeviceEnabled. Can be overwritten within derived classes. Performs initOnEnable method of corresponding property set in addition to setting DeviceEnabled. This method will be called only if the following plausibility checks lead to a positive result:
      • Device has not been closed,
      • ExclusiveUse equals ExclusiveYes: Device is claimed,
      • DeviceEnabled != enabled.
      Specified by:
      deviceEnabled in interface JposBaseInterface
      Overrides:
      deviceEnabled in class JposCommonProperties
      Parameters:
      enable - True to enable, false to disable
      Throws:
      jpos.JposException - If an error occurs during enable or disable
    • open

      public void open() throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Final part of open method. Can be overwritten in derived class, if necessary. sets State property and calls method initOnOpen of object specified by dev. This method will be called whenever the service's open method will be called. All checks, if necessary, must be implemented within the derived service implementation.
      Specified by:
      open in interface JposBaseInterface
      Overrides:
      open in class JposCommonProperties
      Throws:
      jpos.JposException - See UPOS specification, method Open
    • close

      public void close() throws jpos.JposException
      Description copied from interface: JposBaseInterface
      Final part of close 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 neither enabled nor claimed.
      Specified by:
      close in interface JposBaseInterface
      Overrides:
      close in class JposCommonProperties
      Throws:
      jpos.JposException - See UPOS specification, method Close
    • 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
    • waitForKeylockChange

      public void waitForKeylockChange(int pos, int timeout) throws jpos.JposException
      Description copied from interface: KeylockInterface
      Final part of WaitForKeylockChange 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 enabled,
      • keyPosition is between 0 and PositionCount,
      • timeout is ≥ 0 or JPOS_FOREVER.
      Specified by:
      waitForKeylockChange in interface KeylockInterface
      Overrides:
      waitForKeylockChange in class KeylockProperties
      Parameters:
      pos - Requested keylock position.
      timeout - Maximum number of milliseconds to wait for the keylock before returning control back to the application.
      Throws:
      jpos.JposException - If an error occurs.