Vehicle data processing method and device, computer device, and storage medium

By scanning the DBC file to generate a data structure and using the structure pointer variable to process CAN signals, the problem of cumbersome and error-prone vehicle data processing is solved, and efficient and accurate CAN signal reading and writing is achieved.

CN118368281BActive Publication Date: 2026-02-27CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410380607.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-30
Publication Date
2026-02-27
Estimated Expiration
2044-03-30

AI Technical Summary

Technical Problem

In existing technologies, vehicle data processing is cumbersome and error-prone, resulting in low efficiency and accuracy, especially since manual intervention is required when parsing and reading/writing CAN signals.

Method used

By obtaining the DBC file containing the CAN message description information, text scanning is performed to determine the message information, a data structure is generated, and CAN signal data is read and written based on the structure pointer variable, supporting conversion between big-endian and little-endian modes.

Benefits of technology

The vehicle data processing flow has been optimized, improving efficiency and accuracy, reducing manpower and material consumption, lowering production costs, and improving the efficiency and accuracy of signal reading and writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118368281B_ABST
    Figure CN118368281B_ABST
Patent Text Reader

Abstract

The application relates to a vehicle data processing method and device, computer equipment and a storage medium. The method comprises the following steps: obtaining a DBC file carrying CAN message description information; the CAN message is a bit sequence sent by a target vehicle through a CAN network; performing text scanning on the DBC file to determine message information of the CAN message; the message information comprises a current thread mode of each CAN signal in the CAN message; in the case that the current thread mode is a target thread mode, generating a data structure body for the CAN message based on the message information; based on the data structure body, defining a structure body pointer variable, and performing data reading and writing on each CAN signal based on the structure body pointer variable to obtain or modify a signal value of the CAN signal. The method can improve the efficiency and accuracy of signal analysis and signal reading and writing of vehicle data, and is beneficial to the development and application of electric vehicles.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of vehicle signal processing, in particular to a vehicle data processing method, a vehicle data processing device, a computer device, a computer readable storage medium and a computer program product. BACKGROUND

[0002] At present, with the development of network connection and intelligence of the automobile industry, in order to better maintain and manage vehicles, monitor vehicle operating conditions and improve vehicle driving safety, automobile manufacturers generally collect a large number of CAN signals from the CAN (Controller Area Network) bus on the vehicle, and then send the CAN signals in the form of CAN messages to the server through Excel files or DBC files according to industry standard formats, for signal analysis and signal read-write operations.

[0003] However, since the serial number and signal meaning of the CAN signal in each CAN message are manually defined in the code in advance, when the CAN signal needs to be read and written during development, the CAN message needs to be segmented manually for signal analysis and signal read-write, which leads to a very tedious and error-prone development process, thereby existing problems of low efficiency and low accuracy of vehicle data processing. SUMMARY

[0004] To solve the above problems, the present disclosure provides a vehicle data processing method, a vehicle data processing device, a computer device, a computer readable storage medium and a computer program product. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of the embodiments of the present disclosure, a vehicle data processing method is provided, comprising:

[0006] obtaining a DBC file carrying CAN message description information; the CAN message is a bit sequence sent by a target vehicle through a CAN network;

[0007] text scanning the DBC file to determine message information of the CAN message; the message information includes a current end mode of each CAN signal in the CAN message;

[0008] in the case where the current end mode is a target end mode, generating a data structure body for the CAN message based on the message information;

[0009] based on the data structure body, defining a structure body pointer variable to perform data read-write on each CAN signal based on the structure body pointer variable to obtain or modify the signal value of the CAN signal.

[0010] In an example embodiment, the text scanning on the DBC file to determine the message information of the CAN message comprises:

[0011] reading each line of text content in the DBC file, and sequentially determining whether each line of text content corresponds to a preset condition; the preset condition comprises whether the byte length of the text content is 0, whether the text content is line-feeding, and whether the text content comprises a BO field;

[0012] in a case where the text content satisfies the preset condition, determining, from the text content, a message name related to the CAN message, and a signal name, a signal start bit, a signal bit width, and a current endianness mode of a valid CAN signal as the message information;

[0013] wherein the current endianness mode is a big-endian mode or a little-endian mode.

[0014] In an example embodiment, the determining the message information of the CAN message further comprises:

[0015] in a case where the current endianness mode of the CAN signal is the little-endian mode, based on the signal start bit and the signal bit width of the valid CAN signal, calculating a signal start bit, a signal bit width, and a signal end bit of an invalid CAN signal in the CAN message, and taking the signal start bit, the signal bit width, and the signal end bit of the invalid CAN signal as the message information.

[0016] In an example embodiment, after the text scanning on the DBC file to determine the message information of the CAN message, the method further comprises:

[0017] in a case where the current endianness mode of the CAN signal is the big-endian mode, performing a big-endian conversion on the CAN signal to convert the current endianness mode of the CAN signal to the little-endian mode;

[0018] wherein, for a CAN signal in the big-endian mode, the byte bit sequence of the CAN signal in a transversely continuous byte space is discontinuous and the high and low bit directions are opposite;

[0019] for a CAN signal in the little-endian mode, the byte bit sequence of the CAN signal in a transversely continuous byte space is continuous and the high and low bit directions are the same.

[0020] In an example embodiment, the big-endian conversion on the CAN signal to convert the current endianness mode of the CAN signal to the little-endian mode comprises:

[0021] based on the message information, constructing a byte bit sequence mapping table for the CAN signal;

[0022] Based on the byte bit sequence mapping table, the CAN signal is subjected to high-low bit byte symmetry interaction to convert the byte bit sequence of the CAN signal in the transverse continuous byte space into continuous and same high-low bit direction.

[0023] In an exemplary embodiment, the data read-write of each CAN signal based on the structure pointer variable to obtain or modify the signal value of the CAN signal comprises:

[0024] Based on the signal name of the CAN signal pointed to by the structure pointer variable, the signal value read-write of the CAN signal is performed to obtain or modify the signal value of the CAN signal.

[0025] In an exemplary embodiment, after the data read-write of each CAN signal based on the structure pointer variable to obtain or modify the signal value of the CAN signal, further comprising:

[0026] In the case where the CAN signal is converted from the big-endian mode to the little-endian mode, the big-endian and little-endian reverse conversion is performed on the CAN signal to convert the current end mode of the CAN signal to the big-endian mode.

[0027] Based on the C language pointer coercion and memory copy method, the CAN signal subjected to the big-endian and little-endian reverse conversion is packaged to obtain a packaged CAN signal.

[0028] According to a second aspect of the embodiments of the present disclosure, a vehicle data processing apparatus is provided, comprising:

[0029] A file acquisition module is configured to acquire a DBC file carrying CAN message description information; the CAN message is a bit sequence of a CAN signal sent by a target vehicle;

[0030] A text scanning module is configured to perform text scanning on the DBC file to determine message information of the CAN message; the message information includes a current end mode of each CAN signal in the CAN message.

[0031] A structure definition module is configured to, in the case where the current end mode is a target end mode, generate a data structure for the CAN message based on the message information.

