A modular communication method and device, electronic equipment and storage medium

CN118035154BActive Publication Date: 2026-08-11E SURFING IOT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

AT指令使用简单,易于配置和管理模组,但使用AT指令进行数据收发效率较低,稳定性较差,不具备数据完整性校验

Benefits of technology

[0050] This invention embodiment obtains the call instruction for the target function from the first module; serializes the call instruction to obtain binary encoded data; encodes the binary encoded data using a serial port protocol to obtain serial port encoded data; sends the serial port encoded data to the second module; decodes the serial port encoded data using a serial port protocol to obtain binary encoded data; deserializes the binary encoded data to parse the execution instruction for the target function; executes the AT instruction corresponding to the target function based on the execution instruction; and obtains the execution result returned by the second module to the first module based on the result of the AT instruction execution. This invention embodiment, based on the serialized binary data design and serial port encoding/decoding design, can improve the efficiency, speed, and stability of data communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118035154B_ABST
    Figure CN118035154B_ABST
Patent Text Reader

Abstract

This invention discloses a module communication method, apparatus, electronic device, and storage medium. The method includes: acquiring a call instruction from a first module to a target function; serializing the call instruction to obtain binary encoded data; encoding the binary encoded data using a serial port protocol to obtain serial port encoded data; and sending the serial port encoded data to a second module; decoding the serial port encoded data using a serial port protocol to obtain binary encoded data; deserializing the binary encoded data to parse and obtain an execution instruction for executing the target function; executing the AT instruction corresponding to the target function based on the execution instruction; and obtaining the execution result returned by the second module to the first module based on the result of the AT instruction execution. This invention, based on the serialized binary data design and serial port encoding / decoding design, can improve the efficiency, speed, and stability of data communication, and can be widely applied in the field of data processing technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a module communication method, apparatus, electronic device, and storage medium. Background Technology

[0002] A communication module is a key component for transmitting data between devices. It can include various technologies and protocols for enabling wireless or wired communication. Communication modules play a vital role in modern technology, enabling devices to connect, exchange information, and function in a wide range of applications. Features of communication modules include high scalability, supporting different types of data transmission such as voice, images, and text. They can also operate on different frequency bands and ranges to suit various communication needs. Communication modules typically feature optimized power management to ensure long-term availability and can be adapted to battery-powered devices. In the Internet of Things (IoT) and smart device fields, communication modules are becoming increasingly important because they enable devices to interconnect and communicate with cloud services. This offers immense potential for smart cities, smart homes, remote monitoring, and other applications. Common communication modules include: Wi-Fi modules, notebook modules, LTE-CAT1 modules, and 5G modules. These modules provide management and data communication functions to terminal devices via serial ports or USB interfaces. For low-speed modules (Wi-Fi modules, notebook modules), both management and data transmission use serial protocols, and AT commands are used for module configuration and data transmission / reception. AT commands are simple to use and easy to configure and manage modules, but using AT commands for data transmission and reception is inefficient, unstable, and lacks data integrity verification. Summary of the Invention

[0003] This invention aims to at least partially solve one of the technical problems in related technologies. To this end, this invention proposes a module communication method, apparatus, electronic device, and storage medium capable of efficient module communication.

[0004] On one hand, embodiments of the present invention provide a module communication method, including:

[0005] Obtain the call instructions from the first module to the target function;

[0006] The call instruction is serialized to obtain binary encoded data;

[0007] The binary encoded data is encoded using the serial port protocol to obtain serial port encoded data; and the serial port encoded data is sent to the second module.

[0008] Serial port encoded data is decoded using the serial port protocol to obtain binary encoded data;

[0009] The binary encoded data is deserialized and parsed to obtain the execution instructions for the target function.

[0010] Based on the execution instructions, execute the AT instructions corresponding to the target function;

[0011] Based on the result of the AT command execution, the execution result of the second module is returned to the first module.

[0012] Optionally, the calling instruction is serialized to obtain binary encoded data, including:

[0013] Determine the AT command corresponding to the target function based on the calling instruction;

[0014] The function ID and function type of the AT command in binary data format are obtained by serializing the data through a preset function mapping table.

