Packing communication method and device based on script configuration and medium

Through the script-based package communication method, the problem of large workload and high cost in MIS application scenario development in intelligent POS payment is solved, automatic interface parameter adaptation is realized, and efficiency and stability are improved.

CN119728417AActive Publication Date: 2025-03-28FUJIAN NEWLAND PAYMENT TECH

Patent Information

Application Number
CN202411915168.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-03-28
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

In smart POS payment, the development of MIS application scenarios is large, cost-effective, and inefficient. It requires frequent modification and testing of interfaces to adapt to different usage scenarios.

Method used

Design a group package communication method based on script configuration, generate corresponding scripts through configuration scripts, and import them into the device, realize automatic adaptation of interface parameters, and reduce development and testing workload.

Benefits of technology

The development workload of MIS application scenarios in smart POS payment has been reduced, development costs have been saved, work efficiency has been greatly improved, and program stability has been increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728417A_ABST
    Figure CN119728417A_ABST
Patent Text Reader

Abstract

The invention discloses a packet communication method and device based on script configuration and a medium. The method comprises the following steps: configuring different scripts according to different project types; the script is installed in the current POS machine; the upper computer sends the request message to a protocol analyzer through a channel; calling a target communication protocol parser to parse the request message to obtain a request text; calling a target text protocol parser to parse the request text to obtain a request parameter of the upper computer; converting the request parameter of the upper computer into a request parameter of the POS machine, and sending the request parameter to the POS machine for processing; the POS machine converts the response parameters of the POS machine into response parameters of the upper computer according to the transaction instruction in the script; the response parameters of the upper computer are packaged into a response text through the target text protocol analyzer; and packaging the response text into a response message through the target communication protocol analyzer, and sending the response message to the upper computer through a channel. According to the method, the working efficiency is greatly improved, and the program stability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a script-configured package communication method, device and medium. Background Art

[0002] With the development of the smart payment POS industry, the entire acquiring business is becoming more and more mature. At present, MIS (Management Information System) occupies a large number of usage scenarios in smart POS. At present, there is no unified interface standard in this area in China. Major manufacturers have their own internal set of interface specifications. At the same time, the interfaces of a manufacturer in different usage scenarios also have small differences, and the entire industry ecology is relatively chaotic.

[0003] As a developer of payment device applications, after completing a program for an acquiring channel, in order to adapt to the actual MIS usage scenario, each project needs to modify the acquiring program of the POS machine, adapt the corresponding interface of MIS, and then retest and release it. A new MIS application is developed to receive the data transmitted by the host computer and then parse the corresponding fields. The MIS application needs to assign this field to the parameters required by the corresponding function of the POS machine, and then return the converted value to the POS machine through an interface call. It is necessary to manually adjust the code of the MIS application and adapt each interface parameter according to the document. Normally, an interface request has about 30 parameters, and the interface call returns about 30 parameters. An application adaptation needs to adapt about 20 interfaces, resulting in a complicated workload, low efficiency, time-consuming and labor-intensive, and a complete testing process needs to be carried out after the program is modified, which also requires manpower. Although this part of the work is some relatively simple field mapping work, it is very time-consuming. Normally, a project development and testing is expected to take about 20 working days.

[0004] Although the technical development difficulty is low, it requires a lot of work time to deal with the interface adaptation work. In order to solve this problem, it is urgent to design a package communication method based on script configuration. Summary of the invention

[0005] In view of this, the purpose of the present invention is to propose a package communication method based on script configuration, design a set of application processes and a set of script specifications, and for subsequent new requirements, it is only necessary to configure the script in the platform, generate the corresponding script, and import it into the device to complete it, thereby reducing the development workload of MIS application scenarios in smart POS payment, saving development costs, and greatly improving work efficiency.

[0006] In order to achieve the above technical objectives, the technical solution adopted by the present invention is:

[0007] The present invention provides a script configuration-based package communication method, comprising the following steps:

[0008] Step 1. Configure different scripts according to different project types. The configuration information of each script includes the script version number, communication protocol parser information, text protocol parser information and transaction instructions;

[0009] Step 2: Select the corresponding target script according to the project type of the current POS machine, and form a MIS application with the channel and protocol parser, and install it in the current POS machine;

[0010] Step 3: The host computer sends the request message to the protocol analyzer through the channel;

[0011] Step 4: according to the communication protocol parser information in the target script, call the corresponding target communication protocol parser in the protocol parser to parse the request message to obtain the request body;

[0012] Step 5: according to the text protocol parser information in the target script, call the corresponding target text protocol parser in the protocol parser to parse the request text and obtain the request parameters of the host computer;

[0013] Step 6: Convert the request parameters of the host computer into the request parameters of the POS machine according to the transaction instructions in the target script, and send them to the POS machine for processing;

[0014] Step 7, the POS machine converts the response parameters of the POS machine obtained after processing into the response parameters of the host computer according to the transaction instructions in the script;

[0015] Step 8: Encapsulate the response parameters of the host computer into a response body through the target body protocol parser;

[0016] Step 9: Encapsulate the response body into a response message through the target communication protocol parser and send it to the host computer through the channel.

[0017] Furthermore, the step 1 specifically includes:

[0018] Step 11: Design the configuration information of the script according to the project type used between the host computer and the POS machine, the message structure characteristics of the host computer, and the parameter information required for the project type;

[0019] Step 12: The configuration information includes a required part and an optional part;

[0020] The required part includes the version number of the script, the communication protocol parser information, the text protocol parser information and the transaction instruction; wherein the version number of the script is the version number of the selected script, the communication protocol parser information is the information of a communication protocol parser that can support the parsing of the communication structure selected according to the message structure characteristics of the host computer, and one of the standard COMPOS communication protocol parser, the standard MISPOS communication protocol parser, the text-only communication protocol parser and the custom communication protocol parser is adopted; the text protocol parser information is a text protocol parser that can support the parsing of the text structure selected according to the message structure characteristics of the host computer, and one of the standard text protocol parser, the URI transparent transmission protocol parser, the FS separator protocol parser, the TLV text protocol parser and the custom text protocol parser is adopted; the transaction instruction is a step rule for realizing the conversion between the request parameters of the host computer and the request parameters of the POS machine and the conversion between the response parameters of the POS machine and the response parameters of the host computer according to the parameter information required by the project type;

[0021] The optional part includes bankpay, enumeration mapping and TLV format. The bankpay specifies the data type of the POS machine. The bankpay specifies the data type of the POS machine through the three fields of packageName, activity and action. If the POS machine is called explicitly, packageName and activity are configured. If the POS machine is called implicitly, action is configured. The enumeration mapping specifies the mapping relationship between the enumeration value of the host computer and the enumeration value of the POS machine. The TLV format specifies the byte length, encoding method and alignment method of tag, length and value when the message is in TLV format.