[0032] A data read-write module is configured to define a structure pointer variable based on the data structure, and perform data read-write of each CAN signal based on the structure pointer variable to obtain or modify the signal value of the CAN signal.

[0033] According to a third aspect of embodiments of the present disclosure, a computer device is provided, comprising:

[0034] a processor;

[0035] a memory for storing executable instructions of the processor;

[0036] wherein the processor is configured to execute the executable instructions to implement the vehicle data processing method according to any one of the preceding aspects.

[0037] According to a fourth aspect of embodiments of the present disclosure, a computer readable storage medium is provided, the computer readable storage medium comprising program data, when the program data is executed by a processor of a computer device, the computer device is enabled to execute the vehicle data processing method according to any one of the preceding aspects.

[0038] According to a fifth aspect of embodiments of the present disclosure, a computer program product is provided, the computer program product comprising program instructions, when the program instructions are executed by a processor of a computer device, the computer device is enabled to execute the vehicle data processing method according to any one of the preceding aspects.

[0039] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:

[0040] On the one hand, the present scheme first scans the DBC file carrying CAN message description information to obtain message information in the CAN message, and then generates a data structure body for the CAN message based on the message information, and finally defines a structure body pointer variable based on the data structure body to read and write data of the CAN signal, thereby optimizing the vehicle data processing flow, effectively improving the efficiency of vehicle data processing, and reducing the consumption of manpower and material resources. On the other hand, the present scheme is different from the existing vehicle data processing method. In the case that the current end mode of the CAN signal is the target end mode, a data structure body for the CAN message is generated, and the CAN signal is read and written based on the structure body pointer variable corresponding to the data structure body. Therefore, the same data structure body as the structure of the CAN signal can be used to read and write the CAN signal, effectively reducing the production cost of the enterprise, and improving the efficiency and accuracy of signal reading and writing of vehicle data, which is conducive to the development and application of electric vehicles.

[0041] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0042] The accompanying drawings, which are incorporated herein and form a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, further serve to explain the principles of the disclosure without imposing on the disclosure limitations that are inconsistent with the principles of the disclosure.

[0043] Figure 1 is an application environment diagram of a processing method of vehicle data according to an exemplary embodiment.

[0044] Figure 2 is a flowchart of a processing method of vehicle data according to an exemplary embodiment.

[0045] Figure 3 is a flowchart of a text scanning of a DBC file according to an exemplary embodiment.

[0046] Figure 4 is a flowchart of a big-endian / little-endian conversion of a CAN signal according to an exemplary embodiment.

[0047] Figure 5 is a table structure diagram of a byte bit sequence mapping table according to an exemplary embodiment.

[0048] Figure 6 is a table structure diagram of a byte bit sequence mapping table of a CAN signal in a big-endian mode according to an exemplary embodiment.

[0049] Figure 7 is a table structure diagram of a byte bit sequence mapping table of a CAN signal in a little-endian mode according to an exemplary embodiment.

[0050] Figure 8 is a flowchart of a packaging of a CAN signal according to an exemplary embodiment.

[0051] Figure 9 is a structure block diagram of a processing device of vehicle data according to an exemplary embodiment.

[0052] Figure 10 is a block diagram of a computer device for processing of vehicle data according to an exemplary embodiment.

[0053] Figure 11 is a block diagram of a computer readable storage medium for processing of vehicle data according to an exemplary embodiment.

[0054] Figure 12 is a block diagram of a computer program product for processing of vehicle data according to an exemplary embodiment. DETAILED DESCRIPTION

[0055] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.

[0056] The term "and / or" in the embodiments of the present application means any and all possible combinations of one or more of the associated listed items. It should also be noted that when used in the present specification, "comprise / comprising" specifies the presence of stated 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, and / or groups thereof.

[0057] The terms "first", "second", and the like in the present application are used to distinguish different objects, not to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed or can optionally include other steps or units inherent to such processes, methods, products or devices.

[0058] In addition, although the terms "first", "second", and the like are used repeatedly in the present application to describe various operations (or various elements or various applications or various instructions or various data), etc., these operations (or elements or applications or instructions or data) should not be limited by these terms. These terms are only used to distinguish one operation (or element or application or instruction or data) from another operation (or element or application or instruction or data).

[0059] The vehicle data processing method provided by the embodiments of the present application can be applied to an application environment as shown in Figure 1 The terminal 102 communicates with the server 104 through a communication network. The data storage system can store data required by the server 104 to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.

[0060] In some embodiments, reference is made to Figure 1The server 104 acquires a DBC file carrying CAN message description information; the CAN message is a bit sequence sent by a target vehicle through a CAN network; the DBC file is scanned in text to determine message information of the CAN message; the message information includes a current end mode of each CAN signal in the CAN message; in a case where the current end mode is a target end mode, a data structure body for the CAN message is generated based on the message information; based on the data structure body, a structure body pointer variable is defined to read and write data of each CAN signal based on the structure body pointer variable to acquire or modify a signal value of the CAN signal.

[0061] In some embodiments, the terminal 102 (e.g., mobile terminal, fixed terminal) can be implemented in various forms. The terminal 102 can be a mobile terminal including, for example, a mobile phone, a smart phone, a notebook computer, a portable handheld device, a personal digital assistant (PDA), a tablet computer (PAD), and the like, and can also be a fixed terminal such as an automated teller machine (ATM), an automatic integrated machine, a digital TV, a desktop computer, a stationary computer, and the like.

[0062] Hereinafter, it is assumed that the terminal 102 is a fixed terminal. However, those skilled in the art will appreciate that the configuration according to the embodiments of the present disclosure can also be applied to a mobile type terminal 102 if there are operations or elements specifically for mobile purposes.

[0063] In some embodiments, the data processing component running on the server 104 can load any of various additional server applications and / or middleware applications that can be included, such as HTTP (HyperText Transfer Protocol), FTP (File Transfer Protocol), CGI (Common Gateway Interface), RDBMS (Relational Database Management System), and the like, which are being executed.

[0064] In some embodiments, the server 104 can be implemented as a stand-alone server or a server cluster composed of multiple servers. The server 104 can be adapted to run one or more application services or software components of the terminal 102 described in the foregoing disclosure.

[0065] In some embodiments, the operating system on which the application services or software components run can include various versions of Microsoft Windows®, Apple Macintosh® and / or Linux operating systems, various commercial or UNIX®-like operating systems (including, but not limited to, various GNU / Linux operating systems, Google Chrome® OS, and the like), and / or mobile operating systems such as iOS®, Windows® Phone, Android® OS, BlackBerry® OS, Palm® OS operating systems, and other online or offline operating systems, without limitation.

[0066] In some embodiments, as shown in FIG. 1, a method for processing vehicle data is provided, which is applied to the server 104 in FIG. 1 as an example, and the method comprises the following steps. Figure 2 Figure 1 In some embodiments, as shown in FIG. 1, a method for processing vehicle data is provided, which is applied to the server 104 in FIG. 1 as an example, and the method comprises the following steps.

