Data processing method and device and electronic equipment

By replacing the parsing interference factors in the CAN message with preset characters and processing them based on their uniqueness, the problem of low efficiency in CAN message processing in the prior art is solved, and fast and accurate CAN message processing is achieved.

CN119254858AActive Publication Date: 2025-01-03GREAT WALL MOTOR CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411359796.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-03
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

When facing a large number of CAN messages, the prior art has low processing efficiency, cannot achieve rapid processing, and is prone to missed processing of faulty messages.

Method used

By obtaining the original data in the pending test data packet, replacing the parsing preset factors with preset characters, processing the replacement data based on the preset parsing conditions, using the data between every two preset characters Uniqueness, directly search and parse to avoid deduplication.

Benefits of technology

It improves the processing efficiency of test data packets, reduces processing time, ensures the rapid processing and accuracy of CAN packets, and avoids the risk of missed processing failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254858A_ABST
    Figure CN119254858A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is suitable for the technical field of data processing, and provides a data processing method and device and electronic equipment, and the method comprises the steps: obtaining original data in a to-be-processed test data message; replacing a preset factor which interferes with analysis in the original data with a preset character to obtain replacement data; processing the replacement data based on a preset analysis condition; the preset analysis condition at least comprises two preset characters and preset data located between the two preset characters. By adopting the method, the processing efficiency of the test data message can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular, relates to a data processing method, device and electronic equipment. Background Art

[0002] With the development of vehicle technology, Controller Area Network (CAN), as an important communication system on vehicles, has become a widely used communication protocol in vehicle electronic systems. Therefore, in order to ensure the communication security of vehicles, it has become an indispensable task to collect, analyze and process CAN messages.

[0003] At present, existing data acquisition equipment and software are usually used to process CAN messages. However, as the complexity of vehicle systems increases, the amount of CAN message data is also growing exponentially. Existing processing methods are unable to quickly process a large number of CAN messages. Summary of the invention

[0004] The embodiments of the present application provide a data processing method, device and electronic device, which can solve the problem of low CAN message processing efficiency when facing a large number of CAN messages.

[0005] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:

[0006] Obtaining the original data in the test data message to be processed;

[0007] Replacing the preset factors in the original data that interfere with the analysis with preset characters to obtain replacement data;

[0008] The replacement data is processed based on a preset parsing condition; the preset parsing condition includes at least two preset characters and preset data between the two preset characters.

[0009] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:

[0010] A first acquisition module, used to acquire original data in the test data message to be processed;

[0011] A replacement module, used to replace the preset factors that interfere with the parsing in the original data with preset characters to obtain replacement data;

[0012] The first processing module is used to process the replacement data based on a preset parsing condition; the preset parsing condition at least includes two preset characters and preset data between the two preset characters.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of the first aspect described above when executing the computer program.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method of the first aspect described above is implemented.

[0015] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the method of the first aspect.

[0016] Compared with the prior art, the embodiments of the present application have the following beneficial effects: after obtaining the original data in the test data message to be processed, the preset factors in the original data that interfere with the analysis can be replaced with preset characters to obtain replacement data. At this time, the replacement data will consist of the original data and special preset characters. Among them, since the original data included between each two preset characters are usually different, or only partially the same. Therefore, it can be considered that the combination of each two preset characters and the original data contained therein is unique. Based on this, compared with the time taken to retrieve and remove duplicate information in the original data when directly processing the original data, based on the preset parsing conditions corresponding to the preset data containing two preset characters and the preset data located between the two preset characters, when directly retrieving and parsing the original data, due to its uniqueness, it is not necessary to perform deduplication processing. In turn, the efficiency of processing the original data in the test data message is improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0018] Figure 1 It is a flow chart of an implementation of a data processing method provided by an embodiment of the present application;

[0019] Figure 2 is a flow chart of an implementation of a data processing method provided by another embodiment of the present application;

[0020] Figure 3 is a structural schematic diagram of a data processing device provided by an embodiment of the present application;

[0021] Figure 4 It is a structural schematic diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0022] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0023] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0024] It should be noted that the information collection process (such as face image collection process, fingerprint information collection process, etc.) / feature extraction process involved in this application is performed with the user's knowledge and permission, that is, the information collection process / feature extraction process complies with the requirements of laws and regulations and does not constitute an act that harms the public interest.

