Class CashDrawer

All Implemented Interfaces:
CashDrawerInterface, JposBaseInterface

public class CashDrawer extends CashDrawerProperties
Class implementing the CashDrawerInterface for the sample combi device.
  • Constructor Details

    • CashDrawer

      public CashDrawer(Device dev)
      Constructor. Gets instance of Device to be used as communication object. Device index for sample is always 0.
      Parameters:
      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
    • openDrawer

      public void openDrawer() throws jpos.JposException
      Description copied from interface: CashDrawerInterface
      Final part of OpenDrawer 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,
      • Device has not been claimed by other instance.
      Specified by:
      openDrawer in interface CashDrawerInterface
      Overrides:
      openDrawer in class CashDrawerProperties
      Throws:
      jpos.JposException - If an error occurs.
    • waitForDrawerClose

      public void waitForDrawerClose() throws jpos.JposException
      Description copied from interface: CashDrawerInterface
      Final part of WaitForDrawerClose method. Can be overwritten in derived class, if necessary. Since the CashDrawerService class performs beeping directly via the underlaying standardized sound system via javax.sound, the parameters beepTimeout, beepDuration, beepFrequency and beepDelay will not be forwarded to the final part.
      This method will be called only if the following plausibility checks lead to a positive result:
      • Device is enabled,
      • CapStatus is true,
      • The parameters beepTimeout, beepDuration and beepDelay of the calling method are positive or FOREVER,
      • The parameter beepFrequency is between 10 and 24000.
      since the parameters beepTimeout, beepFrequency, beepDuration and beepDelay will not be passed to this method because sound generation will be performed via the sound system, it must simply wait the drawer state changes to closed and return immediately after that change.
      Keep also in mind that the beep duration should be at least 1/8 seconds (125 milliseconds) to ensure that it can be heard, values above 1/4 second (250 milliseconds) are recommended.
      Specified by:
      waitForDrawerClose in interface CashDrawerInterface
      Overrides:
      waitForDrawerClose in class CashDrawerProperties
      Throws:
      jpos.JposException - If an error occurs.