[0015] Binary encoded data is obtained by organizing the data based on the function ID and function type.

[0016] Optionally, the binary encoded data is deserialized to obtain the calling instructions for the target function, including:

[0017] Extract the function ID and function type in binary data format from binary encoded data;

[0018] The function ID and the corresponding AT command for the function type are obtained by deserializing the preset function mapping table;

[0019] The AT command is used as the target function to execute the command.

[0020] Optionally, before obtaining the execution result returned by the second module to the first module, the method further includes:

[0021] The second module serializes the execution result based on a preset response result mapping table to obtain the first encoded data;

[0022] The first encoded data is encoded using a serial port protocol to obtain the second encoded data.

[0023] Optionally, the execution result returned by the second module to the first module includes:

[0024] The first module decodes the second encoded data using a serial port protocol to obtain the first encoded data.

[0025] The first encoded data is deserialized based on the response result mapping table, and the execution result is obtained by parsing.

[0026] Optionally, before obtaining the execution result returned by the second module to the first module, the method further includes:

[0027] The event notification function is executed through the second module;

[0028] The event notification function is serialized based on a preset function mapping table to obtain third-encoded data;

[0029] The third encoded data is encoded using a serial port protocol to obtain the fourth encoded data;

[0030] The fourth encoded data is sent to the first module so that the first module executes the callback function based on the fourth encoded data;

[0031] The first module obtains the execution result returned by the second module through a callback function.

[0032] On the other hand, embodiments of the present invention provide a module communication device, including:

[0033] The first module is used to obtain the call instructions of the first module to the target function;

[0034] The second module is used to serialize the calling instructions to obtain binary encoded data;

[0035] The third module is used to encode binary data using the serial port protocol to obtain serial port encoded data; and then send the serial port encoded data to the second module.

[0036] The fourth module is used to decode the serial port encoded data using the serial port protocol to obtain binary encoded data;

[0037] The fifth module is used to deserialize binary encoded data and parse it to obtain the execution instructions for the target function.

[0038] The sixth module is used to execute the AT instructions corresponding to the target function based on the execution instructions;

[0039] The seventh module is used to obtain the execution result of the second module returning to the first module based on the result of the AT command execution.

[0040] Optionally, before the step in the seventh module where the execution result of the second module returns to the first module is obtained, the device further includes:

[0041] The eighth module is used to serialize the execution result based on a preset response result mapping table by the second module to obtain the first encoded data;

[0042] The ninth module is used to perform serial port protocol encoding on the first encoded data to obtain the second encoded data.

[0043] Optionally, before the step in the seventh module where the execution result of the second module returns to the first module is obtained, the device further includes:

[0044] The tenth module is used to execute event notification functions through the second module;

[0045] The eleventh module is used to serialize the event notification function based on a preset function mapping table to obtain third-encoded data;

[0046] The twelfth module is used to perform serial port protocol encoding on the third encoded data to obtain the fourth encoded data;

[0047] The thirteenth module is used to send the fourth encoded data to the first module so that the first module executes a callback function based on the fourth encoded data; wherein, the first module obtains the execution result returned by the second module through the callback function.

[0048] On the other hand, embodiments of the present invention provide an electronic device, including: a processor and a memory; the memory is used to store a program; the processor executes the program to implement the above-described module communication method.

[0049] On the other hand, embodiments of the present invention provide a computer storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the above-described module communication method.

[0050] This invention embodiment obtains the call instruction for the target function from the first module; serializes the call instruction to obtain binary encoded data; encodes the binary encoded data using a serial port protocol to obtain serial port encoded data; sends the serial port encoded data to the second module; decodes the serial port encoded data using a serial port protocol to obtain binary encoded data; deserializes the binary encoded data to parse the execution instruction for the target function; executes the AT instruction corresponding to the target function based on the execution instruction; and obtains the execution result returned by the second module to the first module based on the result of the AT instruction execution. This invention embodiment, based on the serialized binary data design and serial port encoding / decoding design, can improve the efficiency, speed, and stability of data communication. Attached Figure Description

