Prolin API Programming Guide (V2.4.0)
Prolin API Programming Guide (V2.4.0)
Guide
V 2.4.0
Copyright © 2000-2020 PAX Computer Technology (Shenzhen) Co., Ltd. All rights
reserved. Any part of this documentation is strictly prohibited to be reproduced or
distributed in any form or for any purpose without the prior written permission of PAX
Computer Technology (Shenzhen) Co., Ltd. Despite the effort to enhance the
accuracy of this documentation, there are possible errors or omissions left herein. The
content of this documentation is subject to change without further notice. The
examples and sample programs demonstrated in this manual are for illustrations only
and may fail to meet practical needs. Please test and verify their applicability before
putting into commercial use.
I
History of Revisions
Date Version Note Author
1. Exported the original version of
2012-08-15 V1.0.0 Prolin Team
Prolin from WIKI.
2012-11-06 V1.0.1 1. Internal review and modification. Prolin Team
1. Added Return Code List in
system function;
2. Added a new interface:
2012-12-26 V1.0.2 OsVerifySignExternal(); Prolin Team
3. Added WiFi module;
4. Added Appendix registry table.
2013-02-20 V1.0.3 Added instruction of OsOpenFont (). Prolin Team
1. Modified the instruction of
OsModemOpen();
2. Added two return values in
Modem: -3219 and -3220;
3. Added notes of DetectDialTone;
2013-03-06 V1.0.4 Added a new interface: Prolin Team
OsModemSwitchPower();
4. Modified parameter description
of OsPrnOpen() to “support bmp
format only”;
5. Modified sci_get_fd ().
1. Modified the description of
Chapter 4.10 “S series do not
support this function as S model
has no landline”;
2. Modified open() node in Chapter
14.4.1;
3. Updated time setting code
“pow-hwclock –w” to
2013-04-17 V1.0.5 Prolin Team
“pow-hwclock –w –u”;
4. Updated instruction of
OsWlInit(): When return value is
ERR_WL_NOSIM, some
functions can be used without an
SIM card;
5. Updated the instruction of
OsCheckBattery ().
II
2. Supplemented the description of
Time Delay;
3. Added description of Registry
Table;
4. Modified the parameter
description of
ValueinOsRegGetValue ();
5. Modified the parameter
description of ShaOut in OsSHA
();
6. Updated description of GUI;
7. Added “1200, V22” and“2400,
FC” to the parts of synchronous
variable of ConnectRate[20]
inMODEM.
1. Modified the Registry;
III
OsPedDesDukpt();
2. Modified the value ranges of
several parameters in chapter
PED;
3. Modified the parameter
description of ucATQ0 in
OsPiccAntiSel();
4. Deleted OsPiccGetParam() and
OsPiccSetParam();
5. Updated the instruction of
OsRegGetValue();
6. Added description of
OsPortOpen();
7. Added description of
OsSysSleep();
8. Updated Return Code List in
Network Configuration chapter;
9. Added instruction of OsNetDns().
1. Modified Appendix 4;
2. Modified the instruction of
OsWlSelSim();
3. Added a new return value
forOsMsrOpen();
4. Added new interfaces
OsWlLoginEx(), OsMount() and
OsUmount();
5. Added chapter 26 Barcode;
6. Added description of AES
2014-02-25 V2.0.1 functional interface; Prolin Team
7. Modified the parameter
description of Name in
OsInstallFile();
8. Added an error code
“ERR_APP_MODE” for
OsInstallFile();
9. Added a new interface
OsCheckPowerSupply();
10. Deleted invalid codes in chapter
7 LCD for upgraded Prolin-2.4.
1. Updated OsSysSleep();
2014-03-04 V2.0.2 Prolin Team
2. Updated the WiFi module.
Modified the description of WiFi
2014-03-24 V2.0.3 Prolin Team
module.
1. Updated WiFi module;
3. Added a new interface
2014-04-16 V2.0.4 OsSysSleepEx(); Prolin Team
4. Removed MountFlag’s support
to MS-MOVE in OsMount();
IV
5. Added new interfaces
OsReboot() and OsPowerOff().
1. Modified the instruction of
OsPrnSetIndent();
2. Modified functionality description
of OsModemCheck();
3. Modified parameter description
of TimeoutMS in OsPortRecv();
4. Modified value range of Volume
in OsPlayWave();
2014-06-03 V2.0.5 Prolin Team
5. Modified parameter description
of OsMifareOperate();
6. Added the corresponding
relationship between device
node and serial port.
7. Updated the instruction of
OsWlSwitchSleep() and
OsWifiSwitchPower().
1. Updated the instruction of
OsLog();
2. Updated the return value of
OsPedSetInterval();
3. Added a new interface
OsPedCancelPinEntry();
2014-07-10 V2.0.6 4. Added new return values of Prolin Team
OsVerifySign() and
OsVerifySignExternal();
5. Updated the instruction of
OsCheckBattery();
6. Updated Appendix 3 and
Appendix 4.
1. Updated the return value
PPP_LOGOUTING in
OsWlLogin() and add
corresponding instruction;
2014-10-09 V2.0.7 Prolin Team
2. Modified int OsWifiClose(void) to
void OsWifiClose(void);
3. Modified device nodes of LCD,
keypad and touch screen.
1. Modified the instruction of
OsRunApp();
2. Added U disk file format limitation
2014-11-26 V2.0.8 in OsMount(); Prolin Team
3. Added the instruction of
parameter Channel about S920
model in OsPortOpen();
4. Modified the instruction of
V
OsNetPing();
5. Modified the instruction of
OsNetDns();
6. Added the instruction of
OsNetSetConfig();
7. Added the instruction of
OsNetStartDhcp();
8. Modified the functionality of
OsNetSetRoute()and added a
new return value;
9. Modified functionality, return
value and instruction of
OsNetGetRoute();
10. Modified the instruction of
OsPppoeLogin();
11. Modified the instruction of
OsWILogin();
12. Modified the instruction of
OsWILoginEx();
13. Added sampling frequency
limitation of WAVE file in
OsPlayWave();
VI
2. Modified the instruction of
OsPedSetInterval();
3. Updated the parameter
description of DataIn in
OsPedUpdatePinBlock();
4. Modified the instruction of
OsPedDesDukpt();
5. Modified parameter description of
DataInLen in
OsPedRsaRecover();
6. Modified Appendix 1;
VII
that the battery power of D200 or
S920 gets too low (<3.65V);
3. Added the instruction of
OsPedWriteRsaKey();
4. Supplemented the instruction of
OsSysSleep();
5. Added and modified some codes
of user configuration structure:
PCD_USER_ST;
6. Modified parameter description
of PUKType in OsVerifySign();
7. Added some codes in TCP
programming;
8. Modified the instruction of
OsInstallFile();
9. Added the instructionof PX7
andPX5 in OsPortOpen();
10. Supplemented the instruction of
Prolin-2.4 and Prolin-phoenix-2.5
in OsPedWriteKey();
11. Added some descriptions of PX5
and PX7 in chapter POSIX
Interface;
12. Added PXX model in Appendix 4.
1. Added a return value
ERR_PUK_NOT_EXIST in the
chapter of System Function;
2. Added the instruction of
OsMount();
3. Added the instruction of
OsUmount();
4. Addedthe macro of SM (Secure
Module) key in the chapter of
PED;
5. Added the SM part in
OsPedWriteKey() function;
2015-11-24 V2.1.3 6. Added nine functions in the Prolin Team
chapter of PED, including
OsPedGenSM2Pair(),
OsPedWriteSM2Key(),
OsPedSM2Sign(),
OsPedSM2Verify(),
OsPedSM2Recover(),
OsPedSM(), OsPedSM(),
OsPedGetMacSM(), and
OsPedGetPinBlockSM4();
7. Added two new return values
ERR_MSR_END_ZEROERR
and
VIII
ERR_MSR_PED_DECRYPTER
R in the chapter of MSR;
8. Added new return values in
Return Code List and added
PPP_DIRECT link in Physical
Channel List in the chapter of
Network Configuration;
9. Added a return value
ERR_MODE_NOT_SUPPORT
in the chapter of WiFi;
10. Added return value and
instruction in OsSysSleep ();
11. Added return value and
instruction in OsSysSleepEx().
1. Updated the instruction of
OsMount();
2. Updated the instruction of
OsUmount();
3. Added a return value and
instruction in
OsFirmwareUpgrade();
4. Added introduction of three-level
key system and PED key
mechanism in PED chapter;
5. Added OsGetOptInfo() and its
corresponding data structure in
chapter System Function;
6. Added instruction of low battery
2016-06-13 V2.1.4 in RF, Wifi, Printer and GPRS Prolin Team
chapters;
7. Added a member unsigned char
anti_interference_flag in user
configuration structure struct
pcd_user_t in RF chapter;
8. Modified some errors of Ipv6
related interfaces;
9. Added some related return
values and data structure of Ipv6
in chapter Network
Configuration;
10. Added some system
configuration parameters in
Appendix 3 Registry.
1. Updated the instruction of
OsSysSleep();
2016-07-04 V2.1.5 2. Modified the value range of Prolin Team
ConnectTimeout from 0~300 to
0~60 in the table of Variable
IX
definitions of
ST_MODEM_SETUP in chapter
MODEM;
3. Updated the parameter
KeepAlive in OsWlLogin() and
OsWlLoginEx();
4. Updated the instruction of
OsModemConnect();
5. Updated the instruction of
OsSysSleepTime();
6. Added a new system
configuration parameter
persist.sys.lcdsaverbrightness
and deleted
persist.sys.eth0.enable in the
Appendix 3 Registry;
7. Added three encrypted file
system interfaces
OsCryptFormat() ,
OsCryptMount() and
OsCryptUmount() and related
return code list in chapter
System Function;
8. Added chapter 23 GPS;
9. Added a new return value
POWER_WPC and an related
note in OsCheckPowerSupply();
10. Modified the second point in the
note area under the
OsPmGetEvent().
1. Added an interface
OsPedSetPinIconLayout() in
PED chapter;
2. Added an interface
OsPrnClrBuf() in Printer chapter;
3. Added a note about Bssid
member of ST_WifiApSet structure
in the instruction of OsWifiConnect();
4. Added two new system
2016-07-21 V2.1.6 Prolin Team
configuration parameters
persist.sys.wifi.roam.dhcp
and persist.sys.tm.imei in
Appendix 3 Registry;
5. Updated the instruction of
OsGpsClose();
6. Updated the instruction of
OsWlSwitchPower();
7. In 6.5.6
X
OsPedGetPinBlock(),6.6.1
OsPedGetPinDukpt(),6.4.4
OsPedVerifyPlainPin(),6.4.5
OsPedVerifyCipher() and 6.9.9
OsPedGetPinBlockSM4()
interfaces, added a note about
how calling they migh cause an
exception to the applications that
are running XUI and how to solve
this problem.
1. In Appendix 4 Validity of models
and contents, added Q80 and
D220 models to the validity table;
2. In MODEM chapter, added two
new return values, the error
codes are -3180 and -3184;
3. Added new system configuration
parameters
persist.sys.timezone.tz,
persist.sys.delayshutdown and
persist.sys.continue.print in
Appendix 3 Registry;
4. Added DnsAddrInfo structure
2016-10-17 V2.1.7 and OsNetDnsEx() function in Prolin Team
chapter 20 Network
Configuration;
5. Added a new interface
OsWifiWpsConnect() in WiFi
chapter;
6. In Power Management chapter,
added poweroff event, forbidding
poweroff and allowing poweroff
functions;
7. In Printer chapter, updated the
instruction of interface
OsPrnStart() and added a new
interface OsPrnSetParam().
1. Added new system configuration
parameters
persist.sys.autouload.enable,
persist.sys.autostartup.enable,
persist.sys.hostname,
2017-03-10 V2.1.8 persist.sys.wnet.version and Prolin Team
persist.sys.confirmshutdown in
Appendix 3 Registry;
2. In Network Configuration
chapter, added two new return
values ERR_ROUTE_EXIST
XI
and
ERR_ROUTE_NONEXIST, a
structure Ipv4RouteTable and
three Ipv4 interfaces
OsNetSetRouteTable(),
OsNetDelRouteTable() and
OsNetGetRouteTable();
3. In Keyboard chapter, added a
new key value KEYCAMERA in
the key definition table;
4. In Barcode chapter, added data
definition and
OsScanSetParam() interface of
camera’s scan barcode function;
5. In Power Management chapter,
added return code list and
POWER_TYPE structure;
6. Added description of ports used
by USB scanner;
7. Added instructions for
OsPortOpen() and
OsPortSend();
8. Added chapter 24 Base;
9. Added instruction and return
value for OsScanSetParam();
10. Modified instruction of
OsBaseOpen() and
OsBaseClose();
11. Delete the repeated return value
-3606 in barcode module;
12. Added
persist.sys.keypad.duty_cycle
and items related to barcode
module in registry table;
13. Deleted ro.fac.scanner in registry
table.
1. Added a return value of
OsGpsOpen();
2. Added instruction of
OsNetSetDns();
3. Added note of OsSysSleep();
4. Added ro.fac.coulomb_counter
2017-07-13 V2.1.9 key in registry table; Prolin Team
5. Modified the function of
OsGetSysVer();
6. Added a note of OsSysSleep();
7. Modified the instruction of
OsPortRecv();
8. Added persist.sys.enable.debug
XII
and rt.sys.mainapp.restart in
registry table, and updated the
relevant function instructions;
9. Modified the description of lights
in OsScanSetParam();
10. Updated the parameter
description of KeyVarType in
OsPedDesDukpt();
11. Added note of OsGetAppInfo();
12. Added the length limit of key in
OsRegSetValue() function;
13. Added return code list,
OsRecordOpen(),
OsRecordStart(),
OsRecordStop(),
OsRecordCheck(),
OsRecordClose() and
OsStopPlayWave() functions in
chapter 27 Audio.
14. Add new functions
OsPiccApplePoll() and
OsPiccOffCarrier().
1. Add a Enumeration structure
WAKEUP_SOURCE;
2. Add a new function
OsWakeupSource();
2017-09-07 V2.2.0 Prolin Team
3. Add a new function
OsPedSetPinBg().
4. Add a new function
OsPedCustomKeypad().
1. Modified the description of
OsRecordStart();
2. Updated the instruction of
OsPedCustomKeypad();
3. Added
persist.sys.ped.keypad.mask in
registry table;
4. Added persist.sys.sound.enable
in registry table;
2017-11-15 V2.2.1 5. Modified the description of Prolin Team
persist.sys.delayshutdown in
registry table;
6. Modified the instructions of
OsSysSleep() and
OsSysSleepEx();
7. Updated the instruction of
OsPmGetEvent();
8. Added ro.fac.security_level and
ro.fac.security_mode in registry
XIII
table;
9. Added camera photography
function.
1. Added
persist.sys.mainapp.restart in
registry table;
2. Added
persist.sys.ped.keypad.type in
registry table;
3. Added a new function
OsGetAppExitCode();
4. Added
persist.sys.batterylow.offcnt,
2018-01-08 V2.2.2 Prolin Team
persist.sys.reboot.cnt and
persist.sys.powerkey.offcnt in
registry table;
5. Added a new function
OsPedSetOfflinePin();
6. Modified instruction and
parameter Dns of
OsNetSetDns();
7. Modified the value of parameter
InputLen in PED SM2 Algorithm.
1. Added macro
PORT_USBHOST1, and
modified the instruction of
OsPortOpen();
2. Modified the instruction of
OsNetSetDns() in section 20.4.1;
3. Added persist.sys.dns.static in
registry table;
4. Added
2018-04-02 V2.2.3 Prolin Team
persist.sys.xcb.installapp.lock in
registry table;
5. Modified the description of
DataIn in section 6.5.6
OsPedGetPinBlock;
6. Updated section 24.3 API
7. Updated the instructions of
OsInstallFile() and
OsFirmwareUpgrade().
1. Updated the instructions of
OsPedSetPinIconLayout(), the
description of parameters DataIn
and Mode in
2018-05-23 V2.2.4 Prolin Team
OsPedUpdatePinBlock() and the
description of parameters
InitVector, DataInLen and Mode
in OsPedAes();
XIV
2. Modified the description of
persist.sys.ped.keypad.type and
added
persist.sys.ped.pin.icon.alignin in
registry table;
3. Added interface
OsScanDecodeBuf().
4. Added the permission instruction
of OsInstallFile() and
OsUninstallFile();
5. Deleted section 14.4 POSIX;
6. Added return code -3606.
1. Updated the content of chapter
“IC Card Reader” and “RF
Reader”;
2. Updated the description of
“POSIX Interface”.
3. Updated the description of
parameters DataInLen and Mode
in OsPedDes();
4. Added section “6.10 DES FIRE”;
2018-08-16 V2.2.5 Prolin Team
5. Added interface
OsPiccInitIso15693();
6. Added a new return code -2959
to RF module;
7. Added interfaces
OsPedEndPinEntry() and
OsPedPinKeyNotify(), and
updated section “6.5.10
OsPedGetKcv”.
1. Added NET_LINK_BT for
Bluetooth link;
2. Modified the instruction of the
registry key
“persist.sys.ped.keypad.type”;
3. Added two interfaces
OsPlayAudio() and
OsStopPlayAudio();
4. Added macros
2018-11-15 V2.2.6 RESOLUTION_WIDTH_1024_H Prolin Team
EIGHT_480 and
CAMERA_PIXEL_FORMAT_SB
GGR8 in chapter “Barcode and
Camera”;
5. Updated the instruction in
section OsCameraCapture();
6. Updated the parameter and
instruction in
OsPedGetPinBlock();
XV
7. Updated the parameter and
instruction in
OsPedWriteAesKey();
8. Updated the function description
of OsPedAes();
9. Added a new return value
ERR_MSR_NO_TRACK_ERR in
“MSR” module;
10. Added a new interface
OsMsrReadJIS();
11. Added NET_LINK_USB link in
“Network Configuration” module;
12. Added event type
PM_MSG_POWER_ABNORMA
L and interface
OsCheckPowerStatus() in
“Power Management” module.
1. Updated the description of
parameter Level in
“OsSysSleepEx”;
2. Added key word
ro.security_version in “Appendix
3 Registry”;
3. Modified the description of
2018-11-29 V2.2.7 DUKPT mechanism; Prolin Team
4. Updated the structure
WAKEUP_SOURCE;
5. Updated the function instruction
and description of parameter
level in OsSysSleepEx();
6. Updated the applicable platform
of OsWakeupSource().
1. Updated the limited models for
OsSysSleep() and
OsSysSleepEx();
2019-02-01 V2.2.8 2. Added interface OsWlInitEx(); Prolin Team
3. Modified the description of return
code -3510 in chapter
“GPRS/CDMA”.
1. Added keyword
persist.sys.usbd.mode in the
registry;
2. Added new interface OsLed(),
and list the interface parameter
2019-03-13 V2.2.9 Prolin Team
settings related to the model in
the instruction;
3. Updated parameter KeyFlag in
OsPedSetFunctionKey(), and the
instruction of
XVI
OsPedGetPinBlock(), and the
keyword
persist.sys.ped.keypad.type in
the registry.
Added
PM_MSG_BATTERY_DAMAGE and
2019-04-22 V2.3.0 Prolin Team
upgraded section
“OsCheckPowerStatus()”.
1. Added a new interface
OsTerminalConsumeInfo();
2. Added description of
usbd.mode=4 in keyword
persist.sys.usbd.mode
3. Added
PCD_ERR_RXLEN_EXCEED_F
2019-05-15 V2.3.1 LAG in the return code list of RF Prolin Team
reader;
4. Updated section “User
Configuration Structure”;
5. Added macro ERR_EAP_ID in
the WiFi return code list.
6. Added a new interface
OsPedRkiInjectKey().
1. Added a new interface
OsSetKeyTone();
2. Modified the instruction of
OsRegSetValue().
2019-06-20 V2.3.2 Prolin Team
3. Modified the parameter
description in OsPedGetKcv();
4. Added a new interface
OsNetNat().
1. Modified the instruction of
OsCheckPowerStatus();
2. Added ERR_USB_MODE;
3. Added instruction in Zhang Mengying
2019-07-23 V2.3.3 OsOnBase();
4. Updated the return code and Zheng Zhihai
instruction of OsBaseOpen();
5. Added interface
OsCheckPortStatus().
1. Added instruction for
OsPedCancelPinEntry() and
OsPedEndPinEntry();
2. Updated the parameter Chen Xiaoyong
2019-09-12 V2.3.4 description of
OsPedGetPinBlock(); Zheng Zhihai
3. Added keywords
“persist.sys.ped.reboot.cycle”
and
XVII
“persist.sys.ped.pinwait.retain” in
the Registry table;
4. Updated the instruction and
parameter description of
OsCheckPortStatus().
1. Added a new interface
OsGetBaseInfo();
2. Updated the description of
parameter DutyCycle;
3. Updated interface
OsCameraCapture(); Zheng Zhihai
4. Added a new interface Huang Ruzhen
2019-11-20 V2.3.5
OsCameraDetectMotion(); Li Xin
5. Modified the definition of wakeup Zhang Mengying
source;
6. Added description for interface
OsCheckBMSMode(), keyword
rt.app.key.tone and
rt.app.key.backlight.
1. Added section “Digital IO”;
2. Updated section “Macro
Definition of Camera” and
“OsScanSetParam”;
3. Updated chapter “Power
Management” and the Zheng Zhihai
description of Fang Wei
2019-12-03 V2.3.6 “persist.sys.confirmshutdown” in
registry; Zhang Mengying
4. Added section Zheng Zhihai
“OsPortCheckRx”;
5. Updated the return value in
section “OsCheckPortStatus”
and “OsGetBaseInfo”;
6. Added section “OsBaseCmd”.
1. Updated the instruction of
section “OsPortRecv”; Xu Bin
2019-12-31 V2.3.7
2. Added the instruction of Zhang Mengying
“OsPortCheckRx”.
1. Added the return code
description for installing fwp in
the OsInstallFile();
2020-04-01 V2.3.8 Zhang Mengying
2. Updated the description of the
registry key
“persist.sys.usbd.mode”.
1. Update the user configuration
structure in the chapter “RF Zhang Mengying
2020-05-13 V2.3.9 Reader”.
2. Modified the description of the Huang Ruzhen
keyword ro.fac.videocard;
XVIII
3. Added descriptions of keywords
persist.sys.tm.cpu,
persist.sys.tm.flash and
persist.sys.tm.ram.
Updated “OsTerminalConsumeInfo”
and “OsPiccApplePoll” and Zhang Mengying
2020-06-30 V2.4.0
“persist.sys.usbd.mode” in the Huang Ruzhen
Registry.
XIX
Table of Contents
1 Introduction ........................................................................................................... 1
3 Thread .................................................................................................................. 7
OsSetTime ..................................................................................... 10
OsGetTime ..................................................................................... 11
OsTimerSet .................................................................................... 11
OsTimerCheck ............................................................................... 11
XX
OsSleep.......................................................................................... 12
OsLogSetTag ................................................................................. 13
OsLog ............................................................................................. 13
OsGetTickCount ............................................................................. 13
OsGetAppInfo................................................................................. 14
OsGetOptInfo ................................................................................. 14
OsBeep .......................................................................................... 15
OsSetKeyTone ............................................................................... 16
OsRunApp ...................................................................................... 16
OsGetAppExitCode ........................................................................ 17
OsRegSetValue.............................................................................. 17
OsRegGetValue ............................................................................. 18
OsInstallFile.................................................................................... 19
XXI
OsUninstallFile ............................................................................... 20
OsFirmwareGetVersion .................................................................. 21
OsFirmwareUpgrade ...................................................................... 21
OsVerifySign .................................................................................. 22
OsVerifySignExternal ..................................................................... 23
OsGetSysVer ................................................................................. 24
OsOnBase ...................................................................................... 24
OsSaveCrashReport ...................................................................... 25
OsMount ......................................................................................... 26
OsUmount ...................................................................................... 28
OsCryptFormat ............................................................................... 29
OsCryptMount ................................................................................ 30
OsCryptUmount.............................................................................. 31
OsLed ............................................................................................. 31
XXII
4.23 Get Terminal Accumulated Usage Information......................................... 33
OsTerminalConsumeInfo................................................................ 33
OsDigitalIOGetStat ......................................................................... 34
OsDigitalIOSetStat ......................................................................... 34
OsGetRandom ............................................................................... 36
OsSHA ........................................................................................... 37
OsDES ........................................................................................... 38
OsAES ........................................................................................... 39
OsRSA ........................................................................................... 39
OsRSAKeyGen .............................................................................. 40
6 PED .................................................................................................................... 42
XXIII
DisplayAttribute of Asterisk............................................................. 46
RSA Key Structure for Verifying the Ciphertext IC Card PIN .......... 46
OsPedOpen.................................................................................... 47
OsPedGetVer ................................................................................. 47
OsPedSetInterval ........................................................................... 47
OsPedVerifyPlainPin ...................................................................... 48
OsPedVerifyCipherPin ................................................................... 49
OsPedEraseKeys ........................................................................... 52
OsPedSetFunctionKey ................................................................... 52
OsPedClose ................................................................................... 53
OsPedCancelPinEntry .................................................................... 53
OsPedSetOfflinePin ....................................................................... 53
OsPedEndPinEntry ........................................................................ 54
OsPedPinKeyNotify ........................................................................ 55
OsPedWriteKey .............................................................................. 56
OsPedWriteTIK .............................................................................. 60
OsPedWriteKeyVar ........................................................................ 62
OsPedSetAsteriskLayout ............................................................... 63
XXIV
OsPedSetPinIconLayout ................................................................ 64
OsPedGetPinBlock ......................................................................... 66
OsPedUpdatePinBlock ................................................................... 68
OsPedGetMac ................................................................................ 69
OsPedDes ...................................................................................... 70
OsPedGetKcv................................................................................. 71
OsPedDeriveKey ............................................................................ 73
OsPedSetPinBg ............................................................................. 74
OsPedCustomKeypad .................................................................... 75
OsPedGetPinDukpt ........................................................................ 76
OsPedGetMacDukpt ...................................................................... 78
OsPedDesDukpt ............................................................................. 79
OsPedGetKsnDukpt ....................................................................... 81
OsPedIncreaseKsnDukpt ............................................................... 81
OsPedReadRsaKey ....................................................................... 82
OsPedWriteRsaKey ....................................................................... 82
OsPedRsaRecover ......................................................................... 83
OsPedReadCipherRsaKey ............................................................. 83
OsPedWriteCipherRsaKey ............................................................. 84
XXV
OsPedWriteAesKey ........................................................................ 84
OsPedAes ...................................................................................... 87
6.9 SM Algorithm............................................................................................ 88
OsPedGenSM2Pair ........................................................................ 88
OsPedWriteSM2Key ...................................................................... 88
OsPedSM2Sign .............................................................................. 89
OsPedSM2Verify ............................................................................ 90
OsPedSM2Recover ........................................................................ 91
OsPedSM3 ..................................................................................... 92
OsPedSM4 ..................................................................................... 93
OsPedGetMacSM .......................................................................... 94
OsPedGetPinBlockSM4 ................................................................. 95
OsPedDFAuthDiver ........................................................................ 96
OsPedDFAuthMerge ...................................................................... 97
OsPedRkiInjectKey ........................................................................ 98
7 LCD .................................................................................................................... 99
XXVI
8.1 OsKbBacklight ........................................................................................ 105
OsPrnSetSpace............................................................................ 112
OsPrnSetFont............................................................................... 114
XXVII
OsPrnPrintf ................................................................................... 116
OsCodeConvert............................................................................ 126
XXVIII
14.2 Data Structure ........................................................................................ 129
OsMsrClose.................................................................................. 130
OslccOpen.................................................................................... 136
XXIX
User Configuration Structure ........................................................ 142
OsPiccAntiSel............................................................................... 145
OsPiccTransfer............................................................................. 147
OsPiccRemove............................................................................. 147
XXX
17.2 Communication Control .......................................................................... 154
OsPortCheckRx............................................................................ 159
XXXI
18.6 OsModemConnect ................................................................................. 178
XXXII
OsNetDns ..................................................................................... 200
OsNetDnsEx................................................................................. 201
OsNetGetRouteTable.................................................................. 209
XXXIII
OsNetGetRouteAdvertise6 ........................................................... 214
OsWlInitEx.................................................................................... 222
XXXIV
22 WiFi .............................................................................................................. 233
XXXV
24.3 API ......................................................................................................... 248
XXXVI
27.9 OsPlayAudio .......................................................................................... 266
OsCameraDetectMotion.............................................................. 277
XXXVII
29 Power Management ...................................................................................... 279
XXXVIII
Table List
Table 17.2 Return code list of USB port functions ........................................... 153
XXXIX
Table 21.1 GPRS/CDMA return code list ........................................................ 219
XL
Prolin API Programming Guide
1 Introduction
1.1 Purpose
This documentation introduces the framework of Prolin applications and the key
points of GUI and other important frameworks. It provides programming guide for API
interfaces compatible with controlling hardware based on Prolin OS and offers
corresponding instructions conducive to a successful design for developers.
Prolin provides a series of interfaces based on Linux system calls and POSIX
interfaces. And a set of OSAL interfaces, beginning with the prefix “Os”, are
encapsulated for the compatibility demand of some background services and
applications. In addition, demo programming codes of POSIX interfaces and system
libraries are illustrated in this documentation to guide developers to access device or
system function.
In this documentation, all the interfaces beginning with “Os” are defined in osal.h of
SDK, unless otherwise specified.
Prolin SDK provides necessary tools and resources for local Prolin applications.
Different from the background system applications, Prolin SDK can run independently
as executive programs on Prolin OS-based devices. Local applications enjoy a great
deal of privileges. They can access all Prolin OS features, save data in local file
system and even communicate with other installed programs through a special URL.
1.3 Prerequisites
Process, thread and Linux system functions and their roles in application
development;
Conventions used in this document and their corresponding meanings are listed
below:
Giving notes.
Table 2.1 lists the types and value ranges of return codes involved in this document:
Value(Decimalis
Type Description
m)
General Return
-1000~-1999 General error code of API.
Value
System Function -2200~-2299
Power Management -2300~-2399
Encryption and
-2400~-2499
Decryption
Font Library -2500~-2599
LED display -2600~-2699
MSR -2700~-2799
IC Card Reader -2800~-2899
Contactless IC Card
-2900~-2999
Reader
Communication
-3000~-3099
Port
MODEM -3100~-3299
IP Network
-3300~-3399
Configuration
PED -3800~-3899
Table 2.2 lists the macro definitions, values and corresponding descriptions of the
general return values in this documentation.
2.3 Parameter
There are two types of API parameters: input parameter and output parameter. They
are distinguished with identifiers in this documentation.
All the input and output string parameters end with"\x00" and valid string length must
be clarified in parameter description.
3 Thread
Prolin supports pthread of POSIX. The header file of pthread is located at the
installation directory of ProlinBuilder:
toolchains\arm-linux\arm-softfloat-linux-gnu\include\pthread.
4 System Function
LOG_T:
typedef enum{
LOG_DEBUG, /* Display debugging message*/
LOG_INFO, /* Display prompt message*/
LOG_WARN, /* Display warning message*/
LOG_ERROR, /* Display error message*/
} LOG_T;
ST_TIME(time structure):
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 (valid only in read time)*/
} ST_TIME;
ST_TIMER(timer structure):
ST_TIMER:
typedef struct{
unsigned long Start;
unsigned long Stop;
unsigned long TimeLeft;
} ST_TIMER;
ST_APP_INFO:
typedef struct{
char Id[64];
char Name[64];
char Bin[64];
char Artwork[64];
char Desc[64];
char Vender[32];
char Version[32] ;
} ST_APP_INFO;
ST_OPT_INFO:
typedef struct {
char Name[64];
char Version[32];
} ST_OPT_INFO;
OsSetTime
ERR_INVALID_PARA
Invalid parameter.
M
Only the main application has permission to set time; otherwise,
Instruction
it will fail and return ERR_NEED_ADMIN.
OsGetTime
4.4 Timer
OsTimerSet
OsTimerCheck
M
Instruction
4.5 Delay
OsSleep
4.6 Thread
Prolin thread is implemented by standard linux POSIX interface. Please refer to the
following code:
Example:
#include <pthread.h>
static pthread_t ntid;
static void *thread_fn(void *arg)
{
printf("This is child thread\n");
return ((void *)0);
}
int main()
{
printf("This is main thread\n");
if(pthread_create(&ntid,NULL,thread_fn,NULL) != 0)
printf("can't create thread\n");
sleep(5);
return 0;
}
4.7 Log
OsLogSetTag
OsLog
OsGetTickCount
Instruction
OsGetAppInfo
OsGetOptInfo
obtained.
ERR_FILE_NOT_ The file path that stores optional system
FOUND components does not exist.
ERR_INVALID_P
ARAM Invalid parameter.
When the real number of optional system components is larger
Instruction
than InfoCnt, only the first InfoCnt number will be obtained.
4.10 Buzzer
OsBeep
OsSetKeyTone
OsRunApp
OsGetAppExitCode
OsRegSetValue
to 31 bytes.
Value [Input] Parameter value, ending with “\0”.
The valid string length ranges from 0
to 64 bytes, and it cannot be NULL.
RET_OK Succeeded.
ERR_INVALID_PARA
Invalid Parameter.
M
Return
ERR_NEED_ADMIN Permission denied.
ERR_SYS_NOT_SUP System doesn’t support this
PORT configuration name.
1. This function can only set the system configuration whose
name begins with “persist.sys” , “rt.sys” or “rt.app.”, such as
“persist.sys.app0.pic”. For more information, refer to
Appendix 3 Registry.
2. OsRegSetValue()supports both the keywords listed in
Instruction Appendix 3 and user-defined configurations.
3. Registry beginning with “rt.sys.” and “rt.app.” will be invalid
when POS restarts, if the original state needs to be
restored, it requires to be reset after restarting.
4. After setting the key value, it will take about 200
milliseconds for the key value to take effect.
OsRegGetValue
OsInstallFile
OsUninstallFile
OsFirmwareGetVersion
OsFirmwareUpgrade
Return ERR_VERIFY_SIGN_F
Signature error.
AIL
ERR_SYS_NOT_SUPP
Incompatible with OS.
ORT
OsVerifySign
ERR_FILE_NOT_EXIS
File does not exist.
T
ERR_DEV_BUSY Device is busy.
ERR_INVALID_PARA
Invalid parameter.
M
1. This function is only used to verify application parameter
files, for example, to verify the root certificate defined by the
application.
Instruction 2. Before installing file, it is not recommended to call this
function to verify the legitimacy of the file so that to avoid a
repeated verification, as OsInstallFile() will verify the file
automatically.
OsVerifySignExternal
OsGetSysVer
Prolin can test whether the handset is on the base or not, which is not applicable to
models that do not have any base.
OsOnBase
Prolin can monitor program state. Once the program crashes, it will save the crash
report in the directory“/data/tombstones” after calling OsSaveCrashReport(). .
OsSaveCrashReport
OsMount
OsUmount
OsCryptFormat
OsCryptMount
OsCryptUmount
4.22 LED
OsLed
LED_YELLOW: yellow
LED_CYAN: cyan
LED_MAGENTA: magenta
LED_WHITE: white
Device model.
When operating the led light
of remote device, this
parameter needs to be input
(such as card reader: "IM700",
dev [Input] "IM500" or "IM20");
0 Succeeded.
OsTerminalConsumeInfo
4.24 Digital IO
OsDigitalIOGetStat
OsDigitalIOSetStat
5 Encryption and
Decryption
OsGetRandom
int RandomLen);
Function Generate true random number.
A pointer to sring that stores random
Random [Output]
number.
Parameters Length of random number which needs to
RandomLen[Input be read.
] The valid length is not more than 4096
bytes.
Return None.
Instruction
OsSHA
SHA_TYPE_224 28
SHA_TYPE_256 32
SHA_TYPE_38 48
SHA_TYPE_512 64
Return None.
Instruction
OsDES
KeyLen[Input] 8, 16 or 24 (bytes).
0- Decryption;
Mode
1- Encryption.
Return None.
1. Encryption or decryption is decided by Mode selection.
Instruction
2. For invalid parameter, it performs no action.
OsAES
OsRSA
endian)
ModulusLen[Input] Modulus length[unit:byte].
A pointer that contains RSA
Exp[Input] operation exponent. (stored in big
endian)
ExpLen Exponent length.[unit: byte]
A pointer to the input data buffer.
DataIn[Input] The valid length is equal to the
modulus length.
A pointer to the output data buffer.
DataOut[Output] The valid length is equal to the
modulus length.
RET_OK Succeeded.
ERR_INVALID_PARAM Invalid parameter.
Return
ExpLen is greater than
ERR_DATA_TOO_BIG
ModulusLen.
1. OsRSA() is used to encrypt/dencrypt DatatIn and its result
is stored in DataOut.
2. When (Modulus, Exp) is private key, if DataIn is ciphertext
that encrypted by PUK, then DataOut is plaintext of DataIn;
otherwise, DataOut is RSA ciphertext of DataIn.
Instruction
3. When (Modulus, Exp) is public Key, if DataIn is ciphertext
that encrypted by private key, then DataOut is plaintext of
DataIn; otherwise, DataOut is RSA ciphertext of DataIn.
4. OsRSA() can implement RSA operation whose modulus
length is not more than 4096 bits.
OsRSAKeyGen
6 PED
Prolin provides a series of PED interfaces, including built-in PED, MK/SK, DUKPT,
RSA and other related interfaces.
The architecture of PED is desiged to contain three levels of key. From top to bottom,
its order is:
Each PED terminal only has one TLK. Its index number is 1.
Terminal master key or acquirer master key, each PED terminal can have 100
TMKs. The index number is from 1 to 100.
Transaction working key, which is used to perform PIN, MAC and other
operations.
Each PED terminal can have 100 TMKs. The index number is from 1 to 100.
Each key has its corresponding index number, length, purpose and tags which are
set through API before writing in the key so as to authorize the permission and avoid
abuse of the key.
Mechanism of DUKPT:
DUKPT (Derived Unique Key Per Transaction) is the one-time pad system in which
different key (PIN、MAC) is used for each transaction. KSN (Key Serial Number)
concept which is the key factor to realize one-time pad is introduced in this system.
Each key corresponding to KSN can generate different keys according to the usage
and variant constants listed below.
Each PED terminal can have 100 DUKPT groups. Selection of group index is needed
when writing in TIK; select the corresponding index number when using DUKPT.
Key Type
DisplayAttribute of Asterisk
ST_RSA_KEY
typedef struct{
int ModulusLen; /*Modulus length(bits) */
unsigned char Modulus[512]; /*Modulus.When modulus length is less
than 512 bytes, add 0x00 on the left. */
int ExponentLen; /* Exponent length (bits) */
unsigned char Exponent [512]; /*Exponent.When exponent is less than
512 bytes, add 0x00 on the left.*/
unsigned char KeyInfo[128]; /* RSA key information */
}ST_RSA_KEY;
ST_RSA_PINKEY
typedef struct{
int ModulusLen; /*Modulus length of PIN public key(unit: bits) */
unsigned char Modulus[256]; /*Modulus of PIN public key*/
unsigned char Exponent [4]; /* Exponent of PIN public key*/
int IccRandomLen; /*Length of random data from IC card*/
unsigned char IccRandom[8]; /*Random data from IC card*/
}ST_RSA_PINKEY;
OsPedOpen
OsPedGetVer
OsPedSetInterval
Automatically set to
>600000
600,000(10 min)
Current settings remain
=0xffffffff
unchanged.
RET_OK Succeeded.
Return ERR_DEV_NOT_OPE
PED device is not open.
N
Restrictions of PIN input intervals:
Each PIN input function can only be called for not more than 4
times during 4*TPKIntervalMs. The default value of
TpkIntervalMs is 30s which can be set by calling
OsPedSetInterval(). For example, if the TPKIntervalMs is
Instruction 20,000(ms), then the same PIN input function can be called 4
times at most within 80 seconds.
PIN input functions include OsPedGetPinBlock(),
OsPedGetPinDukpt(), OsPedVerifyPlainPin() and
OsPedVerifyCipherPin().
TpkIntervalMs will be restored to the default value after reboot.
OsPedVerifyPlainPin
OsPedVerifyCipherPin
Encryption algorithm:
Get ciphertext PIN by using the public key to calculate the data
which are listed in following table with RSA algorithm.
icc_resp[1] = apdu_r.SWB;
OsPedEraseKeys
OsPedSetFunctionKey
OsPedClose
OsPedCancelPinEntry
OsPedSetOfflinePin
uchar TpkIdx,
uchar *PinBlock,
ushort PinBlockLen);
Function Set verification mode for off-line plain / cipher text.
Verification mode:
0-Input PIN with internal code
keypad;
Mode [Input]
1- Input PIN with external code
keypad, and the PIN is imported by
parameter PinBlock.
TPK index:
When Mode is 0, it is meaningless;
Parameters TpkIdx [Input] When Mode is 1, the TPK of this
index will be used to decrypt the
imported PinBlock, and the result is
PIN in plain-text.
PIN block:
When Mode is 0, it is meaningless;
PinBlock [Input] When Mode is 1, it represents PIN
in cipher -text encrypted by TPK in
ISO9564 Format1.
PinBlockLen [Input] Length of PIN block
RET_OK Succeeded
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
OsPedEndPinEntry
Instruction This function does not require PED service, so there is no need
to call OsPedOpen() before using it.
OsPedPinKeyNotify
6.5 MK/SK
OsPedWriteKey
PED_TMK,
DstKeyIdx = [1~100];
When DstKeyType =
PED_TPK or PED_TAK or
PED_TDK or
PED_TDFK,DstKeyIdx =
[1~100].
DstKeyType:
PED_TLK
PED_TMK
PED_TPK/PED_TAK/PED_T
1 byte DK
PED_SM4_TMK
PED_SM4_TPK/PED_SM4_T
AK/PED_SM4_TDK
PED_TDFK
DstKeyLen: 8/16/24
When DstKeyType is
PED_SM4_TMK/PED_SM4_
1 byte
TPK/PED_SM4_TAK/PED_S
M4_TDK,
DstKeyLen=16.
DstKeyValue.
8/16/24
bytes Destination key plaintext /
ciphertext.
KcvMode:
0x00: No verification.
0x01: KCV is the first 3 bytes of
ciphertext after encrypting
the 8-byte 0x00 with
DES/TDES algorithm.
0x02: KCV is the first 3 bytes of
1 byte ciphertext after odd parity
check on the plaintext of
key and DES/TDES
encryption on the
“\x12\x34\x56\x78\x90\x12\
x34\x56”.
0x03: KCV is an 8-byte MAC
value that is a result of
ERR_PED_KEY_TYPE_E
RR Key type error.
ERR_PED_NO_MORE_B
UF System memory is not enough.
ERR_PED_KCV_MODE_
ERR PED KCV verification mode error.
ERR_PED_KCV_CHECK_
FAIL PED KCV verification failed.
OsPedWriteTIK
PED_TIK
1 byte DstKeyLen: 8/16
DstKeyValue.
24
bytes The destination key plaintext /
ciphertext
KcvMode:
0x00: No verification.
0x01: KCV is the first 3 bytes of
ciphertext after encrypting
the 8-byte 0x00 with
DES/TDES algorithm.
0x02: KCV is the first 3 bytes of
ciphertext after odd parity
check on the plaintext of key
1 byte and DES/TDES encryption
on
“\x12\x34\x56\x78\x90\x12\x
34\x56”.
0x03: The KCV is an 8-byte MAC
value, that is, a result of
specified mode of MAC
calculation on [ciphertext of
destination key + input
KcvData] with source key
pair.
KcvData:
When the KcvMode is
0x00/0x01/0x02, padding with
random numbers.
128 When the KcvMode is 0x03,
bytes the first byte of KcvData is the
length of KCV data involved in
the calculation, and the rest is
KCV data. The first byte after
the KCV data represents the
mode of MAC calculation.
When KcvMode = 0x00,
padding with random numbers.
8 bytes When KcvMode =
0x01/0x02/0x03, KcvValue
points to the KCV value.
10
Initialize KSN.
bytes
RET_OK Succeeded.
ERR_DEV_NOT_OPE
PED device is not open.
N
Return
ERR_INVALID_PARA
Invalid parameter
M
Others Refer to PED Return Code List .
When calling this function to write the ciphertext or plaintext of a
key to a specific index position of the specific key type area,
please pay attention to the following notes:
1. When SrcKeyIdx=0, DstKeyValue is regarded as the
plaintext of key. The system will directly write the
DstKeyValue to DstKeyIdx in DstKeyType area without
judging SrcKeyType and SrcKeyIdx.
2. Only when PED_TLK does not exist, plaintext is allowed to
be written and key is allowed to be downloaded.
Instruction 3. When PED_TLK exists, plaintext is not allowed to be written
and key is not allowed to be downloaded.
4. If SrcKeyIdx is valid, DstKeyValue is regarded as the
ciphertext of the key. The system will decrypt DstKeyValue
with SrcKeyIdx key in SrcKeyType area and write the key to
DstKeyIdx in DstKeyType. (DstKeyType >= SrcKeyType)
5. KVC is used to verify plaintext. If plaintext is typed-in
directly, and the KcvMode of KeyIn is not 0, the system will
perform KCV verification on plaintext according to the
specified KcvMode.
OsPedWriteKeyVar
PED_TMK
PED_TPK
PED_TAK
PED_TDK
Source key index.The valid range is from 1
SrcKeyIdx
to 100.
Destination key index. The valid range is
DstKeyIdx
from 1 to 100.
A 24-byte string involoved in calculation.
KeyVar[Input] The string is used to xor with the source key.
The string length should be the same as the
key’s, and it is extensible.
RET_OK Succeeded.
ERR_DEV_NOT_OPEN PED device is not open.
Return
ERR_INVALID_PARAM Invalid parameter
Others Refer to PED Return Code List .
Instruction
OsPedSetAsteriskLayout
int OsPedSetAsteriskLayout(int x,
int y,
Prototype int fontSize,
int fontColor,
uchar align);
Function Set the layout attributes of asterisk while inputting PIN.
x X-coordinate
y Y-coordinate
Font size of asterisk:
Parameters fontSize = 16: the character size is 16 dots;
fontSize fontSize = 24: the character size is 24 dots;
fontSize = 32: the character size is 32 dots;
fontSize = 48: the character size is 48 dots.
OsPedSetPinIconLayout
int OsPedSetPinIconLayout(int X,
int Y,
int Interval,
uchar IconNum,
Prototype
char *PinIcon,
int PinIconLen,
char *PinIconBG,
int PinIconBGLen);
OsPedGetPinBlock
OsPedUpdatePinBlock
OsPedGetMac
OsPedDes
calculated.
Length of data that needs to be
calculated.[unit: byte]
The valid data length should be less than or
DataInLen
equal to 1024 bytes.
When Mode=0x00~0x05, the data length
must be a multiple of 8.
DataOut[Outpu
A pointer to the data that has been calculated.
t]
0x00: ECB Decryption
0x01: ECB Encryption
0x02: CBC Decryption
0x03: CBC Encryption
Mode
0x04: OFB Decryption
0x05: OFB Encryption
0x06: CFB8 Decryption
0x07: CFB8 Encryption
RET_OK Succeeded.
ERR_DEV_NOT_OPEN PED device is not open.
Return
ERR_INVALID_PARAM Invalid parameter.
Others Refer to PED Return Code List .
Instruction
OsPedGetKcv
Function Get KCV value to verify the key for both sides of session: when
the KeyType is not TIK, KCV is the first 3-byte of data encrypted
EN
ERR_INVALID_PAR
Invalid parameter.
AM
Others Refer to the PED Return Code List .
Instruction
OsPedDeriveKey
OsPedSetPinBg
OsPedCustomKeypad
background color.
2. Support replacing parts of keypad icons. The system will
only obtain the icon resource file which corresponds to
relevant model in KeypadPath, if no corresponding keypad
icon resource file is found, the system will use the default
resource file.
3. Each keypad icon provided by users needs to be signed by
MF_PVK. If the signature verification is failed, it indicates
the setting is failed, and ERR_VERIFY_SIGN_FAIL will be
returned.
4. When Mode = 0x01, KeypadPath and KeypadColorBg
cannot be NULL at the same time. If none of keypad icon in
KeypadPath meets the requirement, this API will cancel the
setting and return ERR_FILE_NOT_EXIST.
5. Please refer to section 10.3 in “Prolin Application
Development Manual” for the usage and requirements of
relevant models’ keypad icon resource.
6. Soft keypad background color does not support
transparency temporarily, so only RGB in KeypadColorBg
takes effect, and A (Alpha) has no effect.
6.6 DUKPT
OsPedGetPinDukpt
number.
4. If Mode=0x23, DataIn is ISN [6 Bytes,
ASCII code]
A pointer to valid password length string
which is an enumeration set from 0 to 12.
Application enumerates all valid password
ExpPinLen[Inp length and separates each length with “,”. For
ut] example, if no PIN, 4 and 6 digits of PIN are
allowed, the string will be set to “0, 4, 6”. “0”
means no PIN is required and can return
directly by pressing “Enter”.
Choose the format of PIN block:
0x20 ISO9564 format 0, KSN does not
increase 1 automatically.
0x21 ISO9564 format 1, KSN does not
Mode increase 1 automatically.
0x22 ISO9564 format 3, KSN does not
increase 1 automatically.
0x23 HK EPS format, KSN does not increase
1 automatically.
Timeout of PIN input[unit:ms]
TimeoutMs The valid timeout ranges from 0 to 300000ms.
“0” means no timeout, and PED has no
timeout control.
A pointer to the current KSN.
Ksn[Output]
The valid length of KSN is 10 bytes.
PinBlock[Outp A pointer to the generated PIN block result.
ut] The valid length of PIN block is 8 bytes.
RET_OK Succeeded.
ERR_DEV_NOT_OPEN PED device is not open.
Return
ERR_INVALID_PARAM Invalid parameter.
Others Refer to PED Return Code List .
1. When KSN does not increase 1, a DUKPT PIN key can only
calculate the PIN block once.
2. Calling OsPedGetPinDukpt() will operate the framebuffer,
Instruction which might cause the resource conflict. If there is some
kind of exception on the interface of application which is
running XUI, call XuiSuspend() to suspend XUI before
calling OsPedGetPinDukpt(), after a while, call
XuiResume() to resume XUI.
OsPedGetMacDukpt
1. 0x20/0x21/0x22/0x40/0x41/0x42: KSN
does not increase1 automatically.
2. 0x40/0x41/0x42: MAC calculation method
is the same as 0x20/0x21/0x22’s.
3. 0x40/0x41/0x42: Choose to respond to
MAC key.
0x20/0x21/0x22: KSN choose to request
or respond to MAC key
4. Other values are reserved for extended
MAC algorithm.
RET_OK Succeeded.
ERR_DEV_NOT_OPEN PED device is not open.
Return
ERR_INVALID_PARAM Invalid parameter.
Others Refer to PED Return Code List .
If KSN does not increase 1, both the response MAC key and
Instruction
the request MAC key can calculate MAC for unlimited times.
OsPedDesDukpt
RET_OK Succeeded
ERR_DEV_NOT_OPEN PED device is not open.
Return
ERR_INVALID_PARAM Invalid parameter.
Others Refer to PED Return Code List .
Instruction If KSN does not increase 1 automatically, a DUKPT group can
OsPedGetKsnDukpt
OsPedIncreaseKsnDukpt
6.7 RSA
OsPedReadRsaKey
OsPedWriteRsaKey
1. The supported RSA key length is not more than 512 bytes.
OsPedRsaRecover
OsPedReadCipherRsaKey
OsPedWriteCipherRsaKey
6.8 AES
OsPedWriteAesKey
OsPedAes
intOsPedAes(intKeyIdx,
unsigned char *InitVector,
const unsigned char *DataIn,
Prototype
intDataInLen,
unsigned char *DataOut,
int Mode);
Use TAESK or PED_AES_TDK to do AES encryption or
Function
decryption for DataIn whose length is specified by DataInLen.
TAESK index.
KeyIdx[Input]
The value range is from 1 to100.
Initialization vector.
When Mode=0x02/0x03/0x04/0x05,
initialization vector is needed in
encryption/decryption. If InitVector is
NULL, the initialization vector is set to
16-byte 0x00 by default.
InitVector[Input/Out When Mode=0x00/0x01, the initialization
put] vector is not needed and can be set to
NULL.
When Mode=0x06/0x07, the initialization
vector represents a 16-byte temporary
counter which is required for calculation,
Parameters
and the counter will be updated after
calculated successfully.
A pointer to the data that needs to be
DataIn[Input]
calculated.
Length of data that needs to be
calculated.
The valid length is not more than 1024
DataInLen[Input]
bytes and must be a multiple of 16.
When the calculation mode is in CTR
mode, there is no limit to the data length.
A pointer to the data that has been
DataOut[Output]
calculated.
Mode [Input] 0x00: ECB Decryption
6.9 SM Algorithm
OsPedGenSM2Pair
OsPedWriteSM2Key
uchar *KeyValue);
Function Inject SM2 private key or pubic key into PED.
SM2 key index.
KeyIdx[Input]
The valid range is from 1 to 20.
Key types:
KeyType[Input] PED_SM2_PVT_KEY 0x30 private key
Parameters PED_SM2_PUB_KEY 0x31 public key
When KeyType=0x30, the valid length of
KeyValue is 32 bytes.
KeyValue[Input]
When KeyType=0x31, the valid length of
KeyValue is 64 bytes.
RET_OK Succeeded.
ERR_DEV_NOT_OPEN Device is not open.
ERR_INVALID_PARAM Invalid parameter.
ERR_SYS_BAD System error
Return
ERR_PED_KEY_IDX_ERR Key index error
ERR_PED_KEY_TYPE_ER
Key type error
R
Others Refer to PED Return Code List .
Instruction
OsPedSM2Sign
OsPedSM2Verify
OsPedSM2Recover
2048 bytes.
Output[Output] Encrypted or decrypted data.
OutputLen[Output] Length of encrypted or decrypted data.
The length of encrypted data is equal to
the original data length +96 bytes.
The length of decrypted data is equal to
the original data length -96 bytes.
Mode[Input] PED_DECRYPT 0x00 : use SM2
private key to decrypt data.
PED_ENCRYPT 0x01:use SM2 public
key to encrypt data.
RET_OK Succeeded.
ERR_DEV_NOT_OPEN Device is not open.
ERR_INVALID_PARAM Invalid parameter.
ERR_SYS_BAD System error.
ERR_PED_KEY_IDX_ERR Key index error.
Return
ERR_PED_KEY_TYPE_ERR Key type error.
ERR_PED_NO_KEY Key doesn’t exist.
ERR_PED_TAMPERED PED is tampered.
Refer to PED Return Code
Others
List .
Instruction
OsPedSM3
OsPedSM4
OsPedGetMacSM
OsPedGetPinBlockSM4
OsPedDFAuthDiver
Instruction
OsPedDFAuthMerge
6.11 RKI
OsPedRkiInjectKey
7 LCD
Prolin supports Minigui, QT and other GUI support system to manage the display on
LCD. Prolin provides interfaces that can directly access physical device of LCD for
applications to configure light, set contrast and retrieve screen size of LCD.
5. Write 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;
}
memset(sb->buffer, 0, fbmemlen);
return 0;
}
7.1 OsScrContrast
7.2 OsScrBrightness
10: brightest
The default value is 8.
Other values: no action.
Return None.
Instruction The settings will become invalid after exiting the application.
7.3 OsScrGetSize
8 Keyboard
The input subsystem can directly be used to test keyboard drivers or transplant other
GUI systems. The device node of keyboard is "/dev/keypad".
#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;
rd = read(keypad_fd, ev0, sizeof(struct input_event) * 64);
if ( rd < sizeof(struct input_event) ) return 0;
for (i = 0; i < rd / sizeof(struct input_event); i++) {
printf("", ev0[i].type, ev0[i].code, ev0[i].value);
if (ev0[i].type == 3 && ev0[i].code == 0)
realx = ev0[i].value;
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
9 Touch Screen
Application developers can directly use the input subsystem to test touchscreen
drivers or transplant other GUI systems.
About input subsystem calling, please refer to Chapter 8 Keyboard. The node of touch
screen is “/dev/tp”.
10Signature Pad
For more details, please refer to the “Prolin XUI Programming Guide”.
11Printer
Prolin supports both physical printing and virtual printing, and provides developers
with uniform printing interfaces.
Virtual printer generates BMP images and saves the printing result in local disk space.
This part includes three functions: opening, resetting and closing printer.
OsPrnOpen
OsPrnReset
Return None.
Instruction
OsPrnClose
OsPrnSetSize
OsPrnSetDirection
OsPrnSetGray
OsPrnSetSpace
OsPrnReset( ) is called.
2. The default character space is 0 pixel.
3. The default line space for thermal printer and stylus printer
is 0 pixel and 2 pixels, respectively.
4. The maximum line space is 255 pixels.
5. The maximum character space is 255 pixels.
6. Invalid parameter will not change current settings.
OsPrnSetReversal
OsPrnSetIndent
OsPrnCheck
Return ERR_PRN_PAPERO
Out of paper.
UT
ERR_PRN_OVERHE
Printer is overheated.
AT
Instruction
OsPrnGetDotLine
OsPrnSetFont
OsPrnSelectFontSize
int SingleCodeHeight,
int MultiCodeWidth,
int MultiCodeHeight);
Function Set font size.
Width control of single code font. (For
SingleCodeWi non-monospaced font, the real width of each
dth character may not meet the setting).
The value ranges from 8 to 64.
SingleCodeHei Height control of single code font.
Parameters ght The value ranges from 8 to 64.
MultiCodeWidt Width control of multiple code font.
h The value ranges from 12 to 64.
MultiCodeHeig Height control of multiple code font.
ht The value ranges from 12 to 64.
Return None.
1. After the first calling of OsPrnOpen(), the font width and
height are both set to the default values, for single-code, it is
Instruction (12×24) , for multi-code, it is (24×24).
2. This function applies to both physical printer and virtual
printer.
OsPrnFeed
OsPrnPrintf
OsPrnPutImage
OsPrnStart
Return ERR_PRN_WRONG_
Data package format error.
PACKAGE
ERR_PRN_OVERHEA
Printer is overheated.
T
ERR_PRN_OUTOFME
Data size is too large.
MORY
1. OsPrnStart() will begin printing task and will not return until
the task is completed.
2. After completing printing task, OsPrnStart() will return the
printer status in return value. Therefore, it is not necessary to
check printer status.
3. After the printing task is finished, slip will be reprinted if this
function is called again.
Instruction 4. After setting parameter persist.sys.continue.print in the
registry to enable the function of continuing to print after a
shutdown, if event like lacking paper or the printer is
overheated occurs during the printing process,after adding
some more paper or waiting for the machine to cool down,
call this function again will continue the printing from where it
left off. But it doesn’t support continue to print after the
terminal has been rebooted.
OsPrnClrBuf
Parameters None
Return None
Instruction
OsPrnSetParam
Return ERR_INVALID_PARA
Invalid parameter
M
1. This setting only affect the pre-feeding printing paper
Instruction function, and pre-feeding is enabled by default.
2. This function only applies to thermal printer.
11.5 POSIX
Prolin physical printer driver provides application developers with POSIX interface.
Open
Read
buf[0] Description
0x00 Normal
Sample code:
unsigned char buf[10];
int ret = read(handle, buf, 2);
if (ret > 0) {
//buf[0]
}
Write
The first two bytes of buffer are gray setting 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.
From buf[2] on, every line is composed of 48 characters (384 dots), if less than 48
characters, the driver will be padded with 0x00.
Sample code:
unsigned char buf[50];
buf[0] = 0x01;
memset(buf + 2, 0xff, 48);
1. For 384 dots thermal printer, when printing horizontally, the driver can deal with
5000 dot lines each time at most; otherwise, the printer will not work.
2. When printing vertically, the driver can deal with 384 lines each time at most, and
each line can print 5000 dots at most; otherwise, the printer will not work.
Close
close (handle);
12Font Library
Prolin uses 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 */
char FontName[64]; /* Font name */
}FT_FONT;
FT_DOT
typedef struct {
unsigned char Left; /*Left base-line shift*/
unsigned char Top; /* Top base-line shift*/
unsigned char Width; /* Font width */
unsigned char Height; /* Font height */
unsigned char Dot[3072]; /*Valid font data */
}FT_DOT;
OsEnumFont
OsOpenFont
OsCloseFont
OsGetFontDot
13Code
Prolin uses UTF-8 as the default code and provides interfaces to converse code.
OsCodeConvert
array.
Conversion succeeded. Return the
>=0
Return length of converted string.
ERR_INVALID_PARAM Invalid parameter
The system supports conversions among the following codes.
ISO-8859-(1,2,3,4,5,6,7,8,9,10,11, 13,14,15,16)
cp(850,874,932,1250,1251,1252,1253,1254,1255,1256,1257,1
258)
GBK/GB18030(2 bytes part)
BIG5
SHIFT_JIS
Instruction EUC-KR
UNICODE
UTF-8
Notes:
1. The above codes are only suggested to convert with UTF-8
code, conversions between other codes might fail.
2. UNICODE uses the Little-Endian mode.
14MSR
Prolin provides interfaces to read data from MSR. Additionally, the customized MSR
decoding logic can be implemented by application which can access the driver of card
reader and directly get the bit-stream of magnetic stripe through POSIX interface.
MSR data structure: Record information and status of each magnetic track.
ST_MSR_DATA:
typedef struct {
unsigned char TrackData[256]; /* Decoded bit stream*/
int DataLen; /* Track data length*/
int Status; /*Track data status, 0 means succeeded, other value means
failed*/
}ST_MSR_DATA;
OsMsrOpen
OsMsrClose
OsMsrReset
OsMsrSwiped
OsMsrRead
OsMsrReadJIS
ED
ERR_INVALID_PARAM Invalid parameter.
ERR_DEV_NOT_OPEN Device is not open.
1. If any track’s data is not needed, set the corresponding pointer
to NULL, then the data will not be outputted.
2. All track data must be read out within 30 seconds after swiping
card successfully; otherwise, all track data will be cleared
automatically and output data are all 0x00.
Instruction
3. Track 4 is used to store the JCB (JIS II) data, and track 1-3 is
used to store the data in other formats.
4. If the magnetic head of one side has not detected any tracks,
ERR_MSR_NO_TRACK_ERR will be returned to the Status of
the corresponding Track.
In this chapter, all protocol interfaces for IC card are based on ISO7816/EMV.
ST_ APDU_REQ
typedef struct
{
Unsigned char Cmd[4]; /*CLA, INS, P1, P2*/
int LC; /* The valid length of DataIn sent to IC card */
unsigned char DataIn[512];/* The data sent to ICC */
int LE; /* The expected length of returned data*/
}ST_ APDU_REQ;
ST_APDU_REQ structure:
ST_ APDU_RSP:
typedef struct
{
Int LenOut; /* Data length returned from ICC*/
unsigned char DataOut[512]; /*Data pointer returned from ICC */
unsigned char SWA; /*status word 1 of ICC */
OslccOpen
OsIccDetect
This interface will power off the SAM card. Please ensure this
interface is called before resetting SAM card.
OsIccInit
card slot 3
ICC_SAM4_SLOT SAM
card slot 4.
(Bit 0~1) Card voltage options:
00 - 5V, 01 - 1.8V,
10 - 3V
(Bit 2)Support PPS protocol:
0 – Unsupported;
1 – Supported.
(Bit 3~4)Rate used in power-onreset:
00 – Standard rate 9600;
10 – Four times rate 38400.
The rate mentioned here is a
reference value in typical frequency
(3.57MHz).
Option The communication rate between IC
card and card reader is closely related
to working clock frequency provided by
a specific machine.
(Bit 5) Supported standards:
0 – EMV;
1 - ISO7816.
If EMV mode is specified, the power
on rate will be marked as invalid and it
will use the standard rate by default.
(Bit 6 ~31)Reserved
“Option” is set to 0 by default (that is,
5V, non-PPS, standard rate, and
conforming to EMVx).
1. Answer To Reset (ATR). The card
will return response data of 34
Atr [Output] bytes at most.
2. Contents: Length of ATR (1 byte)
and ATR.
Return RET_OK Succeeded.
Please refer to IC Card Return Code
Others
List.
Instruction 1. ATR output buffer should be allocated at least 34 bytes.
2. Whether PPS communication parameters negotiation
protocol is supported or not depends on the specific card.
3. Some terminals can only work with one SAM card at a time.
If several cards need to be operated at the same time,
OsIccExchange
List.
Instruction
OsIccClose
16RF Reader
not exist.
PCD_ERR_USER_CANCEL -2912 Transaction is cancelled.
PCD_ERR_CARRIER_OBTAIN_
-2913 No obtained carrier
FLAG
PCD_ERR_CONFIG_FLAG -2914 Fail to configure register.
The returned data length
PCD_ERR_RXLEN_EXCEED_FL
-2915 exceeds the set
AG
receiving length
PCD_ERR_NOT_ALLOWED_FL Parameter error or
-2951
AG invalid value.
Chip is abnormal or does
PCD_CHIP_ABNORMAL -2952
not exist.
PCD_CHIP_NOT_OPENED -2953 Module is not open.
PCD_CHIP_CARDEXIST -2954 Card is not removed.
PCD_ERR_NOT_IDLE_FLAG -2955 Card is not in idle state.
PCD_ERR_NOT_POLLING_FLA
-2956 No polling
G
PCD_ERR_NOT_WAKEUP_FLA
-2957 Card does not wakeup.
G
PCD_ERR_NOT_ACTIVE_FLAG -2958 Card is not activated.
PCD_ERR_NOT_SUPPORT -2959 Chip is unsupported.
ERR_BATTERY_VOLTAGE_TO Battery voltage is too
-1024
O_LOW low.
For more information about the request data structure and response data structure,
please refer to Chapter IC Card Reader 15.2.1 and 15.2.2.
PCD_USER_ST
typedef struct pcd_user_t{
unsigned char wait_retry_limit_w; /* S(WTX) responds to write
permission of sending times*/
unsigned int wait_retry_limit_val; /*S(WTX)responds to the maximum
repetition times.*/
unsigned char check_cancel_key_w; /*respond to write permission of
the cancel key*/
OsPiccOpen
Return ERR_BATTERY_V
OLTAGE_TOO_LO Battery voltage is too low.
W
ERR_BATTERY_A
Battery is absent.
BSENT
1. D200 and S920 POS models must be powered by battery
to operate RF module; otherwise,
Instruction ERR_BATTERY_ABSENT will be returned.
2. When the battery voltage is 0,
ERR_BATTERY_VOLTAGE_TOO_LOW is returned.
OsPiccClose
Parameters None.
0 Succeeded.
Return Failed.(Details refer to Return Code
Others
List.)
Instruction
OsPiccResetCarrier
OsPiccPoll
OsPiccAntiSel
OsPiccActive
0 Succeeded.
Return Fail to activate card. (Details refer to
Others
Return Code List.)
Instruction
OsPiccTransfer
OsPiccRemove
OsMifareAuthority
OsMifareOperate
OsPiccInitFelica
OsPiccIsoCommand
Instruction
OsPiccSetUserConfig
int OsPiccSetUserConfig(PCD_USER_ST
Prototype
*pcd_user_config) ;
Function Set user configuration.
pcd_user_config A pointer to user configuration structure
Parameters
[Input] PCD_USER_ST.
0 Succeeded.
Return
Others Failed. (Refer to Return Code List.)
Instruction
OsPiccGetUserConfig
int OsPiccGetUserConfig(PCD_USER_ST
Prototype
*pcd_user_config);
Function Get user configuration.
pcd_user_config A pointer to user configuration structure
Parameters
[Output] PCD_USER_ST.
0 Succeeded.
Return
Others Failed. (Refer to the Return Code List.)
Instruction
OsPiccApplePoll
card is 12 bytes.
The response data length of type V
card is 2 bytes.
When the first byte is 0x01, enter a fixed
four-byte length:
"\x01\x00\x00\x00" represents
Terminal in VAS App OR Payment
Mode.
"\x01\x00\x00\x01" represents
Terminal in VAS App AND Payment
Mode.
"\x01\x00\x00\x02", represents
pucSendData[Input] Terminal in VAS App Mode Only.
"\x01\x00\x00\x03", represents
Terminal in Payment Mode Only.
When the first byte is 0x02, enter a
variable-length byte, the lower nibble of
the second byte X represents the length
of Terminal Data:
"\x02\x8X\x00\x00"+X-byte Terminal
Data.
0 Succeeded.
Return
Others Failed. (Refer to the Return Code List.)
1. Mifare card is a special kind of A card.
Instruction
2. The returned card type of M card is type A.
OsPiccOffCarrier
OsPiccInitIso15693
As model S900 and S920 are equipped with both touch screen and RF reader,
application developers should pay special attention to the following notes:
17Communication Port
OsPortOpen
2. Data bit: 7 or 8.
3. Parity check method: “o” - odd parity; “e”
- even parity; “n” - no parity.
4. Stop bit: 1 or 2.
For example, “9600, 8, n, 1\0”.
1. attr =“9600, 8, n, 1”, it represents that the
baud rate is 9600bps; 8 data bits; no
parity; 1 stop bit.
RET_OK Succeeded.
ERR_DEV_BUSY Device is busy.
Return ERR_DEV_NOT_EXIS
Port does not exist.
T
ERR_INVALID_PARA
Invalid parameter.
M
1. When program starts, OsPortOpen() must be called
successfully to open communication port; otherwise, the
related functions will fail to work.
2. Soft flow control and hard flow control will be closed.
3. Only PX7 and PX5 support 921,600 baud rate, while other
models don’t .
4. For device which conforms to HID Category Specification
Instruction and connects to terminal with USB device, PORT_USBHID
port can be used to read data. For example, it supports the
common USB barcode scanner device.
5. For terminal with only one USB HOST port, channel
PORT_USBHOST should be used to open the USB HOST
port; For terminal with two USB HOST ports, channel
PORT_USBHOST and PORT_USBHOST1 should be used
to open their corresponding USB HOST port, respectively.
TM.
OsPortClose
OsPortSend
OsPortRecv
OsPortReset
OsPortCheckTx
OsPortCheckRx
Prolin serial ports are allowed to be accessed by POSIX interfaces. Only PX7 and PX5
series models suppport soft flow control and hard flow control.
For Prolin-2.4 and Prolin-phoenix-2.5 platforms, since there is no soft link for serial
port, the corresponding relation between device nodes and serial ports can refer to
the following table. For Prolin-cygnus-2.6 and later platforms, the device nodes
corresponding to each serial port need to be determined by the soft links of
/dev/ttycom1 and /dev/ttycom2, and the specific terminals will not be updated in the
list.
Corresponding Applicable
Device node Serial port
module models
/dev/ttyAMA0 Modem Modem S800
Open
Open communication port and the device names are ttyAMA0, ttyAMA1, ttyAMA2,
ttyAMA3.
Sample code:
int fd;
fd = open(“/dev/ttyAMA1”, O_RDWR);
if(-1 == fd){
perror(“Open uart error”);
}
Read
Sample code:
charbuff [1024];
int Len = 1024;
int readByte = read (fd, buff, Len);
Write
Sample code:
charbuffer [1024];
Close
close(fd);
Sample code:
int remain;
int count;
/* Inquiry the number of bytes remained in send buffer */
ioctl(fd, TIOCOUTQ, &remain);
/* Inquiry the number of bytes remained in receive buffer */
ioctl(fd, TIOCINQ, &count);
Sample code:
Sample code:
/* Set 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;
18MODEM
Prolin system implements Modem communication through built-in serial ports to send
AT commands to Modem. Besides, there are a series of encapsulated interfaces for
developers to realize Modem communication.
Calling synchronous
communication sending
-3132
data packets retry more
than specified times.
Calling synchronous
-3133 communication sending
data packets timeout.
Calling synchronous
communication
receiving
-3134
acknowledgement
packets retry more than
specified times.
Calling synchronous
-3135 communication sending
state packet 2 errors.
Calling synchronous
-3136 communication sending
state packet 3 errors.
Calling synchronous
-3137 communication sending
state packet 4 errors.
Calling synchronous
communication
-3138 receiving data packets
retry more than
specified times.
Calling synchronous
-3139 communication sending
state packet 5 errors.
Calling synchronous
-3140 communication sending
state packet 6 errors.
Bypass telephone and
parallel telephone are
both idle (used only
when switching from
automatically sending
-3144 number to manually
answering).
In automatically sending
number mode, the
phone is not picked up
timely.
Called synchronization
-3145 handshake fails to send
handshake packet.
Called synchronization
handshake fails to
-3146
receive handshake
packet.
Called synchronization
-3147 handshake more than
specified times.
Called synchronous
-3148 communication sending
state packet 1 error.
Called synchronous
communication
-3149
receiving process 1
error.
Called synchronous
-3150 communication chip is
on-hook.
Called synchronous
communication
-3151
receiving process 2
errors.
Called synchronous
communication
-3152
receiving retry more
than specified times.
Called synchronous
-3153 communication sending
state packet 2 errors.
Called synchronous
-3154 communication sending
data packet error
Called synchronous
communication
-3155
receiving process 3
errors.
Called synchronous
communication
-3156 receiving packet retry
more than specified
times.
Called synchronous
-3157 communication sending
state packet 3 errors.
Called connection
-3160 receiving ring
information error.
Called connection fails
-3161
to detect line voltage.
Called connection
-3162 detecting line voltage
data format error.
Called connection
-3163 voltage is less than
threshold value.
Called connection
-3164
timeout.
Called asynchronous
-3165
line rate format error.
Called asynchronous
-3166
line rate is illegal.
Called connection
-3167
information format error.
Called connection fails
-3170
to set command string 1.
Called connection fails
-3171
to set command string 2.
Called connection fails
-3172 to set extended
command string.
Calling connection fails
-3175
to set command string 1.
Calling connection fails
-3176
to set command string 2.
Calling connection fails
-3177
to set command string 3.
Calling connection fails
-3178
to set command string 4.
Calling connection fails
-3179
to set command string 5.
Communication with
-3199 Daemon communication
fails or error.
Modem is using the
-3200
binding serial port.
-3201 Fail to create Socket.
-3202 Fail to connect Socket.
-3203 Fail to send Socket.
Fail to create
-3204
semaphore.
Fail to set semaphore
-3205
value.
Semaphore is
-3206
pre-occupied.
Fail to release
-3207
Semaphore.
Fail to initialize
-3208
Semaphore.
-3209 Fail to gettimeofday.
More than 2 links are
-3210
using modem daemon.
Received cancel button
ERR_MDM_CANCEL_CONNECT -3211
in dial-up process.
The request of receiving
data is rejected.
-3212
(Receive buffer is
empty.)
Calling connection fails
-3213
to set command string 7.
Calling connection fails
-3214
to set command string 8.
FSK sending timeout,
-3215 but still has data in send
buffer.
Invalid data length
-3216 (len=0 or len>2048),
won’t send data.
ERR_MDM_INIT -3217 Fail to initialize Modem.
If no or error
-3218 implementation of
OsModemConnect(),
then implement
OsPppomLogin()
orOsPppomCheck().
Modem or ModemPPP
-3219 is being used, Modem
cannot be powered off.
Modem is not powered
-3220
on.
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_PRE_DIA
Pre-dial.
L
CallMode MODEM_DIAL Dial.
MODEM_WAIT_CA
Called/Answer the call.
LL
MODEM_COMM_S
Synchronization.
YNC
CommMode
MODEM_COMM_A
Asynchronization.
SYNC
MODEM_CODE_D DTMF(Dual Tone Multiple
TMF Frequency) dialing.
Pulse dialing 1(Pulse rate 10/s;
MODEM_CODE_P
break-make ratio1.6:1; signal
ULSE1
CodeType interval>=500ms).
Pulse dialing 2(Pulse rate 10/s;
MODEM_CODE_P
break-make ratio2:1; signal
ULSE2
interval >=600ms).
Other values Reserved.
none-manually-answering
mode).
Do not detect whether the
parallel telephone is occupied
FALSE (used in Caller dialing or
none-manually-answering
mode).
Detect dial tone.
TRUE Refer to the instruction of
DetectDialTone DialTone Timeout.
FALSE Do not detect dial tone.
DialToneTimeou 1. If detecting dial tone:
t DialToneTimeout () refers to the longest waiting time for
the dial tone after off-hook. During this process, system
will exit waiting as long as the dial tone is detected.[Unit:
100ms]
2. If not detecting dial tone:
DialToneTimeout () refers to the waiting time from
off-hook to dialing.[Unit: 100ms]
The valid timeout ranges from 20 to 50. Minimum value
and the default value are both set to 20.
In both cases above, the time is started about 450~500ms
after off-hook.
CommaPauseTi “,”waiting time when dialing an outside line.[Unit: 100ms]
me This value should be set according to the actual
application environment. Some interfaces should be
reserved for manual setting.
The valid range is from 0 to 255. The value range doesn’t
apply to S800 whose valid range is from 1 to 26s. (It is
inconsistent with the Datasheet because of the modem
patch).
ConnectRate[20] The rate of connection and communication(Expressed as
a string):
“1200”/*1200 bps fast connect */
“1200,V22”/*1200 bps normal connect */
“1200,V23C”/*1200 bps for V.23C(FSK) */
“1200,B202”/*1200 bps for Bell 202(FSK) */
“2400,FC”/*2400 bps fast connect */
“2400”/*2400 bps normal connect*/
“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",the system will select “1200” by default
in synchronous communication and select the maximum
rate that the chip supports by default in asynchronous
communication.
S800 supports baud rate.
Asynchronization:
“1200”/*1200 bps */
“1200,V22”/*1200 bps normal connect */
“1200,V23C”/*1200 bps for V.23C(FSK) */
“1200,B202”/*1200 bps for Bell 202(FSK) */
“2400,FC”/*2400 bps fast connect */
“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 */
Synchronization:
“1200”/*1200 bps */
“1200,V22”/*1200 bps normal connect */
“2400,FC”/*2400 bps fast connect */
“2400”/*2400 bps*/
“9600”/*9600 bps*/
ConnectFormat[ Format of connection and communication(Expressed as a
20 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.
For synchronous communication, the system will select
“8, n, 1”automatically.
Connection timeout. [unit: second]
ConnectTimeout
The valid timeout ranges from 0 to 60s.
The total number of dial-up cycle.
The valid range is 1 to 255. 0 will be converted to 1
DialTimes
automatically.
Dialing all the dialer numbers is one dial-up cycle.
If there is no data exchange in application-layer within
specified time, MODEM will hang up.[Unit: 10s]
IdleTimeout
0 means no timeout. The maximum timeout is 900s. This
value is invalid to ModemPPP.
TRUE Modem PPP communication
Pppom
FALSE Common Modem communication
Reserved[9] Reserved.
18.3 OsModemOpen
18.4 OsModemClose
18.5 OsModemSwitchPower
Parameter
int OnOff OnOff=1, power on,
s
OnOff=0, power off.
RET_OK Succeeded.
18.6 OsModemConnect
pre-dial.
4. For ModemPPP, OsModemConnect() should be called first
and set ST_MODEM_SETUP.Pppom to 1
(OsModemOpen() doesn’t need to be executed), then call
OsPppomLogin().
5. After Modem dialed successfully, calling OsSysSleep() or
OsSysSleepEx(2) will return ERR_DEV_BUSY, and the
system cannot sleep. After Modem is hung up, the system
can sleep by calling sleep function.
18.7 OsModemCheck
Y
Telephone line is not connected
ERR_MDM_NO_LINE
(Line voltage is 0).
ERR_MDM_NO_CARRIER Carrier wave of telephone is lost.
ERR_DEV_NOT_OPEN Device is not open.
1. This function can be used to check whether the pre-dial is
successfully connected.
Instruction 2. After calling OsModemOpen(), OsModemHangup() or
OsModemClose(), the status of the last Modem dial will
become MODEM_IDLE.
18.8 OsModemExCmd
18.9 OsModemHangup
If dialing the number again right after hanging up, the Modem will
wait and start redialing after 3 seconds so as to allow PABX to
finish hanging up action and transmitting dialing tone again.
18.10 OsModemSend
18.11 OsModemRecv
18.12 OsPppomLogin
18.13 OsPppomCheck
18.14 OsPppomLogout
19Network
Communication
Prolin uses unified network protocol stack to manage different physical links. Prolin
provides a standard socket programming for network communication.
#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;
if(-1 == bind(SocketFD,(struct sockaddr *)&stSockAddr,
sizeof(stSockAddr)))
{
perror("error bind failed");
close(SocketFD);
exit(EXIT_FAILURE);
}
if(-1 == listen(SocketFD, 10))
{
perror("error listen failed");
close(SocketFD);
exit(EXIT_FAILURE);
}
for(;;)
{
int ConnectFD = accept(SocketFD, NULL, NULL);
if(0 > ConnectFD)
{
perror("error accept failed");
close(SocketFD);
exit(EXIT_FAILURE);
}
/* perform read-write operations ... read(ConnectFD,buff,size)*/
if (-1 == shutdown(ConnectFD, SHUT_RDWR))
{
perror("cannot shutdown socket");
close(ConnectFD);
exit(EXIT_FAILURE);
}
close(ConnectFD);
}
return EXIT_SUCCESS;
}
/* Client code in C language*/
#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 KeepAlive = 1;
int SocketFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (-1 == SocketFD)
{
perror("cannot create socket");
exit(EXIT_FAILURE);
}
Res = setsockopt(SocketFD, SOL_SOCKET, SO_KEEPALIVE, (void
*)&KeepAlive, sizeof(KeepAlive));
if (-1 == Res)
{
perror("cannot set keepalive");
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)
{
#include <netinet/in.h>
#include <unistd.h> /* for close()socket */
#include <stdlib.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;
memset(&sa, 0, sizeof sa);
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = INADDR_ANY;
sa.sin_port = htons(7654);
fromlen = sizeof(sa);
if (-1 == bind(sock,(struct sockaddr *)&sa, sizeof(sa)))
{
perror("error bind failed");
close(sock);
exit(EXIT_FAILURE);
}
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>
20Network Configuration
Prolin provides network configuration interfaces, including ARP setting, Ping service,
DNS configuration, network card configuration, DHCP service, routing setting and
PPPoE service etc.
device.)
TCP / UDP session is
ERR_NET_SESS_BROKEN -3308
disconnected.
ERR_NET_PASSWD -3309 Wrong password.
Application logout
ERR_NET_LOGOUT -3310
actively.
ERR_NET_INIT -3311 Initialization failed.
DHCP Server is not
ERR_NET_DHCP_DISCOVER -3312
found.
DHCP cannot get the IP
ERR_NET_DHCP_OFFER -3313
address.
ERR_NET_DHCP_START -3314 DHCP is not started.
DNS cannot analyze the
ERR_NET_DNS -3315
corresponding domain.
The port specified by the
ERR_NET_SERV_USING -3316
server is in use.
Domain name server is
ERR_NET_NODNServer -3317
not configured.
Link is disconnected by
ERR_NET_LINKDOWN -3318
the server.
Cannot connect to the
ERR_NET_CONN -3319
specified server.
ERR_NET_TIMEOUT -3320 Connection timeout.
ERR_NET_PPP -3321 PPP connection error.
PPPoE server is not
ERR_NET_SERV -3322
found.
Request resource is not
ERR_NET_AGAIN -3323
found, please try again.
Cannot connect to
ERR_NET_AUTH -3324
RADIUS server.
Windows server is not
ERR_PPP_SERV_NOTREADY -3325 ready when connected
to ppp_direc.
ERR_NET_ICMPV6_UNREACH -3327 Target is unreachable.
ERR_NET_ICMPV6_PKT_TOOBI SIZE is greater than the
-3328
G minimum MTU.
TTL exceeds the
ERR_NET_ICMPV6_TIME_EXCE
-3329 maximum value
ED
(default value:64).
Protocol parameter
ERR_NET_ICMPV6_PARAMPRO error; cannot process
-3330
B middle route or target
node.
Unrecognizable
ERR_NET_DHCPV6_DNS -3331 keywords or illegal IP
address in Resolv.conf.
Macro Description
NET_LINK_ETH Ethernet.
Wireless network, including GPRS, CDMA,
NET_LINK_WL
TDSCDMA
NET_LINK_WIFI WiFi
NET_LINK_PPPOE ADSL link
NET_LINK_MODEM Modem PPP link
NET_LINK_PPPDIRECT ppp_direct link
NET_LINK_BT Bluetooth link
NET_LINK_USB USB link
Data Structure
IPv6Info is used to get an existed IPV6 address, and link address, site address and
global address are different.
Struct IPv6Info
Struct IPv6Info{
char LinkAddr[64]; /*Link address of IPv6,at most 1 link address*/
int NumSiteAddr; /*Number of site address of IPv6*/
char SiteAddr[4][64]; /*Site address of IPv6,at most 4 site
addresses*/
int NumGlobalAddr; /*Number of global address of IPv6*/
char GlobalAddr[8][64]; /*Global address of IPv6,at most 8
addresses*/
int NumDns; /*Number of DNS*/
char Dns[2][64]; /*DNS address*/
}
IPv6RouteTable
struct IPv6RouteTable{
Char RouteNum; /* The number of items in the routing table
*/
Struct {
char DestAddr[64]; /*Prefix of destination address*/
char DestAddrPrefixLen; /*Not supported*/
char NextHop[64]; /*Next hop address*/
}RouteTable[16];
}
DnsAddrInfo
struct DnsAddrInfo{
int NumIPv4Addr; /*numbers of IPv4 addr*/
char IPv4Addr[4][16]; /*IPv4 addr*/
int NumIPv6Addr; /*numbers of IPv6 addr*/
char IPv6Addr[4][64]; /*IPv6 addr*/
};
Structure: IPv4RouteTable
IPv4RouteTable
struct IPv4RouteTable{
int RouteNum;/* number of Route*/
struct{
char DestAddr[16];/* dest addr*/
OsNetAddArp
IP address.
Parameters The format is “XXX.XXX.XXX.XXX”. The value
Addr[Input] range of XXX is from 0 to 255. e.g.:
“192.168.0.1”.
It can’t be NULL.
The MAC address corresponding to the IP
MAC[Input] address;
The size of MAC is 6 bytes. It can’t be NULL.
RET_OK Succeeded.
ERR_INVALID_PARAM Invalid parameter.
Return
The network link cannot be used
ERR_NET_IF
(not established or disconnected).
Instruction
1. Static ARP table is used to resist the attack from ARP Cheat.
2. Static ARP table is obtained dynamically, so application
doesn’t need to configure it.
OsNetPing
OsNetPingEx
OsNetDns
OsNetDnsEx
OsNetSetConfig
RET_OK Succeeded
Network link cannot be used (not
ERR_NET_IF
Return established or disconnected).
ERR_INVALID_PAR
Invalid parameter.
AM
1. The DHCP function will be stopped after calling this function
successfully.
2. The function only checks the validity of Addr, Mask and
Gateway’s formats without checking the matching relation
Instruction between them.
3. Wireless link, PPPoE, and ModemPPP is dynamically
allocated and cannot be configured by this interface.
4. After configuring network information successfully, this link
will be set as the default route.
OsNetGetConfig
can be NULL.
DNS server address.
The size of DNSServer should be at least 16
DNSServer[In
bytes. Format is “XXX.XXX.XXX.XXX”, XXX
put]
ranges from 0 to 255.
e.g.: “192.168.0.1” and it can be NULL.
RET_OK Succeeded.
Return Network link cannot be used (not established or
ERR_NET_IF
disconnected).
Instruction
OsNetStartDhcp
RET_OK Succeeded.
Return
ERR_NET_IF Ethernet or WiFi module is not configured.
1. This interface is just used to start the DHCP and will not wait
for the address allocation process.
2. OsNetCheckDhcp() can be called to check the status of
Instruction
address allocation.
3. After obtaining the address successfully, this link will be set
as the default route.
OsNetCheckDhcp
OsNetStopDhcp
Return None.
1. If the DHCP is stopped, OsNetSetConfig() shall be called to
re-configure the network;
Instruction 2. After a successful DHCP, the system will update the
configuration information at regular interval; if the update
fails, the network will be unavailable.
OsPppoeLogin
OsPppoeCheck
OsPppoeLogout
Return None.
Instruction
OsNetSetRoute
OsNetGetRoute
OsNetSetRouteTable
OsNetDelRouteTable
OsNetGetRouteTable
ERR_NET_SESS_B
Connection error
ROKEN
Application can call OsNetGetRouteTable() to acquire the
Instruction
route information of IPv4 address.
OsNetNat
The following interfaces apply to both IPv4 and IPv6 network environment.
OsNetSetDns
OsNetPing6
OsNetSetIPv6Addr
OsNetGetIPv6Addr
OsNetGetRouteAdvertise6
Case IP6_STATELESS_ADDR_AUTOCONFIG:
break; /*do not need to call DHCPv6*/
Case IP6_DHCP6_STATEFULL_ADDR_CONFIG :
ret=OsNetStartDhcp6(NET_LINK_ETH,IP6_DHC
P6_STATEFULL_ADDR_CONFI
G);
if(ret != RET_OK)
{……};
break;
Case IP6_DHCP6_STATELESS_ADDR_CONFIG:
ret=OsNetStartDhcp6(NET_LINK_ETH,IP6_DHC
P6_STATELESS_ADDR_CONFI
G);
if(ret != RET_OK)
{……};
break;
}
}
……
OsNetStartDhcp6
ERR_INVALID_PARA
Invalid parameter (AddrInfo is NULL).
M
OsNetCheckDhcp6
OsNetStopDhcp6
OsNetSetRouteTable6
OsNetGetRouteTable6
21GPRS/CDMA
Prolin supports GPRS and CDMA network and provides a series of related APIs for
developers.
OsWlLock
OsWlUnLock
OsWlInit
OsWlInitEx
intOsWlInitEx(constchar*SimPin,
intTimeOutMs,
Prototype
char*CmeString,
int Size);
Function Initialize wireless device.
A pointer to SIM card PIN.
The valid string length is less than 50
SimPin[Input] bytes.
It can be NULL, which means it doesn’t
need any password.
Timed out time,[unit:ms];
Parameters Valid range is from 25000 to 100000;
TimeOutMs[Input] When the time is less than 25000, it will
be set to 25000 automatically;
When the time is more than 100000, it
will be set to 100000 automatically.
CmeString[Output] Reserved. Current value is NULL.
Size[Input] Reserved. Current value is 0.
WL_CSD_READY CSD dialupservice is ready.
WL_GPRS_CSD_RE GPRS and CSD dialup service are
ADY ready.
Return
ERR_DEV_NOT_OP
Device/ module is not open.
EN
ERR_DEV_NOT_EXI Wireless device/ module does not
ST exist.
There’s no physics serial port for
ERR_NO_PORT
terminal.
ERR_WL_NEEDPIN SIM card needs PIN.
ERR_WL_RSPERR Device/ module response error.
ERR_WL_NORSP Module has no response.
ERR_WL_NEEDPUK SIM card needs PUK.
ERR_WL_WRONG_
PIN error.
PIN
ERR_WL_NOSIM There’s no SIM card.
ERR_WL_PPP_ONLI
PPP online.
NE
ERR_WL_NOREG Could not register to the network.
ERR_INVALID_PAR
Invalid parameter.
AM
1. Before calling this function,OsWlLock() needs to be called
successfully;
2. SIM card will check PIN automatically;
3. ProlinOS will ensure wireless device/ module has powered
up;
4. When there’s no SIM card inside the terminal, application
can only use the functions which do not need SIM card;
5. After calling OsWlSwitchPower() to power up, application
program needs to wait more than 15 seconds to execute
OsWlInitEx(), otherwise, it may return failure which caused
Instruction by unstable module;
6. When ERR_WL_NOREG is returned, application program
should stop dialing and other operations.
7. When WL_CSD_READY is returned, it indicates that
application program can process CSD service;
8. When WL_GPRS_CSD_READY is returned, it indicates that
application program can process GPRS or CSD service;
9. If CSD service is being used now, and GPRS service will be
used in the future, OsWlInitEx() needs to be called to
reinitialize.
10. When PPP is online, calling OsWlInitEx() will return error.
OsWlSwitchPower
1: on
0: off
RET_OK Succeeded.
ERR_DEV_NOT_E
Wireless module does not exist.
Return XIST
ERR_DEV_NOT_O
Fail to call OsWlLock().
PEN
1. Please reboot terminal to reset wireless module in special
cases such as always failing to call OsWlLogin().
2. Unless it is a special occasion, it is not recommended to call
this function. Because after calling this function to power off
Instruction the wirelss module,the wireless network needs to be
registered again when powering on the wireless device,
which will descrease the success rate of OsWlLogin().
OsWlSwitchSleep
RET_OK Succeeded.
ERR_DEV_NOT_EXIS
Module does not exist.
T
Return ERR_DEV_NOT_OPE
Fail to call OsWlLock().
N
ERR_WL_PPP_ONLI
PPP is online.
NE
Instruction It is reserved and yet not supported.
no SIM card,
deactivated PIN,
OsWlGetSignal
OsWlCheck
OsWlLogin
dialing up.
User name.
The valid string length ranges from 0 to 50
Name[Input] characters.
It can’t be NULL. If there is no user name, a
null string “” can be used instead.
Password.
The valid length ranges from 0 to 50
Password[Input] characters.
It can’t be NULL. If there is no password, a
null string “” can be used instead.
Authentication algorithms.
The system supports the following
algorithms:
PPP_ALG_PA 0x000000 PAP
P 01 authenticat
ion
algorithm
PPP_ALG_CH 0x000000 CHAP
AP 02 authenticat
ion
algorithm
PPP_ALG_MS 0x000000 MSCHAPV
CHAPV1 04 1
authenticat
ion
Auth
algorithm
PPP_ALG_MS 0x000000 MSCHAPV
CHAPV2 08 2
authenticat
ion
algorithm
PPP_ALG_ALL 0xff All
algorithms
are
supported
At least one type of authentication or several
authentications with (+) or (|) should be used, for
example, PPP_ALG_PAP| PPP_ALG_CHAP.
If the algorithm is unknown, fill in parameter
PPP_ALG_ALL.
Timeout.[unit:ms]
TimeOutMs
The valid timeout ranges from 0 to 3600000.
OsWlLoginEx
Authentication algorithm.
The system supports the following
authentication algorithms:
PPP_ALG_PA 0x000000 PAP
P 01 authenticat
ion
algorithm
PPP_ALG_CH 0x000000 CHAP
AP 2 authenticat
ion
algorithm
PPP_ALG_MS 0x000000 MSCHAPV
CHAPV1 04 1
authenticat
ion
Auth algorithm
PPP_ALG_MS 0x000000 MSCHAPV
CHAPV2 08 2
authenticat
ion
algorithm
PPP_ALG_ALL 0xff All
algorithms
are
supported
At least one type of authentication or several
authentications with (+) or (|) should be used, for
example, PPP_ALG_PAP| PPP_ALG_CHAP.
If the algorithm is unknown, fill in parameter
PPP_ALG_ALL.
Timeout.[unit:ms]
The valid timeout ranges from 0 to 3600000.
TimeOutMs If timeout <0, it will be automatically set to 0.
If timeout >3600000, it will be automatically
set to 3600000.
Time interval for link check.[unit:ms]
The valid value ranges from 0 to 3600000.
When it is 0, KeepAlive function is disabled;
KeepAlive When it is 0~10,000, it will be set to 10,000
automatically;
When it is 10,000 ~360,000, the
corresponding setting value will be used.
OsWlLogout
OsWlSelSim
RET_OK Succeeded.
ERR_DEV_NOT_EXIST Module does not exist.
Return ERR_DEV_NOT_OPEN Fail to call OsWlLock().
ERR_WL_ERR_BUSY Module is busy.
Other non-zero value Refer to Return Code List.
1. OsWlLock() must be called successfully before calling this
function.
2. OsWlInit() shall be called again to initialize module after
successfully calling OsWlSelSim(). In this process, the
Instruction module will be powered off and then powered on, this
function will block for about 15 seconds.
3. If the selected card slot has a bad card or has no card, the
function will still return; when logging in, whether it is a bad
card or no card can be detected.
22WiFi
Prolin WiFi supports two modes: Station and IBSS work mode.
Station mode: the communication between the terminal and Access Point (AP), such
as wireless router.
Authentication Modes:
WIFI_AUTH_MODE
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
};
WEP_SEC_KEY
typedef struct _WepSecKey{
char Key[4][40]; /* WEP key data */
int KeyLen; /* Length of WEP key data */
int Idx; /* WEP key index [0,3] */
} WEP_SEC_KEY;
WPA_PSK_KEY
typedef struct _WpaPskKey{
char Key[64]; /* PSK-Key data */
int KeyLen; /* PSK-Key data length */
} WPA_PSK_KEY;
WPA_EAP_KEY
typedef struct _WpaEapKey{
int EapType; /* EAP type */
char Pwd[132]; /* Password */
char Id[132]; /* Identity */
char CaCert[132]; /* Path and filename of CA certificate */
char CliCert[132];/* Path and filename of client certificate */
char PriKey[132]; /*Private key file from file path to client */
char PriKeyPwd[132]; /* Private key file of password */
} WPA_EAP_KEY;
ST_WifiApInfo
typedef struct _WifiApInfo
{
char Essid[33]; /* AP name */
char Bssid[20]; /* MAC address */
int Channel; /* Information channel */
int Mode; /* Connection mode, 0:Station; 1:IBSS */
int Rssi; /* Signal value, the value range is [-99,0] */
int AuthMode; /* Authentication mode*/
int SecMode; /* Encryption mode, NONE,WEP,TKIP,CCMP */
}ST_WifiApInfo;
Connect to AP settings:
ST_WifiApSet
typedef struct _WifiApSet
{
char Essid[33]; /* AP name, valid length is not more than 32 bytes,
ending with ‘\0’*/
char Bssid[20]; /* MAC address, ending with ‘\0’; Bssid can be‘\0’ if there
is no AP with the same ESSID*/
int Channel; /* Information channel, which is valid only in IBSS
mode; 0: default setting */
int Mode; /* Connection mode, 0:Station; 1:IBSS */
int AuthMode; /* Authentication mode */
int SecMode; /*Encryption mode, NONE,WEP,TKIP,CCMP*/
union KEY_UNION{ /* Key setting */
WEP_SEC_KEY WepKey; /* WEP mode */
WPA_PSK_KEY PskKey; /*wpa,wpa2-psk mode*/
WPA_EAP_KEY EapKey; /* wpa,wpa2-eap mode*/
} KeyUnion;
}ST_WifiApSet;
WPS Mode
enum WPS_MODE
{
WPS_MODE_PBC = 1; /* Use keypad to connect, it is also called PBC
connection */
22.4 OsWifiOpen
Function Connect with WiFi server and obtain usage rights of WiFi
module.
Parameters None
RET_OK Succeeded.
ERR_DEV_NOT_EXIS Abnormal loading of module driver or
T module error.
ERR_DEV_BUSY WiFi is busy.
Return
ERR_BATTERY_VOLT
AGE Battery voltage is too low.
_TOO_LOW
ERR_BATTERY_ABS
Battery does not exist.
ENT
1. D200 and S920 POS models must be powered by battery
before accessing Wifi; otherwise,
ERR_BATTERY_ABSENT will be returned.
Instruction
2. When the battery voltage is 0, the module fails to work
normally and returns
ERR_BATTERY_VOLTAGE_TOO_LOW.
22.5 OsWifiClose
Prototype voidOsWifiClose(void);
Function Release the usage right of WiFi module.
Parameters None
Return None
22.6 OsWifiSwitchPower
22.7 OsWifiScan
return -1;
for(i=0; i<num; i++)
printf("[%d] AP name: %s\n", i,Aps[i].Essid);
22.8 OsWifiConnect
22.9 OsWifiDisconnect
Parameters None.
RET_OK Succeeded.
Return ERR_DEV_NOT_OP
Fail to access WiFi device.
EN
Instruction
22.10 OsWifiCheck
22.11 OsWifiCmd
RET_OK Succeeded.
ERR_INVALID_PAR
Invalid parameter.
AM
Return ERR_WIFI_POWER
WiFi module is powered off.
_OFF
ERR_DEV_NOT_O
Fail to access WiFi device.
PEN
1. Argv can be all the commands and parameters supported
by WPA_Supplicant, such as ‘SCAN’ command.
2. If there is only one command in Argv, set Argc to 1.
Instruction
3. This function is called only when other WiFi APIs cannot
meet requirements.
4. Result is the original return value of WPA_Supplicant.
22.12 OsWifiWpsConnect
23GPS
GPS_LOCATION
typedef struct {
double latitude; /*Latitude, unit: degree.*/
double longitude; /*Longitude, unit: degree.*/
double altitude; /*Altitude, unit: meter.*/
} GPS_LOCATION;
23.3 OsGpsOpen
23.4 OsGpsRead
RET_OK Succeeded.
ERR_INVALID_PAR
Invalid parameter.
AM
ERR_DEV_NOT_EXI
Device does not exist.
ST
ERR_DEV_NOT_OP
GPS module is not open.
EN
1. Only when RET_OK is returned, can GPS location
information be read correctly.
2. Influenced by GPS signal, the positioning may take several
minutes, and the correct location information cannot be
read until the positioning is completed. In an extreme case
(places without GPS signal such as indoor, tunnel etc.),
when GPS signal cannot be searched, GPS_NAVIGATING
will be returned all the time until the positioning is
completed.
Instruction
3. For the terminals with ro.fac.gps equal to 3, because the
their GPS modules are integrated into the wireless module,
therefore, during the process of using GPS, if
OsWlSwitchPower() is called to power off the wireless
module, ERR_DEV_NOT_OPEN will be returned for
OsGpsRead(). At this point, the application needs to call
OsGpsClose() to release the resources. After powering on
the wireless module, call OsGpsOpen() again to open GPS
device.
23.5 OsGpsClose
24 Base
24.1 Introduction
Newly added base APIs are used for operating base-set, including detecting whether
the handset is on base and opening/detecting/closing the communication mode of
handset-base.
When the communication mode is enabled on the handset-base, functions will be
extended on base; (B920 extends the Ethernet function, and Px Dock extends printer
and scanner functions). When the communication mode is closed on the
handset-base, extended functions are invalid on base.
Mode instructions
24.3 API
OsOnBase
OsBaseOpen
Parameters None
RET_OK Succeeded
ERR_SYS_NOT_SUPP System does not support this
ORT function.
ERR_SYS_BAD System error.
ERR_TIME_OUT Timeout
Return ERR_NOT_CONNECT Bluetooth has not connected.
ERR_DEV_BUSY Device is busy.
ERR_BASE_ABSENT Base is absent.
ERR_USB_MODE USB mode error
Return values of the Bluetooth
Others
module
1. After opening the handset mode, API of serial port, modem
and Ethernet will be switched to the port which is
corresponding to the operation base side;
Instruction 2. When the connection mode between the handset and the
base is USB, please ensure the USB works in single
channel mode, otherwise the interface will return
ERR_USB_MODE.
OsBaseCheck
module
Call this function in the Bluetooth base, the Bluetooth
connecting state and base state will be returned.
Enumeration as follow:
enum {
BASE_STATE_OPENED = 0, /* Base is open */
Instruction
BASE_STATE_CONNECTING, /* Connecting*/
BASE_STATE_CONNECTED, /* Bluetooth is
connected but base is not open. */
};
OsBaseClose
OsBaseScan
ERR_TIME_OUT Timeout
ERR_INVALID_PAR
Invalid parameter.
AM
ERR_MEM_FAULT Memory application failed.
ERR_DEV_BUSY Device is busy.
ERR_LIB_NOT_FOU
Bluetooth library cannot be found.
ND
Others Return values of the Bluetooth module
Instruction
Sample code
typedef struct _HandsetLinkInfo {
int type; //Reserved for future use
union {
struct {
char name[32]; //Bluetooth name
char mac[32]; //Bluetooth MAC address
} bt; //Bluetooth base information
unsigned char reserved[160];
} u;
} ST_HandsetLinkInfo;
OsBaseConnect
PPORT
ERR_SYS_BAD System error
ERR_TIME_OUT Timeout
ERR_INVALID_PAR
Invalid parameter.
AM
ERR_DEV_BUSY Device is busy.
ERR_LIB_NOT_FOU
Bluetooth library cannot be found.
ND
Others Return values of the Bluetooth module
This function is non-blocking. When 0 is returned, it indicates
the calling succeeded. Application can check the connecting
Instruction state by calling OsBaseCheck(). When
BASE_STATE_CONNECTING is returned, it indicates the
Bluetooth base is in the connecting process.
Sample code
typedef struct _HandsetLinkSet {
int type; //Reserved for future use
union {
struct {
char mac[32]; //Bluetooth MAC address
} bt;
unsigned char reserved[1024];
} u;
} ST_HandsetLinkSet;
OsBaseDisconnect
ERR_SYS_NOT_SU
System does not support this function.
PPORT
ERR_SYS_BAD System error
ERR_TIME_OUT Timeout
ERR_DEV_BUSY Device is busy.
Only the process which has opened the base can close the
Instruction base.
OsCheckPortStatus
OsGetBaseInfo
OsBaseCmd
25File System
26System Information
The SIGMAG is valid only when the magnetic stripe reader 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__)
static sigset_t mask;
void * handler_sigwait(void * arg)
{
}
ret = pthread_create(&tid, NULL, handler_sigwait, 0);
if(ret != 0){
printf("pthread_create error, ret=%d\n", ret);
exit(-1);
}
pthread_join(tid, NULL);
OsMsrClose();
OsIccClose(ICC_USER_SLOT);
27Audio
Prolin audio device is a speaker. In general, the volume settings are unified and can
be set in TM interface.
27.2 OsRecordOpen
ST
ERR_DEV_BUSY Device is occupied by other application
programs.
1. OsRecordOpen() should be called before calling
OsRecordStart() or OsRecordStop().
Instruction
2. After all the operations have been completed, OsRecordClose()
should be called to release the voice recording device.
27.3 OsRecordStart
ERR_DEV_NOT_OPE
Recording not available.
N
ERR_INVALID_PARAM Invalid parameter.
Insufficient space available in
ERR_NO_SPACE
system.
1. The audio file occupies a large space. For example, sample
in the format of S16_LE, 44100Hz, single track, the
recording time is 600s, and it is saved as “wav” format, then
the audio file occupies about 50MB space. It is not
recommended to record for too long time. And it is
recommended to clear the unnecessary audio files in time
Instruction to release the storage space. The recording will be
terminated when the remaining space is less than 10M.
2. In the recording, OsRecordStop() can be called to stop
recording, otherwise, the recording will keep up until the
specified recording time (Duration) or the storage space is
insufficient.
Example
if (OsRecordOpen())
return -1;
OsRecordStart("/data/app/MAINAPP/test.wav", NULL, 1, NULL, 44100, 20);
while (1)
{
if (!XuiHasKey())
continue;
key = XuiGetKey();
if (key == XUI_KEY1)
OsRecordStop();
else if (key == XUI_KEY2)
ret = OsRecordCheck();
else if (key == XUI_KEYCANCEL)
break;
}
OsRecordClose();
27.4 OsRecordStop
27.5 OsRecordCheck
27.6 OsRecordClose
Function Release the access to the recording device and disconnect the
device from the Prolin recording service.
Parameters None
Return None
Instruction
27.7 OsPlayWave
be used.
3. The system supports single track and double track WAVE
audio file.
4. The system supports 8-bit sampling and 16-bit sampling
WAVE audio file. The supported sample frequencies are
8000 Hz, 11025 Hz, 16000 Hz, 22050 Hz, 24000 Hz, 32000
Hz, 44100 Hz and 48000 Hz.
Example
int fd, ret = 0;
char *buff;
int len;
struct stat state;
stat(FILENAME, &state);
len = state.st_size;
buff = (char *) malloc(len * sizeof(char));
fd = open(FILENAME, O_RDONLY);
if(fd<0)
printf("Open File Fail\n");
ret = read(fd, buff, len);
ret = OsPlayWave(buff, len, 3, 0);
if(ret != RET_OK)
printf("PlayWave Fail\n");
close(fd);
free(buff);
27.8 OsStopPlayWave
PPORT
1. When a thread calls OsPlayWave() to play an audio,
OsStopPlayWave() can be called by another thread to stop
Instruction
playing the audio.
2. If no audio is playing, ERR_DEV_NOT_OPEN will be returned.
27.9 OsPlayAudio
The sample code of playing MP3 audio is shown as below, the FILENAME is the
audio file name.
Sample code
int fd = 0, ret = 0;
char *buf;
struct stat state;
fd = open(FILENAME, O_RDONLY);
27.10 OsStopPlayAudio
One-dimensional code is composed of vertical black and white bars of different widths,
and generally there are letters or digits at the bottom of these bars. The code is
commonly used to identify the basic information of products, such as name, price, etc.
CameraAttribute
typedef struct SCameraAttribute
{
int SupportResolution; /*Read only, describes all the resolutions which the
device supports in bits.*/
int CurrentResolution; /*Read and write, it is the current resolution.*/
int SupportPixelFormat; /*Read only, it is the format of output pixel data,
and it only supports yuyv and rgb565 formats.*/
int CurrentPixelFormat; /* Read and write, it is the format of current output
data, and it only support yuyv format*/
char Reserved[128]; /*Reserved for future use.*/
}CameraAttribute;
OsScanSetParam
succeeds.
3. If device only has one camera, this function will return 0
when the front or back camera is set, and scanning code
function will be normal.
OsScanOpen
OsScanRead
OsScanClose
Return None.
Instruction
OsCameraOpen
OsCameraClose
Return None.
Instruction
OsCameraGetParam
OsCameraSetParam
OsCameraCapture
b = tmp_pixel << 3;
3. For image data in yuyv, all Y values will be assigned to
r.g.b, and U and V can be ignored, each 4-byte yuyv data
corresponds to two pixels:
int *yuyv = (int*)Buf;
int yy = *yuyv;
//The first pixel
char y1 = (char)yy;
r = y1; g = y1; b = y1;
// The second pixel
char y2 = (char)(yy >> 16);
r = y2; g = y2; b = y2;
//Keep traversing the yuyv data
yuyv++;
4. For image data in sbggr8, each byte is gray value, that is,
the value is assigned to r.g.b byte by byte:
char* ptr = Buf;
r = *ptr; g = *ptr; b = *ptr;
// Keep traversing the data
ptr++;
5. For image data in NV21, the first 640*480 bytes of the Buf
are the Y values of each pixel, that is, the value is assigned
to r.g.b byte by byte:
char* y = (char*)Buf;
r = y; g = y; b = y;
// Keep traversing the data
y++;
OsScanDecodeBuf
OsCameraDetectMotion
29Power Management
PM_MSG_T:
typedef enum {
PM_MSG_NO_EVENT, /* No event.*/
PM_MSG_ENTER_SLEEP, /* Device enters sleep mode.*/
PM_MSG_EXIT_SLEEP, /* Device exits sleep mode.*/
PM_MSG_ENTER_SCREENSAVER, /* Device enters screensaver
mode.*/
PM_MSG_EXIT_SCREENSAVER, /* Device exits screensaver
mode.*/
PM_MSG_ENTER_ POWEROFF, /* Device starts to power off*/
PM_MSG_POWER_ABNORMAL, /* Device power is abnomal*/
PM_MSG_BATTERY_DAMAGE, /* Battery is out of service */
} PM_MSG_T;
PM_REQ_T:
typedef enum {
PM_FORBID_SLEEP, /* Forbid device from sleeping. */
PM_ALLOW_SLEEP, /* Allow device to sleep.*/
PM_FORBID_SCREENSAVER, /*Forbid device from entering
screensaver mode. */
PM_ALLOW_SCREENSAVER, /* Allow device to enter screensaver
mode.*/
PM_FORBID_ POWEROFF, /*Forbid device from powering off. */
PM_ALLOW_ POWEROFF, /*Allow device to power off.*/
} PM_REQ_T;
POWER_TYPE:
typedef enum {
POWER_ADAPTER = 1, /*Supplied by adapter.*/
POWER_USB, /*Supplied by USB external device.*/
POWER_BATTERY, /*Supplied by battery.*/
POWER_WPC /*Supplied by wireless base.*/
} POWER_TYPE;
WAKEUP_SOURCE:
typedef enum {
WAKEUP_SRC_NONE = 0, /* No wakeup has been done, it has no
wakeup source. */
WAKEUP_SRC_KP, /* Key pressing wakeup */
WAKEUP_SRC_RTC, /* Timer wakeup */
WAKEUP_SRC_BT, /* Bluetooth wakeup */
WAKEUP_SRC_CHC, /* Power wakeup */
WAKEUP_SRC_WIFI, /* WIFI wakeup */
WAKEUP_SRC_MSR, /* MSR wakeup */
WAKEUP_SRC_SMARTCARD0 = 8, /* IC card wakeup */
WAKEUP_SRC_UART = 12, /* serial port wakeup*/
WAKEUP_SRC_ETHER, /* Ethernet wakeup */
WAKEUP_SRC_GENERAL1 = 1000, /* general wakeup 1 */
WAKEUP_SRC_GENERAL2, /* general wakeup 2 */
WAKEUP_SRC_GENERAL3, /* general wakeup 3 */
WAKEUP_SRC_GENERAL4, /* general wakeup 4 */
WAKEUP_SRC_GENERAL5, /* general wakeup 5 */
} WAKEUP_SOURCE;
29.3 OsCheckBattery
29.4 OsCheckPowerSupply
Parameters None.
29.5 OsSysSleep
Parameters None.
RET_OK Succeeded.
29.6 OsSysSleepEx
29.7 OsSysSleepTime
29.8 OsReboot
Parameters None.
29.9 OsPowerOff
29.10 OsPmGetEvent
29.11 OsPmRequest
29.12 OsWakeupSource
29.13 OsCheckPowerStatus
29.14 OsCheckBMSMode
int OsCheckBMSMode(int*CurrentMode,
int *Capacity,
Prototype
int *FullCharge,
int *Recharge);
Function Get information about battery management system.
RET_OK Succeeded
ERR_INVALID_PARA Invalid parameter.
Return M
ERR_SYS_NOT_SU System does not support.
PPORT
Instruction
PM_MSG_T msg;
while(1) {
msg = OsPmGetEvent(100000);
if (msg > 0) {
switch (msg) {
case PM_MSG_ENTER_SLEEP:
break;
case PM_MSG_EXIT_SLEEP:
break;
/*add other case*/
default:
break;
}
}
}
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.1.1 and 1.1.2 respectively.
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
Wherein,
0 = Pad digit: a 4-bit 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
Wherein,
N = PIN length: 4-bit binary number with permissible values 0100(4) to 1100 (12);
P = PIN digit: 4-bit field with permissible values 0000 (zero) to 1001 (9);
T = Transaction digit: 4-bit binary number with permissible values of 0000 (zero) to
1111 (15).
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 2 PIN block has been specified for local use with IC cards. The format 2
PIN block shall only be used in an offline environment and shall not be used for online
PIN verification.
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
Wherein,
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 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).
Convert the above data into BCD code and use TPK to encrypt the BCD code with
DES/TDES algorithm.
Appendix 3 Registry
The table below is a registry of functions which mainly begin with “ro.fac.” and
“persist.sys.”. The "ro.fac." are read-only and"persist.sys." can be both read and
written.
System configuration
Description
name
ro.fac.bootver Boot version information.
Hardware version number. Main board- interface
ro.fac.hwver
board.
ro.fac.mach Product model name.
Boardid information, including the product model,
ro.fac.boardid
hardware version number, etc.
ro.fac.conf.ver Version information of configuration files.
ro.fac.pn PN number.
ro.fac.sn SN number.
Prolin_debug_level information, this value is 0 and 1
ro.fac.prolin_debug_level
for release system and debug system, respectively.
Whether there is a network cable port.(0: does not
ro.fac.eth
exist; 1: exist)
Whether there is a main device interface.(0: does
ro.fac.usb.host
not exist; 1: exist)
Whether there is an USB device interface.(0: does
ro.fac.usb.device
not exist; 1: exist)
Whether there is an USB OTG interface.(0: does not
ro.fac.usb.otg
exist; 1: exist)
Whether there is a LED digital tube.(0: does not
ro.fac.leddt
exist; 1: exist)
Key types.(0: have no key; 1: physical button; 2:
ro.fac.keybroad
touch-screen button)
Whether there is a Buzzer module.(0: does not
ro.fac.buzzer
exist; 1: exist)
ro.fac.simsocket The number of SIM card slot.
Whether there is a battery.(0: does not exist; 1:
ro.fac.battery
exist)
Whether there is a coulombmeter. (None means it
ro.fac.coulomb_counter
does not exist by default.)
Allowing for the configuration differences for different models, some OSAL interfaces
may be invalid for certain kinds of model. For the validity of different models and
Thread √ √ √ √ √ √ √ √
System √ √ √ √ √ √ √ √
Function
Encryptio √ √ √ √ √ √ √ √
n and
Decryptio
PED √ √ √ √ √ √ √ √
clockwi e e direction
se direction direction
directio
Keyboard √ √ √ √ √ √ √ NA
Touch √ NA √ √ NA √ √ √
Screen
Signature √ NA √ √ NA √ √ √
Pad
Printer NA √ √ √ NA NA √ NA
Font √ √ √ √ √ √ √ √
Library
Code √ √ √ √ √ √ √ √
MSR √ √ √ √ √ √ √ √
IC Card √ √ √ √ √ √ √ √
Reader
RF √ √ √ √ √ √ √ √
Reader
Port 1 1 1 DEV
PORT_ PORT_ PORT_U PORT_U
Communi
cation
Configura
tion
MA
(optional)
(optional)
File √ √ √ √ √ √ √ √
System
System √ √ √ √ √ √ √ √
Informati
on
Audio √ √ √ √ N/A √ √ √
Managem
ent
(optional)