Message parsing methods, apparatus, computer-readable media and terminal equipment

CN116455996BActive Publication Date: 2026-09-01CHONGQING CHANGAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310465668.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-26
Publication Date
2026-09-01
Estimated Expiration
2043-04-26

AI Technical Summary

Technical Problem

[0003]本发明的目的之一在于提供一种报文解析方法,以解决现有技术中数据包解析方法存在CPU占用过高、解析时间长、解析效率低的问题;目的之二在于提供一种报文解析装置;目的之三在于提供一种计算机可读介质;目的之四在于提供一种终端设备

Benefits of technology

[0035]1. This application effectively reduces processor usage, shortens message parsing time, and improves parsing efficiency by dividing the data frames of the message to be parsed into layers and parsing the structural information and data content of the data frames in a synchronous and parallel manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116455996B_ABST
    Figure CN116455996B_ABST
Patent Text Reader

Abstract

This invention relates to a message parsing method, apparatus, computer-readable medium, and terminal device, belonging to the field of communication technology. The method includes: acquiring a message to be parsed, the message including a data frame; parsing a first parameter of the data frame to obtain a first parsing result, the first parameter describing the structural information of the data frame; acquiring a second parameter of the payload in the data frame, reading a parameter parsing configuration item matching the second parameter from a specified cache location in a specified cache space, parsing the payload according to the parameter parsing configuration item to obtain a second parsing result, the second parameter describing the structural information of the payload, and the parameter parsing configuration item describing the parsing rule corresponding to the second parameter; and obtaining a target parsing result for the message to be parsed based on the first and second parsing results. This application, by synchronously and parallelly parsing the structural information and data content of the data frame of the message, can effectively reduce processor usage and improve parsing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, specifically to a message parsing method, a message parsing device, a computer-readable medium, and a terminal device. Background Technology

[0002] CANFD is a next-generation CAN bus standard that offers higher speeds and more data. With the increasing number of controllers and sensors in electric intelligent vehicles, the amount of data in CANFD has surged. Traditional CANFD packet parsing algorithms cannot meet the demands of rapidly parsing massive amounts of data. Existing CANFD packet parsing methods typically involve serial parsing of the packets, that is, parsing the transmitted data and user data sequentially using the same thread. However, when dealing with large amounts of data, traditional packet parsing methods suffer from high CPU usage, long parsing times, and low parsing efficiency. Summary of the Invention

[0003] One objective of this invention is to provide a message parsing method to solve the problems of high CPU usage, long parsing time, and low parsing efficiency in existing data packet parsing methods; another objective is to provide a message parsing device; a third objective is to provide a computer-readable medium; and a fourth objective is to provide a terminal device.

[0004] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0005] A message parsing method, comprising:

[0006] Obtain the message to be parsed, wherein the message to be parsed includes at least one data frame;

[0007] The first parameter of the data frame is parsed to obtain a first parsing result, wherein the first parameter is used to describe the structural information of the data frame.

[0008] Obtain the second parameter of the payload in the data frame, read the parameter parsing configuration item that matches the second parameter from the specified cache location of the specified cache space, parse the payload according to the parameter parsing configuration item, and obtain the second parsing result. The second parameter is used to describe the structural information of the payload, and the parameter parsing configuration item is used to describe the parsing rule corresponding to the second parameter.

[0009] The target parsing result of the message to be parsed is obtained based on the first parsing result and the second parsing result.

[0010] Optionally, before reading the parameter parsing configuration item matching the second parameter from the specified cache location, the method further includes:

[0011] Obtain a preset parameter parsing configuration table, wherein the parameter parsing configuration table includes at least parameter parsing configuration items corresponding to the payloads of different messages to be parsed;

[0012] Several parameter parsing configuration items are read from the parameter parsing configuration table, and the read parameter parsing configuration items are stored in the corresponding specified cache location of the specified cache space in a preset order.

[0013] Optionally, after obtaining the target parsing result of the message to be parsed based on the first parsing result and the second parsing result, the method further includes:

[0014] If it is determined that the time during which a parameter parsing configuration item in any specified cache location in the specified cache space has not been read reaches a time threshold, the parameter parsing configuration item is deleted from the specified cache location, and another parameter parsing configuration item is read from the parameter parsing configuration table and stored in the specified cache location.

