Instruction parsing method, device, storage medium and program product

By receiving the AT instructions to be parsed in the communication module of the Internet of Things terminal, using the fuzzy matching of the instruction name list and the instruction format list, the target instruction format is identified and parsed, the problem of conflict between the AT instruction format and the protocol data format is solved, and the analysis efficiency and accuracy are improved.

CN119759422APending Publication Date: 2025-04-04LINKZHILIAN (CHONGQING) TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411710113.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

When handling MQTT and HTTP protocols in IoT terminals, the commonly used AT instruction formats conflict with the data formats of these protocols, resulting in complex data conversion and high resource consumption. Especially on MCUs with limited FLASH memory, the transmissive mode is not supported, resulting in low parsing efficiency and accuracy.

Method used

By receiving the AT instructions to be parsed in the communication module of the Internet of Things terminal, the target instruction format is identified by fuzzy matching of the instruction name list and the instruction format list, and thus the analysis is performed. The method includes obtaining a target instruction name whose fuzzy match with the AT instruction name to be parsed is greater than the first threshold, and parsing the AT instruction to be parsed based on the target instruction format.

Benefits of technology

The parsing efficiency and accuracy of AT instructions are improved, and the parameters that can be parsed in the AT instructions to be parsed can be identified. Compared with the complex AT instructions that cannot be parsed in related technologies, the direct error situation is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759422A_ABST
    Figure CN119759422A_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of Internet of Things technology, and in particular, provides an instruction parsing method, device, storage medium and program product. The method includes receiving an AT instruction to be parsed from a processor in an Internet of Things terminal through a communication module of the Internet of Things terminal; obtaining a target instruction name whose fuzzy matching degree with the instruction name of the AT instruction to be parsed is greater than a first threshold from an instruction name list; obtaining a target instruction format of an AT instruction whose instruction name is the target instruction name from an instruction format list, and the instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters; parsing the AT instruction to be parsed based on the target instruction format. The present solution can quickly identify the parameters that can be identified in the AT instruction to be parsed. Compared with the AT instruction in the related art that has both complex json format and AT instruction format, and directly reports an error if any parameter of the AT instruction cannot be parsed, the recognition efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of Internet of Things, and in particular to an instruction parsing method, device, storage medium and program product. Background Art

[0002] With the rapid development of IoT applications, IoT terminals have been popularized in various industries. The communication module is an integrated circuit module that provides wireless communication capabilities for IoT terminals. Its main function is to implement the functions of wireless communication protocols. With the richness and rapid increase of IoT terminal products, communication modules often come with communication functions including MQTT, HTTP, CoAP, LWM2M and other network protocols.

[0003] Currently, communication module manufacturers mainly implement data communication by sending AT commands between MCU and communication module. For data formats such as json format, which are often used in MQTT and HTTP protocols and conflict with AT command formats, they are generally processed by converting them into hexadecimal data or into transparent transmission mode. On the other hand, due to the limited FLASH memory of some MCUs, the hexadecimal and transparent transmission modes are inconvenient to use, which also brings additional resource consumption. Many low-end modules do not support transparent transmission mode. Summary of the invention

[0004] The present disclosure is proposed in view of the above problems. The present disclosure provides an instruction parsing method, device, storage medium and program product.

[0005] According to a first aspect of the present disclosure, there is provided an instruction parsing method, comprising:

[0006] Receive the AT command to be parsed from the processor in the IoT terminal through the communication module of the IoT terminal;

[0007] Acquire a target instruction name from the instruction name list, the fuzzy matching degree of which with the instruction name of the AT instruction to be parsed is greater than a first threshold;

[0008] Obtaining, from the instruction format list, a target instruction format of an AT instruction whose instruction name is the target instruction name, wherein the instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters;

[0009] The AT command to be parsed is parsed based on the target command format.

[0010] In addition, according to the instruction parsing method of the first aspect of the present disclosure, parsing the AT instruction to be parsed based on the target instruction format includes:

[0011] In the case where the target instruction format includes multiple formats, obtaining a preferred format whose fuzzy matching degree with the format of the AT instruction to be parsed is greater than a second threshold from the multiple formats;

