File processing method and device, electronic equipment and storage medium

By detecting and extracting CAN signals or LIN signals from the on-board network and repackaging them into target messages, the inefficient data analysis caused by the complexity of Ethernet messages is solved, and efficient data analysis is achieved.

CN119211389APending Publication Date: 2024-12-27GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411187739.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In vehicle-mounted networks, when electronic devices perform data analysis, data analysis efficiency is inefficient due to the overly complex Ethernet packets.

Method used

By obtaining the target file, detecting whether the target data frame of CAN signal or LIN signal based on the specified protocol, extracting and re-encapsulating the content of the specified signal, forming the target message so as to directly perform data analysis and avoid analyzing complex Ethernet data .

Benefits of technology

Improve data analysis efficiency, accurately extract and filter CAN and LIN signals in target files, simplifying the data analysis process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211389A_ABST
    Figure CN119211389A_ABST
Patent Text Reader

Abstract

The invention discloses a file processing method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a target file; whether a target data frame exists in the target file or not is detected based on a specified protocol, the target data frame comprises a specified signal, the specified signal is a CAN signal or an LIN signal, and the specified protocol refers to a protocol adopted for packaging the specified signal into the data frame; when it is detected that the target file has the target data frame, extracting the data content of the specified signal from the target data frame; and packaging the data content of the specified signal into a target message. According to the technical scheme provided by the embodiment of the invention, the CAN signal and the LIN signal in the target file can be accurately extracted, irrelevant signals in the target file can be filtered, during subsequent data analysis, data analysis does not need to be carried out on complex Ethernet data (namely the target file), data analysis is directly carried out on the re-packaged target message, and the data analysis efficiency is improved. Therefore, the data analysis efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle networking technology, and in particular to a file processing method, device, electronic device and storage medium. Background Art

[0002] With the development of automotive electronic and electrical architecture, Ethernet has been introduced into automotive networks as a backbone network, and Controller Area Network (CAN) networks are connected via Ethernet. When different CAN networks communicate, the sender needs to encapsulate CAN messages into Ethernet messages, and the receiver needs to extract CAN messages from Ethernet messages.

[0003] In the related art, when analyzing and diagnosing the vehicle network, the electronic equipment needs to read the Ethernet messages uploaded by the vehicle through a packet capture tool (such as Wireshark, Tcpdump), and then perform data analysis on the Ethernet messages.

[0004] In the related art, the Ethernet messages uploaded by vehicles are too complex, resulting in low efficiency in data analysis. Summary of the invention

[0005] The present application proposes a file processing method, device, electronic device and storage medium.

[0006] In a first aspect, an embodiment of the present application provides a file processing method, the method comprising: obtaining a target file; detecting whether a target data frame exists in the target file based on a specified protocol, the target data frame comprising a specified signal, the specified signal being a CAN signal or a LIN signal, and the specified protocol referring to a protocol used to encapsulate the specified signal into a data frame; when it is detected that a target data frame exists in the target file, extracting specified content of the specified signal from the target data frame; and encapsulating the specified content of the specified signal into a target message.

[0007] In a second aspect, an embodiment of the present application provides a file processing device, which includes: a file acquisition module, used to acquire a target file; a data frame detection module, used to detect whether there is a target data frame in the target file based on a specified protocol, the target data frame includes a specified signal, the specified signal is a CAN signal or a LIN signal, and the specified protocol refers to the protocol used to encapsulate the specified signal into a data frame; a content extraction module, used to extract the specified content of the specified signal from the target data frame when it is detected that there is a target data frame in the target file; a data encapsulation module, used to encapsulate the specified content of the specified signal into a target message.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method of the first aspect.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer program instructions are stored. The computer program instructions can be called by a processor to execute the method of the first aspect.