[0025] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0026] With the development of vehicle technology, the controller area network, as an important communication system in vehicles, has become a widely used communication protocol in vehicle electronic systems. Therefore, in order to ensure the communication security of vehicles, it has become an indispensable task to collect, analyze and process CAN messages.

[0027] At present, existing data acquisition equipment and software are usually used to process CAN messages. However, as the complexity of vehicle systems increases, the amount of CAN message data is also growing exponentially. Existing processing methods are unable to quickly process a large number of CAN messages.

[0028] In the prior art, data acquisition equipment usually samples a large number of CAN messages at multiple sampling frequencies to reduce the number of CAN messages to be processed. However, although this method can improve processing efficiency, it is easy to miss processing CAN messages with faults.

[0029] Based on this, in order to improve processing efficiency when facing a large number of CAN messages, an embodiment of the present application provides a data processing method, which can be applied to electronic devices such as tablet computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, etc. The embodiment of the present application does not impose any restrictions on the specific types of electronic devices.

[0030] See also Figure 1 , Figure 1 A flowchart of a data processing method provided in an embodiment of the present application is shown, and the method comprises the following steps:

[0031] S101: Obtain original data in a test data message to be processed.

[0032] In one embodiment, the data message is a data unit exchanged and transmitted in the network, that is, a data block to be sent by a station at one time. The data message contains complete data information to be sent, and its length varies, and the length is unlimited and variable. Usually, the data message includes not only the data to be transmitted, but also necessary additional information. For example, the destination IP, destination port, source address, source port, data length, protocol used, encryption and other information are not limited to this.

[0033] The test data message to be processed is a data message that needs to be sent during vehicle communication, and the test data message needs to be processed during the testing and development phases. The processing includes but is not limited to the reception, transmission, analysis, storage, etc. of the test data message, which is not limited to this.

[0034] It should be noted that the category of the test data message may be a CAN message category, or a LIN (Local Interconnect Network) message category, etc., and there is no limitation on this.

[0035] It is understandable that when the communication buses used on the vehicle are different, the types of the corresponding test data messages are also different. In this embodiment, the following description is made by taking the CAN message as the test data message as an example.

[0036] In one embodiment, the original data may be data directly read from the test data message, in which case the original data has not been parsed, or may be data obtained by parsing the directly read data.

[0037] For example, a frame of message consists of multiple bytes. In computer networks, information needs to be transmitted through binary bytes. Usually, multiple binary bytes represent a character. For example, 4 bytes or 8 bytes represent a character. A character is the smallest unit that a person can read and write. The set of characters that a computer can support is called a character set.

[0038] In actual scenarios, characters cannot usually be transmitted directly in computers and networks, but bytes (bytes composed of 0 and 1) can be parsed to obtain the information to be transmitted. Therefore, characters need to be converted (encoded) into bytes and stored in the test data message. At this time, the original data can be considered to be the byte data in the test data message.

[0039] It should be added that the data message includes not only byte data, but also the values ​​required to be set in the message format corresponding to the communication protocol. For example, it includes the values ​​corresponding to the format such as the start character, control field, data field, checksum, and end character. The value range and specific meaning of this value are usually clearly defined in the communication protocol, so it will not be explained in detail.

[0040] Based on this, it can be considered that the content in the test data message is not limited to 0 and 1 in the byte data, but depends on the specific communication protocol and application scenario, and includes multiple possible values ​​and formats.

[0041] In another embodiment, when decoding is not performed, it may not be possible to automatically identify and extract the most valuable information for the user (for example, CAN message time, DLC, etc.) Based on this, in this embodiment, the above-mentioned original data can also be data obtained by decoding the byte data.

[0042] Among them, a large number of test data messages may be pre-stored in the electronic device. Moreover, the large number of test data messages may be divided into test data messages corresponding to multiple CAN IDs. At this time, the electronic device can perform batch data processing on the test data messages corresponding to the same CAN ID.

[0043] In one embodiment, CANID is mainly used for filtering, arbitration, and high-level protocol management of data messages. The purpose of parsing and testing CAN messages with the same CAN ID is to ensure the reliability and stability of CAN bus communication and comply with application layer specification requirements.