[0022] Step 13: Edit the configuration information corresponding to each script on the host computer through a script editor or a text editor, and generate the corresponding script. Each project type corresponds to a script.

[0023] Furthermore, the step 2 specifically includes:

[0024] Step 21, according to the project type of the current POS machine, select a script with matching functions from the scripts generated in the host computer as the target script;

[0025] Step 22, the target script, the channel and the protocol parser constitute the MIS application, which is installed in the current POS machine; wherein the target script is downloaded to the POS machine when the POS machine leaves the factory or is downloaded to the POS machine again through the network or PC download tool after the POS machine leaves the factory;

[0026] Step 23: When the POS machine is started, the MIS application is automatically started and the target script is loaded;

[0027] Step 24: Obtain the target communication protocol parser and target text protocol parser to be used according to the communication protocol parser information and the text protocol parser information in the target script, and obtain the transaction name and the corresponding script rule according to the transaction instruction in the target script.

[0028] Furthermore, the step 4 specifically includes:

[0029] Step 41, the protocol parser of the MIS application has multiple communication protocol parsers built in: standard COMPOS communication protocol parser, standard MISPOS communication protocol parser, text-only communication protocol parser and custom communication protocol parser;

[0030] Step 42: If the target communication protocol parser called is a standard COMPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard COMPOS communication protocol parser, and the protocol format is a start bit, a length, a body, an end bit and a check bit, to obtain a request body; and then the encoding format of the request body is converted from HEX to ASCII;

[0031] Step 43, if the target communication protocol parser called is a standard MISPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard MISPOS communication protocol parser, and the protocol format is a start bit, a length, a data flow attribute, an application type, a unique identifier, a data body, an end bit and a check bit, to obtain a request body; and then the encoding format of the request body is converted from HEX to ASCII;

[0032] Step 44, if the target communication protocol parser called is a text-only communication protocol parser, it means that the request message does not contain a communication structure but only a text structure, and there is no need to parse the communication structure, and the request text can be directly obtained;

[0033] Step 45: If the target communication protocol parser called is a custom communication protocol parser, the custom communication interface is called to parse the request message to obtain the request body.

[0034] Furthermore, the step 5 specifically includes:

[0035] Step 51, the protocol parser of the MIS application has multiple text protocol parsers built in: standard text protocol parser, URI transparent transmission protocol parser, FS separator protocol parser, TLV text protocol parser and custom text protocol parser;

[0036] Step 52: If the target text protocol parser called is a standard text protocol parser, the request text in URI format is parsed by the standard text protocol parser, and the path of the URI is used as the instruction name of the transaction instruction. The request text is divided into the address and the request parameters of the host computer according to the instruction name;

[0037] Step 53: If the target text protocol parser to be called is a URI transparent transmission protocol parser, the request text in URI format is directly transparently transmitted through the URI transparent transmission protocol parser to obtain the request parameters of the host computer;

[0038] Step 54: If the target text protocol parser to be called is the FS delimiter protocol parser, the request text with FS as the delimiter is parsed by the FS delimiter protocol parser, the instruction code in the request text is used as the instruction name of the transaction instruction, and the request parameters of the host computer in the request text are parsed according to the instruction name and the delimiter;

[0039] Step 55: If the target text protocol parser called is a TLV text protocol parser, the TLV text protocol parser is used to parse the request text in the TLV format, and the transaction type in the request text is used as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed according to the instruction name;

[0040] Step 56: If the target text protocol parser called is a custom text protocol parser, the custom text interface is called to parse the request text to obtain the request parameters of the host computer.

[0041] Furthermore, the step 6 specifically includes:

[0042] Step 61: The transaction instruction includes an instruction name, a request field and a response field. The request field includes input parameter content required by the item type of the current POS machine, and the response field includes return parameter content required by the item type of the current POS machine.

[0043] Step 62: Format the transaction instruction in JSON. The request field is a JSON object in Key:Value format. The Key is the input parameter content required by the project type of the current POS machine, that is, the request parameter of the POS machine, and the Value is the request parameter of the host computer.

[0044] Step 63: assign the corresponding value in the request parameter of the host computer to Value, obtain the request parameter of the POS machine, and send it to the POS machine for processing;

[0045] The step 7 specifically includes:

[0046] Step 71, the response field is a JSON object or a JSON array. If it is a JSON object, the key is the response parameter of the host computer, and the value is the response parameter of the POS machine; if it is a JSON array, the order of elements is the order of the response parameters of the host computer, and the value is the response parameter of the POS machine;

[0047] Step 72: assign the corresponding numerical value in the response parameter of the POS machine obtained after processing by the POS machine to Value, obtain the response parameter of the host computer, and send it to the protocol parser of the MIS application.

[0048] Furthermore, the step 8 specifically includes:

[0049] Step 81: If the target text protocol parser called is a standard text protocol parser, the response parameters of the host computer are encapsulated into a response text in URI format through the standard text protocol parser;

[0050] Step 82: If the target text protocol parser called is a URI transparent transmission protocol parser, the response parameters of the host computer are encapsulated into a response text in URI format through the URI transparent transmission protocol parser;

[0051] Step 83: If the target text protocol parser called is the FS delimiter protocol parser, the FS delimiter protocol parser encapsulates the response parameters of the host computer into a response text format with FS as the delimiter;

[0052] Step 84: If the target text protocol parser called is a TLV text protocol parser, the response parameters of the host computer are encapsulated into a response text in TLV format through the TLV text protocol parser;

[0053] Step 85: If the target text protocol parser called is a custom text protocol parser, the custom text interface is called to encapsulate the response parameters of the host computer into a response text;

[0054] In step 9, the response body is encapsulated into a response message by the target communication protocol parser, which specifically includes:

[0055] Step 91, if the target communication protocol parser called is a standard COMPOS communication protocol parser, the encoding format of the response body is converted from ASCII to HEX by the standard COMPOS communication protocol parser, and then encapsulated into a response message according to the corresponding protocol format: start bit, length, body, end bit and check bit;

[0056] Step 92, if the target communication protocol parser called is a standard MISPOS communication protocol parser, the encoding format of the response body is converted from ASCII to HEX by the standard MISPOS communication protocol parser, and then encapsulated into a response message according to the corresponding protocol format: start bit, length, data flow attribute, application type, unique identifier, data body, end bit and check bit;

[0057] Step 93: If the target communication protocol parser called is a text-only communication protocol parser, there is no need to encapsulate the communication structure, and the response message is directly obtained;

[0058] Step 94: If the target communication protocol parser called is a custom communication protocol parser, the custom communication interface is called to encapsulate the response body into a response message.

