V12 Developer

Developer Notice

Summary

This document introduce all the APIs that required by application development based on Android platform, which the payment module was implemented on secure chip, and the application run in Android, apply to all the Android POS with architecture AP+SP: Android + Security chip.

 

To describe how to use each API to develop application.

The one who will use and maintenance the V12, and to develop application based on V12.

The API described in this document applies to the following hardware configurations.

 

Hardware Configuration

WIFI, Bluetooth, GPS, and 4G are self-contained in Qualcomm modules, which are standard configurations

Platform TP+LCD RFID IC Fingerprint Scanner Camera Alcohol Speaker
MSM8953(2+16) O O O O O O

API Description

Return value -1001 means fail to send the package to secure chip from applicaiton chip.

Return value -1002 means fail to recv the package from secure chip to application chip.

In addition, such as cameras, speakers, WIFI, 4G, Bluetooth, GPS, etc. are programmed directly using Android standard SDK interface.

 

System Class

Constructor int Sys();
Member function int DLL_SysBeep();
  int DLL_SysBeef(byte mode,byte [] dlyTimeMs);
  int DLL_SysSetDateTime(byte [] str);
  int DLL_SysGetDateTime(byte[] str);
  int DLL_SysReadSecurityChipSN (byte [] sn);
  int DLL_SysGetDLLVersion(byte[] version);
int DLL_SysLedControl(byte index, byte mode);
int DLL_SysGetEthMacAddr(byte [] macAddr);
  int DLL_SysGetBlthMac(byte [] macAddr);
int DLL_SysGetIMEI (byte [] imei);
int DLL_SysSoftReset();
  int DLL_SysShutdown();
int DLL_SysStandby();
void DLL_SysRelease ();

Beeper (fixed frequency)

Prototype int DLL_SysBeep();  
Function Sound the beeper in fixed frequency  
Parameters none  
Return value -1001: Send error
  -1002: Recv error  
  0 : Success  
Note Example**:
DLL_SysBeep();
DLL_DelayMs(20);
DLL_SysBeep();
 

Beeper (variable frequency)

Prototype int DLL_SysBeef(byte mode,byte dlyTimeMs);  
Function sound the beeper in specified frequency and continuous time.  
Parameters mode[in] Frequency range: 0~6. 0 à minimum 6 à maximum When mode bigger than 6, the mode value will be mode%7.
DlyTimeMs**[in]** Continuou time(ms). two bytes: dlyTimeMs[0]: high byte dlyTimeMs[1]: low byte  
Return value -1001 Send error
  -1002 Recv error
0 Success
Note Example: DLL_SysBeef(1,200);  

 

Secure chip datetime set

Prototype int DLL_SysSetDateTime(byte [] str);  
Function Set the date and time for secure chip.  
Parameters str**[in]** Format: YYMMDDhhmmss, BCD code, six bytes. Range: 1950,1,1-2049,12,31
Return value 0 Set success
(-900) The format of "str" is error
  (-901) The year value of "str" is error
(-902) The month value of "str" is error
(-903) The day value of "str" is error
  (-904) The hour value of "str" is error
(-905) The minute value of "str" is error
(-906) The second value of "str" is error
(-907) Set failed
(-908) Other error
  (-921) Set success
Note Example: uchar DateTimeStr[7];
memcpy (DateTimeStr, “x08x01x21x09x56x42”, 6);
DLL_SysSetDateTime(DateTimeStr); DLL_SetDateTime(DateTimeStr);
 

Secure chip dateime get

Prototype int DLL_SysGetDateTime(byte[] str);  
Function Get the date and time of secure chip.  
Parameters str**[out]** BCD code:
str[0] - year(YY)
str[1] - month(MM)
str[2] - day (DD)
str[3] - hour(HH)
str[4] - minute(MM)
str[5] - second(SS)
Return value 0 Get success
-1001 Send error
  -1002 Recv error
Others Get failed

Read unique SN of secure chip

Prototype int DLL_SysReadSecurityChipSN (byte [] sn);  
Function Read the unique sn of secure chip.  
Parameters sn [out] 13 bytes.
Return value -1001 Send error
-1002 Recv error
  0 success
Note  

Get the version of DLL

Prototype int DLL_Sys**GetDLLVersion(byte[] version);**  
Function Get the DLL's version  
Parameters version [out] 3bytes:
version[0]: major version
version[1]: middle version
version[2]: minor version
Return value 0 Success
-1001 Send error
-1002 Recv error
Others Faild
Note Firmware and system version number are viewed through the system menu.  

LED control

Prototype int DLL_Sys**LedControl(byte index,byte mode);**  
Function Control the LED, usually for RFID.  
Parameters index [in] Index, 0~3
mode [in] Mode: 1:light on 0:light off  
Return value 0x0 Success
-1001 Send error
  -1002 Recv error
  Others failed