[0044] Among them, when parsing and testing the CAN message data of the same CAN ID, it is possible to check whether the data field length (DLC) of all CAN bus messages sent by the sender complies with the application layer specification requirements. Usually, this step not only involves recording, comparative evaluation and cyclic operation, but also takes a lot of time and manpower because the vehicle CAN bus has many parts and many items need to be tested. Based on this, by testing the test data messages with the same CAN ID, the communication quality of the CAN bus and the accuracy of data transmission can be ensured, avoiding the failure or paralysis of the entire CAN bus system due to errors in a certain node.

[0045] As an example, the electronic device may obtain, from a large number of test data messages, a plurality of test data messages corresponding to the CAN IDs to be parsed as the test data sets to be processed, so as to execute the data processing method in this embodiment.

[0046] In another embodiment, the processing (parsing and testing) of the test data message is usually performed in the development and testing stage. However, in the development and testing stage, the data record format (file format) of the test data message transmitted by the communication bus is usually a preset fixed format. Therefore, in the development and testing stage, it can also be determined whether the test data set needs to be processed according to the file format.

[0047] As a specific example, the electronic device may first obtain a test data set to be processed that is transmitted based on a bus protocol, and then determine a file format of the test data set to process multiple frames of test data messages based on the file format.

[0048] It is understandable that when the bus protocol is the CAN communication protocol, the acquired test data message will be a CAN message; and when the bus protocol is the LIN communication protocol, the acquired test data message will be a LIN test data message, without limitation.

[0049] It should be noted that the test data set generally includes multiple test data messages. In one embodiment, the multiple test data messages included in the test data set may be test data messages with the same CAN ID as described above, or may be test data messages acquired within a preset time period, without limitation.

[0050] In one embodiment, the above file format can be set according to actual conditions, and there is no limitation on this. Exemplarily, the above file format can be in ASC format. Among them, the ASC format is a data recording format of the CAN bus, which usually stores CAN messages in text form and is widely used in the development and testing stages.

[0051] Based on the above description, the electronic device may consider the test data message contained in the acquired test data set as a normal message when the file format is a preset format. Then, each frame of the test data message may be processed in turn. That is, the data processing method in the above embodiment is executed on each frame of the data message.

[0052] Otherwise, when the file format is not the preset format, the test data message contained in the acquired test data set can be considered as an abnormal message. Then, the processing of the test data set can be stopped. That is, the processing of the test data message of the test data set is exited.

[0053] S102: Replace the preset factors in the original data that interfere with the analysis with preset characters to obtain replacement data.

[0054] In one embodiment, the preset factors that interfere with the parsing include, but are not limited to, spaces, bytes without actual data meaning, and other factors, which are not limited to this.

[0055] For example, in the test data message, some bytes do not contain actual data information, but are used for specific communication purposes, such as checksum, control or identification bytes. Although these bytes exist in the test data message, they do not constitute substantial data meaning for the receiver to understand or process the content in the message.

[0056] In another embodiment, since the test data message needs to be tested, the bytes without actual data meaning also need to be tested for faults. Based on this, in this embodiment, it can be considered that the preset factor that interferes with the analysis is a space. That is, the electronic device can replace the space in the original data with a preset character to obtain replacement data.

[0057] Since the bytes in the message need to be parsed later to make them readable and writable by humans, in order to avoid the inserted characters interfering with the parsed character processing, the preset characters may be special characters other than letters and numbers.

[0058] Exemplarily, the above-mentioned preset characters may be punctuation marks, or characters such as “#”, which are not limited thereto.

[0059] Among them, replacing the preset factors with preset characters can enable the electronic device to parse each field in the data message more efficiently when parsing the test data message later, avoiding spaces from interfering with the parsing work.

[0060] S103: Process the replacement data based on preset parsing conditions.

[0061] In one embodiment, the preset parsing condition includes at least two preset characters and preset data between the two preset characters. The preset data includes but is not limited to a value representing a data state, a CNAID, and a preset number, which are not limited thereto. That is, the preset parsing condition includes data such as preset characters + preset data + preset characters.

[0062] In another embodiment, the preset parsing condition may further include other preset data outside the two preset characters. In this case, the preset parsing condition may be preset data + preset character + preset data + preset character; or preset character + preset data + preset character + preset data, which is not limited.

