Ads Development Guide
Ads Development Guide
Ads Development Guide
DEVELOPMENT
GUIDE
ADS-001
Revision1.00
2014-11-5
Content
CONTENT ................................................................................................................................................................ 2
SCOPE ....................................................................................................................................................................... 6
GUIDE CONVENTIONS .................................................................................................................................................... 6
1
1.2
1.3
1.4
COMPILE ENVIRONMENT.......................................................................................................................14
2.1
LINUX OS.......................................................................................................................................................... 14
2.2
WINDOW/MAC OS ............................................................................................................................................ 15
INTRODUCE ....................................................................................................................................................... 20
3.2
CREATE PROJECT............................................................................................................................................. 21
COMPILE ........................................................................................................................................................22
4.1
COMPILING GUIDE........................................................................................................................................... 22
4.2
4.3
DOWNLOAD.........................................................................................................................................................24
6.1
6.2
6.3
DEBUGGING ..................................................................................................................................................29
7.1
7.2
FAQ ...................................................................................................................................................................32
8.1
8.1
8.2
8.3
8.4
8.5
8.6
8.7
8.8
8.8.6 G3 ...........................................................................................................................................................39
Revision History
Date
2014-11-5
Version
V1.0
Description
1. Draft
Author
Sillin Wu
Steven Guo
Jiang Zhao
Scope
The purpose of this document is to provide a quick start for developer to build the Application
Development Environment (ADE) and run an application on the POS terminal with XGD-ADS
(Application Development Suit of XGD).
The XGD-ADS (Application Development Suit of XGD) includes the following resource, all
available on the FTP server ftp://219.133.170.86:8490 .
Compiling environment (cross compiler, Linux OS(Cent-OS), VirtualBox for Windows/Mac)
Reference/Documents (obtain from /ads-x.xx/xgd-ads-x.xx/doc/ )
SMT(Signature Management Tool: PCISignV0.0.2.13)
Packages of SDK library for different models of POS terminal (K320, K370, G810)
Sample Code(module-based)/Demo Code(transaction-based)
Download Tool/Script (UDiskDL2.0)
Guide Conventions
Various conventions are used to help you quickly identify special formatting. Table 1 describes these
conventions and provides examples of their use.
Convention
Meaning
Blue
Bold
Courier
Example
See Guide Conventions.
http://www.xinguodu.com
ADS DEVELOPMENT GUIDE
manage.so
[root@localhost~]$ ./MakeCore -h
Attention:
Table 1
6
Open the signature tool PCISignV0.0.2.13.exe and select the KeyGen page.
Configure the version, issuer, serial number and expiry date. Anything inputted of
these parameters is OK.
Select a path for saving the RSA key pair, and name as app.
The interface as shown 1-2:
Generate the RSA key pair including private key app_sk.lic and public key
app_pk.lic.
As shown 1-3:
Select a path for saving the RSA key pair, and name as root.
The interface as shown 1-4:
10
Generate the RSA key pair including private key root_sk.lic and public key
root_pk.lic.
As shown 1-5:
11
1.4
12
13
2 Compile Environment
There are two ways for running the compiler which depends on the development environment.
2.1
Linux OS
If the compiler runs on the Linux OS, the following steps shall be performed:
a) Create a new folder under /tmp, ( eg. mkdir /tmp/compiler )
14
2.2
Window/Mac OS
If the compiler runs on the Windows or Macintosh, the VirtualBox tool must be
installed to run the virtual machine CentOS for the compiler.
The VirtualBox is a powerful and free software, the developer could get the installing
package and more information from https://www.virtualbox.org/.
The following steps shall be performed:
a) Install the VirtualBox for Windows or Macintosh.
15
d) Create and configure the folder which is shared by the host OS (Windows or
Macintosh) and virtual machine (CentOS). Recommending to create the shared
folder in the root directory of disk C or D (eg. D:\share)
16
17
18
19
3 Building Project
The following must has been completed before building an application project:
Generate the developer root & app RSA key pairs including private keys root_sk.lic
& app_sk.lic and public keys root_pk.lic & app_pk.lic.
The public key root_pk.lic has been signed by vendors(XGD) private key and
renamed as xgd3rd.pk.
The public key app_pk.lic has been signed by root_sk.lic and renamed as app.pk.
The compiler has been installed correctly.
3.1
Introduce
makefile
makefile for the compiling environment.
20
3.2
Create Project
Create an application project from ads-app-template:
21
4 Compile
Application compiling process will be explained in detail in this chapter.
4.1
Compiling Guide
The developer could run ./MakeCore h to get the usage of shell MakeCore. Show as
figure 4.1
Figure 4.1
4.2
Compiling Script
22
4.3
23
5 Download
Step 1
Step 2
Step 3
Step 4
Step 5
24
6 Terminal Management
Terminal Management demonstrates the terminal file system, application manager, multiapplication management and U-Disk download.
e.g. 320cncup.so
b) manage.so
multi-application switching
c) libsdk.so/libsdkload.so/libsdkdev.so
middleware
d) libsdk8583.so/libsdkemv.so
ISO8583/EMV libs
...
5.1.2 /mtd0/res/
a) multitask.ini
b) logo.bmp
Attention:
25
App1
Multitask.ini
Manage.so
defaultapp=
APP1
Figure 5.3
appnum=
num
App1
Attention:
App2
App3
...
App(num)
26
6.3.1
Generate Multi-apps
multitask.ini, a very important configurable ini file which is associated with the compiled
applications (*.so). To ensure the application/multi-application run normally on the terminal,
having a basic understanding of how to modify this file is of great importance.
This file consists of three basic elements, section (e.g. [APPNUM]), key (e.g. defaultapp) and value
(870sgscb).
Total number xx of applications,
APP01, APP02, , APPxx , maximum is
10
The default app runs on terminal after
startup.
27
6.3.2
Application Switching
For example: terminal is running the application (320cncup.so), and wants to run another
application (370cncup.so), and the multitask.ini is correct. Please operate in terminal as
follow instructions.
Step1
Choose application
320cncup
370cncup
Figure5.4.2
Step4
Switch to 320cncup by Up and Down arrows and press Enter to complete the
operation.
The
name 320cncup
multitask.ini file display.
and
370cncup depends
on
the
28
7 Debugging
For the development sample unit, its enabled to output the debug message.
Serial port pinout for each machine model as shown below:
RS232/PINPAD,
/PINPAD,RS232
G870,K320Q,
K320P,G810
GND
RXD (SDK_RS232_PINPAD)
NC
RXD (SDK_RS232_PC)
TXD (SDK_RS232_PC)
NO
TXD (SDK_RS232_PINPAD)
VCC (+5V)
RS232/PINPAD,
/PINPAD,RS232
K370,G870(upgrade),
G3
1
NC
2
GND
3
RXD (SDK_RS232_PINPAD)
4
TXD (SDK_RS232_PINPAD)
5
NC
6
NC
7
NC
8
NC
9
TXD (SDK_RS232_PC)
10
RXD (SDK_RS232_PC)
11
NC
12
NC
29
Before debugging, please confirm your terminal works well and the serial cable is
well connected.
Baud rate:115200
Data Bit: 8
Stop Bit: 1
For example:
The HyperTerminal setting as shown in Figure 7.1:
Figure 7.1
30
31
8 FAQ
8.1 How to Download PK File?
Download xgd3rd.pk:
Step 1
Step 3
Select 1.Download, then 2.USB Stick and it will prompt Load 3rd PK?
ISSUE:XGD Press [ENT] Load, press ENTER to download.
Step 4
Download app.pk:
To download the app.pk is same as how to download the application, please refer to U Disk
Download Manual.pdf.
Step 1
Step 2
Step 3
Include the header file debug.h in your code and delete original sdkDebug.h.
Step 4
32
33
Step 1
Step 2
Send the logo to vendor XGD. XGD will sign and send it back to developer.
Step 3
Rename the logo as logo1.bmp and logo2.bmp and copy the two files to the
Step 5
Step 6
8.3
Download Program
Step 1
Hold key F2+1(K320)/ F1+1(G810/G870)/ F+1(K370/G3) and power on, then enter
password 556677
Step 2
Test Program
Test program is designed to simply test the terminal hardwares and check whether they all work
fine or not. It helps developer tackle the problem encountered during the application
development based on the SDK. If developer recognizes the test program is in Chinese initially,
please follow below steps to switch it to English permanently.
34
Step 1
Hold key F2+3(K320)/ F1+3(G810/G870)/ F+3(K370/G3) and power on, then enter
password 556677
Step 2
8.4
Step 1
Hold key F2+3(K320)/ F1+3(G810/G870)/ F+3(K370/G3) and power on, then enter
password 556677
Step 2
1.Unit Test -> 1.Key -> 2.Key Tone -> Scroll up/down to turn up/down the key volume
8.5
Step 1
Hold key F2+3(K320)/ F1+3(G810/G870)/ F+3(K370/G3) and power on, then enter
password 556677
Step 2
1.Unit Test -> 2.Display -> 5.BACKLIGHT TIME SET -> Set the time interval -> Press
ENTER to save it.
8.6
Step 1
Hold key F2+3(K320)/ F1+3(G810/G870)/ F+3((K370/G3) and power on, then enter
password 556677
Step 2
Check the GPRS/3G signal strength, it is better above 10 , otherwise, step3 may failed.
Step 4
Set the correct APN, IP and PORT to connect to XGDs test server:
IP: 219.133.170.86, PORT: 8526
8.7
If compiling failed in Ubuntu ,please follow steps as below to resolve the problem:
Step 1
Step 2
If the result displays /bin/sh -> dash instead of /bin/sh -> bash, do step 3
Step 3
35
Step 4
8.8
8.8.1
36
8.8.2
K370
37
8.8.3
G810
8.8.4
G870
38
8.8.5
G870(upgrade)
8.8.6
G3
39
The number marked in the picture represents the corresponding card slot number for each
model.
40