[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when instructions in the computer program product are executed, is used to implement the method of the first aspect.

[0011] Compared with the prior art, the technical solution provided in the embodiment of the present application, after acquiring the target file, detects whether there is a target data frame including a specified signal (CAN signal or LIN signal) in the target file based on the specified protocol. When the existence of the target data frame is detected, the specified content of the specified signal is extracted and repackaged. Since the specified protocol refers to the protocol used to encapsulate the specified signal into a data frame, according to the protocol content of the specified protocol, there are usually some fields in the data frame (such as type fields, subtype fields, etc.) for marking the relevant information of the specified signal. Based on the above fields, it can be accurately detected whether there is a target data frame including the specified signal in the target file. The technical solution of the embodiment of the present application can accurately extract the CAN signal and the LIN signal in the target file, filter out irrelevant signals in the target file, and when performing subsequent data analysis, there is no need to perform data analysis on complex Ethernet data (that is, the target file), but directly perform data analysis on the repackaged target message, thereby improving data analysis efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0013] Figure 1 It is a schematic diagram of the implementation environment provided by the embodiment of the present application.

[0014] Figure 2 It is a flowchart of a file processing method provided by an embodiment of the present application.

[0015] Figure 3 It is a flowchart of a file processing method provided by another embodiment of the present application.

[0016] Figure 4 It is a flowchart of a file processing method provided by another embodiment of the present application.

[0017] Figure 5 It is a block diagram of a file processing device provided by an embodiment of the present application.

[0018] Figure 6 It is a structural block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0019] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0020] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.

[0021] First, the technical terms involved in the embodiments of the present application are introduced.

[0022] Audio Video Transport Protocol (AVTP): used to transmit and exchange audio and video signals in the network to ensure high-quality transmission of audio and video. In the fields of automotive networks, industrial control, etc., it can also be used to transmit CAN signals or LIN signals.

[0023] CAN bus: It is a communication network used to connect various electronic control units in modern cars. It enables various systems inside the car to efficiently transmit and communicate data. Inside the vehicle, the electronic control units connected through the CAN bus include: engine control module, transmission control module, brake system control module, body control module, instrument control module, vehicle infotainment module, etc.

[0024] Local Interconnect Network (LIN) bus: A low-cost serial communication network defined for automotive distributed electronic systems. Inside the vehicle, components connected via the LIN bus include smart sensors, brake devices, and more.

[0025] In response to the problem of low data analysis efficiency when performing data analysis on Ethernet messages in the related art, an embodiment of the present application provides a file processing method. After obtaining the target file, it is detected based on the specified protocol whether there is a target data frame including a specified signal (CAN signal or LIN signal) in the target file. When the target data frame is detected, the specified content of the specified signal is extracted and repackaged. Since the specified protocol refers to the protocol used to encapsulate the specified signal into a data frame, according to the protocol content of the specified protocol, there are usually some fields (such as type fields, subtype fields, etc.) in the data frame for marking the relevant information of the specified signal. Based on the above fields, it can be accurately detected whether there is a target data frame including the specified signal in the target file. The technical solution of the embodiment of the present application can accurately extract the CAN signal and the LIN signal in the target file, filter out irrelevant signals in the target file, and when performing subsequent data analysis, there is no need to perform data analysis on complex Ethernet data (that is, the target file), but directly perform data analysis on the repackaged target message, thereby improving data analysis efficiency.

[0026] In the technical solution provided in the embodiment of the present application, the execution subject of each step can be an electronic device or a vehicle. Among them, the electronic device can be a vehicle diagnostic device or a server. In the embodiment of the present application, only the embodiment of each step is described as a vehicle diagnostic device as an example.

[0027] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment includes an electronic device 100 and a vehicle 200.

[0028] The vehicle 200 includes an in-vehicle network communication system, which includes a CAN bus system, a LIN bus system, and the like. During the operation of the vehicle 200, each electronic control unit connected via the CAN bus system generates a CAN signal, and each component connected via the LIN bus system generates a LIN signal. The above-mentioned CAN signal and LIN signal are usually encapsulated into data frames based on the AVTP protocol and then transmitted on the Ethernet.