[0015] Optionally, the method further includes:

[0016] If a parameter parsing configuration item matching the second parameter cannot be read from the specified cache location of the specified cache space, then a parameter parsing configuration item matching the second parameter is read from the parameter parsing configuration table; and

[0017] Mark the current parameter parsing configuration item as a cache miss.

[0018] Optionally, after obtaining the target parsing result of the message to be parsed based on the first parsing result and the second parsing result, the method further includes:

[0019] Determine the number of cache misses in the parameter parsing configuration item reading result within a preset time period, and determine the total number of parameter parsing configuration items read within the preset time period;

[0020] If the ratio of the number of misses to the total number of reads is lower than the first cache hit rate threshold, a new specified cache location is added to the specified cache space, and a new parameter parsing configuration item is read from the parameter parsing configuration table and stored in the new specified cache location.

[0021] Optionally, after obtaining the target parsing result of the message to be parsed based on the first parsing result and the second parsing result, the method further includes:

[0022] If the ratio of the number of misses to the total number of reads is higher than the second cache hit rate threshold, and if it is determined that there is a parameter parsing configuration item in the specified cache space that has not been read for a time that reaches the time threshold, the parameter parsing configuration item is deleted from the corresponding specified cache location, and the specified cache location is deleted from the specified cache space, and the second cache hit rate threshold is not less than the first cache hit rate threshold.

[0023] Optionally, the first parameter includes at least:

[0024] The identifier, control segment, checksum, start position, and data length of the data frame;

[0025] The second parameter includes at least:

[0026] The name, starting position, data length, and encoding method of the original signal in the payload.

[0027] A message parsing device, comprising:

[0028] The message acquisition module is configured to acquire a message to be parsed, the message to be parsed including at least one data frame;

[0029] The first parameter parsing module is configured to parse the first parameter of the data frame to obtain a first parsing result, wherein the first parameter is used to describe the structural information of the data frame.

[0030] The second parameter parsing module is configured to obtain the second parameter of the payload in the data frame, read the parameter parsing configuration item matching the second parameter from a specified cache location in a specified cache space, parse the payload according to the parameter parsing configuration item, and obtain a second parsing result. The second parameter is used to describe the structural information of the payload, and the parameter parsing configuration item is used to describe the parsing rule corresponding to the second parameter.

[0031] The parsing result calculation module is configured to obtain the target parsing result of the message to be parsed based on the first parsing result and the second parsing result.

[0032] A computer-readable medium storing a computer program that, when executed by a processor, implements the above-described message parsing method.

[0033] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described message parsing method.

[0034] The beneficial effects of this invention are:

[0035] 1. This application effectively reduces processor usage, shortens message parsing time, and improves parsing efficiency by dividing the data frames of the message to be parsed into layers and parsing the structural information and data content of the data frames in a synchronous and parallel manner.

[0036] 2. By pre-storing the parsing rules corresponding to the data content in a specified cache location within a specified cache space, when parsing the data content of a data frame, the corresponding pre-cached parsing rules can be read directly from the cache without accessing the original configuration file corresponding to the parsing rules, thereby effectively improving the parsing speed of the data content. Attached Figure Description

[0037] Figure 1 This is a flowchart of the message parsing method of the present invention;

[0038] Figure 2 This is a schematic diagram of the message parsing structure of the present invention;

[0039] Figure 3 This is a schematic diagram of the message parsing process of the present invention;

[0040] Figure 4 This is a schematic diagram of the message parsing logic of the present invention;

[0041] Figure 5 This is a schematic block diagram of the message parsing device of the present invention;

[0042] Figure 6 This is a schematic diagram of a terminal device structure.

[0043] Among them, 10-terminal device, 100-processor, 101-memory, and 102-computer program. Detailed Implementation

[0044] The embodiments of the present invention will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention and not for limiting the scope of protection of the present invention.

[0045] like Figure 1 As shown, this embodiment proposes a message parsing method, including:

[0046] S100: Obtain the message to be parsed, which includes at least one data frame;