[0059] Furthermore, the communication methods between the host computer and the channel include serial port, Bluetooth, local area network and cloud MIS.

[0060] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the above-mentioned script-configuration-based package communication method is implemented.

[0061] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned script-configuration-based package communication method is implemented.

[0062] By adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art:

[0063] In the CommPOS scenario application development for the smart POS machine, the present invention only needs to configure the script on the PC and then download it to the POS machine. There is no need to redevelop and package the MIS application, which greatly reduces the workload. Since there is no need to re-modify the code, different interface parameters are adapted through scripts. Only one script file needs to be written each time. The script file can also be generated through PC tools. There is no need to modify the program or perform a large amount of repeated testing work, which greatly improves work efficiency and increases program stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0065] Figure 1 It is an execution flow chart of a package communication method based on script configuration provided by an embodiment of the present invention.

[0066] Figure 2 It is a data transmission process diagram of a host computer, MIS application and POS machine provided by an embodiment of the present invention.

[0067] Figure 3 It is a schematic diagram of the structure of a message provided by an embodiment of the present invention.

[0068] Figure 4 It is a schematic diagram of an electronic device provided by an embodiment of the present invention.

[0069] Figure 5 It is a schematic diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present invention, but are not intended to limit the scope of the present invention. Similarly, the following examples are only partial embodiments of the present invention rather than all embodiments, and all other embodiments obtained by those of ordinary skill in the art without creative work are within the scope of protection of the present invention.

[0071] Glossary:

[0072] Host computer: mainly includes business systems, which transmit amounts to slave computers for financial transactions, generally referring to PCs and cash registers.

[0073] Lower computer: The initiator of financial transactions, receiving instructions from the upper computer, generally refers to the POS machine.

[0074] Channel: Communication channel.

[0075] Solution design:

[0076] Aiming at the MIS scenario requirements in smart POS payment, the present invention designs a package communication method based on script configuration. Define an external interface for the acquiring program and do not change it again to ensure the stability of the acquiring program. Provide a script editor, which can automatically generate the corresponding script between the corresponding MIS interface and the acquiring program interface by clicking and checking on the PC. Define the script configuration parser application MIS 3.0, load the previously generated script, and the MIS 3.0 application receives the communication instructions of the host computer. The communication instructions of the host computer can be parsed according to the script, and then the corresponding acquiring program is called. After receiving the return result of the acquiring program, the corresponding host computer response communication instruction is generated according to the script and returned to the host computer.

[0077] a. The host computer supports the following connection methods: serial port, LAN, Bluetooth, and cloud MIS.

[0078] b. The host computer supports Window and Android, has a unified external interface, and outputs Jar, DLL, SO, and OCX call libraries.

[0079] c. The host computer provides corresponding testing software.

[0080] d. The lower computer supports the following connection modes: serial port, Bluetooth base, DH10 (wireless version), DH10 (wired version), LAN, Bluetooth, and cloud MIS.

[0081] e. The lower computer is compatible with all smart POS machines.

[0082] like Figure 2 As shown, MIS structure: MIS consists of three parts: channel, protocol parser and script.

[0083] Channel: responsible for communicating with the host computer.

[0084] Protocol parser: responsible for extracting the request parameters of the host computer from the request message and composing the response parameters of the host computer into the response message.

[0085] Script: responsible for converting the request parameters of the host computer into the request parameters of the POS machine, and converting the response parameters of the POS machine into the response parameters of the host computer.

[0086] Protocol parser:

[0087] like Figure 3 As shown in the figure, a message generally consists of two parts: a communication structure and a body structure. The communication structure contains the body, and the body also has its own structure, namely the body structure. The body contains request parameters / response parameters. Therefore, if you want to extract the request parameters, you must first parse the communication structure to extract the body, and then parse the body structure to extract the request parameters. If you want to compose a response message, you must first compose the response parameters into the body structure, and then compose the body into the communication structure.

[0088] The protocol parser is also divided into two parts: communication protocol parser and text protocol parser.

[0089] 1. Communication protocol parser:

[0090] There are three built-in communication protocol parsers: standard COMPOS communication protocol parser, standard MISPOS communication protocol parser, and text-only communication protocol parser. If the communication structure of the project is different from the communication structure supported by these three communication protocol parsers, a custom communication protocol parser is required.

[0091] (1) Standard COMPOS communication protocol parser:

[0092] Parse the following communication structure:

[0093]

[0094] (2) Standard MISPOS communication protocol parser:

[0095]

[0096]

[0097]

[0098] (3) Text-only communication protocol parser:

[0099] Used when the message does not contain a communication structure but only a body structure. Commonly used in WIFI communication and cloud MIS (i.e. IOT).

[0100] (4) Custom communication protocol parser:

[0101] A custom communication protocol parser needs to implement the Instruction interface.

[0102] 2. Text protocol parser

[0103] There are four built-in text protocol parsers: standard text protocol parser, URI transparent transmission protocol parser, FS delimiter protocol parser and TLV text protocol parser. If the text structure of the project is different from the text structure supported by these four text protocol parsers, you need to customize the text protocol parser.

[0104] (1) Standard text protocol parser:

[0105] 1) Parse the request body in URI format, and use the path of the URI as the instruction name of the transaction instruction.

[0106] Text format: scheme: / / host:port / path?param1=val1¶m2=val2……

[0107] 2) The response body is in JSON object format.

[0108] Commonly used in standard MIS instructions.

[0109] (2)URI transparent protocol parser:

[0110] 1) Directly pass through the request body in URI format without configuring transaction instructions.

[0111] 2) Transmit the response parameters returned by the POS machine in JSON object format.

[0112] Commonly used in situations where MIS calls the cash register.

[0113] (3)FS separator protocol parser:

[0114] The request body and the response body are both in the text format with FS as the separator, and the instruction code in the request body is used as the instruction name of the transaction instruction.

[0115] Text format: instruction code + FS + parameter 1 + FS + parameter 2 + ... FS + parameter N;

[0116] Among them, FS is 1Ch.

[0117] (4) TLV body protocol parser:

[0118] The request body and response body are both in TLV format. The transaction type in the request body is used as the instruction name of the transaction instruction.

[0119] (5) Custom text protocol parser:

[0120] A custom text protocol parser needs to implement the ContConverter interface.

[0121] Host computer:

[0122] The dynamic library of the host computer provides three interfaces to the outside, which are used for initializing connection, data communication and releasing connection, corresponding to the init, comm and release methods respectively.

[0123] The initial connection parameters are configured in the config.ini configuration file. Dynamic configuration will be considered in the later stage. All ports of the local machine or all IPs in the LAN will be polled. When multiple devices are matched, the user can choose which device to communicate with, and store the configuration parameters in the configuration file, and automatically connect next time the connection is started.