[0029] The electronic device 100 includes a data packet parsing tool. In an embodiment of the present application, the electronic device 100 detects whether there is a target data frame including a specified signal (CAN signal or LIN signal) in the target file through the data packet parsing tool. When the target data frame is detected, the specified content of the specified signal is extracted and repackaged to obtain a target message. In this way, the subsequent electronic device 100 can directly perform data analysis on the target message without performing data analysis on complex Ethernet messages, thereby improving data analysis efficiency. Optionally, the electronic device 100 may also include a compression tool, which can compress the target message, effectively reduce the data volume of the target message, and save storage space.

[0030] A wired connection (such as a Universal Serial Bus (USB) cable connection) or a wireless connection (such as a Bluetooth connection) may be established between the vehicle 200 and the electronic device 100 .

[0031] Please refer to Figure 2 , which shows a flow chart of a file processing method involved in an embodiment of the present application. The method includes the following process.

[0032] S201, obtaining a target file.

[0033] The target file is in a specified format, for example, the specified format may be a Packet Capture (PCAP) format. In some embodiments, the target file includes data frames encapsulated based on an Audio Video Transport Protocol (AVTP) format.

[0034] In some embodiments, the electronic device may export the target data packet from the vehicle locally. For example, a communication connection is established between the electronic device and the vehicle, and the target file is obtained through the communication connection. The communication connection may be a wired connection (such as a USB connection) or a wireless connection (such as a Bluetooth connection).

[0035] In other embodiments, the electronic device may obtain the target file from the cloud server. For example, the electronic device sends a file acquisition request to the cloud server, and the file acquisition request may carry a unique identifier of the vehicle (such as a vehicle identification code), and the cloud server returns the corresponding target file according to the file acquisition request.

[0036] S202, detecting whether a target data frame exists in the target file based on a specified protocol.

[0037] The target data frame includes a designated signal, which is a CAN signal or a LIN signal. The designated protocol is a protocol used to encapsulate the designated signal into a data frame.

[0038] The data transmission protocol usually defines the rules and conventions that both parties must follow in data communication (such as the format, sequence, rate of data, and operations such as confirmation or rejection of data transmission, error detection, retransmission control and inquiry), and these rules and conventions ensure the effective and reliable transmission of data. In this embodiment, the designated signal is encapsulated into a data frame according to the designated protocol. According to the protocol content of the designated protocol, there are usually some fields (such as type field, subtype field, etc.) in the data frame for marking the relevant information of the designated signal. Therefore, based on the designated protocol, it can be detected whether the target file contains a target data frame including the designated signal. The specific detection process will be described in the following embodiment.

[0039] S203: When it is detected that the target file has a target data frame, extract the designated content of the designated signal from the target data frame.

[0040] The designated content of the designated signal may include control information and data information. The control information may include signal type, timestamp, data length, etc. The data signal may include various sensor data in the vehicle, vehicle status information, control instructions, etc. The extraction process of the designated content of the designated signal will be described in the following embodiments.

[0041] When it is detected that the target file does not have the target data frame, the subsequent steps are not executed.

[0042] S204, encapsulate the designated content of the designated signal into a target message.

[0043] The protocol used to encapsulate the designated content of the designated signal into the target message is usually different from the designated protocol. The specific encapsulation process will be described in the following embodiments.

[0044] To summarize, the technical solution provided by the embodiment of the present application, after acquiring the target file, detects whether there is a target data frame including a specified signal (CAN signal or LIN signal) in the target file based on the specified protocol. When the existence of the target data frame is detected, the specified content of the specified signal is extracted and repackaged. Since the specified protocol refers to the protocol used to encapsulate the specified signal into a data frame, according to the protocol content of the specified protocol, there are usually some fields in the data frame (such as type fields, subtype fields, etc.) for marking the relevant information of the specified signal. Based on the above fields, it can be accurately detected whether there is a target data frame including the specified signal in the target file. The technical solution of the embodiment of the present application can accurately extract the CAN signal and the LIN signal in the target file, filter out irrelevant signals in the target file, and when performing subsequent data analysis, there is no need to perform data analysis on the complex Ethernet data (that is, the target file), but directly perform data analysis on the repackaged target message, thereby improving data analysis efficiency.