Note  

Get MAC address of WIFI module

Prototype: int DLL_SysGetEthMacAddr(byte []macAddr);  
Function Get the mac address of wifi module.  
Parameters mac_addr**[out]** Wifi module's MAC address. 6bytes.
Return value 0 Get success
Others Get failed.  
Note Example: AA:BB:CC:11:22:66  

Get MAC address of BT module

Prototype int DLL_SysGetBlthMac(byte [] macAddr);  
Function Get the mac address of BT module  
Parameters mac [out] BT module's MAC address. 6bytes. For example: AA:BB:CC:11:22:66
Return value 0 Get success
Others Get failed.  
Note  

Get IMEI of wireless module

Prototype int DLL_SysGetIMEI (byte [] imei);  
Function Get imei of 3G/4G module.  
Parameters imei [out] GPRS/3G/4G's imei.
Return value 0 Get success
Others Get failed.  
Note  

Reset the secure chip

Prototype int DLL_SysSoftReset ();  
Function Soft reset the secure chip  
Parameters none  
Return value 0 success
Others failed  
Note  

Shut down

 

Prototype int DLL_SysShutdown();  
Function Shut down the applicaiton chip and secure chip.  
Parameters none  
Return value 0 success
Others failed  
Note  

Sleep

 

Prototype int DLL_SysStandby ();  
Function Control the applicaiton and secure chip enter sleep mode.  
Parameters none  
Return value 0 success
Others failed  
Note  

System service release

 

Prototype void DLL_SysRelease ();
Function Release the system service. Before call the member funciton of system class, an object of system class must be created, and bind the service. The service bind by the object must be released when not used.
Parameters None
Return value None
Note

 

 

PICC class

Contactless module is mounted on a security chip (different from alcohol module and printer security chip). Power-on and power-off need to be controlled by application. Therefore, before using Non-connector interface, the corresponding security chip needs to be controlled first. Refer to Appendix A for the control code.

 

Constructor Picc();
Member function int DLL_PiccOpen();
int DLL_PiccClose();  
int DLL_PiccCheck(byte mode, byte[] cardType, byte[] serialNo);  
int DLL_PiccCommand(byte[] apduSend, byte[] apduRecv);  
int DLL_PiccRemove();  
int DLL_PiccHalt();  
int DLL_PiccReset();  
int DLL_PiccM1Authority(byte type, byte blkNo, byte[] pwd, byte[] serialNo);  
int DLL_PiccM1ReadBlock(byte blkNo, byte[] blkValue);  
int DLL_PiccM1WriteBlock(byte blkNo, byte[] blkValue);  
int DLL_PiccM1Operate(byte type, byte blkNo, byte [] value, byte updateBlkNo);  
int DLL_PiccGetPan(byte [] pan);  
void DLL_PiccRelease ();  

PICC open

Prototype int DLL_PiccOpen();  
Function Power on and reset the contactless module.  
Parameters None  
Return value 0x00 Success
Others Failed, see the error code at the end of this chapter  
-1001 Send error  
-1002 Recv error  
Note When terminal power on, the contactless module was in power off status, before use the contactless module, this API must be called first. l All the function of PICC except "DLL_PiccClose" will be called failed if not call this API first. l When the contactless module was not installed or malfunction, this API will be failed.  

PICC close

