Class CashDrawers

  • public class CashDrawers
    extends Object
    This class provides functions for working with cash drawers. Specifically, it allows clients to list all connected cash drawers from known hardware types. More types of cash drawers may be added over time.

    This class differs from the CashDrawer class in that it abstracts any hardware cash drawer, where CashDrawer only works with cash drawers connected to configured Clover printers.

    Old implementations of this class used a hardcoded list of supported cash drawers, this newer implementation allows Clover to add support for new cash drawer types as they become available.

    • Constructor Detail

      • CashDrawers

        public CashDrawers​(Context context)
    • Method Detail

      • list

        public Set<CashDrawer> list()
        Discover cash drawers supported at this time by this device. Discovery of a cash drawer does not guarantee that it is actually connected at this very moment. Discovery of a cash drawer only indicates that it is either connected now, or there is a available hardware port allowing one to be connected.

        For example local RJ12-type cash drawers may or may not actually be connected at the time this method is invoked but will be returned regardless. Other types of cash drawers may only be discovered if they are physically connected such as USB cash drawers.

        This method may perform blocking I/O and must not be invoked on the main thread.

        See Also:
      • registerDiscovery

        public void registerDiscovery​(CashDrawer.Discovery<? extends CashDrawer> d)
        Register a new cash drawer hardware type. Subsequent calls to list() will invoke this discovery mechanism.