Data processing method and apparatus, and electronic device

By replacing interference factors in CAN messages with preset characters and applying preset parsing conditions, the problem of low CAN message processing efficiency is solved, and more efficient data processing is achieved.

CN119254858BActive Publication Date: 2025-12-12GREAT WALL MOTOR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies are inefficient and cannot process large numbers of CAN messages quickly.

Method used

By replacing the preset factors that cause interference in the original data with preset characters, and using preset parsing conditions to process the replaced data, including two preset characters and preset data located between the two preset characters, the processing efficiency is improved.

Benefits of technology

It improves the efficiency of raw data processing in test data messages, reduces deduplication time, and improves the speed and accuracy of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254858B_ABST
    Figure CN119254858B_ABST
Patent Text Reader

Abstract

Embodiments of the present application are suitable for the technical field of data processing, and provide a data processing method, device and electronic equipment. The method comprises: obtaining original data in test data messages to be processed; replacing preset factors in the original data that interfere with analysis with preset characters to obtain replacement data; processing the replacement data based on preset analysis conditions; and the preset analysis conditions comprise at least two preset characters and preset data between the two preset characters. The above method can improve the processing efficiency of test data messages.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of data processing, and particularly relates to a data processing method and device and electronic equipment. BACKGROUND

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

[0003] At present, the existing data collection equipment and software are usually used to process CAN messages. However, with the increase in complexity of the vehicle system, the amount of CAN message data also increases exponentially. The existing processing methods cannot achieve fast processing of a large amount of CAN messages. SUMMARY

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

[0005] In a first aspect, the embodiments of the present application provide a data processing method, which comprises:

[0006] obtaining original data in test data messages to be processed;

[0007] replacing a preset factor in the original data that interferes with analysis with a preset character to obtain replacement data;

[0008] processing the replacement data based on a preset analysis condition; the preset analysis condition at least contains two preset characters and preset data located between the two preset characters.

[0009] In a second aspect, the embodiments of the present application provide a data processing device, which comprises:

[0010] a first obtaining module configured to obtain original data in test data messages to be processed;

[0011] a replacement module configured to replace a preset factor in the original data that interferes with analysis with a preset character to obtain replacement data;

[0012] a first processing module configured to process the replacement data based on a preset analysis condition; the preset analysis condition at least contains two preset characters and preset data located between the two preset characters.

[0013] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method of the first aspect when executing the computer program.

[0014] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the method of the first aspect.

[0015] In a fifth aspect, a computer program product is provided, which, when executed on an electronic device, causes the electronic device to perform the method of the first aspect.

[0016] Compared with the prior art, the embodiments of the present application have the beneficial effects that: 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 are replaced with preset characters to obtain replacement data. At this time, the replacement data is composed of the original data and special preset characters. Since the original data included between every two preset characters is usually different or only partially the same, it can be considered that the combination of every two preset characters and the original data included therebetween has uniqueness. Based on this, compared with directly processing the original data, the time required for searching and deduplicating the repeated information in the original data, based on the preset analysis condition corresponding to the two preset characters and the preset data located between the two preset characters, directly searching and analyzing the original data, etc., since it has uniqueness, it can be processed without deduplication. Further, the efficiency of processing the original data in the test data message is improved. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

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

[0019] Figure 2 is an implementation flowchart 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 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0022] In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular sequences of steps, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and

[0023] It should be understood that the term "comprising" as used in the specification and in the following claims indicates the presence of the recited features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0024] It should be noted that the information collection process (such as the face image collection process, the fingerprint information collection process, etc.) / feature extraction process involved in the present application is performed with the user's knowledge and permission, i.e., the information collection process / feature extraction process meets the legal and regulatory requirements and does not belong to the act of obstructing public interests.

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

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

[0027] At present, the existing data collection equipment and software are usually used to process CAN messages. However, with the increasing complexity of vehicle systems, the amount of CAN message data also increases exponentially. The existing processing methods cannot achieve fast processing of a large number of CAN messages when facing a large number of CAN messages.

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