[0045] Please refer to Figure 3 , which shows a flowchart of a file processing method provided by an embodiment of the present application, the method includes the following process. In this embodiment, Figure 2 S202 in the embodiment is replaced by S302-S303.

[0046] S301, obtaining a target file.

[0047] S302, parsing the target file to obtain a parsed file.

[0048] In one embodiment, the electronic device parses the target data packet through the Scapy library. The Scapy library is a powerful and flexible Python library for operating and exploring data packets in computer networks, which includes a large number of data packet processing tools. Specifically, the electronic device parses the target file through a specified function in the Scapy library, and the specified function is an rdpcap function. The target file can be parsed into a Scapy object through the specified function, so that the target file can be further parsed through other data packet processing tools in the Scapy library.

[0049] In another embodiment, the electronic device parses the target data packet through the dpkt library. The dpkt library is also a Python library for network data packet analysis, which provides a simple application programming interface (Application Programming Interface, API) to achieve the capture, parsing and construction of the dui network data packet.

[0050] S303, traversing the parsed file using a preset screening rule to detect whether the parsed file contains a target data frame.

[0051] The preset screening rule is determined based on encapsulation configuration information of the designated signal, where the encapsulation configuration information of the designated signal represents configuration information for encapsulating the designated signal into a data frame according to a designated protocol.

[0052] In some embodiments, the specified protocol is the AVTP protocol, and S303 is implemented as the following sub-steps:

[0053] S3031, detecting whether the data frame included in the target file is an Ethernet data frame.

[0054] Optionally, the electronic device detects whether the type of the target file is a first specified type, if the type of the target file is the first specified type, the data frame included in the target file is an Ethernet data frame, if the type of the target file is not the first specified type, the data frame included in the target file is not an Ethernet data frame. The first specified type is scapy.layers.l2.Ether type.

[0055] S3032: When it is detected that the data frames included in the target file are Ethernet data frames, detect whether a designated data frame exists in the data frames included in the target file.

[0056] The designated data frame is a data frame encapsulated based on the AVTP protocol, and includes data based on the AVTP protocol.

[0057] Optionally, for each data frame included in the target file, the electronic device sequentially reads the type field of the data frame, if the value of the type field of the data frame is a first specified value, then the data frame is a specified data frame, if the value of the type field of the data frame is not the first specified value, then the data frame is not a specified data frame. The type field is type. The first specified value is 0x22f0.

[0058] When it is detected that the data frame included in the target file is not an Ethernet data frame, the subsequent processing steps are not performed.

[0059] S3033: When it is detected that a specified data frame exists in the data frames included in the target file, obtain a subtype of the specified data frame.

[0060] The electronic device reads the subtype field of the specified data frame to obtain the subtype of the specified data frame. The subtype field of the specified data frame is usually located at the first byte of the specified data frame.

[0061] S3034: Determine a designated data frame whose subtype is a time synchronization type as a target data frame.

[0062] The electronic device reads the subtype field of the specified data frame, and if the subtype field of the specified data frame is the second specified value, determines that the subtype of the specified data frame is the time synchronization type, and if the subtype field of the specified data frame is not the second specified value, determines that the subtype of the specified data frame is not the time synchronization type. Optionally, the second specified value is 0x05.

[0063] S304: When it is detected that the target file has a target data frame, extract the designated content of the designated signal from the target data frame.

[0064] The designated content of the designated signal includes control information and data information. Optionally, S304 may include the following sub-steps.

[0065] S3041, read the control information of the designated signal from the header structure of the target data frame.

