Fujian MoreFun Electronic Technology Co.,Ltd.
XPOS
Secondary development
interface document
1 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Document magament
Version history
Date Version Modify record Author
20181109 1.0 Basic interface yangjy
2 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Content
Content ....................................................................................................................................................... 3
1 profile................................................................................................................................................ 9
1.1 overall structure ........................................................................................................................... 9
1.1 modular design ............................................................................................................................ 9
2 System module(libapi_system) .....................................................................................................10
2.1 interface list ............................................................................................................................... 10
2.2 API interface ............................................................................................................................... 11
2.2.1 System initialization(Sys_Init) .......................................................................................... 11
2.2.2 Vendor personality parameter setting(Sys_Config) ......................................................... 12
2.2.3 Get terminal info(Sys_GetTerminalInfo) .......................................................................... 13
2.2.4 Get system time(Sys_GetDateTime) ................................................................................ 13
2.2.5 Set systemn time(Sys_SetDateTime) ................................................................................ 14
2.2.6 Scan buttun(Sys_CheckKey).............................................................................................. 15
2.2.7 Clear button cache(Sys_ClrKey)........................................................................................ 15
2.2.8 Open timer(Sys_TimerOpen) ............................................................................................ 16
2.2.9 Test timer (Sys_TimerCheck) ............................................................................................ 16
2.2.10 Turn of timer(Sys_TimerClose) ......................................................................................... 17
2.2.11 delay(Sys_Delay)............................................................................................................... 18
2.2.12 Terminal sleep (Sys_Sleep) ............................................................................................... 18
2.2.13 Terminal reboot(Sys_Reboot)........................................................................................... 19
3 Tool module (libapi_util) ...............................................................................................................19
3.1 interface list ............................................................................................................................... 19
3.2 API interface ............................................................................................................................... 21
3.2.1 ASCII code change to BCD code (Util_Asc2Bcd) ............................................................... 21
3.2.2 BCD code convert to ASCII code (Util_Bcd2Asc) ............................................................... 21
3.2.3 Int type data convert to BCD code (Util_Int2Bcd) ............................................................ 22
3 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
3.2.4 BCD code convert to int type(Util_Bcd2Int) ..................................................................... 23
3.2.5 Caculate LRC(Util_GenLrc)................................................................................................ 24
3.2.6 DES encryption and decryption (Util_Des) ....................................................................... 24
3.2.7 Chinese character copy(Util_StrCopy) .............................................................................. 25
3.2.8 Waiting button(Util_WaitKey) ......................................................................................... 26
3.2.9 Input method input(Util_InputMethod) ........................................................................... 27
3.2.10 String input (Util_InputText) ............................................................................................ 28
3.2.11 Amount input(Util_InputAmount) .................................................................................... 29
3.2.12 IP input (Util_InputIp) ....................................................................................................... 30
3.2.13 beep(Util_Beep) ................................................................................................................ 31
3.2.14 Voice play (Play_Voice) .................................................................................................... 32
3.2.15 Generate random numbers(Util_Rand) ........................................................................... 33
4 File module(libapi_file) ..................................................................................................................34
4.1 Interface list ............................................................................................................................... 34
4.2 API interface ............................................................................................................................... 35
4.2.1 Check if the file exists (UFile_Check) ................................................................................ 35
4.2.2 File open / create(UFile_OpenCreate) .............................................................................. 36
4.2.3 File read(UFile_Read) ....................................................................................................... 37
4.2.4 Write file (UFile_Write) .................................................................................................... 38
4.2.5 Positioning file pointer(UFile_Lseek) ................................................................................ 39
4.2.6 Delete file record (UFile_Delete) ...................................................................................... 40
4.2.7 Close file (UFile_Close) ..................................................................................................... 41
4.2.8 Delete file (UFile_Remove) ............................................................................................... 42
4.2.9 Rename file (UFile_Rename) ............................................................................................ 42
4.2.10 Empty file(UFile_Clear) ..................................................................................................... 43
4.2.11 Get free space(UFile_GetFreeSpace)................................................................................ 44
4.2.12 Get the number of file records (UFile_GetNumberOfRecords) ........................................ 45
4.2.13 Append file record(UFile_AppendRecord) ........................................................................ 46
4 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
4.2.14 Query records based on index number(UFile_GetRecordByIndex) .................................. 47
4.2.15 Check record(UFile_GetRecord) ....................................................................................... 48
4.2.16 Update record(UFile_UpdateRecord)............................................................................... 49
4.2.17 Update records based on index number(UFile_UpdateRecordByIndex) ......................... 51
4.2.18 Delete record (UFile_DeleteRecord) ................................................................................. 52
4.2.19 Delete records based on index number(UFile_DeleteRecordByIndex) ............................ 53
4.2.20 Read one line text(UFile_ReadLine) ................................................................................. 54
4.2.21 Read non-fixed length records (UFile_ReadTLV).............................................................. 55
4.2.22 Write non-fixed data(UFile_WriteTLV) ............................................................................ 56
4.2.23 Delete non-fixed length record (UFile_DeleteTLV)........................................................... 57
5 IC card module (libapi_iccard) .......................................................................................................58
5.1 interface list ............................................................................................................................... 58
5.2 API interface ............................................................................................................................... 59
5.2.1 Turn on IC card device (Icc_Open) .................................................................................. 59
5.2.2 Turn off IC card device (Icc_Close).................................................................................... 60
5.2.3 Turn off IC card device (Icc_Close).................................................................................... 60
5.2.4 Test card(Icc_GetCardStatus) ........................................................................................... 62
5.2.5 Contact card power on(Icc_PowerUp) ............................................................................. 62
5.2.6 Contact card power off (Icc_PowerDown) ....................................................................... 63
5.2.7 Contact card communication (Icc_ICComm) .................................................................... 64
5.2.8 NFC card searching card (Icc_CTLSPowerUpAndSeek) .................................................... 66
5.2.9 NFC card power off(Icc_CTLSPowerDown)....................................................................... 67
5.2.10 Use APDU to communicate with NFC card(Icc_CTLSComm)............................................ 67
6 communication( libapi_comm) ...............................................................................................69
6.1 interface list ............................................................................................................................... 69
6.2 API interface ............................................................................................................................... 69
6.2.1 comm_net_link ................................................................................................................. 69
6.2.2 comm_net_unlink ............................................................................................................. 70
5 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
6.2.3 comm_sock_connect ........................................................................................................ 71
6.2.4 comm_sock_recv .............................................................................................................. 71
6.2.5 comm_sock_send ............................................................................................................. 72
6.2.6 comm_sock_close ............................................................................................................. 73
6.2.7 comm_ssl_init ................................................................................................................... 73
6.2.8 comm_ssl_connect ........................................................................................................... 74
6.2.9 comm_ssl_send ................................................................................................................ 75
6.2.10 comm_ssl_recv ................................................................................................................. 75
6.2.11 comm_ssl_close ................................................................................................................ 76
7 security( libapi_security) .........................................................................................................77
7.1 interface list ............................................................................................................................... 80
7.2 API interface ............................................................................................................................... 80
7.2.1 mksk_save_plaintext_key ................................................................................................ 80
7.2.2 mksk_save_encrypted_key............................................................................................... 81
7.2.3 mksk_3des_run................................................................................................................. 82
7.2.4 dukpt_get_ksn .................................................................................................................. 83
7.2.5 dukpt_3des_run.................................................................................. 错误 !未定义书签。
7.2.6 dukpt_init_key .................................................................................... 错误 !未定义书签。
8 Gui (libapi_gui) ........................................................................................................................87
8.1 interface list ............................................................................................................................... 87
8.2 API interface ............................................................................................................................... 89
8.2.1 gui_bar_rc ........................................................................................................................ 89
8.2.2 gui_set_bar_color............................................................................................................. 89
8.2.3 gui_get_bar_color ............................................................................................................ 90
8.2.4 gui_set_font...................................................................................................................... 91
8.2.5 gui_get_font ..................................................................................................................... 91
8.2.6 gui_set_text_color ............................................................................................................ 92
8.2.7 gui_get_text_color ........................................................................................................... 93
6 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
8.2.8 gui_set_text_bg_color...................................................................................................... 93
8.2.9 gui_get_text_bg_color ..................................................................................................... 94
8.2.10 gui_clear_dc ..................................................................................................................... 95
8.2.11 gui_set_pixel..................................................................................................................... 95
8.2.12 gui_get_pixel .................................................................................................................... 96
8.2.13 gui_text_out ..................................................................................................................... 97
8.2.14 gui_get_text_width .......................................................................................................... 97
8.2.15 gui_get_text_height ......................................................................................................... 98
8.2.16 gui_cline............................................................................................................................ 99
8.2.17 gui_get_width ................................................................................................................ 100
8.2.18 gui_get_height ............................................................................................................... 100
8.2.19 gui_page_op_paint ........................................................................................................ 101
8.2.20 gui_ime_set_mode ......................................................................................................... 102
8.2.21 gui_ime_start_input ....................................................................................................... 102
8.2.22 gui_main_menu_func_add ............................................................................................ 103
8.2.23 gui_main_menu_item_add ............................................................................................ 104
8.2.24 gui_main_menu_show ................................................................................................... 104
8.2.25 gui_post_message .......................................................................................................... 105
8.2.26 gui_proc_default_msg ................................................................................................... 106
8.2.27 gui_messagebox_show .................................................................................................. 106
8.2.28 gui_load_bmp................................................................................................................. 107
8.2.29 gui_out_bits .................................................................................................................... 108
9 EMV(libapi_emv) ..........................................................................................................................109
9.1 interface list ............................................................................................................................. 109
9.2 API interface ............................................................................................................................. 109
9.2.1 emv_read_card............................................................................................................... 109
9.2.2 EMV_TermConfigInit ...................................................................................................... 110
9.2.3 EMV_GetKernelVersion .................................................................................................. 110
7 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
9.2.4 EMV_GetKernelData ...................................................................................................... 111
9.2.5 EMV_PrmSetAIDPrm ...................................................................................................... 112
9.2.6 EMV_PrmGetAIDPrm ..................................................................................................... 112
9.2.7 EMV_PrmDelAIDPrm ...................................................................................................... 113
9.2.8 EMV_PrmClearAIDPrmFile ............................................................................................. 113
9.2.9 EMV_PrmSetCAPK .......................................................................................................... 114
9.2.10 EMV_PrmGetCAPK ......................................................................................................... 114
9.2.11 EMV_PrmDelCAPK .......................................................................................................... 115
9.2.12 EMV_PrmClearCAPKFile ................................................................................................. 116
10 Print (libapi_print)........................................................................................................................116
10.1 interface list ............................................................................................................................. 116
10.2 API interface ............................................................................................................................. 117
10.2.1 UPrint_GetModuleVer .................................................................................................... 117
10.2.2 UPrint_Init ...................................................................................................................... 118
10.2.3 UPrint_Str ....................................................................................................................... 118
10.2.4 UPrint_BitMap ................................................................................................................ 119
10.2.5 UPrint_Start .................................................................................................................... 120
10.2.6 UPrint_StrBold ................................................................................................................ 120
10.2.7 UPrint_Feed .................................................................................................................... 121
10.2.8 UPrint_MatrixCode ......................................................................................................... 122
8 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
1 profile
1.1 overall structure
This document provides a comprehensive introduction to the
application development interface to assist application developers in
better secondary development.
application
Public module
XPOS API
Terminal
1.1 modular design
The terminal software is divided into modules to face relatively independent devices
or functions, to meet the goal of rapid development of terminal software and frequent
update of requirements.
9 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
APP MAIN
Print commun
protocol Parameter Record APP Manage
Func ication
System Gui Print Utils Comm IC Mag File Security Emv
Device type A Device type B ...
2 System module(libapi_system)
2.1 interface list
Function name Function prototype Function function
System initialization Sys_Init System initialization, independent
initialization with application layer
manufacturer personality Sys_Config Manufacturer personality parameter
parameter setting setting, call each vendor
personalization function
Get terminal info Sys_GetTerminalInfo Get terminal info
Obtain system time Sys_GetDateTime Obtain system time
Set system time Sys_SetDateTime Set system time
Scanning buttun Sys_CheckKey Scan button, non-blocking
10 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Clear button cache Sys_ClrKey Clear button cache
oepn timer Sys_TimerOpen Turn on the timer and set the timing
test timer Sys_TimerCheck Check if the timing time is up
Close timer Sys_TimerClose Close timer
delay Sys_Delay Delay, block
Display battery power in Sys_GetBatter Display battery power in real time
real time
terminal sleep Sys_Sleep Terminal enter into sleep status
terminal reboot Sys_Reboot terminal reboot
Get network license for Sys_GetNetworkLicense Get network license for terminal
terminal
Set screen backlight Sys_SetScrBackLight Set screen backlight
Get terminal fireware info Sys_GetFirmwareInfo Get terminal fireware info
2.2 API interface
2.2.1 System initialization(Sys_Init)
Function int Sys_Init(int Argc, char **Argv, char *AppName);
prototype
Function System initialization, independent initialization with application layer
function
Parameter In parameter Argc:Reuse the main function parameter Argc
Description
Argv:Reuse the main function parameter Argv
11 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
AppName:application name
Out none
parameter
Return value USYS_FAIL = -1, // failure
USYS_FIRST = 1,//First run after the program is updated
USYS_NOFIRST = 2//The program is not the first time running
Supplementary no process for not using in parameter
explanation
Function internal call vendor private API
The API only returns to the first run when the program is newly installed.
The program update is not the first run.
2.2.2 Vendor personality parameter setting(Sys_Config)
Function void Sys_Config(void);
prototype
Function Manufacturer personality parameter setting, call each vendor
function personalization function
Parameter In parameter none
description
Out none
parameter
Return value
12 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
explanation
2.2.3 Get terminal info(Sys_GetTerminalInfo)
Function int Sys_GetTerminalInfo(TERMINALINFO *terminal);
prototype
Function Get terminal info
function
Parameter In none
description parameter
Out terminal referance TERMINALINFO
parameter
Return value USYS_FAIL = -1, // failure
USYS_SUCCES= 0,// success
Supplementary
explanation
2.2.4 Get system time(Sys_GetDateTime)
Function int Sys_GetDateTime(byte *DateTime);
prototype
Function Get system time
function
Parameter In parameter None
13 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
description Out DateTime:"YYYYMMDDHHMMSS" 14 byte
parameter
Return value USYS_FAIL = -1, // failure
Supplementary USYS_SUCCES = 0,// success
explanation
Function
prototype
2.2.5 Set systemn time(Sys_SetDateTime)
Function int Sys_SetDateTime(byte *DateTime);
prototype
Function Set system time
function
Parameter In DateTime:"YYYYMMDDHHMMSS" 14 byte
description parameter
Out None
parameter
Return value USYS_PARAERROR = -2,// parameter wrong
USYS_FAIL = -1, // failure
USYS_SUCCES= 0,// success
Supplementary API internal judge whether time format is correct
explanation
14 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
2.2.6 Scan button(Sys_CheckKey)
Function int Sys_CheckKey(void);
prototype
Function Scan button, non-block
function
Parameter In none
description parameter
Out none
parameter
Return value Success return key value KEY_VALUE
No button return 0
USYS_FAIL = -1, // failure
Supplementary None enum KEY_VALUE defined ket,unified return 0
explanation
2.2.7 Clear button cache(Sys_ClrKey)
Function void Sys_ClrKey(void);
prototype
Function Clear button cache
function
Parameter In none
description parameter
15 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out none
parameter
Return value
Supplementary
explanation
2.2.8 Open timer(Sys_TimerOpen)
Function int Sys_TimerOpen(uint TimerMs);
prototype
Function turn on timer, set timer timing
function
Parameter In TimerMs: in millisecond
description parameter
Out none
parameter
Return value success return timer handle
USYS_FAIL = -1, // failure
Supplementary
explanation
2.2.9 Test timer (Sys_TimerCheck)
Function int Sys_TimerCheck(int iHandle);
prototype
16 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function test whether timer time is up
function
Parameter In iHandle:timer handle
description parameter
Out none
parameter
Return value Successful return, remaining time, in milliseconds (0 means the time is
up)
USYS_FAIL = -1, // failure
Supplementary
explanation
2.2.10 Turn off timer(Sys_TimerClose)
Function int Sys_TimerClose(int iHandle);
prototype
Function turn off timer
function
Parameter In iHandle:timer handle
description parameter
Out none
parameter
Return value USYS_FAIL = -1, // failure
USYS_SUCCESS = 0 // success
Supplementary
explanation
17 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
2.2.11 delay(Sys_Delay)
Function void Sys_Delay(uint uiMs);
prototype
Function Postpone, block
function
Parameter In uiMs:delay time in ms
description parameter
Out none
parameter
Return value
Supplementary
explanation
2.2.12 Terminal sleep (Sys_Sleep)
Function int Sys_Sleep(uint Time);
prototype
Function terminal enter into sleep status
function
Parameter In Time: Enter sleep time, in seconds (unsupported
description parameter manufacturers, considered invalid)
Out none
parameter
Return value USYS_FAIL = -1, // failure
USYS_SUCCESS = 0 // success
18 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary The application needs to detect the wireless network registration
explanation status after waking up.
2.2.13 Terminal reboot(Sys_Reboot)
Function int Sys_Reboot(void);
prototype
Function Terminal reboot
function
Parameter In none
description parameter
Out none
parameter
Return value USYS_FAIL = -1, // failure
USYS_SUCCESS = 0 // success
Supplementary Each vendor implements according to its own OS and for unsupport,
explanation then direct return. (Considering unsupported vendors, the
application layer needs to prompt a forced restart after calling
the API)
3 Tool module (libapi_util)
3.1 interface list
Function name Function prototype Function function
19 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
ASCII code change to Util_Asc2Bcd ASCII code change to BCD code
BCD code
BCD code change to Util_Bcd2Asc BCD code change to ASCII code
ASCII code
Int type data change to Util_Int2Bcd Int type data change to BCD code
BCD code
BCD code change to int Util_Bcd2Int BCD code data change to int type
type
Caculate LRC Util_GenLrc Calculate and generate LRC check
digits (bitwise XOR)
DES encryption and Util_Des DES encryption and decryption of data
decryption or 3DES encryption and decryption
Chinese character copy int Util_StrCopy Chinese intelligent truncation function,
solves the problem of displaying half a
Chinese character in a line of Chinese
waiting key Util_WaitKey Wait for the button within the set time,
wait for the timeout without the button
input method Util_InputMethod Support data input for input method
switching
string input Util_InputText Number, letter, password type in
amount input Util_InputAmount Input amount
IP input Util_InputIp Input IP address
beep Util_Beep beep, non-block
Voice play Play_Voice voice play, non-block
Production random number Util_Rand generate random number
20 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
3.2 API interface
3.2.1 ASCII code change to BCD code
(Util_Asc2Bcd)
Function int Util_Asc2Bcd(char *AscBuf, char *BcdBuf, int AscLen)
prototype
Function ASCII code change to BCD code
function
Parameter In AscBuf: ASCII code data to be converted
description parameter
AscLen: Importing ASCII code data length
Out BcdBuf: Convert output BCD code data
parameter
Return value UUTIL_FAIL = -1, // failure
UUTIL_SUCCESS = 0 // success
Supplementary ‘F’Left on the BCD code, after the number of digits is
explanation insufficient, make up ‘F’
3.2.2 BCD code convert to ASCII code
(Util_Bcd2Asc)
21 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int Util_Bcd2Asc(char *BcdBuf, char *AscBuf, int AscLen)
prototype
Function BCD code convert to ASCII code
function
Parameter In BcdBuf: BCD code data that need to be converted
description parameter
AscLen: ASCII code data length, which is double the
length of BCD code data
Out AscBuf: Convert output ASCII code data
parameter
Return value UUTIL_FAIL = -1, // failure
UUTIL_SUCCESS = 0 // success
Supplementary
explanation
3.2.3 Int type data convert to BCD code
(Util_Int2Bcd)
22 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int Util_Int2Bcd(uint IntData, char *BcdBuf, int BcdLen)
prototype
Function Int type data convert to BCD code
function
Parameter IntData: Int data to be converted
In
description
parameter
BcdLen:BCD code data length after conversion
Out BcdBuf:BCD data after conversion
parameter
Return value UUTIL_FAIL = -1, // failure
UUTIL_SUCCESS =0 // success
Supplementary Right by BCD code, the number of digits is less then add 0 in the left side
explanation
3.2.4 BCD code convert to int type(Util_Bcd2Int)
Function int Util_Bcd2Int(char *BcdBuf, uint *IntData, int BcdLen)
prototype
Function BCD code data convert to int type
function
Parameter BcdBuf:BCD data to be converted
In
description
parameter
BcdLen:BCD code data length
Out IntData: int type data after conversion
parameter
23 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value UUTIL_FAIL = -1, // failure
UUTIL_SUCCESS = 0 // success
Supplementary
explanation
3.2.5 Caculate LRC(Util_GenLrc)
Function Byte Util_GenLrc(char *Data, int DataLen)
prototype
Function Calculate and generate LRC check digits (bitwise XOR)
function
Parameter Data:Data of the LRC check digit to be calculated
In
description
parameter
DataLen: data length
Out
parameter
Return value Calculate the generated LRC check value
Supplementary
explanation
3.2.6 DES encryption and decryption (Util_Des)
24 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function intUtil_Des(bytebDesType,char*Key,char*InData,char*OutData)
prototype
Function DES encryption and decryption of data or 3DES encryption and
function decryption
Parameter In parameter bDesType: DES encryption and decryption
description algorithm: 0 means DES encryption, 1
means DES decryption, 2 means
3DES encryption, 3 means 3DES
decryption
The transport key used for encryption
Key:
and decryption must be a multiple of 8.
InData: The ciphertext data to be encrypted
and decrypted must be 8 bytes.
Out OutData: The encrypted and decrypted key
parameter must be 8 bytes.
Return value UUTIL_FAIL = -1, // failure
UUTIL_SUCCESS =0 // success
Supplementary
explanation
3.2.7 Chinese character copy(Util_StrCopy)
25 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int Util_StrCopy(char *dst, cchar *src, int len)
prototype
Function Chinese intelligent truncation function, solves the problem of
function displaying half a Chinese character in a line of Chinese
Parameter In parameter scr: Source data string
description
len: Source data length
Out Dst: target data string
parameter
Return value Returns the length of the copied string
Supplementary
explanation
3.2.8 Waiting button(Util_WaitKey)
Function int Util_WaitKey(int TimeOut)
prototype
Function Wait for the button within the set time, without button then waiting
function timeout
Parameter In parameter TimeOut: Waiting timeout (seconds), 0 means
description blocking
Out
parameter
26 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value UUTIL_TIMEOUT Or return button value
Supplementar
y explanation
3.2.9 Input method input(Util_InputMethod)
Function int Util_InputMethod(int disp_line, char * msgPrompt, int
prototype input_line, char *str, int min, int max, byte disp_pattern,int
timeout)
Function data input that support input method switching
function
Parameter In paramater disp_line: Prompt message shows
description the number of lines
msgPrompt: Prompt message (left
alignment)
input_line: Input data display line
number
min: Minimum input length
max: Maximum input length
disp_pattern: Input data display
position, 0 left aligned; 1 centered;
2 right alignment
timeout: Waiting for input timeout (seconds)
Out str: input data
parameter
27 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value Success: return the input data str bytes
UUTIL_TIMEOUT = -3, // input timeout
UUTIL_CANCEL = -2, // input cancel
UUTIL_FAIL = -1, // failure
Supplementary
explanation
3.2.10 String input (Util_InputText)
Function int Util_InputText(int disp_line, char * msgPrompt, int input_line,
prototype char *str, int min, int max, int disp_pattern,byte disp_mode ,
int timeout)
Function number, letter, password input
function
Parameter In disp_line: Prompt message shows the number of
description paramater lines
msgPrompt: Prompt message
input_line: Input data display line number
min: Minimum input length
max: Maximum input length
disp_pattern: Display position, 0 left aligned; 1
centered; 2, right aligned
disp_mode: Input mode, 0 digital input; 1
28 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
number, letter input
password input
timeout: Timeout (seconds)
Out parameter str: Input data
Return value Success: return the input data str bytes
UUTIL_TIMEOUT = -3, // input timeout
UUTIL_CANCEL = -2, // input cancel
UUTIL_FAIL = -1, // failure
Supplementary When the input mode is numeric or letter input, switching between a
explanation certain number, uppercase and lowercase, and lowercase is
performed by pressing a button continuously.
3.2.11 Amount input(Util_InputAmount)
Function int Util_InputAmount(int disp_line, char * msgPrompt, int input_line,
prototype char *amount, byte disp_ pattern,int timeout)
Function Input amount
function
Parameter In parameter disp_line: Prompt message shows the number
description of lines
msgPrompt: Prompt message
input_line: Input data display line number
29 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
disp_pattern: Display mode, 0 left aligned; 1
centered; 2, right aligned
timeout: Timeout (second)
Out amount: Output amount
parameter
Return value Success: return the output amount bytes
UUTIL_TIMEOUT = -3, // input timeout
UUTIL_CANCEL = -2, // input cancel
UUTIL_FAIL = -1, // failure
Supplementary the amount input is accurate to cent (two decimal places are
description reserved) and stored in the Amount variable in 12-bit ASCII code.
3.2.12 IP input (Util_InputIp)
Function int Util_InputIp(int disp_line, char * msgPrompt, int input_line,
prototype char *ip, byte disp_pattern, int timeout)
Function Enter IP address
function
30 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In parameter
disp_line: Prompt message
description
shows the number of lines
msgPrompt: prompt message
input_line: Input data display line
number
disp_pattern:
Display position, 0 left aligned;
1 centered; 2, right pair
Timeout: timeout
(seconds)
Out ip: enter IP address
parameter
Return value Success: return input IP address bytes
UUTIL_TIMEOUT = -3, // input timeout
UUTIL_CANCEL= -2, // input cancel
UUTIL_FAIL = -1, // failure
Supplementary API internal with IP address format judgment
explanation
3.2.13 beep(Util_Beep)
Function Void Util_Beep(int num)
prototype
31 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function Buzzer, non-blocking
function
Parameter In num: Beep times
description paramter
Out
parameter
Return value
Supplementary
explanation
3.2.14 Voice play (Play_Voice)
Function void Play_Voice(char *msg)
prototype
Function Specified line display
function
Parameter In parameter Msg: Information that requires voice play
description
Out None
parameter
Return value None
Supplementar Voice playback is non-blocking
y explanation
32 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
3.2.15 Generate random numbers(Util_Rand)
Function int Util_Rand(byte *psRandom)
prototype
Function Generate random numbers
function
Parameter In
description parameter
Out psRandom8byte Binary random number
parameter
Return value UUTIL_FAIL = -1, // failure
UUTIL_SUCCESS =0 // success
Supplementar Priority use true random numbers
y explanation
33 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
4 File module(libapi_file)
4.1 Interface list
Function name Function prototype function function
Check if the file exists UFile_Check Check if the file exists
File open/create UFile_OpenCreate File open/create
File reading UFile_Read File reading
File writing UFile_Write File writing
Positioning file pointer UFile_Lseek Positioning file pointer
Delete file record UFile_Delete Delete file record
Close file UFile_Close Close file
Delete file UFile_Remove Delete file
Rename file UFile_Rename Rename file
Empty file UFile_Clear Empty file content
Take the remaining space UFile_GetFreeSpace Take the remaining space of the file
of the file system system
Take the number of file UFile_GetNumberOfRecord Take the number of file records
records s
Append file record UFile_AppendRecord At the end of the file, add a fixed length
record file. Automatically create a file
when it does not exist
check records based on UFile_GetRecordByIndex Find any record by record index
index number
Check record UFile_GetRecord Find any record by condition
Update record UFile_UpdateRecord Update any record by condition
34 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Update records based on UFile_UpdateRecordByInd Update any records based on index
index number ex number
Delete record UFile_DeleteRecord Delete any record by condition
Delete records based on UFile_DeleteRecordByInde Delete any record by recording the
index number x index number
Read a line of text UFile_ReadLine Read a line of text and support \r \n
newline
Read non-fixed length UFile_ReadTLV Read non-fixed length record TLV,
records consistent with IC card TVL format
Write non-fixed data UFile_WriteTLV Write non-fixed data TLV
Delete non-fixed record UFile_DeleteTLV Delete non-fixed record TLV
4.2 API interface
4.2.1 Check if the file exists (UFile_Check)
Function int UFile_Check(cchar *FileName, int iFileLocation);
prototype
Function Check if the file exists
function
Parameter In parameter FileName:File name, ending with NULL, up to 16 bytes
description
iFileLocation: Storage location, see enum
35 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
FILELOCATION
Out None
parameter
Return value UFILE_NO_EXIST = -12, // The specified file does not exist
UFILE_PARAERROR = -11, // parameter wrong
UFILE_SUCCESS = 0 //File operation succeeded
Supplementar
y explanation
4.2.2 File open / create(UFile_OpenCreate)
Function intUFile_OpenCreate(cchar*FileName,intiFileLocation,intFlag,
prototype FILE_HANDLE *fh, int RecSize);
Function File open / create
function
36 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In parameter FileName:open file name, end with NULL, maximum 16
description bytes in length
iFileLocation: storage place, see enum FILELOCATION
Flag:Open file mode, the value refer to FileFlags define
RecSize:File record size
RecSize = 0,Create Open Stream File, Text File
RecSize = 1,Create open non-fixed length record (TLV)
file
8<=RecSize<=4090 Create open fixed length record file
Out parameter Fh:File handle
Return value UFILE_NO_EXIST = -12, //The specified file does not exist
UFILE_PARAERROR = -11, //Parameter error
UFILE_OPEN_FAIL = -2, //Open error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation succeeded
Supplementar RecSize only works for the newly created file
y explanation
For opening a created file, the RecSize parameter should be ignored.
4.2.3 File read(UFile_Read)
37 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int UFile_Read(FILE_HANDLE handle, char *buffer, int size);
prototype
Function File reading
function
Parameter In parameter handle:Read file handle
description
size:Read data size
Out buffer:read data
parameter
Return value The file was read successfully: the return value is equal to the
number of bytes actually read.
UFILE_PARAERROR = -11, // paramter error
UFILE_READ_FAIL = -5, //reading error
UFILE_FAIL = -1, //file operation failed
Supplementar
y explanation
4.2.4 Write file (UFile_Write)
Function int UFile_Write(FILE_HANDLE handle, char *buffer, int size);
prototype
38 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function File writing
function
Parameter In parameter handle:Read file handle
description
size:The size of the data to be written
buffer:Data to be written
Out None
parameter
Return value File write succeeded: the return value is equal to the number of
bytes actually written
UFILE_PARAERROR = -11, // parameter erro
UFILE_WRITE_FAIL = -4, //write error
UFILE_FAIL = -1, //file operation failed
Supplementar
y explanation
4.2.5 Positioning file pointer(UFile_Lseek)
Function long UFile_Lseek(FILE_HANDLE handle, long offset, int origin);
prototype
Function Positioning file pointer
function
39 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In parameter Handle: file handle, offset: offset, origin:
description starting position, see FileSeekFlags type
Out None
parameter
Return value UFILE_PARAERROR = -11, //parameter error
UFILE_SEEK_FAIL = -6, //Positioning file pointer error
UFILE_SUCCESS =0
Supplementar
y explanation
4.2.6 Delete file record (UFile_Delete)
Function int UFile_Delete(FILE_HANDLE handle, uint size);
prototype
Function delete file record
function
Parameter In parameter handle:file handle
description
size:Number of deleted files
Out None
parameter
40 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value UFILE_PARAERROR = -11, //parameter error
UFILE_DELETE_FAIL = -7, //Delete file record error
UFILE_SUCCESS = 0
Supplementar The specific location of the deletion is determined by the
y explanation File_Lseek() function.
4.2.7 Close file (UFile_Close)
Function int UFile_Close(FILE_HANDLE handle);
prototype
Function Close file
function
Parameter In parameter handle:file handle
description
Out None
parameter
Return value UFILE_PARAERROR = -11, // parameter error
UFILE_CLOSE_FAIL = -8, //Close file error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation
succeeded
Supplementary
explanation
41 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
4.2.8 Delete file (UFile_Remove)
Function int UFile_Remove(cchar *filename, int iFileLocation);
prototype
Function Delete file
function
Parameter In paramater fileName:File name, ending with NULL, up to 16
description bytes
iFileLocation: storage location, see enum
FILELOCATION
Out None
parameter
Return value UFILE_NO_EXIST = -12, //The specified file does not exist
UFILE_PARAERROR = -11, //parameter error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation succeed
Supplementar
y explanation
4.2.9 Rename file (UFile_Rename)
42 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int UFile_Rename(cchar *oldname, int iFileLocation, cchar
prototype *newname);
Function Rename file
function
Parameter In parameter oldname : old file name iFileLocation: storage
description location, see enum FILELOCATION newname:new
file name
Out parameter None
Return value UFILE_NO_EXIST = -12, //The specified file does not exist
UFILE_PARAERRO = -11, //parameter error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation succeed
Supplementar
y explanation
4.2.10 Empty file(UFile_Clear)
Function int UFile_Clear(cchar *FileName, int iFileLocation);
prototype
Function Empty file content
function
43 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In parameter FileName:File name, ending with NULL, up to 16
description bytes
iFileLocation: storage location, see enum
FILELOCATION
Out None
parameter
Return value UFILE_NO_EXIST = -12, //The specified file does not exist
UFILE_PARAERROR = -11, //parameter error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation succeed
Supplementar
y explanation
4.2.11 Get free space(UFile_GetFreeSpace)
Function long UFile_GetFreeSpace(cchar *drive);
prototype
Function Take the remaining space of the file system
function
44 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In parameter drive:driver name("I:"or"F:")
description
This parameter should be ignored if there is no
driver name
Out None
parameter
Return Success: return the remaining space unit K
value
Failure:UFILE_FAIL = -1, //File operation failed
Supplementar Get the size of the remaining space of the drive, regardless of the
y explanation manufacturer of the drive, no need to deal with the drive, just
return the total remaining space of the file system
4.2.12 Get the number of file records
(UFile_GetNumberOfRecords)
Function int UFile_GetNumberOfRecords(cchar *FileName, int iFileLocation,
prototype int Record_Len);
Function Get the number of file records
function
Parameter In FileName : file name iFileLocation: storage
description parameter
location,see enum FILELOCATION
Record_Len:Single record length
45 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out None
parameter
Return Success: Returns the number of records
value
failure:UFILE_PARAERROR = -11, //parameter error
UFILE_FAIL = -1, //file operation failed
Supplementar
y explanation
4.2.13 Append file record(UFile_AppendRecord)
Function int UFile_AppendRecord(cchar *FileName, int iFileLocation, char
prototype *Record, int Record_Len);
Function At the end of the file, add a fixed length record file. When the file does not
function exist, automatically create the file;
Parameter In parameter FileName:File name, ending with NULL, up to 16 bytes
description
iFileLocation: storage location,see enum FILELOCATION
Record:record data
Record_Len:record the length of data
Out parameter None
Return value UFILE_PARAERROR = -11, // parameter error
UFILE_FAIL = -1, // file operation failed
46 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
UFILE_SUCCESS =0 //file operation succeed
Supplementary Power failure protection
explanation
4.2.14 Query records based on index
number(UFile_GetRecordByIndex)
Function int UFile_GetRecordByIndex(cchar *FileName, int iFileLocation,
prototype void *Record, int Record_Len, uint Record_Index);
Function Find any record by record index
function
Parameter In FileName : file name iFileLocation: storage
description parameter
location,see enum FILELOCATION
Record_Len:record length
Record_Index :Record index (starting at 0)
Out Record:record data
parameter
47 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value UFILE_NO_EXIST = -12, //The specified file does not exist
UFILE_PARAERROR = -11, //parameter error
UFILE_NO_RECORD = -10, //record not found
UFILE_READ_FAIL = -5, //reading error
UFILE_OPEN_FAIL = -2, //opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Supplementar
y explanation
4.2.15 Check record(UFile_GetRecord)
Function int UFile_GetRecord(cchar *FileName, int iFileLocation, void
prototype *Record, int Record_Len, DBSEARCOND *Condtion);
Function Find any record by condition
function
Parameter In parameter FileName:file name iFileLocation: storage location,see
description
enum FILELOCATION
Record_Len:record length
Condtion:query condition, see DBSearCond structure
48 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out Record:record data
parameter
Return UFILE_NO_EXIST = -12, //The specified file does not exist
value
UFILE_PARAERROR = -11, //parameter error
UFILE_NO_RECORD = -10, //record not found
UFILE_READ_FAIL = -5, //reading error
UFILE_OPEN_FAIL = -2, //opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Supplementar
y explanation
4.2.16 Update record(UFile_UpdateRecord)
Function int UFile_UpdateRecord(cchar *FileName, int iFileLocation, void
prototype *Record, int Record_Len, DBSEARCOND *Condtion);
Function Update any record by condition
function
Parameter In FileName:file name
description parameter
49 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
iFileLocation: storage location, see enum
FILELOCATION
Record:record data
Record_Len:record length
Condtion:query condition, see DBSearCond structure
Out parameter Record
Return UFILE_NO_EXIST = -12, //The specified file does not exist
value
UFILE_PARAERROR = -11, //parameter error
UFILE_NO_RECORD = -10, //record not founded UFILE_READ_FAIL
= -5, // read error
UFILE_WRITE_FAIL = -4, //write error
UFILE_OPEN_FAIL = -2, // opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation succeed
Supplementar Power failure protection
y explanation
Record is both in parameter and out parameter
In the case of a successful search, the Record is populated by the search
results.
50 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
4.2.17 Update records based on index
number(UFile_UpdateRecordByIndex)
Function intUFile_UpdateRecordByIndex(cchar*FileName,intiFileLocation, void
prototype *Record, int Record_Len, uint Index);
Function Update any record by index number
function
Parameter In parameter FileName:file name iFileLocation: storage location,see
description
enum FILELOCATION
Record:record data
Record_Len:record length
Index: Record index number
Out parameter Record
Return value UFILE_NO_EXIST = -12, //The specified file does not exist
UFILE_PARAERROR = -11, //parameter error
UFILE_NO_RECORD = -10, //record not founded UFILE_READ_FAIL
= -5, // reading error
UFILE_WRITE_FAIL = -4, // writing error
UFILE_OPEN_FAIL = -2, // opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS =0 //File operation succeed
51 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementar Power failure protection
y explanation
Record is both in parameter and out parameter
In the case of a successful search, the Record is populated by the search
results.
4.2.18 Delete record (UFile_DeleteRecord)
Function prototype int UFile_DeleteRecord(cchar *FileName, int iFileLocation, int
Record_Len, DBSEARCOND *Condtion);
Function function Delete any record by condition
Parameter In parameter FileName:file name iFileLocation: storage location, see
description
enum FILELOCATION
Record_Len:record length
Condtion:query condition,see DBSearCond structure
Out parameter
Return value UFILE_NO_EXI = -12, //The specified file does not
ST exist
UFILE_PARAE
OR = -11, //parameter error
RR
UFILE_NO_RE
RD = -10, //record not founded
CO
52 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
UFILE_DELET
FAIL = -7, //Delete file record error
E_
UFILE_OPEN_
I L = -2, //opening error
FA
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Supplementary Power failure
explanation protection
4.2.19 Delete records based on index
number(UFile_DeleteRecordByIndex)
Function intUFile_DeleteRecordByIndex(cchar*FileName,intiFileLocation,
prototype int Record_Len, uint Index);
Function function Delete any record by recording the index number
Parameter In parameter FileName:file name iFileLocation: storage location,see
description
enum FILELOCATION
Record_Len:record length
Index: record index number
Out parameter
53 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value UFILE_NO_EXIST = -12, //specified file not existed
UFILE_PARAERROR = -11, //parameter error
UFILE_NO_RECORD = -10, //record not founded
UFILE_DELETE_FAIL = -7, //Delete file record error
UFILE_OPEN_FAIL = -2, //opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Supplementar Power failure
y explanation protection
4.2.20 Read one line text(UFile_ReadLine)
Function int UFile_ReadLine(FILE_HANDLE pFile, char *pLineBuff,uint
prototype LineBuffSize);
Function Read a line of text, and support \r \n newline (data read out should not
function contain newline)
Parameter In parameter pFile:file handle
description
LineBuffSize:Buffer size
Out parameter pLineBuff :Read text data
54 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value Success: data length
UFILE_PARAERROR = -11, // parameter error
UFILE_READ_FAIL = -5, // reading error
UFILE_FAIL = -1, //file operation failed
Parameter For a text file, read a row of data from the current location and
description jump to the next row.
4.2.21 Read non-fixed length records
(UFile_ReadTLV)
Function int UFile_ReadTLV(char *FileName, int iFileLocation, uint FldID, char *Data,
prototype uint *DataLen);
Function function Read non-fixed length record TLV, consistent with IC card TVL format
Parameter In parameter FileName: file name iFileLocation: storage location, see
description enum FILELOCATION
FldID: tag (Tag)
Out parameter Data: data (Value)
DataLen: length (length)
Return value UFILE_NO_EXIST = -12, //The specified file does not
exist
UFILE_PARAERROR = -11, // parameter error
UFILE_NO_RECORD = -10, //record not founded
55 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
UFILE_READ_FAIL = -5, // reading error
UFILE_OPEN_FAIL = -2, //opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Parameter Read the record in TLV format
description
4.2.22 Write non-fixed data(UFile_WriteTLV)
Function int UFile_WriteTLV(char *FileName, int iFileLocation, uint FldID,
prototype char *Data, uint *DataLen);
Function function Write non-fixed length record TLV
Parameter In parameter FileName: file name iFileLocation: storage location,
description
see enum FILELOCATION
FldID:tag (Tag)
Data:data (Value)
DataLen:length (length)
Out none
parameter
Return value UFILE_NO_EXIST = -12, //specified file does not existed
UFILE_PARAERROR = -11, //parameter error
UFILE_WRITE_FAIL = -4, //writing error
56 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
UFILE_OPEN_FAIL = -2, //opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Supplementary
description
4.2.23 Delete non-fixed length record
(UFile_DeleteTLV)
Function int UFile_DeleteTLV(char *FileName, int iFileLocation, uint
prototype FldID);
Function Delete non-fixed length record TLV
function
Parameter In FileName :file name
description parameter
iFileLocation: storage location, see enum
FILELOCATION
FldID:tag(Tag)
Out None
parameter
57 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value UFILE_NO_EXIST = -12, //specified file does not exist
UFILE_PARAERROR = -11, //parameter error
UFILE_NO_RECORD = -10, //record not founded
UFILE_DELETE_FAIL = -7, //Delete file record error
UFILE_OPEN_FAIL = -2, //opening error
UFILE_FAIL = -1, //File operation failed
UFILE_SUCCESS = 0 //File operation succeed
Supplementary
description
5 IC card module (libapi_iccard)
5.1 interface list
function name function prototype Function function
Turn on IC card device Icc_Open Turn on IC card device
Turn off IC card device Icc_Close Turn off IC card device
Check the card Icc_GetCardStatus Contact card: Check if the card
is in the card slot
Contact card powering Icc_PowerUp Powering on contact IC card: setting IC
card type, card slot category
58 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Contact card power off Icc_PowerDown Contact card power off
Contact card Icc_ICComm Contact IC card communication
communication function
NFC card card search Icc_CTLSPowerUpAndSee NFC card reader search card
k
NFC card power off Icc_CTLSPowerDown NFC card power off
NFC card communication Icc_CTLSComm Use APDU to communicate with NFC
card
5.2 API interface
5.2.1 Turn on IC card device(Icc_Open)
Function int Icc_Open(int iSlotType);
prototype
Function Turn on IC card device
function
Parameter In iSlotType:card slot number ,see enum
description paramate SlotType
Out None
parameter
Return UICC_FAIL = -1,// operation failed
value
UICC_OK = 0// operation succeed
59 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplemen
tary
description
5.2.2 Turn off IC card device (Icc_Close)
Function prototype int Icc_Close(int iSlotType);
Function function Turn off IC card device
Parameter In iSlotType : card slot number , see enum
description parameter SlotType
Out None
parameter
Return value =
UICC_FAIL // operation failed
-1,
UICC_OK = 0 // operation succeed
Supplement
ary
description
5.2.3 Turn off IC card device (Icc_Close)
Function int Icc_CTLSComm(int iCardType,int iSlotType ,
ICCAPDU *Apdu);
prototype
60 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function Use APDU to communicate with NFC card
function
Parameter In iCardType:NFC card type, see enum IccType
description parameter
iSlotType:card slot, see enum SlotType
Apdu:refer to ICCAPDU Structure description
The various types of card operations are based on the
type of OperType operation in the ICCAPDU structure.
The data that needs to be passed in during various card
operations and the way it is stored in the Apdu structure
are discussed separately.
Out parameter Apdu:refer to ICCAPDU structure description
The returned data is based on the type of OperType
operation in the ICCAPDU structure, placed in R_Data
Return UICC_COMMAND_FAIL = -2,// Communication error with card
value
UICC_FAIL = -1, // operation failed
UICC_OK = 0 // operation succeed
Supplement
ary
description
61 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
5.2.4 Test card(Icc_GetCardStatus)
Function int Icc_GetCardStatus(int iSlotType);
prototype
Function Contact card:
Check if the card is in the card slot
function
Parameter In iSlotType:card slot number,refer to enum
description parameter SlotType
Out
parameter
Return UICC_EMPTY = -3,// no card in card slot
value
UICC_FAIL = -1,// operation failed
UICC_OK = 0// operation succeed
Supplemen Please call first to open the IC card device (Icc_Open)
tary
description
5.2.5 Contact card power on(Icc_PowerUp)
62 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int Icc_PowerUp(int iCardType, int iSlotType);
prototype
Function Powering on the contact IC card: Set the IC card type
and card slot category.
function
Parameter In iCardType:IC card type,see enum IccType
description parameter
iSlotType:card slot type,refer to enum
SlotType
Out None
parameter
Return UICC_EMPTY = -3,// no card in card slot
value
UICC_FAIL = -1,// operation failure
UICC_OK = 0// operation succeed
Supplemen Contains the card reset operation, and subsequently
tary obtains the card reset information through
description Icc_GetCardATR
5.2.6 Contact card power off (Icc_PowerDown)
Function int Icc_PowerDown(int iCardType , int iSlotType);
prototype
Function contact card power off
function
63 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In iCardType:IC card type,see enum IccType
description papameter
iSlotType : card slot type , see enum
SlotType
Out None
parameter
Return UICC_FAIL = -1,// operation failure
value
UICC_OK = 0// operation succeed
Supplemen Pay attention to call after power off. Close the IC card
tary device (Icc_Close)
description
5.2.7 Contact card communication
(Icc_ICComm)
Function int Icc_ICComm (int iCardType,int iSlotType, ICCAPDU
*Apdu);
prototype
Function Contact IC card communication function
function
64 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In iCardType:IC card type,see enum IccType
description parameter
iSlotType : card slot type , see enum
SlotType Apdu:refer to ICCAPDU structure
The various types of card operations are
based on the type of OperType operation in
the ICCAPDU structure.
The data that needs to be passed in during
various card operations and the way it is
stored in the Apdu structure are discussed
separately.
Out Apdu:refer to ICCAPDU structure
parameter
The returned data is based on the type of
OperType operation in the ICCAPDU
structure, placed in R_Data
Return UICC_COMMAND_FAIL= -2,// Communication error
value with card
UICC_FAIL = -1,// operation failure
UICC_OK = 0// operation succeed
Supplement None
ary
description
65 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
5.2.8 NFC card searching card
(Icc_CTLSPowerUpAndSeek)
Function int Icc_CTLSPowerUpAndSeek (int iCardType, int
iSlotType, char
prototype
*psUID);
Function NFC card reader searching card
function
Parameter In iCardType : NFC card type, see enum
description parameter IccType
iSlotType:card slot, see enum SlotType
Out psUID:Card serial number, the first byte is
parameter the serial number length
Return UICC_NORF = -4,// no NFC card
value
UICC_FAIL = -1,// operation failure
UICC_OK = 0// operation succeed
Supplemen Please call first to open the IC card device (Icc_Open)
tary
description
Contains card reset operation application layer loop call
Get card reset information via Icc_GetCardATR
66 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
5.2.9 NFC card power off(Icc_CTLSPowerDown)
Function int Icc_CTLSPowerDown (int iSlotType);
prototype
Function NFC card power off
function
Parameter In iSlotType:card slot number ,see enum
description parameter SlotType
Out None
parameter
Return UICC_FAIL = -1,// operation failure
value
UICC_OK = 0// operation succeed
Supplemen Pay attention to call after power off. Close the IC card
tary device (Icc_Close)
description
5.2.10 Use APDU to communicate with NFC
card(Icc_CTLSComm)
Function int Icc_CTLSComm(int iCardType,int iSlotType ,
ICCAPDU *Apdu);
prototype
Function use APDU to communicate with NFC card
function
67 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In iCardType : NFC card type , see enum
description parameter IccType
iSlotType:card slot,see enum SlotType
Apdu : refer to ICCAPDU structure
description
The various types of card operations are
based on the type of OperType operation in
the ICCAPDU structure. The data that
needs to be passed in during various card
operations and the way it is stored in the
Apdu structure are discussed separately.
Out Apdu : refer to ICCAPDU structure
parameter description
The returned data is based on the type of
OperType operation in the ICCAPDU
structure, placed in R_Data
Return UICC_COMMAND_FAIL= -2,// communication error
value with card
UICC_FAIL = -1,// operation failure
UICC_OK = 0// operation succeed
Supplement
ary
description
68 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
6 communication( libapi_comm)
6.1 interface list
Function prototype Function function
comm_net_link Connect Network
comm_net_unlink Disconnect from the network
comm_sock_connect connect to the server
comm_sock_recv Receive data
comm_sock_send send data
comm_sock_close Disconnect the server
comm_ssl_init ssl initialization
comm_ssl_connect ssl connect to the server
comm_ssl_send ssl send data
comm_ssl_recv ssl Receive data
comm_ssl_close ssl Disconnect
6.2 API interface
6.2.1 comm_net_link
Function int comm_net_link(char * title, char * apn , int timeover);
prototype
Function Connect Network
function
Parameter In title:Tips for connecting to the network
description parameter apn:gprs apn
timeover : Connection timeout
69 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.2 comm_net_unlink
Function int comm_net_unlink();
prototype
Function Disconnect from the network
function
Parameter In
description parameter
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
70 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
6.2.3 comm_sock_connect
Function int comm_sock_connect(int index, char * ip, int
prototype port);
Function Connect to the server
function
Parameter In index sock index
description parameter ip server ip
port server port
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.4 comm_sock_recv
Function int comm_sock_recv(int index, unsigned char * buff,
prototype int len, unsigned int timeover);
Function Receive data
function
Parameter In index sock index
description parameter buff Receive buffer
71 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
len Receiving length
timeover overtime time
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.5 comm_sock_send
Function int comm_sock_send(int index, unsigned char *
prototype buff , int size);
Function send data
function
Parameter In index sock index
description parameter buff Send buffer
len Send length
Out
parameter
Return value 0, success
Other, failure
72 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
6.2.6 comm_sock_close
Function int comm_sock_close(int index);
prototype
Function Disconnect the server
function
Parameter In index sock index
description parameter
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.7 comm_ssl_init
Function int comm_ssl_init(int index, char * cacert, char *
prototype clientcert, char * clientkey,int level);
Function ssl initialization
function
73 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In index sock index
description parameter cacert Server certificate
clientcert Client certificate
clientkey Client key
level Verification level 0=Not
verified 1=Verify server certificate
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.8 comm_ssl_connect
Function int comm_ssl_connect(int index , char * ip , int
prototype port);
Function ssl connect to the server
function
Parameter In index sock index
description parameter ip server ip
port server port
Out
parameter
74 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value 0, success
Other, failure
Supplementary
description
6.2.9 comm_ssl_send
Function int comm_ssl_send(int index, char * pdata, int
prototype size);
Function ssl send data
function
Parameter In index sock index
description parameter data ssl data
size Data size
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.10 comm_ssl_recv
75 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int comm_ssl_recv(int index, char * pdata, int size);
prototype
Function ssl Receive data
function
Parameter In index sock index
description parameter data ssl data
size Data size
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.11 comm_ssl_close
Function int comm_ssl_close(int index);
prototype
Function ssl Disconnect
function
Parameter In index sock index
description parameter
Out
parameter
76 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value 0, success
Other, failure
Supplementary
description
6.2.12 comm_wifi_list_ap
Function int comm_wifi_list_ap(st_wifi_ap_list * ap_list);
prototype
Function Get the router list
function
Parameter In
description parameter
Out ap_list Router list data, The ap_list
parameter space is allocated by the caller with an
array size of 10
Return value Number of routers
Supplementary
description
77 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
6.2.13 comm_wifi_link_ap
Function int comm_wifi_link_ap(st_wifi_ap_list * ap_list ,
prototype char * pwd);
Function Connecting router
function
Parameter In ap_list: Router data
description parameter pwd: password
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
6.2.14 comm_wifi_unlink_ap
Function int comm_wifi_unlink_ap();
prototype
Function unlink router
function
Parameter In
description parameter
78 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out ap_list Router list data, The ap_list
parameter space is allocated by the caller with an
array size of 10
Return value 0, success
Other, failure
Supplementary
description
6.2.15 comm_wifi_get_link_state
Function int comm_wifi_get_link_state();
prototype
Function Get connection status
function
Parameter In
description parameter
Out
parameter
Return value 1, connection
0, disconnect
Supplementary
description
79 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
7 security( libapi_security)
7.1 interface list
Function prototype Function function
mksk_save_plaintext_key Save key plaintext
mksk_save_encrypted_key Save key ciphertext
mksk_3des_run Use key 3des operation
dukpt_get_ksn Get a set of dukpt keys
dukpt_3des_run Use the previously obtained key
3des operation
dukpt_init_key Initialize the dukpt key
sec_get_hw_ver get pci hardware version
sec_get_fw_ver get pci firmware version
7.2 API interface
7.2.1 mksk_save_plaintext_key
Function int mksk_save_plaintext_key(int type, int gid,
prototype unsigned char * key, unsigned char *kvc);
80 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function Save key plaintext
function
Parameter In type: Key type(0x00-0x04)
description parameter gid : Key grouping(0-9)
key : Key plaintext
Out kvc Key kvc(Key plaintext
parameter encryption 8 0x00)
Return value 0, success
Other, failure
Supplementary
description
7.2.2 mksk_save_encrypted_key
Function int mksk_save_encrypted_key(int type, int gid,
prototype unsigned char * key, unsigned char *kvc);
Function Save key ciphertext
function
Parameter In type: Key type(0x00-0x04)
description parameter gid : Key grouping(0-9)
key : Key plaintext
Out kvc Key kvc(Key plaintext
parameter encryption 8 0x00)
81 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value 0, success
Other, failure
Supplementary
description
7.2.3 mksk_3des_run
Function int mksk_3des_run(int type, int gid, int mode,
prototype unsigned char *ind, int size, unsigned char *outd);
Function Use key 3des operation
function
Parameter In type: Key type(0x00-0x04)
description parameter gid : Key grouping(0-9)
mode: Operation type
(encryption/decryption)
ind: Raw data
size: Data length (8-byte
multiple)
Out outd: Calculation results
parameter
Return value 0, success
Other, failure
Supplementary
description
82 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
7.2.4 dukpt_init_ipek
Function int dukpt_init_ipek(unsigned char gid, unsigned
prototype char* init_ksn, unsigned char* init_key);
Function Initialize the dukpt key use IPEK
function
Parameter In gid : Key grouping,0
description parameter
In init_ksn: Initial KSN
parameter
In init_key: IPEK
parameter
Return value 0, success
Other, failure
Supplementary
description
7.2.5 dukpt_init_ciphertext_ipek
Function int dukpt_init_ipek(unsigned char gid, unsigned
prototype char* init_ksn, unsigned char* init_key);
Function Initialize the dukpt key use IPEK
function
Parameter In gid : Key grouping,0
description parameter
83 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
In Key:IPEK Ciphertext
parameter
In Kvc: IPEK plaintext encryption 8 0x00
parameter
Return value 0, success
Other, failure
Supplementary This function first decrypts the IPEK with the
description transport key, and then calls dukpt_ init_Ipek
7.2.6 dukpt_init_bdk
Function int dukpt_init_ipek(unsigned char gid, unsigned
prototype char* init_ksn, unsigned char* init_key);
Function Initialize the dukpt key use IPEK
function
Parameter In gid : Key grouping,0
description parameter
In init_ksn: Initial KSN
parameter
In init_key: BDK
parameter
Return value 0, success
Other, failure
Supplementary This function will first convert BDK to IPEK, and then
description call calls dukpt_ init_Ipek
84 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
7.2.7 dukpt_prepare_key
Function int dukpt_prepare_key(unsigned char gid, unsigned
prototype char * ksn);
Function Get a set of dukpt keys
function
Parameter In gid : Key grouping,0
description parameter
Out ksn: Key corresponds to ksn
parameter
Return value 0, success
Other, failure
Supplementary Get a new PEK and the corresponding KSN, then use
description dukpt_ 3DES_run_ex to calculate
7.2.8 dukpt_3des_run_ex
Function int dukpt_3des_run_ex(int mode, char *ind, int
prototype size, char *outd, int des_mode, int key_tpye);
Function Use the previously obtained key 3des operation
function
Parameter In mode: Operation type
description parameter (encryption/decryption)
ind: Raw data
size: Data length (8-byte
multiple)
des_mode:ECB/CBC
key_type: DUKPT_DES_KEY_PIN/
DUKPT_DES_KEY_MAC1/
DUKPT_DES_KEY_DATA1
85 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out outd: Calculation results
parameter
Return value 0, success
Other, failure
Supplementary
description
7.2.9 sec_get_hw_ver
Function char * sec_get_hw_ver();
prototype
Function get pci hardware version
function
Parameter In
description parameter
Out
parameter
Return value hardware version
Supplementary
description
7.2.10 sec_get_fw_ver
Function char * sec_get_fw_ver();
prototype
86 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function get pci firmware version
function
Parameter In
description parameter
Out
parameter
Return value firmware version
Supplementary
description
8 Gui (libapi_gui)
8.1 interface list
Function prototype Function function
gui_bar_rc Gui filled area
gui_set_bar_color Set the fill color
gui_get_bar_color Get the fill color
gui_set_font Set display font
gui_get_font Get display font
87 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
gui_set_text_color Set text color
gui_get_text_color Get text color
gui_set_text_bg_color Set the text background color
gui_get_text_bg_color Get the text background color
gui_clear_dc Clear screen display
gui_set_pixel Draw on the screen
gui_get_pixel The color of the point on the screen
gui_text_out Display text on the screen
gui_get_text_width Get the display width of the text
gui_get_text_height Get the display height of the text
gui_cline Draw line
gui_get_width Get screen width
gui_get_height Get screen height
gui_page_op_paint Display characters at the bottom left
and bottom of the screen
gui_ime_set_mode Set input method parameters
gui_ime_start_input Open the input method page
gui_main_menu_func_add Add menu handler
gui_main_menu_item_add Add menu item
gui_main_menu_show Add menu handler
gui_post_message Send a message
gui_get_message Recv a message
gui_proc_default_msg Let the system process the default
message
gui_messagebox_show Display dialog
gui_load_bmp Load bmp into memory
gui_out_bits display image
88 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
8.2 API interface
8.2.1 gui_bar_rc
Function void gui_bar_rc(int left, int top, int right, int
prototype bottom);
Function Gui filled area
function
Parameter In left Left border
description parameter top Upper boundary
right Right border
bottom Lower boundary
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
8.2.2 gui_set_bar_color
Function void gui_set_bar_color(int color);
prototype
Function Set the fill color
function
89 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In color Color format 0x00RRGGBB
description parameter
Out
parameter
Return value 0, success
Other, failure
Supplementary
description
8.2.3 gui_get_bar_color
Function int gui_get_bar_color();
prototype
Function Get the fill color
function
Parameter In
description parameter
Out
parameter
Return value Fill color
90 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
8.2.4 gui_set_font
Function Set display font
prototype
Function void gui_set_font(int font);
function
Parameter In font 0=12 lattice 1=16 lattice
description parameter
Out
parameter
Return value
Supplementary
description
8.2.5 gui_get_font
Function int gui_get_font(void);
prototype
Function Get display font
function
91 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In
description parameter
Out
parameter
Return value Font index
Supplementary
description
8.2.6 gui_set_text_color
Function void gui_set_text_color(int color);
prototype
Function Set text color
function
Parameter In color text color
description parameter
Out
parameter
Return value
92 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
8.2.7 gui_get_text_color
Function int gui_get_text_color(void);
prototype
Function Get text color
function
Parameter In
description parameter
Out
parameter
Return value Text color
Supplementary
description
8.2.8 gui_set_text_bg_color
Function void gui_set_text_bg_color(int color) ;
prototype
Function Set the text background color
function
93 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In cloro text color
description parameter
Out
parameter
Return value
Supplementary
description
8.2.9 gui_get_text_bg_color
Function int gui_get_text_bg_color(void);
prototype
Function Get the text background color
function
Parameter In
description parameter
Out
parameter
Return value Text background color
94 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
8.2.10 gui_clear_dc
Function void gui_clear_dc(void);
prototype
Function Clear screen display
function
Parameter In
description parameter
Out
parameter
Return value
Supplementary
description
8.2.11 gui_set_pixel
Function int gui_set_pixel(int x, int y, int color);
prototype
Function Draw on the screen
function
95 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In x x coordinate
description parameter y y coordinate
color Point color
Out
parameter
Return value 0 success
Supplementary
description
8.2.12 gui_get_pixel
Function int gui_get_pixel(int x, int y);
prototype
Function The color of the point on the screen
function
Parameter In x x coordinate
description parameter y y coordinate
Out
parameter
Return value Point color
96 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
8.2.13 gui_text_out
Function int gui_text_out(int x, int y, char * text);
prototype
Function Display text on the screen
function
Parameter In x x coordinate
description parameter y y coordinate
text Text content
Out
parameter
Return value 0 success
Supplementary
description
8.2.14 gui_get_text_width
Function int gui_get_text_width(char *text);
prototype
97 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function Get the display width of the text
function
Parameter In text Text content
description parameter
Out
parameter
Return value
Supplementary
description
8.2.15 gui_get_text_height
Function int gui_get_text_height(char *text);
prototype
Function Get the display height of the text
function
Parameter In text Text content
description parameter
Out
parameter
98 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value Text height
Supplementary
description
8.2.16 gui_cline
Function void gui_cline(int x1, int y1, int x2, int y2, int color);
prototype
Function Draw line
function
Parameter In x1 Point 1 X coordinate
description parameter x2 Point 2 X coordinate
y1 Point 1 Y coordinate
y2 Point 2 Y coordinate
color Line color
Out
parameter
Return value
Supplementary
description
99 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
8.2.17 gui_get_width
Function int gui_get_width(void);
prototype
Function Get screen width
function
Parameter In
description parameter
Out
parameter
Return value Screen width
Supplementary
description
8.2.18 gui_get_height
Function xxx
prototype
Function int gui_get_height(void);
function
Parameter In
description parameter
100 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out
parameter
Return value Screen height
Supplementary
description
8.2.19 gui_page_op_paint
Function void gui_page_op_paint(char * left_str, char *
prototype right_str);
Function Display characters at the bottom left and bottom of
function the screen
Parameter In left_str The character displayed
description parameter in the lower left corner
right_str The character displayed
in the lower right corner
Out
parameter
Return value
Supplementary
description
101 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
8.2.20 gui_ime_set_mode
Function int gui_ime_set_mode(int def_mode, int
prototype allow_mode, int password);
Function Set input method parameters
function
Parameter In def_mode Default input method
description parameter allow_mode Support input method
password enter password
Out
parameter
Return value
Supplementary
description
8.2.21 gui_ime_start_input
Function int gui_ime_start_input(char * buffer, int max, int *
prototype position, char * help);
Function Open the input method page
function
Parameter In buffer Input buffer
description parameter max Maximum input
102 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
character
position Cursor position
help Enter page title
Out
parameter
Return value Input length
Supplementary
description
8.2.22 gui_main_menu_func_add
Function int gui_main_menu_func_add(void * pfunc);
prototype
Function Add menu handler
function
Parameter In pfunc Menu handler
description parameter
Out
parameter
Return value 0 success
103 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
8.2.23 gui_main_menu_item_add
Function int
prototype gui_main_menu_item_add(st_gui_menu_item_def
* menu_item);
Function Add menu item
function
Parameter In menu_item Menu data
description parameter
Out
parameter
Return value 0 success
Supplementary
description
8.2.24 gui_main_menu_show
Function void gui_main_menu_show(char *id , int timeover);
prototype
104 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function Display menu
function
Parameter In id menu id
description parameter timeover overtime time
Out
parameter
Return value
Supplementary
description
8.2.25 gui_post_message
Function unsigned int gui_post_message(unsigned int
prototype msg_id, unsigned int wparam, unsigned int lparam);
Function Send a message
function
Parameter In msg_id Message id
description parameter wparam parameter 1
lparam parameter 2
Out
parameter
105 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value 0 success
Supplementary
description
8.2.26 gui_proc_default_msg
Function int gui_proc_default_msg( st_gui_message *
prototype pmsg );
Function Let the system process the default message
function
Parameter In pmsg Message structure
description parameter
Out
parameter
Return value 0 success
Supplementary
description
8.2.27 gui_messagebox_show
106 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int gui_messagebox_show(char *title, char *msg ,
prototype char* pszLeftOp, char* pszRightOp , int timeover);
Function Display dialog
function
Parameter In title Message title
description parameter msg Message content
pszLeftOp Bottom left corner
pszRightOp Tip in the lower right
corner
timeover overtime time
Out
parameter
Return value 1 Confirm return
2 Cancel back
3 Timeout
Supplementary
description
8.2.28 gui_load_bmp
Function char * gui_load_bmp(char * filename , int *width ,
prototype int *height);
Function Load bmp into memory
function
Parameter In filename Image name
description parameter
107 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out width Image width
parameter height Picture height
Return value Image content array, which needs to be released
after use
Supplementary
description
8.2.29 gui_out_bits
Function void gui_out_bits(int x, int y, unsigned char *pbits,
prototype int width , int height, int mode);
Function display image
function
Parameter In x X coordinate
description parameter y Y coordinate
pbits Image data
width Image width
height Picture height
Out
parameter
Return value
Supplementary
Show attention to release pbits
description
108 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
9 EMV(libapi_emv)
9.1 interface list
Function prototype Function function
emv_read_card EMV card trans.
EMV_TermConfigInit Init terminal configure
EMV_GetKernelVersion EMV kernel version
EMV_GetKernelData TLV from EMV buffer.
EMV_PrmSetAIDPrm Save AID buffer.
EMV_PrmGetAIDPrm Get AID.
EMV_PrmDelAIDPrm Delete specific AID
EMV_PrmClearAIDPrmFile Clear all AID.
EMV_PrmSetCAPK Save CAPK.
EMV_PrmGetCAPK Get specific CAPK.
EMV_PrmDelCAPK Delete specific CAPL.
EMV_PrmClearCAPKFile Clear all CAPK.
9.2 API interface
9.2.1 emv_read_card
Function int emv_read_card(st_read_card_in *card_in,
prototype st_read_card_out *card_out);
Function Process of emv card trans.
function
Parameter In The parameter of EMV trans.
description parameter
109 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out Out buffer of EMV trans.
parameter
Return value Result of emv trans.
Supplementary
description
9.2.2 EMV_TermConfigInit
Function int EMV_TermConfigInit(const TERMCONFIG
prototype *ptermconfig);
Function Init terminal configure of emv.
function
Parameter In Terminal configure of emv.
description parameter
Out Null
parameter
Return value Result of init terminal configure.
Supplementary
description
9.2.3 EMV_GetKernelVersion
Function void EMV_GetKernelVersion(char *KernelVersion,
prototype int size);
110 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function Get emv kernel version
function
Parameter In Length of version buffer.
description parameter
Out Kernel Version
parameter
Return value Null
Supplementary
description
9.2.4 EMV_GetKernelData
Function int EMV_GetKernelData (char *Tag, int *Len, byte
prototype *Value);
Function Get TLV from EMV buffer.
function
Parameter In Tag
description parameter
Out Length Value
parameter
Return value Result of get TLV data.
Supplementary
description
111 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
9.2.5 EMV_PrmSetAIDPrm
Function int EMV_PrmSetAIDPrm(TERMINALAPPLIST
prototype *pTerminalApps);
Function Set AID buffer into device.
function
Parameter In Aid buffer.
description parameter
Out Null
parameter
Return value Result of set aid.
Supplementary
description
9.2.6 EMV_PrmGetAIDPrm
Function int EMV_PrmGetAIDPrm(TERMINALAPPLIST
prototype *pTerminalApps);
Function Get all aid into memory.
function
Parameter In Null
description parameter
Out The AID buffer
parameter
112 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Return value Result of get aid buffer.
Supplementary
description
9.2.7 EMV_PrmDelAIDPrm
Function int EMV_PrmDelAIDPrm(byte *AID, byte AID_Len);
prototype
Function Delete the specific AID.
function
Parameter In AID Length of AID
description parameter
Out Null
parameter
Return value Result of Delete.
Supplementary
description
9.2.8 EMV_PrmClearAIDPrmFile
Function int EMV_PrmClearAIDPrmFile(void);
prototype
Function Clear all AID from device.
function
113 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Parameter In Null
description parameter
Out Null
parameter
Return value Result of clear AID.
Supplementary
description
9.2.9 EMV_PrmSetCAPK
Function int EMV_PrmSetCAPK(CAPUBLICKEY *ppkKey);
prototype
Function Save CAPK into device.
function
Parameter In CPAK
description parameter
Out Null
parameter
Return value Result of save CAPK.
Supplementary
description
9.2.10 EMV_PrmGetCAPK
114 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Function int EMV_PrmGetCAPK(CAPUBLICKEY *ppkKey, byte
prototype *RID, byte PKIndex);
Function Get the specific index of CAPK.
function
Parameter In RID of CAPK Index of CAPK
description parameter
Out CAPK
parameter
Return value Result of get CAPK.
Supplementary
description
9.2.11 EMV_PrmDelCAPK
Function int EMV_PrmDelCAPK(byte *RID, byte PKIndex);
prototype
Function Delete the specific index of CAPK.
function
Parameter In RID of CAPK Index of CAPK
description parameter
Out Null
parameter
Return value Result of delete.
115 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
9.2.12 EMV_PrmClearCAPKFile
Function int EMV_PrmClearCAPKFile(void);
prototype
Function Clear all CAPK from device.
function
Parameter In Null
description parameter
Out Null
parameter
Return value Result of clear.
Supplementary
description
10 Print (libapi_print)
10.1 interface list
Function prototype Function function
UPrint_GetModuleVer Get version number of print class
module
UPrint_Init Initialize, check the printer status (if
it is out of paper), set the print font,
use before printing
116 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
UPrint_Str String printing with automatic line
break function, support \r, \n
newline
UPrint_BitMap Picture printing
UPrint_Start Start printing
UPrint_StrBold String printing (UPrint_StrBold)
with automatic line feed function,
support \r, \n newline
UPrint_Feed Printer paper feeding
UPrint_MatrixCode Print QR code
10.2 API interface
10.2.1 UPrint_GetModuleVer
Function int UPrint_GetModuleVer(char *pszVer);
prototype
Function Get version number of print class module
function
Parameter In Nothing
description parameter
Out pszVer Module version number
parameter
Return value > 0 Successfully returns module version number
length
USYS_FAIL = -1
Supplementary
description
117 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
10.2.2 UPrint_Init
Function int UPrint_Init(void);
prototype
Function Initialize, check the printer status (if it is out of
function paper), set the print font, use before printing.
Parameter In Nothing
description parameter
Out Nothing
parameter
Return value UPRN_FILE_FAIL Fail to open the file
UPRN_OUTOF_PAPER The printer is out of paper
UPRN_DEV_FAIL Printer device failure
UPRN_FAIL Printer unknown fault
UPRN_SUCCESS Success
Supplementary
description
10.2.3 UPrint_Str
Function int UPrint_Str(char *str, byte attrib, int linegap);
prototype
Function String printing with automatic line break function,
function support \r, \n newline
Parameter In str: Need to print string information
description parameter attrib: Font size: 0 small, 1 medium,
2 large
linegap: Line spacing: unit pixels, 0 is
the default value (for Pin printing use)
118 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Out Nothing
parameter
Return value UPRN_CACHE_ERR Save cache failed
UPRN_SUCCESS Success
Supplementary
description
10.2.4 UPrint_BitMap
Function int UPrint_BitMap(char *BmpFile,byte pattern);
prototype
Function Picture printing
function
Parameter In BmpFile: Image file name(XXX.bmp)
description parameter pattern: Alignment: 0 left alignment,
1 center alignment, 2 right alignment
Out Nothing
parameter
Return value UPRN_CACHE_ERR Save cache failed
UPRN_SUCCESS Success
Supplementary
description
119 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
10.2.5 UPrint_Start
Function int UPrint_Start(void);
prototype
Function Start printing
function
Parameter In Nothing
description parameter
Out Nothing
parameter
Return value UPRN_HANDLE_BACK Split machine handle is not
put back
UPRN_FILE_FAIL Fail to open the file
UPRN_LOSE_COMMAND Print handle not obtained
UPRN_OUTOF_PAPER The printer is out of paper
UPRN_DEV_FAIL Printer device failure
UPRN_FAIL Printer unknown fault
UPRN_SUCCESS Success
Supplementary
description
10.2.6 UPrint_StrBold
Function int UPrint_StrBold(char *pszStr, byte cAttrib, byte
prototype cPattern,int nLinegap);
Function String printing with automatic line feed function,
function support \r, \n newline
Parameter In pszStr: Need to print string information
description parameter cAttrib: Font size: 0 small, 1 medium, 2
large
120 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
cPattern: Print position: 0 left, 1 center,
2 right
nlinegap: Line spacing, unit pixels, 0 is
the default value (for Pin printing use)
Out Nothing
parameter
Return value UPRN_CACHE_ERR Save cache failed
UPRN_SUCCESS Success
Supplementary
description
10.2.7 UPrint_Feed
Function int UPrint_Feed(int nFeedLines);
prototype
Function Printer paper feeding
function
Parameter In nFeedLines Paper length (pixels)
description parameter
Out Nothing
parameter
Return value UPRN_CACHE_ERR Save cache failed
UPRN_SUCCESS Success
121 / 122
Fujian MoreFun Electronic Technology Co.,Ltd.
Supplementary
description
10.2.8 UPrint_MatrixCode
Function int UPrint_MatrixCode(const char *psMatrixCode,
prototype int nLen,byte cSize,byte cPattern);
Function Print QR code ( UPrint_MatrixCode ) ,Convert
function incoming data to QR code and print
Parameter In psMatrixCode: QR code data
description parameter nLen: QR code data length
cSize: QR code size, 0-small,
1-medium, 2-large
cPattern: Alignment, 0 left
alignment, 1 center alignment, 2 right
alignment
Out Nothing
parameter
Return value UPRN_CACHE_ERR Save cache failed
UPRN_SUCCESS Success
Supplementary
description
122 / 122