[0012] Based on the preferred format, determining the position of the target parameter that can be parsed in the AT command to be parsed;

[0013] Based on the position of the target parameter, the target parameter is parsed.

[0014] In addition, according to the instruction parsing method of the first aspect of the present disclosure, before obtaining a target instruction name having a fuzzy matching degree greater than a first threshold with the instruction name of the AT instruction to be parsed from the instruction name list, it also includes:

[0015] Acquire a plurality of pre-configured AT standard commands, wherein the plurality of AT standard commands include command names of all AT commands that may be involved in the communication process between the communication module and the processor;

[0016] Based on the edit distance principle, simplify the instruction names of the standard AT instructions whose instruction names are longer than a length threshold among the multiple AT standard instructions to obtain simplified instruction names;

[0017] The command name list is generated based on the simplified command name and the command names of standard AT commands whose command names are less than or equal to the length threshold among the plurality of AT standard commands.

[0018] In addition, according to the instruction parsing method of the first aspect of the present disclosure, before obtaining the target instruction format of the AT instruction with the instruction name of the target instruction name from the instruction format list, it also includes:

[0019] Identifying the instruction formats of the plurality of AT standard instructions;

[0020] The instruction format list is generated based on the instruction format.

[0021] In addition, according to the instruction parsing method of the first aspect of the present disclosure, generating the instruction format list based on the instruction format includes:

[0022] Based on the instruction format, obtaining a first type of standard instruction in which the number of parameters in the plurality of AT standard instructions is less than a number threshold and a second type of standard instruction in which the number of parameters is greater than or equal to the number threshold;

[0023] Based on the instruction format, obtaining, from the second category of standard instructions, a first subcategory standard instruction with a fixed number of parameters and a second subcategory standard instruction with a variable number of parameters;

[0024] generating a first sub-list based on the first category standard instructions, generating a second sub-list based on the first sub-category standard instructions, and generating a third sub-list based on the second sub-category standard instructions;

[0025] The instruction format list is generated based on the first sub-list, the second sub-list, and the third sub-list.

[0026] In addition, according to the instruction parsing method of the first aspect of the present disclosure, obtaining the target instruction format of the AT instruction whose instruction name is the target instruction name from the instruction format list includes:

[0027] The first sub-list, the second sub-list and the third sub-list are traversed to obtain the target instruction format.

[0028] According to a second aspect of the present disclosure, there is provided an instruction parsing device, the device comprising:

[0029] A receiving module, used for receiving an AT command to be parsed from a processor in the IoT terminal through a communication module of the IoT terminal;

[0030] A first acquisition module is used to acquire, from the instruction name list, a target instruction name whose fuzzy matching degree with the instruction name of the AT instruction to be parsed is greater than a first threshold;

[0031] A second acquisition module is used to acquire a target instruction format of an AT instruction whose instruction name is the target instruction name from the instruction format list, wherein the instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters;

[0032] The parsing module is used to parse the AT instruction to be parsed based on the target instruction format.

[0033] According to a third aspect of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in the first aspect.

[0034] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program / instruction is stored, and when the computer program / instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0035] According to a fourth aspect of the present disclosure, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the method described in the first aspect when executed by a processor.

[0036] As will be described in detail below, according to the instruction parsing method of the embodiment of the present disclosure, the target instruction format of the AT instruction to be parsed is identified by matching the instruction name list and the instruction format list, so that the AT instruction to be parsed is parsed based on the target instruction format. Since the target instruction format indicates the number of parameters included in the AT instruction to be parsed and the complexity of the parameters, when the AT instruction to be parsed is parsed based on the target instruction format, it is possible to identify which parameters are simple and can be parsed based on the target instruction format, so that the parameters that can be identified in the AT instruction to be parsed can be quickly identified. Compared with the related art, for AT instructions that have both complex json format and AT instruction format, any parameter of the AT instruction cannot be parsed at all, and an error is directly reported, the recognition efficiency and accuracy are improved.