[0063] As an example, the above preset parsing conditions include but are not limited to preset character + Rx + preset character, preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character and other conditions, which are not limited to this.

[0064] It is understandable that, since the space is replaced by the preset character, the replacement data will not have two consecutive adjacent preset characters. Based on this, it can be considered that part of the original data will be included between two consecutive preset characters.

[0065] Furthermore, since the original data included between every two preset characters (spaces) are usually different, or only partially identical, it can be considered that the combination of every two preset characters and the original data included therebetween is unique in the entire replacement data.

[0066] Based on the above description, when the electronic device determines that the replacement data includes data corresponding to the preset parsing condition, it can consider that the test data message includes normal data corresponding to the preset parsing condition. Furthermore, the replacement data can be parsed using the preset parsing rule corresponding to the preset parsing condition to obtain the first target data.

[0067] Otherwise, when it is determined that the replacement data does not contain data corresponding to the preset parsing condition, the test data message can be considered to be missing and an abnormal message. Then, the processing of the test data message of the current frame can be stopped directly, and the processing of the next frame of test data message can be started to improve the processing efficiency of the test data message.

[0068] Among them, the preset parsing rules can be set according to actual conditions. The parsing rules of different communication protocols are usually different, which will not be described in detail.

[0069] Exemplarily, when the preset character + Rx + preset character does not exist in the replacement data, it can be considered that the test data message is not a message obtained from the sender, but a test data message generated by itself. The electronic device can consider that the data contained in the test data message generated by itself has been recorded. Therefore, it is not necessary to perform data processing to obtain the data in the test data message. Furthermore, it can be considered that the replacement data does not meet the preset parsing conditions and no subsequent processing is required.

[0070] Furthermore, when the replacement data contains the preset character + Rx + preset character, the test data message can be considered as a message obtained from the sender. Therefore, it is necessary to process it to obtain and detect the data in the test data message.

[0071] Wherein, Rx represents a receiving state in the data state, which can be used to indicate that the test data message is a received message. In another embodiment, the data state further includes a sending state Tx, which is used to indicate that the test data message is a message that needs to be sent.

[0072] Similar to the above judgment method, when the replacement data does not contain data such as preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character, the test data message can be considered as an abnormal message. Furthermore, it can be considered that the test data message does not meet the preset parsing conditions and no subsequent processing is required.

[0073] Otherwise, when the replacement data contains data such as preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character, the test data message can be considered as a normal message. Furthermore, it can be considered that the replacement data meets the preset parsing conditions and needs to be processed later.

[0074] It should be noted that when it is determined that the preset parsing condition is met, the electronic device needs to parse the replacement data based on the preset parsing rule corresponding to the preset parsing condition to obtain the first target data. For example, when the preset parsing conditions corresponding to preset character + Rx + preset character, preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character, etc. are met, Rx, CAN ID and DLC information in the test data message are respectively used as the first target data.

[0075] The DLC information represents the length of the data message. In the CAN communication protocol, DLC is used to identify the number of bytes of data in the data message to assist electronic devices in correctly parsing the message content, which helps to ensure the integrity and correctness of the data.

[0076] It should be added that, no matter what kind of data message, the structure of the data message usually has a data segment for storing data. The data stored in the data segment is usually the main information transmitted by the sender. Among them, other fields of the test data message usually store fixed types of information. For example, the destination address, source address, confirmation / response information, check value and other types of information are stored. In addition, the data segment is usually located after the control segment (including DLC ​​information) in the data message that represents the number of bytes of the data segment.

[0077] Based on this, in order to completely process the test data message, after determining that the replacement data meets the above-mentioned multiple preset parsing conditions, the electronic device can also obtain the data in the data segment and perform verification. Then, when the verification passes, the electronic device can parse the data in the data segment and use it as the first target data.

[0078] Among them, since the DLC information represents the number of bytes of the data segment, the data segment usually stores data to be transmitted, so the number of bytes of the data segment is not 0. Based on this, the way to verify the test data message can be that if the value after parsing the DLC information is 0, it can be considered that the test data message is abnormal, and then it can be determined that the verification fails. At this time, the electronic device can directly end the processing of the test data message.

[0079] Otherwise, if the value after parsing the DLC information is not 0, it can be considered that the test data message is normal, and then it can be determined that the verification has passed. At this time, the electronic device can continue to process the test data message.