[0047] S200. Parse the first parameter of the data frame to obtain the first parsing result. The first parameter is used to describe the structural information of the data frame.

[0048] S300. Obtain the second parameter of the payload in the data frame. Read the parameter parsing configuration item that matches the second parameter from the specified cache location of the specified cache space. Parse the payload according to the parameter parsing configuration item to obtain the second parsing result. The second parameter is used to describe the structural information of the payload, and the parameter parsing configuration item is used to describe the parsing rule corresponding to the second parameter.

[0049] S400. Based on the first parsing result and the second parsing result, the target parsing result of the message to be parsed is obtained.

[0050] Thus, by dividing the data frames of the message to be parsed into layers and parsing the structural information and payload of the data frames synchronously and in parallel, this application can effectively reduce processor usage, shorten message parsing time, and improve parsing efficiency. At the same time, by pre-storing the parsing rules corresponding to the payload parsing in a designated cache location in a designated cache space, when parsing the payload of the data frame, the corresponding pre-cached parsing rules can be read directly from the cache without accessing the original configuration file corresponding to the parsing rules, thereby effectively improving the parsing speed of the payload.

[0051] Understandably, the method of this application can be applied to vehicle ADAS controllers to achieve rapid parsing of CAN / CANFD data, or to industrial controllers such as PLCs to achieve rapid parsing of field data; this is not limited here. In step S100, the message to be parsed can be real-time acquired field data. Taking the parser module of the vehicle ADAS controller as an example, the message to be parsed is a CANFD message, which can be a data packet obtained by encapsulating the raw signals of relevant parameters during vehicle operation, such as current, voltage, and temperature, using the CANFD protocol. A message to be parsed typically includes multiple data frames. Taking the CANFD message as an example, each data frame includes at least the identifier, control segment, data segment, checksum, and start position fields, used to represent the data frame's ID, position in the message, data length, and other data transmission information. For example, the identifier is used to represent the ID of the data frame, the control segment is used to represent the data transmission control parameters and the number of bytes of transmitted data, the start position is used to represent the start and end positions of the data frame in the message, and the checksum is used to verify the data frame. The data segment is the payload of the data frame, which is used to record the acquired raw signal data. It usually includes the name of the raw signal, the start position, the data length, and the encoding method.

[0052] To improve parsing efficiency and reduce CPU usage, this application divides data frame parsing into two parts: message transport layer parsing and user layer parsing. During data frame parsing, both the message transport layer and user layer are parsed in parallel. The message transport layer includes the data frame's identifier, control segment, data segment, checksum, and start position field, while the user layer includes the data segment. Therefore, in step S200 of this application, the first parameter includes at least: the data frame's identifier, control segment, checksum, start position, and data length; in step S300, the second parameter includes at least: the name or ID of the original signal in the payload, start position, data length, and encoding method.

[0053] like Figure 2 As shown, by parsing the data frame, data length, and header at the message transmission layer, the data in the data frame can be read correctly and effectively, ensuring the security and correctness of data transmission. By parsing the original signal at the user layer and checking the parsing results, such as checksums, data integrity, the correctness of each field, and data validity checks, such as verifying whether the data exceeds the defined range, the integrity, correctness, and security of the data can be guaranteed.

[0054] In step S300, before reading the parameter parsing configuration item matching the second parameter from the specified cache location, the method further includes:

[0055] S301. Obtain a preset parameter parsing configuration table. The parameter parsing configuration table includes at least parameter parsing configuration items corresponding to the payloads of different messages to be parsed. The parameter parsing configuration items describe the parsing rules corresponding to the data content of the payload, and the parameter parsing configuration table records the correspondence between different parameter parsing configuration items and different payloads. For example, the payload can be a current signal or a voltage signal, with ID A representing a current signal and ID B representing a voltage signal. Then, in the parameter parsing configuration table, the parameter parsing configuration item for the current signal is pre-stored as (A, parsing rule A; B, parsing rule B). Parsing rule A can be a calculation rule that converts the original current signal into a specific current value, and parsing rule B can be a calculation rule that converts the original voltage signal into a specific voltage value. Alternatively, a correspondence between data frames and parsing rules can be established based on the identifier of the data frame. For example, if the identifier of the data frame is A, indicating that it is a current signal, then the parameter parsing configuration item with ID A can be retrieved from the parameter parsing configuration table. Understandably, parameter parsing configuration items can include multiple parsing rules, and this is not limited here. For example, the parameter parsing configuration table can use an existing DBC file, and each parameter parsing configuration item can be the corresponding CAN signal information in the DBC file. This signal information can describe the parsing rules for a certain raw signal. Understandably, DBC stands for Database CAN, indicating a CAN database, and the DBC file is the CAN database file. The DBC file is existing technology and will not be elaborated upon here.