[0037] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0039] Figure 1 is a flowchart illustrating an instruction parsing method according to an embodiment of the present disclosure.

[0040] Figure 2 FIG. 4 is a diagram illustrating an overall system architecture of an embodiment of the present disclosure.

[0041] Figure 3 is a flowchart illustrating an instruction parsing method according to an embodiment of the present disclosure.

[0042] Figure 4 is a flowchart illustrating an instruction parsing method according to an embodiment of the present disclosure.

[0043] Figure 5 2 is a structural diagram illustrating an instruction parsing device according to an embodiment of the present disclosure.

[0044] Figure 6 is a hardware block diagram illustrating an electronic device according to an embodiment of the present disclosure.

[0045] Figure 7 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0047] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0048] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.

[0049] In the related technology, each communication module manufacturer mainly realizes data communication by sending AT commands between MCU and communication module. For data formats such as json format, which are often used in MQTT and HTTP protocols and conflict with AT command formats, they are generally processed by converting them into hexadecimal data or into transparent transmission mode. On the other hand, due to the limited FLASH memory of some MCUs, both hexadecimal and transparent transmission modes are inconvenient to use, which also brings additional resource consumption. Many low-end modules do not support transparent transmission mode.

[0050] In order to alleviate the technical problems existing in the related art, the embodiments of the present disclosure provide an instruction parsing method, device, equipment, storage medium and computer program product. The method identifies the target instruction format of the AT instruction to be parsed by matching the instruction name list and the instruction format list, thereby parsing the AT instruction to be parsed based on the target instruction format. Since the target instruction format indicates the number of parameters included in the AT instruction to be parsed and the complexity of the parameters, when the AT instruction to be parsed is parsed based on the target instruction format, it is possible to identify which parameters are simple and can be parsed based on the target instruction format, so that the parameters that can be identified in the AT instruction to be parsed can be quickly identified. Compared with the related art, for AT instructions that have both complex json format and AT instruction format, any parameter of the AT instruction cannot be parsed at all, and an error is directly reported, which improves the recognition efficiency and accuracy.

[0051] To facilitate understanding of this embodiment, a method for parsing instructions disclosed in an embodiment of the present disclosure is first introduced in detail. The execution subject of the method for parsing instructions provided in the embodiment of the present disclosure is generally an electronic device with certain computing capabilities, and the electronic device includes, for example, a terminal device or a server or other processing device. In some possible implementations, the method for parsing instructions can be implemented by a processor calling a computer-readable instruction stored in a memory.

[0052] See also Figure 1 FIG. 1 is a flowchart of an instruction parsing method provided by an embodiment of the present disclosure, and the method comprises the following steps:

[0053] Step 101: Receive an AT command to be parsed from a processor in the IoT terminal through a communication module of the IoT terminal.

[0054] Step 102: Obtain, from the command name list, a target command name whose fuzzy matching degree with the command name of the AT command to be parsed is greater than a first threshold.

[0055] It should be understood that the format of AT commands usually consists of three parts: prefix, body and terminator. The prefix is ​​composed of the character "AT", the body is composed of the command name, parameters and possible data, the parameters are separated by commas "", ", the string is represented by double quotes "", and the terminator is generally "\r\n". Therefore, parameters with commas and double quotes in json format cannot be parsed normally.

[0056] Fuzzy matching is a data matching technique that compares two or more records and calculates the likelihood that they belong to the same entity. Instead of roughly classifying records as matches and mismatches, fuzzy matching outputs a number that identifies the likelihood that these records belong to an entity. However, the fuzzy matching algorithm is based on the edit distance algorithm, and common algorithms cannot match strings that are too complex and close.

[0057] In this embodiment, the first threshold value may be preset manually based on experience or according to actual needs, for example, the first threshold value is set to 0.8.

[0058] In some embodiments, before obtaining from the command name list a target command name whose fuzzy matching degree with the command name of the AT command to be parsed is greater than a first threshold, the method may further include the following steps:

[0059] Acquire multiple pre-configured AT standard commands, where the multiple AT standard commands include command names of all AT commands that may be involved in the communication process between the communication module and the processor;