[0029] Based on this, in order to improve the 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, notebook computers, ultra-mobile personal computers (UMPC), netbooks, etc. The specific type of the electronic device is not limited in the embodiment of the present application.

[0030] Please refer to Figure 1 , Figure 1 An implementation flowchart of a data processing method provided by the embodiment of the present application is shown, which includes the following steps:

[0031] S101, obtaining original data in a test data message to be processed.

[0032] In an embodiment, the data message is a data unit exchanged and transmitted in a network, i.e. 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 is variable. Generally, the data message includes not only the data to be transmitted, but also necessary additional information. For example, destination IP, destination port, source address, source port, data length, used protocol, encryption, etc. The information is not limited.

[0033] The test data message to be processed is a data message to be sent when a vehicle communicates, and the test data message needs to be processed in the test and development stage. The processing includes, but is not limited to, receiving, sending, parsing, storing, etc. of the test data message, which is not limited.

[0034] It should be noted that the category of the test data message can be a CAN message category, or a LIN (Local Interconnect Network) message category, etc. which is not limited.

[0035] It can be understood that the category of the corresponding test data message is different when the communication bus used on the vehicle is different. In the embodiment, the CAN message is taken as the test data message for the following description.

[0036] In an embodiment, the original data can be data directly read from the test data message, and at this time, the original data has not been parsed. Alternatively, the original data can be data obtained after parsing the directly read data.

[0037] For example, a frame of a message is composed of multiple bytes. In a computer network, 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. The smallest unit of characters that can be read and written by people is called a character set.

[0038] In actual scenarios, characters cannot be directly transmitted 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 test data messages. At this time, the original data can be considered as byte data in the test data message.

[0039] It should be noted that the data message includes not only byte data, but also values required by the message format corresponding to the communication protocol. For example, values corresponding to the start character, control field, data field, checksum, and end character. The value range and specific meaning of the value are usually clearly defined in the communication protocol, and no detailed description is made.