[0051] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the technical solutions of the present invention, and do not constitute a limitation on the technical solutions of the present invention.

[0052] Figure 1 This is a schematic diagram of an implementation environment for module communication provided in an embodiment of the present invention;

[0053] Figure 2 This is a flowchart illustrating a module communication method provided in an embodiment of the present invention;

[0054] Figure 3A schematic diagram of a conventional module communication method provided in an embodiment of the present invention;

[0055] Figure 4 This is a schematic diagram of an AT command-based communication module provided in an embodiment of the present invention;

[0056] Figure 5 This is a schematic diagram of the business process for module AT command interaction provided in an embodiment of the present invention;

[0057] Figure 6 This is a schematic diagram of an integrated RPC terminal and module provided in an embodiment of the present invention;

[0058] Figure 7 A schematic diagram of the RPC module design architecture provided in an embodiment of the present invention;

[0059] Figure 8 This is a schematic diagram illustrating the principle of the serial port data packet transmission interval provided in an embodiment of the present invention.

[0060] Figure 9 This is a schematic diagram of the RPC function execution process provided in an embodiment of the present invention;

[0061] Figure 10 This is a schematic diagram of the structure of a module communication device provided in an embodiment of the present invention;

[0062] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0063] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0064] It should be noted that although functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100," "second / S200," etc., in the specification, claims, and the aforementioned figures are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0065] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0066] It should be noted that, for the sake of understanding the technical solution of this invention, the technical terms that may appear in the embodiments of this invention will first be explained:

[0067] RPC: Remote Procedure Call.

[0068] UART (Universal Asynchronous Receiver / Transmitter) is an asynchronous transceiver that is part of computer hardware and transmits data via serial communication. It performs parallel-to-serial data conversion at the transmitting end and serial-to-parallel data conversion at the receiving end. It is versatile because parameters such as transmission speed and data rate are configurable. UART is typically used for connections to other communication interfaces (such as EIA RS-232). The letter "A" in UART stands for asynchronous, meaning there is no clock signal to synchronize or verify the data sent from the transmitter and received by the receiver (asynchronous serial communication). This is the opposite of synchronous serial communication, which uses a shared clock signal between the transmitter and receiver to "synchronize" their data. In UART, the transmitter and receiver must agree on timing parameters beforehand. Furthermore, UART uses special bits at the beginning and end of each data word to synchronize the transmitter and receiver.

[0069] Serial port: A data communication protocol, generally used for data communication between terminals and other chips or modules.

[0070] MCU: Microcontroller Unit, also known as Single Chip Microcomputer or microcontroller, is a chip-level computer that integrates a central processing unit (CPU) with a reduced frequency and specifications, and peripheral interfaces such as memory, timer, USB, A / D converter, UART, PLC, DMA, and even LCD driver circuitry onto a single chip. This allows for different combinations of control for different applications.

[0071] Serialization: Converting structured data into binary data in a continuous space.

[0072] Deserialization: Converting continuous binary data into structured data, typically bit structures.

[0073] CEREG: Registration information for EPS networks (EPS is a concept introduced by the 3GPP standards committee in 4G mobile communications). It can be simply understood as the command query performed by the 4G network when using the CAT1 or NB module to query the network registration status, depending on whether the actual module is a 4G network or a 2G network.

[0074] like Figure 1 The diagram shown is a schematic representation of an implementation environment provided by an embodiment of the present invention. (Refer to...) Figure 1 The implementation environment includes at least a first module and a second module. It should be noted that the first module and the second module in this embodiment are not specifically limited to any particular module; for example, such as... Figure 1 As shown, the first module can be an MCU (microcontroller), and the second module can be a module chip; specifically, the MCU and the module communicate and interact via RPC binary data based on a serial port (UART).

[0075] For example, based on Figure 1 The implementation environment shown in the invention provides a module communication method, referring to... Figure 2 , Figure 2 A flowchart illustrating a module communication method applied to a server, provided in an embodiment of the present invention. (Refer to...) Figure 2 The method includes the following steps:

[0076] S100, Obtain the call instruction of the first module to the target function;