[0067] Step S11: Obtain a DBC file carrying CAN message description information.

[0068] In an embodiment, the CAN message is a bit sequence used to describe a CAN signal sent by a target vehicle.

[0069] In an embodiment, the DBC file is a file used to carry Controller Area Network (CAN) message description information. In the automotive industry and other fields, CAN bus is a commonly used communication protocol for communication between control units.

[0070] In an embodiment, the DBC file contains information such as messages, signals, nodes, and communication rates used in the CAN network, so as to exchange and communicate data between different devices.

[0071] Step S12: Text scan the DBC file to determine message information of the CAN message.

[0072] In an embodiment, the message information includes message name of the CAN message, signal ID of the CAN signal, number of signals (including valid / invalid signals), signal start bit, signal sequence, signal bit width, and signal size end mode.

[0073] In an embodiment, the signal size end mode is the current end mode of each CAN signal in the CAN message, and the current end mode includes big-endian mode and little-endian mode.

[0074] ​In some embodiments, the data storage for the CAN signal in the computer can adopt different Endianness, including Big Endian and Little Endian.

[0075] For a Little Endian system, the least significant byte of the data is stored at the lowest address, and the most significant byte of the data is stored at the highest address. Therefore, if it is said that "the high bits of the CAN signal are stored in the low bits of the low byte of the memory", it means that the high bit data (such as the bit with the higher starting bit) of the CAN signal is stored in the low bit (i.e. the low bit in the byte) of the low byte (i.e. the low address) of the memory. This means that for the data of the CAN signal, the storage order in the memory is stored in the Little Endian.

[0076] In some embodiments, the server can perform the following steps on the DBC file in sequence to scan the message information: first, file reading is performed on the DBC file, such as using the file reading function in a programming language (such as C, Python, etc.), to open and read the DBC file, so as to read the content of the DBC file into a data structure in the memory, for subsequent text scanning and analysis; then, text scanning is performed, that is, the content of the read DBC file is scanned line by line, and in the scanning process, a regular expression can be used to match the definition of the CAN message to determine the message information of the CAN message; then, the message information of the CAN message is determined, that is, in the scanning process, the line containing the CAN message definition can be found, which usually starts with "BO_" followed by the ID, name and length of the CAN message, so that by matching these lines, the message information of each CAN message can be determined, including the message ID, message name, message length, etc.; finally, the message information is extracted, that is, after the message information of the CAN message is determined, these information can be extracted and stored in a data structure in the memory for subsequent processing and analysis, for example, the extracted message information can be output to the console or saved to a file for viewing or further processing. In addition, the DBC file can be continuously scanned, that is, after the message information of the CAN message is determined, the DBC file can be continuously scanned to find other information, such as signal definition, node definition, etc., for example, other information in the DBC file can be scanned and extracted as needed to obtain complete CAN network information.

[0077] Step S13: In the case where the current thread mode is the target thread mode, generating a data structure body for the CAN message based on the message information.

[0078] In some embodiments, if the current endianness mode of the CAN signal is the target endianness mode (e.g., little-endian mode), the server directly generates the data structure body for the CAN message; if the current endianness mode of the CAN signal is not the target endianness mode (e.g., big-endian mode), the server first converts the current endianness mode of the CAN signal to the target endianness mode, and then generates the data structure body for the CAN message.

[0079] The data structure body of the CAN message is a data structure used to describe signal information in CAN communication. In CAN communication, data is transmitted through signals, and each signal has its own name, start bit, length, factor, offset, etc. attributes to describe the meaning and value conversion rule of the signal. In some embodiments, the data structure body corresponding to the CAN message can contain the following information:

[0080] Signal name: describes the name of the signal, usually a string.

[0081] Start bit (Start Bit): the start bit of the signal in the CAN data frame.

[0082] Length (Length): the bit length of the signal.

[0083] Factor (Factor): a factor used to convert the signal value to the actual physical value.

[0084] Offset (Offset): an offset used to convert the signal value to the actual physical value.

[0085] By defining the data structure body corresponding to the CAN message, the signal information in CAN communication can be better organized and managed, and the CAN data can be easily parsed and processed by the program. In actual embedded system development, the data structure body corresponding to the CAN signal is usually used to describe various state and parameter information of the vehicle, so that the system can accurately parse and process the CAN data.

[0086] In some embodiments, the server can use the data type coercion of the C language to parse each CAN message according to the message information of each CAN message and the pre-defined data structure body definition, to generate the C language data structure body of each CAN message.

[0087] The process of parsing the CAN message using data type coercion is as follows: using an automated script, identifying the signal description field according to the key feature string, and then using special characters to cut the signal description field into individual basic information fields according to the field description structure characteristics, to generate the data structure body of each CAN message. The data structure body of the CAN message is the same as the data structure of the CAN message.

[0088] In an exemplary embodiment, the data structure of a CAN message can be represented by characters as follows:

[0089] typedef union

[0090] {

[0091] uint64 raw;

[0092] struct{

[0093] uint32 Pad52:12;

[0094] uint32 BMS_SOC:10;

[0095] uint32 BMS_BattCurr:14;

[0096] uint32 Pad14:14;

[0097] uint32 BMS_BattVolt:14;

[0098] }sig;

[0099] }BMS_104_t;

[0100] In the above data structure, a CAN signal named BMS_104_t is included.

[0101] In an embodiment, a CAN message is a data unit transmitted on a CAN bus, containing information such as the sender's identifier, control field, data field, and check field. A CAN message can carry one or more CAN signals. A CAN signal is a data segment in a CAN message that represents specific information or parameters. A CAN message can contain multiple CAN signals, each with its own start bit, length, data type, and value range.

[0102] In practical applications, CAN signals are often used to represent sensor data, actuator control commands, and other specific information. CAN messages carry one or more CAN signals to achieve data exchange and communication between different control units. By analyzing the CAN signals in the CAN message, the receiving end can obtain the specific data content sent by the sending end, thus realizing real-time communication and data exchange between systems.

[0103] In the above signal structure, the combination of union and struct is used to represent the data structure of a CAN signal. The meanings of each part in the data structure are as follows:

[0104] The line "typedef union {...} BMS_104_t" defines a union type named BMS_104_t to represent the data structure of the CAN signal.

[0105] The union contains a member named raw, which is a 64-bit unsigned integer, to store the entire CAN signal data.

[0106] The union also contains a structure named sig, which is used to decompose the CAN signal bit by bit, allowing each field to be accessed individually.

[0107] Within the structure, the following fields are defined:

[0108] The field "uint32 Pad52:12" is named Pad52 and occupies 12 bits, representing specific data.

[0109] The field "uint32 BMS_SOC:10" is named BMS_SOC and occupies 10 bits, representing specific data.

[0110] The field "uint32 BMS_BattCurr:14" is named BMS_BattCurr and occupies 14 bits, representing specific data.

[0111] The field "uint32 Pad14:14" is named Pad14 and occupies 14 bits, representing specific data.