[0124] The dynamic library encapsulates serial communication, wifi communication (http), cloud MIS and Bluetooth communication methods.

[0125] The interface call is a blocking call, and the input parameter is send. After the interface receives a successful return, the output parameter can be obtained from recv. If it fails, no data can be obtained from the output parameter.

[0126] See also Figure 1 , a script configuration-based package communication method of the present invention comprises the following steps:

[0127] Step 1. Configure different scripts according to different project types. The configuration information of each script includes the script version number, communication protocol parser information, text protocol parser information and transaction instructions;

[0128] In this embodiment, the step 1 specifically includes:

[0129] Step 11: Design the configuration information of the script according to the project type used between the host computer and the POS machine, the message structure characteristics of the host computer, and the parameter information required for the project type;

[0130] Step 12: The configuration information includes a required part and an optional part;

[0131] The required part includes the version number (versionCode) of the script, the communication protocol parser information (instruction), the text protocol parser information (cont) and the transaction instruction; wherein the version number of the script is the version number of the selected script, the communication protocol parser information is the information of a communication protocol parser that can support the parsing of the communication structure selected according to the message structure characteristics of the host computer, and one of the standard COMPOS communication protocol parser, the standard MISPOS communication protocol parser, the text-only communication protocol parser and the custom communication protocol parser is adopted; the text protocol parser information is a text protocol parser that can support the parsing of the text structure selected according to the message structure characteristics of the host computer, and one of the standard text protocol parser, the URI transparent transmission protocol parser, the FS separator protocol parser, the TLV text protocol parser and the custom text protocol parser is adopted; the transaction instruction is a step rule for realizing the conversion between the request parameters of the host computer and the request parameters of the POS machine and the conversion between the response parameters of the POS machine and the response parameters of the host computer according to the parameter information required by the project type;

[0132] The optional part includes bankpay, enumeration mapping and TLV format. The bankpay specifies the data type of the POS machine. The bankpay specifies the data type of the POS machine through the three fields of packageName, activity and action. If the POS machine is called explicitly, packageName and activity are configured. If the POS machine is called implicitly, action is configured. The enumeration mapping specifies the mapping relationship between the enumeration value of the host computer and the enumeration value of the POS machine. The TLV format specifies the byte length, encoding method and alignment method of tag, length and value when the message is in TLV format.

[0133] Step 13: Edit the configuration information corresponding to each script on the host computer through a script editor or a text editor, and generate the corresponding script. Each project type corresponds to a script.

[0134] Step 2: Select the corresponding target script according to the project type of the current POS machine, and form a MIS application with the channel and protocol parser, and install it in the current POS machine;

[0135] In this embodiment, step 2 specifically includes:

[0136] Step 21, according to the project type of the current POS machine, select a script with matching functions from the scripts generated in the host computer as the target script;

[0137] Step 22, the target script, the channel and the protocol parser constitute the MIS application, which is installed in the current POS machine; wherein the target script is downloaded to the POS machine when the POS machine leaves the factory or is downloaded to the POS machine again through the network or PC download tool after the POS machine leaves the factory;

[0138] Step 23: When the POS machine is started, the MIS application is automatically started and the target script is loaded;

[0139] Step 24: Obtain the target communication protocol parser and target text protocol parser to be used according to the communication protocol parser information and the text protocol parser information in the target script, and obtain the transaction name and the corresponding script rule according to the transaction instruction in the target script.

[0140] Step 3: The host computer sends the request message to the protocol analyzer through the channel;

[0141] In this embodiment, the communication methods between the host computer and the channel include serial port, Bluetooth, local area network and cloud MIS.

[0142] Step 4: according to the communication protocol parser information in the target script, call the corresponding target communication protocol parser in the protocol parser to parse the request message to obtain the request body;

[0143] In this embodiment, step 4 specifically includes:

[0144] Step 41, the protocol parser of the MIS application has multiple communication protocol parsers built in: standard COMPOS communication protocol parser, standard MISPOS communication protocol parser, text-only communication protocol parser and custom communication protocol parser;

[0145] Step 42: If the target communication protocol parser called is a standard COMPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard COMPOS communication protocol parser, and the protocol format is a start bit, a length, a body, an end bit and a check bit, to obtain a request body; and then the encoding format of the request body is converted from HEX to ASCII;

[0146] Step 43, if the target communication protocol parser called is a standard MISPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard MISPOS communication protocol parser, and the protocol format is a start bit, a length, a data flow attribute, an application type, a unique identifier, a data body, an end bit and a check bit, to obtain a request body; and then the encoding format of the request body is converted from HEX to ASCII;

[0147] Step 44, if the target communication protocol parser called is a text-only communication protocol parser, it means that the request message does not contain a communication structure but only a text structure, and there is no need to parse the communication structure, and the request text can be directly obtained;

[0148] Step 45: If the target communication protocol parser called is a custom communication protocol parser, the custom communication interface is called to parse the request message to obtain the request body.

[0149] Step 5: according to the text protocol parser information in the target script, call the corresponding target text protocol parser in the protocol parser to parse the request text and obtain the request parameters of the host computer;

[0150] In this embodiment, step 5 specifically includes:

[0151] Step 51, the protocol parser of the MIS application has multiple text protocol parsers built in: standard text protocol parser, URI transparent transmission protocol parser, FS separator protocol parser, TLV text protocol parser and custom text protocol parser;

[0152] Step 52: If the target text protocol parser called is a standard text protocol parser, the request text in URI format is parsed by the standard text protocol parser, and the path of the URI is used as the instruction name of the transaction instruction. The request text is divided into the address and the request parameters of the host computer according to the instruction name;

[0153] Step 53: If the target text protocol parser to be called is a URI transparent transmission protocol parser, the request text in URI format is directly transparently transmitted through the URI transparent transmission protocol parser to obtain the request parameters of the host computer;

[0154] Step 54: If the target text protocol parser to be called is the FS delimiter protocol parser, the request text with FS as the delimiter is parsed by the FS delimiter protocol parser, the instruction code in the request text is used as the instruction name of the transaction instruction, and the request parameters of the host computer in the request text are parsed according to the instruction name and the delimiter;

[0155] Step 55: If the target text protocol parser called is a TLV text protocol parser, the TLV text protocol parser is used to parse the request text in the TLV format, and the transaction type in the request text is used as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed according to the instruction name;

[0156] Step 56: If the target text protocol parser called is a custom text protocol parser, the custom text interface is called to parse the request text to obtain the request parameters of the host computer.

[0157] Step 6: Convert the request parameters of the host computer into the request parameters of the POS machine according to the transaction instructions in the target script, and send them to the POS machine for processing;

[0158] In this embodiment, step 6 specifically includes:

[0159] Step 61: The transaction instruction includes an instruction name, a request field and a response field. The request field includes input parameter content required by the item type of the current POS machine, and the response field includes return parameter content required by the item type of the current POS machine.

[0160] Step 62: Format the transaction instruction in JSON. The request field is a JSON object in Key:Value format. The Key is the input parameter content required by the project type of the current POS machine, that is, the request parameter of the POS machine, and the Value is the request parameter of the host computer.

[0161] Step 63: assign the corresponding value in the request parameter of the host computer to Value, obtain the request parameter of the POS machine, and send it to the POS machine for processing;

[0162] Step 7, the POS machine converts the response parameters of the POS machine obtained after processing into the response parameters of the host computer according to the transaction instructions in the script;

[0163] The step 7 specifically includes:

[0164] Step 71, the response field is a JSON object or a JSON array. If it is a JSON object, the key is the response parameter of the host computer, and the value is the response parameter of the POS machine; if it is a JSON array, the order of elements is the order of the response parameters of the host computer, and the value is the response parameter of the POS machine;

[0165] Step 72: assign the corresponding numerical value in the response parameter of the POS machine obtained after processing by the POS machine to Value, obtain the response parameter of the host computer, and send it to the protocol parser of the MIS application.

[0166] Step 8: Encapsulate the response parameters of the host computer into a response body through the target body protocol parser;

[0167] In this embodiment, step 8 specifically includes:

[0168] Step 81: If the target text protocol parser called is a standard text protocol parser, the response parameters of the host computer are encapsulated into a response text in URI format through the standard text protocol parser;

[0169] Step 82: If the target text protocol parser called is a URI transparent transmission protocol parser, the response parameters of the host computer are encapsulated into a response text in URI format through the URI transparent transmission protocol parser;

[0170] Step 83: If the target text protocol parser called is the FS delimiter protocol parser, the FS delimiter protocol parser encapsulates the response parameters of the host computer into a response text format with FS as the delimiter;

[0171] Step 84: If the target text protocol parser called is a TLV text protocol parser, the response parameters of the host computer are encapsulated into a response text in TLV format through the TLV text protocol parser;

[0172] Step 85: If the target text protocol parser called is a custom text protocol parser, the custom text interface is called to encapsulate the response parameters of the host computer into a response text;

[0173] Step 9: encapsulating the response body into a response message through the target communication protocol parser, and sending it to the host computer through the channel; in step 9, encapsulating the response body into a response message through the target communication protocol parser specifically includes:

[0174] Step 91, if the target communication protocol parser called is a standard COMPOS communication protocol parser, the encoding format of the response body is converted from ASCII to HEX by the standard COMPOS communication protocol parser, and then encapsulated into a response message according to the corresponding protocol format: start bit, length, body, end bit and check bit;

[0175] Step 92, if the target communication protocol parser called is a standard MISPOS communication protocol parser, the encoding format of the response body is converted from ASCII to HEX by the standard MISPOS communication protocol parser, and then encapsulated into a response message according to the corresponding protocol format: start bit, length, data flow attribute, application type, unique identifier, data body, end bit and check bit;

[0176] Step 93: If the target communication protocol parser called is a text-only communication protocol parser, there is no need to encapsulate the communication structure, and the response message is directly obtained;

[0177] Step 94: If the target communication protocol parser called is a custom communication protocol parser, the custom communication interface is called to encapsulate the response body into a response message.

[0178] Examples:

[0179] Take the following sign-in for collection as an example:

[0180] The host computer sign-in message is as follows:

[0181] payment: / / com.newland.pospp / LOGON? transType=LOGON&BANKPAY_VE R=1020700&MASK_HOMEKEY=false&IS_UNIQUE=true&EXT_ORDER_NO=12345678909876543210

[0182] The sign-in interface for acquiring is as follows:

[0183]

[0184]

[0185]

[0186] Note 1: The data in the EXT_ORDER_NO field will not be sent to the ICBC host. If you need to reflect the order information on the reconciliation sheet generated by ICBC for the merchant, you need to use the BILL_INFO field (please find it in the input parameters of the corresponding command).

[0187] Note 2: When the MASK_HOMEKEY field is true, it will ensure that the HOME key will remain in the masked state during the interface execution process and when the call is completed and returned; when the field value is false, the HOME key may be masked during the interface execution process (determined by the currently called interface function), but the HOME key will be fixedly released when the interface call is completed and returned.

[0188] Conventional treatment methods:

[0189] A new MIS application is developed to receive data from the host computer and then parse the corresponding fields. payment: / / com.newland.pospp / LOGON? transType=LOGON&BANKPAY_VER=1020700&MASK_HOMEKEY=false&IS_UNIQUE=true&EXT_ORDER_NO=12345678909876543210

[0190] For example, if transType = LOGON, the MIS application needs to assign this value LOGON to the parameter cmd required for the sign-in receiving of the acquiring program, so that cmd = LOGON, and then use the value of cmd to call the sign-in of its acquiring program through the interface.

[0191] Normally, an interface request has about 30 parameters, and an interface call returns about 30 parameters. However, an application needs to adapt to more than 10 or 20 interfaces, which results in a lot of work.

[0192] The method of the present invention is as follows:

[0193] The first step is script configuration:

[0194] The project type is sign-in. Depending on the project type, use a text editor to write the script or use the provided script editor to edit the script. The final generated script is a .properties file. The default file name is miscall.properties. One script per project, do not use multiple scripts at the same time.

[0195] The script consists of 2 parts: a mandatory part and an optional part.

[0196] Required parts: versionCode, instruction, cont.

[0197] versionCode: specifies the version number of the script;

[0198] Instruction: specifies the communication protocol parser. When the PC uses serial port and Bluetooth communication, STCOM indicates the standard COMPOS communication protocol parser, and STMIS indicates the standard MISPOS communication protocol parser;

[0199] cont: specifies the text protocol parser. ST means standard text protocol parser, FS means FS separator protocol parser, TLV means TLV text protocol parser, PASS_URI means URI pass-through protocol parser;

[0200] Optional parts: bankpay, transaction instruction, enumeration mapping, TLV format.

[0201] bankpay: specifies the data type of the acquirer and parameter; bankpay specifies the acquirer or cashier through the three fields packageName, activity, and action. If the POS machine is called explicitly, the packageName and activity can be configured; if the POS machine is called implicitly, the action can be configured. If not configured, the body needs to contain the URL.

[0202] For example, ICBC acquiring requires implicit call, so the bankpay configuration is as follows:

[0203] JSON bankpay={"action":"**********************"}

[0204] Transaction instructions: specify the correspondence between request parameters and response parameters, and also specify the data type of the parameters;

