Prolin API Programming Guide: PAX Computer Technology (Shenzhen) Co.,Ltd
Prolin API Programming Guide: PAX Computer Technology (Shenzhen) Co.,Ltd
Guide
V 2.1.1
I
Revision History
Date Version Note Author
Translated from Chinese standard version
Prolin
2012-08-29 V1.0.0 of ‗Prolin API Programming Guide
Team
v1.0.0‘.
Prolin
2012-11-19 V1.0.1 Modified the interfaces.
Team
1. Added the return code list in the
System function;
2. Added a new interface Prolin
2012-12-26 V1.0.2 OsVerifySignExternal(); Team
3. Added the WIFI module;
4. Added the Register table in Appendix
Prolin
2013-02-20 V1.0.3 1. Added descriptions in OsOpenFont ().
Team
1. Modified the description of
OsModemOpen();
2. Added two return values -3219 and
-3220 in Modem;
3. Added the instruction of
DetectDailTone; Prolin
2013-03-06 V1.0.4
4. Added a new function Team
OsModemSwitchPower();
5. Modified the parameter description of
OsPrnOpen(), it does not support the
png format;
6. Modified the sci_get_fd ().
1. Modified the 14.4.1 open() node;
2. Updated the time setting code, Modify
the ―pow-hwclock -w‖ to
―pow-hwclock -w -u‖;
3. Updated the fifth term of OsWlInit() Prolin
2013-04-17 V1.0.5 instruction; when the return value is Team
ERR_WL_NOSIM (without SIM
card), application can use some
functions without SIM card.
4. Updated the instruction of the
OsCheckBattery ().
1. Modified the description of ‗Timer‘.
2. Added description of ‗Delay‘. Prolin
2013-05-17 V1.0.6 3. Added description for registry table. Team
4. Modified the parameter description of
Value inOsRegGetValue ().
II
5. Modified the parameter description of
ShaOut inOsSHA ().
6. Updated the description of GUI.
7. Added ‗1200, V22‘ and‗2400, FC‘ to
the parts of synchronous variable for
MODEM.
1. Modified the Registry table.
2. Modified the data structure of Font.
Prolin
2013-08-09 V1.0.7 3. Updated the OsCheckBattery()
Team
4. Updated the chapter 15 ICC Reader
and chapter 16 RF Reader.
1. Added 4.11 Save the crash report for
system function.
2. Modified the brightness level to
[0~10] in the chapter of LCD.In Prolin
2013-10-22 V1.0.8
particular , 0 indicates closing the Team
backlight
3. Updated the key value definitions in
the chapter of Keyboard.
1. Updated the chapter of System
function
2. Modified the OsCodeConvert() in the
character conversion.
Prolin
2013-10-31 V1.0.9 3. Added new interfaces OsPortReset()
Team
and OsPortCheckTx() in the
Communication chapter.
4. Updated the Audio chapter, add a new
interface OsPlayWave().
1. Added the KeyVarType parameter
associated with the description of
0x02
2. Modified the parameters value ranges
in several chapters associated with
PED.
3. Modified the description of parameter
ucATQ0 in OsPiccAntiSel ().
Prolin
2013-11-20 V2.0.0 4. Deleted OsPiccGetParam() and
Team
OsPiccSetParam().
5. Updated the instruction of
OsRegGetValue().
6. Added notes of OsPortOpen().
7. Updated instructions of OsSysSleep()
8. Updated the Return code list in
chapter Network Configuration.
9. Added instruction of OsNetDns().
III
2. Added a return value
forOsMsrOpen().
3. Added new interfaces
OsWlLoginEx(), OsMount(),
OsUmount().
4. Add chapter 26 Barcode.
5. Add AES functions.
6. Updated the Appendix 4.
7. Modified the parameter Name in the
OsInstallFile().
8. Added an error code
―ERR_APP_MODE‖ for
theOsInstallFile().
9. Added a new interface
OsCheckPowerSupply().
10. Since Prolin2.4 upgrade, deleted the
unsuccessful code in chapter 7 LCD.
1. Updated the OsSysSleep(). Prolin
2014-3-4 V2.0.2
2. Updated the WIFI module. Team
Prolin
2014-3-24 V2.0.3 1. Modified the WIFI module.
Team
1. Updated OsWifiConnect() and
OsWifiCheck().
2. Added a new interface
OsSysSleepEx(). Prolin
2014-4-16 V2.0.4
3. Added new interface OsReboot() and Team
OsPowerOff().
4. Removed the MS-MOVE in
parameter MountFlags.
1. Modified the instruction of
OsPrnSetIndent().
2. Modified the functionality description
of OsModemCheck().
3. Modified the description of the
parameter TimeoutMS in
OsPortRecv().
Prolin
2014-6-3 V2.0.5 4. Modified the value range of the
Team
parameter Volume in OsPlayWave().
5. Modified the OsMifareOperate().
6. Listed the corresponding relation
between device node and serial port.
7. Updated the instructions of
OsWlSwitchSleep() and
OsWifiSwitchPower().
1. Updated the instructions of OsLog().
2014-07-10 V2.0.6 2. Updated the return value of Prolin
OsPedSetInterval(). Team
3. Added a new interface
IV
OsPedCancelPinEntry().
4. Added return values for
OsVerifySign() and
OsVerifySignExternal().
5. Updated the instruction of
OsCheckBattery().
6. Updated the Appendix 3 and
Appendix 4.
1. Updated the return value of
OsWlLogin() and add the
corresponding new instruction.
Prolin
2014-10-09 V2.0.7 2. Modified int OsWifiClose(void) to
Team
void OsWifiClose(void);
3. Modified the nodes of LCD,
keypad, touch screen devices.
1. Modified the instrunction of the
OsRunApp().
2. Added the U disk file format
limitation in OsMount().
3. Added the specification about
S920 in parameter ‗Channel‘ in
OsPortOpen().
4. Added the instruction of
OsNetPing().
5. Modified the instruction of
OsNetDns().
6. Modified the instruction of
OsNetSetConfig().
7. Added the instruction of
OsNetStartDhcp().
8. Modified the function and added a Prolin
2014-11-26 V2.0.8
new return value for Team
OsNetSetRoute().
9. Modified the function, return
values and instruction of
OsNetGetRoute().
10. Modified the instruction of
OsPppoeLogin().
11. Modified the instruction of
OsWILogin().
12. Modified the instruction of
OsWILoginEx().
13. Added WAVE file sampling
frequency limitation in
OsPlayWave().
14. Added new instructions for S920
models in appendix 4.
V
2. Added some return code in 2.2 general Team
return code.
3. Added a return value and instruction in
OsPrnOpen().
4. Added some return values and
instruction in OsWlLock().
5. Added a new return value and
instruction in OsWlLogout().
6. Modified the description of the return
value in OsCheckBattery().
7. Added a new instruction in
OsNetSetRoute().
8. Added a new system upgrade block
with two functions
OsFirmwareGetVersion() and
OsFirmwareUpgrade() in the chapter of
System Function.
VI
1. Added the instruction of LCD size
and rotation method of different POS
models in Appendix 4.
2015-04-13 V2.1.1 2. Added a new return value
ERR_BATTERY_ABSENT in
function OsWifiOpen() and its
corresponding instruction.
VII
Prolin API Programming Guide
Contents
1 Introduction ....................................................................................................................... 14
1.1 Purpose ................................................................................................................... 14
1.2 Readers ................................................................................................................... 14
1.3 Prerequisite ............................................................................................................ 15
1.4 Related Documents ................................................................................................ 15
1.5 Abbreviation .......................................................................................................... 15
1.6 Document Conventions .......................................................................................... 16
2 Return Code and Parameter ............................................................................................... 19
2.1 Return code classification ...................................................................................... 19
2.2 General return code ................................................................................................ 20
2.3 Parameter Specification ......................................................................................... 21
3 Thread ................................................................................................................................ 23
4 System Function ................................................................................................................ 25
4.1 Return code list ...................................................................................................... 25
4.2 Data Definition....................................................................................................... 26
4.3 Timeset ................................................................................................................... 27
4.3.1 OsSetTime ...................................................................................................... 27
4.3.2 OsGetTime...................................................................................................... 27
4.4 Timer ...................................................................................................................... 28
4.4.1 OsTimerSet ..................................................................................................... 28
4.4.2 OsTimerCheck ................................................................................................ 28
4.5 Delay ...................................................................................................................... 28
4.5.1 OsSleep ........................................................................................................... 28
4.6 Thread .................................................................................................................... 28
4.7 Log ......................................................................................................................... 29
4.7.1 OsLogSetTag .................................................................................................. 29
4.7.2 OsLog ............................................................................................................. 29
4.8 Get the count value ................................................................................................ 30
4.8.1 OsGetTickCount ............................................................................................. 30
PAX Computer Technology (Shenzhen) Co., Ltd. 1
Prolin API Programming Guide
Table List
Table 1 Abbreviation ........................................................................................................ 15
Table 2 Return code classification List ............................................................................ 19
Table 3 General return code list ....................................................................................... 20
Table 4 System function return code list .......................................................................... 25
Table 5 Macro definitions of file types ............................................................................ 25
Table 6 Encryption and decryption return code list ......................................................... 41
Table 7 PED Return code list ........................................................................................... 47
Table 8 Key Types ........................................................................................................... 49
Table 9 Layout attributes of asterisk ................................................................................ 49
Table 10 The color values of asterisk............................................................................... 49
Table 11 Printer return code list ....................................................................................... 89
Table 12 MSR return code list ....................................................................................... 109
Table 13 ICC reader return code list .............................................................................. 114
Table 14 Return Code List ............................................................................................. 129
Table 15 Macro definition list of communication ports ................................................. 143
Table 16 Return code list of USB port functions ........................................................... 143
Table 17 Modem return code list ................................................................................... 153
Table 18 Variable definition of ST_MODEM_SETUP ................................................. 162
Table 19 Network Configuration return code list .......................................................... 181
Table 20 Physical Channel List ...................................................................................... 182
Table 21 GPRS/CDMA return code list ......................................................................... 193
Table 22 Return Code List ............................................................................................. 204
Table 23 Encryption type List ........................................................................................ 205
1 Introduction
1.1 Purpose
1.2 Readers
This document is primarily targeted for Prolin OS developers, who are expected to create
Prolin applications. The purpose is to introduce the framework of Prolin application program;
demonstrate some of the key customization points in GUI and other significant frameworks;
and provide programming aid to the API interfaces, which support driver control to the Prolin
OS hardware platform. It will also provide guidance to design.
The interface provided by Prolin is based on Linux system calls or POSIX interface.
Considering the compatibility requirements of the PaxME OS and applications, it will
encapsulate a set of OSAL interface which begins with the prefix ―Os‖. The access of other
devices and system functions will provide the demo code to guide developers how to use the
POSIX or system library to program.
For details, refer to the following document.
In this document, the interface that begins with the prefix ―Os‖ has been defined in osal.h of
SDK, unless otherwise specified.
1.3 Prerequisite
1.5 Abbreviation
Table 1 Abbreviation
Abbreviation Description
API Application Programming Interface
CDPD Cellular Digital Packet Data
CHAP Challenge Handshake Authentication Protocol
DHCP Dynamic Host Configuration Protocol
DUKPT Derived unique key per transaction
EMV Europay, MasterCard, Visa
EMV is a global standard for credit and debit
payment cards based on chip card technology
【Used for reminding the audience some place may have to pay
attention to, which may lead to exceptions or errors.】
List the types and values of the return code which appeared in this document.
Table 2 Return code classification List
API parameters are divided into input parameters and output parameters. The type of the
parameters has been labeled in the detailed API specification.
All string input and output parameters end with "\x00", and String parameters must indicate
the length limit.
3 Thread
Prolin supports multithread development. The platform provides standard POSIX thread
library (pthread) for developers to use.
The pthread header file is located in the installation directory of Prolin SDK:
tool chains\arm-linux\arm-softfloat-linux-gnu\include\pthread.h
4 System Function
LOG_T:
typedef enum{
LOG_DEBUG, //Display debugging information
LOG_INFO, // Display prompt information
LOG_WARN, // Display warning information
LOG_ERROR, // Display error information
} LOG_T;
ST_TIME:
typedef struct{
int Year; //year 1970– 2037
int Month; //month 1 –12
int Day; //day 1 –31
int Hour; //hour 0 – 23
int Minute; //minute 0 –59
int Second; //second 0 –59
int DayOfWeek; //Monday–Sunday(Only effective for reading time)
} ST_TIME;
ST_TIMER:
typedef struct{
unsigned long Start;
unsigned long Stop;
unsigned long TimeLeft;
} ST_TIMER;
ST_APP_INFO:
typedef struct{
char Id[32];
char Name[64];
char Bin[64];
char Artwork[64];
char Desc[64];
char Vender[32];
char Version[32] ;
} ST_APP_INFO;
4.3 Timeset
4.3.1 OsSetTime
4.3.2 OsGetTime
4.4 Timer
4.4.1 OsTimerSet
4.4.2 OsTimerCheck
4.5 Delay
4.5.1 OsSleep
4.6 Thread
Example:
#include <pthread.h>
{
printf("This is child thread\n");
return ((void *)0);
}
int main()
{
printf("This is main thread\n");
sleep(5);
return 0;
}
4.7 Log
4.7.1 OsLogSetTag
4.7.2 OsLog
4.8.1 OsGetTickCount
4.9.1 OsGetAppInfo
4.10 Buzzer
4.10.1 OsBeep
Return None
4.11.1 OsRunApp
OsGetTerminalInfo() and OsReadSn() which applied to Prolin 2.3 have been deleted, and the
related functions can be implemented by calling OsRegGetValue().
4.12.1 OsRegSetValue
4.12.2 OsRegGetValue
The system configuration name can only be set beginning with ―ro.fac.‖ or
―persist.sys.‖ About the ―ro.fac.‖, users can refer to registry table.
Instruction If the query parameter does not exist or the parameter value is empty, it‘ll
return 0 and the output parameter Value will be ―‖.
4.13.1 OsInstallFile
4.13.2 OsUninstallFile
Instruction This function is only used for unloading application and parts of system files.
4.14.1 OsFirmwareGetVersion
4.14.2 OsFirmwareUpgrade
The Prolin provides a function to verify the file signature. Use this interface to verify the
signature before using the files.
4.15.1 OsVerifySign
4.15.2 OsVerifySignExternal
int PUKType);
Verify the file signature specified by FileName to see whether it is legal or not.
Function The file does not include the signature data.
FileName 【Input】 The file name which contains the path.
SignData 【Input】 Signature data, it has 284 bytes.
PUK_TYPE_M
The public key of Manufacturers. It is used to do
the signature verification for firmware released by
manufacturer.
Parameters PUK_TYPE_US_PUK
PUKType【Input】 The public key of user signature certificate, it is
used to do the signature verification for the public
key certificate.
PUK_TYPE_USER
The public key of users, it is used to do the
signature verification for user application.
RET_OK Success
ERR_VERIFY_SIGN_FAIL Illegal signature.
2. In order to avoid repeating validation, –the user should use this function to
verify the legitimacy of the file before installing the file. (System will
verify automatically in OsInstallFile ()).
4.16.1 OsGetSysVer
Return None
1. If Version[0] is equal to 0x00,it means the corresponding module does not
Instruction exist,
2. The buffer size of version must be greater than31 bytes.
Prolin can determine whether the handset is on the base or not. Since the S series doesn‘t have
any bases, so it can‘t support this function.
4.17.1 OsOnBase
Parameters None
1 yes
Return
0 no
Prolin supports monitoring program state. Once the program crashes, it will generate crash
report in the directory‗/data/tombstones‘ after calling this function.
4.18.1 OsSaveCrashReport
Return None
Method one
Through the function signal(SIG_XXX, OsSaveCrashReport);
OsSaveCrashReport will be registered as signal handler, for example:
signal(SIGILL, OsSaveCrashReport);
signal(SIGABRT, OsSaveCrashReport);
signal(SIGBUS, OsSaveCrashReport);
signal(SIGFPE, OsSaveCrashReport);
signal(SIGSEGV, OsSaveCrashReport);
signal(SIGSTKFLT, OsSaveCrashReport);
Method two
During the signal handler process, call OsSaveCrashReport (sig) to save
Instruction the error message. For example:
int mysighandler(int sig)
{
do_something();
OsSaveCrashReport(sig);
}
The recommended signals are SIGILL, SIGABRT, SIGBUS, SIGFPE,
SIGSEGV and SIGSTKFLT.
After calling this function, it will ignore the signal that corresponds to sig. That
is, it calls the signal (sig, SIG_IGN) in function OsSaveCrashReport ().
In Terminal Manager(TM), it can export the report to U disk.
4.19.1 OsMount
4.19.2 OsUmount
5 Encryption and
Decryption
Prolin supports true random number, and provides the application interface to generate true
random number.
5.2.1 OsGetRandom
Return None
Instruction
Prolin supports the SHA algorithms, such as SHA-1, SHA-2(SHA-256, SHA-512) and
truncates form of the SHA-2(SHA-224, SHA-384).
5.3.1 OsSHA
Return None
5.4.1 OsDES
int KeyLen,
int Mode);
Function Do DES / TDES encryption and decryption with 8bytes.
Return None
Do the encryption or decryption according to the mode selection.
Instruction If the parameters are invalid, there will be no operation.
5.5.1 OsAES
int KeyLen,
int Mode);
Function Perform AES encryption and decryption operation.
Input 【Input】 16-byte input data
Parameters
Output【Output】 16-byte output data
AesKey【Input】 Key
0- Decryption;
Mode
1- Encryption.
Return None
This function supports 128, 192 or 256 (bits) AES encryption and decryption.
Instruction If the parameter is invalid, there will be no any operations.
5.6 RSAalgorithm
Prolin supports RSA algorithm, including public/private key-pair generation, RSA encryption
and RSA decryption. Currently, Prolin supports a maximum length of 2048 bits.
5.6.1 OsRSA
int ModulusLen,
ERR_DATA_TOO_B
ExpLen is bigger than ModulusLen.
IG
1. This function performs RSA encryption/decryption operations; encryption
and decryption are performed by selecting different keys. If select a
private key, such as Modulus, Exp, it will do encryption; or a public key, it
Instruction will do decryption.
2. This function can perform RSA operation with the length of less than or
equal to 2048 bits.
5.6.2 OsRSAKeyGen
Parameters ModulusLen Module length. (It can be 64, 128, and 256 (bytes)).
Public key exponent.
PubExp 【Input】 It only can be:‖\x00\x00\x00\x03‖ or
―\x00\x01\x00\x01‖
RET_OK Success
ERR_INVALID_PA
Invalid Parameters
RAM
Return
ERR_GEN_RAND
Fail to generate random data.
OM
ERR_GEN_FAIL Fail to generate RSA Key pair.
By calling this interface, it will randomly generate a RSA Key pair with a
Instruction specified exponent and modulus.
6 PED
Prolin provides a series of PED interface, including built-in PED, MK / SK, DUKPT, RSA
and other related interfaces.
ST_RSA_KEY
typedef struct{
unsigned char Exponent [512]; /*When exponent <512 bytes, add 0x00
in left.*/
}ST_RSA_KEY;
6.3.2 RSA key structure for verifying the ciphertext IC card PIN
ST_RSA_PINKEY
typedef struct{
}ST_RSA_PINKEY;
6.4.1 OsPedOpen
Parameters None
RET_OK Success
Return
ERR_DEV_BUSY Device is busy.
Instruction Other PED series functions can be called only after successfully opening the
PED device.
6.4.2 OsPedGetVer
Instruction
6.4.3 OsPedSetInterval
6.4.4 OsPedVerifyPlainPin
int Mode,
apdu_s.lc = icc_command[4];
apdu_s.le = 0;
return CMDERR;
icc_resp[0] = apdu_r.swa;
icc_resp[1] = apdu_r.swb;
6.4.5 OsPedVerifyCipherPin
ST_APDU_RSP apdu_r;
apdu_s.LC = icc_command[4];
apdu_s.LE = 0;
return ERR_PED_ICC_CMD_ERR;
icc_resp[0] = apdu_r.SWA;
icc_resp[1] = apdu_r.SWB;
6.4.6 OsPedEraseKeys
6.4.7 OsPedSetFunctionKey
Instruction
6.4.8 OsPedClose
Parameters None
Return None
Instruction This function should be called to close device before the program exits.
6.4.9 OsPedCancelPinEntry
6.5 MK/SK
6.5.1 OsPedWriteKey
DstKeyIdx = [1~100].
DstKeyType:
PED_TLK
1 byte
PED_TMK
PED_TPK/PED_TAK/PED_TDK
1 byte DstKeyLen: 8/16/24
8/16/24 DstKeyValue.
bytes The destination key plaintext / ciphertext
KcvMode:
0x00: No authentication
0x01: Performs DES/TDES encryption on
8-byte 0x00, and uses first 3 bytes in
ciphertext as KCV.
0x02: Firstly, performs parity check, then
1 byte does DES/TDES encryption on
―\x12\x34\x56\x78\x90\x12\x34\x56
‖, and uses first 3 bytes in ciphertext
as KCV.
0x03: Transfers in a string of KcvData, uses
source key to perform specified
MAC on [DstKeyValue + KcvData],
and then gets the result as KCV.
KcvData:
When KcvMode is 0x00/0x01/0x02,
padding with random numbers.
128 When KcvMode is 0x03, the first byte
bytes of KcvData is the length of KCV data
which participate in the calculation, the
rest is KCV data. The first byte after
the KCV data represents the MAC
operation mode.
When KcvMode = 0x00, padding with
random numbers.
8 bytes
When KcvMode =0x01/0x02/0x03,
KcvValue points to the KCV value.
10 bytes Padding with random number.
RET_OK Success.
ERR_DEV_NOT_O
PED device is not open.
PEN
Return
ERR_INVALID_PA
Invalid parameter.
RAM
Others Refer to the PED Return code list .
Writing the ciphertext and plaintext to the specific index position of the specific
key type area. This function has following key points:
1. When SrcKeyIdx=0, system considers that the DstKeyValue is the
plaintext of key and does not judge SrcKeyType and SrcKeyIdx. Write the
DstKeyValue to DstKeyIdx in DstKeyType area directly.
2. Only when PED_TLK does not exist, to type-in plain text or download
any key is allowed.
3. When PED_TLK exist, it is not allowed to type in plaintext or download
key. PED_TLK can be 16 or 24 bytes.8-byte key is not allowed.
4. Format PED to clear all downloaded keys and then write in PED_TLK.
5. If SrcKeyIdx is valid, PED considers the DstKeyValue as the key
ciphertext, thus decrypt it using SrcKeyIdx key and write the key to
DstKeyIdx. DstKeyType >= SrcKeyType.
Instruction 6. DstKeyLen only can be of 8, 16 or 24 bytes. If DstKeyLen = 8 bytes, the
key could only be used for DES calculation. If DstKeyLen = 16 or 24
bytes, the key could be used for TDES calculation. DstKeyLen <=
SrcKeyLen.
7. If DstKeyType=PED_TPK, the key only be used to encrypt PIN Block.
If DstKeyType=PED_TAK, the key can only be used for MAC
encryption.
If DstKeyType=PED_TDK, the key can only be used for *DES/TDES.
8. KCV is the verification for plaintext. If plaintext is typed-in directly, the
KcvMode of KeyIn is not 0 and the system will do the KCV verification
for plaintext according to the specified KcvMode.
9. The valid KeyBlock must be 184 bytes, and the users must pass in valid
parameters, otherwise an error will occur.
6.5.2 OsPedWriteTIK
DstKeyValue.
24 bytes
The destination key plaintext / ciphertext
KcvMode:
0x00: No authentication.
0x01: Performs DES/TDES encryption on
the 8-bytes 0x00, and uses first 3
bytes in ciphertext as KCV.
0x02: Performs parity check 1st, then
performs DES/TDES encryption on
1 byte 8 bytes
―\x12\x34\x56\x78\x90\x12\x34\x56
‖, and uses first 3 bytes in ciphertext
as KCV.
0x03: Sends in data KcvData, uses source
key to perform specified mode of
MAC on [aucDesKeyValue +
KcvData], and use the result as
KCV.
KcvData:
When the KcvMode is
0x00/0x01/0x02, padding with random
numbers.
128 When the KcvMode is 0x03the first
bytes byte of KcvData is the length of KCV
data which participate in the
calculation, the rest is KCV data. The
first byte after the KCV data represents
the MAC operation mode.
When KcvMode = 0x00, padding with
random numbers.
8 bytes
When KcvMode = 0x01/0x02/0x03,
KcvValue point to the KCV value.
10 bytes Initialize KSN.
RET_OK Success
ERR_DEV_NOT_O
PED device is not open.
PEN
Return
ERR_INVALID_PA
Invalid parameter
RAM
Others Refer to the PED Return code list .
Writes the cryptograph and plaintext of a key to the specific index position of
the specific key type area. This function has following key points:
1. When SrcKeyIdx=0, system considers that the DstKeyValue is the
plaintext of key and will not check the SrcKeyType and SrcKeyIdx. Write
the DstKeyValue to DstKeyIdx in DstKeyType area directly.
Instruction 2. Only when PED_TLK does not exist, it is allowed to type-in plaintext or
download any key.
3. When PED_TLK exist, it is not allowed to type in plaintext or download
key.
4. If SrcKeyIdx is valid, PED considers the DstKeyValue as key
6.5.3 OsPedWriteKeyVar
24 bytes.
KeyVar 【Input】 The extensible input data to be used in exclusive-or,
length of it should be same as the key.
RET_OK Success
ERR_DEV_NOT_O
PED device is not open.
PEN
Return
ERR_INVALID_PA
Invalid parameter
RAM
Others Refer to the PED Return code list .
6.5.4 OsPedSetAsteriskLayout
int OsPedSetAsteriskLayout(int x,
int y,
Prototype
int fontSize,
int fontColor,
uchar align);
Function Sets how to display the layout attributes of asterisk while inputting PIN.
x X-coordinate
y Y-coordinate
Font size of asterisk:
fontSize = 16, represents the character has 16 dots;
fontSize = 24, represents the character has 24 dots;
fontSize fontSize = 32, represents the character has 32 dots;
fontSize = 48,represents the character has 48 dots;
Display the asterisk with PED internal font, and it is not
Parameters relevant to system installed font.
Font color of asterisk.
fontColor Using the macro definition RGB (_r, _g, _b) and according
to the input three-primary colors to generate color value with
16-bit.
Alignment:
PED_ASTERISK_ALIGN_LEFT;
align
PED_ASTERISK_ALIGN_CENTER
PED_ASTERISK_ALIGN_RIGHT
RET_OK Success
ERR_DEV_N
PED device is not open.
OT_OPEN
Return
ERR_INVALI
Invalid parameter.
D_PARAM
Others Refer to the PED Return code list .
1. The PIN input interface is displayed by the application, this function will
only display asterisk.
Instruction 2. It needs to call this function to set the displaying layout of asterisk before
using PedVerifyPlainPin, PedVerifyCipherPin, PedGetPinBlock and
PedGetPinDukpt.
6.5.5 OsPedGetPinBlock
[1-100]
KeyIdx
Index of TPK.
If Mode=0x00, DataIn is 16 bytes primary
account number after shifting.
If Mode=0x01, Input parameters for
participation in PinBlock formatting, 8 bytes
data. (Refer to ISO9564 standard, this data
DataIn【Input】 can be Random number, transaction serial
number or time stamp, etc.)
If Mode=0x02, DataIn is 16 bytes primary
account number after shifting.
If Mode=0x03, DataIn is ISN [6 Bytes,
ASCII code].
Enumeration of 0-12
Application enumerates all possible lengths of
Parameters PIN. ‗,‘ will be used to separate each number of
ExpPinLen 【Input】 length. If no PIN, or 4 or 6 digits of PIN are
allowed, the string will be set as ‗0, 4, and 6‘.
0 means that no PIN is required and pressing
‗Enter‘ will return.
PIN BLOCK format
0x00 0x00 ISO9564 format 0
Mode 0x01 0x01 ISO9564 format 1
0x02 0x02 ISO9564 format 3
0x03 0x03 HK EPS format
The timeout of PIN entry [ms]
TimeoutMs Maximum is 300000ms.
0: Without timeout or related control for PED.
8bytes.
PinBlock 【Output】
Point to the generated PINBlock.
RET_OK Success
ERR_DEV_NOT_OPEN PED device is not open.
Return ERR_INVALID_PARA
Invalid parameter.
M
Others Refer to the PED Return code list .
6.5.6 OsPedUpdatePinBlock
int Mode);
PinBlock 8 bytes.
【Output】 Input original PINBlock data, output new PINBLOCK.
6.5.7 OsPedGetMac
int Mode);
Use MAC key specified by the KeyID to do the MAC operation for the
Function following Mode algorithm, output the 8-byte result to Mac.
KeyIdx TAK index. [1~100]
Parameters <=1024 bytes
DataIn【Input】
The data package that needs to do the MAC operation.
6.5.8 OsPedDes
int Mode);
Uses the TDK to do the DES/TDES decryption for the data and then outputs
Function plaintext or ciphertext. A specified TDK can be used for encryption and
decryption algorithms.
KeyIdx TDK index. [1~100].
Parameters
InitVecto 【Input】 Used for CBC/OFB encryption or decryption. If set to
NULL, it will set the initialization vector as
―\x00\x00\x00\x00\x00\x00\x00\x00‖ by default.
It is not needed for ECB encryption or decryption, and
can be set to NULL.
DataIn 【Input】 Points to the data that needs to be calculated.
DataInLen Data length. It should be <=1024 and multiple of 8.
DataOut【Output】 Points to the data that has been calculated.
0x00: ECB Decryption
0x01: ECB Encryption
0x02: CBC Decryption
Mode
0x03: CBC Encryption
0x04: OFB Decryption
0x05: OFB Encryption
RET_OK Success
ERR_DEV_NOT_
PED device is not open.
OPEN
Return
ERR_INVALID_P
Invalid parameter.
ARAM
Others Refer to the PED Return code list .
Instruction
6.5.9 OsPedGetKcv
int KeyIdx,
int KcvMode,
Prototype
int KcvDataLen,
TIK-injection.
PED_TLK
PED_TMK
PED_TAK
KeyType
PED_TPK
PED_TDK
PED_TIK
Index number of the key, for example:
TLK can only be 1.
KeyIdx TMK takes range value from 1 to 100.
TWK takes range value from 1 to 100.
Parameters TIK takes range value from 1 to 100.
Instruction
6.5.10 OsPedDeriveKey
int SrcKeyIdx,
int DstKeyType,
Prototype
int DstFromKeyIdx,
int DstToKeyIdx,
int Mode);
Divergent key. Uses the key specified by SrcKeyIdx to do the encryption or
Function decryption for the key specified by DstFromKeyIdx, then derives a new key
PAX Computer Technology (Shenzhen) Co., Ltd. 66
Prolin API Programming Guide
Instruction The source key level should not be lower than the destination key type.
6.6 DUKPT
6.6.1 OsPedGetPinDukpt
int Mode,
6.6.2 OsPedGetMacDukpt
int DataInLen,
Prototype
unsigned char *Mac,
int Mode);
Function Calculate MAC by using MAC key of DUKPT.
GroupIdx DUKPT group ID. [1~100]
DataIn 【Input】 Points to the data that needs to calculate the MAC.
The data length should be <=1024. If the length is not the
DataInLen
multiple of 8, 0x00 will be padded automatically.
Mac 【Output】 Points to the obtained MAC.
Ksn 【Output】 Points to the current KSN.
1. 0x20: Perform TDES encryption for BLOCK1 by
using MAC key. Does TDES encryption again by
using TAK when and after bitwise XOR the
previous encryption result with BLOCK 2. Processes
in turn to get the 8 bytes encryption result.
2. 0x21: Does bitwise XOR for BLOCK1 and BLOCK
2; Does bitwise XOR again by using previous XOR
result with BLOCK3. Does it in turn and finally gets
the 8 bytes XOR result. Uses TAK to process TDES
Parameters encryption for the result.
3. 0x22: ANSIX9.19 standard, Does DES encryption
for BLOCK1 by using TAK (only take the first 8
bytes of key). The encryption result will bitwise
Mode XOR with BLOCK2 and then does DES encryption
by using TAK again. Does it in turn and gets the 8
bytes encryption result. Uses TDES to encrypt in the
last time.
4. 0x20/0x21/0x22: KSN not plus 1 automatically.
5. 0x40/0x41/0x42: The MAC calculation method is
the same with 0x20/0x21/0x22.
6. 0x40/0x41/0x42: Chooses to response the MAC key.
7. 0x20/0x21/0x22: KSN chooses to request and
response MAC key
8. 0x40/0x41/0x42: KSN not plus 1 automatically.
9. Other values are reserved for extended MAC
algorithm.
RET_OK Success
ERR_DEV_NOT_
PED device is not open.
OPEN
Return
ERR_INVALID_P
Invalid parameter.
ARAM
Others Refer to the PED Return code list .
If KSN does not increase, both the response MAC key and the response-request
Instruction MAC key can calculate MAC for unlimited times.
6.6.3 OsPedDesDukpt
int KeyVarType,
int DataInLen,
Prototype
unsigned char *DataIn,
int Mode);
Uses DES/MAC key of DUKPT to do encryption and decryption for the input
Function data.
GroupIdx DUKPT group ID. [1~100]
0x00: Uses the requests and responses of MAC key
0x01: Uses DES key of DUKPT
KeyVarType 【Input】 0x02: Uses the PIN variant to encrypt the data and it
is only available for ECB encryption that means
the Mode can only be 1.
Used for CBC/OFB encryption or decryption. If set to
NULL, it will set the initialization vector as
Parameters ―\x00\x00\x00\x00\x00\x00\x00\x00‖ by default.(8
InitVector 【Input】 bytes)
It is not needed for ECB encryption, and can be set to
NULL.
The data needed to be calculated should be <= 8192
DataInLen
bytes.
DataIn 【Input】 Input data.
DataOut 【Output】 Points to the data that has been calculated.
6.6.4 OsPedGetKsnDukpt
Instruction
6.6.5 OsPedIncreaseKsnDukpt
_OPEN
ERR_INVALID
Invalid parameter.
_PARAM
Others Refer to the PED Return code list .
Instruction
6.7 RSA
6.7.1 OsPedReadRsaKey
Instruction It can only read the RSA public key, while reads private key, returns error.
6.7.2 OsPedWriteRsaKey
6.7.3 OsPedRsaRecover
Function Uses the RSA key stored in PED to process data operation.
RsaKeyIdx 1~10: Index of RSA Key.
The length of operation data which is the same as the
RSA modulus, the size in bytes.
DataInLen
The length can be the value which is multiples of 8 and
Parameters should also between 64 bytes and 256 bytes.
DataIn 【Input】 Points to the data that needs to be calculated.
DataOut 【Output】 Points to the data that has been calculated.
KeyInfo 【Output】 Key information
RET_OK Success
ERR_DEV_NOT_O
PED device is not open.
PEN
Return
ERR_INVALID_PA
Invalid parameter.
RAM
Others Refer to the PED Return code list .
Instruction
6.7.4 OsPedReadCipherRsaKey
Instruction
6.7.5 OsPedWriteCipherRsaKey
Parameters CipherRsaKeyLen The byte length of the ciphertext data of RSA key.
CipherRsaKey【Input】 Points to the ciphertext data of RSA key.
RET_OK Success
ERR_DEV_NOT_OP
PED device is not open.
EN
Return
ERR_INVALID_PAR
Invalid parameter.
AM
Others Refer to the PED Return code list .
Instruction
6.8 AES
6.8.1 OsPedWriteAesKey
Function Write in an AES key and use KCV to check the key correction.
PED_TMK
SrcKeyIdx:
When SrcKeyType = PED_TLK,
SrcKeyIdx = 1;
1 byte When SrcKeyType = PED_TMK,
SrcKeyIdx = [1~100];
If ucSrcKeyIdx = 0, key will be written
in PED as plain text.
1 byte DstKeyIdx: [1-100].
7 bytes Reserved domain. Random number.
1 byte DstKeyType: PED_TAESK
1 byte DstKeyLen: 16/24/32
DstKeyValue:
32 bytes The destination key plain-text or
cipher-text.
KcvMode:
0x00: No KCV check.
0x01: Performs AES ECB encryption on
16-byte 0x00, and use first 3 bytes as
KCV.
0x02: Perform parity check at first, then
perform AESECB encryption on 16
1 byte bytes
―\x12\x34\x56\x78\x90\x12\x34\x56
\x12\x34\x56\x78\x90\x12\x34\x56‖
, and use first 3 bytes as KCV.
0x03: Transfers in a string of KcvData, use
source key to perform specified
mode MAC on [DstKeyValue
(cipher) + KcvData], and use the
result as KCV.
KcvData:
When KcvMode is 0x00/0x01/0x02,
padding with random numbers.
When KcvMode is0x03, the first byte
128 bytes of KcvData is the length of KCV data
which participates in the calculation,
the rest is KCV data. The first byte
after the KCV data represents the
MAC operation mode.
When KcvMode = 0x00, padding with
random numbers.
8 bytes
When KcvMode =0x01/0x02/0x03,
KcvValue point to the KCV value.
2 bytes Padding with random number.
RET_OK Success
Return
ERR_DEV_NOT_ Device is not open.
OPEN
ERR_INVALID_P Invalid parameter.
ARAM
Others Refer to the PED Return code list.
Writing the cryptograph and plaintext of an AES key to the specific index
position of the AES area. This function has following key points:
1. When SrcKeyIdx=0, system consider that the DstKeyValue is the plaintext
of key and does not judge SrcKeyType and SrcKeyIdx. Write the
DstKeyValue to DstKeyIdx in DstKeyType area directly.
2. Only when PED_TLK does not exist, to inject plaintext or download any
Instruction key into PED is allowed.
3. When PED_TLK exist, it is not allowed to inject in plaintext or download
key.
4. If SrcKeyIdx is valid, PED considers the DstKeyValue as the key
cryptography, thus decrypt it using SrcKeyIdx key and write the key to
DstKeyIdx.
5. The valid KeyBlock must be 184 bytes, and the users must pass a valid
parameter to it, otherwise an error will occur.
6.8.2 OsPedAes
intOsPedAes(intKeyIdx,
int Mode);
Function Uses the specified AES key stored in PED to do the AES encryption or
decryption for the data and then output ciphertext or plaintext.
KeyIdx 【Input】 TAESK index: 1~100.
Used for CBC/OFB encryption or decryption. If
set to NULL, it will set the initialization vector as
―\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
InitVector 【Input】 x00\x00\x00\x00\x00‖ by default.
7 LCD
In Prolin, the operation of displaying contents on LCD is managed by the GUI; it supports the
graphics systems such as Minigui, QT. In this chapter, it will provide OsScrBrightness(),
OsScrContrast(), OsScrGetSize() and some related interfaces for application use.
Application can adopt the XUI graphic interfaces that provided by PAX, for more details;
refer to the ―XUI Programming Guide‖. It also can develop the GUI system by itself, or it can
use FrameBuffer approach to test the validity of the LCD driver. OsScrContrast(),
OsScrBrightness(), OsScrGetSize() and the rest of the LCD operations are managed by the
GUI.
Applications (such as driver testing) can also operate FrameBuffer directly. Details are as
follows:
1. Open the FrameBuffer device, the device node is ―/dev/fb‖;
2. Get the fixed screen information through ioctl,
3. Get the variable screen information through ioctl,
4. Map device memory to the process space through mmap,
5. Write the FrameBuffer.
int open_screen(void)
{
char vtname[128];
int fd, nr;
unsigned y, addr;
struct fb_fix_screeninfo fix;
sb = (screen_buffer*)malloc(sizeof (screen_buffer));
if ((sb->dev_fd = open(FB_DEV_PATH, O_RDWR)) == -1) {
perror("open");
return -1;
}
if (ret) {
sb->width = FB_WIDTH;
sb->height = FB_HEIGHT;
sb->bytes_per_pixel = FB_BYTES_PER_PIXEL;
fprintf(stderr,"in %s line %d",__FUNCTION__,__LINE__);
} else {
sb->width = fb_vinfo.xres;
sb->height = fb_vinfo.yres;
sb->bytes_per_pixel = fb_vinfo.bits_per_pixel / 8;
}
if(sb->bytes_per_pixel == 3)
sb->bytes_per_pixel = 4;
7.1 OsScrContrast
Return None
7.2 OsScrBrightness
Return None
Instruction
7.3 OsScrGetSize
Return None
The screen size is just a read-only property.
Instruction The interface only applys to the applications that does not support GUI.
8 Keyboard
KEY3 4 KEY―3‖
KEY4 5 KEY―4‖
KEY5 6 KEY―5‖
KEY6 7 KEY―6‖
KEY7 8 KEY―7‖
KEY8 9 KEY―8‖
KEY9 10 KEY―9‖
KEY0 11 KEY―0‖
KEYCLEAR 14 KEY―CLEAR‖
KEYENTER 28 KEY―ENTER‖
KEYF2 60
KEYF3 61
KEYF4 62
The application developers can directly use the input subsystem when they need to test
keyboard drivers or transplant other GUI systems. The device node of the keyboard is "/dev/
keypad".
Details of calling the input subsystem are shown as follow:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <linux/input.h>
static int keypad_fd = -1;
struct input_event ev0[64];
//for handling /key/event
static int handle_event0() {
int button = 0, realx = 0, realy = 0, i, rd;
int main(void) {
int done = 1;
printf("sizeof(struct input_event) = %d\n", sizeof(struct input_event));
keypad_fd = open("/dev/keypad", O_RDWR);
if ( keypad_fd < 0 )
return -1;
while ( done ) {
printf("begin handel_event0...\n");
done = handle_event0();
printf("end handel_event0...\n");
}
if ( keypad_fd > 0 ) {
close(keypad_fd);
keypad_fd = -1;
}
return 0;
}
8.1 OsKbBacklight
Return None
Instruction
9 Touch Screen
10 Signature Pad
11 Printer
Prolin provides both virtual printing and physical printing function, and also provides the
unified interface for API. For physical printer, the senior application developers can
access the printer driver through a POSIX interface to achieve the specific print function.
This part includes three functions: opening, resetting and closing the printer.
11.2.1 OsPrnOpen
ERR_BATTERY_AB
The battery is absent
SENT
1. This function needs to be called when the program starts to run, otherwise
Instruction the associated functions won‘t work.
2. Noted that S920 and D200 mobile terminals need battery to work.
11.2.2 OsPrnReset
Parameters None
Return None
Calling this function will restore the printer default settings and clear buffer
Instruction data.
This function is applicable to both physical printers and virtual printers.
After calling OsPrnReset (), the font choice of library file will be
restored to default font status (only available in English).
11.2.3 OsPrnClose
Parameters None
Return None
Instruction This function should be called to close the printer device when program exit.
11.3.1 OsPrnSetSize
11.3.2 OsPrnSetDirection
Instruction This function is applicable to both physical printers and virtual printers.
11.3.3 OsPrnSetGray
Return None
Before setting gray level, it prints with the default level, after calling this
Instruction function it will print with the setting level.
This function is only applicable to the physical printer.
11.4 TypeSetting
11.4.1 OsPrnSetSpace
Return None
1. Settings will be valid until they are set again or OsPrnReset() is called;
2. Printing character space is 0 by default;
3. Printing line spaces are 0 and 2 for thermal printer and stylus printer
Instruction respectively by default ;
4. The maximum line space can be 255;
5. The maximum character space can be 255;
6. Invalid parameter does not change the current settings.
11.4.2 OsPrnSetReversal
Return None
Instruction This function is applicable to both physical printers and virtual printers
11.4.3 OsPrnSetIndent
11.4.4 OsPrnCheck
Parameters None
RET_OK Success.
ERR_PRN_NOFONTLIB Has no font library.
11.4.5 OsPrnGetDotLine
Parameters None
11.4.6 OsPrnSetFont
11.4.7 OsPrnSelectFontSize
int SingleCodeHeight,
Prototype
int MultiCodeWidth,
int MultiCodeHeight);
Function Sets the font size.
The width control of single code font. (For non-
monospaced font, width of each character may not meets
SingleCodeWidth the settings).
The value ranges from 8 to 64.
The height control of single code font.
SingleCodeHeight
Parameters The value ranges from 8 to 64.
The width control of multiple code fonts.
MultiCodeWidth
The value ranges from 12 to 64.
The height control of multiple code font
MultiCodeHeight
The value ranges from 12 to 64.
Return None
After the first calling of OsPrnOpen(), the font width and height are set to the
Instruction default values (12x24) (24x24).
This function is applicable to both physical printers and virtual printers.
Suggest the height and width of multiple code font should be the
same, otherwise, the font may display abnormally.
11.4.8 OsPrnFeed
Return None
1. If the pixel value is positive, then the paper will feed forwards. If it is
Instruction negative, then feed backwards. If it is 0, then no action.
2. This function is applicable to both physical and virtual printers.
This is a one-time action, that is, it will lose its effect after the
implementation.
11.4.9 OsPrnPrintf
Return None
1. Support variable parameters;
2. Support ‗\n‘ (new line) and ‗\f‘ (new page) control characters in the string;
3. If the printing data package is too long, then the program will overflow;
4. If the string is longer than the printing boundary, it will automatically
Instruction change line and continue printing;
5. The maximum buffer size is 2048 bytes;
6. Store str in printing buffer, and print data in printing buffer in sequence of
writing into the buffer after calling OsPrnStart().
11.4.10 OsPrnPutImage
Return None
1. Bitmap data is generated as follows:
Draw a bitmap (usually a logo): use paintbrush program under
Windows to draw a bitmap and save it as a ―monochromatic, bmp
format‖ file.
Use ―Bitmap Converter‖ provided by PAX to convert the .bmp file
into a header file, for instance, Logo.h header file. (If more than
one .bmp files are selected, after the conversion, the head file contain
the same number of array\the definition of the name of the array will
Instruction be associated with the BMP filename.
Printing bitmap size limit: for thermal printer, up to 384 pixels in
width is allowed, for stylus printer, 180 pixels are allowed, but the
height is unlimited.
2. Use the generated array as the input parameter of this function.
3. If the bitmap width is larger than the limit of the printer, then it will be get
rid of the redundant data on the right. .
4. If the size of the data packet is too large, then this function will remove the
LOGO message.
11.4.11 OsPrnStart
Parameters None
RET_OK Success
Return
ERR_PRN_BUSY Printer is busy.
11.5 POSIX
Prolin physical printer driver module makes the POSIX programming interface open to the
application developers.
11.5.1 open
Opens the physical printer, the device name is ―/dev/printer‖
int handle = open(―/dev/printer‖, O_RDWR);
11.5.2 read
Read the printer status. The data format of the first byte buf[0] in Read buffer is defined
as follows:0x00 normal
0x01 printer is busy
0x02 out of paper
0x03 printer overheats
0x04~0xFF reserved
11.5.3 Write
The first two bytes of the buffer are gray settings and reserved bit, suppose that the buffer is
char buf [50], bit0~bit2 in the buf [0] represent the printing gray control values, bit3~bit7 are
reserved.
000(0) Reserved
001(1) Normal gray level
010(2) Reserved
011(3) Two-layer thermal printing A
100(4) Two-layer thermal printing B
101(5) Reserved
110(6) Reserved
111(7) Reserved
From buf [2], a single line is composed of every 48 characters (384 dots); if it is less than 48
then it will be padding with blank by the driver.
buf[0] = 0x01;
memset(buf + 2, 0xff, 48);
if (ret < 0) {
//Error handling……
}
lines, it will not print. The longest length of a write buffer should be 384*5000/8 + 2 =
240002 Bytes.
11.5.4 Close
Closes the printer file handles.
close (handle);
12 Font Library
Prolin supports Freetype as the system font library. Therefore, the system supports a series of
vector font and bitmap font.
FT_FONT
typedef struct {
char FileName[64]; /* Font file name */
}FT_FONT;
FT_DOT
typedef struct {
unsigned char Left; /*Font offsets left from the baseline*/
}FT_DOT;
12.2.1 OsEnumFont
int i, num;
FT_FONT *FontList;
num = OsEnumFont(&FontList);
return -1;
i, FontList[i].FileName, FontList[i].FontName);
12.2.2 OsOpenFont
It needs to cache the dot-matrix data after open the fonts, and it is
Instruction recommended to call OsGetFontDot() after 3 seconds.
12.2.3 OsCloseFont
Return None
After using vector fonts, please promptly shut down to release the system
Instruction resources.
12.2.4 OsGetFontDot
FT_DOT *FtDot);
Function Gets the utf-8 encoding standard character font.
Handle 【Input】 Font handle
Utf8Code 【Input】 Characters of UTF-8 encoding standards
Width 【Input】 Font width, value range is【8, 128】.
Height 【Input】 Font height, value range is【8, 128】.
Font style:
FONT_STYLE_NON 0 No style
E
Parameters
FONT_STYLE_BOL 0x00000001 Bold type
D
Style 【Input】
FONT_STYLE_ITAL 0x00000002 Italic type
IC
FONT_STYLE_BOL bold italics
D|FONT_STYLE_IT
ALIC
FtDot 【Output】 The output of font data structure.
ERR_INVALID_PAR
Invalid parameter
AM
ERR_FILE_NOT_EX
File does not exist.
IST
ERR_FONT_CODE Font code error.
ERR_INVALID_HA
Invalid handle
NDLE
Utf8Code input.
UTF-8 code is a variable length, and it needs to end with '\ 0', when the code is
composed of letters, Utf8Code requires two bytes where Utf8Code [0] represents
letter, Utf8Code [1] represents ' \ 0'; but for Chinese, Utf8Code requires four
bytes where Utf8Code [0-2] represents the Chinese and Utf8Code [3] represents '
\ 0'.
The Italic style dot matrix.
When using italics effects, the obtained dot matrix width is wider than the set
value. It is not recommended that the dot size should be not less than 24;
otherwise the dot may not show italics effects. For example, when the dot size of
Song typeface is less than 19, and the bold font dot size is less than 21, the italic
effects cannot be used for Chinese, but it is available for letters.
The format of font data.
Instruction
0x00, 0x00,
0x20, 0x00,
0x10, 0x00,
0x10, 0x00,
0x08, 0x00,
0x04, 0x00,
0x04, 0x00,
0x02, 0x00,
0x01, 0x00,
0x00, 0x80,
0x00, 0x80,
0x01, 0x00,
0x02, 0x00,
0x04, 0x00,
0x04, 0x00,
0x08, 0x00,
0x10, 0x00,
0x10, 0x00,
0x20, 0x00,
0x00, 0x00
Width = 10
Height = 20
Dot data:
0x00,0x00,0x20,0x00,0x10,0x00,0x10,0x00,
0x08,0x00,0x04,0x00,0x04,0x00,0x02,0x00,
0x01,0x00,0x00,0x80,0x00,0x80,0x01,0x00,
0x02,0x00,0x04,0x00,0x04,0x00,0x08,0x00,
0x10,0x00,0x10,0x00,0x20,0x00,0x00,0x00
13 Code
Prolin supports UTF8 as the system default code, and also provides the code-conversion
interface.
13.1.1 OsCodeConvert
14 MSR
Prolin provides the function of reading the magnetic stripe data and provides a unified API
reading interface for use. In addition, senior application developers can access to the magnetic
drive through the POSIX interface and directly get the magnetic stripe bit-stream to achieve
different logics of magnetic stripe decoding.
ST_MSR_DATA:
typedef struct {
unsigned char TrackData[256]; /*Track data buffer*/
}ST_MSR_DATA;
14.3.1 OsMsrOpen
Parameters None
RET_OK Success
ERR_DEV_NOT_EXIST Device does not exist.
Return
ERR_DEV_BUSY Device is busy.
ERR_DEV_NOT_OPEN Fail to open the device.
Instruction Other functions can be operated only after open device successfully.
14.3.2 OsMsrClose
Parameters None
Return None
Instruction This function should be called to close device when program exit.
14.3.3 OsMsrReset
Parameters None
Return None
When the magnetic reader is powered on, this function resets the reader and
Instruction clears the data in the buffer.
14.3.4 OsMsrSwiped
Parameters None
TRUE Card swiped
FALSE Not swiped
Return
ERR_DEV_NOT
Device is not open.
_OPEN
1. This function returns the corresponding value immediately, doesn‘t matter
card is swiped or not.
Instruction 2. Call this function to check whether a card is swiped or not.
3. After calling the OsMsrOpen(), OsMsrRead() or OsMsrReset(), the status
of swiping card will be clear.
14.3.5 OsMsrRead
ST_MSR_DATA *Track3);
Function Reads data of magnetic stripe card.
Track1 【Output】 Output the data of Track1
14.4 POSIX
Prolin Magnetic driver module makes the POSIX programming interface open to the senior
application developers.
14.4.1 Open
Opens the magnetic stripe reader, and the device name is‖/dev/msr‖
int handle = open(―/dev/msr‖, O_RDONLY);
14.4.2 Read
Read the bit stream data from magnetic stripe card.
The data format in Read buffer is defined as follows:
Variable length of data, but it is not more than 3 * 750 bytes. In the case of no card swiping,
the returned data length of read is 0, and the read () may return -1. When the first byte of the
buffer is 0, it presents that the following data will be plaintext magnetic track data.
The data bit stream is represented by using the ASCII code 0/1 and an ASCII code represents
a bit, tracks are separated by 0x0A.
010101010101010101000000000000000000000000000000000011111111111111111111111
111111\n
010101010101010101000000000000000000000000000000000011111111111111111111111
111111\n
010101010101010101000000000000000000000000000000000011111111111111111111111
111111\n
The second byte of the buffer is 1 that means the following data will be locked by using fixed
key encryption. Which needs PedMsrDecryptRaw() interface to do the decryption.
14.4.3 Close
Closes file handles of the magnetic stripe reader.
After closing the handle, the original magnetic data stored in the drive buffer will be cleared.
close (handle);
15 ICC Reader
sci_dcb_t:
/* device control block */
struct sci_dcb_t {
unsigned int voltage; /* operation condition: voltage */
sci_atr_t:
/* ATR */
struct sci_atr_t {
unsigned char ts;
unsigned char t0;
unsigned char ta_flag;
unsigned char tb_flag;
unsigned char tc_flag;
unsigned char td_flag;
unsigned char ta[8];
unsigned char tb[8];
unsigned char tc[8];
unsigned char td[8];
unsigned char hbytes[15];
unsigned char tck;
};
ST_ APDU_REQ
typedef struct
{
Unsigned char Cmd[4]; /*CLA, INS, P1, P2*/
int LC; /* The valid length of DataIn sent to ICC */
unsigned char DataIn[512];/* The data sent to ICC */
int LE; /* The expected returned length */
}ST_ APDU_REQ;
ST_APDU_REQ structure:
1. LE is the expected return length. . The actual returned length
is related to specific command. Here is an expected length but
the actual returned length will be obtained by LenOut.
2. LE and LC are used in combination as follows:
LC=0, LE=0. There are neither sending data nor return
data.
LC=0, LE>0. No sending data, but expecting return
length. If the expected return length is unknown, set Le to
256; otherwise, set it to a specific value.
LC>0, LE=0. The data are sent, but no expected return
length.
LC>0, LE>0. The data are sent and returned the
expected length. . If expected return length is unknown,
set Le to 256; otherwise, set it to a specific value.
ST_ APDU_RSP:
typedef struct
{
Int LenOut; /* The actual returned data length */
unsigned char DataOut[512]; /* Returned data pointer from ICC */
unsigned char SWA; /*status word 1 of ICC */
unsigned char SWB; /* status word 2 of ICC */
}ST_ APDU_RSP;
sci_open () sci_detect ()
sci_get_dcb () sci_cold_reset ()
sci_set_dcb () sci_warm_reset ()
sci_read () emv_atr_parse ()
sci_write () iso7816_atr_parse ()
sci_close () iso7816_pps ()
sci_lock () iso7816_ocs()
sci_unlock() iso7816_t1_ifsd_request()
sci_powerup() iso7816_t0_exchange()
sci_powerdown() iso7816_t1_exchange()
15.3.1 sci_open
Instruction Other functions can be operated only after open device successfully.
15.3.2 sci_get_fd
15.3.3 sci_get_dcb
Instruction
15.3.4 sci_set_dcb
id【Input】 device id
Parameters
dcb【Output】 device control block
0 success
Return
others error
Instruction
15.3.5 sci_read
Instruction
15.3.6 sci_write
Instruction
15.3.7 sci_close
Return 0 success
others error
Instruction This function should be called to close device while program exit.
15.3.8 sci_lock
15.3.9 sci_unlock
15.3.10 sci_powerup
Instruction
15.3.11 sci_powerdown
Instruction
15.3.12 sci_detect
15.3.13 sci_cold_reset
Instruction
15.3.14 sci_warm_reset
Instruction
15.4.1 emv_atr_parse
Instruction
15.4.2 iso7816_atr_parse
Instruction
15.4.3 iso7816_pps
Instruction
15.4.4 iso7816_ocs
15.4.5 iso7816_t1_ifsd_request
Instruction
15.4.6 iso7816_t0_exchange
Instruction
15.4.7 iso7816_t1_exchange
information.
Pointer to APDU response, card response
apdu_resp【Output】
information.
0 success
Return
others Error
Instruction
15.5.1 OslccOpen
15.5.2 OsIccDetect
slot or not.
2. For USER_SLOT, if card-insert or card-extract happens, system will send
MSG_ICCSIG message to the application which is used to open the
device. This mechanism doesn‘t apply to SAM card.
For SAM card, please make sure call this interface firstly before
reset the SAM card. This interface will cause the SAM card to
power off.
15.5.3 OsIccInit
15.5.4 OsIccExchange
15.5.5 OsIccClose
RET_OK Success.
Return
Others Please refer to ICC Return code list
Instruction
16 RF Reader
This part mainly describe the applicaton programming interface of contactless IC card reader
conforming to the ISO14443 and ‗EMV Contactless Book D V2.1‘ regulation.
About request and response of data structure, please refer to the IC Card Reader section
15.2.3 and 15.2.4.
PCD_USER_ST
typedef struct pcd_user_t{
unsigned char wait_retry_limit_w; /* Written enable for the number
of S(WTX) response*/
unsigned int wait_retry_limit_val; /* S(WTX) response to the times that
repeat most frequently.*/
unsigned char check_cancel_key_w; /*Written enable for checking the
cancel key*/
unsigned char check_cancel_key_val; /* 0 represents no response to the
struct PCD_PARAM_ST
/*Card protocol check enable switch,1- check;0 – do not check */
unsigned int uiProtocolCheckEn;
/*the maximum block length that the card received .(unit: byte) */
unsigned int uiFSC;
/*The longest time that waiting for card response, use the current ETU
time as a time unit*/
unsigned int uiFWT;
/*sending protection time, use the current ETU time as a unit */
unsigned int uiSFGT;
16.3.1 iso14443_3a_req
16.3.2 iso14443_3a_wup
16.3.3 iso14443_3a_antisel
0 Success.
Return
others Error
16.3.4 iso14443_3a_halt
Parameters None
0 Success.
Return
Others Error.
Instruction
16.3.5 iso14443_3a_rats
Parameters ats【Output】 the response from PICC(must be greater than 256 bytes)
0 Success.
Return
others Error
Instruction
16.4.1 iso14443_3b_req
16.4.2 iso14443_3b_wup
16.4.3 iso14443_3b_attri
Instruction
16.4.4 iso14443_3b_halt
Parameters None
0 Success
Return
others Error
Instruction
16.5.1 iso14443_4_transfer
int tx_ln,
Prototype
unsigned char *des,
int *rx_ln );
Function Implements the half duplex communication protocol with ISO14443-4.
src The data will be transmitted by PCD.
tx_ln The number of transmitted data by PCD.
Parameters
des The data will be transmitted by PICC
rx_ln The number of transmitted data by PICC.
0 Success
Return
others Error
Instruction
16.6.1 OsPiccOpen
16.6.2 OsPiccClose
16.6.3 OsPiccResetCarrier
16.6.4 OsPiccPoll
16.6.5 OsPiccAntiSel
16.6.6 OsPiccActive
0 Success.
Return
Others Failed(Details refer to the return code list.)
The output data of PucRATS mainly includes the card frame waiting time,
Instruction
buffer size, maximum frame sizes, start-up frame guard time, etc. For details,
see the ‗EMV Contactless Book D V2.1‘ in section 5.7 and 6.4.
16.6.7 OsPiccTransfer
int iTxLen,
Prototype
unsigned char* pucRxBuff,
int *piRxLen );
Carry out the transparent transmission/reception in accordance with the
Function half-duplex communication protocol in the ISO14443-4
pucTxBuff【Input】 The data buffer to be transmitted.
iTxLen 【Input】 The length of data to be transmitted.
Parameters
pucRxBuff【Output】 Response data buffer of receiving card.
piRxLen 【Output】 The length of receiving card‘s response data.
0 Success
Return
Others Failed(Details refer to the return code list.)
Instruction
16.6.8 OsPiccRemove
16.6.9 OsMifareAuthority
Instruction
16.6.10 OsMifareOperate
unsigned charucSrcBlkNo,
Prototype
unsigned char*pucVal,
Do operations of reading and writing block for the specified blocks of Mifare
Function card, and increasing, decreasing or backup the specified data block of Mifare
card, and then update it into other specified value block.
‗r‘ or ‗R‘ represents read operations,
‗w‘ or ‗W‘ represents write operations,
ucOpCode 【Input】 ‗+‘ represents Increase value,
‗-‘ represents Decrease value,
‗>‘ represents transfer /backup operation.
ucSrcBlkNo【Input】 Specify the visiting block number.
If it is the read operation, pucVal outputs
the block contents, and points to the buffer
size of 16 bytes.
If it is the write operation, pucVal inputs
Parameters the block contents, and points to the buffer
size of 16 bytes.
pucVal【Input/Output】 If it is the ‗+‘or ‗-‘ operation, pucVal is
the first address of buffer, and points to
the buffer size of 4 bytes.
If it is the transfer operation, pucVal has
no practical meaning, but the incoming
pointer must be NULL.
16.6.11 OsPiccInitFelica
16.6.12 OsPiccIsoCommand
16.6.13 OsPiccSetUserConfig
16.6.14 OsPiccGetUserConfig
It has configured touch screen and RF reader on S300 and S800. When the RF card does the
A/B transaction, application developers should note that touch screen cannot be used during
the period. The remove card function should be called after finishing the transaction. When
operating Mifare card, it must call OsPiccRemove () or OsPiccClose () at last. When
operating Felica card, the RF module should be closed at last.
17 Communication Port
PORT_COM2 1 UART 2
PORT_COM3 2 UART3
17.2.1 OsPortOpen
ERR_DEV_NOT_E
The port does not exist.
XIST
ERR_INVALID_PA
Invalid parameter.
RAM
1. Other functions can be operated only after opening device successfully.
Instruction 2. Calling this function will close the functions of software flow control and
hardware flow control.
1. The prolin2.4 system uses the USB to start the XCB service
by default. When application needs to use the USB or serial
port, it should call OsRegSetValue ("persist.sys.xcb.enable",
"0") in mian() to close the XCB service in order to avoid the
resource conflict.
2. We can start the XCB service in these ways.
a) Call the OsRegSetValue("persist.sys.xcb.enable", "1") in
the main application;
b) Select a connection way among COM, USB and Network
in TM.
17.2.2 OsPortClose
Return None
Instruction This function should be called to close the device while program exit.
17.2.3 OsPortSend
int SendLen);
Function Sends data to the specified communication port.
Channel Please Refer to the Macro definition of communication port
RET_OK Success
ERR_DEV_NOT
Port is not open.
Return _OPEN
ERR_INVALID
Invalid parameter.
_PARAM
1. The buffer size is 8K, when the sent data is less than the free space of the
buffer, this function will not block and the sent data will only be stored in
Instruction the send buffer.
2. When calling OsPortClose(), the system will block until the send buffer
data has been sent out.
17.2.4 OsPortRecv
void *RecvBuf,
Prototype
int RecvLen,
int TimeoutMs);
Function Receives data from specified communication port.
Channel Please Refer to the Macro definition of communication.
RecvBuf【Output】 Received data buffering.
The data length that want to receive. When the length is
RecvLen
0, it means clear the receive buffer.
Parameters
Receive timeouts【unit:ms】
(The minimum precision is 100ms)
TimeoutMs
It should be <= 25500, otherwise, it will return
ERR_INVALID_PARAM.
>=0 The actual length of receive data.
ERR_DEV_NOT_
Port does not open.
Return OPEN
ERR_INVALID_P
Invalid parameter.
ARAM
1. The received data will return immediately when it is equal to the RecvLen.
Instruction 2. If did not reach the RecvLen, it will wait for timeouts.
17.2.5 OsPortReset
Parameters Channel 【Input】 Please Refer to the Macro definition list of communication
ports.
RET_OK Success
Instruction
17.2.6 OsPortCheckTx
Instruction
17.3 POSIX
17.3.1 Open
Opens the uart, and the device name are ttyAMA0, ttyAMA1, ttyAMA2, ttyAMA3.
int fd;
/* Open the uart with read-write access mode*/
fd = open(“/dev/ttyAMA1”, O_RDWR);
if(-1 == fd){
perror (“Open uart error!”);
}
17.3.2 Read
Read data from communication port.
char buff [1024];
int Len = 1024;
int readByte = read (fd, buff, Len);
17.3.3 Write
Write data to the communication port. (send)
char buffer [1024];
int Length = 1024;
int nByte;
nByte = write (fd, buffer, Length);
17.3.4 Close
Close communication port.
close(fd);
int remain;
int count;
/* Inquiry the number of bytes remained in send buffer */
ioctl(fd, TIOCOUTQ, &remain);
/* Inquiry the number of bytes which remained in receive buffer */
ioctl(fd, TIOCINQ, &count);
/* Set the baud rate, data bits, parity bits and stop bits of uart*/
int SetTermios (int fd, int nSpeed, int nBits, char cEvent, int nStop)
{
struct termios newtio, oldtio;
switch (cEvent)
{
case 'o':
newtio.c_cflag |= PARENB;
newtio.c_cflag |= PARODD;
newtio.c_iflag |= (INPCK | ISTRIP);
break;
case 'e':
newtio.c_iflag |= (INPCK | ISTRIP);
newtio.c_cflag |= PARENB;
newtio.c_cflag &= ~PARODD;
break;
case 'n':
newtio.c_cflag &= ~PARENB;
break;
}
/* Set the waiting time and the minimum number of characters, there is no
specific request for waiting time and receive characters ,and it can be set to 0
*/
newtio.c_cc[VTIME] = 0;
newtio.c_cc[VMIN] = 0;
18 MODEM
In Prolin, it can use the built-in UART to send AT commands to Modem and implement the
Modem communication functions; at the same time, it can encapsulate some Modem
communication interfaces for the developers to use.
MODEM_CONNECTED 0 Connected
MODEM_IDLE 11 Idle
Command of excommand() is
ERR_MDM_CMD_TOO_LONG -3109
too long, exceeded 100.
Calling synchronization
-3115 handshake receiving process 1
error
Calling synchronization
-3116 handshake receiving data
package error.
Calling synchronization
-3117 handshake receiving package
type error.
Calling synchronization
-3118 handshake receiving process 2
error
Calling synchronous
-3119 communication receiving
process 1 error
Calling synchronous
-3120
communication chip hang up
Calling synchronous
-3121 communication receiving
packet series number error
Calling synchronous
-3122 communication receiving
process 2 error
Calling synchronous
-3123
communication sent overload
Calling synchronous
-3124 communication sent under
load.
Calling synchronous
-3130 communication line rate is
illegal.
Calling synchronous
-3131 communication send state
packet 1 errors
Calling synchronous
communication sent data
-3132
packets retry more than the
specified time.
Calling synchronous
-3133 communication sent data
packets timeout
Calling synchronous
communication receiving the
-3134
acknowledgement packet retry
more than the specified time
Calling synchronous
-3135 communication sent stateful
packet 2 error
Calling synchronous
-3136 communication sent stateful
packet 3 error
Calling synchronous
-3137 communication sent stateful
packet 4 error
Calling synchronous
communication receiving data
-3138
packets retry more than the
specified time
Calling synchronous
-3139 communication sent stateful
packet 5 error
Calling synchronous
-3140 communication sent stateful
packet 6 error
Called synchronization
-3145 handshake sent handshake
packets failed
Called synchronization
-3146 handshake receiving
handshake packets failed
Called synchronization
-3147 handshake more than the
specified time.
Called synchronous
-3148 communication sent stateful
packet 1 error
Called synchronous
-3149 communication receiving
process 1 error
Called synchronous
-3150
communication chip hang up
Called synchronous
-3151 communication receiving
process 2 error
Called synchronous
-3152 communication receiving retry
more than the specified time
Called synchronous
-3153 communication sent stateful
packet 2 error
Called synchronous
-3154 communication sent data
packet error
Called synchronous
-3155 communication receiving
process 3 error
Called synchronous
communication receiving the
-3156
packet retry more than the
specified time
Called synchronous
-3157 communication sent stateful
packet 3 error
Calling connection
-3181 asynchronous line rate is
illegal
Non-pre-dial-up dial up
-3192 timeout
(300s)
Called synchronous
-3196 communication sent data
packet format error
Asynchronous communication
-3197 does not support the Connect
Format parameters
ST_MODEM_SETUP:
typedef struct {
int CallMode;
int CommMode;
int CodeType;
int CodeDuration;
int CodeSpacing;
int DetectLineVoltage;
int DetectDialTone;
int DialToneTimeout;
int CommaPauseTime;
char ConnectRate[20];
char ConnectFormat[20];
int ConnectTimeout;
int DialTimes;
int IdleTimeout;
int Pppom;
int Reserved[9];
}ST_MODEM_SETUP;
MODEM_COMM_SYN
synchronous
C
CommMode
MODEM_COMM_ASY
asynchronous
NC
The longest time to wait for the dial tone. Exit waiting when the dial
tone has been detected during this time.
Unit: 100ms, both the minimum value and default value are 20, valid
range is 20~50.
In both cases, waits 450 to 500ms to start starts the timer after hanging
up the machine.
CommaPauseTime ―,‖wait time when dial outside line (Unit: 100ms). This value will be set
according to the actual application environment. It is better to keep
interface of manually setting in the application. (Range is 0~255. The
range is not applicable to S800)
The valid range of S800 is 1~26s (Because of the modem patch, it is
inconsistent with the Datasheet)
ConnectRate[20] The rate of connection and communication(Expressed as a string
):
―4800‖//4800 bps
―7200‖//7200 bps
―9600‖//9600 bps
―12000‖//12000 bps
―14400‖//14400 bps
―19200‖//19200 bps
―24000‖//24000 bps
―26400‖//26400 bps
―28800‖//28800 bps
―31200‖//31200 bps
―33600‖//33600 bps
―48000‖//48000 bps
―56000‖//56000 bps
For null string "\ 0"and synchronous communication, the system will
select ―1200‖ by default.
―1200‖//1200 bps
―2400‖//2400 bps
―4800‖//4800 bps
―7200‖//7200 bps
―9600‖//9600 bps
―12000‖//12000 bps
―14400‖//14400 bps
―19200‖//19200 bps
―24000‖//24000 bps
―26400‖//26400 bps
―28800‖//28800 bps
―31200‖//31200 bps
―33600‖/33600 bps
―48000‖//48000 bps
―56000‖//56000 bps
Synchronous:
―1200‖//1200 bps
―2400‖//2400 bps
―9600‖//9600 bps
ConnectFormat[20 Format of connection and communication(Expressed as a string):
―8, n, 1‖
―8, e, 1‖
―8, o, 1‖
―7, e, 1‖
―7, o, 1‖
For null string "\ 0", the system will select―8, n, 1‖ by default.
Reserved[9] Reserved.
18.3 OsModemOpen
Parameters None
RET_OK Success
ERR_DEV_NOT_EXIST Device does not exist.
Return
ERR_DEV_BUSY Device is busy.
ERR_NO_PORT No communication port.
Other functions can be operated only after opening the device successfully. It
Instruction should call the OsModemSwitchPower() to power on the device before using
the Modem.
18.4 OsModemClose
Parameters None
Return None
This function can only close the modem that is opened by the local application.
Instruction When the modem device is not open, this function can‘t do any operation.
18.5 OsModemSwitchPower
RET_OK Success
18.6 OsModemConnect
18.7 OsModemCheck
Parameters None
MODEM_CONNECTING Dialing
MODEM_CONNECTED Connected
MODEM_IDLE Idle
ERR_MDM_BYPASS_BUSY The parallel line is busy.
Telephone line is not properly connected, or
ERR_MDM_LINE_BUSY
parallel line is occupied.
ERR_MDM_NO_ANSWER No response for dialing.
ERR_MDM_CALLEE_BUSY Line busy.
Return
Telephone line is not connected (Line voltage
ERR_MDM_NO_LINE
is 0).
ERR_MDM_NO_CARRIER Carrier wave of telephone lost.
ERR_MDM_RECVPOOL_N Receive buffer is not empty(received remote
OT_EMPTY data)
ERR_MDM_RECVPOOL_SE
Receive buffer is not empty (received remote
NDPOOL_BOTH_NOT_EMP
data), and the send buffer is sending data.
TY
ERR_DEV_NOT_OPEN Device is not open.
1. This function can be used to check whether communication has been
established or not by the pre-dial.
Instruction 2. After calling OsModemOpen(), OsModemHangup() or OsModemClose(),
the status of the last Modem dial will become: MODEM_IDLE.
18.8 OsModemExCmd
char *Rsp,
Prototype
int *RespLen,
int TimeoutMs);
Sets additional AT control command for OsModemConnect() to control the
Function connection behavior of Modem dialing.
Cmd 【Input】 Input AT control command.
Rsp 【Output】 Contents of response data.
Parameters
RespLen 【Output】 Length of response data.
TimeoutMs Waiting time for response.(unit:ms)
RET_OK Success
ERR_INVALID_PARAM Invalid parameter.
ERR_MDM_CMD_BUF_
Command buffer overflow.
FULL
Return ERR_MDM_CMD_TOO_
Command is too long.
LONG
ERR_MDM_CMD_NOT_ Does not support the command. (command that
SUPPORT begin with AT,S3,S7,WT=)
ERR_DEV_NOT_OPEN Device is not open.
1. The function is needed to be called before OsModemConnect(), and it is
only valid for the entire process of OsModemConnect().
2. While the function is executing, it will automatically hang up current
Instruction dialing or communication process.
3. The function can be called 100 times continuously. If it is more than 100,
the exceeding callings will be discarded and report error.
18.9 OsModemHangup
Parameters None
Return None
If dialing the number again right after hanging up, the Modem will wait and
Instruction start redialing after 3 seconds in order to allow PABX finish hanging up and
transmitting dialing tone.
18.10OsModemSend
18.11OsModemRecv
int Timeout);
18.12OsPppomLogin
int TimeOutMs);
Function Establishes the Modem PPP network link.
User name;
Length<=50 bytes;
Parameters Name 【Input】 It cannot be NULL.
For the 96169 background of ChinaTelecom, it can
enter any user name, and it must enter a character at
least.
Password;
Length<=50 bytes;;
Password 【Input】 It cannot be NULL.
For the 96169 background of ChinaTelecom, it can
enter any password, and it must enter a character at
least.
Authentication Algorithms;
Currently the following Authentication algorithms are
supported
PPP_ALG_PAP 0x1 PAP Authentication
Algorithm
PPP_ALG_CHAP 0x2 CHAP
Authentication
Algorithm
PPP_ALG_MSCH 0x4 MSCHAPV1
APV1 Authentication
Auth Algorithm
PPP_ALG_MSCH 0x8 MSCHAPV2
APV2 Authentication
Algorithm
PPP_ALG_ALL 0xff All Authentication
Algorithms
At least one type of authentication algorithm has to be
selected, more than one authentication algorithm will
also be allowed by using (+) or (|), for example,
PPP_ALG_PAP| PPP_ALG_CHAP. If the algorithm is
unknown, fill with parameter PPP_ALG_ALL.
Timeouts【unit:ms】;
The valid range is 0~3600000.
TimeOutMs If timeout is <0, it will automatically be set to 0.
If more than 360000. It will automatically be set to
3600000.
PPP_LOGINING In process
RET_OK The link established successfully.
ERR_INVALID_PAR
Invalid parameter
Return AM
ERR_NET_PASSWD wrong password
ERR_NET_SERVER
Server is busy, communication failed.
_BUSY
1. Before using this function, call OsModemConnect() first and set the
ST_MODEM_SETUP.Pppom to 1, also it doesn‘t need to call
OsModemOpen();
Instruction 2. TimeOutMs=0 means return immediately,
3. Call OsPppomCheck() to check the link status
4. The login time may vary from settings to settings of ST_MODEM_SETUP
parameters. The modem chip of S800 supports up to 33600 asynchronous
PAX Computer Technology (Shenzhen) Co., Ltd. 172
Prolin API Programming Guide
baud rate, dial-up while the setting is less than or equal to 33600, there will
be a low re-training rate and high success rate.
5. For the 96169 background (Guidway A8010), if a re-training is occurred
and the time period after sending number is more than 20 seconds, then the
background communication will no longer confirm to ppp protocol, which
will end up in failure.
6. After the link has been set up successfully, it can communicate through the
IP network communication function.
7. In the process of dialing, when users want to hang up by pressing the cancel
button, the methods of operation are as follows: Application porting a thread
and take the key, if it is the cancel key, perform OsPppomLogin ("a", "a", 1,
-1), the first 3 parameters should be filled in accordance with the
requirements, and the fourth parameter must be set to -1, then ModemPPP
will hang-up and automatically logout.
18.13OsPppomCheck
PPP_LOGOUTING
In disconnection state
PPP_LOGINING In process
RET_OK Established the link successfully.
Return
ERR_NET_PASSWD wrong password
Already called OsPppomLogout() to
ERR_NET_LOGOUT
disconnect the link.
ERR_NET_IF Link has been disconnected.
Instruction
18.14OsPppomLogout
19 Network
Communication
Prolin uses the unified TCP/IP stack to manage different physical connections. For the
network communications programming, it provides a standard socket programming (socket).
/* Server code in C */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(void)
{
struct sockaddr_in stSockAddr;
int SocketFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if(-1 == SocketFD)
{
perror("cannot create socket");
exit(EXIT_FAILURE);
}
memset(&stSockAddr, 0, sizeof(stSockAddr));
stSockAddr.sin_family = AF_INET;
stSockAddr.sin_port = htons(1100);
stSockAddr.sin_addr.s_addr = INADDR_ANY;
for(;;)
{
int ConnectFD = accept(SocketFD, NULL, NULL);
/* Client code in C */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main(void)
{
struct sockaddr_in stSockAddr;
int Res;
int SocketFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (-1 == SocketFD)
{
perror("cannot create socket");
exit(EXIT_FAILURE);
}
memset(&stSockAddr, 0, sizeof(stSockAddr));
stSockAddr.sin_family = AF_INET;
stSockAddr.sin_port = htons(1100);
Res = inet_pton(AF_INET, "192.168.1.3", &stSockAddr.sin_addr);
if (0 > Res)
{
perror("error: first parameter is not a valid address family");
close(SocketFD);
exit(EXIT_FAILURE);
}
else if (0 == Res)
{
perror("char string (second parameter does not contain valid
ipaddress)");
close(SocketFD);
exit(EXIT_FAILURE);
}
shutdown(SocketFD, SHUT_RDWR);
close(SocketFD);
return EXIT_SUCCESS;
}
19.2 UDPprogramming
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
int main(void)
{
int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
struct sockaddr_in sa;
char buffer[1024];
ssize_t recsize;
socklen_t fromlen;
for (;;)
{
printf ("recv test....\n");
recsize = recvfrom(sock, (void *)buffer, sizeof(buffer), 0, (struct sockaddr
*)&sa, &fromlen);
if (recsize < 0) {
fprintf(stderr, "%s\n", strerror(errno));
exit(EXIT_FAILURE);
}
printf("recsize: %z\n ", recsize);
sleep(1);
printf("datagram: %.*s\n", (int)recsize, buffer);
}
}
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>
20 Network Configuration
Prolin provides the interface for network configuration, including ARP settings, Ping services,
DNS configuration, network card configuration, DHCP service, routing settings and PPPoE
service etc.
Macro Description
NET_LINK_ETH Ethernet
All of the macro values listed in the above table are positive
integers, and they are greater than 0.
For more Details, refer to osal.h.
20.3.1 OsNetAddArp
Instruction
1. Static ARP table is used to resist the attack from ARP Cheat,
2. If there is no static ARP table, the system will dynamically
obtain, and it doesn’t need to be configured by the
application.
20.3.2 OsNetPing
20.3.3 OsNetPingEx
20.3.4 OsNetDns
int TimeOutMs);
Analyzes the IP address corresponding to the domain name and stores the
Function results in Addr parameter.
Information of domain name, for example:
[www.sina.com.cn].
Name【Input】
The maximum length cannot be NULL and cannot
exceed255 characters.
It is an output parameter;
Parameters Use to store the IP address, mapped by the domain name,
the format is ―XXX.XXX.XXX.XXX‖, XXX represents
Addr【Output】
0~255,e.g:‖192.168.0.3‖;
It cannot be NULL; there are at least 16 bytes in the
space.
TimeOutMs Timeout【unit:ms】, the valid range is 1000~3600000
RET_OK Success
The Link is unavailable, means the link has not been set
ERR_NET_IF
correctly (or has been disconnected).
ERR_INVALID_P
Return Invalid parameter
ARAM
ERR_TIME_OUT Timeout.
The domain server cannot analyze the corresponding
ERR_NET_DNS
domain, or it does not exist.
Use the default route to do the communication, and searching the route can be
Instruction done by calling OsNetGetRoute().
20.3.5 OsNetSetConfig
Instruction 1. After calling successfully, the system will stop the DHCP function.
2. The function does not check the matching relationship between Addr,
Mask and Gateway; it only checks the validity of their formats.
3. Wireless link, PPPoE, and ModemPPP can only be dynamically
allocated and cannot be configured by this interface.
4. After setting the configuration successfully, this link will be set to be
the default route.
20.3.6 OsNetGetConfig
char *Addr,
char *Gateway,
char *DNSServer);
Gets the network configuration information, such as IP, subnet mask, gateway
Function and DNS.
Physical channel can only be set to Ethernet and WIFI;
NET_LINK_ETH Ethernet;
NetLink
NET_LINK_WIFI WIFI(Wireless Local Area
Network)
The address used by POS is an Output parameter. There are
at least 16 bytes in the space. The format is
Addr【Output】 ―XXX.XXX.XXX.XXX‖, XXX represents 0~255;
e.g.: ―192.168.0.3‖;
It can be NULL.
Mask code used by POS is an Output parameter. There are
at least 16 bytes in the space.
Mask【Output】 Format is ―XXX.XXX.XXX.XXX‖;
e.g.: ―255.255.255.0‖;
Parameters It can be NULL.
Address of the default gateway is an Output parameter.
There are at least 16 bytes in the space.
Gateway Format is ―XXX.XXX.XXX.XXX‖, XXX represents
【Output】 0~255;
e.g.: ―192.168.0.1‖;
It can be NULL.
DNS server address is an Output parameter. There are at
least 16 bytes in the space.
DNSServer Format is ―XXX.XXX.XXX.XXX‖, XXX represents
【Input】 0~255;
e.g.: ―192.168.0.1‖;
It can be NULL.
RET_OK Success
Return The link is unavailable, means the link has not been set
ERR_NET_IF
correctly.
Instruction
When Addr, Mask, Gateway and DNS Server return the string as
“ ”, that means there is no configuration.
20.3.7 OsNetStartDhcp
20.3.8 OsNetCheckDhcp
ERR_NET_DHCP
DHCP Server has not been found.
_DISCOVER
ERR_NET_DHCP
DHCP cannot be assigned the IP address.
_OFFER
ERR_NET_DHCP
DHCP does not start.
_START
Instruction
20.3.9 OsNetStopDhcp
Return None
1. After the DHCP function stops, the application needs to re-configure the
network using OsNetSetConfig ();
Instruction 2. After DHCP, the system will regularly update the configuration
information, when the update fails, it will cause the network become
unusable.
20.3.10 OsNetSetRoute
Instruction 3. It is allowed to switch only when the default route has been set up,
otherwise return ERR_NET_IF.
20.3.11 OsNetGetRoute
Parameters None
Instruction 2. Any link that has been set up successfully will be configured as the
default route. When the last used link is being logged off, it will delete
this route. At this time, call OsNetSetRoute to reconfigure .
20.3.12 OsPppoeLogin
int TimeOutMs);
Function PPPoE link Login.
User name;
Cannot exceed 50 bytes
Name【Input】
Cannot be NULL, if there is no password, use an null string
― ‖;
Password;
Parameters
Password【Input】 Cannot exceed 50 bytes
Cannot be NULL, if there is no password, use ― ‖;
Timeout,【unit:ms】
TimeOutMs
The valid range is 0~3600000;
NET_DOING Logging
20.3.13 OsPppoeCheck
Parameters None
NET_DOING Logging
20.3.14 OsPppoeLogout
Parameters None
Return None
Instruction
21 GPRS/CDMA
Prolin provides supports for GPRS and CDMA, for the utility and configuration of these
wireless modules. It also provides a series of APIs for application developers to use.
21.2.1 OsWlLock
Parameters None
21.2.2 OsWlUnLock
Parameters None
Return None
Instruction
21.2.3 OsWlInit()
Instruction 1. Before using this function, make sure to call OsWlLock() successfully.
21.2.4 OsWlSwitchPower
21.2.5 OsWlSwitchSleep
Others: Errors.
RET_OK Success
ERR_DEV_NOT_EXIST Module does not exist.
Return
ERR_DEV_NOT_OPEN Fail to call Os WlLock().
ERR_WL_PPP_ONLINE PPP is on line.
Instruction Reserved interface and it is not yet supported.
21.2.6 OsWlGetSignal
Parameters None
Represents the signal strength, the higher the
0~5 number, the stronger the signal, 0 means no
signal and 5 represents the strongest signal.
Return ERR_DEV_NOT_EXIST Module does not exist.
ERR_NO_PORT Not enough physical uart.
ERR_WL_POWER_ONING Module is power on.
1. It doesn‘t need to call OsWLock() when use this function;
2. When the wireless link is not established, this API will get the signal
values from the module through AT commands;
Instruction 3. OsWlGetSignal() can‘t obtain the current signal strength and returns
‗ERR_WL_RSPERR‘ after a wireless link established by calling
OsWlLogin(). In this time, module is in the data exchange mode, can‘t get
the real-time signal.
21.2.7 OsWlCheck
Parameters None
PPP_LOGOUTING Link disconnecting.
21.2.8 OsWlLogin
int TimeOutMs,
int KeepAlive,
int ReserParam);
Function Log in on the wireless network and set up a wireless link.
APN – Access Point Name for GPRS communication,
dialing number for CDMA.
Length <= 50 characters;
APN 【Input】
When pointer points to NULL, the application should
dial-up first and the protocol stacks directly log in on
PPP.
User name;
Length <= 50 bytes;
Name 【Input】
It cannot be NULL, if there is no user name, replace it
with an empty string ― ‖;
Parameters
Password;
Length <= 50 characters;
Password 【Input】
It cannot be NULL, if there is no password, replace it
with an empty string ― ‖;
The supported authentication algorithms
PPP_ALG_PAP 0x00000001 PAP
Auth authentication
algorithm
PPP_ALG_CHAP 0x0000000 CHAP
authentication
algorithm
PPP_ALG_MSCH 0x00000004 MSCHAPV1
APV1 authentication
algorithm
PPP_ALG_MSCH 0x00000008 MSCHAPV2
APV2 authentication
algorithm
PPP_ALG_ALL 0xff All
algorithms
are supported
At least one type of authentication algorithm has to be
chosen; or choose more than one authentication
algorithm by using (+) or (|), for example,
PPP_ALG_PAP| PPP_ALG_CHAP. If the algorithm is
unknown, fill it with PPP_ALG_ALL.
Timeout,【unit:ms】;
TimeOutMs The valid range is 0~3600000; if it is <0, automatically
set it to 0, if more than 360000, automatically set it to
3600000.
Interval for link check, unit is ms;
The valid range is 10000~3600000;
KeepAlive If the link is longer than KeepAlive time but without
any messages; the system automatically starts the link
check interval;
ReserParam Reserved parameter, used for extension.
PPP_LOGINING In process
PPP_LOGOUTING The wireless module is logging out.
RET_OK Set up link successfully.
ERR_DEV_NOT_E
Wireless module does not exist.
XIST
ERR_DEV_NOT_O
Performing OsWlLock() failed
PEN
ERR_INVALID_PA
Invalid parameter.
RAM
Return
ERR_WL_POWER
Module is powered on.
_ONING
ERR_WL_POWER
Module is powered off.
_OFF
ERR_WL_NOT_IN
Initialization failed.
IT
ERR_NET_PASSW
Password is incorrect.
D
ERR_NET_SERVE
Server is busy, communication failure.
R_BUSY
21.2.9 OsWlLoginEx
_OFF
ERR_WL_NOT_IN
Initialization failed.
IT
ERR_NET_PASSW
Password is incorrect.
D
ERR_NET_SERVE
Server is busy, communication failure.
R_BUSY
1. This function is similar to OsWlLogin(), when DialNum is NULL, the two
functions have the same functionality.
2. Before using this function, make sure to call OsWlLock() successfully.
3. When TimeOutMs=0,it means return immediately;
4. Calling OsWlCheck() to check the link status;
5. For different modules and different network environments, the login time
Instruction will be different; if the login did not complete in 60 seconds, it means
login failure or the module has an exception error.
6. Unsuccessful login for three consecutive times, it indicates the module has
no response, the application must call OsWlSwitchPower() to reset the
module.
7. After the link has been set up successfully, the link will be set to be the
default route and communication can be done through the IP network
communication function.
21.2.10 OsWlLogout
Parameters None
PPP_LOGOUTING The link is being disconnected
ERR_DEV_NOT_OPEN Fail to call OsWlLock().
1. Before using this function, make sure to call OsWlLock() successfully.
2. After calling this function, OsWlCheck() should be called to check the status
Instruction of the logout. Only when ERR_NET_LOGOUT is returned does that mean
disconnecting the link successfully.
21.3.1 OsWlSelSim
22 WIFI
RET_CONNECTING 1 Connecting
Authentication Modes:
enum WIFI_AUTH_MODE{
AUTH_NONE_OPEN=1,
AUTH_NONE_WEP,
AUTH_NONE_WEP_SHARED, /* The mode will be scanned as
AUTH_NONE_WEP */
AUTH_IEEE8021X,
AUTH_WPA_PSK,
AUTH_WPA_EAP,
AUTH_WPA_WPA2_PSK,
AUTH_WPA_WPA2_EAP,
AUTH_WPA2_PSK,
AUTH_WPA2_EAP
};
Connect to AP settings:
22.4 OsWifiOpen
Parameters None
RET_OK Success
Return
ERR_DEV_NOT_
Driver loading exception or module error.
EXIST
ERR_BATTERY_
Battery does not exist.
ABSENT
For D200 and S920 POS models, the battery must be installed in order to operate
Instruction the Wifi, otherwise ERR_BATTERY_ABSENT will be returned.
22.5 OsWifiClose
Parameters None
Return None
Instruction
22.6 OsWifiSwitchPower
RET_OK Success
ERR_INVALID_P
Invalid parameter
ARAM
Return ERR_DEV_NOT_
Driver loading exception or module error.
EXIST
ERR_DEV_NOT_
Fail to access to the WIFI device.
OPEN
The module will automatically power on after the boot, it doesn‘t need to call this
Instruction function.
Reserved interface and it is not yet supported.
22.7 OsWifiScan
ERR_MEM_FAU
Memory error
LT
ERR_INVALID_P
Invalid parameter
Return ARAM
ERR_WIFI_POW
WIFI module is powered off.
ER_OFF
ERR_DEV_NOT_
Fail to access to the WIFI device.
OPEN
/*For example:*/
int i, num;
ST_WifiApInfo * Aps;
num = OsWifiScan (&Aps);
Instruction
if(num <= 0)
return -1;
for(i=0; i<num; i++)
printf("[%d] AP name: %s\n", i, Aps[i].Essid);
22.8 OsWifiConnect
RET_OK Success
RET_CONNECTING Connecting
ERR_AUTH_SEC_MOD
Authentication mode or encryption mode error
E
ERR_WIFI_POWER_OF
WIFI module is powered off.
F
ERR_INVALID_PARA
Invalid parameter
M
22.9 OsWifiDisconnect
Parameters None
RET_OK Success
Return
ERR_DEV_NOT_OPEN Fail to access to the WIFI device.
Instruction
22.10OsWifiCheck
int *Rssi);
Gets the current status of WIFI. If the connection is successful, it can get the
Function ESSID, BSSID and signal strength of AP through the parameters.
Parameters Bssid 【Output】 The size is 20-byte, and it also can be NULL.
RET_CONNECTIN
Connecting
G
ERR_NOT_CONN No connection to the network
ECT
ERR_WIFI_BAD_S WIFI signal is bad.
IGNAL
Return
ERR_NOT_FOUN Has not fount AP
D_AP
ERR_NET_PASSW Password error
D
ERR_AUTH_SEC_ Authentication mode or encryption mode error
MODE
ERR_INVALID_PA
Invalid parameter.
RAM
1. It does not need to call OsWifiOpen() before calling this interface.
2. It returns ERR_NOT_ CONNECT only in the following cases:
a) OsWifiConnect() has not been invoked by any application,
b) The connection time exceeds 90 seconds in IBSS mode,
Instruction
c) OsWifiDisconnect() has been invoked by an application and
returns RET_OK.
3. If the connection fails in Station mode, it returns values other than
ERR_NOT_ CONNECT.
22.11OsWifiCmd
int Argc,
char *Result,
int Len);
Send commands to the WPA_Supplicant back-end service, and then obtain the
Function return results.
Commands supported by WPA_Supplicant, it can‘t be
Argv 【Input】
NULL.
t Argv two-dimensional array that used to store the number
Argc 【Input】
of commands or parameters
Parameters
Return result of WPA_Supplicant, it can‘t be NULL, and
Result 【Output】
the size must be at least 2048 bytes.
ERR_INVALID_P
Invalid parameter.
ARAM
Return
ERR_WIFI_POW
WIFI module is power off.
ER_OFF
ERR_DEV_NOT_
Fail to access to the WIFI device.
OPEN
1. Argv represents all the commands and parameters that supported by
WPA_Supplicant, such as ‗SCAN‘ command.
2. If Argv only has one command, Argc=1.
Instruction
3. It's worth noting that this function is invoked only when other WIFI APIs
cannot meet requirements.
4. Result is the original return value of WPA_Supplicant.
23 File System
To access the file system, use the standard ANSI.C to operate API. For more details about
real-time operation, please refer to<stdio.h>. It is allowed to
use the standard POSIX interface to get the access.
24 System Information
In Prolin, the system messages generated by the hardware device are implemented by
asynchronous notification. The system provides two kinds of hardware system messages,
magnetic cards and IC cards.
SIGMAG
SIGICC
The SIGMAG is only valid when the magnetic stripe reader device is open.
EXAMPLE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>
#include <osal.h>
#include <cutils/log.h>
#define printf(...) LOGI(__VA_ARGS__)
while(1){
ret = sigwait(&mask, &signo);
if(ret != 0){
printf("sigwait err, ret=%d\n", ret);
break;
}
switch(signo){
case SIGMAG:
printf("Capture msr signal\n");
break;
case SIGICC:
printf("Capture icc signal\n");
break;
default:
printf("Capture other signal %d\n", signo);
break;
}
}
}
int main()
{
int ret;
sigset_t oldmask;
pthread_t tid;
ret = OsMsrOpen();
if (ret < 0)
exit(-1);
ret = OsIccOpen(ICC_USER_SLOT);
if (ret < 0){
OsMsrClose();
return -1;
}
sigemptyset(&mask);
sigaddset(&mask, SIGMAG);
sigaddset(&mask, SIGICC);
pthread_join(tid, NULL);
OsMsrClose();
OsIccClose(ICC_USER_SLOT);
}
25 Audio
The speaker volume of Prolin is divided into five levels, ranging from 0 to 4,
0 means mute. In general, the volume setting is unified, and it can set in the TM interface.
25.1 OsPlayWave
EXAMPLE
int fd, ret = 0;
char *buff;
int len;
struct stat state;
stat(FILENAME, &state);
len = state.st_size;
fd = open(FILENAME, O_RDONLY);
if(fd<0)
printf("Open File Fail\n");
close(fd);
free(buff);
26 Barcode
26.2 OsScanOpen
Parameter None
26.3 OsScanRead
26.4 OsScanClose
Parameter None
Return None
Instruction
27 Power Management
27.1 OsCheckBattery
Parameters None
BATTERY_LEVEL_3 40%~70%battery
BATTERY_LEVEL_4 70%~100%battery
27.2 OsCheckPowerSupply
Parameters None
Instruction
27.3 OsSysSleep
Parameters None
RET_OK Success
Return
ERR_SYS_NOT_SUPPORT System does not support this function.
The system will enter sleep mode by calling this function, otherwise, it never
Instruction sleep.
In sleep mode, CPU stops running and the screen is black; Terminal could be
awakened up by pressing key, the contents displayed in the screen are the same
as before calling this function. System continues running at the breakpoint which
was made before sleep. It is not recommended to hibernate during using RF card,
if so, after wake up, it must call OsPiccClose() firstly, and then call
OsPiccOpen() and other cards operations.
27.4 OsSysSleepEx
Make the POS terminal enter different levels of sleep mode, and
Function
reduce the power consumption.
Sleep level, value range is [0, 2].
0: System runs normally;
1: Screen save mode.
CPU works well, specific performance in turning
Level the LCD, key backlight, touch key, touch
Parameters
【Input】 screen off. You also can wake up them by
plastic button.
2: System hibernation.
CPU stops working, modules can only
be awakened by plastic button.
RET_OK Success
ERR_INVALID
Invalid parameter
Return _PARAM
ERR_SYS_NO
System hibernation is not Supported.
T_SUPPORT
1. When Level=2, it is equivalent to calling the OsSysSleep();
2. The opened handle will not be closed in any sleep level.
3. The current working state of cards and communication modules
will not be changed in level 0 and level 1. In level 2, the modules
Instruction other than plastic button will be closed.
4. Under normal operation, it will enter the screen save mode if there
is no input event within the default interval of one minute. The
interval can be set by persist.sys.backlighttime(unit: minute), when
persist.sys.backlighttime = 0, it means turn off the screensaver.
27.5 OsReboot
Parameters None
Instruction
27.6 OsPowerOff
Parameters None
Instruction
Bit
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64
where
N = PIN length: 4-bit binary number with permissible values of 0100(4) to 1100(12);
P/F = PIN/Fill digit: designation of these fields is determined by the PIN length field;
Bit
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64
where
0 = Pad digit: a 4-big field with the only permissible value of 0000(zero);
A1…A12 = Account number: content is the 12 rightmost digits of the primary account
number (PAN) excluding the check digit. A12 is the digit immediately preceding the PAN‘s
check digit. If the PAN excluding the check digit is less than 12 digits, the digits are right
justified and padded to the left with zeros. Permissible values are 0000 (zero) to 1001 (9).
This PIN block is constructed by concatenation of two fields: the plain text PIN field and the
transaction field.
The format 1 PIN block should be used in situations where the PAN is not available.
Bit
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64
where
N = PIN length: 4-bit binary number with permissible values 0100(4) to 1100 (12);
P = PIN digit: 4-bitfield with permissible values 0000 (zero) to 1001 (9);
P/T = PIN/Transaction digit: designation of these fields is determined by the PIN length field;
T = Transaction digit: 4-bit binary number with permissible values of 0000 (zero) to 1111
(15).
PAX Computer Technology (Shenzhen) Co., Ltd. 226
Prolin API Programming Guide
The transaction field is a binary number formed by [56-(N*4)] bits. This binary shall be
unique (except by chance) for every occurrence of the PIN block and can, for example, be
derived from a transaction sequence number, time stamp, random number or similar.
The transaction field should not be transmitted and is not required in order to translate the PIN
block to another format since the PIN length is known.
The format 3 PIN block is the same as format 0 PIN block except for the fill digits.
This PIN block is constructed by modulo-2 addition of two 64-bit fields: the plain text PIN
field and the account number field. The formats of these fields are described in 1.4.2 and 1.4.3
respectively.
Bit
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64
where
N = PIN number: 4-bit binary number with permissible values of 0100 (4) to 1100 (12);
P = PIN digit: 4-bit field with permissible values of 0000 (zero) to 1001 (9);
P/F = PIN/Fill digit: designation of these fields is determined by the PIN length field;
F = Fill digit: 4-bit field, with values from 1010(10) to 1111(15), where the
Fill-digit values are randomly or sequentially selected from this set of six possible values,
such that it is highly unlikely that the identical configuration of fill digits will be used more
than once with the same account number field by the same PIN encipherment device.
Bit
1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 64
For more details related to PIN Block format please refer to ISO 9564-1:2002(E).
System configuration
Note
name
ro.fac.ubootver Uboot version information
ro.fac.hwver Hardware version number. Main board- Interface board.
ro.fac.mach Product type name.
The information about the product ‘boardid’includes the
ro.fac.boardid
product model type and hardware version number ect.
ro.fac.conf.ver Version information of configuration files.
ro.fac.pn PN number
ro.fac.sn SN number
The current system Prolin debug_level information. Values of
ro.fac.prolin_debug_level release version system and debug version system are 0 and 1
respectively.
ro.fac.eth Whether there is network cable.(0- does not exist, 1- exist)
Whether there is the main device interface.(0- does not exist, 1-
ro.fac.usb.host
exist)
Whether there is an USB device interface.(0- does not exist, 1-
ro.fac.usb.device
exist)
Whether there is an USB OTG interface.(0- does not exist, 1-
ro.fac.usb.otg
exist)
ro.fac.leddt Whether there is LED digital tube.(0- does not exist, 1- exist)
Key types.(0- have no keys, 1- indicates the presence of
ro.fac.keybroad physical buttons, 2- indicates the presence of a touch-screen
buttons)
ro.fac.buzzer Whether there is a Buzzer module.(0- does not exist, 1- exist)
ro.fac.simsocket The number of SIM card slot.
ro.fac.battery Whether there is a battery.(0- does not exist, 1- exist)
Name of WIFI module.(If none, it means does not exist by
ro.fac.wifi
default)
Name of Bluetooth module. (If none, it means does not exist by
ro.fac.bt
default)
Wireless module information, and the parameter information is
ro.fac.radio optional. It needs to isolate when there are multiple wireless
modules. (If none, it means does not exist by default)
Name of Modem module. (If none, it means does not exist by
ro.fac.modem
default)
Name of Printer module. (If none, it means does not exist by
ro.fac.printer
default)
PAX Computer Technology (Shenzhen) Co., Ltd. 230
Prolin API Programming Guide
Thread √ √ √ √
System √ √ √ √
Function
Encryption and √ √ √ √
Decryption
PED √ √ √ √
Keyboard √ √ √ √
Touch Screen √ NA √ NA
Signature Pad √ NA √ NA
Printer NA √ √ NA
Font Library √ √ √ √
Code √ √ √ √
MSR √ √ √ √
ICC Reader √ √ √ √
RF Reader √ √ √ √
File System √ √ √ √
System √ √ √ √
Information
Audio √ √ √ N/A