[0112] The field "uint32 BMS_BattVolt:14" is named BMS_BattVolt and occupies 14 bits, representing specific data.

[0113] Through the above structure definition, a 64-bit integer data can be split into different fields by bits, facilitating the parsing operation and read-write processing of each part of the CAN signal.

[0114] Step S14: Based on the data structure, define a structure pointer variable to read and write data based on the structure pointer variable to obtain or modify the signal value of the CAN signal.

[0115] In an embodiment, the server can use data structure body variables and structure pointer variables to access elements in the data structure body to read and write CAN signals in each CAN message to complete the acquisition or modification of signal values in the CAN signals. In the process of reading and writing the CAN signals, the CAN signals are parsed, and the CAN signals can also be packaged after parsing the CAN signals.

[0116] In Controller Area Network (CAN) bus communication, the parsing and packaging of CAN signals refers to the process of extracting CAN signals from CAN messages or packaging CAN signals into CAN messages.

[0117] Specifically, the parsing of CAN signals: when a CAN message is received, the CAN signals in it need to be parsed to obtain the specific information contained therein. CAN signal packaging: when sending a CAN message, the CAN signals to be sent need to be packaged into the CAN message so that the receiving end can correctly parse and process. Through the parsing and packaging of CAN signals, accurate and reliable transmission of data between different nodes can be achieved, and real-time communication and data exchange between systems can be achieved.

[0118] In some embodiments, the server reads and writes data for each CAN signal based on the structure pointer variable, including reading and writing signal values for the CAN signal based on the signal name of the CAN signal pointed to by the structure pointer variable to obtain or modify the signal values of the CAN signal.

[0119] In an exemplary embodiment, when the server processes the BMS_BattVolt signal in the CAN message with a signal name of "0x104", it can first determine whether to perform big-endian conversion according to the scanning result of the DBC, then define a structure pointer variable bms for it, and finally perform a forced type conversion instruction bms=(BMS_104_t)can when parsing the CAN message to complete the parsing of the CAN signal (only one statement is required). At this time, the signal BMS_BattVolt can be read and written through the element variable name bms→BMS_BattVolt in the data structure body, and other CAN signals can be read and written in a similar manner.

[0120] In which, the reading and writing of CAN signals can obtain the signal values of the corresponding CAN signals through the signal names of the scanned CAN signals, and modify the signal values.

[0121] If the signal matrix of the CAN signal needs to be changed after the reading and writing of the CAN signal is completed, the server can first receive a new DBC file to parse the message information of each CAN message in the new DBC file, then generate a new data structure body of each CAN message, and change the signal matrix by using the new data structure body.

[0122] In the process of processing the vehicle data, in one aspect, the scheme optimizes the processing flow of the vehicle data, effectively improves the efficiency of the vehicle data processing, and reduces the consumption of manpower and material resources, by first performing text scanning on the DBC file carrying the CAN message description information to obtain the message information in the CAN message, then generating the data structure body for the CAN message based on the message information, and finally defining the structure body pointer variable based on the data structure body to perform data reading and writing on the CAN signal.

[0123] As can be understood by those skilled in the art, in the above method of the specific embodiment, the disclosed method can be implemented in a more specific manner. For example, the above-described implementation of the server defining the structure body pointer variable based on the data structure body to perform data reading and writing on each CAN signal based on the structure body pointer variable to obtain or modify the signal value of the CAN signal is merely illustrative.

[0124] In an exemplary embodiment, referring to Figure 3 , Figure 3 is a flowchart of an embodiment of the present application for text scanning on the DBC file. In step S12, i.e., the process of the server performing text scanning on the DBC file to determine the message information of the CAN message, specifically includes the following steps:

[0125] Step 1: Read the text content of each line in the DBC file to determine whether the corresponding text content of each line meets the preset condition in turn.

[0126] The preset condition includes whether the byte length of the text content is 0, whether the text content is line feed, and whether the text content includes the BO field.

[0127] Specifically, the server starts from the first line of text content in the DBC file and reads each line of text content in sequence to determine whether the byte length of the corresponding line of text content is 0, whether the text content needs to be wrapped, and whether the text content includes a BO field. If the byte length of the text content is 0, the scanning of the line of text content is immediately ended. Further, if the byte length of the text content is not 0, if the text content needs to be wrapped, the current line is immediately skipped, and the next line of text content is scanned. Further, if the text content does not need to be wrapped, if the text content includes a BO field, the message signal of the previous line is recorded first, the text is cut by spaces, the second end is taken as the signal name, and after completion, the current line is skipped to scan the next line of text content. If the text content does not need to be wrapped, if the text content does not include a BO field, the text is cut by spaces in sequence, the first segment is taken as the signal name, the third segment is cut by “|” to obtain a sub-segment, the sub-segment 0 is taken as the signal start bit, the sub-segment 2 is cut by “@” to obtain the bit width, the signal information is recorded, and after completion, the current line is skipped to scan the next line of text content.

[0128] Step two: in the case that the text content meets the preset condition, the message name about the CAN message and the signal name, the signal start bit, the signal bit width, and the current end mode about the valid CAN signal are determined from the text content as message information.

[0129] For example, part of the file content of a DBC file is as follows.

[0130] The file content for the CAN message “BMC_104” is as follows.

[0131] BO_260 BMS_104: 8 GW_TBOX

[0132] SG_BMS_BattVolt : 7 | 14@0-- (0.1,0) [0 | 1000] “V” TBOX

[0133] SG_BMS_BattCurr : 27 | 14@0+ (0.1,-400) [-400 | 1000] “A” TBOX

[0134] SG_BMS_SOC : 45 | 10@0+ (0.1,0) [0 | 100] “%” TBOX

[0135] The file content for the CAN message “BMC_109” is as follows.

[0136] BO_265 BMS_109: 8 GW_TBOX

[0137] SG_BMS_ChgStatus_T_BOX : 9 | 2@0+ (1,0) [0 | 3] " " TBOX

[0138] SG_BMS_CC2Sta : 27 | 2@0+ (1,0) [0 | 3] " " TBOX

[0139] SG_BMS_OncConst : 34 | 3@0+ (1,0) [0 | 7] " " TBOX

[0140] For the above two CAN messages (BMC_104 and BMS_109), each of the CAN messages starts with the string "BO_" field, and a line is directly empty between the two CAN messages, indicating the end of the CAN message. Among them, the current end mode of the CAN message includes big-endian mode (indicated by character 0) or little-endian mode (indicated by character 1).