Prototype int DLL_PiccClose();  
Function Close the contactless module. make the contactless in the power off status.  
Parameters None  
Return value 0x00 Success
Others Failed, see the error code at the end of this chapter  
-1001 Send error  
-1002 Recv error  
Note After call this function, contactless module will be in power off status, All the function of PICC except "DLL_PiccOpen" called will be failed  
Prototype int DLL_PiccCheck(byte mode, byte[] cardType, byte[] serialNo);  
Function Polling search the contactless card according to the specified mode, and select and activate the card after searched.  
Parameters mode**[in]** mode:
0: search all A-type card firstly:
1> search multiple A-type card, return error;
2> no A-type card searched, and then search for all B-type card:
1. search multiple B-type card, return error;
2. Search a B-type card, activate it;
3. Without search any B-type cards, return no card;
3> search a A-type card, and then search all B-type cards:
1. Search multiple B-type cards, returns an error;
2. Without search any B-type card, activate the A-type card searched;
'a' or 'A' or 0x0a: search A-type card once( if multiple A-type card searched,only select one card, If a A-type CPU card and a M1 card in the field area, M1 card will be selected first.
'b' or 'B' or 0x0b : search B-type card once;
'm' or 'M' --- search M1 card once; if multiple M1 card searched, only selected one of them.
'f' of 'F' --- search Felica card once.
  cardType**[out]** Card type buffer, 2 bytes.
cardType**[0]**
‘A’ —A type card searched
‘B’ —B type card searched
cardType**[1]**
‘C’ —CPU card searched
‘M’ —M1 type card searched
‘F’ —Felica card searched.
  serialNo**[out]** card serial number information.
This information includes the lenth of the serial number and the content of serial number; the length of B-type cards and M1 type card’s serial number is 4 bytes; the length of A-type card's serial number is usually 4 bytes, 7 bytes or 10 bytes. The length of Felica type card's serial number is usually 18 bytes. SerialNo [0] indicates the length of the serial number, SerialNo [1 ~ 10] to save the serial number (left justified).
Return value 0 Success
(-3503) Mode error
(-3502) Module not opened
(-3526) Multiple card collision
  Others Failed, see the error code at the end of this chapter
-1001 Send error
-1002 Recv error
Note   After CPU A-type card searched, the function "DLL_PiccReset" must be called to make the card in the protocol status, data exchange can be only done on card in this status.

PICC command exchange

Prototype int DLL_PiccCommand(byte[] apduSend, byte[] apduRecv);  
Function Exchange data between CPU and card.  
Parameters apduSend**[in]** The same as the parameter of ICC apdu.
apduRecv**[out]** The same as the parameter of ICC apdu.  
Return value 0 Success
(-3503) Mode error
(-3502) Module not opened
(-3524) Command error
-1001 Send error
  -1002 Recv error
Note This function only can be called after "DLL_PiccCheck" called successfully first.  

PICC remove

Prototype int DLL_PiccRemove(void);  
Function Remove the card out from field area  
Parameters None  
Return value 0 Success, card removed out from field area
(-3502) Module not opend
(-3525) Card still in the filed area
  -1001 Send error
-1002 Recv error
Note  

PICC halt

Prototype int DLL_PiccHalt();  
Function Send HALT command to card. enter HALT status.  
Parameters None  
Return value 0 Success
Others Failed  
-1001 Send error
-1002 Recv error
Note  

 

PICC reset

Prototype int DLL_PiccReset();  
Function Send RATS command only to CPU type A card. no need for other types card.  
Parameters None  
Return value 0 Success
(-3527) Not A type card
(-3517) Send RATS command error
  -1001 Send error
-1002 Recv error
Note The API only used for CPU A-Type card, and this funciton must be called before data exchange done on CPU A-Type card.  

PICC M1 card authority

Prototype int DLL_PiccM1Authority(byte Type,byte blkNo, byte []pwd,byte []serialNo);  
Function Before operate the M1 card, authority must be done first.  
Parameters type**[in]** Password type: ‘A’ or‘a’ or 0x0a ——verify type A password ‘B’or‘b’ or 0x0b ——verify type B password
blkNo**[in]** The block NO to be accessed. the range is 0~63 for 1K capacity of M1 card.  
pwd**[in]** The password buffer  
serialNo**[in]** The serial number was got from DLL_PiccCheck ()’s return value: SerialNo +1  
Return value 0 Success
  (-3502) Module not opened
(-3503) Parameter error
(-3523) Authority failed
-1001 Send error
  -1002 Recv error
Note l Every four blocks compose to one sector, the last block of each sector is control block, which used to save A or B password and control information of each block; A or B password are all 6 bytes. The length of each block is 16 bytes, l Only after "DLL_PiccCheck ()" was called successfully, this function can be called.  

PICC M1 card read block

Prototype int DLL_PiccM1ReadBlock(byte blkNo,byte []blkValue);  
Function Read specified block's data ,16bytes.  
Parameters blkNo**[in]** Block number, 0~63 for 1K capacity card.
blkValue**[out]** Block value buffer, 16bytes.  
Return value 0 Success
(-3502) Module not opened
(-3522) Read failed
-1001 Send error
-1002 Recv error
Note M1 card ‘s wallet is in a block consisting of a specific format, read the block to get the balance. The format is as follows: BALANCE [4] + ^ balance [4] + BALANCE [4] + BLK_NO + ^ blk_no + BLK_NO + ^ blk_no BALANCE [4] - 4-byte balance (low byte first), saved twice in the block ^ balance [4] –Reverse code of each balance byte. BLK_NO – the wallet’s block number; the range is 0~63 for 1K capacity of M1 card.; stored in the block for twice ^ blk_no - reverse code of block number; stored in the block for twice  

PICC M1 card write block

Prototype int DLL_PiccM1WriteBlock(byte blkNo,byte []blkValue);  
Function Write data to specified block of M1 card  
Parameters blkNo**[in]** Block number, 0~63 for 1K capacity card.
blkValue**[in]** Block value buffer, 16bytes.  
Return value 0 Success
(-3502) Module not opened  
(-3521) Write error  
-1001 Send error  
-1002 Recv error  
Note l After authenticate successfully, then call this function to write wallet’s initial value and other data in the specified block. l when card personalization, also use this function to update the control block;  

PICC M1 card operate

Prototype int DLL_PiccM1Operate(byte type,byte blkNo,byte []value, byte updateBlkNo);  
Function Operate the specified block of M1 card, include '+', '-', '='  
Parameters type**[in]** 用于指定对钱包的操作类型: ‘+’ →充值,加号 ‘-’ →减值,减号 ‘=’ →钱包和钱包备份块之间的传输和恢复,等号 used to specify the type of operation on the wallet: '+' → recharge, plus '-' →impairment, minus ‘=’->backup or recover, equal.
blkNo**[in]** The block NO. The range is 0~63 for 1K capacity of M1 card.  
value**[in]** Amount, 4 bytes, low byte first. Only integer value support for operating, the specific amount and unit decided by applicaiton, the value must be integer type.  
updateBlkNo [in] Specified the block save the final result of operation. there are mainly and backup wallet in M1 card, to backup and recover when the data lost in some reason. The operation result of the mainly block will be written into the backup block.  
Return value 0 Success
(-3503) Parameter error  
(-3502) Module not opened  
(-3520) Operate failed  
-1001 Send error  
-1002 Recv error  
Note l “BlkNo” is the block number to be operated, and “UpdateBlkNo” is specified to the block save the results of this operation. l To recover the data from backup block, swap the “BlkNo” and “UpdateBlkNo” l “BlkNo” and “UpdateBlkNo” must be two neighboring blocks in one sector, otherwise return -3520.  

Get IC card account

Prototype int DLL_PiccGetPan(byte [] pan);  
Function: Get the account of contactless IC card.  
Parameters pan [out] Account number
Return value 0 Success
-1001 Send error  
-1002 Recv error  
others Failed  
Note  

PICC service release

Prototype void DLL_PiccRelease ();
Function Release the PICC service. Before call the member funciton of PICC class, an object of PICC class must be created, and bind the service. The service bind by the object must be released when not used.
Parameters None
Return value None
Note

Printer class

The basic printing process is as follows:

  1. Restore printing default values and clear buffered content:DLL_PrnInit()

2. Set the print gray level (if not set, use the default value of 4):DLL_PrnSetGray()

3. Setting up printing environment:DLL_PrnSetFont(). DLL_PrnSetLeftIndent() and DLL_PrnSetSpace()

4. The contents to be printed are all sent to the print buffer:DLL_PrnStr() and DLL_PrnLogo()

5. Repeat steps 3 and 4 if you need to print different fonts

  1. Start print:DLL_PrnStart()

Notes: 1. The maximum number of print dot matrix rows fed into the buffer is 5000 pixel rows (i.e. no more than 625mm length of printed content), and the content will not be printed; 2. After calling the printing function DLL_PrnStart (), the print buffer will be emptied.

The font format of print font library is GBK, which needs to be set to GBK encoding format in eclipse or Android studio project.

Constructor Print();
member function int DLL_PrnInit();
int DLL_PrnSetSpace(byte x, byte y);  
int DLL_PrnSetFont(byte asciiFontHeight, byte extendFontHeight, byte zoom);  
int DLL_PrnGetFont(byte []asciiFontHeight, byte [] extendFontHeight, byte[] zoom);  
int DLL_PrnStep(int pixel);  
int DLL_PrnStr(String strInUTF8);  
int DLL_PrnLogo(byte [] logo);  
int DLL_PrnBmp(Bitmap bitmap);  
int DLL_PrnStart();  
int DLL_PrnSetLeftIndent(int x);  
int DLL_PrnSetGray(byte nLevel);  
int DLL_PrnSetTemperature (int tempValue);  
int DLL_PrnGetTemperature (int [] tempValue);  
int DLL_PrnSetMode (byte mode);  
void DLL_PrnRelease ();  

Printer initial

Prototype int DLL_PrnInit();  
Function Recover all the set to default and clear the printer buffer.  
Parameters None  
Return value 0 Success
(-4007) No font library  
-1001 Send error  
-1002 Recv error  
Note  

Printer set word and row spacing

Prototype int DLL_PrnSetSpace(byte x, byte y);    
Function Set word and row spacing.    
Parameters x**[in]** Word spacing (pixel), the default is 0, the maximum is 255.  
y**[in]** Row spacing (pixel), the default is 0, the maximum is 255.    
Return value 0 Success  
Others Failed    
-1001 Send error    
-1002 Recv error    
Note The set will be effective until DLL_PrnInit called again or this API called again.    
       

Printer set font parameter

Prototype int DLL_PrnSetFont(byte asciiFontHeight, byte extendFontHeight, byte zoom);    
Function Set the print font and size    
Parameters asciiFontHeight**[in]** The height of English character: Can be PRN_FONT_SMALL(8X16) or PRN_FONT_BIG(12X24), the default value is:PRN_FONT_BIG  
extendFontHeight**[in]** The height of extend character: Can be PRN_FONT_SMALL(16X16) or PRN_FONT_BIG(24X24), the default value is :PRN_FONT_BIG    
zoom**[in]** Enlarge font parameter, the default value is 0, means not zoom in. ①PRN_ASCII_X_ENLARGE: Zoom in once in horizontal for English character. ②PRN_ASCII_Y_ENLARGE: Zoom in once in vertical for English character. ③PRN_EXT_X_ENLARGE: Zoom in once in horizontal for extend character. ④PRN_EXT_Y_ENLARGE: Zoom in once in vertical for extend character.    
Return value 0 Success  
Others Failed    
-1001 Send error    
-1002 Recv error    
Note ① The set will be effective until DLL_PrnInit called again or this API called again. ②Macro definition: #define PRN_FONT_SMALL 16 #define PRN_FONT_BIG 24 #define PRN_ASCII_X_ENLARGE 0x01 #define PRN_ASCII_Y_ENLARGE 0x02 #define PRN_EXT_X_ENLARGE 0x10 #define PRN_EXT_Y_ENLARGE 0x20    
       

Printer get font parameter

Prototype int DLL_PrnGetFont(byte asciiFontHeight[], byte extendFontHeight[], byte[] zoom);    
Function Get currnet font parameter of printer.    
Parameters asciiFontHeight**[out]** The height of English character, can be PRN_FONT_SMALL(8X16)or PRN_FONT_BIG(12X24)  
extendFontHeight**[out]** The height of extend character, can be PRN_FONT_SMALL(16X16)or PRN_FONT_BIG(24X24)    
zoom**[out]** Enlarge font parameter, the default value is 0, means not zoom in. ①PRN_ASCII_X_ENLARGE: Zoom in once in horizontal for English character. ②PRN_ASCII_Y_ENLARGE: Zoom in once in vertical for English character. ③PRN_EXT_X_ENLARGE: Zoom in once in horizontal for extend character. ④PRN_EXT_Y_ENLARGE: Zoom in once in vertical for extend character.    
Return value 0 Success  
others Failed    
-1001 Send error    
-1002 Recv error    
Note    
       

Printer offset the pointer in print buffer

Prototype int DLL_PrnStep(int pixel);  
Function Offset the pointer to specified pixel position in printer buffer.  
Parameters pixel**[in]** The pixel to be offset, can be a positive number or a negative number.
Return value 0 Success
others Failed  
-1001 Send error  
-1002 Recv error  
Note When print ,note the following points: 1, the pixels to be offset can be positive or negative. Positive to move forward; negative to move backward. 2, assuming that there are already 100 pixels in buffer, then the legitimate range for “pixel” is [-100,4900], out of the range will no action;  

Printer send string data to print buffer

Prototype int DLL_PrnStr(String str);  
Function Sent the data to be printed to print buffer. (The system will automatically converts the string to dot matrix data and stored within the print buffer)  
Parameters str [in] The string data to be printed in format UTF8
Return value 0 Success
(-4008) Print buffer overflow  
-1001 Send error  
-1002 Recv error  
Note 1) support variable parameters, please refer to printf () function of standard C; 2) support ' n' [line], ' f' [feed] control characters in the buffer; 3) Line feed automatically; 4) maximum 2047 bytes for once. 5) Not support the paramenters with "% f" format.  