[0056] S302. Read several parameter parsing configuration items from the parameter parsing configuration table, and store the read parameter parsing configuration items in the corresponding specified cache positions of the specified cache space according to a preset order. When reading the parsing configuration items for the first time, several parameter parsing configuration items can be directly specified based on the vehicle's operating status, such as specifying N parameter parsing configuration items to be written to the specified cache space; or, N non-repeating parameter parsing configuration items can be randomly read from the parameter parsing configuration table and written to the specified cache space. The specified cache space includes N specified cache positions. After reading N parameter parsing configuration items, the IDs of each parameter parsing configuration item can be arranged in ascending or descending order, and the N parameter parsing configuration items are written sequentially to the N specified cache positions in the specified cache space according to the arrangement order. Thus, when parsing the data frame, a binary search based on the ID number of each parameter parsing configuration item can quickly find the corresponding parameter parsing configuration item. For example, Figure 3As shown, by writing parameter parsing configuration items, such as DBC files, into the cache, when parsing real-time received messages, such as sensor data, the ADAS controller's parser module can directly read the parsing rules from the cache and parse the original signal without having to access the parameter parsing configuration table again. This can effectively improve the parsing speed of the original signal, thereby effectively improving the speed of data abstraction and application.

[0057] In this application, step S400 further includes, after obtaining the target parsing result of the message to be parsed, caching the parsed data, such as the signal value of the original signal obtained from the parsing, into a message queue so that the parsing result can be read and called directly in the future.

[0058] like Figure 4 As shown, to further improve the data parsing speed, after obtaining the target parsing result of the message to be parsed in step S400 of this application, the method further includes:

[0059] S500: If the time threshold for not reading a parameter parsing configuration item in any specified cache location within the specified cache space is reached, the parameter parsing configuration item is deleted from the specified cache location, and another parameter parsing configuration item is read from the parameter parsing configuration table and stored in the specified cache location. Since the vehicle's operating environment and usage environment change during operation, the data types that need to be parsed often change with the vehicle's operating environment. For example, if a parameter parsing configuration item has not been read since its last read, after a time threshold T, it indicates that the parameter parsing configuration item is no longer suitable for the current vehicle's operating environment. However, this parameter parsing configuration item still needs to occupy the corresponding designated cache location. Since the parameter parsing configuration items for data that needs frequent parsing in the current vehicle operating environment are not stored in the designated cache space, data parsing still requires accessing the parameter parsing configuration table to read the corresponding parsing rules, leading to a decrease in parsing speed. Therefore, in this case, this application updates the cache by deleting the parameter parsing configuration item from the designated cache location and reading a new parameter parsing configuration item from the parameter parsing configuration table and storing it in the designated cache location. This allows for dynamic adjustment of the parameter parsing configuration items in the cache space to adapt to the vehicle's operating environment. It is understood that the new parameter parsing configuration item can be determined based on the number of times each parameter parsing configuration item in the parameter parsing configuration table is read within a certain time period. For example, the parameter parsing configuration item that is read the most times within the time threshold T can be used as the new parameter parsing configuration item.

[0060] In step S300, if a parameter parsing configuration item matching the second parameter cannot be read from a specified cache location in the specified cache space, this application further marks the current parameter parsing configuration item's read result as a cache miss. Then, after step S400, the method of this application further includes:

[0061] S600. Determine the number of cache misses for parameter parsing configuration items within a preset time period, and determine the total number of parameter parsing configuration items read within the preset time period. For example, determine the total number of reads of all parameter parsing configuration items in the specified cache space within the time period t before the current time, and the total number of cache misses for all read results recorded within the time period t. Calculate the ratio of the number of misses to the total number of reads, i.e., the cache hit rate. If the obtained cache hit rate is lower than a first cache hit rate threshold, add a new specified cache location in the specified cache space, and read a new parameter parsing configuration item from the parameter parsing configuration table and store it in the new specified cache location. For example, when the calculated cache hit rate is lower than the first cache hit rate threshold, it means that the parameter parsing configuration items in the current cache space cannot meet the data parsing requirements of the current vehicle operating environment. In this case, a new specified cache location can be added to the specified cache space to increase the cache size, and the number of parameter parsing configuration items in the specified cache space can be increased, thereby improving the cache hit rate.

[0062] If the calculated cache hit rate is higher than the second cache hit rate threshold, it indicates that the parameter parsing configuration items in the current cache space can well meet the data parsing requirements of the current vehicle operating environment. Therefore, the cache space usage can be reduced. In this case, if there are parameter parsing configuration items in the specified cache space that have not been read for a time threshold T, then the parameter parsing configuration item is deleted from the corresponding specified cache location, and the specified cache location is also deleted from the specified cache space, thereby reducing cache usage without affecting the data parsing speed. If there are no parameter parsing configuration items in the specified cache space that have not been read for a time threshold T, then the parameter parsing configuration item that has been read the fewest times within the time threshold T can be deleted from the corresponding specified cache location. The second cache hit rate threshold is not less than the first cache hit rate threshold; in this application, the second cache hit rate threshold is greater than the first cache hit rate threshold.

[0063] This application manages a specified cache space using either a hash table or an LRU algorithm. Hash tables offer fast lookup speeds but consume more space; LRU algorithms save space but have relatively slower lookup speeds. In practice, a suitable cache data structure can be chosen based on the specific needs; no limitation is made here. This application monitors the number of times parameter parsing configuration items in the specified cache space are read, updates these items based on the read count, and dynamically and adaptively adjusts the cache size. This ensures that the cache space is not ineffectively occupied, thereby improving the data processing efficiency of the vehicle control system.

[0064] like Figure 5 As shown, a message parsing device includes:

[0065] The message acquisition module is configured to acquire a message to be parsed, which includes at least one data frame.

[0066] The first parameter parsing module is configured to parse the first parameter of the data frame to obtain the first parsing result. The first parameter is used to describe the structural information of the data frame.

[0067] The second parameter parsing module is configured to obtain the second parameter of the payload in the data frame, read the parameter parsing configuration item matching the second parameter from a specified cache location in a specified cache space, parse the payload according to the parameter parsing configuration item, and obtain the second parsing result. The second parameter is used to describe the structural information of the payload, and the parameter parsing configuration item is used to describe the parsing rule corresponding to the second parameter; and

[0068] The parsing result calculation module is configured to obtain the target parsing result of the message to be parsed based on the first parsing result and the second parsing result.

[0069] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0070] A computer-readable medium storing a computer program that, when executed by a processor, implements the above-described message parsing method.

[0071] A terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the aforementioned message parsing method.

[0072] like Figure 6 The diagram shown is a schematic representation of a terminal device provided in an embodiment of this application. Figure 6 As shown, the terminal device 10 of this embodiment includes a processor 100, a memory 101, and a computer program 102 stored in the memory 101 and executable on the processor 100. When the processor 100 executes the computer program 102, it implements the steps in the above method embodiments. Alternatively, when the processor 100 executes the computer program 102, it implements the functions of each module / unit in the above device embodiments.

[0073] For example, computer program 102 may be divided into one or more modules / units, one or more of which are stored in memory 101 and executed by processor 100 to complete this application. One or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 102 in terminal device 10.

[0074] Terminal device 10 may be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. Terminal device 10 may include, but is not limited to, a processor 100 and a memory 101. Those skilled in the art will understand that... Figure 6 This is merely an example of terminal device 10 and does not constitute a limitation on terminal device 10. It may include more or fewer components than shown, or combine certain components, or different components. For example, terminal device may also include input / output devices, network access devices, buses, etc.