[0060] Based on the edit distance principle, the command names of the standard AT commands whose command names are longer than a length threshold in the plurality of AT standard commands are simplified to obtain simplified command names;

[0061] A command name list is generated based on the simplified command name and the command names of standard AT commands whose command names are less than or equal to a length threshold among the plurality of AT standard commands.

[0062] In this embodiment, the length threshold may be set manually based on experience or according to actual needs, and this embodiment does not specifically limit this.

[0063] In this embodiment, the simplification of the command names follows the edit distance principle. After simplifying the command names of some relatively long AT commands, a command name list can be obtained.

[0064] Step 103: Obtain a target instruction format of an AT instruction whose instruction name is the target instruction name from the instruction format list. The instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters.

[0065] In some embodiments, before obtaining the target instruction format of the AT instruction with the instruction name of the target instruction name from the instruction format list, the method may further include:

[0066] Identifying the instruction formats of the plurality of AT standard instructions;

[0067] The instruction format list is generated based on the instruction format.

[0068] It should be understood here that a standard AT instruction may be identified in multiple instruction formats, and different types of instruction formats represent different numbers of parameters. Of course, a standard AT instruction may also be identified in only one instruction format. When the complexity of the parameters in the standard AT instruction is not high and the standard AT instruction is relatively simple, the instruction format of the standard AT instruction identified is usually one. When the complexity of the parameters in the standard AT instruction is relatively high, the instruction formats of the standard AT instruction identified are usually multiple.

[0069] In some embodiments, based on the recognized instruction format of the AT standard instruction, the instruction format list can be divided into three sub-lists, namely, a first sub-list, a second sub-list, and a third sub-list. In specific implementation, the instruction format list can be generated by the following steps:

[0070] Based on the instruction format, obtaining a first type of standard instruction whose number of parameters in a plurality of AT standard instructions is less than a number threshold and a second type of standard instruction whose number of parameters is greater than or equal to the number threshold;

[0071] Based on the instruction format, from the second category of standard instructions, a first subcategory standard instruction with a fixed number of parameters and a second subcategory standard instruction with a variable number of parameters are obtained;

[0072] generating a first sub-list based on the first category of standard instructions, generating a second sub-list based on the first sub-category of standard instructions, and generating a third sub-list based on the second sub-category of standard instructions;

[0073] An instruction format list is generated based on the first sub-list, the second sub-list, and the third sub-list.

[0074] In the application, the number threshold may be manually set based on experience or according to actual needs, and this embodiment does not specifically limit this.

[0075] It should be understood that when the number of parameters is fixed, the instruction format of the AT standard command that is usually recognized is one, and when the number of parameters is variable, the instruction format of the AT standard command that is usually recognized is multiple.

[0076] Accordingly, obtaining the target instruction format of the AT instruction whose instruction name is the target instruction name from the instruction format list may include the following steps:

[0077] The first sub-list, the second sub-list and the third sub-list are traversed to obtain the target instruction format.

[0078] Step 104: Parse the AT command to be parsed based on the target command format.

[0079] In some optional embodiments, parsing the AT command to be parsed based on the target command format may include the following steps:

[0080] In the case where the target instruction format includes multiple formats, obtaining a preferred format whose fuzzy matching degree with the format of the AT instruction to be parsed is greater than a second threshold from the multiple formats;

[0081] Based on the preferred format, determine the position of the target parameter that can be parsed in the AT command to be parsed;

[0082] Based on the position of the target parameter, resolve the target parameter.

[0083] It should be understood that, in the case where the target instruction format includes one format, the target instruction format is directly used as the preferred format.

[0084] In this embodiment, the second threshold value may be artificially set in advance based on experience or according to actual needs, and this embodiment does not specifically limit this.

[0085] It should be understood that the preferred format indicates the number of parameters included in the AT command to be parsed and the complexity of the parameters. For example, the preferred format indicates that the AT command to be parsed includes four parameters, and the complexity of the second parameter and the fourth parameter is relatively high, so the second parameter and the fourth parameter are parameters that may not be parsed, while the first parameter and the third parameter are relatively simple, so the first parameter and the third parameter are parameters that can be parsed. In this way, the first parameter and the third parameter can be determined as target parameters, and the first parameter and the third parameter are parsed.