Printer send logo dot data to print buffer

Prototype int DLL_PrnLogo(byte logo[]);  
Function Send the logo dot data to the print buffer  
Parameters logo**[in]** The logo data to be printed
Return value 0 Success
(-4008) Print buffer overflow  
-1001 Send error  
-1002 Recv error  
Note Use “LogoTools” to convert bmp to dot data. The maximum size of logo: width: 384 pixel, height: 500 pixel;  

Printer print BMP

Prototype int DLL_PrnBmp(Bitmap bitmap);  
Function Print BMP file  
Parameters bitmap**[in]** The bmp file to be printed
Return value 0 Success
(-4008) Print buffer overflow  
-1001 Send error  
-1002 Recv error  
Note  

Printer start print

Prototype int DLL_PrnStart();  
Function Start print  
Parameters None  
Return value 0 Success
(-4002) Out of paper  
(-4005) Over heat  
(-4007) No font library  
(-4008) Printer buffer overflow  
(-4009) Printer cover closed  
(-4011) Low battery, can't print any more  
-1001 Send error  
-1002 Recv error  
Others Other error  
Note ① After calling this function, it will return untill completed ② After finished, this function will return the state of printer; ③ After calling this function, the print buffer will be cleared;  

Printer set left indent

Prototype int DLL_PrnSetLeftIndent(int x);  
Function Set lef indent for pinter.  
Parameters x**[in]** The left indent value, range:0~336
Return value 0 Success
Others Failed  
-1001 Send error  
-1002 Recv error  
Note The default left indent is 0, and this function is invalid to DLL_PrnLogo function.  