[0205] Enumeration mapping: specifies the mapping relationship between the enumeration value of the host computer (such as status code, card reading method, etc.) and the enumeration value of the POS machine;

[0206] TLV format: When the message is in TLV format, you can specify the byte length, encoding method, and alignment method of tag, length, and value.

[0207] In this embodiment, the designed script is:

[0208] Script example:

[0209] versionCode=1

[0210] instruction=STCOM

[0211] cont=ST

[0212] LOGON={"request":{"cmd":"transType","ctrlData":{"BANKPAY_VER":"BANKPAY_VER","EXT_ORDER_NO":"EXT_ORDER_NO","IS_UNIQUE":"IS_UNIQU E","MASK_HOMEKEY":"MASK_HOMEKEY"}},"response":{"RESULT":"RESU LT","DESCRIPTION":"DESCRIPTION","BATCH_NUM":"BATCH_NUM"}}

[0213] According to the above rules, the current script version number is 1. The project uses: standard COMPOS communication protocol parser and standard text protocol parser, and there is also a parsing script rule with a transaction name of LOGON.

[0214] The second step is to load the script:

[0215] Download the edited script to the POS machine when it leaves the factory, and you can also download it again through the network or PC download tool later. When the device starts, the MIS 3.0 application will automatically start. When MIS 3.0 starts, it will load the script file / 3G_MIS / miscall.properties by default. You can also load the properties script file in other locations through settings.

[0216] After loading the sample script, MIS 3.0 can know to use the standard COMPOS communication protocol parser and the standard text protocol parser based on the values ​​of instruction and cont. When receiving a transaction instruction, it will automatically use the corresponding parser. It also knows that there is a transaction name of LOGON, and loads the corresponding parsing rules.

[0217] The third step is communication protocol analysis:

[0218] The host computer sends a request message to MIS 3.0, which uses the standard COMPOS communication protocol parser to parse it:

[0219] Message:

[0220] 0201377061796D656E743A2F2F636F6D2E6E65776C616E642E706F737070 2F4C4F474F4E3F7472616E73547970653D4C4F474F4E2642414E4B5041595F5645523D31303230373030264D41534B5F48 4F4D454B45593D66616C73652649535F554E495155453D74727565264558545F4F524445525F4E4F3D3132333435363738 3930393837363534333231300322

[0221] Standard COMPOS communication protocol parser rules:

[0222]

[0223] According to the protocol specifications, it can be concluded that:

[0224] Start bit: 02

[0225] Length: 0137

[0226] text:

[0227] 7061796D656E743A2F2F636F6D2E6E65776C616E642E706F7370702F4C4F474F 4E3F7472616E73547970653D4C4F474F4E2642414E4B5041595F5645523D31303 230373030264D41534B5F484F4D454B45593D66616C73652649535F554E495155 453D74727565264558545F4F524445525F4E4F3D31323334353637383930393837 36353433323130

[0228] End bit: 03

[0229] Check digit: 22

[0230] The text encoding format is converted from HEX to ASCII:

[0231] payment: / / com.newland.pospp / LOGON? transType=LOGON&BANKPAY_VE R=1020700&MASK_HOMEKEY=false&IS_UNIQUE=true&EXT_ORDER_NO=12345678909876543210

[0232] Step 4: Parsing of the text protocol:

[0233] From the configuration, we can see that the standard text protocol parser is used: the text is a string in URI format, and the parameters need to be converted into request parameters corresponding to JSON.

[0234] First, according to the URI rule, the body is divided into the front and back parts using LOGON.

[0235] Request address: payment: / / com.newland.pospp / LOGON

[0236] Request parameters:

[0237] transType=LOGON&BANKPAY_VER=1020700&MASK_HOMEKEY=false&IS_UNIQUE=true&EXT_ORDER_NO=12345678909876543210

[0238] If the last word in the request address is LOGON, it means that this is a transaction with the transaction name LOGO. At this time, the LOGON transaction configuration in the configuration file is searched as follows:

[0239] Signed transaction instructions:

[0240] LOGON={"request":{"cmd":"transType","ctrlData":{"BANKPAY_VER":"BANKPAY_VER","EXT_ORDER_NO":"EXT_ORDER_NO","IS_UNIQUE":"IS_UNI QUE","MASK_HOMEKEY":"MASK_HOMEKEY"}},"response":{"RESULT":"RESULT","DESCRIPTION":"DESCRIPTION","BATCH_NUM":"BATCH_NUM"}}

[0241] JSON formatting:

[0242]

[0243]

[0244] Let's check the parameters under the request field. This is a JSON string in the Key:Value format, where the Key is the actual required Key and the Value is the Key in the body. For example, "cmd":"transType", which means that the actual transaction requires a "cmd" attribute, whose value is the value corresponding to the "transType" Key in the body, which is "LOGON". The final required parameter is "cmd" with a value of "LOGON".

[0245] Parse the entire text according to this rule to get the request parameters:

[0246]

[0247] At this time, MIS 3.0 has automatically parsed the request address

[0248] payment: / / com.newland.pospp / LOGON and request parameters, and follow the normal process to request the transaction according to the request address and request parameters. When receiving the return, process it in the same way and return it to the host computer.

[0249] When new requirements are met, MIS3.0 will parse according to the script. There is no need to create a new project and convert fields one by one. You only need to write the Json string according to the rules.

[0250] Other text parsers only have different rules for taking fields, but the general process is the same. If the default three text parsers cannot meet your needs, you can customize the text parser according to the interface. You only need to implement the parsing and encapsulation interfaces.

[0251] The following is a description of the FS delimiter protocol and TLV protocol rules.

[0252] FS separator protocol corresponding script:

[0253] The request body and the response body are both in the text format with FS as the separator, and the instruction code in the request body is used as the instruction name of the transaction instruction.

[0254] Text format: instruction code + FS + parameter 1 + FS + parameter 2 + ... FS + parameter N

[0255] Transaction script:

[0256] LOGON = | amount | bankVersion | ... | parameter N (the first parameter does not need to be configured, the default is the instruction code)

[0257] Actual text:

[0258] 001|000000000001|1.0.0|…|..

[0259] It means:

[0260] Instruction code: 001

[0261] Parameter: amount = 1

[0262] bankVersion=1.0.0

[0263] …

[0264] The script corresponding to the TLV format:

[0265] If the host computer uses TLV message format, the script rules are as follows:

[0266]

[0267]

[0268] in:

[0269] Tags

[0270] The JSON object of Tag contains two fields: type and len.

[0271] type: Optional field, indicating whether the tag is fixed-length (fix) or variable-length (var). The default tag is variable-length.

[0272] len: Optional field, indicating how many bytes a tag occupies when it is fixed length. The maximum occupancy is 4 bytes.