[0141] In an embodiment, for the CAN message "BMC_104" (the CAN message "BMC_109" is similar), "BMS_104" in the first string indicates that the message comes from the BMS, and the message name is "0x104", respectively; "BMS_BattVolt" in the second string, "BMS_BattCurr" in the third string and "BMS_SOC" in the fourth string respectively indicate the signal names of the three effective CAN signals in the CAN message; "7" in the second string indicates that the starting bit of the CAN signal "BMS_BattVolt" is 7, "27" in the third string indicates that the starting bit of the CAN signal "BMS_BattCurr" is 27, and "45" in the fourth string indicates that the starting bit of the CAN signal "BMS_SOC" is 45; "14" in the second string indicates that the bit width of the CAN signal "BMS_BattVolt" is 14, "14" in the third string indicates that the bit width of the CAN signal "BMS_BattCurr" is 14, and "10" in the fourth string indicates that the bit width of the CAN signal "BMS_SOC" is 10; "0" in the second string indicates that the current end mode of the CAN signal "BMS_BattVolt" is big-endian mode, "0" in the third string indicates that the current end mode of the CAN signal "BMS_BattCurr" is big-endian mode, and "0" in the fourth string indicates that the current end mode of the CAN signal "BMS_SOC" is big-endian mode.

[0142] In the DBC file, the information of the invalid signal is not defined, and thus the start bit and the width of the invalid signal need to be calculated according to the information of the valid signal. Therefore, in an embodiment, after the server determines the signal information of the valid CAN signal from the text content, the signal information of the invalid CAN signal can be further determined by using the signal information of the valid CAN signal, which specifically includes: in the case that the current endianness mode of the CAN signal is the little-endian mode, the start bit, the bit width and the end bit of the invalid CAN signal in the CAN message are calculated based on the start bit and the bit width of the valid CAN signal, and the start bit, the bit width and the end bit of the invalid CAN signal are taken as the message information.

[0143] For example, in the BMS_104 message, the start bit of the BMS_BattVolt signal is 7, the bit width is 14, the start bit of the BMS_BattCurr signal is 27, and the bit width is 14, and thus the start bit of the intermediate interval is 9, and the signal with the bit width of 14 is the invalid CAN signal. Therefore, the start bit, the bit width and the end bit of the invalid CAN signal can be calculated by using the signal information of the valid CAN signal, and the start bit is 9, the bit width is 14 and the end bit is 23.

[0144] In some embodiments, the CAN signal is a bit-oriented signal network, the supported signal bit width is 1-64 bits, and the Motorola LSB (Motorola / Big Endian) format is generally used for transmission, and the computing unit of the software system and the chip processing the CAN signal is byte-oriented, and the Intel (Intel / Little Endian) format is generally used. Therefore, before the server reads and writes the CAN signal, data format conversion is generally involved.

[0145] Specifically, after step S12, that is, after the server performs text scanning on the DBC file to determine the message information of the CAN message, the following steps are further included: in the case that the current endianness mode of the CAN signal is the big-endian mode, the big-endian conversion of the CAN signal is performed to convert the current endianness mode of the CAN signal to the little-endian mode.

[0146] In an exemplary embodiment, refer to Figure 4 , Figure 4 The flowchart of an embodiment of the big-endian conversion of the CAN signal in the present application is shown, that is, the big-endian conversion of the CAN signal by the server to convert the current endianness mode of the CAN signal to the little-endian mode, which specifically includes the following steps:

[0147] Step a1: based on the message information, a byte bit sequence mapping table for the CAN signal is constructed.

[0148] Specifically, the server can use the bit field feature of the C language data structure body and the data type coercion manner to establish a byte bit sequence mapping table for each CAN message according to the message information of each CAN message.

[0149] Referring to Figure 5 , Figure 5 is a table structure diagram of an embodiment of the byte bit sequence mapping table in the present application. The byte bit sequence mapping table is a 64-bit byte bit sequence mapping table, that is, the data of the valid CAN signal and the invalid CAN signal in a CAN message is stored in a format by 64 bytes.

[0150] Among them, for the CAN signal in the big-end mode, the byte bit sequence of the CAN signal in the transverse continuous byte space is discontinuous and the high and low bit directions are opposite; for the CAN signal in the little-end mode, the byte bit sequence of the CAN signal in the transverse continuous byte space is continuous and the high and low bit directions are the same.

[0151] Step a2: based on the byte bit sequence mapping table, the high and low bit bytes of the CAN signal are symmetrically exchanged to convert the byte bit sequence of the CAN signal in the transverse continuous byte space into continuous and the same high and low bit directions.

[0152] Referring to Figure 6 , Figure 6 is a table structure diagram of an embodiment of the byte bit sequence mapping table of the CAN signal in the big-end mode in the present application. Among them, in the case that each CAN signal (including the valid CAN signal and the invalid CAN signal) is in the big-end mode, each CAN signal can be stored across bytes, and the high bit of each CAN signal is stored in the low bit of the low byte of the memory, and the low bit of each CAN signal is stored in the high bit of the high byte of the memory. For example, the byte bit sequence mapping table in the figure contains 3 signals, that is, the bit sequence numbers "0-7" and "10-15" are the first valid CAN signal, the bit sequence numbers "24-27", "32-39" and "46-47" are the second valid CAN signal, and the bit sequence numbers "40-45" and "52-55" are the third valid CAN signal, and the remaining bit sequence numbers are the bit sequence numbers occupied by the invalid CAN signal.

[0153] Among them, byte (Byte) and bit (Bit) are units of measuring data storage capacity and transmission rate, and they have the following relationship: Bit: It is the smallest unit of data in a computer, which can only represent two states of 0 or 1. In digital electronic devices, all data is stored and transmitted in the form of bits. Byte: Usually composed of 8 bits, it is a commonly used data storage unit in computers. A byte can represent 256 different states (2828), so it can be used to represent more complex data such as characters, integers, etc. Therefore, one byte is equal to 8 bits. In computers, data is usually stored and transmitted in bytes, while bits are used to represent the smallest unit of data.

[0154] In an embodiment, if the storage format of each CAN signal in the byte bit sequence mapping table of the CAN signal in the big-endian mode is converted into a continuous horizontal byte, it can be found that the byte bit sequence of the CAN signal in the horizontal continuous byte space is not continuous and the high and low bits are opposite. Therefore, the signal storage format needs to be converted to make the signal continuous in the horizontal continuous byte, so that the CAN message can be parsed using the data type coercion method of C language.

[0155] In an exemplary embodiment, when each CAN signal in the CAN message is in big-endian mode, the server can perform big-endian conversion on each CAN signal to parse the start bit, bit width and end bit of the valid / invalid signal in each CAN signal.

[0156] Among them, the big-endian conversion is used to reverse the byte bit sequence of the CAN signal, so that the bit sequence of the CAN signal is continuous and increasing, so that the start bit and end bit of the invalid signal can be calculated.

[0157] Among them, the process of big-endian conversion is: high and low byte symmetric interaction (that is, in the byte bit sequence mapping table, the bit sequence number at "0" bit is symmetrically interacted with the bit sequence number at "7" bit, the bit sequence number at "1" bit is symmetrically interacted with the bit sequence number at "6" bit, the bit sequence number at "2" bit is symmetrically interacted with the bit sequence number at "5" bit, the bit sequence number at "3" bit is symmetrically interacted with the bit sequence number at "4" bit), to realize the continuous storage of the CAN signal in the horizontal continuous bit format and the correct high and low bits.

