Use Cash Drawer
Understand the differences between these SDKs before migrating to StarXpand SDK.
StarPRNT SDK
Sample code: Refer to the createPeripheralData() method in ApiFunctions.swift (GitHub).
To monitor the cash drawer status, set an instance conforming to the StarIoExtManagerDelegate protocol to the delegate property of the StarIoExtManager class, as described in Monitor Printer Status.
Calling connect() in this state causes the following appropriate delegate method to be executed when the open/close status of the cash drawer changes.
func didCashDrawerOpen(_ manager: StarIoExtManager!) {
print("Cash Drawer: Open")
}
func didCashDrawerClose(_ manager: StarIoExtManager!) {
print("Cash Drawer: Close")
}
Sample code (GitHub)
StarXpand SDK
Pass this instance as an argument to the addDrawer() method of the DocumentBuilder instance.
Sample code (GitHub)
To monitor the cash drawer status, set an object conforming to the DrawerDelegate protocol to the StarPrinter.drawerDelegate property.
Calling open() in this state causes the corresponding delegate method to be executed when the open/close status of the cash drawer connected to the printer changes.
func drawer(printer: StarPrinter, communicationErrorDidOccur error: Error) {
print("Drawer: Communication Error")
}
func drawer(printer: StarPrinter, didSwitch openCloseSignal: Bool) {
print("Drawer: Open Close Signal Switched: \(openCloseSignal)")
}
The delegate methods corresponding to cash drawer events are as follows:
- drawer(printer: StarPrinter, didSwitch openCloseSignal: Bool): Notify that the state of the open/close signal for the cash drawer has changed.
- drawer(printer: StarPrinter, communicationErrorDidOccur error: Error): Notify that a communication error has occurred.
Refer to Supported API List for information on whether each API is supported in StarPRNT SDK and StarXpand SDK.
Understand the differences between these SDKs before migrating to StarXpand SDK.
StarPRNT SDK
Sample code: Refer to the createPeripheralData() method in ApiFunctions.java (GitHub).
To monitor the cash drawer status, specify an instance implementing the IStarIoExtManagerListener interface in the StarIoExtManager class constructor, as described in Monitor Printer Status.
Calling connect() in this state causes the following appropriate listener method to be executed when the open/close status of the cash drawer changes.
override fun onCashDrawerOpen() {
Log.d(TAG, "Cash Drawer: Open")
}
override fun onCashDrawerClose() {
Log.d(TAG, "Cash Drawer: Close")
}
Sample code (GitHub)
StarXpand SDK
Pass this instance as an argument to the addDrawer() method of the DocumentBuilder instance.
Sample code (GitHub)
To monitor the cash drawer status, set an object implementing the DrawerDelegate interface to the StarPrinter.drawerDelegate property.
Calling openAsync() in this state causes the corresponding callback method to be executed when the open/close status of the cash drawer connected to the printer changes.
override fun onCommunicationError(e: StarIO10Exception) {
Log.d(TAG, "Drawer: Communication Error")
}
override fun onOpenCloseSignalSwitched(openCloseSignal: Boolean) {
Log.d(TAG, "Drawer: Open Close Signal Switched: $openCloseSignal")
}
The callback methods corresponding to cash drawer events are as follows:
- onOpenCloseSignalSwitched(openCloseSignal: Boolean): Notify that the state of the open/close signal for the cash drawer has changed.
- onCommunicationError(e: StarIO10Exception): Notify that a communication error has occurred.
Refer to Supported API List for information on whether each API is supported in StarPRNT SDK and StarXpand SDK.