[0066] The IEEE 1722 data stream in the target data frame includes a header structure and a payload, and the electronic device can read the control information of the specified signal from the header structure. The control information may include a timestamp, data length, signal type of the specified signal, and the like.

[0067] In some embodiments, the electronic device may determine the signal type of the specified signal based on the value of the acf_mag_type field. When the value of the acf_mag_type field is 0x01, the signal type of the specified signal is a CAN signal; when the value of the acf_mag_type field is 0x11, the signal type of the specified signal is a LIN signal. The electronic device may determine the data length of the specified signal based on the value of the acf_mag_length field. The electronic device may obtain the timestamp of the specified signal based on the value of the message_timestamp field.

[0068] S3042, extracting data information of the designated signal from the payload of the target data frame based on the control information of the designated signal.

[0069] Optionally, when the control information of the designated signal includes the signal type and message length of the designated signal, S3042 is specifically implemented as follows: when the signal type of the designated signal is a CAN signal, data information of the designated signal is read from a first designated position of the payload based on the message length; when the designated signal included in the target data frame is a LIN signal, data information of the designated signal is read from a second designated position of the payload based on the message length.

[0070] The first designated position is the starting position of the data information included in the designated signal in the payload when the signal type of the designated signal is a CAN signal. The second designated position is the starting position of the data information included in the designated signal in the payload when the signal type of the designated signal is a LIN signal. Since the starting positions of the data content included in the data frame are different when the signal type of the designated signal is different, the electronic device needs to first determine the signal type of the designated signal to determine the starting position of the data information included in the designated signal in the payload, and then read the content of the determined message length from the above starting position as the data information of the designated signal.

[0071] S305, encapsulate the designated content of the designated signal into a target message.

[0072] The electronic device may use other data transmission protocols different from the specified protocol to encapsulate the specified content of the specified signal into a target message. For example, the electronic device may encapsulate the specified content of the CAN signal into a CAN message based on the CAN protocol. For another example, the electronic device may encapsulate the specified content of the LIN signal into a LIN message based on the LIN protocol.

[0073] Optionally, S305 is implemented as: based on the signal type of the designated signal, determining a structure corresponding to the signal type of the designated signal; encapsulating designated content of the designated signal according to the structure corresponding to the signal type of the designated signal to obtain a target message.

[0074] In some embodiments, the electronic device defines a structure corresponding to the signal type of the specified signal based on the data transmission protocol used to encapsulate the specified content of the specified signal into the target message. In the case where the specified signal is a CAN signal, the data transmission protocol used to encapsulate the specified content of the specified signal into the target message is the CAN protocol, and the structure corresponding to the CAN signal includes a timestamp, an identifier, whether the frame is extended, whether the frame is an error, and the data length. In the case where the specified signal is a LIN signal, the data transmission protocol used to encapsulate the specified content of the specified signal into the target message is the LIN protocol, and the structure corresponding to the LIN signal includes a timestamp, a check field, a data field, and an identifier.

[0075] After the electronic device determines the structure corresponding to the signal type of the specified signal, it assembles the specified content of the specified signal according to the structure corresponding to the signal type of the specified signal to obtain a target message. For example, the electronic device assembles the specified content of the CAN signal according to the structure corresponding to the CAN signal to obtain a CAN message. For another example, the electronic device assembles the specified content of the LIN signal according to the structure corresponding to the LIN signal to obtain a LIN message.

[0076] To summarize, the technical solution provided by the embodiment of the present application, after acquiring the target file, detects whether there is a target data frame including a specified signal (CAN signal or LIN signal) in the target file based on the specified protocol. When the existence of the target data frame is detected, the specified content of the specified signal is extracted and repackaged. Since the specified protocol refers to the protocol used to encapsulate the specified signal into a data frame, according to the protocol content of the specified protocol, there are usually some fields in the data frame (such as type fields, subtype fields, etc.) for marking the relevant information of the specified signal. Based on the above fields, it can be accurately detected whether there is a target data frame including the specified signal in the target file. The technical solution of the embodiment of the present application can accurately extract the CAN signal and the LIN signal in the target file, filter out irrelevant signals in the target file, and when performing subsequent data analysis, there is no need to perform data analysis on the complex Ethernet data (that is, the target file), but directly perform data analysis on the repackaged target message, thereby improving data analysis efficiency.