[0075] The processor 100 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0076] The memory 101 can be an internal storage unit of the terminal device 10, such as a hard disk or RAM of the terminal device 10. The memory 101 can also be an external storage device of the terminal device 10, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal device 10. Furthermore, the memory 101 can include both internal and external storage units of the terminal device 10. The memory 101 is used to store computer programs and other programs and data required by the terminal device 10. The memory 101 can also be used to temporarily store data that has been output or will be output.

[0077] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0078] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0079] The above embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention.

Claims

1. A message parsing method, characterized in that, include: Obtain the message to be parsed, wherein the message to be parsed includes at least one data frame; The first parameter of the data frame is parsed to obtain a first parsing result, wherein the first parameter is used to describe the structural information of the data frame. Obtain a preset parameter parsing configuration table, wherein the parameter parsing configuration table includes at least parameter parsing configuration items corresponding to the payloads of different messages to be parsed; Read several parameter parsing configuration items from the parameter parsing configuration table, and store the read parameter parsing configuration items in the corresponding specified cache location of the specified cache space in a preset order; Obtain the second parameter of the payload in the data frame, read the parameter parsing configuration item that matches the second parameter from the specified cache location of the specified cache space, parse the payload according to the parameter parsing configuration item, and obtain the second parsing result. The second parameter is used to describe the structural information of the payload, and the parameter parsing configuration item is used to describe the parsing rule corresponding to the second parameter. The target parsing result of the message to be parsed is obtained based on the first parsing result and the second parsing result; Determine the number of cache misses in the parameter parsing configuration item reading result within a preset time period, and determine the total number of parameter parsing configuration items read within the preset time period; If the ratio of the number of misses to the total number of reads is lower than the first cache hit rate threshold, a new specified cache location is added to the specified cache space, and a new parameter parsing configuration item is read from the parameter parsing configuration table and stored in the new specified cache location. If the ratio of the number of misses to the total number of reads is higher than the second cache hit rate threshold, and if it is determined that there is a parameter parsing configuration item in the specified cache space that has not been read for a time threshold, the parameter parsing configuration item is deleted from the corresponding specified cache location, and the specified cache location is deleted from the specified cache space, and the second cache hit rate threshold is not less than the first cache hit rate threshold.

2. The message parsing method according to claim 1, characterized in that, After obtaining the target parsing result of the message to be parsed based on the first parsing result and the second parsing result, the method further includes: If the time threshold is reached when it is determined that a parameter parsing configuration item in any specified cache location in the specified cache space has not been read, the parameter parsing configuration item is deleted from the specified cache location, and another parameter parsing configuration item is read from the parameter parsing configuration table and stored in the specified cache location.

3. The message parsing method according to claim 2, characterized in that, The method further includes: If a parameter parsing configuration item matching the second parameter cannot be read from the specified cache location of the specified cache space, then a parameter parsing configuration item matching the second parameter is read from the parameter parsing configuration table; and Mark the current parameter parsing configuration item as a cache miss.

4. The message parsing method according to claim 1, characterized in that, The first parameter includes at least: The identifier, control segment, checksum, start position, and data length of the data frame; The second parameter includes at least: The name, starting position, data length, and encoding method of the original signal in the payload.

5. A message parsing apparatus, employing the message parsing method according to any one of claims 1 to 4, characterized in that, The device includes: The message acquisition module is configured to acquire a message to be parsed, the message to be parsed including at least one data frame; The first parameter parsing module is configured to parse the first parameter of the data frame to obtain a first parsing result, wherein the first parameter is used to describe the structural information of the data frame. The second parameter parsing module is configured to obtain the second parameter of the payload in the data frame, read the parameter parsing configuration item matching the second parameter from a specified cache location in a specified cache space, parse the payload according to the parameter parsing configuration item, and obtain a second parsing result. The second parameter is used to describe the structural information of the payload, and the parameter parsing configuration item is used to describe the parsing rule corresponding to the second parameter. The parsing result calculation module is configured to obtain the target parsing result of the message to be parsed based on the first parsing result and the second parsing result.

6. A computer-readable medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the message parsing method according to any one of claims 1 to 4.

7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the message parsing method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • CAN message analysis method and device, computer storage medium and electronic equipment

    CN115190188A

  • Message analysis method and device, electronic equipment and storage medium

    CN115883681A