[0086] In the solution provided by this embodiment, the target instruction format of the AT instruction to be parsed is identified by matching the instruction name list and the instruction format list, so that the AT instruction to be parsed is parsed based on the target instruction format. Since the target instruction format indicates the number of parameters included in the AT instruction to be parsed and the complexity of the parameters, when the AT instruction to be parsed is parsed based on the target instruction format, it is possible to identify which parameters are simple and can be parsed based on the target instruction format, so that the parameters that can be identified in the AT instruction to be parsed can be quickly identified. Compared with the related art, for AT instructions that have both complex json format and AT instruction format, any parameter of the AT instruction cannot be parsed at all, and an error is directly reported, the recognition efficiency and accuracy are improved.

[0087] See also Figure 2 , Figure 2 This is a diagram of the overall system architecture provided by the embodiment of this application. Figure 2As shown in the figure, the overall system architecture diagram includes MCU and communication module. MCU and module communicate with AT commands through UART or USB. The module mainly includes AT command fuzzy processing module, AT command parsing module and various application layer modules. The AT command sent by MCU is first matched by AT command fuzzy processing module, and then the AT command parameters are fuzzy processed based on keyword optimization after matching. The module processed by AT command fuzzy processing module further enters AT command parsing module and is distributed to various application layer modules through AT command parsing module.

[0088] The format of AT command usually consists of three parts: prefix, body and terminator. The prefix is ​​composed of the character "AT", the body is composed of the command name, parameters and possible data, the parameters are separated by commas, the string is represented by double quotes, and the terminator is generally "\r\n". Therefore, parameters with commas and double quotes in json format cannot be parsed normally.

[0089] Fuzzy matching is a data matching technique that compares two or more records and calculates the likelihood that they belong to the same entity. Instead of roughly classifying records as matches and mismatches, fuzzy matching outputs a number that identifies the likelihood that these records belong to an entity. However, the fuzzy matching algorithm is based on the edit distance algorithm, and common algorithms cannot match strings that are too complex and close.

[0090] The technical solution of the present application is to parse the AT instructions sent by the MCU to the communication module through the architecture, identify the instruction name using fuzzy matching, and extract the parameters by performing fuzzy matching based on keyword optimization for the expected instruction parameters.

[0091] All AT commands of the communication module are simplified and preprocessed. The simplified processing follows the edit distance principle and simplifies some longer AT command names to obtain the simplified AT command name list TABLE1;

[0092] Preprocess the AT command parameters that allow special formats to obtain the appropriate string AT parameter list TABLE2;

[0093] Furthermore, it is allowed that the AT parameter list TABLE2 contains only one parameter string, which is the most common usage;

[0094] Furthermore, a unified parameter list management is performed for all AT commands, and AT commands with a number of parameters less than or equal to X are matched in a unified AT parameter list set, and AT commands with a number of parameters greater than X are allowed to have independent AT parameter lists;

[0095] Furthermore, for AT commands containing variable parameters, the variable parameters need to be enumerated in detail, and each format needs to be enumerated as a matching expectation.

[0096] MCU sends AT command 1 to the communication module and enters Figure 3 Process; In particular, the AT command can contain complex format data AT parameters and simplified AT command names. An implementation example of using the AT+MIPSENDDATA command to send data is as follows:

[0097] AT+MPSD="{"psm":1,"at":"AT+MTEST=1,"321,80",5"}",10,"{"name":"JohnDoe","age":1 8,"address":{"country":"china","zip-code":"10000"}}","{"a":1,"b":[1,2,3]}"\r\n

[0098] Furthermore, the punctuation format in the AT command can also be input as an incorrect format with little difference, and the command name can also be input as an incorrect AT command name with little difference.