[0077] Please refer to Figure 4 , which shows a flow chart of a file processing method provided by another embodiment of the present application. The method includes the following process.

[0078] S401, obtaining a target file.

[0079] S402, detecting whether a target data frame exists in the target file based on a specified protocol.

[0080] The target data frame includes a designated signal, the designated signal is a CAN signal or a LIN signal, and the designated protocol refers to a protocol used to encapsulate the designated signal into a data frame.

[0081] S403: When it is detected that the target file has a target data frame, extract the data content of the designated signal from the target data frame.

[0082] S404, encapsulating the data content of the designated signal into a target message.

[0083] S405, compressing the target message according to a preset compression algorithm to obtain a compressed file corresponding to the target message.

[0084] The compressed file corresponding to the target message is a binary data (Binary Logging Format, BLF) file, that is, the data in the compressed file corresponding to the target file is binary data. The preset compression algorithm can be a Huffman Coding compression algorithm or an Arithmetic Coding compression algorithm, which is not limited in the embodiment of the present application.

[0085] The electronic device follows the compression specification of the binary data file to define the compression format string corresponding to the signal type of the specified signal, and then compresses the target message according to the compression format string corresponding to the signal type of the specified signal to obtain a compressed file corresponding to the target message. Among them, the compression specification of the binary data file can be determined based on the standard document provided by Vector. The electronic device compresses the target message according to the compression format string corresponding to the signal type of the specified signal through the packing function in the struct library provided by Python to obtain a compressed file corresponding to the target message.

[0086] On the one hand, the compressed file corresponding to the target message has a smaller data volume than the target message, which can save storage pressure. On the other hand, the compressed file corresponding to the target file can effectively store structured CAN messages or LIN messages. The CAN device can play back and view the compressed file corresponding to the target message, providing important support for subsequent analysis and diagnosis of the vehicle network.

[0087] To sum up, according to the technical solution provided by the embodiment of the present application, after the electronic device extracts the specified signal from the target file and encapsulates it into a target message, it will also compress the target message based on the binary data file compression algorithm. On the one hand, the compressed file corresponding to the target message has a smaller data volume than the target message, which can save storage pressure. On the other hand, the compressed file corresponding to the target file can effectively store structured CAN messages or LIN messages. The CAN device can play back and view the compressed file corresponding to the target message, providing important support for subsequent analysis and diagnosis of the vehicle network.

[0088] Please refer to Figure 5 , which shows a structural block diagram of a file processing device provided by an embodiment of the present application. The device includes: a file acquisition module 510, a data frame detection module 520, a content extraction module 530, and a data encapsulation module 540.

[0089] The file acquisition module 510 is used to acquire a target file.

[0090] The data frame detection module 520 is used to detect whether there is a target data frame in the target file based on the specified protocol. The target data frame includes a specified signal, which is a CAN signal or a LIN signal. The specified protocol refers to the protocol used to encapsulate the specified signal into a data frame.

[0091] The content extraction module 530 is used to extract the designated content of the designated signal from the target data frame when detecting that the target file has the target data frame.

[0092] The data encapsulation module 540 is used to encapsulate the specified content of the specified signal into a target message.

[0093] In some embodiments, the data frame detection module 520 is used to parse the target file to obtain a parsed file; and use preset filtering rules to traverse the parsed file to detect whether there is a target data frame in the target file, and the preset filtering rules are determined based on the encapsulation configuration information of the specified signal, and the encapsulation configuration information of the specified signal represents the configuration information for encapsulating the specified signal into a data frame according to the specified protocol.

