DBC file processing method and device, communication equipment and readable storage medium
By analyzing and storing CAN message information in DBC files, the problem of poor compatibility of CAN protocol in the prior art is solved, and more efficient CAN bus communication development and testing is achieved.
Patent Information
- Application Number
- CN202411816261.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-11
AI Technical Summary
Existing DBC file reception or sending solutions have poor compatibility when handling different CAN protocols, resulting in high development and testing costs and low efficiency.
By obtaining the DBC file of the CAN bus, parsing the CAN message, determining the description information is added, and storing it in the target structure to achieve compatibility with different CAN protocols.
Improves the compatibility of processing codes with different CAN protocols, reduces the development and testing costs related to CAN bus communication, and improves efficiency.
Smart Images

Figure CN119788758A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a DBC file processing method, apparatus, communication equipment and readable storage medium. Background Art
[0002] DBC (Database for CAN) file is an XML (Extensible Markup Language) format file used to define the CAN (Controller Area Network) bus communication protocol. It is mainly used to describe the communication of the Electronic Control Unit (ECU) in the CAN bus network. DBC file contains information such as CAN communication signals, message IDs, data length, and transmission cycles, helping developers to develop, test, diagnose, and analyze CAN communication protocols.
[0003] In the current DBC file receiving or sending scheme, the storage order of data with more than 2 bytes is usually fixed, the sending message and the receiving message cannot be stored in the same structure, and the single-channel signal and multiplexed signal in the DCB file need to be processed separately using different processing codes.
[0004] It can be seen that when using the current DBC file receiving or sending solution for CAN bus communication, due to the poor compatibility of its processing code with different CAN protocols, the above processing code has to be frequently modified according to the DBC file content during the communication process, resulting in high development and testing costs and low efficiency related to CAN bus communication. Summary of the invention
[0005] The main purpose of this application is to propose a DBC file processing method, device, communication equipment and readable storage medium, aiming to improve the compatibility of processing code based on DBC files for different CAN protocols, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency.
[0006] In a first aspect, the present invention provides a DBC file processing method, the method comprising:
[0007] Obtain a CAN database DBC file of a controller area network CAN bus, wherein the DBC file is used to describe a protocol message of the CAN bus;
[0008] Obtaining a CAN message through the DBC file, and parsing the CAN message to obtain a message identifier and signal description information, wherein the signal description information includes: a signal name and basic description information;
[0009] Determining to add description information according to the message identifier and the signal description information;
[0010] The message identifier, the basic description information and the added description information are stored in a created target structure, and the target structure is used to parse the received CAN message or encode the CAN message to be sent.
[0011] In an optional implementation manner, the signal description information includes: a signal name of at least one signal and basic description information of each signal, and the added description information includes: the added description information of at least one signal;
[0012] The determining, according to the message identifier and the signal description information, to add description information comprises:
[0013] Determine the added description information of each signal respectively according to the message identifier and the signal description information of at least one signal;
[0014] The added description information includes: a group index value, signal value description information, message value description information, signal storage sequence information, signal transmission time interval information, and signal reception timestamp information.
[0015] In an optional embodiment, the target structure includes: at least one first structure, and a second structure;
[0016] The method further comprises:
[0017] Creating at least one of the first structures, and storing the signal name, the basic description information, and the added description information of at least one signal in at least one corresponding first structure;
[0018] Create the second structure, and store the signal list information, group index signal information, multiplexing flag information, the message identifier, message name description information, message frame type and message sending node description information of at least one signal in the second structure.
[0019] In an optional embodiment, the method further comprises:
[0020] Receive the CAN message to be received;
[0021] Determine the second structure corresponding to the message identifier corresponding to the to-be-received CAN message from the target structure;
[0022] According to the multiplexing flag information in the second structure, determining whether the message identifier corresponding to the to-be-received CAN message is a message identifier for multiplexing of multiple signals;
[0023] If it is a message identifier of multiplexed signals, the second structure is used to locate the first group index number of the multiplexed signals to which the CAN message to be received belongs;
[0024] According to the first group index number, the second structure and at least one of the first structures are used to parse the signal value of the CAN message to be received.
[0025] In an optional embodiment, the method further comprises:
[0026] If it is a message identifier of a separate signal, the second structure and at least one of the first structures are used to perform signal value analysis on the CAN message to be received.
[0027] In an optional embodiment, the method further comprises:
[0028] Get the CAN message to be sent;
[0029] Parsing the CAN message to be sent, obtaining and setting the signal name and signal value to be set corresponding to the CAN message to be sent and storing them in a preset message sending buffer;
[0030] Determine, from the target structure, the second structure corresponding to the message identifier corresponding to the CAN message to be sent;
[0031] According to the multiplexing flag information in the second structure, determining whether the message identifier corresponding to the CAN message to be sent is a message identifier for multiplexing of multiple signals;
[0032] If it is a message identifier of multiplexed signals, the second structure is used to locate the second group index number of the multiplexed signals to which the CAN message to be sent belongs;
[0033] According to the second group index number, the second structure and at least one of the first structures are used to encode the signal value of the CAN message to be sent, and the encoded CAN message to be sent is sent.
[0034] In an optional embodiment, the method further comprises:
[0035] If it is a message identifier of a separate signal, the second structure and at least one of the first structures are used to encode the signal value of the CAN message to be sent, and the encoded CAN message to be sent is sent.
[0036] In a second aspect, the present invention provides a DBC file processing device, comprising:
[0037] An acquisition module, used for acquiring a DBC file of a CAN bus, wherein the DBC file is used for describing a protocol message of the CAN bus;
[0038] A parsing module, used to obtain a CAN message through the DBC file, and parse the CAN message to obtain a message identifier and signal description information, wherein the signal description information includes: a signal name and basic description information;
[0039] A determination module, used for determining to add description information according to the message identifier and the signal description information;
[0040] A creation module is used to create a target structure, and store the message identifier, the basic description information and the added description information in the target structure, wherein the target structure is used to parse the received CAN message or encode the CAN message to be sent.
[0041] In a third aspect, the present invention provides a communication device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform a method as described in any of the foregoing embodiments.
[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, executes the method as described in any of the aforementioned embodiments.
[0043] The beneficial effects of this application are:
[0044] The DBC file processing method provided in the embodiment of the present application includes: obtaining a CAN database DBC file of a controller area network CAN bus, wherein the DBC file is used to describe the protocol message of the CAN bus; obtaining a CAN message through the DBC file, and parsing the CAN message to obtain a message identifier and signal description information, wherein the signal description information includes: a signal name and basic description information; determining to add description information based on the message identifier and the signal description information; storing the message identifier, the basic description information and the added description information in a created target structure, wherein the target structure is used to parse the received CAN message, or to encode the CAN message to be sent. In this embodiment, a specific method is implemented by running a processing code, wherein a CAN message is obtained through a DBC file, the CAN message is parsed to obtain a message identifier and signal description information, and based on the message identifier and the signal description information, additional description information is determined, and then the message identifier, the basic description information and the additional description information are stored in a created target structure, and the target structure is used to parse the received CAN message, or to encode the CAN message to be sent, so that only one processing code can be used to create a target structure stored in a DBC file based on the DBC file that is compatible with sending CAN messages, receiving CAN messages, multiplexing of multiple signals, etc., and can be used for subsequent sending and receiving of CAN messages, and the reception, parsing, encoding, sending and other operations of different CAN protocols can be realized by importing the DBC file without modifying the above-mentioned processing code, thereby improving the compatibility of the processing code with different CAN protocols, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0046] Figure 1 A schematic diagram of a DBC file processing method provided in an embodiment of the present application;
[0047] Figure 2 A schematic diagram of the structure of a target structure provided in one embodiment of the present application;
[0048] Figure 3 A flowchart of a DBC file processing method provided by another embodiment of the present application;
[0049] Figure 4 A flowchart of a DBC file processing method provided by another embodiment of the present application;
[0050] Figure 5 A schematic diagram of the structure of a DBC file processing device provided in an embodiment of the present application;
[0051] Figure 6 A schematic diagram of the structure of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0053] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0054] It should be noted that similar numbers and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further defined or explained in subsequent figures. The terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the statement "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device that includes the element.
[0055] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0056] The DBC file processing code currently used in the CAN communication process cannot support compatibility with sending messages, receiving messages, multiplexing of multiple signals, etc., because the structure it creates does not contain a flag bit for indicating single-channel signals and multiplexed signals. In addition, when storing signals larger than 2 bytes, the signal storage order cannot be adjusted. For example, if the CAN communication process involves the reception, parsing, encoding, and sending of different CAN protocols, it is necessary to frequently modify the relevant codes to adapt to the above-mentioned different CAN protocols, resulting in low CAN bus communication efficiency. The main purpose of this application is to propose a DBC file processing method, which aims to improve the compatibility of the processing code with different CAN protocols based on the DBC file, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency.
[0057] Figure 1 A flowchart of a DBC file processing method provided in an embodiment of the present application is provided. The execution subject of the method may be a computer or other device. The storage space of the computer or other device may be installed with a related software program for the above-mentioned DBC file processing. The software program may include a processing code based on the DBC file. When the processing code is run, the computer or other device may execute the above-mentioned DBC file processing method to complete the sending and receiving of CAN messages in the DBC file, etc. Figure 1 As shown, the method includes:
[0058] S101. Obtain a CAN database DBC file of a controller area network CAN bus, where the DBC file is used to describe protocol messages of the CAN bus.
[0059] Exemplarily, the acquisition of the CAN database DBC file of the controller area network CAN bus may refer to, for example, receiving a DBC file sent from a sending device via the CAN bus, the sending device may include but is not limited to a computer or other device, or may refer to a DBC file imported into a local storage space by other means, and the protocol message of the CAN bus may also be referred to as a CAN message. It may refer to, for example, a frame for transmitting data, the frame may be represented by a hexadecimal number, and may be composed of 7 parts, the 7 parts may be, for example, a frame start, an arbitration segment, a control segment, a data segment, a CRC (Cyclic Redundancy Check) segment, an ACK (Acknowledge character) segment, and a frame end. The protocol message of the above-mentioned CAN bus can have two formats, which can be, for example, a standard format and an extended format. The identifier (ID, Identity document) length of the protocol message of the above-mentioned standard format and extended format CAN bus can be different, for example, the standard format can be 11 bits and the extended format can be 29 bits. The identifier of the protocol message of the CAN bus can also be called CAN_ID, which can be used to indicate whether the corresponding CAN bus protocol message is multiplexed, the number of signals contained and the byte position of each signal, the conversion relationship between the message and the actual physical quantity, etc.
[0060] Of course, the above contents are only possible examples. The specific way to obtain the DBC file of the CAN bus, the specific type and form of the protocol message of the CAN bus, and the specific content that the above CAN_ID can indicate, etc. can all be selected and determined according to actual needs and are not limited to the above contents.
[0061] S102. Obtain a CAN message through the DBC file, and parse the CAN message to obtain a message identifier and signal description information, wherein the signal description information includes: a signal name and basic description information.
[0062] Exemplarily, the above-mentioned parsing of the above-mentioned CAN message to obtain the message identification and signal description information can be implemented in the above-mentioned DBC file through a preset parsing algorithm or a preset parsing program such as the above-mentioned processing code. The above-mentioned message identification can refer to the identifier of the CAN bus protocol message in the above example, that is, CAN_ID, and the above-mentioned basic description information can refer to the content that the above-mentioned CAN_ID can be used to indicate specifically, such as whether the corresponding CAN bus protocol message is multiplexed (if it is multiplexed, it can further indicate the multiplexing group number), the number of signals contained and the byte position of each signal, the conversion relationship between the message and the actual physical quantity, etc.
[0063] Of course, the above contents are only possible examples. How to parse the DBC file, the specific form in which the message identifier is recorded, and what information the basic description information contains can all be selected and determined according to actual conditions and are not limited here.
[0064] S103: Determine to add description information according to the message identifier and the signal description information.
[0065] Exemplarily, the above-mentioned added descriptive information may include, for example, a signal storage order of more than 2 bytes, a time interval parameter, a signal timestamp, etc. The above-mentioned signal storage order of more than 2 bytes may be used to indicate the arrangement order between fields corresponding to signals of more than 2 bytes, the above-mentioned signal timestamp may be used to indicate the moment of signal reception, and the above-mentioned signal reception time interval may be used to indicate that the signal corresponding to the signal timestamp is cleared after a preset time period, such as 30 seconds, 45 seconds, 60 seconds, etc., has passed at the signal reception time indicated by the above-mentioned signal timestamp, so as to prevent communication congestion caused by timeout of protocol message reception of the above-mentioned CAN bus, etc.
[0066] Of course, what the above-mentioned added description information specifically includes, and the specific form and content of each of the above-mentioned added description information can be selected and determined according to actual conditions, and are not limited here.
[0067] S104: Store the message identifier, the basic description information and the added description information into a created target structure, where the target structure is used to parse the received CAN message or encode the CAN message to be sent.
[0068] Exemplarily, the above-mentioned target structure can be, for example, a secondary structure stored in a DBC file, which can be created by the above-mentioned processing code and can be composed of a signal storage container and a variable, wherein the above-mentioned basic description information and the above-mentioned additional description information can correspond to the signal contained in the protocol message of the CAN bus, and each signal can have corresponding basic description information and additional description information. The signal contained in the protocol message of the CAN bus can be stored in the signal storage container of the secondary structure, and the above-mentioned message identifier can be stored in the above-mentioned variable. It should be noted that there can be multiple target structures.
[0069] Of course, the above contents are only possible examples, and the specific number, type and composition of the target structures, the specific message identifier, the above basic description information and the storage location of the above added description information can all be selected and determined according to actual conditions and are not limited here.
[0070] The DBC file processing method provided in the embodiment of the present application includes: obtaining a CAN database DBC file of a controller area network CAN bus, the above-mentioned DBC file is used to describe the protocol message of the above-mentioned CAN bus; obtaining a CAN message through the above-mentioned DBC file, and parsing the above-mentioned CAN message to obtain a message identifier and signal description information, the above-mentioned signal description information includes: a signal name and basic description information; determining to add description information based on the above-mentioned message identifier and the above-mentioned signal description information; storing the above-mentioned message identifier, the above-mentioned basic description information and the above-mentioned added description information in a created target structure, the above-mentioned target structure is used to parse the received CAN message, or to encode the above-mentioned CAN message to be sent. In this embodiment, a specific method is implemented by running a processing code, wherein a CAN message is obtained through a DBC file, the CAN message is parsed to obtain a message identifier and signal description information, and based on the message identifier and the signal description information, it is determined to add description information, and then the message identifier, the basic description information and the added description information are stored in a created target structure, and the target structure is used to parse the received CAN message, or to encode the CAN message to be sent, so that only one processing code can be used to create a target structure stored in a DBC file based on the DBC file that is compatible with sending CAN messages, receiving CAN messages, multiplexing of multiple signals, etc., and can be used for subsequent CAN message sending and receiving, and the reception, parsing, encoding, sending and other operations of different CAN protocols can be realized by importing the DBC file without modifying the above processing code, thereby improving the compatibility of the processing code with different CAN protocols, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency.
[0071] Optionally, in Figure 1 Based on the embodiment, the above-mentioned signal description information may include: the signal name of at least one signal and basic description information of each signal, and the above-mentioned additional description information may include: the above-mentioned additional description information of at least one signal.
[0072] The determining of the added description information according to the message identifier and the signal description information may include: determining the added description information of each signal respectively according to the message identifier and the signal description information of at least one signal;
[0073] The above-mentioned added description information includes: the group index value, signal value description information, message value description information, signal storage sequence information, signal transmission time interval information and signal reception timestamp information.
[0074] Typically, the signals included in the protocol message of the CAN bus may be multiple signals, each of which may have a corresponding signal name, basic description information and additional description information. Optionally, the signal name, basic description information and additional description information corresponding to each of the above signals may be the same or different.
[0075] Exemplarily, the group index value may be used to indicate the group number corresponding to the multiplexed signal, that is, the multiplexed group number. When the corresponding signal is a multiplexed signal, the group index value may be an integer ≥ 0, such as 0, 1, 2, 3, etc. When the corresponding signal is a single-channel signal, the group index value may be, for example, -2, etc.
[0076] On this basis, the added description information can further include group index signal description information, which can be used to store the group index signal information of the corresponding multiplexed signal, for example, it can include its start bit, length and other information in the CAN message. If the corresponding signal is a single-channel signal, the group index signal description information may be invalid or empty, etc., which is not limited here.
[0077] The above-mentioned signal value description information can be used to indicate the physical quantity with practical significance obtained after the corresponding signal is parsed and converted according to a specific conversion relationship, while the above-mentioned message value description information can be used to indicate the message value of the signal before parsing and conversion according to a specific conversion relationship, and the message value can be a hexadecimal value, for example.
[0078] Similar to the above examples, the signal storage order information may refer to the signal storage order of more than 2 bytes, for example, it may be used for the arrangement order between fields corresponding to signals of more than 2 bytes. The signal reception timestamp information may refer to the signal timestamp, for example, it may be used to indicate the moment of signal reception. The signal transmission time interval information may refer to the signal reception time interval, for example, it may be used to indicate that after a preset time period, such as 30 seconds, 45 seconds, 60 seconds, etc., has passed at the signal reception time indicated by the signal timestamp, the signal corresponding to the signal timestamp shall be cleared to prevent communication congestion caused by the reception timeout of the protocol message of the CAN bus.
[0079] It can be understood that the above content is only possible examples, and the specific forms and specific meanings of the above-mentioned group index values, group index signal description information, signal value description information, message value description information, signal storage order information, signal transmission time interval information and signal reception timestamp information can be adjusted and determined according to actual conditions and are not limited here.
[0080] Further, based on the above embodiment, it is necessary to create a target structure, which may include: at least one first structure and a second structure. Figure 1The target structures in the embodiments are the same. The target structures may be, for example, secondary structures stored in a DBC file. Each target structure may correspond to a CAN message. The target structure may be composed of a signal storage container and a variable. At least one of the first structures may be stored in the signal storage container. Each first structure may correspond to a signal in a CAN message, and the second structure may be stored in a variable corresponding to the signal storage container. Therefore, the first structure may store information such as a signal name, basic description information and additional description information of the corresponding signal, and the second structure may store information such as the corresponding signal storage container.
[0081] Accordingly, the above method may further include:
[0082] At least one of the first structures is created, and the signal name, the basic description information and the added description information of at least one signal are stored in at least one corresponding first structure.
[0083] The second structure is created, and the signal list information, group index signal information, multiplexing flag information, the message identifier, message name description information, message frame type and message sending node description information of at least one signal are stored in the second structure.
[0084] For example, at least one first structure created above is as follows:
[0085]
[0086]
[0087] Of course, the above content is only a possible example of the first structure. The comment content after the above “ / / ” is the name of the corresponding field. It can be understood that the number and type of fields in the first structure corresponding to different signals may be different, and the names and specific uses of the above fields can be adaptively adjusted according to actual conditions, and are not limited to the above examples.
[0088] On this basis, the second structure created above is as follows:
[0089]
[0090] Among them, the above-mentioned signal list information may refer to the above-mentioned signal storage container, which may be used to store the above-mentioned first structure corresponding to at least one signal; the above-mentioned group index signal information may correspond to the group index value in the above-mentioned first structure; the above-mentioned multiplexing flag information may be used to indicate whether the signal in the above-mentioned signal list information is a single-channel signal or a multiplexed signal. Exemplarily, the initial value of the above-mentioned group index signal information may be -1, for example, when the signal in the above-mentioned signal list information is a single-channel signal, the value of the multiplexing flag information may be false, and at this time, the above-mentioned group index signal information may be -2 after the processing code is run; when the signal in the above-mentioned signal list information is a multiplexed signal, the value of the multiplexing flag information may be true, and at this time, the above-mentioned group index signal information may be the same as the above-mentioned first structure after the processing code is run. The positive integer > 0 corresponding to the group index value in the structure, that is, the value of the m_groupIndex field matches the value of the M_Sinal; the message identifier may refer to the identifier of the protocol message of the CAN bus, that is, CAN_ID, and the message name description information may be used to indicate the message name corresponding to the message identifier. It should be noted that the message name corresponds to the message, not the signal name; the message frame type may be used to indicate the format of the protocol message frame of the CAN bus, that is, the standard format and the extended format. The length of the identifier (ID, Identity document) of the protocol message of the CAN bus in the standard format and the extended format may be different, for example, the standard format may be 11 bits and the extended format may be 29 bits; the message sending node description information may be used to indicate the sending node name.
[0091] Of course, the above content is a possible example of the second structure. The comment content after the above “ / / ” is the name of the corresponding field. It can be understood that the number and type of fields in the second structure corresponding to different signals may be different, and the names and specific uses of the above fields can be adaptively adjusted according to actual conditions, and are not limited to the above examples.
[0092] For example, Figure 2 For a schematic diagram of the structure of the target structure provided in one embodiment of the present application, please refer to Figure 2 The target structure may include: at least one first structure, and a second structure. The at least one first structure may be stored in Figure 1 In the signal storage container of the target structure disclosed in the embodiment, the signal list information in the second structure can be used to indicate the signal in the signal storage container of the target structure, and the second structure can be stored in Figure 1 The variables of the above target structure disclosed in the embodiment correspond to the signal storage container of the target structure. It can be understood that: Figure 2 The contents in the above are only possible examples. The target structure and the number of the first structure and the information in the first structure and the second structure can be adjusted and determined according to the actual situation. Figure 2 The content is limited to .
[0093] Figure 3 A flowchart of a DBC file processing method provided by another embodiment of the present application is shown as follows: Figure 3 As shown, based on the above embodiment, the above method may further include:
[0094] S301, receiving a CAN message to be received.
[0095] Exemplarily, the CAN message to be received may belong to Figure 1 The protocol message of the CAN bus in the embodiment is similar to the protocol message of the CAN bus mentioned above, which may, for example, refer to a frame for transmitting data. The frame may, for example, be represented by a hexadecimal number and may be composed of 7 parts, which may, for example, be a frame start, an arbitration segment, a control segment, a data segment, a CRC segment, an ACK segment and a frame end. The CAN message to be received may also have two formats, which may, for example, be a standard format and an extended format. The identifier (ID, Identity document) length of the protocol message of the CAN bus in the standard format and the extended format may be different, for example, the standard format may be 11 bits and the extended format may be 29 bits. The receiving of the CAN message to be received may, for example, refer to receiving the CAN message to be received sent from the sending end device via the CAN bus. The sending end device may be a device including but not limited to a computer, etc. Of course, the above content is only a possible example. The specific form and specific receiving method of the CAN message to be received may be selected and determined according to actual conditions, and are not limited here.
[0096] S302: Determine the second structure corresponding to the message identifier corresponding to the to-be-received CAN message from the target structure.
[0097] Exemplarily, the above-mentioned receiving of the CAN message to be received can be specifically completed by the first thread. Each time the first thread receives a frame of CAN message, it can add it to the buffer queue. The above-mentioned determination of the above-mentioned second structure corresponding to the above-mentioned message identifier corresponding to the above-mentioned CAN message to be received from the above-mentioned target structure can be specifically completed by the second thread. When the second thread detects that the buffer is not empty, it can take out a frame of message from the buffer, and search for the CAN_ID corresponding to the CAN message to be received in the DBC file where the above-mentioned CAN message to be received is located, and traverse and search for the above-mentioned second structure stored in the local storage space according to the CAN_ID corresponding to the CAN message to be received, until the second structure whose CAN_ID is the same as the CAN_ID corresponding to the CAN message to be received is found.
[0098] S303: Determine, based on the multiplexing flag information in the second structure, whether the message identifier corresponding to the to-be-received CAN message is a message identifier for multiplexing multiple signals.
[0099] Continuing with the above example, the above determination of whether the message identifier corresponding to the CAN message to be received is a message identifier for multiplexing of multiple signals based on the multiplexing flag information in the second structure may refer to, after finding the second structure whose CAN_ID is the same as the CAN_ID corresponding to the CAN message to be received, obtaining the multiplexing flag of the second structure, such as the data in the MultiIDFlag field in the second structure example, to determine whether the first structure in the signal storage container of the target structure to which the second structure corresponding to the CAN_ID belongs corresponds to a single signal or a multiplexed signal.
[0100] S304: If it is a message identifier of multiplexed signals, the second structure is used to locate the first group index number of the multiplexed signals to which the CAN message to be received belongs.
[0101] Continuing with the above example, if the above is a message identifier for multiplexed signals, the above second structure is used to locate the first group of index numbers of the multiplexed signals to which the above CAN message to be received belongs. When the second structure corresponding to the above CAN_ID corresponds to a multiplexed signal, for example, when the value in the MultiIDFlag field in the above second structure example is true, the start bit, bit length, offset and other information corresponding to the first group of index numbers of the multiplexed signals can be further obtained according to the data in the M_signal field in the above second structure example, and the first group of index numbers of the multiplexed signals can be obtained by parsing and converting through a preset parsing algorithm or a preset parsing program.
[0102] S305 , according to the first group of index numbers, using the second structure and at least one of the first structures to perform signal value analysis on the to-be-received CAN message.
[0103] Continuing with the above example, the above signal value parsing of the to-be-received CAN message may refer to traversing and searching for at least one first structure corresponding to the first group of index numbers (for example, the first structure whose value in the m_groupIndex field is the same as the first group of index numbers) in the signal list information corresponding to the second structure for the starting bit, bit length, offset and other information of the signal, and parsing and converting the starting bit, bit length, offset and other information of the signal corresponding to the at least one first structure through a preset parsing algorithm or a preset parsing program to obtain a physical quantity with practical significance corresponding to the first structure, and finally storing the physical quantity with practical significance corresponding to the first structure in the DBC file in the signal value description information of the first structure, for example, in the Value field.
[0104] Finally, you can also use, for example, an encapsulated API function based on CAN channel, signal name, signal value storage address and other parameters to match and obtain the above signal value description information and store it in the signal value parameter of the function parameter.
[0105] It can be understood that the above contents are all possible examples, which can be adjusted according to actual conditions and are not limited to the above contents.
[0106] In this embodiment, a CAN message to be received is received; the second structure corresponding to the message identifier corresponding to the CAN message to be received is determined from the target structure; according to the multiplexing flag information in the second structure, it is determined whether the message identifier corresponding to the CAN message to be received is a message identifier for multiplexed signals; if it is a message identifier for multiplexed signals, the second structure is used to locate the first group index number of the multiplexed signals to which the CAN message to be received belongs; according to the first group index number, the second structure and at least one of the first structures are used to perform signal value analysis on the CAN message to be received. The CAN_ID of the CAN message to be received is used to traverse and search for the second structure with the same CAN_ID in the target structure, and then determine whether the signal corresponding to the CAN message to be received is a multiplexed signal according to the multiplexing flag information in the second structure. If the signal corresponding to the above-mentioned CAN message to be received is a multiplexed signal, the above-mentioned first group of index numbers is parsed and obtained, and at least one first structure corresponding to the above-mentioned first group of index numbers is traversed and searched in the signal list information corresponding to the above-mentioned second structure, thereby realizing the extraction and parsing conversion of the information of the signal corresponding to the first structure, such as its start bit, bit length, offset, etc., and obtaining the physical quantity with practical significance corresponding to the signal and storing it in the corresponding signal value description information, thereby improving the compatibility of the above-mentioned processing code with different CAN protocols, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency.
[0107] Furthermore, based on the above embodiment, the above method may further include:
[0108] If it is a message identifier of a separate signal, the second structure and at least one of the first structures are used to perform signal value analysis on the CAN message to be received.
[0109] Continuing with the above example, if the above is a message identifier of a separate signal, the above second structure and at least one of the above first structures are used to perform signal value analysis on the above CAN message to be received. This means that when the first structure in the signal storage container of the target structure to which the second structure corresponding to the above CAN_ID belongs corresponds to a single-channel signal, for example, when the value in the MultiIDFlag field in the above second structure example is -2, the first group of index numbers of the multiplexed signals to which the above CAN message to be received does not exist, and the starting bit, bit length, offset and other information of the signals corresponding to all the first structures can be directly traversed in the signal list information corresponding to the above second structure, and the starting bit, bit length, offset and other information of the signals corresponding to each of the above first structures can be parsed and converted through a preset parsing algorithm or a preset parsing program to obtain a physical quantity corresponding to each of the above first structures with practical significance. Finally, the physical quantity corresponding to each first structure with practical significance can be stored in the signal value description information of the first structure in the DBC file, for example, in the above Value field.
[0110] Figure 4 A flowchart of a DBC file processing method provided by another embodiment of the present application is shown as follows: Figure 4 As shown, based on the above embodiment, the above method may further include:
[0111] S401, obtaining a CAN message to be sent.
[0112] Exemplarily, the above-mentioned CAN message to be sent may refer to a signal value to be sent that has not yet been encoded into a frame for transmitting data, which may be formed into a frame for transmitting data after being encoded by the signal value. The CAN message to be sent may be stored in the local storage space of the sending device, and the sending device may include but is not limited to a computer and other devices. Of course, the specific storage method of the CAN message to be sent may be selected and determined based on actual conditions, and is not limited here.
[0113] S402, parsing the CAN message to be sent, obtaining and setting the signal name and signal value to be set corresponding to the CAN message to be sent and storing them in a preset message sending buffer.
[0114] Exemplarily, the above-mentioned CAN message to be sent is parsed, and the preset message sending buffer corresponding to the CAN message to be sent can be defined before obtaining and setting and storing the signal name and signal value to be set corresponding to the CAN message to be sent in the preset message sending buffer. The specific process of defining the preset message sending buffer corresponding to the CAN message to be sent can be that when the signal corresponding to the CAN message to be sent is a single-channel signal, a preset message sending buffer of, for example, 8 bytes is allocated to the CAN_ID of each CAN message to be sent; when the signal corresponding to the CAN message to be sent is a multiplexed signal, a preset message sending buffer of, for example, 8 bytes is allocated to each multiplexing group of the CAN_ID of each CAN message to be sent, and at the same time, the group index bit in the above 8 bytes is assigned according to its corresponding multiplexing group index.
[0115] Based on the above content, the CAN message to be sent is parsed again, and the signal name and signal value to be set are set and stored in the preset message sending buffer by, for example, calling, for example, an encapsulation API function through the first thread.
[0116] S403: Determine the second structure corresponding to the message identifier corresponding to the CAN message to be sent from the DBC structure stored this time.
[0117] Exemplarily, the above-mentioned second structure corresponding to the message identifier corresponding to the above-mentioned CAN message to be sent is determined from the DBC structure stored this time, for example, can refer to, when, for example, the second thread detects that the buffer is not empty, taking out a signal from the buffer area, and searching for the signal name in the structure corresponding to the signal, and then traversing through the signal name to search for the CAN_ID in the DBC structure stored this time, that is, the message identifier corresponding to the above-mentioned CAN message to be sent.
[0118] S404: Determine, based on the multiplexing flag information in the second structure, whether the message identifier corresponding to the CAN message to be sent is a message identifier for multiplexing multiple signals.
[0119] Continuing with the above example, the above determination of whether the message identifier corresponding to the CAN message to be sent is a message identifier for multiplexing of multiple signals based on the multiplexing flag information in the second structure may, for example, refer to judging whether the message identifier corresponding to the CAN message to be sent is a message identifier for multiplexing of multiple signals through the value of, for example, the MultiIDFlag field in the second structure.
[0120] S405: If it is a message identifier of multiplexed signals, the second structure is used to locate the second group index number of the multiplexed signals to which the CAN message to be sent belongs.
[0121] Continuing with the above example, if the message identifier corresponding to the above-mentioned CAN message to be sent is a message identifier of multiplexed signals, the multiplexed group index value corresponding to the above-mentioned signal can be obtained by referring to the process in the above-mentioned S204, and the second group index number of the multiplexed signal to which the above-mentioned CAN message to be sent belongs can be located.
[0122] S406. According to the second group of index numbers, use the second structure and the at least one first structure to encode the signal value of the CAN message to be sent, and send the encoded CAN message to be sent.
[0123] Continuing with the above example, the above-mentioned second structure and at least one first structure are used to encode the signal value of the CAN message to be sent according to the above-mentioned second group index number, and send the encoded CAN message to be sent. For example, it can refer to searching the above-mentioned preset message sending buffer according to the message identifier corresponding to the above-mentioned CAN message to be sent, and after finding the corresponding preset message sending buffer, further searching for the multiplexing group corresponding to the current signal name, and modifying the specified byte of the preset message sending buffer corresponding to the multiplexing group according to the start bit, bit length, offset and other information of the signal, that is, the above-mentioned CAN message to be sent is encoded with a signal value, and finally the above-mentioned encoded CAN message to be sent is sent through, for example, a CAN driver function.
[0124] It is understandable that the above steps S401 to S406 can be completed in, for example, a local DBC file, and the above contents are all possible examples, which can be adjusted according to actual conditions and are not limited to the above contents.
[0125] In this embodiment, a CAN message to be sent is obtained; the above-mentioned CAN message to be sent is parsed to obtain and set the signal name and signal value to be set corresponding to the above-mentioned CAN message to be sent and store them in a preset message sending buffer; the above-mentioned second structure corresponding to the above-mentioned message identifier corresponding to the above-mentioned CAN message to be sent is determined from the above-mentioned target structure; according to the above-mentioned multiplexing flag information in the above-mentioned second structure, it is determined whether the above-mentioned message identifier corresponding to the above-mentioned CAN message to be sent is a message identifier for multiplexed signals; if it is a message identifier for multiplexed signals, the above-mentioned second structure is used to locate the second group index number of the multiplexed signal to which the above-mentioned CAN message to be sent belongs; according to the above-mentioned second group index number, the above-mentioned second structure and at least one of the above-mentioned first structures are used to encode the signal value of the above-mentioned CAN message to be sent, and the encoded above-mentioned CAN message to be sent is sent. By parsing, the signal name and signal value to be set corresponding to the CAN message to be sent are obtained and set and stored in the preset message sending buffer, so as to determine the second structure corresponding to the message identifier corresponding to the CAN message to be sent from the DBC structure stored this time, and then determine whether the message identifier corresponding to the CAN message to be sent is a message identifier of multiplexed signals. If it is a message identifier of multiplexed signals, the second structure is used to locate the second group of index numbers of the multiplexed signals to which the CAN message to be sent belongs; according to the second group of index numbers, the second structure and at least one of the first structures are used to encode the signal value of the CAN message to be sent, and the encoded CAN message to be sent is sent, thereby improving the compatibility of the processing code to different CAN protocols, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency.
[0126] Furthermore, based on the above embodiment, the above method may further include:
[0127] If it is a message identifier of a separate signal, the second structure and at least one of the first structures are used to encode the signal value of the CAN message to be sent, and the encoded CAN message to be sent is sent.
[0128] Exemplarily, if the above is a message identifier of a separate signal, the above second structure and at least one of the above first structures are used to encode the signal value of the above CAN message to be sent, and the encoded CAN message to be sent is sent. For example, when the message identifier corresponding to the above CAN message to be sent is the message identifier of a single-channel signal, there is no need to further obtain the above second group of index numbers, and the above preset message sending buffer can be searched according to the message identifier corresponding to the above CAN message to be sent. After finding the corresponding preset message sending buffer, the specified byte of the preset message sending buffer is directly modified according to the start bit, bit length, offset and other information of the signal, that is, the above signal value encoding is performed on the above CAN message to be sent, and finally the above encoded CAN message to be sent is sent through, for example, a CAN driver function. It can be understood that the above content can also be completed in, for example, a local DBC file.
[0129] Of course, the above contents are only possible examples, and the specific contents can be determined and adjusted according to actual conditions, and are not limited here.
[0130] Figure 5 The structure diagram of a DBC file processing device provided in an embodiment of the present application is a schematic diagram. The DBC file processing device can execute the above-mentioned DBC file processing method to realize the reception or transmission of CAN messages in the DBC file. The device can be integrated into the above-mentioned computer and other devices, such as Figure 5 As shown, the device comprises:
[0131] The acquisition module 510 is used to acquire a CAN database DBC file of a controller area network CAN bus, wherein the DBC file is used to describe the protocol message of the CAN bus;
[0132] The parsing module 520 is used to obtain the CAN message through the DBC file, and parse the CAN message to obtain the message identifier and signal description information, wherein the signal description information includes: signal name and basic description information;
[0133] A determination module 530, configured to determine to add description information according to the message identifier and the signal description information;
[0134] The creation module 540 is used to store the message identifier, the basic description information and the added description information into a created target structure, and the target structure is used to parse the received CAN message or encode the CAN message to be sent.
[0135] The DBC file processing method provided in the embodiment of the present application includes: obtaining a CAN database DBC file of a controller area network CAN bus, the above-mentioned DBC file is used to describe the protocol message of the above-mentioned CAN bus; obtaining a CAN message through the above-mentioned DBC file, and parsing the above-mentioned CAN message to obtain a message identifier and signal description information, the above-mentioned signal description information includes: a signal name and basic description information; determining to add description information based on the above-mentioned message identifier and the above-mentioned signal description information; storing the above-mentioned message identifier, the above-mentioned basic description information and the above-mentioned added description information in a created target structure, the above-mentioned target structure is used to parse the received CAN message, or to encode the above-mentioned CAN message to be sent. In this embodiment, a specific method is implemented by running a processing code, wherein a CAN message is obtained through a DBC file, the CAN message is parsed to obtain a message identifier and signal description information, and based on the message identifier and the signal description information, it is determined to add description information, and then the message identifier, the basic description information and the added description information are stored in a created target structure, and the target structure is used to parse the received CAN message, or to encode the CAN message to be sent, so that only one processing code can be used to create a target structure stored in a DBC file based on the DBC file that is compatible with sending CAN messages, receiving CAN messages, multiplexing of multiple signals, etc., and can be used for subsequent sending and receiving of CAN messages, and the reception, parsing, encoding, sending and other operations of different CAN protocols can be realized by importing the DBC file without modifying the above processing code, thereby improving the compatibility of the processing code with different CAN protocols, thereby reducing the development and testing costs related to CAN bus communication and improving efficiency.
[0136] Optionally, the signal description information includes: a signal name of at least one signal and basic description information of each signal, and the added description information includes: the added description information of at least one signal.
[0137] The determination module 430 is specifically configured to determine the added description information of each signal according to the message identifier and the signal description information of at least one signal;
[0138] The above-mentioned added description information includes: the group index value, signal value description information, message value description information, signal storage sequence information, signal transmission time interval information and signal reception timestamp information.
[0139] Optionally, the target structure includes: at least one first structure, and a second structure;
[0140] The above-mentioned creation module 440 can also be used to create at least one of the above-mentioned first structures, and store the above-mentioned signal name, the above-mentioned basic description information and the above-mentioned added description information of at least one signal in at least one corresponding first structure; create the above-mentioned second structure, and store the signal list information, group index signal information, multiplexing flag information, the above-mentioned message identifier, message name description information, message frame type and message sending node description information of at least one signal in the above-mentioned second structure.
[0141] Optionally, the above-mentioned device may also include: a receiving module, used to receive a CAN message to be received; determine the above-mentioned second structure corresponding to the above-mentioned message identifier corresponding to the above-mentioned CAN message to be received from the above-mentioned target structure; determine whether the above-mentioned message identifier corresponding to the above-mentioned CAN message to be received is a message identifier of multiplexed signals according to the above-mentioned multiplexing flag information in the above-mentioned second structure; if it is a message identifier of multiplexed signals, use the above-mentioned second structure to locate the first group index number of the multiplexed signal to which the above-mentioned CAN message to be received belongs; according to the above-mentioned first group index number, use the above-mentioned second structure and at least one of the above-mentioned first structures to perform signal value analysis on the above-mentioned CAN message to be received.
[0142] Optionally, the above-mentioned receiving module can also be used to use the above-mentioned second structure and at least one of the above-mentioned first structures to perform signal value analysis on the above-mentioned CAN message to be received if it is a message identifier of a separate signal.
[0143] Optionally, the above-mentioned device may also include: a sending module, used to obtain the CAN message to be sent; parse the above-mentioned CAN message to be sent, obtain and set the signal name and signal value to be set corresponding to the above-mentioned CAN message to be sent and store them in a preset message sending buffer; determine the above-mentioned second structure corresponding to the above-mentioned message identifier corresponding to the above-mentioned CAN message to be sent from the above-mentioned target structure; determine whether the above-mentioned message identifier corresponding to the above-mentioned CAN message to be sent is a message identifier for multiplexed signals according to the above-mentioned multiplexing flag information in the above-mentioned second structure; if it is a message identifier for multiplexed signals, use the above-mentioned second structure to locate the second group index number of the multiplexed signal to which the above-mentioned CAN message to be sent belongs; according to the above-mentioned second group index number, use the above-mentioned second structure and at least one of the above-mentioned first structures to encode the signal value of the above-mentioned CAN message to be sent, and send the encoded above-mentioned CAN message to be sent.
[0144] Optionally, the sending module may also be used to encode the signal value of the CAN message to be sent using the second structure and at least one of the first structures if it is a message identifier of a separate signal, and send the encoded CAN message to be sent.
[0145] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0146] Figure 6 A schematic diagram of the structure of a communication device provided in an embodiment of the present application, the communication device may be a device such as the above-mentioned computer, such as Figure 6 As shown, the device 600 includes:
[0147] Processor 610 , storage medium 620 and bus 630 . Processor 610 and storage medium 620 are communicatively connected via bus 630 .
[0148] The storage medium 620 stores machine-readable instructions executable by the processor 610. When the communication device is running, the processor 610 executes the machine-readable instructions to perform the DBC file processing method.
[0149] It should be understood that Figure 6 The structure shown is only a schematic diagram of the structure of the communication device. The communication device may also include Figure 6 More or fewer components as shown, or with Figure 6 Different configurations are shown. Figure 6 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0150] The embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program can be executed by a processor, the DBC file processing method described in the above method embodiment is implemented.
[0151] 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 program codes that execute any of the method steps in the above method. These program codes may be read from or written to one or more computer program products. The program code may be compressed, for example, in an appropriate form.
[0152] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0153] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0154] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0155] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the inventive concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A DBC file processing method, characterized in that: The method comprises: Obtain a CAN database DBC file of a controller area network CAN bus, wherein the DBC file is used to describe a protocol message of the CAN bus; Obtaining a CAN message through the DBC file, and parsing the CAN message to obtain a message identifier and signal description information, wherein the signal description information includes: a signal name and basic description information; Determining to add description information according to the message identifier and the signal description information; The message identifier, the basic description information and the added description information are stored in a created target structure, and the target structure is used to parse the received CAN message or encode the CAN message to be sent.
2. The method according to claim 1, characterized in that The signal description information includes: a signal name of at least one signal and basic description information of each signal, and the added description information includes: the added description information of at least one signal; The determining, according to the message identifier and the signal description information, to add description information comprises: Determine the added description information of each signal respectively according to the message identifier and the signal description information of at least one signal; The added description information includes: a group index value, signal value description information, message value description information, signal storage sequence information, signal transmission time interval information, and signal reception timestamp information.
3. The method according to claim 2, characterized in that The target structure includes: at least one first structure, and a second structure; The method further comprises: Creating at least one of the first structures, and storing the signal name, the basic description information, and the added description information of at least one signal in at least one corresponding first structure; Create the second structure, and store the signal list information, group index signal information, multiplexing flag information, the message identifier, message name description information, message frame type and message sending node description information of at least one signal in the second structure.
4. The method according to claim 3, characterized in that The method further comprises: Receive the CAN message to be received; Determine the second structure corresponding to the message identifier corresponding to the to-be-received CAN message from the target structure; According to the multiplexing flag information in the second structure, determining whether the message identifier corresponding to the to-be-received CAN message is a message identifier for multiplexing of multiple signals; If it is a message identifier of multiplexed signals, the second structure is used to locate the first group index number of the multiplexed signals to which the CAN message to be received belongs; According to the first group index number, the second structure and at least one of the first structures are used to parse the signal value of the CAN message to be received.
5. The method according to claim 4, characterized in that The method further comprises: If it is a message identifier of a separate signal, the second structure and at least one of the first structures are used to perform signal value analysis on the CAN message to be received.
6. The method according to claim 3, characterized in that The method further comprises: Get the CAN message to be sent; Parsing the CAN message to be sent, obtaining and setting the signal name and signal value to be set corresponding to the CAN message to be sent and storing them in a preset message sending buffer; Determine, from the target structure, the second structure corresponding to the message identifier corresponding to the CAN message to be sent; Determine, according to the multiplexing flag information in the second structure, whether the message identifier corresponding to the CAN message to be sent is a message identifier for multiplexing of multiple signals; If it is a message identifier of multiplexed signals, the second structure is used to locate the second group index number of the multiplexed signals to which the CAN message to be sent belongs; According to the second group index number, the second structure and at least one of the first structures are used to encode the signal value of the CAN message to be sent, and the encoded CAN message to be sent is sent.
7. The method according to claim 6, characterized in that The method further comprises: If it is a message identifier of a separate signal, the second structure and at least one of the first structures are used to encode the signal value of the CAN message to be sent, and the encoded CAN message to be sent is sent.
8. A DBC file processing device, characterized in that: include: An acquisition module, used for acquiring a CAN database DBC file of a controller area network CAN bus, wherein the DBC file is used for describing a protocol message of the CAN bus; A parsing module, used to obtain a CAN message through the DBC file, and parse the CAN message to obtain a message identifier and signal description information, wherein the signal description information includes: a signal name and basic description information; A determination module, used for determining to add description information according to the message identifier and the signal description information; A creation module is used to store the message identifier, the basic description information and the added description information in a created target structure, wherein the target structure is used to parse the received CAN message or encode the CAN message to be sent.
9. A communication device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Message parsing method and device and vehicle-mounted terminal
CN111797098A
DBC file analysis method and device, equipment and storage medium
CN116112583A
Data analysis method and device, electronic equipment and storage medium
CN116132558A
DBC message signal assignment and analysis method and system, terminal equipment and storage medium
CN116248771A
Data conversion method, device and equipment, medium and vehicle
CN116820608A
Cited By
CAN message burying point data optimization acquisition method and system based on signal deduplication
CN120692180A