[0099] After receiving AT command 1, the communication module performs fuzzy matching with the module's built-in AT list TABLE1 through the interface function ATCmdFuzzyMatching (char*cmd, char*table); in particular, the AT commands in TABLE1 are also simplified;

[0100] Fuzzy match the instruction COMMAND1 whose result value is closest to 1 in the AT list TABLE1, and check whether its result value is greater than the expected value. In particular, the result value is a number between 0 and 1. The closer it is to 1, the higher the similarity. The expected value is a value close to 1, which is used to filter out results with too large a difference. A typical implementation use case sets this value to 0.8.

[0101] Check whether fuzzy matching is allowed in each parameter of COMMAND1. Generally, only string parameters with expected special formats are allowed to perform fuzzy matching on command parameters.

[0102] If COMMAND1 detects that parameter fuzzy matching is allowed, it will perform fuzzy matching with the preset parameter string list TABLE2 of the command through the interface function ATParaFuzzyMatching (char*cmd, char*table);

[0103] Furthermore, the AT commands that allow fuzzy matching of parameters have complex and variable parameters. An implementation example is as follows, which are all allowed parameter formats:

[0104] AT+MIPSEND="{}",,"{}","{}"\r\n'

[0105] AT+MIPSEND="{}",,"{}","{}",\r\n

[0106] AT+MIPSEND="{}",,"{}","{}",,\r\n

[0107] AT+MIPSEND="{}",,"{}","{}",,,\r\n

[0108] Fuzzy match the format patternX whose result value is closest to 1 in the instruction parameter string list TABLE2, and check whether its result value is greater than the expected value; in particular, the result value is a number between 0 and 1, and the closer it is to 1, the higher the similarity; the expected value is a value close to 1, which is used to filter out results with too large a difference. A typical implementation use case based on keyword optimization sets this value to 0.6.

[0109] Process the parameters of COMMAND1 according to the format patternX. Figure 3 The process ends;

[0110] Furthermore, keyword optimization is performed on the detected parameters, such as Figure 4 As shown, the steps are as follows:

[0111] Select the required keyword symbols, such as "{};

[0112] Perform keyword filtering on the parameters in COMMAND1 and only retain COMMAND2 containing the keyword;

[0113] Perform fuzzy matching between COMMAND2 and the preset parameter string list TABLE2 of the command through the interface function ATParaFuzzyMatching (char*cmd, char**table);

[0114] Fuzzy match the format patternY that is closest to 1 in the instruction parameter string list TABLE2, and check whether its result value is greater than the expected value;

[0115] Process the parameters of COMMAND1 according to the format patternY.

[0116] The solution of this embodiment has the following advantages:

[0117] An AT architecture based on fuzzy matching, which performs fuzzy matching on AT command names and their parameters respectively;

[0118] The parameters are fuzzy matched based on keyword optimization. The optimized string can make up for the defects of the edit distance algorithm itself and improve the operation speed.

[0119] The matching list of fuzzy matching parameters is optimized by keywords. The optimized matching list can improve the matching accuracy and increase the operation speed.

[0120] Perform fuzzy matching on its parameters, allowing AT commands with complex variable parameter formats to perform fuzzy matching on parameters;

[0121] Perform fuzzy matching on its parameters, allowing parameters to contain characters that conflict with the AT command format;

[0122] Perform fuzzy matching on its parameters, allowing incorrect punctuation formats in AT commands with little difference;

[0123] Perform fuzzy matching on AT command names, allowing MCU to input simplified AT command names to save MCU space;

[0124] Optimize the matching list of fuzzy matching of AT command names. The optimized list must satisfy the edit distance algorithm to adapt to the best matching command. The optimized list can save module FLASH space.

[0125] Perform fuzzy matching on AT command names, allowing AT command names with little difference to be incorrect AT command names.

[0126] The present disclosure also provides an instruction parsing device for executing the instruction parsing method provided in any of the above embodiments. Figure 5 As shown, the device comprises:

[0127] The receiving module 51 is used to receive the AT command to be parsed from the processor in the IoT terminal through the communication module of the IoT terminal;