Printer set gray

Prototype int DLL_PrnSetGray(byte nLevel);  
Function Set gray/speed for printer  
Parameters nLevel**[in]** Gray value, range: 0~15, the bigger the value, the deeper the effect, the slower the speed.
Return value 0 Success
Others Failed  
-1001 Send error  
-1002 Recv error  
Note  

Printer set overheat temperature value

Prototype int DLL_PrnSetTemperature (int tempValue);    
Function Set overheat temperature value to printer, once the value reached, return overheat.    
Parameters tempValue [in] Temperature value, range: 25°~65°  
Return value 0 Success  
-4010 The temperature vaule is not in the range.    
Note    
       

Printer get current printer temperature

Prototype int DLL_PrnGetTemperature (int [] tempValue);    
Function Get current printer temperature    
Parameters tempValue [out] Range: 25°~65°  
Return value 0 Success  
Others Failed    
Note    
       

Printer set print mode

Prototype int DLL_PrnSetMode (byte mode);    
Function Set print mode    
Parameters mode [ini] mode: 0x01: underline 0x02: bold 0x04: italic 0x08: left alignment 0x10: centered alignment 0x20: right alignment 0x40: reversed(black and white) combination was supported, for example: underline+ bold: (0x01 | 0x02 =0x03) , Note : left,centered, right alignment only can be one of them at the same time.  
Return value 0 Success  
Others Failed    
Note    
       