[0158] As above Figure 6As shown, the starting bit of the BMS_BattVolt signal is 7, and its bit width is 14. Therefore, the starting bit of the next signal, BMS_BattCurr, is 27, and its bit width is 14. Thus, it's impossible to calculate how many bits are occupied by the invalid signal in the middle. Therefore, after endianness conversion, the starting bit of the BMS_BattVolt signal is 0, and its bit width is 14, allowing us to deduce that its ending bit is 13. Furthermore, the starting bit of the BMS_BattCurr signal is 28. Therefore, the invalid signal between BMS_BattVolt and BMS_BattCurr starts at 14, ends at 27, and has a bit width of 14.

[0159] See Figure 7 , Figure 7 This is a table structure diagram of an embodiment of the byte bit order mapping table for CAN signals in little-endian mode in this application. Figure 7 As shown, it is displayed as a byte bit order mapping table after the CAN signal has undergone endianness conversion. Among them, as... Figure 7 After swapping the positions of the high and low bytes, all the signals appear continuous in the horizontal continuous byte space, and the high and low bytes are correct.

[0160] The CAN signals parsed from the BMS_104 message are as follows:

[0161] BMS_BattVolt signal: start bit 0, bit width 14, stop bit 13;

[0162] PAD14 (Invalid signal): Start bit 14, bit width 14, stop bit 27;

[0163] BMS_BattCurr signal: start bit 28, bit width 14, stop bit 41;

[0164] BMS_SOC signal: start bit 42, bit width 10, stop bit 51;

[0165] PAD52 (Invalid signal): Start bit 52, bit width 12, stop bit 63.

[0166] In one exemplary embodiment, see Figure 8 , Figure 8 This is a flowchart illustrating one embodiment of the CAN signal encapsulation in this application. Following step S14, i.e., after the server reads and writes data to each CAN signal based on the structure pointer variable to obtain or modify the signal value of the CAN signal, the following steps are further included:

[0167] Step b1: When the CAN signal is converted from big-endian mode to little-endian mode, perform a reverse big-endian conversion on the CAN signal to convert the current endian mode of the CAN signal to big-endian mode.

[0168] Specifically, before encapsulating the CAN signal, the server also needs to determine whether to perform endianness conversion on the CAN signal. If the CAN signal was converted from big-endian to little-endian during the initial parsing stage, then the CAN signal will be converted from big-endian to big-endian before encapsulation. If the CAN signal was in little-endian mode during the initial parsing stage, i.e., the CAN signal has not undergone endianness conversion, then no endianness conversion will be performed on the CAN signal before encapsulation.

[0169] Step b2: Based on the pointer type casting and memory copying method in C language, the CAN signal after endianness conversion is encapsulated to obtain the encapsulated CAN signal.

[0170] In some embodiments, assuming that the CAN message pointed to by the CAN signal structure pointer variable bms has been set, the server first defines a character pointer char *can, and uses this character pointer to point to the CAN signal structure can = (char *)bms. Then, the CAN signal encapsulation is completed by performing data encapsulation on the memory space pointed to by the can pointer.

[0171] In some embodiments, the server can also encapsulate CAN signal data by creating a function. This function first copies the CAN signal data to be encapsulated into a data structure and then returns the encapsulated CAN signal data. The server obtains the encapsulated CAN signal data by calling this function in the main program and passing in the CAN signal data to be encapsulated.

[0172] In this way, on the one hand, this solution first scans the DBC file carrying CAN message description information to obtain the message information in the CAN message, then generates a data structure for the CAN message based on the message information, and finally defines a structure pointer variable based on the data structure to read and write data on the CAN signal. This optimizes the vehicle data processing flow, effectively improves the efficiency of vehicle data processing, and reduces the consumption of manpower and material resources. On the other hand, this solution differs from existing vehicle data processing methods by generating a data structure for the CAN message when the current endpoint mode of the CAN signal is the target endpoint mode. Data reading and writing of the CAN signal is then performed based on the structure pointer variable corresponding to the data structure. This allows the reading and writing of the CAN signal to be completed using a data structure with the same structure as the CAN signal, effectively reducing the production cost of enterprises and improving the efficiency and accuracy of signal parsing and signal reading and writing of vehicle data, which is beneficial to the development and application of electric vehicles.

[0173] It should be understood that, although Figures 2-8 The steps in the accompanying diagrams are shown sequentially as indicated by the arrows; however, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order in which these steps are performed, and they can be performed in other orders. Furthermore, Figures 2-8 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.

[0174] It is understood that the same / similar parts between the various embodiments of the methods described above in this specification can be referred to each other. Each embodiment focuses on the differences from other embodiments, and relevant parts can be referred to the description of other method embodiments.

[0175] Figure 9 This is a structural block diagram of a vehicle data processing device provided in an embodiment of this application. (Refer to...) Figure 9 The vehicle data processing device 10 includes: a file acquisition module 11, a text scanning module 12, a structure definition module 13, and a data reading and writing module 14.

[0176] The file acquisition module 11 is used to acquire a DBC file carrying CAN message description information; the CAN message is a bit sequence sent by the target vehicle through the CAN network.

[0177] The text scanning module 12 is used to perform text scanning on the DBC file to determine the message information of the CAN message; the message information includes the current thread mode of each CAN signal in the CAN message.

[0178] The structure definition module 13 is used to generate a data structure for the CAN message based on the message information when the current thread mode is the target thread mode.

[0179] The data read / write module 14 is used to define a structure pointer variable based on the data structure, and to read / write data on each of the CAN signals based on the structure pointer variable, so as to obtain or modify the signal value of the CAN signal.

[0180] In one embodiment, in the aspect of performing text scanning on the DBC file to determine the message information of the CAN message, the vehicle data processing device 10 is further configured to perform:

[0181] reading the text content of each line in the DBC file, and sequentially determining whether the corresponding text content meets a preset condition; the preset condition includes whether the byte length of the text content is 0, whether the text content is line- broken, and whether the text content includes a BO field;

[0182] in a case where the text content meets the preset condition, determining, from the text content, a message name of the CAN message, and a signal name, a signal start bit, a signal bit width, and a current endianness mode of an effective CAN signal as message information;

[0183] wherein the current endianness mode is a big-endian mode or a little-endian mode.

[0184] In an embodiment, in the aspect of determining the message information of the CAN message, the vehicle data processing apparatus 10 is further configured to perform:

[0185] in a case where the current endianness mode of the CAN signal is the little-endian mode, based on the signal start bit and the signal bit width of the effective CAN signal, inferring a signal start bit, a signal bit width, and a signal end bit of an ineffective CAN signal in the CAN message, and taking the signal start bit, the signal bit width, and the signal end bit of the ineffective CAN signal as the message information.

[0186] In an embodiment, in the aspect of performing the text scanning on the DBC file and determining the message information of the CAN message, the vehicle data processing apparatus 10 is further configured to perform:

[0187] in a case where the current endianness mode of the CAN signal is the big-endian mode, performing a big-endian conversion on the CAN signal to convert the current endianness mode of the CAN signal to the little-endian mode;