[0273] When the tag is variable length, the entire Tag field does not need to be set. Refer to: Variable length encoding rules for tags.

[0274] Len

[0275] The JSON object of Len contains two fields: type and len.

[0276] type: Optional field, indicating whether the value length is fixed (fix) or variable (var). The default value length is variable.

[0277] len: Optional field, indicating how many bytes the value occupies when the value length is fixed. The maximum occupancy is 4 bytes.

[0278] When the value length is variable, the entire Len field does not need to be set. Reference: Variable-length encoding rules for value length.

[0279] cmd

[0280] The value of cmd is the tag of the transaction type. In this example, the tag of the transaction type is set to DF01.

[0281] Value Description:

[0282] The key of the value description is a specific Tag tag, and the value is a JSON object. The JSON object contains three fields: encoding, len, and option.

[0283] encoding: A required field, the encoding method of the value. Three values ​​can be set: ASC, BCD and BIN.

[0284] len: Optional field, the length when the value is fixed. For example, if the attribute of a domain is N4, the value of this field is 4.

[0285] option: optional field, used to fill in the value when it is of fixed length and is insufficient.

[0286] The value of option is as follows:

[0287] -1 - no padding (default)

[0288] 0-right-aligned, left-filled with 0

[0289] 1-Left-aligned, right-filled with 0

[0290] 2-Right-align, left-fill with spaces

[0291] 3-Left-align, right-fill with space

[0292] The example sets the value descriptions for DF01, DF02, and DF03.

[0293] Encoding rules for tags and values ​​with variable lengths:

[0294] The attribute of a tag is bit, represented by hexadecimal, and occupies 1 to 2 bytes. For example, "9F33" is a tag that occupies two bytes. And "95" is a tag that occupies one byte. If the last four bits of the first byte of the tag (Note: the byte sorting direction is from left to right, the first byte is the leftmost byte. The bit sorting rule is the same.) are "1111", it means that the tag occupies two bytes, such as "9F33"; otherwise it occupies one byte, such as "95".

[0295] The attribute of the value length (i.e. L itself) is also bit, occupying 1 to 3 bytes. The specific encoding rules are as follows:

[0296] a) When the leftmost bit (bit8) of the leftmost byte of the L field is 0, it means that the L field occupies one byte, and its subsequent 7 bits (bit7 to bit1) represent the length of the subdomain value, and the decimal number of the subdomain value length is represented by a binary number. For example, if a domain value occupies 3 bytes, then the length of its subdomain value is represented as "00000011". Therefore, if the length of the subdomain value is between 1 and 127 bytes, then the L field itself only occupies one byte.

[0297] b) When the leftmost bit (bit8) of the leftmost byte of the L field is 1, it means that the L field occupies more than one byte. Then the number of bytes it occupies is represented by the decimal value of the following 7 bits (bit7 to bit1) of the leftmost byte. For example, if the leftmost byte is 10000010, it means that the L field has two bytes after this byte. The decimal value of the subsequent bytes indicates the length of the sub-domain value. For example, if the L field is "1000 0001 1111 1111", it means that the sub-domain value occupies 255 bytes. Therefore, if the length of the sub-domain value is between 127 and 255 bytes, then the L field itself needs to occupy two bytes.

[0298] like Figure 4 As shown, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned script-configuration-based package communication method when executing the program.

[0299] like Figure 5 As shown, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned script-configuration-based package communication method is implemented.

[0300] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0301] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0302] The above descriptions are only some embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent device or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A package communication method based on script configuration, characterized in that: The steps include: Step 1. Configure different scripts according to different project types. The configuration information of each script includes the script version number, communication protocol parser information, text protocol parser information and transaction instructions; Step 2: Select the corresponding target script according to the project type of the current POS machine, and form a MIS application with the channel and protocol parser, and install it in the current POS machine; Step 3: The host computer sends the request message to the protocol analyzer through the channel; Step 4: according to the communication protocol parser information in the target script, call the corresponding target communication protocol parser in the protocol parser to parse the request message to obtain the request body; Step 5: according to the text protocol parser information in the target script, call the corresponding target text protocol parser in the protocol parser to parse the request text and obtain the request parameters of the host computer; Step 6: Convert the request parameters of the host computer into the request parameters of the POS machine according to the transaction instructions in the target script, and send them to the POS machine for processing; Step 7, the POS machine converts the response parameters of the POS machine obtained after processing into the response parameters of the host computer according to the transaction instructions in the script; Step 8: Encapsulate the response parameters of the host computer into a response body through the target body protocol parser; Step 9: Encapsulate the response body into a response message through the target communication protocol parser and send it to the host computer through the channel.

2. A script-based package communication method as claimed in claim 1, characterized in that: The step 1 specifically includes: Step 11: Design the configuration information of the script according to the project type used between the host computer and the POS machine, the message structure characteristics of the host computer, and the parameter information required for the project type; Step 12: The configuration information includes a required part and an optional part; The required part includes the version number of the script, the communication protocol parser information, the text protocol parser information and the transaction instruction; wherein the version number of the script is the version number of the selected script, the communication protocol parser information is the information of a communication protocol parser that can support the parsing of the communication structure selected according to the message structure characteristics of the host computer, and one of the standard COMPOS communication protocol parser, the standard MISPOS communication protocol parser, the text-only communication protocol parser and the custom communication protocol parser is adopted; the text protocol parser information is a text protocol parser that can support the parsing of the text structure selected according to the message structure characteristics of the host computer, and one of the standard text protocol parser, the URI transparent transmission protocol parser, the FS separator protocol parser, the TLV text protocol parser and the custom text protocol parser is adopted; the transaction instruction is a step rule for realizing the conversion between the request parameters of the host computer and the request parameters of the POS machine and the conversion between the response parameters of the POS machine and the response parameters of the host computer according to the parameter information required by the project type; The optional part includes bankpay, enumeration mapping and TLV format. The bankpay specifies the data type of the POS machine. The bankpay specifies the data type of the POS machine through the three fields of packageName, activity and action. If the POS machine is called explicitly, packageName and activity are configured. If the POS machine is called implicitly, action is configured. The enumeration mapping specifies the mapping relationship between the enumeration value of the host computer and the enumeration value of the POS machine. The TLV format specifies the byte length, encoding method and alignment method of tag, length and value when the message is in TLV format. Step 13: Edit the configuration information corresponding to each script on the host computer through a script editor or a text editor, and generate the corresponding script. Each project type corresponds to a script.