[0080] It should be noted that the above is only one way to verify the data in the data segment. In another embodiment, the data in the data segment can also be verified based on the data in the check segment (CRC) that characterizes the integrity and correctness of the data in the test data message. In this embodiment, the method for verifying the data in the data segment is not limited.

[0081] In one embodiment, the processing of the test data message includes, but is not limited to, parsing, storing, checking, outputting, and the like, which are not limited thereto.

[0082] It should be added that during the processing, the parsed first target data may need to be output to an external device. Furthermore, since the data contained in the data segment in the test data message is the main data, after obtaining the first target data, the external device usually needs to call the data corresponding to the data segment in the first target data.

[0083] However, in actual scenarios, the data obtained after parsing the bytes in the data segment is usually in a record format of bus data and cannot be directly called by an external device or application.

[0084] Based on this, in order to facilitate external devices or applications to call, the electronic device can also determine the second target data located in the data segment of the test data message from the first target data, and then convert the data format of the second target data into an array format for transmission.

[0085] It should be noted that storing and sending the second target data in an array format allows an external device or application to directly use the array file when it needs to call the second target data corresponding to the array file, without the need for complex parsing or deserialization, thereby simplifying the calling steps.

[0086] In one embodiment, the test data set may include multiple test data messages, and the electronic device may process each test data message in turn. When the processing of the previous test data message is completed, or the preset parsing condition is not met (that is, the replacement data does not contain data corresponding to the preset parsing condition), the electronic device may process the next test data message until all test data messages in the test data set are processed.

[0087] It should be noted that there may be multiple preset parsing conditions. At this time, for any preset parsing condition, the electronic device may sequentially determine whether the replacement data includes data corresponding to the preset parsing condition. Furthermore, in the process of sequentially determining whether the replacement data includes data corresponding to each preset parsing condition, if it is determined that the replacement data does not include data corresponding to any preset parsing condition, the electronic device may no longer process the subsequent preset parsing conditions that have not been determined, but directly process the test data message of the next frame.

[0088] Furthermore, compared to the method of judging all preset parsing conditions, by adopting the above judgment method, the electronic device can directly end the processing of the test data message when it detects that the replacement data does not meet any of the above preset parsing conditions, thereby improving the processing efficiency of the test data message.

[0089] In another embodiment, in order to further improve the efficiency of the electronic device in matching the replacement data with the preset parsing conditions, the judgment order of the preset parsing conditions may be the same as the order in which the preset data is read in the test data message.

[0090] Usually, the order in which the data in a data message is read mainly depends on the structure of the data message and the transmission protocol. Taking the structure of a data message as an example, the structure of a data message is usually divided from the beginning to the end into: a frame start segment (used to indicate the beginning of the data message, this segment usually contains the data status), an arbitration segment (indicating the priority of the data message, usually characterized based on the ID. That is, when the data message is a CAN message, this segment contains the CAN ID), a control segment, a data segment, a CRC segment, an ACK segment (used to confirm the normal reception of the data) and a frame end segment (used to indicate the end of the data message). When reading data, it is usually read from the frame start segment, and then passes through the arbitration segment, control segment, data segment, CRC segment, ACK segment, until the frame end segment.

[0091] Based on the above description, when determining whether the replacement data meets the preset parsing condition, the judgment can be made in sequence according to the order in which the preset data in the preset parsing condition is read. Based on this, it can be quickly determined whether the replacement data meets the preset parsing condition. Furthermore, when it is determined that the preset parsing condition is not met, the subsequent processing of the test data message can be terminated in time to improve the processing efficiency.

[0092] Exemplarily, taking the preset parsing conditions corresponding to preset characters + Rx + preset characters, preset characters + CAN ID + data status + preset characters, d + preset characters + 8 + preset characters, etc. as examples, when reading the target replacement data, the data status contained in the frame start segment, the CAN ID in the arbitration segment, and the DLC information in the control segment are read in sequence.

[0093] Based on this, the judgment order of the above preset parsing conditions can be: preset character + Rx + preset character, preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character, etc. In addition, when it is necessary to verify the data in the data segment, the verification order can be placed after the preset parsing condition corresponding to d + preset character + 8 + preset character.