[0188] wherein, for a CAN signal in the big-endian mode, the byte bit sequence of the CAN signal in a transversely continuous byte space is discontinuous and the high and low bit directions are opposite;

[0189] wherein, for a CAN signal in the little-endian mode, the byte bit sequence of the CAN signal in a transversely continuous byte space is continuous and the high and low bit directions are the same.

[0190] In an embodiment, in the aspect of performing the big-endian conversion on the CAN signal to convert the current endianness mode of the CAN signal to the little-endian mode, the vehicle data processing apparatus 10 is further configured to perform:

[0191] based on the message information, constructing a byte bit sequence mapping table for the CAN signal;

[0192] Based on the byte order mapping table, the CAN signals are symmetrically exchanged in high and low byte to convert the byte order of the CAN signals in the transverse continuous byte space into continuous and same direction of high and low byte.

[0193] In an embodiment, after the data read and write of each CAN signal based on the structure pointer variable to obtain or modify the signal value of the CAN signal, the vehicle data processing device 10 is further configured to perform:

[0194] Based on the signal name of the CAN signal pointed by the structure pointer variable, the signal value read and write of the CAN signal is performed to obtain or modify the signal value of the CAN signal.

[0195] In an embodiment, after the data read and write of each CAN signal based on the structure pointer variable to obtain or modify the signal value of the CAN signal, the vehicle data processing device 10 is further configured to perform:

[0196] In the case that the CAN signal is converted from the big-endian mode to the little-endian mode, the big-endian and little-endian reverse conversion of the CAN signal is performed to convert the current end mode of the CAN signal into the big-endian mode.

[0197] Based on the C language pointer coercion and memory copy method, the CAN signal after the big-endian and little-endian reverse conversion is encapsulated to obtain the encapsulated CAN signal.

[0198] Figure 10 is a block diagram of a computer device 20 provided by an embodiment of the present application. For example, the computer device 20 can be an electronic device, an electronic component, or a server array, etc. Referring to Figure 10 , the computer device 20 includes a processor 21, which can be a set of processors, and can include one or more processors, and the computer device 20 includes a memory resource represented by a memory 22, wherein the memory 22 stores program data such as an application program. The program data stored in the memory 22 can include one or more modules each corresponding to a set of executable instructions. In addition, the processor 21 is configured to implement the vehicle data processing method as described above when calling the program data stored in the memory 22.

[0199] In some embodiments, the computer device 20 is an electronic device with a computing system that can execute one or more operating systems, including any of the operating systems discussed above as well as any commercially available server operating system. The computer device 20 can also run any of a variety of additional server applications and / or middleware applications, including an HTTP (HyperText Transfer Protocol) server, an FTP (File Transfer Protocol) server, a CGI (Common Gateway Interface) server, a hyper server, a database server, and the like. Exemplary database servers include, but are not limited to, database servers available from International Business Machines® (IBM®), Oracle®, Microsoft® and the like.

[0200] In some embodiments, the processor 21 generally controls the overall operation of the computer device 20, such as operations associated with displaying, data processing, data communications, and recording operations. The processor 21 can include one or more processor components to execute computer programs to complete all or part of the steps of the methods described above. In addition, the processor components can include one or more modules to facilitate interaction with other components. For example, the processor components can include a multimedia module to facilitate controlling the interaction between the user computer device 20 and the processor 21 using the multimedia components.

[0201] In some embodiments, the processor components in the processor 21 can also be referred to as CPUs (Central Processing Units). The processor components can be an electronic chip with the processing capability of signals. The processor can also be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor component or the like. In addition, the processor components can be jointly implemented by integrated circuit chips.

[0202] In some embodiments, the memory 22 is configured to store various types of data to support operations at the computer device 20. Examples of such data include instructions for any application programs or methods operating at the computer device 20, acquired data, messages, pictures, videos, and the like. The memory 22 can be implemented by any type of volatile or non-volatile storage devices, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disks, optical disks, or graphene memory.

[0203] In some embodiments, the memory 22 can be a memory stick, a TF card, or the like, and can store all information in the computer device 20, including input raw data, computer programs, intermediate running results, and final running results, which are saved in the memory 22. In some embodiments, it stores and retrieves information according to the location specified by the processor. In some embodiments, the computer device 20 has a memory function only with the memory 22, and can work normally. In some embodiments, the memory 22 of the computer device 20 can be divided into main memory (internal memory) and auxiliary memory (external memory) according to the purpose, and there is also a classification method of dividing into external memory and internal memory. The external memory is usually a magnetic medium or an optical disk, which can store information for a long time. The internal memory refers to the storage component on the motherboard, which is used to store the data and programs currently being executed, but only for temporary storage of programs and data, and the data will be lost when the power is off.

[0204] In some embodiments, the computer device 20 can further include a power component 23 configured to perform power management of the computer device 20, a wired or wireless network interface 24 configured to connect the computer device 20 to a network, and an input / output (I / O) interface 25. The computer device 20 can operate based on an operating system stored in the memory 22, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like.

[0205] In some embodiments, the power component 23 provides power to various components of the computer device 20. The power component 23 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the computer device 20.

[0206] In some embodiments, the wired or wireless network interface 24 is configured to facilitate wired or wireless communication between the computer device 20 and other devices. The computer device 20 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof.

[0207] In some embodiments, the wired or wireless network interface 24 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the wired or wireless network interface 24 also includes a near field communication (NFC) module to facilitate short-range communications. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0208] In some embodiments, the input / output (I / O) interface 25 provides an interface between the processor 21 and peripheral interface modules, which can be a keyboard, a click wheel, buttons, and the like. These buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0209] Figure 11 is a block diagram of a computer readable storage medium 30 provided by an embodiment of the present application. The computer readable storage medium 30 stores a computer program 31, wherein the computer program 31 is executed by a processor to implement the vehicle data processing method as described above.

[0210] The functional units integrated in the units in various embodiments of the present application, if implemented in the form of software functional units and sold or used as independent products, can be stored in the computer readable storage medium 30. Based on this understanding, the technical solutions of the present application, essentially or say the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer readable storage medium 30 stores a computer program 31, which includes a number of instructions for causing a computer device (which can be a personal computer, a system server, or a network device, etc.), an electronic device (such as an MP3, an MP4, etc., which can also be a mobile phone, a tablet computer, a wearable device, etc. smart terminal, or a desktop computer, etc.) or a processor to execute all or part of the steps of the various embodiments of the method of the present application.

[0211] Figure 12 is a block diagram of a computer program product 40 provided by an embodiment of the present application. The computer program product 40 includes program instructions 41, which can be executed by the processor of the computer device 20 to implement the vehicle data processing method as described above.

