Package com.clover.sdk.cashdrawer
Class CashDrawer
- java.lang.Object
-
- com.clover.sdk.cashdrawer.CashDrawer
-
- Direct Known Subclasses:
CloverServiceCashDrawer
public abstract class CashDrawer extends Object
An abstraction for a cash drawer. The identifier and drawer number together may be used to uniquely identify each particular cash drawer. New identifiers may be added as new cash drawers are supported by Clover but values for existing cash drawers will not change and may be saved in persistent storage. Here are example values:identifier drawer number ---------- ------------- com.clover.BAYLEAF 1 com.clover.BAYLEAF 2 com.clover.USB 1 com.clover.USB 2 com.clover.USB 3 com.clover.FUTUREX 1 org.otherapp.XYZ77 1
No two drawers will ever have the same pair of identifier and drawer number.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CashDrawer.Discovery<T extends CashDrawer>
A method for discovering connected cash drawers.
-
Field Summary
Fields Modifier and Type Field Description protected Context
context
protected int
drawerNumber
protected static String
TAG
-
Constructor Summary
Constructors Modifier Constructor Description protected
CashDrawer(Context context, int drawerNumber)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
abstract String
getDisplayName()
A human readable name for this cash drawer.int
getDrawerNumber()
Get the cash drawer number for this identifier.abstract String
getIdentifier()
The identifier String along with the drawer number uniquely identify cash drawer.String
getUniqueIdentifier()
Get a completely unique identifier for this cash drawer as a String which includes the identifier and drawer number.int
hashCode()
abstract boolean
pop()
Attempt to pop (open) this cash drawer.
-
-
-
Constructor Detail
-
CashDrawer
protected CashDrawer(Context context, int drawerNumber)
-
-
Method Detail
-
getIdentifier
public abstract String getIdentifier()
The identifier String along with the drawer number uniquely identify cash drawer. Some examples (not exhaustive) are:com.clover.BAYLEAF com.clover.USB org.otherapp.XYZ77
Subclasses written by 3rd party developers should never prefix their cash drawer identifier with "com.clover" to avoid conflicts with cash drawers discovered by Clover Services.- Returns:
- the identifier, never null
-
getDrawerNumber
public int getDrawerNumber()
Get the cash drawer number for this identifier. Numbers start from 1 and counting up with no gaps. Each identifier has it's own sequence.
-
getDisplayName
public abstract String getDisplayName()
A human readable name for this cash drawer. The name does not include the drawer number. The name is adjusted to the currently chosen device locale.
-
pop
public abstract boolean pop()
Attempt to pop (open) this cash drawer.This method may perform blocking IO operations depending on the specific cash drawer hardware. It must not be called from the main (UI) thread.
Direct use of this method is not recommended, prefer to use the
CashEvents
class to pop the cash drawer so that cash event logging is also performed.- Returns:
- false indicates the cash drawer definitely did not open, true indicates the cash drawer likely opened but possibly did not open due to mechanical or electrical issues or may simply be locked.
-
getUniqueIdentifier
public final String getUniqueIdentifier()
Get a completely unique identifier for this cash drawer as a String which includes the identifier and drawer number.
-
-