Research on POS Terminal System Software Based on Mobile Payment
introduction
In the less than half a century of credit card application, the payment method will undergo a historic change. Based on the emergence of mobile payment methods based on wireless communication technology, the payment form is completely free from all the constraints of space, not only widely and conveniently applied. In the fixed trading place; and can realize the payment function in the mobile process, thus creating a more flexible and intimate consumption environment for consumers, realizing the electronic and mobileization of the wallet, is a brand new payment means.
At present, countries around the world are actively studying this emerging mobile payment system. Australia and Finland have taken the lead in launching the commercial model. Guangdong Province is also the first in China to launch a commercial mobile payment system. Mobile users can purchase through their mobile phones. Subway tickets, cola, snacks and other goods. According to statistics, mobile terminals will become widely used payment instruments within three to five years. However, this emerging payment method cannot provide consumer bills, which is not in line with the current consumption concept of Chinese people. It is necessary to develop a wireless POS printing terminal system based on the situation by being able to obtain the ticket voucher method to perfect this emerging payment method.
1 System overall design
The overall block diagram of the system is shown in Figure 1:
The composition of the system is: the main control CPU adopts RABBIT3000 of Z-WORLD company, the SRAM adopts CY62128 of CYPRESS company, the FLASH adopts SST39VF020 of SST company, the printer adopts GP-7635 of GPRINTER company, the GPRS module adopts MC35 of Siemens company, CPU embedded TCP /IP protocol stack.
The overall framework of the system is as follows. In order to control the stable operation of the whole system, the system needs a microprocessor. In order to print out a certificate, the system needs a micro printer. Because the system needs to access the Internet through wireless, the system also needs a wireless communication module, which can access the Internet and select GPRS communication module or CDMA communication module. In order to access the Internet, only one communication module is not working, and it is also necessary to follow the common communication protocol of the Internet. There are several combinations of such changes to the system. The system uses a CPU embedded with a TCP/IP protocol stack. The chip that uses the MCU and the TCP/IP protocol is formed into the core of the application system, and the application system can directly access the Internet, and the hardware circuit is relatively simple. The program has the following advantages: 1 does not rely on PC or high-end single-chip microcomputer, truly realizes that 8-bit single-chip microcomputer system directly connects to the Internet, the whole system is completely self-sufficient; 2 uses fewer peripheral devices, and the system is low.
2 software hierarchy
All the code in the program is written in C language and adopts a layered structure, from bottom to top: serial port driver layer, GPRS module driver layer, PPP protocol layer, IP protocol layer, UDP protocol layer and application layer. . The implementation of the upper function needs to be applied to the underlying function, and the task of the underlying function is to provide services for the upper layer function, and finally complete the application layer task - transfer data. The main functions of each layer are shown in Figure 2:
2.1 driver writing
The first is the serial port driver layer. It implements functions such as opening the serial port (OpenComm), closing the serial port (CloseComm), reading the serial port data (ReadComm), and writing the serial port data (WriteComm). For example, the WriteComm function sends one byte of data to the serial port, and the transmit function sends a string of data to the serial port.
Then, based on these serial functions, write the driver function of the GPRS module. The microcontroller controls the GPRS module through the serial port to perform operations such as dialing and setting. The method of control is to use the AT command. After controlling the GPRS module to dial the login number "*99**1#" of the mobile Monternet GGSN, the GPRS module is transferred to the online mode (0n-Line). At this point, all data sent by the microcontroller to the serial port is transparently transmitted to the GGSN, and the GGSN's response is also transmitted back to the serial port of the microcontroller. When the data transfer is complete, the microcontroller needs to inform the GPRS module to end the session and switch from the online mode to the normal command mode, which can be done by setting the DTR line high. At the same time, if the line is disconnected due to abnormality, the CD line will return to the normal low level, so in the online mode, it is also necessary to continuously detect whether the CD line is at a high level. According to these operations, you can write GPRS driver functions: initialize the GPRS module function (GPRSInit), dial function (GPRSDial), disconnect function (GPRSHangup), and detect whether it is in the online state function (GPRS0nline).
These underlying driver functions will make it easy to write the upper layer protocol and, more importantly, it provides us with a driver abstraction layer. When the underlying hardware changes, only the underlying driver functions need to be changed, and the code of the upper function is unchanged.
2.2 Implementation of PPP Protocol
Since the GGSN of Monternet communicates with the GPRS module and follows the PPP protocol, a part of the PPP protocol must also be implemented in the microcontroller to talk to it. After dialing, the GPRS module first negotiates the communication link with the GPRS gateway, that is, negotiates various link parameter configurations from point to point. The negotiation process complies with protocols such as LCP (Link Control Protocol), PAP (Password Authentication Protocol), and IPCP (Internet Protocol Control Protocol). The LCP protocol is used to establish, construct, and test link connections; the PAP protocol is used to process the password verification part; and the IPCP protocol is used to set the network protocol environment and assign IP addresses.
The negotiation mechanism is implemented using a model of a finite state machine. Once the negotiation is completed, the link has been created, and the IP address has been assigned to transmit the IP packet according to the negotiated standard. Depending on the application, IP packets can carry UDP packets or TCP or ICMP packets. After the data transfer is completed, the microcontroller sends a disconnect message to the GGSN to terminate the network connection.
The frame structure of the PPP protocol is shown in Figure 3. The serial port interrupt receiving program of the microcontroller first determines whether there is a complete PPP packet and checks the contents of the PPP packet to determine the integrity and correctness of the data packet. Then, the PPP packet parsing module is entered in the main loop, and the parsing process is as shown in FIG. 4 .
2.3 The process of logging in to the GGSN
One difficulty of the system is the process in which the microcontroller logs into the GPRS Gateway (GGSN) and negotiates with the gateway through the LCP, PAP, and IPCP protocols. The frame structure of the LCP, PAP, and IPCP protocols is similar, and the most common ones are request (REQ), consent (ACK), and reject (NAK). The microcontroller and the GGSN are each negotiating. Each party can send a REQ frame request for some aspect of the configuration. The other party thinks that the configuration is unacceptable and will respond to the NAK frame. If so, it will respond to the ACK frame. In order to save resources, we only deal with these three data frames, and other link problems are solved by the microcontroller under the control of the program. The negotiation process is roughly described as follows: After the dial-up is successfully connected, the GGSN first returns a PAP REQ data frame. We send an empty LCP REQ frame to force the protocol negotiation phase. The GGSN then sends the LCP settings frame and we reject all settings and request the authentication mode. The GGSN selects CHAP or PAP mode authentication, and we only accept the PAP mode. Then, the PAP authentication user name and password process is performed. In GPRS, the username and password are both empty. If successful, the GGSN returns an IPCP packet to assign a dynamic IP address. At this point, the negotiation process with the GGSN is completed. The state transition of the negotiation process is shown in Figure 5.
After the negotiation is completed, enter the IP datagram communication phase. At this time, all the PPP packets sent by the microcontroller to the GGSN containing the IP packets will be transmitted to the corresponding IP addresses in the Internet. The remote packets sent to the IP address of the microcontroller will also pass through the GPRS network. Transferred to the microcontroller to complete the data transfer between the microcontroller and the remote host over the Internet.
3 TCP/IP implementation on RABBIT3000
The Rabbit 3000 series is a high performance 8-bit device. Thanks to its C-friendly instruction set and fast digital processing capabilities, it has received attention. The Rabbit architecture is based on Zilog's original Z80 microprocessor, but with several improvements: instead of using 16-bit addressing to cover storage space like the Z80 instruction set, a 20-bit or 1MB actual storage space is used; Connection to static memory devices; 3 memory chip select lines and 2 sets of write/output enable lines; on-chip peripherals including 4 serial ports, 1 subport, 40 p lines, 7 different timings , accurate pulse generation hardware and battery-backed RTC.
Users only need to add related chips and auxiliary facilities (such as power supply, user-required peripherals, etc.); and the implementation of the software, because the Rabbit 3000 series chip is supported by the Dynamic C compiler and the library required to implement TCP/IP. The file dcrtcp.lib, so it can be developed in C language. The focus of users' attention has also become the code compilation and optimization after the realization of network communication, which can greatly improve the development progress.
The following is the main body of the program for Dynamic C to implement TCP/IP protocol communication. The starting macro in the program is defined as the default IP configuration information; the "memmap" sentence allows the program to be compiled inside the chip as if it were compiled in the extended code window; the "use" clause causes the compiler to compile the code according to the library file configuration.
#define TCPCONFIG 1
#memmap xmem
#use dcrtcp.lib
Main(){
Sock_init();
For(;;) {
Tcp_tick(NULL);}
}
Both sock_init() and tcp_tick() are the basic functions of the TCP/IP function library. The former is to initialize the TCP/IP protocol stack function, so that the protocol stack starts processing the incoming datagram. The latter has two main purposes: 1 Support background processing. The latest information; 2 test the status of the TCP/IP socket.
With the TCP/IP protocol package provided by Dynamic C, users can easily establish TCP/IP communication. After the communication is established, subsequent further functional extensions can be performed on this basis, and protocol implementations such as HTTP and PPP are implemented.
4 system software part of the implementation
The software part of the system mainly includes 4 parts, l, GPRS dialing part 2, TCP/IP protocol stack part 3, print driving part 4, storage part.
The GPRS dialing part mainly uses the PPP protocol to send a request to the mobile service center to use its network, and the service center verifies the passage. The TCP/IP protocol stack is the network transmission and control protocol commonly followed by the network transmission data, and the print driver part Mainly to control the printer to print out the documents that need to be printed, the storage part is mainly the control of the memory to store data and other information.
5 Conclusion
The mobile payment system fully considers the consumer psychology of “paying the money in one hand and delivering the first handâ€, and prints the receipt by using the wireless ticket printing terminal (wireless POS terminal). The printing terminal performs identity verification by identifying the source of the short message, and prints according to the customer's needs. Customer phone number (or customer identification code), transaction amount, transaction time, transaction party print POS machine number, transaction fee and other detailed information, and can print multi-layer paper.
The wireless POS terminal is connected to the GGSN of the mobile office through the wireless network by means of GPRS, and the GGSN of the mobile office is connected to the payment system via the Internet, so that the wireless POS terminal can perform TCP/IP communication with the payment system. GPRS wireless data transmission has the characteristics of low equipment cost, safe and reliable data transmission, flexible use and so on. It is very suitable for application on wireless POS terminals. Therefore, wireless ticket printing terminal has fast connection speed, high transmission rate, flexible configuration and low construction cost. Etc. Although there are mobile payments in the domestic market (using mobile phones to support small denominations), users are in the process of using them; there is no one voucher and when there is a problem (such as the money in the mobile phone is deducted or other users are also There is no evidence to verify with the shipper, which means that mobile payment does not form a closed loop. This is also a reason for the slow promotion of mobile payment. We launched a mobile payment-based wireless POS printing terminal to solve this problem, it will be widely used in the chain. Convenience stores, pharmacies, newsstands, vending kiosks, etc., will greatly improve people's living standards and make people's lives more convenient.
references:
[1] Wang Tianmiao. "Embedded System Design and Case Development" [M]. Beijing: Tsinghua University Press [2] Behrouz A. Forouzan. "Data Communication and Network" [M]. Beijing: Mechanical Industry Press [ 3] Zdravkovic A. wireless point of sale terminal for credit and debit paymentsystems [J]. IEEE Canadian Conference on Electrical and computer Engineering. Part vol. 2, 1998, pp. 890-3 vol. 2. New York, NY, USA.
4. Jean J Labrose. Embedded System Components [M]. Beijing: Mechanical Industry Press, 2002.145-167.
5.http://POS-customer/a/9000000059885.htm
About the author: Chen Qunxian: (1970~) female master lecturer Research direction: Computer application and control technology Author brief introduction: CHEN Qun-xian (1970-), Female, Lecturer, Master. Major:Computer application and control
E-mail:
Address: Department of Information Engineering, Shanghai Dianji University, No. 690 Jiangchuan Road, Minhang District, Shanghai
1. The common wire iron common Nail for construction has a wide head having a smooth or textured surface and has a sharp diamond shaped point. In some applications it makes sense to actually dullthe wire iron common nail for construction tip to prevent splitting wood.
2. This product is suitable for hard and soft wood, bamboo pieces, ordinary plastic, wall foundry, repairing furniture, packaging etc.
3. Widely used in construction, decoration, decoration and renovation wire iron common nail for construction used in general construction and are the wire iron common nail for construction type used where building code requires certain framing construction. These wire iron common nail for constructions have a thick shank and are made from iron wire.
Common Nail,Common Wire Nail,Nail Common Wire,Common Framing Nails
Anping County Xinhai Traffic Wire Mesh Manufacture Co., Ltd , https://www.xhmetalfence.com