[0128] A first acquisition module 52 is used to acquire, from the instruction name list, a target instruction name whose fuzzy matching degree with the instruction name of the AT instruction to be parsed is greater than a first threshold;

[0129] A second acquisition module 53 is used to acquire a target instruction format of an AT instruction whose instruction name is the target instruction name from the instruction format list, wherein the instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters;

[0130] The parsing module 54 is used to parse the AT command to be parsed based on the target command format.

[0131] In some embodiments, the parsing module 54 is used to:

[0132] In the case where the target instruction format includes multiple formats, obtaining a preferred format whose fuzzy matching degree with the format of the AT instruction to be parsed is greater than a second threshold from the multiple formats;

[0133] Based on the preferred format, determining the position of the target parameter that can be parsed in the AT command to be parsed;

[0134] Based on the position of the target parameter, the target parameter is parsed.

[0135] In some embodiments, the device is also used to:

[0136] Before obtaining a target instruction name whose fuzzy matching degree with the instruction name of the AT instruction to be parsed is greater than a first threshold from the instruction name list, obtaining a plurality of pre-configured AT standard instructions, wherein the plurality of AT standard instructions include instruction names of all AT instructions that may be involved in the communication process between the communication module and the processor;

[0137] Based on the edit distance principle, simplify the instruction names of the standard AT instructions whose instruction names are longer than a length threshold among the multiple AT standard instructions to obtain simplified instruction names;

[0138] The command name list is generated based on the simplified command name and the command names of standard AT commands whose command names are less than or equal to the length threshold among the plurality of AT standard commands.

[0139] In some embodiments, the device is also used to:

[0140] Before obtaining the target instruction format of the AT instruction with the target instruction name from the instruction format list, identifying the instruction formats of the plurality of AT standard instructions;

[0141] The instruction format list is generated based on the instruction format.

[0142] In some embodiments, the device is used to:

[0143] Based on the instruction format, obtaining a first type of standard instruction in which the number of parameters in the plurality of AT standard instructions is less than a number threshold and a second type of standard instruction in which the number of parameters is greater than or equal to the number threshold;

[0144] Based on the instruction format, obtaining, from the second category of standard instructions, a first subcategory standard instruction with a fixed number of parameters and a second subcategory standard instruction with a variable number of parameters;

[0145] generating a first sub-list based on the first category standard instructions, generating a second sub-list based on the first sub-category standard instructions, and generating a third sub-list based on the second sub-category standard instructions;

[0146] The instruction format list is generated based on the first sub-list, the second sub-list, and the third sub-list.

[0147] In some embodiments, the device is used to:

[0148] The first sub-list, the second sub-list and the third sub-list are traversed to obtain the target instruction format.

[0149] The instruction parsing device provided in the embodiment of the present disclosure and the instruction parsing method provided in the embodiment of the present disclosure are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented therein.

[0150] The present disclosure also provides an electronic device to execute the above instruction parsing method. Figure 6 It shows a schematic diagram of an electronic device provided by some embodiments of the present disclosure. Figure 6 As shown, the electronic device 8 includes: a processor 800, a memory 801, a bus 802 and a communication interface 803, wherein the processor 800, the communication interface 803 and the memory 801 are connected via the bus 802; the memory 801 stores a computer program that can be run on the processor 800, and when the processor 800 runs the computer program, the instruction parsing method provided in any of the aforementioned embodiments of the present disclosure is executed.

[0151] The memory 801 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the device network element and at least one other network element is realized through at least one communication interface 803 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0152] The bus 802 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 801 is used to store programs, and the processor 800 executes the program after receiving an execution instruction. The instruction parsing method disclosed in any implementation of the aforementioned embodiment of the present disclosure may be applied to the processor 800, or implemented by the processor 800.

[0153] The processor 800 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 800 or the instruction in the form of software. The above processor 800 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 801, and the processor 800 reads the information in the memory 801 and completes the steps of the above method in combination with its hardware.

[0154] The electronic device provided by the embodiment of the present disclosure and the instruction parsing method provided by the embodiment of the present disclosure are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by them.

