public class StarCashDrawerTest
{
public static void main(String[] args)
{
// instantiate a new jpos.CashDrawer object
CashDrawer cashDrawer = new CashDrawer();
try
{
// open the cashDrawer object according to the entry names defined in jpos.xml
//cashDrawer.open("TSP700-cashdrawer-linux-usb"); // TSP700 cashDrawer - linux - usb
//cashDrawer.open("TSP700-cashdrawer-linux-serial"); // TSP700 cashDrawer - linux - serial
//cashDrawer.open("TSP700-cashdrawer-linux-parallel"); // TSP700 cashDrawer - linux - parallel
//cashDrawer.open("TSP700-cashdrawer-windows-usb"); // TSP700 cashDrawer - windows - usb
//cashDrawer.open("TSP700-cashdrawer-windows-serial"); // TSP700 cashDrawer - windows - serial
//cashDrawer.open("TSP700-cashdrawer-windows-parallel"); // TSP700 cashDrawer - windows - parallel
cashDrawer.open("TSP700-cashdrawer-mac-usb"); // TSP700 cashDrawer - mac - usb
//cashDrawer.open("TSP700-cashdrawer-ethernet"); // TSP700 cashDrawer - ethernet
// claim exclsive usage of the cashDrawer object
cashDrawer.claim(1);
// enable the device for input and output
cashDrawer.setDeviceEnabled(true);
// check if the drawer is currently opened
// if this check returns true when the drawer is ACTUALLY CLOSED,
// set the drawerClosedOnSignalLow property of this device's entry
// in the jpos.xml file to true
if (cashDrawer.getDrawerOpened() == true)
{
System.out.println("cashDrawer.getDrawerOpened() == true");
}
else
{
System.out.println("cashDrawer.getDrawerOpened() == false");
}
// open the cash drawer
// if your cash drawer is wired to the printer's control circuit
// number 2, set the cashDrawer1 proprty of this device's entry in
// jpos.xml file to true
cashDrawer.openDrawer();
}
catch(JposException e)
{
// display any errors that come up
e.printStackTrace();
}
finally
{
// close the cashDrawer object
try
{
cashDrawer.close();
}
catch (Exception e) {}
}
System.out.println("StarCashDrawerTest finished.");