[0094] Based on the above description, in this embodiment, after obtaining the original data in the test data message to be processed, the preset factors in the original data that interfere with the analysis can be replaced with preset characters to obtain replacement data. At this time, the replacement data will be composed of the original data and special preset characters. Among them, since the original data included between each two preset characters are usually different, or only partially the same. Therefore, it can be considered that the combination of each two preset characters and the original data contained therein is unique. Based on this, compared with the time taken to retrieve and remove duplicate information in the original data when directly processing the original data, based on the preset parsing conditions corresponding to the preset data containing two preset characters and the preset data located between the two preset characters, when directly retrieving and parsing the original data, due to its uniqueness, it is not necessary to perform deduplication processing. In turn, the efficiency of processing the original data in the test data message is improved.

[0095] In another embodiment, referring to Figure 2 , Figure 2 This is a flow chart for implementing a data processing method provided by another embodiment of the present application. An example is given for explanation of the preset parsing conditions corresponding to the test data message being a CAN message and the preset parsing conditions including preset characters + Rx + preset characters, preset characters + CAN ID + data status + preset characters, d + preset characters + 8 + preset characters, etc.

[0096] After obtaining the test data set to be processed based on the CAN bus protocol transmission, it can be determined whether the file format is the preset ASC format. If the file format is not the preset ASC format, the electronic device can stop processing the test data set. Otherwise, if the file format is the ASC format, the electronic device can process each frame of the CAN message in turn. For example, process the Nth frame of the CAN message, where N is greater than or equal to 1. The processing is described below by taking the parsing and transmission of the CAN message as an example. Specifically, the method for processing the CAN message is as follows:

[0097] The electronic device may replace the spaces in the original data with preset characters to obtain replacement data. Then, the electronic device may first determine whether the replacement data contains data corresponding to the first preset parsing condition of the preset character+Rx+preset character. If the replacement data does not contain data corresponding to the first preset parsing condition, the electronic device may stop judging the unprocessed preset parsing condition of the CAN message and process the next frame of the CAN message.

[0098] Otherwise, when the replacement data includes data corresponding to the first preset parsing condition, the electronic device can again determine whether the replacement data includes data corresponding to the second preset parsing condition of preset characters + CAN ID + data status + preset characters. If the replacement data does not include data corresponding to the second preset parsing condition, the electronic device can stop determining the unprocessed preset parsing condition of the CAN message and process the next frame of CAN message.

[0099] Otherwise, when the replacement data includes data corresponding to the second preset parsing condition, the electronic device can again determine whether the replacement data includes data corresponding to the third preset parsing condition of d+preset character+8+preset character. If the replacement data does not include data corresponding to the third preset parsing condition, the electronic device can stop determining the unprocessed preset parsing condition of the CAN message and process the next frame of the CAN message.

[0100] Otherwise, when the replacement data includes data corresponding to the third preset parsing condition, it can be determined again whether the number of bytes in the data segment of the CAN message is 0. If the number of bytes is 0, the electronic device can stop determining the unprocessed preset parsing condition of the CAN message and process the next frame of the CAN message.

[0101] Otherwise, if the number of bytes is not 0, the electronic device can parse the data in the data segment to obtain the second target data, and convert the second target data into an array format. At the same time, when the above preset parsing conditions are met, the electronic device can also parse the replacement data based on the preset parsing rules corresponding to the above preset parsing conditions to obtain the remaining first target data. For example, the data state (Rx) corresponding to the first preset parsing condition is obtained, the CAN message time corresponding to the second preset parsing condition is obtained, and the DLC information in the CAN message corresponding to the third preset parsing condition is obtained.

[0102] Finally, the electronic device can output the above-mentioned first target data (including the second target data) to the external device. In addition, it is determined whether there are other unparsed CAN messages in the test data set. If there are unparsed CAN messages, the above-mentioned parsing is performed on the next frame (N=N+1) of CAN messages. Otherwise, it is confirmed that the test data set has been parsed and there is no problem in the parsing process, and the external device is informed that the parsing work has been successfully completed.