[0155] The present disclosure also provides a computer-readable storage medium corresponding to the instruction parsing method provided in the above embodiment. Figure 7 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the instruction parsing method provided in any of the aforementioned embodiments will be executed.

[0156] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0157] The computer-readable storage medium provided by the above-mentioned embodiments of the present disclosure and the instruction parsing method provided by the embodiments of the present disclosure are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0158] It should be noted that:

[0159] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present disclosure can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail so as not to obscure the understanding of this description.

[0160] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present disclosure, the various features of the present disclosure are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following schematic diagram: the claimed disclosure requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the single embodiment disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present disclosure.

[0161] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of this disclosure and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0162] The above is only a preferred specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A method for parsing instructions, characterized in that: The method comprises: Receive the AT command to be parsed from the processor in the IoT terminal through the communication module of the IoT terminal; Acquire a target instruction name from the instruction name list, the fuzzy matching degree of which with the instruction name of the AT instruction to be parsed is greater than a first threshold; Obtaining, from the instruction format list, a target instruction format of an AT instruction whose instruction name is the target instruction name, wherein the instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters; The AT command to be parsed is parsed based on the target command format.

2. The method according to claim 1, characterized in that Parsing the AT command to be parsed based on the target command format includes: In the case where the target instruction format includes multiple formats, obtaining a preferred format whose fuzzy matching degree with the format of the AT instruction to be parsed is greater than a second threshold from the multiple formats; Based on the preferred format, determining the position of the target parameter that can be parsed in the AT command to be parsed; Based on the position of the target parameter, the target parameter is parsed.

3. The method according to claim 1, characterized in that Before obtaining a target instruction name whose fuzzy matching degree with the instruction name of the AT instruction to be parsed is greater than a first threshold from the instruction name list, the method further includes: Acquire a plurality of pre-configured AT standard commands, wherein the plurality of AT standard commands include command names of all AT commands that may be involved in the communication process between the communication module and the processor; Based on the edit distance principle, simplify the instruction names of the standard AT instructions whose instruction names are longer than a length threshold among the multiple AT standard instructions to obtain simplified instruction names; The command name list is generated based on the simplified command name and the command names of standard AT commands whose command names are less than or equal to the length threshold among the plurality of AT standard commands.

4. The method according to claim 3, characterized in that Before obtaining the target instruction format of the AT instruction with the instruction name of the target instruction name from the instruction format list, the method further includes: Identifying the instruction formats of the plurality of AT standard instructions; The instruction format list is generated based on the instruction format.

5. The method according to claim 4, characterized in that Generating the instruction format list based on the instruction format includes: Based on the instruction format, obtaining a first type of standard instruction in which the number of parameters in the plurality of AT standard instructions is less than a number threshold and a second type of standard instruction in which the number of parameters is greater than or equal to the number threshold; Based on the instruction format, obtaining, from the second category of standard instructions, a first subcategory standard instruction with a fixed number of parameters and a second subcategory standard instruction with a variable number of parameters; generating a first sub-list based on the first category standard instructions, generating a second sub-list based on the first sub-category standard instructions, and generating a third sub-list based on the second sub-category standard instructions; The instruction format list is generated based on the first sub-list, the second sub-list, and the third sub-list.

6. The method according to claim 5, characterized in that From the command format list, a target command format of an AT command whose command name is the target command name is obtained, including: The first sub-list, the second sub-list and the third sub-list are traversed to obtain the target instruction format.

7. A command parsing device, characterized in that: The device comprises: A receiving module, used for receiving an AT command to be parsed from a processor in the IoT terminal through a communication module of the IoT terminal; A first acquisition module is used to acquire, from the instruction name list, a target instruction name whose fuzzy matching degree with the instruction name of the AT instruction to be parsed is greater than a first threshold; A second acquisition module is used to acquire a target instruction format of an AT instruction whose instruction name is the target instruction name from the instruction format list, wherein the instruction format is used to indicate the number of parameters included in the AT instruction of the target instruction name and the complexity of the parameters; The parsing module is used to parse the AT instruction to be parsed based on the target instruction format.

8. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.