CN-121985050-A - Message processing method, device, vehicle, equipment, storage medium and program product
Abstract
The disclosure relates to a message processing method, a device, a vehicle, equipment, a storage medium and a program product, wherein the method comprises the steps of receiving a CAN message to be processed, splitting the CAN message to obtain load data and a time stamp of the CAN message, and converting the CAN message into an Ethernet message based on the load data and the time stamp, wherein the Ethernet message comprises a load frame and a time frame, the load frame carries the load data of the CAN message, and the time frame carries the time stamp of the CAN message. The method and the device realize lossless transmission of time information from the CAN message to the Ethernet message, effectively solve the problem of timestamp loss in traditional conversion, maintain the original time sequence characteristic of the message data and enhance the time reliability of the message transmission process.
Inventors
- GONG ZHANLI
Assignees
- 小米汽车科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260205
Claims (18)
- 1. A method for processing a message, comprising: receiving a CAN message to be processed; splitting the CAN message to obtain load data and a time stamp of the CAN message; and converting the CAN message into an Ethernet message based on the load data and the time stamp, wherein the Ethernet message comprises a load frame and a time frame, the load frame carries the load data of the CAN message, and the time frame carries the time stamp of the CAN message.
- 2. The method of claim 1, wherein the converting the CAN message to an ethernet message based on the load data and the timestamp comprises: Based on the load data and the time stamp, converting the CAN message with the preset fixed frame number into an Ethernet message, wherein the Ethernet message comprises a load frame and a time frame, the load frame carries the load data of the CAN message with the fixed frame number, and the time frame carries the time stamp of the CAN message with the fixed frame number.
- 3. The method of claim 1, wherein the converting the CAN message to an ethernet message based on the load data and the timestamp comprises: writing the load data of the CAN message into a load frame field of the Ethernet message according to a preset sequence; And forming a self-defined time frame according to the preset sequence by the time stamp of the CAN message, and attaching the time frame to the tail part of the Ethernet message.
- 4. The method of claim 3 wherein the CAN message to be processed is a plurality of frames, and wherein writing the payload data of the CAN message into the payload frame field of the Ethernet message in a predetermined order comprises: respectively forming a plurality of independent load frames from load data of a multi-frame CAN message to be processed; and writing the plurality of independent load frames into a load frame field of the Ethernet message according to the preset sequence.
- 5. The method of claim 4, wherein forming the time stamps of the CAN packets into custom time frames in the predetermined order, attaching the time frames to the tail of the ethernet packets, comprises: and forming one or more self-defined time frames of the multi-frame CAN message according to the preset sequence, and attaching the one or more time frames to the tail part of the Ethernet message.
- 6. The method as recited in claim 1, further comprising: And sending the Ethernet message to a receiving end, so that the receiving end recovers the load data of the CAN message based on the load frame field of the Ethernet message, and recovers the time information of the CAN message based on the time frame of the Ethernet message.
- 7. The method of claim 1, further comprising, prior to said converting said CAN message to an ethernet message based on said load data and said timestamp: determining a currently adapted target conversion frame number according to a current network load and/or a preset time precision requirement; And when the frame number of the CAN message to be processed reaches the target conversion frame number, converting the CAN message with the target conversion frame number into an Ethernet message based on the load data and the time stamp.
- 8. A message processing apparatus, comprising: the receiving module is used for receiving the CAN message to be processed; the splitting module is used for splitting the CAN message to obtain load data and a time stamp of the CAN message; The conversion module is used for converting the CAN message into an Ethernet message based on the load data and the time stamp, wherein the Ethernet message comprises a load frame and a time frame, the load frame carries the load data of the CAN message, and the time frame carries the time stamp of the CAN message.
- 9. The apparatus of claim 8, wherein the conversion module is configured to convert a CAN packet of a preset fixed frame number into an ethernet packet based on the load data and the timestamp, the ethernet packet including a load frame and a time frame, the load frame carrying load data of the CAN packet of the fixed frame number, and the time frame carrying a timestamp of the CAN packet of the fixed frame number.
- 10. The device of claim 8, wherein the conversion module is configured to write the load data of the CAN packet into a load frame field of the ethernet packet according to a preset sequence, form a custom time frame from the timestamp of the CAN packet according to the preset sequence, and attach the time frame to a tail of the ethernet packet.
- 11. The device of claim 10, wherein the CAN message to be processed is a plurality of frames, the conversion module is configured to form a plurality of individual load frames from load data of the multi-frame CAN message to be processed, and write the plurality of individual load frames into a load frame field of the ethernet message according to the preset sequence.
- 12. The apparatus of claim 11, wherein the conversion module is configured to form the time frames of the multi-frame CAN message into one or more custom time frames according to the preset sequence, and attach the one or more custom time frames to the tail of the ethernet message.
- 13. The apparatus of claim 8, further comprising a transmitting module configured to transmit the ethernet packet to a receiving end, so that the receiving end recovers load data of the CAN packet based on a load frame field of the ethernet packet, and recovers time information of the CAN packet based on a time frame of the ethernet packet.
- 14. The apparatus of claim 8, further comprising a determining module configured to determine a currently adapted target conversion frame number according to a current network load and/or a preset time precision requirement before the converting the CAN packet into an ethernet packet based on the load data and the timestamp, and convert the CAN packet of the target conversion frame number into the ethernet packet based on the load data and the timestamp when the frame number of the CAN packet to be processed reaches the target conversion frame number.
- 15. A vehicle, characterized by comprising: at least one processor, and A memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the processor being configured to execute the instructions to implement the method of any one of claims 1-7.
- 16. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the processor being configured to execute the instructions to implement the method of any one of claims 1-7.
- 17. A computer readable storage medium, characterized in that the storage medium stores a computer program or instructions, which, when executed by a processor of an electronic device, enable the electronic device to perform the method of any one of claims 1-7.
- 18. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
Description
Message processing method, device, vehicle, equipment, storage medium and program product Technical Field The present disclosure relates to the field of communications technologies, and in particular, to a method, an apparatus, a vehicle, a device, a storage medium, and a program product for processing a message. Background In an intelligent automobile, a CAN (Controller Area Network ) bus is used as a traditional vehicle communication protocol and is widely used for data interaction of modules such as automobile body control and power systems. However, with the popularization of the on-board ethernet, it is required to convert the CAN packet into an ethernet protocol (ETH) for transmission. In the process of converting the CAN message into the Ethernet message, the adopted message format cannot carry the original time stamp of the CAN message, so that the original time information of the CAN message cannot be recovered at the receiving end, and the application of the CAN message in the time sensitive function is limited. Disclosure of Invention In order to overcome the problems in the related art, the present disclosure provides a message processing method, a device, a vehicle, a device, a storage medium and a program product, which realize lossless transmission of time information from a CAN message to an ethernet message, effectively solve the problem of timestamp loss in the conventional conversion, maintain the original time sequence characteristic of message data, and enhance the time reliability of the message transmission process. In a first aspect, an embodiment of the disclosure provides a message processing method, which includes receiving a CAN message to be processed, splitting the CAN message to obtain load data and a timestamp of the CAN message, and converting the CAN message into an ethernet message based on the load data and the timestamp, wherein the ethernet message includes a load frame and a time frame, the load frame carries the load data of the CAN message, and the time frame carries the timestamp of the CAN message. In a second aspect, an embodiment of the present disclosure provides a packet processing device, including: the receiving module is used for receiving the CAN message to be processed; the splitting module is used for splitting the CAN message to obtain load data and a time stamp of the CAN message; The conversion module is used for converting the CAN message into an Ethernet message based on the load data and the time stamp, wherein the Ethernet message comprises a load frame and a time frame, the load frame carries the load data of the CAN message, and the time frame carries the time stamp of the CAN message. In a third aspect, embodiments of the present disclosure provide a vehicle comprising: at least one processor, and A memory communicatively coupled to the at least one processor; Wherein the memory stores instructions executable by the at least one processor, the processor being configured to execute the instructions to implement the method of any of the above aspects. In a fourth aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor, and A memory communicatively coupled to the at least one processor; Wherein the memory stores instructions executable by the at least one processor, the processor being configured to execute the instructions to implement the method of any of the above aspects. In a fifth aspect, embodiments of the present disclosure provide a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the method of any one of the above aspects. In a sixth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program which, when executed by a processor, implements the method of any of the above aspects. According to the message processing method, device, vehicle, equipment, storage medium and program product, the CAN message to be processed is split into the load data and the time stamp, the load frame and the time frame are set in the Ethernet message, the original load data and the time stamp of the CAN message are respectively carried in the load frame and the time frame of the Ethernet message, lossless transmission of the load data and the time information from the CAN message to the Ethernet message is achieved, the problem that the time stamp is lost in traditional conversion is effectively solved, the original time sequence characteristic of the message data is maintained, and the time reliability of the message transmission process is enhanced. Drawings The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in