[0103] Based on the above description, using the above method, when facing a large number of test data messages, the spaces in the original data can be replaced with preset characters to obtain replacement data. At this time, the replacement data will be composed of the original data and the preset characters. Among them, since the original data included between each two preset characters are usually different, or only partially the same. Therefore, it can be considered that the combination of each two preset characters and the original data contained therein is unique. Based on this, compared to the time taken to retrieve and remove duplicate information in the original data when directly processing the original data, based on the preset parsing conditions corresponding to the preset data containing two preset characters and located between the two preset characters, when directly retrieving and parsing the original data, due to its uniqueness, it is not necessary to perform deduplication processing. Thereby, the efficiency of processing the original data in the test data message is improved.

[0104] Furthermore, when judging whether the preset parsing condition is met, the judgment is made according to the order in which the preset data is read, which can improve the judgment efficiency. Also, when it is determined that the preset parsing condition is not met, the next frame of test data message is directly parsed, which can also avoid spending a lot of time on completely parsing the test data message. Based on this, the efficiency of processing the test data message can be further improved.

[0105] See also Figure 3 , Figure 3 1 is a structural block diagram of a data processing device provided in an embodiment of the present application. The data processing device in this embodiment includes modules for executing Figure 1 to Figure 2 For details, please refer to the steps in the corresponding embodiment. Figure 1 to Figure 2 as well as Figure 1 to Figure 2 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 3 , the data processing device 300 may include: a first acquisition module 310, a replacement module 320 and a first processing module 330, wherein:

[0106] The first acquisition module 310 is used to acquire original data in the test data message to be processed.

[0107] The replacement module 320 is used to replace the preset factors that interfere with the parsing in the original data with preset characters to obtain replacement data.

[0108] The first processing module 330 is used to process the replacement data based on a preset parsing condition; the preset parsing condition at least includes two preset characters and preset data between the two preset characters.

[0109] In one embodiment, the data processing device 300 further includes:

[0110] The second acquisition module is used to acquire a test data set to be processed based on bus protocol transmission; the test data set includes multiple frames of test data messages.

[0111] The first determination module is used to determine the file format of the test data set.

[0112] The second processing module is used to process the multi-frame test data message based on the file format.

[0113] In one embodiment, the second processing module is further configured to:

[0114] If the file format is a preset format, each frame of the test data message is processed in turn; if the file format is not a preset format, the processing of the test data set is stopped.

[0115] In one embodiment, the replacement module 320 is further configured to:

[0116] Replace the spaces in the original data with preset characters to obtain replacement data.

[0117] In one embodiment, the test data message has multiple frames; the first processing module 330 is further used to:

[0118] If the replacement data contains data corresponding to the preset parsing conditions, the preset parsing rules corresponding to the preset parsing conditions are used to parse the replacement data to obtain the first target data; if the replacement data does not contain data corresponding to the preset parsing conditions, processing of the test data message of the current frame is stopped, and processing of the next frame of test data message is performed.

[0119] In one embodiment, there are multiple preset parsing conditions; the first processing module 330 is further used to:

[0120] For any preset parsing condition, determine in turn whether the replacement data contains data corresponding to the preset parsing condition; if the replacement data does not contain data corresponding to the preset parsing condition, stop judging the unprocessed preset parsing condition and process the next frame of test data message.

[0121] In one embodiment, the data processing device 300 further includes:

[0122] The second determination module is used to determine the second target data located in the data segment of the test data message from the first target data.

[0123] The conversion module is used to convert the data format of the second target data into an array format for sending.

[0124] In one embodiment, the order of determining the preset parsing conditions is the same as the order in which the preset data is read in the test data message.

[0125] When it is understood that Figure 3 In the structural block diagram of the data processing device shown in FIG. Figure 1 to Figure 2 The steps in the corresponding embodiments, and for Figure 1 to Figure 2 Each step in the corresponding embodiment has been explained in detail in the above embodiment. Figure 1 to Figure 2 as well as Figure 1 to Figure 2 The relevant descriptions in the corresponding embodiments are not repeated here.

[0126] Figure 4 1 is a structural block diagram of an electronic device provided by an embodiment of the present application. Figure 4 As shown, the electronic device 400 of this embodiment includes: a processor 410, a memory 420, and a computer program 430 stored in the memory 420 and executable on the processor 410, such as a program of a data processing method. When the processor 410 executes the computer program 430, the steps in each embodiment of the above-mentioned data processing method are implemented, such as Figure 1 Alternatively, the processor 410 implements the above when executing the computer program 430 Figure 3 The functions of each module in the corresponding embodiment are, for example, Figure 3 For details on the functions of each module shown, please refer to Figure 3 Related description in the corresponding embodiment.

