A script configuration-based packet assembly communication method, device and medium
Through the script configuration-based package communication method, the time-consuming and labor-intensive problem of interface adaptation in the smart POS industry is solved, and efficient interface adaptation and stability improvement are achieved.
Patent Information
- Application Number
- CN202411915168.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-12-24
AI Technical Summary
In the smart POS industry, major manufacturers lack unified interface standards, resulting in the need to modify and adapt the POS machine's payment collection program every time a project is developed. This is time-consuming, labor-intensive, and inefficient.
A script-based package communication method is designed. The corresponding script file is generated by configuring the script and installed in the POS machine to automatically parse and convert interface parameters, reducing manual adjustment and testing work.
It greatly reduces the development workload, improves work efficiency, saves development costs, and enhances the stability of the program and the flexibility of adapting to different interfaces.
Smart Images

Figure CN119728417B_ABST
Abstract
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 increasingly mature. Currently, MIS (Management Information System) accounts for a large proportion of smart POS usage scenarios. Currently, there is no unified interface standard in China for this area. Major manufacturers have their own internal interface specifications. Furthermore, even within a single manufacturer, interfaces vary slightly across different usage scenarios, resulting in a relatively chaotic industry ecosystem.
[0003] As a developer of payment device applications, after completing a acquiring channel program, each project requires modifying the POS acquiring program to adapt it to the MIS interface, retesting, and releasing it to accommodate actual MIS usage scenarios. A newly developed MIS application receives data from the host computer and parses the corresponding fields. The MIS application then assigns these fields to the parameters required by the corresponding POS function and returns the converted values to the POS terminal through an interface call. This requires manual adjustments to the MIS application code, adapting each interface parameter according to documentation. Typically, an interface request has around 30 parameters, and an interface call returns around 30 parameters. A single application adaptation requires adapting to around 20 interfaces, resulting in a complex, inefficient, and time-consuming workload. Furthermore, after program modifications, a comprehensive testing process is required, which also requires significant labor. Although this work involves relatively simple field mapping tasks, it is time-consuming. A typical project development and testing process is estimated to take around 20 working days.
[0004] Although the technical development is easy, it requires a lot of work time to handle 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. 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. This reduces the development workload of MIS application scenarios in smart POS payment, saves development costs, and greatly improves 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 an MIS application with the channel and protocol parser, and install it into 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, the corresponding target communication protocol parser in the protocol parser is called to parse the request message to obtain the request body;
[0012] Step 5: Call the corresponding target text protocol parser in the protocol parser according to the text protocol parser information in the target script 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 response parameters of the host computer according to the transaction instructions in the script;
[0015] Step 8: Encapsulate the host computer's response parameters 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 based on 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 script version number, communication protocol parser information, text protocol parser information and transaction instructions; wherein, the script version number is the version number of the selected script, the communication protocol parser information is information of a communication protocol parser that can support parsing the communication structure according to the message structure characteristics of the host computer, and adopts 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; the text protocol parser information is information of a text protocol parser that can support parsing the text structure according to the message structure characteristics of the host computer, and adopts one of the standard text protocol parser, the URI transparent transmission protocol parser, the FS delimiter protocol parser, the TLV text protocol parser and the custom text protocol parser; the transaction instruction is a script 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. 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 the tag, length, and value when the message is in TLV format.
[0022] Step 13: Edit the configuration information of each script on the host computer using a script editor or text editor, and generate the corresponding script. Each project type corresponds to a script.
[0023] Furthermore, the step 2 specifically includes:
[0024] Step 21: Select a script with matching functions from the scripts generated in the host computer according to the project type of the current POS terminal as the target script;
[0025] Step 22: The target script, channel, and protocol parser constitute an MIS application and are installed in the current POS terminal. The target script is downloaded to the POS terminal when the POS terminal leaves the factory or is downloaded to the POS terminal again through a network or PC download tool after the POS terminal leaves the factory.
[0026] Step 23: When the POS machine starts, the MIS application is automatically started and the target script is loaded;
[0027] Step 24, according to the communication protocol parser information and the text protocol parser information in the target script, obtaining the target communication protocol parser and the target text protocol parser to be used, and according to the transaction instruction in the target script, obtaining the transaction name and the corresponding script rule.
[0028] Further, the step 4 specifically comprises:
[0029] Step 41, the protocol parser of the MIS application is built-in with multiple communication protocol parsers: a standard COMPOS communication protocol parser, a standard MISPOS communication protocol parser, a text-only communication protocol parser, and a custom communication protocol parser;
[0030] Step 42, if the called target communication protocol parser is the standard COMPOS communication protocol parser, the request message is parsed into the corresponding protocol format by the standard COMPOS communication protocol parser, the protocol format is start bit, length, text, end bit and check bit, and the request text is obtained; then the encoding format of the request text is converted from HEX to ASCII;
[0031] Step 43, if the called target communication protocol parser is the standard MISPOS communication protocol parser, the request message is parsed into the corresponding protocol format by the standard MISPOS communication protocol parser, the protocol format is start bit, length, data flow attribute, application type, unique identification, data text, end bit and check bit, and the request text is obtained; then the encoding format of the request text is converted from HEX to ASCII;
[0032] Step 44, if the called target communication protocol parser is the text-only communication protocol parser, it means that the request message does not contain communication structure, only contains text structure, so it is not necessary to parse the communication structure, and the request text is directly obtained;
[0033] Step 45, if the called target communication protocol parser is the custom communication protocol parser, the request message is parsed by calling the custom communication interface, and the request text is obtained.
[0034] Further, the step 5 specifically comprises:
[0035] Step 51, the protocol parser of the MIS application is built-in with multiple text protocol parsers: a standard text protocol parser, a URI transparent protocol parser, an FS separator protocol parser, a TLV text protocol parser, and a custom text protocol parser;
[0036] Step 52: If the target text protocol parser is a standard text protocol parser, the standard text protocol parser is used to parse the request text in the URI format. The path of the URI is used as the instruction name of the transaction instruction. The request text is then split into the address and the host computer request parameters 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 FS delimiter protocol parser is used to parse the request text with FS as the delimiter, using the instruction code in the request text as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed based on the instruction name and the delimiter.
[0039] Step 55: If the target text protocol parser is a TLV text protocol parser, the TLV text protocol parser is used to parse the request text in TLV format, using the transaction type in the request text as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed based on 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 parameters required by the current POS terminal's item type, and the response field includes return parameters required by the current POS terminal's item type.
[0043] Step 62: Format the transaction instruction in JSON. The request field is a JSON object in the Key:Value format. The Key is the input parameter content required by the current POS machine's project type, i.e., the POS machine's request parameter, and the Value is the host machine's request parameter.
[0044] Step 63: Assign the corresponding value in the request parameter of the host computer to Value to 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 the 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 to be 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 to be 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 TLV format response text through the TLV text protocol parser;
[0053] Step 85: If the target text protocol parser 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, specifically including:
[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 is a text-only communication protocol parser, then no communication structure encapsulation is required, and the response message is obtained directly.
[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, comprising 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 having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned script-configuration-based package communication method.
[0062] By adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art:
[0063] In the development of CommPOS scenario applications for smart POS machines, the present invention only requires configuration of the script on the PC and then downloading 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 modify the code again, 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, 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 following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 any creative work.
[0065] Figure 1 This is a flowchart of an execution of a script configuration-based package communication method provided by an embodiment of the present invention.
[0066] Figure 2 This is a diagram of the data transmission process among the 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 the message provided by an embodiment of the present invention.
[0068] Figure 4 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 described in further detail below with reference to the accompanying drawings and examples. It is particularly noted that the following examples are intended only to illustrate the present invention and are not intended to limit the scope of the present invention. Similarly, the following examples are only some embodiments of the present invention and are not intended to be exhaustive. All other embodiments obtained by those of ordinary skill in the art without creative effort are intended to fall within the scope of protection of the present invention.
[0071] Glossary:
[0072] Host computer: mainly includes the business system, transmits the amount to the lower computer for financial transactions, generally refers to PCs and cash registers.
[0073] Slave computer: The initiator of financial transactions, receiving instructions from the host computer, generally refers to the POS machine.
[0074] Channel: Communication channel.
[0075] Program 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 anymore to ensure the stability of the acquiring program. Provide a script editor that can automatically generate the corresponding scripts between the 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 host computer communication instructions. It can parse the host computer communication instructions according to the script, then call the corresponding acquiring program, receive the return result of the acquiring program, and then generate the corresponding host computer response communication instructions according to the script and return them 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 Windows 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 methods: 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 host computer's request parameters from the request message and composing the host computer's response parameters 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, a message generally consists of two parts: a communication structure and a body structure. The communication structure contains the body, which also has its own structure, the body structure. The body contains request and response parameters. Therefore, to extract the request parameters, you must first parse the communication structure to extract the body, then parse the body structure to extract the request parameters. To assemble a response message, you must first assemble the response parameters into the body structure, then assemble 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] Three communication protocol parsers are built-in: the standard COMPOS communication protocol parser, the standard MISPOS communication protocol parser, and the body-only communication protocol parser. If the project's communication structure differs from the communication structure supported by these three communication protocol parsers, a custom communication protocol parser will be 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 contains only a body structure and no communication structure. Commonly used in Wi-Fi 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] Four text protocol parsers are built-in: standard text protocol parser, URI transparent transmission protocol parser, FS delimiter protocol parser, and TLV text protocol parser. If the text structure of your project differs from the text structure supported by these four text protocol parsers, you will 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 URI path as the instruction name of the transaction instruction.
[0106] Content 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 transmission 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] Often used when MIS calls the cash register.
[0113] (3) FS delimiter protocol parser:
[0114] Both the request body and the response body are in the body format with FS as the delimiter, 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] Both the request body and the response body are 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 world, which are used to initialize the connection, data communication and release the connection, corresponding to the init, comm and release methods respectively.
[0123] The initial connection parameters are configured in the config.ini configuration file. Later, dynamic configuration will be considered, polling all ports of the local machine or all IPs in the LAN. When multiple matches are found, the user chooses which device to communicate with and stores the configuration parameters in the configuration file. The connection will be automatically connected next time the system 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 Figure 1 The present invention provides a script-based package communication method, comprising 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, step 1 specifically includes:
[0129] Step 11: Design the configuration information of the script based on 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 script version number (versionCode), communication protocol parser information (instruction), text protocol parser information (cont) and transaction instructions; wherein the script version number is the version number of the selected script, the communication protocol parser information is information of a communication protocol parser selected according to the message structure characteristics of the host computer that can support parsing the communication structure, and adopts 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; the text protocol parser information is information of a text protocol parser selected according to the message structure characteristics of the host computer that can support parsing the text structure, and adopts one of the standard text protocol parser, the URI transparent transmission protocol parser, the FS delimiter protocol parser, the TLV text protocol parser and the custom text protocol parser; the transaction instruction is a script rule for realizing conversion between the request parameters of the host computer and the request parameters of the POS machine, and 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. 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 the tag, length, and value when the message is in TLV format.
[0133] Step 13: Edit the configuration information of each script on the host computer using a script editor or 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 an MIS application with the channel and protocol parser, and install it into the current POS machine;
[0135] In this embodiment, step 2 specifically includes:
[0136] Step 21: Select a script with matching functions from the scripts generated in the host computer according to the project type of the current POS terminal as the target script;
[0137] Step 22: The target script, channel, and protocol parser constitute an MIS application and are installed in the current POS terminal. The target script is downloaded to the POS terminal when the POS terminal leaves the factory or is downloaded to the POS terminal again through a network or PC download tool after the POS terminal leaves the factory.
[0138] Step 23: When the POS machine starts, 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 text protocol parser information in the target script, and obtain the transaction name and corresponding script rules according to the transaction instructions 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, the corresponding target communication protocol parser in the protocol parser is called 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 is a standard COMPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard COMPOS communication protocol parser. The protocol format includes a start bit, a length, a body, an end bit, and a check bit to obtain a request body. The encoding format of the request body is then 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. The protocol format includes 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 the encoding format of the request body is converted from HEX to ASCII.
[0147] Step 44: If the target communication protocol parser to be 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. In this case, there is no need to parse the communication structure and the request body 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: Call the corresponding target text protocol parser in the protocol parser according to the text protocol parser information in the target script 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 built-in text protocol parsers: standard text protocol parser, URI transparent transmission protocol parser, FS delimiter protocol parser, TLV text protocol parser and custom text protocol parser;
[0152] Step 52: If the target text protocol parser is a standard text protocol parser, the standard text protocol parser is used to parse the request text in the URI format. The path of the URI is used as the instruction name of the transaction instruction. The request text is then split into the address and the host computer request parameters 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 FS delimiter protocol parser is used to parse the request text with FS as the delimiter, using the instruction code in the request text as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed based on the instruction name and the delimiter.
[0155] Step 55: If the target text protocol parser is a TLV text protocol parser, the TLV text protocol parser is used to parse the request text in TLV format, using the transaction type in the request text as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed based on 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 parameters required by the current POS terminal's item type, and the response field includes return parameters required by the current POS terminal's item type.
[0160] Step 62: Format the transaction instruction in JSON. The request field is a JSON object in the Key:Value format. The Key is the input parameter content required by the current POS machine's project type, i.e., the POS machine's request parameter, and the Value is the host machine's request parameter.
[0161] Step 63: Assign the corresponding value in the request parameter of the host computer to Value to 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 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 the 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 host computer's response parameters 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 to be 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 to be 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 TLV format response text through the TLV text protocol parser;
[0172] Step 85: If the target text protocol parser 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 text into a response message through the target communication protocol parser and sending it to the host computer through the channel; Step 9: Encapsulating the response text 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 is a text-only communication protocol parser, then no communication structure encapsulation is required, and the response message is obtained directly.
[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] Case:
[0179] Take the following check-in for payment 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 remains in a 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] Develop a new MIS application to receive data from the host computer and 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 function of the acquiring program, so that cmd = LOGON, and then use the value of cmd to call the sign-in function of the acquiring program through the interface.
[0191] Typically, 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 large workload.
[0192] The method of the present invention is as follows:
[0193] The first step is script configuration:
[0194] For a check-in project, write the script using a text editor or edit it using the provided script editor. The resulting script is a .properties file, with the default name miscall.properties. Each project has its own script; multiple scripts should not be used simultaneously.
[0195] The script consists of two parts: a required part and an optional part.
[0196] Required fields: versionCode, instruction, and cont.
[0197] versionCode: specifies the version number of the script;
[0198] Instruction: Specifies the communication protocol parser. When the PC uses the 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 indicates the standard text protocol parser, FS indicates the FS separator protocol parser, TLV indicates the TLV text protocol parser, and PASS_URI indicates the URI pass-through protocol parser.
[0200] Optional parts: bankpay, transaction instructions, enumeration mapping, TLV format.
[0201] bankpay: Specifies the acquirer and parameter data types. Bankpay uses the packageName, activity, and action fields to specify the acquirer or cashier. If the POS device is called explicitly, the packageName and activity can be configured; if the POS device is called implicitly, the action can be configured. If not configured, the body must contain a 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 of the 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 the transaction name LOGON.
[0214] The second step is to load the script:
[0215] Download the edited script to the POS machine when it leaves the factory. You can also download it later through the Internet or PC download tools. The MIS 3.0 application will automatically start when the device starts. MIS 3.0 will load the script file / 3G_MIS / miscall.properties by default when it starts. You can also set it to load the properties script file in other locations.
[0216] When loading the sample script above, MIS 3.0 determines which parser to use for the standard COMPOS communication protocol and the standard text protocol based on the values of instruction and cont. When a subsequent transaction instruction is received, the corresponding parser is automatically used. Furthermore, it recognizes that a transaction name is 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 the text protocol:
[0233] The configuration shows that the standard text protocol parser is used: the text is a string in URI format, and the parameters need to be converted into JSON corresponding request parameters.
[0234] First, according to the URI rule, the body is divided into 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 named LOGO. In this case, the LOGON transaction configuration in the configuration file is:
[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 look at the parameters below the request field. This is a JSON string in Key:Value format, where the Key is the actual key and the Value is the key in the body. For example, "cmd":"transType" indicates that the actual transaction requires a "cmd" attribute, whose value is the value corresponding to the "transType" key in the body. If it is "LOGON", the final required parameter is "cmd" with a value of "LOGON".
[0245] Parse the entire body 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 the request parameters. Follow the normal process to request the transaction based on the request address and request parameters. When receiving the response, process it in the same way and return it to the host computer.
[0249] When new requirements are encountered, MIS3.0 will parse them 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, and 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] Both the request body and the response body are in the body format with FS as the delimiter, and the instruction code in the request body is used as the instruction name of the transaction instruction.
[0254] Text format: command 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 and defaults to 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] Script corresponding to TLV format:
[0265] If the host computer uses the 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 the number of bytes occupied by a fixed-length tag. The maximum occupancy is 4 bytes.
[0273] When the tag is variable-length, the entire Tag field can be omitted. See: 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 the number of bytes occupied when the value is fixed length. The maximum occupancy is 4 bytes.
[0278] When the value length is variable, the entire Len field can be left blank. See: Variable-length encoding rules for value lengths.
[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, and the value is a JSON object containing three fields: encoding, len, and option.
[0283] encoding: A required field, which specifies the encoding method of the value. Three values are available: 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, then 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 padded with 0
[0289] 1-Left alignment, right padding with 0
[0290] 2-Right alignment, left padding
[0291] 3-Left alignment, right padding
[0292] The example sets the value descriptions for DF01, DF02, and DF03.
[0293] Encoding rules for tags and values with variable lengths:
[0294] Tag attributes are bits, expressed in hexadecimal, and occupy 1 to 2 bytes. For example, "9F33" is a two-byte tag. "95" is a one-byte tag. If the last four bits of the first byte (note: bytes are sorted from left to right, with the first byte being the leftmost byte. The same applies to bit sorting) of a tag are "1111," the tag occupies two bytes, such as "9F33." Otherwise, the tag occupies one byte, such as "95."
[0295] The value length (i.e., L itself) is also a bit, occupying 1 to 3 bytes. The specific encoding rules are as follows:
[0296] a) When the leftmost bit (bit 8) of the leftmost byte of the L field is 0, the L field occupies one byte. The following seven bits (bits 7 through 1) represent the length of the subfield value, expressed as a decimal representation of the subfield length in binary. For example, if a field value occupies three bytes, the subfield length is represented as "00000011." Therefore, if the subfield value is between 1 and 127 bytes long, the L field itself occupies only one byte.
[0297] b) When the leftmost bit (i.e., bit 8) of the leftmost byte of the L field is 1, it indicates that the L field occupies more than one byte. The number of bytes it occupies is then indicated by the decimal value of the seven bits following the leftmost byte (i.e., bits 7 to 1). For example, if the leftmost byte is 10000010, it means that the L field has two bytes following it in addition to this byte. The decimal value of the subsequent bytes indicates the length of the subfield value. For example, if the L field is "1000 0001 1111 1111", it means that the subfield value occupies 255 bytes. Therefore, if the length of the subfield value is between 127 and 255 bytes, the L field itself must 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 having a computer program stored thereon, which implements the above-mentioned script-configuration-based package communication method when executed by a processor.
[0300] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0301] If the integrated unit is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the entire or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0302] The above only describes some embodiments of the present application, and does not limit the protection scope of the present application. Any equivalent device or equivalent process transformation, or direct or indirect application in other related technical fields based on the content of the present application specification and drawings are also included in the patent protection scope of the present application.
Claims
1. A script-based package communication method, 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 an MIS application with the channel and protocol parser, and install it into 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, the corresponding target communication protocol parser in the protocol parser is called to parse the request message to obtain the request body; Step 5: Call the corresponding target text protocol parser in the protocol parser according to the text protocol parser information in the target script 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 response parameters of the host computer according to the transaction instructions in the script; Step 8: Encapsulate the host computer's response parameters 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 configuration-based package communication method according to claim 1, characterized in that: The step 1 specifically includes: Step 11: Design the configuration information of the script based on 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, communication protocol parser information, text protocol parser information and transaction instructions; wherein the version number of the script is the version number of the selected script, the communication protocol parser information is information of a communication protocol parser that can support parsing the communication structure according to the message structure characteristics of the host computer, and adopts 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; the text protocol parser information is a text protocol parser that can support parsing the text structure according to the message structure characteristics of the host computer, and adopts one of the standard text protocol parser, the URI transparent transmission protocol parser, the FS delimiter protocol parser, the TLV text protocol parser and the custom text protocol parser; the transaction instruction is a script 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. 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 the tag, length, and value when the message is in TLV format. Step 13: Edit the configuration information of each script on the host computer using a script editor or text editor, and generate the corresponding script. Each project type corresponds to a script.
3. A script configuration-based package communication method as claimed in claim 1, characterized in that: The step 2 specifically includes: Step 21: Select a script with matching functions from the scripts generated in the host computer according to the project type of the current POS terminal as the target script; Step 22: The target script, channel, and protocol parser constitute an MIS application and are installed in the current POS terminal. The target script is downloaded to the POS terminal when the POS terminal leaves the factory or is downloaded to the POS terminal again through a network or PC download tool after the POS terminal leaves the factory. Step 23: When the POS machine starts, 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 text protocol parser information in the target script, and obtain the transaction name and corresponding script rules according to the transaction instructions in the target script.
4. A script configuration-based package communication method according to 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 is a standard COMPOS communication protocol parser, the request message is parsed into a corresponding protocol format by the standard COMPOS communication protocol parser. The protocol format includes a start bit, a length, a body, an end bit, and a check bit to obtain a request body. The encoding format of the request body is then 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. The protocol format includes 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 the encoding format of the request body is converted from HEX to ASCII. Step 44: If the target communication protocol parser to be 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. In this case, there is no need to parse the communication structure and the request body 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. The script configuration-based package communication method according to claim 1, wherein: The step 5 specifically includes: Step 51: The protocol parser of the MIS application has multiple built-in text protocol parsers: standard text protocol parser, URI transparent transmission protocol parser, FS delimiter protocol parser, TLV text protocol parser and custom text protocol parser; Step 52: If the target text protocol parser is a standard text protocol parser, the standard text protocol parser is used to parse the request text in the URI format. The path of the URI is used as the instruction name of the transaction instruction. The request text is then split into the address and the host computer request parameters 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 FS delimiter protocol parser is used to parse the request text with FS as the delimiter, using the instruction code in the request text as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed based on the instruction name and the delimiter. Step 55: If the target text protocol parser is a TLV text protocol parser, the TLV text protocol parser is used to parse the request text in TLV format, using the transaction type in the request text as the instruction name of the transaction instruction. The request parameters of the host computer in the request text are parsed based on 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 configuration-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 parameters required by the current POS terminal's item type, and the response field includes return parameters required by the current POS terminal's item type. Step 62: Format the transaction instruction in JSON. The request field is a JSON object in the Key:Value format. The Key is the input parameter content required by the current POS machine's project type, i.e., the POS machine's request parameter, and the Value is the host machine's request parameter. Step 63: Assign the corresponding value in the request parameter of the host computer to Value to 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 the 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 configuration-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 to be 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 to be 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 TLV format response text through the TLV text protocol parser; Step 85: If the target text protocol parser 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, specifically including: 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 is a text-only communication protocol parser, then no communication structure encapsulation is required, and the response message is obtained directly. 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. The script configuration-based package communication method according to claim 1, wherein: 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, wherein: 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, the package group communication method based on script configuration is implemented as described in any one of claims 1 to 8.
Citation Information
Patent Citations
POS product automatic test method, system and device, and computer storage medium
CN112380143A
System for controlling a POS terminal network
WO2019125200A1