[0212] Those skilled in the art will understand that the embodiments of the present application can provide a vehicle data processing method, a vehicle data processing apparatus 10, a computer device 20, a computer readable storage medium 30 or a computer program product 40. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product 40 embodied in one or more computer program instructions 41 (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable program code.

[0213] The present application is described with reference to the flowcharts and / or block diagrams according to the vehicle data processing method, the vehicle data processing apparatus 10, the computer device 20, the computer readable storage medium 30 or the computer program product 40 in the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by the computer program product 40. These computer program products 40 can be provided to the processor of a general purpose computer, a special purpose computer, an embedded processing machine or other programmable data processing devices to produce a machine, so that the program instructions 41 executed by the processor of the computer or other programmable data processing devices produce an apparatus for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flowcharts and / or block diagrams.

[0214] These computer program products 40 can also be stored in a computer readable memory capable of directing the computer or other programmable data processing devices to work in a specific way, so that the program instructions 41 stored in the computer program products 40 produce a manufactured product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flowcharts and / or block diagrams.

[0215] These program instructions 41 can also be loaded into the computer or other programmable data processing devices, so that a series of operation steps are performed on the computer or other programmable devices to produce a computer implemented process, so that the program instructions 41 executed on the computer or other programmable devices provide steps for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flowcharts and / or block diagrams.

[0216] It should be noted that the various methods, apparatus, electronic devices, computer readable storage media, computer program products, etc. described above according to the method embodiments can also include other implementations that are not specifically described above. The specific implementations described are illustrative and not limiting.

[0217] Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.

[0218] It should be understood that the present disclosure is not limited to the precise structures herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from its scope. The scope of the present disclosure is limited only by the claims that follow.

Claims

1. A method of processing vehicle data, characterized by, The method comprises: acquiring a DBC file carrying CAN message description information; the CAN message is a bit sequence sent by a target vehicle through a CAN network; performing text scanning on the DBC file to determine message information of the CAN message; the message information comprises a current end mode of each CAN signal in the CAN message; including: in a case where the current end mode of the CAN signal is a big-end mode, performing big-end conversion on the CAN signal to convert the current end mode of the CAN signal into a little-end mode; in a case where the current end mode of the CAN signal is the little-end mode, based on a signal start bit and a signal bit width of a valid CAN signal, calculating a signal start bit, a signal bit width and a signal termination bit of an invalid CAN signal in the CAN message, and taking the signal start bit, the signal bit width and the signal termination bit of the invalid CAN signal as message information; wherein, the big-end conversion on the CAN signal to convert the current end mode of the CAN signal into the little-end mode comprises: based on the message information, constructing a byte bit sequence mapping table for the CAN signal; based on the byte bit sequence mapping table, performing symmetric interaction of high and low byte of the CAN signal to convert byte bit sequence of the CAN signal in a transverse continuous byte space into continuous and same direction of high and low bit; in a case where the current end mode is a target end mode, generating a data structure body for the CAN message based on the message information; based on the data structure body, defining a structure body pointer variable to perform data read and write on each CAN signal based on the structure body pointer variable to acquire or modify a signal value of the CAN signal.

2. The method of claim 1, wherein, The text scanning on the DBC file to determine the message information of the CAN message comprises: reading each line of text content in the DBC file to sequentially determine whether the corresponding each line of text content satisfies a preset condition; the preset condition comprises whether the byte length of the text content is 0, whether the text content is line feed, and whether the text content comprises a BO field; in a case where the text content satisfies the preset condition, determining a message name about the CAN message and a signal name, a signal start bit, a signal bit width and a current end mode about a valid CAN signal from the text content as message information; wherein, the current end mode is a big-end mode or a little-end mode.

3. The method of claim 1, wherein, The data read and write on each CAN signal based on the structure body pointer variable to acquire or modify the signal value of the CAN signal comprises: based on the signal name of the CAN signal pointed by the structure body pointer variable, performing signal value read and write on the CAN signal to acquire or modify the signal value of the CAN signal.

4. The method of claim 3, wherein, after the data read and write on each CAN signal based on the structure body pointer variable to acquire or modify the signal value of the CAN signal, further comprising: In the case that the CAN signal is converted from the big-end mode to the little-end mode, the CAN signal is subjected to big-end little-end reverse conversion to convert the current end mode of the CAN signal to the big-end mode; The CAN signal subjected to the big-end little-end reverse conversion is encapsulated based on a C language-based pointer forced conversion and memory copying method to obtain an encapsulated CAN signal.

5. A processing device of vehicle data, characterized by, The device comprises: A file acquisition module configured to acquire a DBC file carrying CAN message description information; the CAN message is a bit sequence sent by a target vehicle through a CAN network; A text scanning module configured to perform text scanning on the DBC file to determine message information of the CAN message; the message information includes a current end mode of each CAN signal in the CAN message; in the case that the current end mode of the CAN signal is the big-end mode, the CAN signal is subjected to big-end little-end conversion to convert the current end mode of the CAN signal to the little-end mode; in the case that the current end mode of the CAN signal is the little-end mode, the signal start bit, the signal bit width and the signal termination bit of an invalid CAN signal in the CAN message are calculated based on the signal start bit and the signal bit width of a valid CAN signal, and the signal start bit, the signal bit width and the signal termination bit of the invalid CAN signal are taken as the message information; wherein the big-end little-end conversion of the CAN signal to convert the current end mode of the CAN signal to the little-end mode comprises: constructing a byte bit sequence mapping table for the CAN signal based on the message information; and performing symmetric interaction of high and low byte bits of the CAN signal based on the byte bit sequence mapping table to convert the byte bit sequence of the CAN signal in the transverse continuous byte space to continuous and same high and low bit direction; a structure body definition module configured to generate a data structure body for the CAN message based on the message information in the case that the current end mode is a target end mode; A data read-write module configured to define a structure body pointer variable based on the data structure body, to perform data read-write on each CAN signal based on the structure body pointer variable to acquire or modify the signal value of the CAN signal.

6. The apparatus of claim 5, wherein, The device is further configured to read each line of text content in the DBC file, and sequentially determine whether the corresponding each line of text content satisfies a preset condition; the preset condition includes whether the byte length of the text content is 0, whether the text content is line broken, and whether the text content includes a BO field; in the case that the text content satisfies the preset condition, the message name about the CAN message and the signal name, the signal start bit, the signal bit width and the current end mode about the valid CAN signal are determined from the text content as the message information; wherein the current end mode is the big-end mode or the little-end mode.

7. The apparatus of claim 5, wherein, The device is further configured to read or write a signal value of the CAN signal based on a signal name of the CAN signal pointed by the structure pointer variable, to obtain or modify the signal value of the CAN signal.

8. The apparatus of claim 5, wherein, The device is further configured to, in a case where the CAN signal is converted from the big-endian mode to the little-endian mode, perform a big-endian / little-endian reverse conversion on the CAN signal to convert a current endianness mode of the CAN signal to the big-endian mode, and perform a C language-based pointer coercion and memory copy on the CAN signal after the big-endian / little-endian reverse conversion to obtain an encapsulated CAN signal.

9. A computer device, comprising: The device comprises: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the method of any one of claims 1 to 4.

10. A computer-readable storage medium, internally storing program instructions, characterized in that, The program instructions, when executed by a processor, implement the method of any one of claims 1 to 4.

Citation Information

Patent Citations

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

    CN116132558A