3. A script-based package communication method as claimed in claim 1, characterized in that: The step 2 specifically includes: Step 21, according to the project type of the current POS machine, select a script with matching functions from the scripts generated in the host computer as the target script; Step 22, the target script, the channel and the protocol parser constitute the MIS application, which is installed in the current POS machine; wherein the target script is downloaded to the POS machine when the POS machine leaves the factory or is downloaded to the POS machine again through the network or PC download tool after the POS machine leaves the factory; Step 23: When the POS machine is started, the MIS application is automatically started and the target script is loaded; Step 24: Obtain the target communication protocol parser and target text protocol parser to be used according to the communication protocol parser information and the text protocol parser information in the target script, and obtain the transaction name and the corresponding script rule according to the transaction instruction in the target script.

4. A script-based package communication method as claimed in claim 1, characterized in that: The step 4 specifically includes: Step 41, the protocol parser of the MIS application has multiple communication protocol parsers built in: standard COMPOS communication protocol parser, standard MISPOS communication protocol parser, text-only communication protocol parser and custom communication protocol parser; Step 42: If the target communication protocol parser called is a standard COMPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard COMPOS communication protocol parser, and the protocol format is a start bit, a length, a body, an end bit and a check bit, to obtain a request body; and then the encoding format of the request body is converted from HEX to ASCII; Step 43, if the target communication protocol parser called is a standard MISPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard MISPOS communication protocol parser, and the protocol format is a start bit, a length, a data flow attribute, an application type, a unique identifier, a data body, an end bit and a check bit, to obtain a request body; and then the encoding format of the request body is converted from HEX to ASCII; Step 44, if the target communication protocol parser called is a text-only communication protocol parser, it means that the request message does not contain a communication structure but only a text structure, and there is no need to parse the communication structure, and the request text can be directly obtained; Step 45: If the target communication protocol parser called is a custom communication protocol parser, the custom communication interface is called to parse the request message to obtain the request body.

5. A script-based package communication method as claimed in claim 1, characterized in that: The step 5 specifically includes: Step 51, the protocol parser of the MIS application has multiple text protocol parsers built in: standard text protocol parser, URI transparent transmission protocol parser, FS separator protocol parser, TLV text protocol parser and custom text protocol parser; Step 52: If the target text protocol parser called is a standard text protocol parser, the request text in URI format is parsed by the standard text protocol parser, and the path of the URI is used as the instruction name of the transaction instruction. The request text is divided into the address and the request parameters of the host computer according to the instruction name; Step 53: If the target text protocol parser to be called is a URI transparent transmission protocol parser, the request text in URI format is directly transparently transmitted through the URI transparent transmission protocol parser to obtain the request parameters of the host computer; Step 54: If the target text protocol parser to be called is the FS delimiter protocol parser, the request text with FS as the delimiter is parsed by the FS delimiter protocol parser, the instruction code in the request text is used as the instruction name of the transaction instruction, and the request parameters of the host computer in the request text are parsed according to the instruction name and the delimiter; Step 55: If the target text protocol parser called is a TLV text protocol parser, the TLV text protocol parser is used to parse the request text in the TLV format, and the transaction type in the request text is used as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed according to the instruction name; Step 56: If the target text protocol parser called is a custom text protocol parser, the custom text interface is called to parse the request text to obtain the request parameters of the host computer.

6. A script-based package communication method as claimed in claim 1, characterized in that: The step 6 specifically includes: Step 61: The transaction instruction includes an instruction name, a request field and a response field. The request field includes input parameter content required by the item type of the current POS machine, and the response field includes return parameter content required by the item type of the current POS machine. Step 62: Format the transaction instruction in JSON. The request field is a JSON object in Key:Value format. The Key is the input parameter content required by the project type of the current POS machine, that is, the request parameter of the POS machine, and the Value is the request parameter of the host computer. Step 63: assign the corresponding value in the request parameter of the host computer to Value, obtain the request parameter of the POS machine, and send it to the POS machine for processing; The step 7 specifically includes: Step 71, the response field is a JSON object or a JSON array. If it is a JSON object, the key is the response parameter of the host computer, and the value is the response parameter of the POS machine; if it is a JSON array, the order of elements is the order of the response parameters of the host computer, and the value is the response parameter of the POS machine; Step 72: assign the corresponding numerical value in the response parameter of the POS machine obtained after processing by the POS machine to Value, obtain the response parameter of the host computer, and send it to the protocol parser of the MIS application.

7. A script-based package communication method as claimed in claim 1, characterized in that: The step 8 specifically includes: Step 81: If the target text protocol parser called is a standard text protocol parser, the response parameters of the host computer are encapsulated into a response text in URI format through the standard text protocol parser; Step 82: If the target text protocol parser called is a URI transparent transmission protocol parser, the response parameters of the host computer are encapsulated into a response text in URI format through the URI transparent transmission protocol parser; Step 83: If the target text protocol parser called is the FS delimiter protocol parser, the FS delimiter protocol parser encapsulates the response parameters of the host computer into a response text format with FS as the delimiter; Step 84: If the target text protocol parser called is a TLV text protocol parser, the response parameters of the host computer are encapsulated into a response text in TLV format through the TLV text protocol parser; Step 85: If the target text protocol parser called is a custom text protocol parser, the custom text interface is called to encapsulate the response parameters of the host computer into a response text; In step 9, the response body is encapsulated into a response message by the target communication protocol parser, which specifically includes: Step 91, if the target communication protocol parser called is a standard COMPOS communication protocol parser, the encoding format of the response body is converted from ASCII to HEX by the standard COMPOS communication protocol parser, and then encapsulated into a response message according to the corresponding protocol format: start bit, length, body, end bit and check bit; Step 92, if the target communication protocol parser called is a standard MISPOS communication protocol parser, the encoding format of the response body is converted from ASCII to HEX by the standard MISPOS communication protocol parser, and then encapsulated into a response message according to the corresponding protocol format: start bit, length, data flow attribute, application type, unique identifier, data body, end bit and check bit; Step 93: If the target communication protocol parser called is a text-only communication protocol parser, there is no need to encapsulate the communication structure, and the response message is directly obtained; Step 94: If the target communication protocol parser called is a custom communication protocol parser, the custom communication interface is called to encapsulate the response body into a response message.

8. A script configuration-based package communication method as claimed in claim 1, characterized in that: The communication modes between the host computer and the channel include serial port, Bluetooth, local area network and cloud MIS.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the package group communication method based on script configuration is implemented as described in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a script-configuration-based package communication method as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Point of sale (POS) terminal-based script processing device and data processing method thereof

    CN101989366A

  • POS product automatic test method, system and device, and computer storage medium

    CN112380143A

  • POS machine script processing tool and construction device thereof

    CN118349438A

  • System, Method, and Computer Program Product for Customizing Functions of a Point-of-Sale Terminal

    US20200219078A1

  • POS terminal and network configuration method and system thereof

    WO2015003483A1

Cited By

  • Standardized heterogeneous communication data interaction design method

    CN121193836A