Printer service release

Prototype void DLL_PrnRelease ();
Function Release the Printer service. Before call the member funciton of Printer class, an object of Printer class must be created, and bind the service. The service bind by the object must be released when not used.
Parameters None
Return value None
Note

1D/2D Scanner class

When using the interface of the scanning head module, the application needs to control the power-on first. The control code is referred to Appendix A.

Constructor Scan();
Member function int DLL_ScanOpen();
int DLL_ScanClose();  
int DLL_ScanModeSet(byte [] mode);  
int DLL_ScanTrigger();  
int DLL_ScanRead(String [] data);  
int DLL_ScanKeySet(boolean mode);  
void DLL_ScanRelease ();  

Scan open

Prototype int DLL_ScanOpen();  
Function Power on the scan module, switch the comport from external serial to scan module.  
Parameters None  
Return value 0x00 Success
Others Failed  
Note  

Scan close

Prototype int DLL_ScanClose();  
Function Power off the scan module.  
Parameters None  
Return value 0x00 Success
Others Failed  
Note  

Scan mode set

Prototype int DLL_ScanModeSet(byte mode,byte []prefix, byte []suffix);  
Function Set scan mode for the scan module.  
Parameters mode**[in]** 1byte, each bit represent one mode. 1: enable, 0: disable. 0:keywedge mode; 1. add Prefix (4 bytes max)and suffix(2 bytes max) to the data scaned 2. add enter at end of the data scaned 3. Beep off/on 4. Restore factory default setting
prefix [in] the prefix data to be set when the first bit of mode is 1,  
suffix [in] the suffix data to be set when the first bit of mode is 1,  
Return value 0 Success
Others Failed  
Note Recover to default, the keywedge mode is disable. After set the mode, the result will be reflect in API DLL_ScanRead  

Scan start scan

Prototype int DLL_ScanTrigger();  
Function Trigger the scan , start to scan  
Parameters None  
Return value 0 Success
Others Failed  
Note  

Scan read data

Prototype int DLL_ScanRead(unsigned []data);  
Function Read the data scanned.  
Parameters data**[out]** The data scanned
Return value len The length of the data scanned, 0 means scan failed.
Others Other error  
Note Use together with "DLL_ScanSet".  

Scan Enable/Disable scan key

Prototype int DLL_ScanKeySet(boolean mode);  
Function Enable/Disable the scan key on device  
Parameters mode**[in]** 1:Enable; 0:Disable;
Return value 0 Success
Others Failed  
Note  

Scan service release

Prototype void DLL_ScanRelease ();
Function Release the Scan service. Before call the member funciton of Scan class, an object of Scan class must be created, and bind the service. The service bind by the object must be released when not used.
Parameters None
Return value None
Note

Alcohol class

The equipment supports the selection of alcohol module. The alcohol module is mounted on the terminal security chip and communicates with the security chip through serial port.

At the same time, it supports the alcohol module of the new and old national standards, and differentiates the different interfaces for the alcohol module of the new and old national standards.

Constructor Alcohol ();
Member function int DLL_AlcoholCheck(byte[] pkgName, byte cmd, byte dataLen, byte [] dataIn, byte[] dataOut);
int DLL_AlcoholSet(byte[] pkgName, byte cmd, byte dataLen, byte [] dataIn, byte[] dataOut);  
int DLL_AlcoholOperate(byte[] pkgName, byte cmd, byte dataLen, byte [] dataIn, byte[] dataOut);  
int DLL_AlcoholProt(byte cmd, byte dataLen, byte [] dataIn, AlcoholListener listener);  
int DLL_AlcoholProtCancel();  
int DLL_AlcoholProtEx(byte cmd, byte dataLen, byte [] dataIn, byte [] dataOut);  
void DLL_AlcoholRelease()  