[0094] In some embodiments, the designated protocol is the AVTP protocol, and the data frame detection module 520 is used to detect whether the data frame included in the parsed file is an Ethernet data frame; when it is detected that the data frame included in the parsed file is an Ethernet data frame, it is detected whether there is a designated data frame in the data frame included in the parsed file, and the designated data frame includes data based on the AVTP protocol; when it is detected that there is a designated data frame in the data frame included in the parsed file, the subtype of the designated data frame is obtained; and the designated data frame whose subtype is a time synchronization type is determined as a target data frame.

[0095] In some embodiments, the device further includes: a data compression module (not shown in the figure). The data compression module is used to compress the target message according to a preset compression algorithm to obtain a compressed file corresponding to the target message, and the compressed file corresponding to the target message is a binary data file.

[0096] In some embodiments, the signal content of the specified signal includes control information of the specified signal and data information of the specified signal; the content extraction module 530 is used to read the control information of the specified signal from the header structure of the target data frame; and read the data information of the specified signal from the payload of the target data frame according to the control information of the specified signal.

[0097] In some embodiments, the control information of the designated signal includes the message length of the designated signal; the content extraction module 530 is used to read the data information of the designated signal from the first designated position of the payload based on the message length when the designated signal is a CAN signal; and to read the data information of the designated signal from the second designated position of the payload based on the message length when the designated signal is a LIN signal.

[0098] In some embodiments, the data encapsulation module 540 is used to determine a structure corresponding to the signal type of the specified signal based on the signal type of the specified signal; encapsulate the specified content of the specified signal according to the structure corresponding to the signal type of the specified signal to obtain a target message.

[0099] To summarize, the technical solution provided by the embodiment of the present application, after acquiring the target file, detects whether there is a target data frame including a specified signal (CAN signal or LIN signal) in the target file based on the specified protocol. When the existence of the target data frame is detected, the specified content of the specified signal is extracted and repackaged. Since the specified protocol refers to the protocol used to encapsulate the specified signal into a data frame, according to the protocol content of the specified protocol, there are usually some fields in the data frame (such as type fields, subtype fields, etc.) for marking the relevant information of the specified signal. Based on the above fields, it can be accurately detected whether there is a target data frame including the specified signal in the target file. The technical solution of the embodiment of the present application can accurately extract the CAN signal and the LIN signal in the target file, filter out irrelevant signals in the target file, and when performing subsequent data analysis, there is no need to perform data analysis on the complex Ethernet data (that is, the target file), but directly perform data analysis on the repackaged target message, thereby improving data analysis efficiency.

[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0101] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.

[0102] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0103] See also Figure 6 , which shows that the embodiment of the present application further provides an electronic device 600, which includes: one or more processors 610, a memory 620, and one or more applications. Among them, the one or more applications are stored in the memory 620 and are configured to be executed by the one or more processors 610, and the one or more applications are configured to execute the method described in the above embodiment.