[0077] For example, in some specific embodiments, the present invention encapsulates module functions and uses the module functions through function calls.

[0078] S200: Serialize the call instruction to obtain binary encoded data;

[0079] It should be noted that in some embodiments, step S200 is executed by the first module. Step S200 may include: determining the AT instruction corresponding to the target function according to the calling instruction; serializing the function ID and function type of the binary data format corresponding to the AT instruction through a preset function mapping table; and organizing the binary encoded data based on the function ID and function type.

[0080] For example, in some specific embodiments, functions and parameters are serialized into binary encoded data. Specifically, the present invention uses the RPC concept to encapsulate binary data. In order to be compatible with the operation mode of AT commands, the present invention designs a set of binary instruction tables to define the functions and operation mode of the module.

[0081] The following table lists common 3GPP AT commands and serial port RPC function mappings, as shown in Table 1:

[0082] Table 1

[0083] 01 AT 02 ATI 03 ATE 04 AT+CGSN 05 AT+CIMI 06 AT+CSQ 07 AT+CEREG 08 AT+CGATT 09 AT+CFUN

[0084] The following is a description of the binary data format, where [] indicates optional parameters. For example, the binary data format of an RPC function request is: Function ID (1 Byte) + Function Type (1 Byte) [+ Parameter List (n Bytes)].

[0085] S300 performs serial port protocol encoding on the binary encoded data to obtain serial port encoded data; and sends the serial port encoded data to the second module.

[0086] For example, in some specific embodiments, step S300 is performed by the first module, wherein serialization / deserialization: serializing the function and parameters into binary encoded data / deserializing the binary encoded data into a list of functions and parameters.

[0087] S400: Decode the serial port encoded data using the serial port protocol to obtain binary encoded data;

[0088] For example, in some specific embodiments, step S400 is performed by the second module, wherein serialization / deserialization: serializing the function and parameters into binary encoded data / deserializing the binary encoded data into a list of functions and parameters.

[0089] S500: Deserialize the binary encoded data and parse it to obtain the execution instructions for the target function;

[0090] In some embodiments, the second module executes step S500 to deserialize the binary encoded data and obtain the calling instruction of the target function. This may include: obtaining the function ID and function type in binary data format from the binary encoded data; deserializing the function ID and the AT instruction corresponding to the function type through a preset function mapping table; and using the AT instruction as the execution object of the target function to trigger the execution instruction.

[0091] For example, in some specific embodiments, the synchronous response of an RPC function returns a response result and data (if present). The following is a description of the binary data format, where [] indicates optional parameters. For example, the binary data format of the synchronous response data of an RPC function is: Function ID (1 Byte) + Response Result (1 Byte) [+ Data (nBytes)].

[0092] S600: Based on the execution instruction, execute the AT instruction corresponding to the target function;

[0093] In some embodiments, step S600 is performed by the second module.

[0094] S700, based on the result of the AT command execution, obtains the execution result of the second module returning to the first module.

[0095] It should be noted that in some embodiments, before obtaining the execution result returned by the second module to the first module, the method may further include: serializing the execution result using the second module based on a preset response result mapping table to obtain first encoded data; and performing serial port protocol encoding on the first encoded data to obtain second encoded data. The serialization based on the response result mapping table is similar in principle to the serialization using the function mapping table mentioned earlier, and will not be elaborated further. The first encoded data is also in binary format.

[0096] In some embodiments, obtaining the execution result returned by the second module to the first module may include: decoding the second encoded data using a serial port protocol through the first module to obtain the first encoded data; deserializing the first encoded data based on the response result mapping table, and parsing to obtain the execution result. The deserialization based on the response result mapping table is similar in principle to the deserialization using the function mapping table described earlier, and will not be elaborated further.

[0097] It should be noted that in some embodiments, before obtaining the execution result returned by the second module to the first module, the method further includes: executing an event notification function through the second module; serializing the event notification function based on a preset function mapping table to obtain third encoded data; encoding the third encoded data using a serial port protocol to obtain fourth encoded data; and sending the fourth encoded data to the first module so that the first module executes a callback function based on the fourth encoded data. The first module obtains the returned execution result from the second module through the callback function. The serialization of the event notification function based on the preset function mapping table is similar to the previous principle of serializing the call instruction using a function mapping table, and will not be elaborated further. The third encoded data is also in binary format.