Alcohol module information query(Old national standard)

Prototype int DLL_AlcoholCheck(byte cmd, byte dataLen, byte [] dataIn, byte[] dataOut);  
Function Inquire about alcohol module information  
Parameters cmd [in] Command bytes for querying information:1 byte 0x01:ID 0x02:Version 0x03:Production time 0x04:Factory time 0x05:Temperature correction time 0x06:Calibration time 0x07:Blowing time 0x09:k value 0x0a:blowing pressure 0x0b:test unit 0x0c: Current temperature 0x0d: Temperature calibration data 0x0e: Read calibration data
dataLen [in] Length of data sent  
dataIn [in] Input data: only when "read out the temperature calibration data" need to pass in the corresponding temperature calibration point data
dataOut**[out]** Query results, allocating 128 byte buffer size
Return value 0 Success
-1001 Send error  
-1002 Recv error  
Others Failed  
Note None  

Alcohol Module Parameters Settings(Old national standard,only for internal use)

Prototype int DLL_AlcoholSet(byte cmd, byte dataLen, byte [] dataIn, byte[] dataOut);  
Function Alcohol Module Parameters Settings  
Parameters cmd [in] Parameters of Setting Command Type:1 byte: 0x01:ID 0x02:Version 0x03:Production time 0x04:Factory time 0x05:Temperature correction time 0x06:Calibration time 0x07:Blowing time 0x09:k value 0x0a:blowing pressure 0x0b:test unit 0x0c: Current temperature 0x0d: Temperature calibration data 0x0e: Write calibration data
dataLen [out] Length of data to be sent  
dataIn [out] Data to be set: ID[12]:ID Ver[6]:Version Date[6]:Y/M/D,for Production,Factory,Temperature correction,Calibration time[1]: blowing time k[1]:k value pressure[1]: blowing pressure unit[1]:unit temp[5]: Temperature calibration data Calibration[5]: calibration data
dataOut [out] Return value of set result.
Return value 0 Success
-1001 Send error  
-1002 Recv error  
Others Failed  
Note None  

Alcohol module operation(Old national standard)

Prototype int DLL_AlcoholOperate(byte cmd, byte dataLen, byte [] dataIn, byte[] dataOut);  
Function Blow test, Return test results.  
Parameters cmd [in] 0x04:blow test
dataLen [out] The length of data ot be passed in,2bytes  
dataIn [out] 2 bytes: The first byte means test mode: 0x00:Passive testing 0x01:Active testing The second byte indicates whether the test is fast or not: 0xaa:fast test 0xbb:Test without exhaust 0xcc:Test with exhaust
dataOut [out] Result: dataOut:0~5 Command fields can be ignored dataOut:6~26: The contents in byte order are: Unit the eight higher digits of the peak AD value the eight lower digits of the peak AD value the eight higher digits of the sampling times the eight lower digits of the sampling times the eight higher digits of the exit point AD the eight lower digits of the exit point AD Exit flag test result test result test result test result test result the eight higher digits of the integral value AD the eight lower digits of the integral value AD the eight higher digits of the temperature AD value the eight lower digits of the temperature AD value the eight higher digits of the calibration theory AD value the eight lower digits of the calibration theory AD value the eight higher digits of the test theory AD value the eight lower digits of the test theory AD value Just focus on the five fields of test results: For example: Test result: 3039332E32,is ASCII code ,Converting numbers to :93.2 mg/100ml, Specific units according to the settings, the default is mg/100ML
Return value 0 Success
-1001 Send error  
-1002 Recv error  
Others Failed  
Note None  
 

Operation requiring blowing(New national standard)