[0127] Exemplarily, the computer program 430 may be divided into one or more modules, one or more modules are stored in the memory 420, and are executed by the processor 410 to implement the data processing method provided in the embodiment of the present application. One or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 430 in the electronic device 400. For example, the computer program 430 may implement the data processing method provided in the embodiment of the present application.

[0128] The electronic device 400 may include, but is not limited to, a processor 410 and a memory 420. Those skilled in the art will appreciate that Figure 4 It is only an example of the electronic device 400 and does not constitute a limitation of the electronic device 400. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0129] The processor 410 may be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0130] The memory 420 may be an internal storage unit of the electronic device 400, such as a hard disk or memory of the electronic device 400. The memory 420 may also be an external storage device of the electronic device 400, such as a plug-in hard disk, a smart memory card, a flash memory card, etc. equipped on the electronic device 400. Furthermore, the memory 420 may also include both an internal storage unit of the electronic device 400 and an external storage device.

[0131] An embodiment of the present application provides a computer-readable storage medium, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the data processing method in the above-mentioned embodiments is implemented.

[0132] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the data processing method in each of the above embodiments.

[0133] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Obtaining the original data in the test data message to be processed; Replacing the preset factors in the original data that interfere with the analysis with preset characters to obtain replacement data; The replacement data is processed based on a preset parsing condition; the preset parsing condition at least includes two preset characters and preset data between the two preset characters.

2. The method according to claim 1, characterized in that The method further comprises: Acquire a test data set to be processed based on bus protocol transmission; the test data set includes multiple frames of test data messages; Determine the file format of the test data set; The multiple frames of the test data messages are processed based on the file format.

3. The method according to claim 2, characterized in that The processing of the multiple frames of the test data messages based on the file format includes: If the file format is a preset format, processing each frame of the test data message in turn; If the file format is not a preset format, the processing of the test data set is stopped.

4. The method according to claim 1, characterized in that: The step of replacing the preset factors in the original data that interfere with the analysis with preset characters to obtain replacement data includes: The spaces in the original data are replaced with the preset characters to obtain the replacement data.

5. The method according to claim 1, characterized in that The test data message has multiple frames; the processing of the replacement data based on the preset parsing condition includes: If the replacement data includes data corresponding to the preset parsing condition, the replacement data is parsed using a preset parsing rule corresponding to the preset parsing condition to obtain first target data; If the replacement data does not include data corresponding to the preset parsing condition, the processing of the test data message of the current frame is stopped, and the test data message of the next frame is processed.

6. The method according to claim 5, characterized in that The preset parsing conditions include a plurality of conditions; and the processing of the replacement data based on the preset parsing conditions further includes: For any of the preset parsing conditions, determining in turn whether the replacement data includes data corresponding to the preset parsing condition; If the replacement data does not include data corresponding to the preset parsing condition, the judgment of the unprocessed preset parsing condition is stopped, and the next frame of the test data message is processed.

7. The method according to claim 5, characterized in that After the replacement data is parsed using the preset parsing rule corresponding to the preset parsing condition to obtain the first target data, the method further includes: Determining, from the first target data, second target data located in a data segment of the test data message; The data format of the second target data is converted into an array format for sending.

8. The method according to any one of claims 1 to 7, characterized in that: The order of judging the preset parsing conditions is the same as the order in which the preset data is read in the test data message.

9. A data processing device, characterized in that: The device comprises: A first acquisition module, used to acquire original data in the test data message to be processed; A replacement module, used to replace the preset factors that interfere with the parsing in the original data with preset characters to obtain replacement data; The first processing module is used to process the replacement data based on a preset parsing condition; the preset parsing condition at least includes two preset characters and preset data between the two preset characters.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • DBC file parsing and message analyzing method based on regular expression

    CN108600192A

  • Data transmission method and device, application processing method and device and electronic equipment

    CN115344330A

  • CAN message verification method, apparatus and device, and storage medium

    CN117978891A

  • Method and device for processing vehicle data, analysis equipment and storage medium

    CN118101795A

  • Generation of parsable data for deep parsing

    US20160062965A1