[0098] For example, in some specific embodiments, the event notification returns an event ID and data (if present), and the following is a description of the binary data format, where [] indicates optional parameters. The binary data format of the event notification data is: event ID (1 Byte) [+ event data (n Bytes)].

[0099] To explain in detail the principle of the technical solution of the present invention, the overall process of the present invention will be described below with reference to some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and should not be regarded as a limitation of the present invention.

[0100] First, it should be noted that, as Figure 3 and Figure 4 As shown, existing module communication uses a UART interface or a USB interface for management and communication, with the UART interface using AT commands (data format is string format).

[0101] UART: Used for module parameter configuration and low-speed data communication, using AT commands to transmit string data.

[0102] USB: Transmits binary data via a dial-up protocol.

[0103] MCU side: It integrates an AT client, which encapsulates and parses the module configuration and communication commands into AT format and response data.

[0104] Module side: Integrates AT server, used to parse commands and encapsulate response data, as well as execute event notifications.

[0105] The existing modules are configured and managed using AT commands. As shown in Tables 2 and 3 below, AT commands use string format to define data and define the basic methods and parameter formats for data operations.

[0106] Table 2

[0107]

[0108]

[0109] Table 3

[0110]

[0111] Existing modules use AT commands for configuration and management. AT commands employ a request-response model for configuring the module and sending data, and a notification method for indicating module events. For example... Figure 5 The diagram shows the AT command interaction between the MCU and the module, as well as the business process for module event notification.

[0112] Based on the problems of existing technologies, this invention improves the AT command protocol used by the UART serial port by using a binary data format and encapsulating the interaction method using the RPC protocol. For example... Figure 1 and Figure 6 As shown.

[0113] MCU side: It integrates an RPC client, which encapsulates and parses response data for module configuration and communication commands.

[0114] Module side: Integrates an RPC server for parsing commands, encapsulating response data, and executing event notifications.

[0115] Specifically, RPC protocol design - architecture:

[0116] This invention utilizes an RPC encapsulation module to convert AT command requests and responses into function calls and responses. Furthermore, it uses binary data encoding, resulting in higher data payload and transmission efficiency compared to the strings used in AT commands. Figure 7 It is a design diagram of the module and MCU-side RPC structure.

[0117] The RPC architecture design mainly consists of interface functions, serialization / deserialization, serial data encoding / decoding, and serial device transceiver units. Specifically:

[0118] Interface functions: These encapsulate the functionality of the module, allowing users to access its features through function calls.

[0119] Serialization / Deserialization: Serializes functions and parameters into binary encoded data / Deserializes binary encoded data into functions and parameter lists.

[0120] Serial port encoding / decoding: Encoding serialized data according to the serial port protocol, or decoding encoded data received from the serial port.

[0121] UART serial port device: used for sending and receiving serial encoded data.

[0122] Specifically, RPC protocol design - binary data format:

[0123] This invention uses the RPC concept to encapsulate binary data. To ensure compatibility with AT command operation, a binary instruction table is designed to define the module's functions and operation methods. The following is a description of the binary data format, where [] indicates optional parameters.

[0124] The binary data format for an RPC function request is: Function ID (1 Byte) + Function Type (1 Byte) [+ Parameter List (n Bytes)];

[0125] The binary data format of RPC function synchronous response data is: function ID (1 Byte) + response result (1 Byte) [+ data (n Bytes)];

[0126] The binary data format of the event notification data is: event ID (1 Byte) [+ event data (n Bytes)].

[0127] RPC function requests, using AT+CEREG as an example, are illustrated in Table 4 below:

[0128] Table 4

[0129]

[0130] RPC functions provide synchronous responses, returning the response result and data (if any). The following example uses AT+CEREG? as an illustration, as shown in Table 5:

[0131] Table 5

[0132]

[0133] Event notifications will return the event ID and data (if any), as shown in +CEREG below: For example, see Table 6 below:

[0134] Table 6

[0135]

[0136]

[0137] RPC Protocol Design - Function Mapping Table and Event Notification Table:

[0138] The following table lists common 3GPP AT commands and serial port RPC function mappings, as shown in Table 1 above; the following table lists common 3GPP event notifications and serial port RPC event function mappings, as shown in Table 7 below:

[0139] Table 7

[0140] 01 +CEREG: 02 +CGATT: 03 +CSCON:

[0141] RPC Protocol Design - Serial Port Encoding / Decoding Format Design:

[0142] The UART serial port is used for sending and receiving RPC data. To ensure the stability of data transmission, an encoding rule needs to be designed.

[0143] The following is the binary format of serial port data:

[0144] Message identifier (1 Byte) + data length (2 Bytes) + RPC data (n Bytes) + CRC16 (2 Bytes);

[0145] Message Identifier Description:

[0146] The lower 6 bits represent the message ID;

[0147] The highest two bits identify the message type (00: request message, 01: synchronous response message, 10: event notification, 11: reserved);

[0148] like Figure 8 As shown, serial port data transmission uses a streaming method. In order to deal with the problem of packet fragmentation, after sending one packet of data, the serial port must wait at least 1ms before sending the next packet of data.

[0149] RPC protocol interaction:

[0150] like Figure 9 As shown, the RPC protocol also uses the request-response pattern and the event notification pattern. Based on the previous design, through... Figure 9 The flowchart shown illustrates how RPC invokes module functions and how the module returns event notifications.

[0151] In summary, this embodiment of the invention integrates the deployment of a serial port RPC server within the module, completes function instantiation, and then exports a list of RPC service functions. Based on the exported RPC service list, a corresponding RPC client is generated and integrated into the terminal side. This completes the full deployment of RPC. This embodiment of the invention, through serialized binary data design and serial port encoding / decoding design, can improve data communication efficiency, increase communication speed, and enhance communication stability.

[0152] On the other hand, such as Figure 10 As shown, this embodiment of the invention provides a module communication device 1000, including: a first module 1010 for acquiring a call instruction from a first module to a target function; a second module 1020 for serializing the call instruction to obtain binary encoded data; a third module 1030 for encoding the binary encoded data using a serial port protocol to obtain serial port encoded data, and sending the serial port encoded data to a second module; a fourth module 1040 for decoding the serial port encoded data using a serial port protocol to obtain binary encoded data; a fifth module 1050 for deserializing the binary encoded data and parsing it to obtain an execution instruction for executing the target function; a sixth module 1060 for executing the AT instruction corresponding to the target function based on the execution instruction; and a seventh module 1070 for obtaining the execution result returned from the second module to the first module based on the result of the AT instruction execution.

[0153] In some embodiments, before the step of obtaining the execution result returned by the second module to the first module in the seventh module, the device further includes: an eighth module, used to serialize the execution result by the second module based on a preset response result mapping table to obtain first encoded data; and a ninth module, used to perform serial port protocol encoding on the first encoded data to obtain second encoded data.

[0154] In some embodiments, before the step of obtaining the execution result returned by the second module to the first module in the seventh module, the device further includes: a tenth module, used to execute an event notification function through the second module; an eleventh module, used to serialize the event notification function based on a preset function mapping table to obtain third encoded data; a twelfth module, used to perform serial port protocol encoding on the third encoded data to obtain fourth encoded data; and a thirteenth module, used to send the fourth encoded data to the first module so that the first module executes a callback function according to the fourth encoded data; wherein the first module obtains the returned execution result from the second module through the callback function.

[0155] The content of the method embodiments of the present invention is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0156] On the other hand, such as Figure 11 As shown, this embodiment of the invention also provides an electronic device 1100, which includes at least one processor 1110 and at least one memory 1120 for storing at least one program; taking a processor 1110 and a memory 1120 as an example.

[0157] The processor 1110 and the memory 1120 can be connected via a bus or other means.

[0158] Memory 1120, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory 1120 may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 1120 may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0159] The electronic device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0160] Another aspect of this invention provides a computer-readable storage medium storing a program that is executed by a processor to implement the aforementioned method.