Prototype int DLL_AlcoholProt(byte cmd, byte dataLen, byte [] dataIn, AlcoholListener listener);  
Function Operation of test , calibration and temperature correction.  
Parameters cmd [in] 0xAF: Exhaust gas test 0xA1: General test 0xB2: Passive testing 0xA3: Quick Checking and Testing 0xA2: Air test zero 0xA4: Calibration instructions (active mode) 0xA7: -5 degree temperature calibration operation 0xA8: 5 degree temperature calibration operation 0xA9: 15 degree temperature calibration operation 0xAA: 28 degree temperature calibration operation 0xAB: 37 degree temperature calibration operation 0xB7: 45 degree temperature calibration operation
dataLen [in] Length of data to be passed in  
dataIn [in] Calibration instructions (active mode) 2 bytes of concentration value,for example: Passed in 0x03,0x81,concentration is 0.381mg/L others: No incoming data required
listener [out] Return value of test result: interface AlcoholListener { void GetRetData(int ret, byte[] dataOut); } The caller is required to implement this interface. Return value: 0x51: Alcohol test ready 0x53: Blow detection 0x54: Full blowing time 0x55: Successful Blowing Sampling 0xC2: Integral Results of Alcohol Detection 0x56: Alcohol concentration results 0x57: Blowing interruption 0x58: Refuse to blow up 0x59: Failure of alcohol testing 0xA6: Module Response Detection Termination 0xea: Return value of Real-time blowing process 0xA5: Calibration instructions (active mode) 0xA7: - 5 degree temperature calibration operation 0xA8: 5 degree temperature calibration operation 0xA9: 15 degree temperature calibration operation 0xAA: 28 degree temperature calibration operation 0xAB: 37 degree temperature calibration operation 0xB7: 45 degree temperature calibration operation
Return value 0 Success
-1001 Send error  
-1002 Recv error  
Others Failed  
Note none  

Alcohol testing terminated(New national standard)

Prototype int DLL_AlcoholProtCancel();  
Function Alcohol testing terminated  
Parameters None  
Return value 0 Success
-1001 Send error  
-1002 Recv error  
Others Failed  
Note None  

Operating Interface for Alcohol Module(New national standard)

Prototype int DLL_AlcoholProtEx(byte cmd, byte dataLen, byte [] dataIn, byte [] dataOut);  
Funciton New Protocol Operating Interface for Alcohol Module  
Parameters cmd [in] 0x76: Version Number Query 0xA0: Communication connection 0xB0: Read calibration data 0xAC: Direct Writing of Temperature Calibration Data 0xAE: Reading Temperature Calibration Data 0xC0: Read the current pressure 0xC1: Read the current temperature 0xB5: Setting up start-up flow rate, blowing time and blowing volume 0xC5: Read start-up flow, blowing time, blowing volume 0xB6: Calibration flow rate 0xC6: Read and calibrate flow and pressure (difference) 0xC7: Atmospheric pressure in reading and calibrating flow rate
dataLen [in] Length of data to be passed in  
dataIn [in] Write temperature calibration data directly: AD_H+AD_L+TEM_H+TEM_L AD_H,AD_L: Indicate concentration integral AD value TEM_H,TEM_L: Represents temperature AD value, decimal representation Setting up start-up flow rate, blowing time and blowing volume: FLOW+TIME+VOLUM+VOLUN_OR FLOW: Start-up Traffic-HEX Code(06 represents 6L/MIN-14 represents 20L/MIN) VOLUN_OR:Whether to Judge Volume(0x01-0x00) TIME: Blowing time -10*HEX code(1E represents 3.0 seconds-3C represents 6.0 seconds) VOLUM: Blowing volume -HEX code/10(05 represents 0.5L-19 2.5L) Calibrated flow: FLOW: Calibrated flow(HEX)(0A represents 10L/MIN-14 represents 20L/MIN)
dataOut [out] Return value of test result:
Return value: 0 Success
-1001 Send error  
-1002 Recv error  
Others Failed  
Note:  

Alcohol service release

Prototype void DLL_AlcoholRelease ()
Function Release the Alcohol service. Before call the member funciton of Alcohol class, an object of Alcohol class must be created, and bind the service. The service bind by the object must be released when not used.
Parameters None
Return value None
Note

Fingerprint class

This terminal supports two different kinds of fingerprint module matching (Ariot and Datang). The manufacturer of fingerprint module has provided corresponding SDK, so it has not been re-encapsulated. The application is developed directly using the so library and interface provided by the manufacturer, and refers to the Demo provided by the manufacturer.

The fingerprint module is a USB interface. Because the main chip has only one USB interface, it is common to charge and debug the USB outside the terminal. So it can not charge and debug the ADB when using the USB host function. That is to say, when the control fingerprint module is powered on, the USB can be switched to use the fingerprint. At this time, it can not charge and debug the adb. If you need ADB debugging, you can do it by using WIFI. Please refer to Appendix B for the steps. When the fingerprint control module is powered down, the USB will switch to a chargeable and ADB debugging state.

ID card class

The ID card module manufacturer has provided the corresponding SDK, so it has not been re-encapsulated. The application is developed directly using the so library and interface provided by the manufacturer, and refers to the Demo provided by the manufacturer.

Appendix A

The control code of security chip and module power-on and power-off, for application call.

Appendix B

When USB is occupied by fingerprint, it can not be debugged and logcat checked by USB adb. At this time, it can be debugged and logcat checked by network. The specific steps are as follows:

1. The terminal connects WiFi to ensure that it is on the same network as the PC terminal and checks the IP address of the acquired terminal.

2. The PC side opens the ADB command line and uses the command "adb connect *. *. * *" to connect the terminal.

3. After successful connection, you can use ADB command to debug and logcat to view.