[0104] The processor 610 may include one or more processing cores. The processor 610 uses various interfaces and lines to connect various parts of the entire battery management system, and executes various functions and processes data of the battery management system by running or executing instructions, programs, code sets or instruction sets stored in the memory 620, and calling data stored in the memory 620. Optionally, the processor 610 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 610 can integrate one or more combinations of a central processing unit 610 (CPU), a graphics processing unit 610 (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented separately through a communication chip.

[0105] The memory 620 may include a random access memory 620 (Random Access Memory, RAM), and may also include a read-only memory 620 (Read-Only Memory). The memory 620 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the various method embodiments described below, etc. The data storage area may also store data created by the electronic device during use (such as a phone book, audio and video data, chat record data), etc.

[0106] An embodiment of the present application further provides a computer-readable storage medium, in which computer program instructions are stored. The computer program instructions can be called by a processor to execute the method described in the above embodiment.

[0107] The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for computer program instructions for executing any method step in the above method. These computer program instructions may be read from or written to one or more computer program products. The computer program instructions may be compressed in an appropriate form.

[0108] The above are only preferred embodiments of the present application, and are not intended to limit the present application in any form. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technical personnel in the field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present application. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of the technical solution of the present application.

Claims

1. A file processing method, characterized in that: The method comprises: Get the target file; Detecting whether the target file has a target data frame based on a specified protocol, wherein the target data frame includes a specified signal, the specified signal is a CAN signal or a LIN signal, and the specified protocol refers to a protocol used to encapsulate the specified signal into a data frame; In the case where it is detected that the target file has the target data frame, extracting the specified content of the specified signal from the target data frame; Encapsulate the designated content of the designated signal into a target message.

2. The method according to claim 1, characterized in that The detecting whether the target file has a target data frame based on a specified protocol comprises: Parsing the target file to obtain a parsed file; The parsed file is traversed using preset filtering rules to detect whether the target file contains the target data frame, wherein the preset filtering rules are determined based on encapsulation configuration information of the target signal, and the encapsulation configuration information of the target signal represents configuration information for encapsulating the target signal into a data frame according to the specified protocol.

3. The method according to claim 2, characterized in that The designated protocol is the AVTP protocol, and the method of traversing the parsed file using a preset screening rule to detect whether the target file has the target data frame includes: Detecting whether the data frame included in the parsed file is an Ethernet data frame; In the case where it is detected that the data frame included in the parsed file is the Ethernet data frame, detecting whether there is a specified data frame in the data frame included in the parsed file, the specified data frame including data based on the AVTP protocol; In the case where it is detected that the specified data frame exists in the data frames included in the parsed file, obtaining a subtype of the specified data frame; The designated data frame whose subtype is the time synchronization type is determined as the target data frame.

4. The method according to claim 1, characterized in that After encapsulating the data content of the designated signal into a target message, the method further includes: The target message is compressed according to a preset compression algorithm to obtain a compressed file corresponding to the target message, wherein the compressed file corresponding to the target message is a binary data file.

5. The method according to any one of claims 1 to 4, characterized in that: The signal content of the designated signal includes control information of the designated signal and data information of the designated signal; The step of extracting the data content of the designated signal from the target data frame comprises: Reading control information of the designated signal from the header structure of the target data frame; According to the control information of the designated signal, data information of the designated signal is read from the payload of the target data frame.

6. The method according to claim 5, characterized in that The control information of the designated signal includes the message length of the designated signal; The step of reading data information of the designated signal from a payload of the target data frame according to the control information of the designated signal comprises: In a case where the designated signal is the CAN signal, reading data information of the designated signal from a first designated position of the payload based on the message length; In a case where the designated signal is the LIN signal, data information of the designated signal is read from a second designated position of the payload based on the message length.

7. The method according to any one of claims 1 to 4, characterized in that The step of encapsulating the designated content of the designated signal into a target message includes: Based on the signal type of the specified signal, determining a structure corresponding to the signal type of the specified signal; The specified content of the specified signal is encapsulated according to the structure corresponding to the signal type of the specified signal to obtain the target message.

8. A file processing device, characterized in that: The device comprises: File acquisition module, used to acquire target files; A data frame detection module, used for detecting whether the target file has a target data frame based on a specified protocol, wherein the target data frame includes a specified signal, wherein the specified signal is a CAN signal or a LIN signal, and the specified protocol refers to a protocol used to encapsulate the specified signal into a data frame; A content extraction module, configured to extract the specified content of the specified signal from the target data frame when detecting that the target file exists in the target data frame; The data encapsulation module is used to encapsulate the specified content of the specified signal into a target message.

9. An electronic device, characterized in that: include: one or more processors; Memory; One or more applications, wherein one or more of the applications are stored in the memory and configured to be executed by one or more of the processors, and one or more of the applications are configured to execute the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and the computer program instructions can be called by a processor to execute the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Internet of Things general data transmission method and device, and storage medium

    CN119814773A