[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 is determined according to the specific communication protocol and application scenario, and contains a variety of possible values and formats.

[0041] In another embodiment, when not decoded, it can not be possible to automatically identify and extract information of the greatest value to the user (such as CAN message time, DLC, and other information). Based on this, in this embodiment, the above-mentioned original data can also be data obtained after decoding the byte data.

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

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

[0044] In the process of analyzing the CAN message data with the same CAN ID, it can be checked whether the data length (DLC) of all CAN bus messages sent by the sender complies with the application layer specification requirements. Generally, this step not only involves recording, comparison, evaluation and loop operation, but also requires a large amount of time and manpower due to the large number of components of the vehicle CAN bus and the large number of test items. Therefore, by testing the test data messages with the same CAN ID, the communication quality and data transmission accuracy of the CAN bus can be ensured, and the failure or paralysis of the entire CAN bus system caused by errors of a node can be avoided.

[0045] As an example, the electronic device can obtain a plurality of test data messages corresponding to the CAN ID to be analyzed from a large number of test data messages as a test data set to be processed, so as to execute the data processing method in the embodiment.

[0046] In another embodiment, the processing (analysis and testing) of the test data message is generally 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 generally a preset fixed format. Therefore, in the development and testing stage, it can be determined whether the test data set needs to be processed according to the file format.

[0047] As a specific example, the electronic device can first obtain the test data set to be processed based on the bus protocol. Then, the file format of the test data set is determined to process the plurality of test data messages based on the file format.

[0048] It can be understood that when the bus protocol is the CAN communication protocol, the obtained test data message is a CAN message; and when the bus protocol is the LIN communication protocol, the obtained test data message is a LIN test data message, which is not limited.

[0049] It should be noted that the test data set generally includes a plurality of test data messages. In an embodiment, the plurality of test data messages included in the test data set can be the test data messages with the same CAN ID as described above, or the test data messages obtained within a preset time period, which is not limited.

[0050] In an embodiment, the file format can be set according to actual conditions, which is not limited. For example, the file format can be an ASC format. The ASC format is a data record format of the CAN bus, which generally stores CAN messages in a text manner and is widely used in the development and testing stage.

[0051] Based on the above description, the electronic device can consider the test data messages contained in the obtained test data set as normal messages when the file format is the preset format. Furthermore, each frame of test data message can be processed in turn. That is, the data processing method in the above embodiment is performed on each frame of data message.

[0052] Otherwise, when the file format is a non-preset format, the test data messages contained in the obtained test data set can be considered as abnormal messages. Furthermore, the processing of the test data set can be stopped. That is, the processing of the test data messages of the test data set is exited.

[0053] S102, replacing the preset factors that interfere with parsing in the original data with preset characters to obtain replacement data.

[0054] In an embodiment, the preset factors that interfere with parsing include but are not limited to spaces, bytes without actual data meaning, etc., without limitation.

[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 check, control or identification bytes. These bytes exist in the test data message, but 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 the present embodiment, the preset factors that interfere with parsing can be considered as spaces. That is, the electronic device can replace the spaces in the original data with preset characters to obtain replacement data.

[0057] Since the bytes in the message need to be parsed later to become characters that can be read and written by people, in order to avoid the inserted characters interfering with the processing of the parsed characters, the above-mentioned preset characters can be special characters other than letters and numbers.

[0058] For example, the above-mentioned preset characters can be punctuation marks, or characters such as "#", without limitation.

[0059] Replacing the preset factors with preset characters can enable the electronic device to more efficiently parse each field in the data message when parsing the test data message later, avoiding the interference of spaces with the parsing work.

[0060] S103, processing the replacement data based on a preset parsing condition.

[0061] In an embodiment, the preset analysis condition comprises 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 CAN ID, and a preset number, without limitation. That is, the preset analysis condition includes preset characters + preset data + preset characters, and the like.

[0062] In another embodiment, the preset analysis condition can also include other preset data outside the two preset characters. At this time, the preset analysis condition can be preset data + preset character + preset data + preset character; or preset character + preset data + preset character + preset data, without limitation.

[0063] As an example, the preset analysis condition includes, but is not limited to, preset characters + Rx + preset characters, preset characters + CAN ID + data state + preset characters, d + preset characters + 8 + preset characters, and the like, without limitation.

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

[0065] And since the original data included between every two preset characters (spaces) is usually different, or only partially the same. Therefore, it can be considered that the combination of the original data included between every two preset characters and has uniqueness in the entire replacement data.

[0066] Based on the above description, when the electronic device determines that the replacement data contains data corresponding to the preset analysis condition, it can be considered that the test data packet contains normal data corresponding to the preset analysis condition. Further, the preset analysis rule corresponding to the preset analysis condition can be used to analyze the replacement data to obtain the first target data.

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

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

[0069] For example, when the preset character +Rx+ preset character does not exist in the replacement data, it can be considered that the test data packet is not the packet obtained from the sender, but a test data packet generated by itself. The electronic device can consider that the data contained in the test data packet generated by itself has been recorded. Therefore, the data in the test data packet can be obtained without data processing. Further, it can be considered that the replacement data does not meet the preset analysis condition, and subsequent processing is not required.

[0070] In addition, when the preset character +Rx+ preset character exists in the replacement data, it can be considered that the test data packet is the packet obtained from the sender. Therefore, it needs to be processed to obtain and detect the data in the test data packet.

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

[0072] Similarly, when the preset character +CAN ID+ data state+ preset character, d+ preset character+8+ preset character and the like do not exist in the replacement data, it can be considered that the test data packet is an abnormal packet. Further, it can be considered that the test data packet does not meet the preset analysis condition, and subsequent processing is not required.

[0073] Otherwise, when the preset character +CAN ID+ data state+ preset character, d+ preset character+8+ preset character and the like exist in the replacement data, it can be considered that the test data packet is a normal packet. Further, it can be considered that the replacement data meets the preset analysis condition, and subsequent processing is required.

[0074] It should be noted that when it is determined that the preset analysis condition is met, the electronic device needs to analyze the replacement data based on the preset analysis rule corresponding to the preset analysis condition to obtain the first target data. For example, when the preset analysis condition corresponding to the preset character +Rx+ preset character, the preset character +CAN ID+ data state+ preset character, d+ preset character+8+ preset character and the like are met, Rx, CAN ID and DLC information in the test data packet are respectively taken as the first target data.

[0075] The DLC information represents the length of the data packet. In the CAN communication protocol, DLC is used to identify the number of bytes of data in the data packet, to assist the electronic device in correctly analyzing the packet content, and to help ensure the integrity and correctness of the data.

[0076] It should be noted that, regardless of the data message, 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 type information. For example, the type information of storing the destination address, the source address, the confirmation / response information, the check value, etc. And the data segment is usually located after the control segment (containing DLC information) representing the byte number of the data segment in the data message.

[0077] Based on this, in order to be able to complete the processing of the test data message, after determining that the replacement data meets the above-mentioned multiple preset analysis conditions, the electronic device can also obtain the data in the data segment and perform a check. Then, when the check passes, the electronic device can analyze the data in the data segment and use it as the first target data.

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

[0079] Otherwise, if the value obtained by analyzing 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 check passes. 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 check the data in the data segment, and in another embodiment, the data in the data segment can also be checked according to the data in the check segment (CRC) in the test data message. The way to check the data in the data segment in this embodiment is not limited.

[0081] In an embodiment, processing the test data message includes but is not limited to analysis, storage, checking, outputting and other processing, which is not limited.

[0082] It should be noted that during the processing, it may be necessary to output the analyzed first target data to an external device. And since the data contained in the data segment of 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 by analyzing the bytes in the data segment is usually in the format of bus data records, which cannot be directly called by the external device or application.

[0084] Based on this, in order to facilitate the calling of external devices or applications, the electronic device can further determine, from the first target data, second target data located in the data segment of the test data packet. Then, the data format of the second target data is converted into an array format for transmission.

[0085] It should be noted that storing and transmitting the second target data in array format can enable the 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 process, thereby simplifying the calling steps.

[0086] In an embodiment, the test data set can include multiple frames of test data packets, and the electronic device can process each frame of test data packet in turn. When the processing of the previous frame of test data packet is completed or the preset parsing condition is not met (i.e., the replacement data does not contain the data corresponding to the preset parsing condition), the electronic device can process the next frame of test data packet, until all test data packets in the test data set are processed.

[0087] It should be noted that the above-mentioned preset parsing condition can have multiple, at this time, for any preset parsing condition, the electronic device can judge in turn whether the replacement data contains the data corresponding to the preset parsing condition. And in the process of judging in turn whether the replacement data contains the data corresponding to each preset parsing condition, if it is determined that the replacement data does not contain the data corresponding to any preset parsing condition, the electronic device can no longer process the preset parsing condition which has not been judged yet, but directly process the next frame of test data packet.

[0088] Further, compared with the way of judging all preset parsing conditions, by using the above-mentioned judgment method, the electronic device can directly end the processing of the test data packet when it detects that the replacement data does not meet any of the above-mentioned preset parsing conditions, thereby improving the processing efficiency of the test data packet.

[0089] In another embodiment, in order to further improve the efficiency of the electronic device in matching and judging the replacement data and the preset parsing condition, the judgment order of the above-mentioned preset parsing condition can also be the same as the order in which the preset data is read in the test data packet.

[0090] Generally, the order in which the data in the data message is read mainly depends on the structure of the data message and the transmission protocol. For example, the structure of the data message is divided into the following segments from the beginning to the end: a frame start segment (used to indicate the beginning of the data message, which usually contains data status), an arbitration segment (used to indicate the priority of the data message, which is usually represented by an 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 the data, the frame start segment is usually read first, and then the arbitration segment, the control segment, the data segment, the CRC segment, the ACK segment, and finally the frame end segment.

[0091] Based on the above description, when determining whether the replacement data meets the preset analysis condition, the preset data in the preset analysis condition can be read in sequence to determine whether the replacement data meets the preset analysis condition. Based on this, it can be quickly determined whether the replacement data meets the preset analysis condition. Further, when it is determined that the preset analysis condition is not met, the subsequent processing of the test data message can be ended in time, and the processing efficiency can be improved.

[0092] For example, 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 under the preset analysis conditions of preset character + Rx + preset character, preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character, etc.

[0093] Based on this, the order of the above-mentioned preset analysis conditions can be in the order of preset character + Rx + preset character, preset character + CAN ID + data status + preset character, d + preset character + 8 + preset character, etc. In addition, when the data in the data segment needs to be checked, the checking order can be after the preset analysis condition corresponding to d + preset character + 8 + preset character.

[0094] Based on the above description, in the embodiment, after obtaining the original data in the test data message to be processed, the preset factors in the original data that interfere with parsing can be replaced with preset characters to obtain replacement data. At this time, the replacement data will be composed of original data and special preset characters. Among them, since the original data included between every two preset characters is usually different, or only partially the same. Therefore, it can be considered that the combination of every two preset characters and the original data contained between them has uniqueness. Based on this, compared to directly processing the original data, the time required to search and remove duplicate information in the original data, based on the preset parsing condition corresponding to the two preset characters and the preset data located between the two preset characters, directly searching and parsing the original data and other processing, since it has uniqueness, it can not need to be removed. Further, improve the efficiency of processing the original data in the test data message.

[0095] In another embodiment, with reference to Figure 2 , Figure 2 is an implementation flowchart of a data processing method provided by another embodiment of the present application. Taking the test data message as a CAN message, the preset parsing condition containing the preset character+Rx+the preset character, the preset character+CAN ID+data state+the preset character, d+the preset character+8+the preset character, and the corresponding preset parsing condition as an example for example description.

[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 CAN message in turn. For example, processing the Nth CAN message, N is greater than or equal to 1. Among them, processing is described below taking CAN message parsing and transmission as an example. Specifically, the CAN message is processed as follows:

[0097] The electronic device can replace the space in the original data with a preset character to obtain replacement data. Then, the electronic device can first determine whether the replacement data contains data corresponding to the first preset parsing condition of the preset character+Rx+the preset character. If the replacement data does not contain data corresponding to the first preset parsing condition, the electronic device can stop judging the preset parsing condition that has not been processed for the CAN message, and process the next frame of CAN message.

[0098] Otherwise, when the data corresponding to the first preset parsing condition is included in the replacement data, the electronic device can again determine whether the data corresponding to a second preset parsing condition of preset characters + CAN ID + data state + preset characters is included in the replacement data. If the data corresponding to the second preset parsing condition is not included in the replacement data, the electronic device can stop determining the preset parsing conditions that are not processed for the CAN message, and process the next frame of CAN message.

[0099] Otherwise, when the data corresponding to the second preset parsing condition is included in the replacement data, the electronic device can again determine whether the data corresponding to a third preset parsing condition of d + preset characters + 8 + preset characters is included in the replacement data. If the data corresponding to the third preset parsing condition is not included in the replacement data, the electronic device can stop determining the preset parsing conditions that are not processed for the CAN message, and process the next frame of CAN message.

[0100] Otherwise, when the data corresponding to the third preset parsing condition is included in the replacement data, it can be determined again whether the number of bytes of the data segment in the CAN message is 0. If the number of bytes is 0, the electronic device can stop determining the preset parsing conditions that are not processed for the CAN message, and process the next frame of 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 second target data, and convert the second target data into an array format. At the same time, when all the above preset parsing conditions are met, the electronic device can also parse the replacement data based on the preset parsing rules corresponding to each of 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, the DLC information in the CAN message corresponding to the third preset parsing condition is obtained, and so on.

[0102] Finally, the electronic device can output the above first target data (including the second target data) to an external device. And it is determined whether there is other unanalyzed CAN message in the test data set. If there is an unanalyzed CAN message, the next frame (N = N + 1) of CAN message is analyzed. Otherwise, it is confirmed that the test data set is parsed and the parsing process is correct, and the external device is informed that the parsing work has been successfully completed.

[0103] Based on the above description, by using the above method, when facing a large amount of test data packets, 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 original data and preset characters. Among them, since the original data included between every two preset characters is usually different or only partially the same. Therefore, it can be considered that the combination of every two preset characters and the original data contained between them has uniqueness. Based on this, compared to directly processing the original data, the time required to search and remove duplicate information in the original data, based on the preset analysis condition corresponding to the two preset characters and the preset data located between the two preset characters, directly searches and analyzes the original data and other processing, since it has uniqueness, it can be unnecessary to perform the de-duplication processing. Further, the efficiency of processing the original data in the test data packet is improved.

[0104] In addition, when judging whether the preset analysis condition is met, the judgment is made according to the order in which the preset data is read, which can improve the judgment efficiency. In addition, when it is determined that the preset analysis condition is not met, the analysis of the next frame of test data packet is directly performed, which can also avoid wasting a lot of time for completely analyzing the test data packet. Based on this, the efficiency of processing the test data packet can be further improved.

[0105] Please refer to Figure 3 , Figure 3 is a structural block diagram of a data processing apparatus provided by an embodiment of the present application. In the embodiment, each module of the data processing apparatus is used to execute each step in the corresponding embodiment. For details, please refer to the related description in the corresponding embodiment of Figures 1 to 2 and Figures 1 to 2 and Figures 1 to 2 . For the sake of illustration, only the parts related to the present embodiment are shown. Referring to Figure 3 , the data processing apparatus 300 can include a first acquisition module 310, a replacement module 320, and a first processing module 330, wherein:

[0106] The first acquisition module 310 is configured to acquire original data in a test data packet to be processed.

[0107] The replacement module 320 is configured to replace a preset factor that interferes with analysis in the original data with a preset character to obtain replacement data.

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

[0109] In an embodiment, the data processing apparatus 300 further includes:

[0110] The second obtaining module is configured to obtain a test data set to be processed transmitted based on a bus protocol, and the test data set comprises a plurality of test data packets.

[0111] The first determining module is configured to determine a file format of the test data set.

[0112] The second processing module is configured to process the plurality of test data packets based on the file format.

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

[0114] If the file format is a preset format, sequentially process each test data packet; if the file format is not the preset format, stop processing the test data set.

[0115] In an embodiment, the replacing module 320 is further configured to:

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

[0117] In an embodiment, the test data packet has a plurality of frames; the first processing module 330 is further configured to:

[0118] If the replacement data contains data corresponding to a preset parsing condition, parse the replacement data using a preset parsing rule corresponding to the preset parsing condition to obtain first target data; if the replacement data does not contain data corresponding to the preset parsing condition, stop processing the test data packet of the current frame and process the test data packet of the next frame.

[0119] In an embodiment, the preset parsing condition has a plurality of preset parsing conditions; the first processing module 330 is further configured to:

[0120] For any preset parsing condition, sequentially determine 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 determining the unprocessed preset parsing condition and process the test data packet of the next frame.

[0121] In an embodiment, the data processing apparatus 300 further comprises:

[0122] The second determining module is configured to determine, from the first target data, second target data located in a data segment of the test data packet.

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

[0124] In an embodiment, the order of determining the preset parsing condition is the same as the order in which the preset data is read in the test data packet.

[0125] It is understood that,Figure 3 The structure block diagram of the data processing apparatus shown in the figure is used to execute Figures 1 to 2 the steps in the corresponding embodiments, and for Figures 1 to 2 the steps in the corresponding embodiments have been explained in detail in the above embodiments, please refer to Figures 1 to 2 and Figures 1 to 2 the related descriptions in the corresponding embodiments, which will not be repeated here.

[0126] Figure 4 is a structure block diagram of an electronic device provided in an embodiment of the present application. As Figure 4 shown, the electronic device 400 of this embodiment comprises a processor 410, a memory 420, and a computer program 430 stored in the memory 420 and executable by the processor 410, for example, a program of a data processing method. The processor 410 implements the steps in the embodiments of the above various data processing methods when executing the computer program 430, for example, S101 to S103 shown in Figure 1 . Alternatively, the processor 410 implements the functions of the modules in the corresponding embodiments when executing the computer program 430, for example, Figure 3 the functions of the modules shown in Figure 3 , please refer to Figure 3 the related descriptions in the corresponding embodiments.

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

[0128] The electronic device 400 can include, but is not limited to, the processor 410 and the memory 420. Those skilled in the art can understand that Figure 4 the electronic device 400 is only an example and does not constitute a limitation on the electronic device 400, and can include more or fewer components than shown, or combine certain components, or different components, for example, the electronic device can also include an input / output device, a network access device, a bus, etc.

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

[0130] The memory 420 can be an internal storage unit of the electronic device 400, for example, a hard disk or a memory of the electronic device 400. The memory 420 can also be an external storage device of the electronic device 400, for example, a plug-in hard disk, a smart memory card, a flash memory card, or the like equipped on the electronic device 400. Further, the memory 420 can include both the internal storage unit and the external storage device of the electronic device 400.

[0131] The 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, and the processor executes the computer program to implement the data processing method in each of the above embodiments.

[0132] The embodiment of the present application provides a computer program product, when the computer program product is executed on the electronic device, so that 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, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A data processing method, characterized by, The method comprises: Obtaining original data in a test data packet to be processed; the test data packet has multiple frames; Replacing preset factors in the original data that interfere with parsing with preset characters to obtain replacement data; Processing the replacement data based on preset parsing conditions; the preset parsing conditions at least include two preset characters and preset data located between the two preset characters; The method further comprises: Obtaining a test data set to be processed based on a bus protocol; the test data set includes multiple frames of the test data packet; Determining a file format of the test data set; Processing multiple frames of the test data packet based on the file format; The processing of the replacement data based on the preset parsing conditions comprises: If the replacement data includes data corresponding to the preset parsing conditions, a preset parsing rule corresponding to the preset parsing conditions is used to parse the replacement data to obtain first target data; If the replacement data does not include data corresponding to the preset parsing conditions, processing of the test data packet of the current frame is stopped, and the test data packet of the next frame is processed; After the preset parsing rule corresponding to the preset parsing conditions is used to parse the replacement data to obtain first target data, the method further comprises: Determining second target data located in a data segment of the test data packet from the first target data; Converting a data format of the second target data into an array format for transmission.

2. The method of claim 1, wherein, The processing of multiple frames of the test data packet based on the file format comprises: If the file format is a preset format, each frame of the test data packet is processed in turn; If the file format is a non-preset format, processing of the test data set is stopped.

3. The method of claim 1, wherein, The replacement of the preset factors in the original data that interfere with parsing with preset characters to obtain replacement data comprises: Replacing spaces in the original data with the preset characters to obtain the replacement data.

4. The method of claim 1, wherein, The preset parsing conditions have multiple; the processing of the replacement data based on the preset parsing conditions further comprises: For any preset parsing condition, it is determined 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 determination of the unprocessed preset parsing condition is stopped, and the test data packet of the next frame is processed.

5. The method according to any one of claims 1 to 4, characterized in that, The determination order of the preset parsing conditions is the same as the order in which the preset data is read in the test data packet.

6. A data processing apparatus, characterized in that, The device comprises: A first obtaining module for obtaining original data in a test data packet to be processed; the test data packet has multiple frames A replacement module for replacing preset factors in the original data that interfere with parsing with preset characters to obtain replacement data; A first processing module for processing the replacement data based on preset parsing conditions; the preset parsing conditions at least include two preset characters and preset data located between the two preset characters; The data processing device further comprises: The second acquisition module is used to acquire the test dataset to be processed based on the bus protocol transmission; the test dataset includes multiple frames of the test data packets; The first determining module is used to determine the file format of the test dataset; The second processing module is used to process multiple frames of the test data packets based on the file format; The first processing module is also used for: If the replacement data contains data corresponding to the preset parsing condition, then the replacement data is parsed using the preset parsing rule corresponding to the preset parsing condition to obtain the first target data; If the replacement data does not contain the data corresponding to the preset parsing condition, then the processing of the test data packet of the current frame is stopped, and the processing of the test data packet of the next frame is started. The data processing device also includes: The second determining module is used to determine, from the first target data, the second target data located in the data segment of the test data message; The conversion module is used to convert the data format of the second target data into an array format for transmission.

7. 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, it implements the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

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

    CN108600192A

  • Communication network system and method of operating same

    US20230388147A1