[0161] The content of the method embodiments of the present invention is applicable to the computer-readable storage medium embodiments. The specific functions implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.

[0162] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.

[0163] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0164] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0165] It should be noted that although several modules for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0166] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of the present invention.

[0167] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.

[0168] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.

[0169] If a function is implemented as 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 this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0170] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution means, apparatus, or device (such as a computer-based device, a processor-including device, or other means that can fetch and execute instructions from, or in conjunction with, an instruction execution means, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution means, apparatus, or device.

[0171] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0172] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0173] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0174] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

[0175] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.

Claims

1. A module communication method, characterized in that, The method includes: Obtain the call instructions from the first module to the target function; The calling instruction is serialized to obtain binary encoded data; The binary encoded data is encoded using a serial port protocol to obtain serial port encoded data; and the serial port encoded data is sent to the second module. The serial port encoded data is decoded using the serial port protocol to obtain the binary encoded data; The binary encoded data is deserialized and parsed to obtain the execution instructions for executing the target function; Based on the execution instruction, execute the AT instruction corresponding to the target function; Based on the result of the AT command execution, the execution result returned by the second module to the first module is obtained; Before the step of obtaining the execution result returned by the second module to the first module, the method further includes: The event notification function is executed through the second module; The event notification function is serialized based on a preset function mapping table to obtain third encoded data; The third encoded data is encoded using a serial port protocol to obtain the fourth encoded data; The fourth encoded data is sent to the first module so that the first module executes a callback function based on the fourth encoded data; The first module obtains the execution result returned by the second module through the callback function.

2. The module communication method according to claim 1, characterized in that, The step of serializing the calling instruction to obtain binary encoded data includes: The AT instruction corresponding to the target function is determined based on the calling instruction; The function ID and function type in binary data format corresponding to the AT command are obtained by serialization using a preset function mapping table; The binary encoded data is obtained by organizing the data based on the function ID and the function type.

3. The module communication method according to claim 1, characterized in that, The step of deserializing the binary encoded data to obtain the calling instruction of the target function includes: Extract the function ID and function type in binary data format from the binary encoded data; The function ID and the AT command corresponding to the function type are obtained by deserializing the preset function mapping table; The AT command is used as the execution target of the target function, and the execution command is triggered.

4. The module communication method according to claim 1, characterized in that, Before the step of obtaining the execution result returned by the second module to the first module, the method further includes: The second module serializes the execution result based on a preset response result mapping table to obtain the first encoded data; The first encoded data is encoded using a serial port protocol to obtain the second encoded data.

5. The module communication method according to claim 4, characterized in that, The step of obtaining the execution result returned by the second module to the first module includes: The first module decodes the second encoded data using a serial port protocol to obtain the first encoded data. The first encoded data is deserialized based on the response result mapping table, and the execution result is obtained by parsing.

6. A module communication device, characterized in that, The apparatus, applied to the method of claim 1, comprises: The first module is used to obtain the call instructions of the first module to the target function; The second module is used to serialize the calling instruction to obtain binary encoded data; The third module is used to perform serial port protocol encoding on the binary encoded data to obtain serial port encoded data; and to send the serial port encoded data to the second module. The fourth module is used to decode the serial port encoded data using the serial port protocol to obtain the binary encoded data; The fifth module is used to deserialize the binary encoded data and parse it to obtain the execution instructions for executing the target function; The sixth module is used to execute the AT instructions corresponding to the target function based on the execution instructions; The seventh module is used to obtain the execution result returned by the second module to the first module based on the result of the execution of the AT command.

7. The module communication device according to claim 6, characterized in that, The device further includes: The eighth module is used to serialize the execution result based on a preset response result mapping table by the second module to obtain the first encoded data; The ninth module is used to perform serial port protocol encoding on the first encoded data to obtain the second encoded data.

8. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 5.

9. A computer storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to implement the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Serial port communication method between mobile terminal processor

    CN101179790A

  • Method and apparatus for implementing conversion of AT command and business message

    CN101378548A