Cash box driver

About operating cash box with Sunmi device

Partial Sunmi devices, such as T1, can connect external cash box. The cash box can be opened by App via the following two methods.

One. Open the cash box via the method of encapsulation in AIDL file.

Two. Open the cash box via command.

One. Open the cash box via the method of encapsulation in AIDL file

1.     Download the relevant resource file, establish a new package in the following hierarchy in the project, place the AIDL file in the source file into the package.

1

2.     To operate the cash box, there are only two methods available, namely open the cash box and obtain the number of times of opening the cash box, as shown in the following figure. These two methods are available in IWoyouService.aidl file, and the developers can invoke them in their own codes.

2

Two. Via the method of ES/POS command

The developer can send ES/POS command to service via two methods

1.        Establish connection with service via Virtual Bluetooth, send ES/POS command. You can refer to the printer driver document and open the cash box via invoking send command with Bluetooth connection. The ES/POS command to open the cash box is as follows:

byte[] aa = new byte[5];
aa[0] = 0x10;
aa[1] = 0x14;
aa[2] = 0x00;
aa[3] = 0x00;
aa[4] = 0x00;

2.        Send command via sendRAWData(bytes [], callback) method encapsulated in AIDL method. It also requires to use the resource file in method one. You may refer to AIDL printing method in printer driver document:

byte[] aa = new byte[5];

aa[0] = 0x10;
aa[1] = 0x14;
aa[2] = 0x00;
aa[3] = 0x00;
aa[4] = 0x00;

 try {
  woyouService.sendRAWData(aa, callback);
  } catch (RemoteException e1) {
     e1.printStackTrace();
   }