Data message processing method and device, electronic equipment and storage medium
By detecting the identity identifier at the message receiving end of the TBOX platform and encapsulating the different types of messages, the problem of large data volume and large bandwidth occupancy when the MCU transmits CAN messages is solved, and efficient transmission of data messages is achieved and Real-time processing.
Patent Information
- Application Number
- CN202411316233.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-03
Smart Images

Figure CN119254477A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data message technology, and in particular to a data message processing method, device, electronic device, and computer-readable storage medium. Background Art
[0002] With the development of technology, in the TBOX platform architecture, microcontrollers (MCUs) are usually used in combination with microprocessors (MPUs), where the MPU is responsible for running applications that require high computing power, while the MCU is used for in-vehicle buses (such as CAN) and functional safety applications. Collecting messages from the vehicle's CAN network and uploading them to the MPU is one of the main tasks of the MCU.
[0003] However, in the prior art, the MCU usually parses all the CAN signals in the CAN message and transmits them to the MPU. This will result in a large amount of transmitted data, occupy the communication bandwidth, and cause great communication pressure. Therefore, a solution for transmitting and processing data messages is urgently needed to solve the above problems and improve the transmission efficiency of data messages. Summary of the invention
[0004] To solve the above technical problems, the embodiments of the present application provide a data message processing method and device, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of an embodiment of the present application, a data message processing method is provided, which is applied to a message receiving end, including: receiving a data message and determining an identity identifier corresponding to the data message; if the identity identifier indicates that the data message is in a preset whitelist of the message receiving end, identifying the message type corresponding to the data message; if the data message belongs to an event-type message, encapsulating the identity identifier of the data message and the original data corresponding to the data message into a message signal; and sending the message signal to a corresponding target processor so that the message signal can be parsed and processed by the target processor.
[0006] According to one aspect of an embodiment of the present application, the method also includes: if the data message is a periodic message, extracting the original data in the data message; obtaining the historical original data corresponding to the identity identifier, the historical original data including the original data received by the identity identifier in the current period; if the original data matches the historical original data, sending the message signal corresponding to the data message to the corresponding target processor according to the sending period corresponding to the data message.
[0007] According to one aspect of an embodiment of the present application, the method includes: if the original data does not match the historical original data, encapsulating the identity identifier and the original data into a message signal and forwarding it to a corresponding target processor.
[0008] According to one aspect of an embodiment of the present application, encapsulating the identity identifier of the data message and the original data corresponding to the data message into a message signal includes: determining the valid data corresponding to the data message, and extracting the original data corresponding to the valid data; encapsulating the original data and the identity identifier of the data message into a message signal.
[0009] According to one aspect of an embodiment of the present application, a data message processing method is provided, which is applied to a message processing end, including: receiving a message signal sent by a message receiving end, and parsing the message signal to obtain a parsing result; determining bit data corresponding to the message signal according to a preset communication matrix and the parsing result; and performing byte order conversion on the bit data to obtain a signal value corresponding to the message signal.
[0010] According to one aspect of an embodiment of the present application, the method also includes: determining each signal in the message signal based on the analysis result; determining the cache variable corresponding to each signal based on the mapping relationship between the signal and the cache vector in the preset communication matrix; and determining the signal value corresponding to each signal in the message signal based on the cache variable.
[0011] According to one aspect of an embodiment of the present application, a data message processing device is provided, which is applied to a message receiving end, and the device includes: a determination module, which is used to receive a data message and determine an identity identifier corresponding to the data message; an identification module, which is used to identify the message type corresponding to the data message if the identity identifier represents that the data message is in a preset whitelist of the message receiving end; an encapsulation module, which is used to encapsulate the identity identifier of the data message and the original data corresponding to the data message into a message signal if the data message belongs to an event-type message; and a sending module, which is used to send the message signal to a corresponding target processor so that the message signal can be parsed and processed by the target processor.
[0012] According to one aspect of an embodiment of the present application, a data message processing device is provided, which is applied to a message processing end, and the device includes: a parsing module, which is used to receive a message signal sent by a message receiving end, and parse the message signal to obtain a parsing result; a determination module, which is used to determine the bit data corresponding to the message signal according to a preset communication matrix and the parsing result; and a conversion module, which is used to perform byte order conversion on the bit data to obtain a signal value corresponding to the message signal.
[0013] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the data message processing method as described above.
[0014] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the data message processing method as described above.
[0015] According to one aspect of an embodiment of the present application, a computer program product is also provided, including a computer program, which implements the steps in the data message processing method described above when executed by a processor.
[0016] In the technical solution provided in the embodiments of the present application, by detecting whether the identity identifier of the data message is in the preset whitelist, it is possible to effectively prevent unauthorized or malicious data messages from entering, thereby ensuring security. Then, targeted processing can be performed according to the type of data message corresponding to the data message. For event-type messages, the identity identifier and the original data are directly encapsulated as a message signal. This can avoid the problem of large data volume transmitted by the message signal after parsing by the message receiving end, large bandwidth occupation, and high communication pressure. In addition, by quickly encapsulating and sending it to the target processor for processing, the response time can be significantly shortened, and the real-time and reliability of data message processing can be improved.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 It is a schematic diagram of an implementation environment for data message processing shown in an exemplary embodiment of the present application;
[0020] Figure 2 is a flow chart of a data message processing method shown in an exemplary embodiment of the present application;
[0021] Figure 3 is a flow chart of a data message processing method shown in another exemplary embodiment of the present application;
[0022] Figure 4 is a flow chart of a data message processing method shown in another exemplary embodiment of the present application;
[0023] Figure 5 is a schematic diagram of the structure of a message signal shown in an exemplary embodiment;
[0024] Figure 6 is a flow chart of a data message processing method shown in another exemplary embodiment of the present application;
[0025] Figure 7 is a flow chart of a data message processing method shown in another exemplary embodiment of the present application;
[0026] Figure 8 It is a brief flow chart of data message processing in an exemplary application scenario;
[0027] Fig. 9 is a block diagram of a data message processing device shown in an exemplary embodiment of the present application;
[0028] Fig.10 is a block diagram of a data message processing device shown in an exemplary embodiment of the present application;
[0029] Fig.11 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0031] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0032] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0033] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0034] First of all, it should be noted that in the TBOX (Telematics Box) platform architecture, the combination of MCU (Microcontroller Unit) and MPU (Microprocessor Unit) is an efficient and flexible design method to meet the performance and cost requirements in different application scenarios. This architecture is particularly suitable for the vehicle field, where there are high requirements for real-time, reliability and cost-effectiveness. Among them, the roles of MCU include: MCU is very suitable for processing tasks that require fast response due to its low power consumption and efficient real-time processing capabilities, such as in-vehicle bus communication (such as CAN bus), sensor data acquisition, basic safety control, etc.; in application scenarios with high functional safety requirements, MCU can ensure the safe execution of key tasks and prevent system failures from causing harm to passengers and vehicles; MCU is responsible for collecting messages from the vehicle CAN network. CAN bus is the main network for communication between various control units (ECUs) in the vehicle. By reading messages on the CAN bus, MCU can obtain various status information of the vehicle, such as vehicle speed, engine speed, door status, etc.
[0035] The roles of MPU include: (High-computing power applications) MPU has stronger computing power and larger memory space than MCU, so it is responsible for running applications that require high computing power, such as complex image processing, advanced driver assistance system (ADAS) algorithms, in-vehicle entertainment systems, etc. MPU also has data processing and analysis functions. After receiving raw data such as CAN messages from MCU, MPU performs further processing and analysis to support higher-level vehicle functions and services.
[0036] In the TBOX platform, MCU and MPU exchange data through efficient communication mechanisms (such as SPI, I2C or dedicated high-speed interfaces). MCU uploads key data such as collected CAN messages to MPU, which uses these data for analysis and decision-making, and then sends the results or instructions back to MCU for execution. This collaborative working mode not only improves the overall performance of the system, but also enhances the flexibility and scalability of the system.
[0037] Figure 1 FIG. 1 is a schematic diagram of an implementation environment for data message processing shown in an exemplary embodiment of the present application. Figure 1 As shown, the message receiving end 110 monitors the data message, extracts the identity identifier corresponding to the data message, and detects whether the identity identifier is in the preset white list of the message receiving end. If the identity identifier represents that the data message is in the preset white list of the message receiving end, the type corresponding to the data message is identified. If the message receiving end 110 detects that the data message belongs to an event-type message, the identity identifier of the data message and the original data corresponding to the data message are encapsulated as a message signal; and the message signal is sent to the message processing end 120, and then the message processing end 120 parses and processes the message signal to realize the processing of the data message.
[0038] With the development of technology, in the TBOX platform architecture, microcontrollers (MCUs) are usually used in combination with microprocessors (MPUs), where the MPU is responsible for running applications that require high computing power, while the MCU is used for in-vehicle buses (such as CAN) and functional safety applications. Collecting messages from the vehicle's CAN network and uploading them to the MPU is one of the main tasks of the MCU.
[0039] However, in the prior art, the MCU usually parses all the CAN signals in the CAN message and transmits them to the MPU. This will result in a large amount of transmitted data, occupy the communication bandwidth, and cause great communication pressure. Therefore, a solution for transmitting and processing data messages is urgently needed to solve the above problems and improve the transmission efficiency of data messages.
[0040] The above-mentioned problems are generally applicable in the TBOX platform architecture. To solve these problems, the embodiments of the present application respectively propose a data message processing method, a data message processing device, an electronic device, a computer-readable storage medium and a computer program product, which will be described in detail below.
[0041] See also Figure 2 , Figure 2 is a flowchart of a data message processing method shown in an exemplary embodiment of the present application. The method can be applied to Figure 1The implementation environment shown is a schematic diagram. It should be understood that the method may also be applicable to other exemplary implementation environments and may be specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.
[0042] like Figure 2 As shown, in an exemplary embodiment, the data message processing method includes at least steps S210 to S240, which are described in detail as follows:
[0043] Step S210, receiving a data message and determining an identity corresponding to the data message.
[0044] First of all, it is necessary to explain the key features and functions of the Component Platform (CP) in AUTOSAR (AUTomotive Open System ARchitecture). AUTOSAR is a global collaborative development framework that aims to provide a standardized software architecture for automotive electronic / electrical architecture to support the portability, reusability and interchangeability of software components between different suppliers.
[0045] In the AUTOSAR architecture, Component Platform (CP) is a key component. It provides a set of predefined services and interfaces, allowing developers to build and integrate software components based on these standardized interfaces. These components can be independently developed, tested and maintained, and then integrated into a larger system, thereby improving development efficiency and system reliability. CP runs on the MCU (microcontroller unit). As one of the core software layers of the automotive electronic system, it is responsible for interacting with the hardware and providing necessary services and interfaces to the upper-layer application software. In terms of CAN (Controller Area Network) network management, CP plays a vital role. It is responsible for initializing and managing the CAN network, including configuring CAN channels, setting baud rates, handling network failures, etc. In addition, CP is also responsible for the transmission and reception of CAN messages, that is, receiving CAN messages from other ECUs (Electronic Control Units) and passing them to the corresponding application components for processing, and also sending out CAN messages generated by this ECU.
[0046] Specifically, data messages on the CAN network are received by the CAN controller (usually integrated in the MCU). The CAN controller is responsible for monitoring the signals on the CAN bus and storing the received data messages in the receive buffer. When the CAN controller receives a data message, it may trigger an interrupt signal to the CPU (microprocessor). The CPU responds to this interrupt and executes the corresponding interrupt service routine (ISR) to process the received data message. In the interrupt service routine, the CPU reads the data message from the receive buffer of the CAN controller.
[0047] A data message usually includes an identifier (ID) field and a data field. The identifier is used to uniquely identify the data message, while the data field contains the actual data. The CPU parses the identifier field in the data message to determine the identity of the data message. The identity can be predefined to indicate the source, type or purpose of the data message. Once the identity of the data message is determined, it can be routed to the corresponding software component or application for processing as needed.
[0048] Step S220: If the data message represented by the identity identifier is in the preset white list of the message receiving end, the type corresponding to the data message is identified.
[0049] Specifically, the receiving end maintains a preset whitelist, which contains the identities of the data messages that are allowed to be received. When a data message is received and its identity is determined, it will check whether the identity exists in the whitelist. If the identity is found in the whitelist, the verification is passed, indicating that the data message is expected to be received. If the identity is not in the whitelist, further actions may need to be taken, such as ignoring the data message, recording an error, or sending a warning signal. Once it is confirmed that the identity of the data message is in the whitelist, the specific type of the data message needs to be identified next. Among them, the type of the data message may be implicitly indicated by the identity itself, or indicated by specific information in the data field in the data message. In some cases, it may be necessary to refer to additional mapping tables or configuration files to determine the type of the data message.
[0050] Step S230: If the data message is an event-type message, the identity identifier of the data message and the original data corresponding to the data message are encapsulated into a message signal.
[0051] Specifically, first, it is necessary to identify whether the received data message is an event message, which is usually done by checking the identity (ID) of the data message or specific information in the data field. Among them, event messages refer to those messages that indicate the occurrence of a specific event or state change, such as sensor readings, switch state changes, etc., and extract the raw data from the received data message. These data are usually located in the data field and are parsed according to the definition of the data message. A message signal object or data structure is created to encapsulate the identity and raw data of the data message. The identity of the data message is stored as part of the message signal, which helps to identify the source and type of the data message in subsequent processing. The parsed raw data is also encapsulated in the message signal, and this data will be used for subsequent application logic processing or state update. Before or after encapsulating the message signal, some additional processing may be required, such as data verification, data conversion (such as unit conversion, scaling, etc.) or data filtering (such as noise removal, outlier detection, etc.).
[0052] Step S240: sending the message signal to the corresponding target processor so that the target processor can parse and process the message signal.
[0053] It should be noted that in embedded or distributed systems, Remote Procedure Call (RPC) is a protocol that allows a program (called a client) to call a procedure or function in another address space (usually another computer on the network, but in embedded systems it may be a different processor in the same system, such as an MCU and an MPU), just like calling a local procedure. In this embodiment, RPC specifically refers to a data interaction module or process between an MCU (microcontroller unit) and an MPU (microprocessor unit), and this interaction is usually based on a serial clock data transmission protocol, such as UART (Universal Asynchronous Receiver / Transmitter), I2C (Inter-Integrated Circuit, a serial communication protocol), or SPI (Serial Peripheral Interface, a serial peripheral interface).
[0054] Specifically, the identity of the data message and the corresponding original data can be encapsulated into a corresponding message signal, and the original data of the data message is not parsed in the message signal, thereby reducing the amount of data transmission. In the process of transmitting the message signal to the target processor, first, it is necessary to determine which target processor (MPU) should receive and process the message signal, which is usually determined based on the requirements of the architecture and application. In some feasible embodiments, one or more MPUs are responsible for processing different types of message signals. The message signal is then sent to the target processor via RPC so that the target processor can parse and process the message signal.
[0055] In this embodiment, by detecting whether the identity identifier of the data message is in the preset whitelist, unauthorized or malicious data messages can be effectively prevented from entering, thereby ensuring security. Then, targeted processing can be performed according to the type of data message. For event-type messages, the identity identifier and the original data are directly encapsulated as a message signal. This can avoid the problem of large data volume transmitted by the message signal after parsing by the message receiving end, large bandwidth occupation, and high communication pressure. In addition, by quickly encapsulating and sending it to the target processor for processing, the response time can be significantly shortened, and the real-time and reliability of data message processing can be improved.
[0056] Further, based on the above embodiments, please refer to Figure 3 In one of the exemplary embodiments provided in the present application, the specific implementation process of the above data message processing method may also include steps S310 to S330, which are described in detail as follows:
[0057] Step S310: If the data message is a periodic message, extract the original data in the data message.
[0058] Specifically, a message whitelist mechanism is pre-set in the message data receiving end, and then the pre-set message whitelist mechanism can be used to determine which messages need to be transmitted to the message processing end for parsing, and the pre-set message whitelist mechanism can also be used to control the message transmission mode and transmission efficiency, which can improve the flexibility and transmission efficiency of message signal transmission. For example, taking the data message as CAN data as an example, the whitelist mechanism includes the following data structures:
[0059] Can ID: The corresponding CAN message identity.
[0060] send-period: CAN message sending period.
[0061] times-count: Number of times the packet is received.
[0062] buffer: Cache the original data of the message received last time.
[0063] Using the above data structure, define a structure array. The information corresponding to the CAN message that needs to be forwarded to the MPU must be filled into the array (white list) to achieve forwarding. CAN messages that are not added to the white list will be filtered out. Specifically, after receiving a data message at the data receiving end, it will determine whether the identity of the data message is in the preset white list. If it is in the preset white list, it will further determine the message type to which the data message belongs. If the data message belongs to a periodic message, the original data carried in the data message is extracted. Among them, periodic messages refer to data messages that are sent periodically at certain time intervals. They are usually used to transmit information that needs to be updated regularly, such as sensor readings, status updates, etc.
[0064] Exemplarily, first, it is necessary to identify whether the received data message is a periodic message. This is usually done by checking the identity (ID) of the data message, specific information in the data field, or timestamp. For periodic messages, it may be verified whether the message sending time is consistent with the expected period, which helps to ensure the real-time and accuracy of the data and detect possible communication failures or data loss. When the data message is confirmed to be a periodic message and passes the time verification, the original data will be extracted from the data message, and this data is usually located in the data field and can be parsed according to the definition of the data message.
[0065] Step S320, obtaining historical original data corresponding to the identity identifier, where the historical original data includes original data received by the identity identifier in the current cycle.
[0066] Specifically, when it is determined that the data message is a periodic message, the historical original data corresponding to the identity identifier of the data message cached in the data receiving end can be obtained, wherein the historical original data includes the original data received by the identity identifier corresponding to the data message in the current period. For example, the Can ID in the whitelist data architecture can be compared with the content cached in the buffer.
[0067] Exemplarily, first, an identity is extracted from a received periodic message, and this identity is used to uniquely identify the data source or data type to which the message belongs, and raw data is extracted from the currently received periodic message, which data is sent by the data source in the current period and is associated with a specific identity. Then, the historical raw data corresponding to the identity cached in the data receiving end can be obtained.
[0068] Step S330: If the original data matches the historical original data, a message signal corresponding to the data message is sent to the corresponding target processor according to the sending period corresponding to the data message.
[0069] Specifically, the original data corresponding to the received periodic data message is compared with the historical original data received in the current cycle. If the comparison result indicates that the original data matches the historical original data, the message signal corresponding to the data message can be sent to the corresponding target processor according to the sending cycle corresponding to the data message. That is, if the original data of the periodic data message matches the historical original data, it indicates that the original data of the data message has not changed in the current cycle, and then it is further determined whether the periodic sending time of the message has arrived. If not, the message signal corresponding to the data message can be sent to the corresponding target processor when the periodic sending time of the message has arrived.
[0070] Exemplarily, the currently received raw data is compared with the historical raw data to check whether they match. The specific matching criteria depend on the application scenario and data characteristics. For example, it may only be necessary to check whether the data is within a predefined tolerance range, or whether it follows a specific pattern or sequence. If the data match is successful, the sending cycle of the data message should be checked, which is usually done by comparing the timestamp or sequence number in the message with the expected sending cycle. If the current time (or the order of the sequence number) meets the requirements of the sending cycle, the message signal corresponding to the data message is sent to the corresponding target processor.
[0071] In this embodiment, the message signal is sent to the target processor according to the data message sending cycle only when the original data matches the historical original data. This avoids data transmission when the data is abnormal or invalid, thereby saving resources and bandwidth, and by reducing delays and errors in data transmission and processing, it can respond to external events or requests more quickly, thereby improving the overall response speed.
[0072] According to one aspect of the embodiments of the present application, in one of the exemplary embodiments provided in the present application, the specific implementation process of the above data message processing method may also include the following steps, which are described in detail as follows:
[0073] If the original data does not match the historical original data, the identity identifier and the original data are encapsulated as a message signal and forwarded to the corresponding target processor.
[0074] Continuing from the above embodiment, if the original data of the periodic data message does not match the historical original data of the periodic data message within the same period, it indicates that the data message has changed, and it is necessary to immediately encapsulate the identity of the data message and the corresponding original data into a message signal, and forward the message signal to the corresponding target processor.
[0075] Exemplarily, after receiving a new periodic message, the identity identifier and original data are first extracted and compared with the previously stored historical original data. Once it is determined that the data does not match, a new message signal needs to be prepared to transmit the inconsistent information.
[0076] The encapsulation process involves packaging the identity and original data as payload into the message signal. This may need to be done in a certain data format or protocol to ensure the integrity and identifiability of the data during transmission. Once the message signal is encapsulated and the target processor is selected, the message signal will be forwarded to the target processor via the network, RPC or other communication mechanism.
[0077] In this embodiment, in the case of a mismatch, it means that the periodic message has changed, and the data message can be immediately sent to the message processing end. By forwarding the unmatched data to the target processor, the data status and processing results can be fed back in real time, so that the monitoring personnel or administrators can understand the operating status in time and take corresponding measures to ensure stable operation.
[0078] Further, based on the above embodiments, please refer to Figure 4 In one of the exemplary embodiments provided in the present application, the specific implementation process of encapsulating the identity identifier of the data message and the original data corresponding to the data message into a message signal may also include step S410 and step S420, which are described in detail as follows:
[0079] Step S410, determining the valid data corresponding to the data message, and extracting the original data corresponding to the valid data;
[0080] Step S420: encapsulate the original data and the identity identifier of the data message into a message signal.
[0081] Specifically, in the process of parsing the data message, it is necessary to determine which data is valid. Valid data refers to data that meets predefined conditions, has a correct format and is useful.
[0082] The method of determining valid data may vary depending on the application scenario, but usually includes checking the integrity of the data (such as checksums), verifying the range of the data (such as whether the temperature is within a reasonable range), confirming the timestamp of the data, etc. Once the valid data is determined, it is necessary to extract the original data from these valid data. Raw data refers to data that is not processed or converted and comes directly from the data source. The encapsulation process involves packaging the raw data and identity into a whole according to a certain format or protocol so that it can be transmitted over the network or other communication mechanisms. Additional metadata (such as timestamps, serial numbers, checksums, etc.) may need to be added during encapsulation to ensure the integrity and identifiability of the data.
[0083] For example, Figure 5 As shown, taking the data message as a CAN message as an example, CanId (2 bytes): is used to uniquely identify the message on the CAN network. It determines which nodes (such as ECU, sensor, etc.) will receive and process the message. CanData (8 bytes): contains the actual data to be transmitted. This length is fixed, and of course it can be adjusted according to actual application requirements (although in standard CAN 2.0A, the maximum length of the data field is 8 bytes). In the RPC framework, in order to transmit CAN messages, CanId and CanData can be encapsulated into a structure or message body, and then sent to the target processor or through the network (such as Ethernet, serial bus, etc.). Since the length of Payload (effective data) has been specified as 10 bytes (CanId 2 bytes + CanData 8 bytes), the encapsulation process is very direct and simple.
[0084] In this embodiment, since the message signal has a small data volume, fast transmission speed, low latency, and the data structure of the message signal is simple and clear, easy to implement and maintain, this encapsulation method is very suitable for application scenarios that require efficient transmission of CAN messages, such as automotive control, industrial automation, etc.
[0085] Further, based on the above embodiments, the present application provides a data message processing method, which is applied to a message processing end of a device, such as Figure 6 As shown, the specific implementation process of the data message processing method of the message processing end includes steps S610 to S630, which are described in detail as follows:
[0086] Step S610, receiving a message signal sent by a message receiving end, and analyzing the message signal to obtain an analysis result;
[0087] Step S620, determining the bit data corresponding to the message signal according to the preset communication matrix and the analysis result;
[0088] Step S630, performing byte order conversion on the bit data to obtain a signal value corresponding to the message signal.
[0089] It should be noted that the Com module in Autosar Cp can be transplanted to the MPU processing end to parse the Rpc data packet corresponding to the CAN message transmitted by the receiving MCU and obtain all the CAN signal values, so that the MPU processing end does not need to develop a set of CAN signal parsing code. In the embedded automotive protocol, the Autosar com component plays an important role. It ensures the sending and receiving of data and notifies the application of the result (success or error) when necessary. For example, when the I-PDU transmission is not completed before the specified deadline, Autosar com can send a notification to the application, and the corresponding buffer area is defined for the raw data and signal of each CAN message in Autosar Cp, and the recently received CAN data will be filled into these buffer areas in real time, so that the application module can easily obtain the can raw data and use these buffers to control the transmission frequency. There is no need to open up a buffer area and grab the can data from the bottom layer, which saves MCU resources and makes it more convenient to extract can raw data using Autosar Cp.
[0090] Specifically, after receiving the message signal sent by the message receiving end, the message processing end parses the message signal sent by the message receiving end, and can parse the original data of the data message from the message signal, split the signal data from the original data cache, and after converting the byte order of the signal, obtain the value corresponding to each signal in the message signal according to the corresponding data meaning in the communication matrix.
[0091] For example, a message signal: a message is a data unit transmitted in network communication, usually including a header (such as source address, destination address, control information, etc.) and a data part. The received message signal needs to be parsed into a recognizable data format, which usually involves understanding the message structure, including message length, field separator, checksum, etc. The parsed result is usually a series of data fields, which may be represented by strings, numbers or other data types, where the preset communication matrix is a predefined mapping table or rule set for mapping the parsed data fields to specific bit data. These bit data may represent the status of the device, parameter values or other control information.
[0092] Byte order refers to the order in which multi-byte data is stored in computer memory, mainly in big-endian and little-endian. Different devices may use different byte orders. Since the message signal may come from different devices, its byte order may be inconsistent with the receiving end. Therefore, before converting the bit data into a signal value, byte order conversion is required to ensure the correct interpretation of the data. The bit data after byte order conversion can be further processed or interpreted to obtain the final signal value. This signal value may represent a certain state of the device, the actual value of a parameter, or other meaningful information.
[0093] In this embodiment, through a strict message signal parsing process, it can be ensured that the received data is interpreted according to the established format and rules, reducing the possibility of data errors or misreadings. The preset communication matrix is used as a benchmark for data parsing to ensure that the correspondence between data fields and devices or internal data structures is accurate, thereby improving the accuracy of data processing. By converting the byte order of bit data, it can be ensured that data is correctly transmitted and parsed between devices with different byte orders.
[0094] Further, based on the above embodiment, please refer to Figure 7 In one of the exemplary embodiments provided in the present application, the specific implementation process of the above data message processing method may also include steps S710 to S730, which are described in detail as follows:
[0095] Step S710, determining each signal in the message signal based on the analysis result;
[0096] Step S720, determining a cache variable corresponding to each signal based on a mapping relationship between signals and cache vectors in a preset communication matrix;
[0097] Step S730: determining a signal value corresponding to each signal in the message signal based on the cache variable.
[0098] Specifically, after the message signal is successfully parsed, a series of data items or fields will be obtained, which are organized according to the structure and format of the message. According to the definition or specification of the message (such as the DBC file of the CAN message, the custom protocol document, etc.), each data item or field in the parsing result can be identified as a specific signal. The signal is a meaningful data unit in the message, representing the status, parameters or other information of the device. The preset communication matrix: This is a table or data structure that stores the mapping relationship between signals and caches. It defines how each signal should be stored in the memory of the receiving end and the location of these signals in the memory (i.e., cache variables). Each signal has one or more cache variables associated with it. These cache variables are used to store the value of the signal at the receiving end for subsequent processing or analysis. By looking up the preset communication matrix, the cache variable corresponding to each signal can be determined. This usually involves matching the identifier of the signal (such as signal name, ID, etc.) with the entry in the matrix.
[0099] Later, once the corresponding cache variables for each signal are determined, the values of the signals can be read from these variables. These values are stored after the message signals are received, parsed, and mapped to the cache variables. The signal value is the actual numerical value of the signal at a specific point in time, which represents the current state or parameter of the device. These values can be further processed or analyzed as needed, such as for control decisions, data logging, or user interface display.
[0100] In this embodiment, by parsing each signal in the message signal one by one, the integrity and accuracy of the data are ensured. Each signal is processed separately, reducing the error accumulation caused by the overall processing. By using the mapping relationship in the preset communication matrix, the cache variable corresponding to each signal can be accurately found, avoiding data confusion caused by mapping errors.
[0101] Figure 8It is an interactive flow chart of data message processing between a message receiving end and a message processing end in an exemplary application scenario. At the message receiving end, after receiving the data message, the identity identifier corresponding to the data message is determined, and it is judged whether the identity identifier is in the preset white list. If it is in the preset white list, the message type corresponding to the data message is identified. If the message type is a data event message, the corresponding message signal is encapsulated according to the identity identifier of the data message and the original data corresponding to the data message, and the message signal is sent to the message processing end, so that the message signal is further parsed by the message processing end. If the data message belongs to a periodic message, the original data in the data message is extracted; the historical original data corresponding to the identity identifier is obtained, and the historical original data includes the original data received by the identity identifier in the current period; if the original data matches the historical original data, the message signal corresponding to the data message is sent to the corresponding target processor according to the sending period corresponding to the data message. If the original data does not match the historical original data, the identity identifier and the original data are encapsulated as a message signal and forwarded to the corresponding target processor. At the message processing end, after obtaining the complete original message data from the message signal, the signal data can be split from the original cache data by presetting the definition of the original data in the communication matrix, thereby obtaining the signal value corresponding to each signal in the message signal. For the detailed implementation process, please refer to the records in the aforementioned embodiments, which will not be described in detail here.
[0102] Fig. 9 is a block diagram of a data message processing device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The implementation environment shown is as follows. The device may also be applicable to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applicable.
[0103] like Fig. 9 As shown, the exemplary data message processing device is applied to a message receiving end, and the device includes: a determination module 910, which is used to receive a data message and determine an identity identifier corresponding to the data message; an identification module 920, which is used to identify the message type corresponding to the data message if the identity identifier represents that the data message is in a preset whitelist of the message receiving end; an encapsulation module 930, which is used to encapsulate the identity identifier of the data message and the original data corresponding to the data message into a message signal if the data message belongs to an event-type message; and a sending module 940, which is used to send the message signal to the corresponding target processor so that the message signal can be parsed and processed by the target processor.
[0104] According to one aspect of an embodiment of the present application, the above-mentioned data message processing device also includes: an extraction module, which is used to extract the original data in the data message if the data message is a periodic message; an acquisition module, which is used to obtain historical original data corresponding to the identity identifier, and the historical original data includes the original data received by the identity identifier in the current period; a comparison module, which is used to send the message signal corresponding to the data message to the corresponding target processor according to the sending period corresponding to the data message if the original data matches the historical original data.
[0105] According to one aspect of an embodiment of the present application, the comparison module is also used to encapsulate the identity identifier and the original data into a message signal and forward it to the corresponding target processor if the original data does not match the historical original data.
[0106] According to one aspect of an embodiment of the present application, the encapsulation module 930 is further used to determine valid data corresponding to the data message, and extract original data corresponding to the valid data; and encapsulate the original data and the identity of the data message into a message signal.
[0107] See also Fig.10 According to one aspect of the embodiment of the present application, a data message processing device is provided, which is applied to a message processing end. The device can be applied to Figure 1 The implementation environment shown is as follows. The device may also be applicable to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applicable.
[0108] The data message processing device 1000 includes: a parsing module 1010, which is used to receive a message signal sent by a message receiving end, and parse the message signal to obtain a parsing result; a determination module 1020, which is used to determine the bit data corresponding to the message signal according to a preset communication matrix and the parsing result; and a conversion module 1030, which is used to perform byte order conversion on the bit data to obtain a signal value corresponding to the message signal.
[0109] According to one aspect of an embodiment of the present application, the above-mentioned data message processing device also includes: a signal splitting module, used to determine each signal in the message signal based on the analysis result; a cache variable module, used to determine the cache variable corresponding to each signal based on the mapping relationship between the signal and the cache vector in the preset communication matrix; a signal value determination module, used to determine the signal value corresponding to each signal in the message signal based on the cache variable.
[0110] It should be noted that the data message processing device provided in the above embodiment and the data message processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the data message processing device provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0111] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the data message processing method provided in the above-mentioned embodiments.
[0112] Fig.11 The structure diagram of a computer suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Fig.11 The computer 1100 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0113] like Fig.11 As shown, the computer 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1102 or the program loaded from the storage part 1108 to the random access memory (RAM) 1103, such as executing the method in the above embodiment. In the RAM 1103, various programs and data required for the operation are also stored. The CPU 1101, the ROM 1102 and the RAM 1103 are connected to each other through the bus 1104. The input / output (I / O) interface 1105 is also connected to the bus 1104.
[0114] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed so that a computer program read therefrom is installed into the storage section 1108 as needed.
[0115] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1109, and / or installed from a removable medium 1111. When the computer program is executed by a central processing unit (CPU) 1101, various functions defined in the present application are executed.
[0116] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, a device or a component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for execution by an instruction, use by an apparatus or device, or use in conjunction with the instruction. The computer program contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the 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 boxes represented in succession 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 or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based implementation that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0118] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0119] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the data message processing method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0120] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the data message processing method provided in each of the above embodiments.
[0121] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A data message processing method, characterized in that: Applied to the message receiving end, including: Receive a data message and determine an identity corresponding to the data message; If the identity identifier indicates that the data message is in a preset whitelist of the message receiving end, identifying the message type corresponding to the data message; If the data message is an event-type message, encapsulating the identity identifier of the data message and the original data corresponding to the data message into a message signal; The message signal is sent to a corresponding target processor so that the target processor parses and processes the message signal.
2. The method according to claim 1, characterized in that The method further comprises: If the data message is a periodic message, extracting original data in the data message; Acquire historical original data corresponding to the identity identifier, wherein the historical original data includes original data received by the identity identifier in a current period; If the original data matches the historical original data, a message signal corresponding to the data message is sent to a corresponding target processor according to a sending period corresponding to the data message.
3. The method according to claim 2, characterized in that The method comprises: If the original data does not match the historical original data, the identity identifier and the original data are encapsulated as a message signal and forwarded to the corresponding target processor.
4. The method according to claim 1, characterized in that The step of encapsulating the identity identifier of the data message and the original data corresponding to the data message into a message signal includes: Determine the valid data corresponding to the data message, and extract the original data corresponding to the valid data; The original data and the identity identifier of the data message are encapsulated into a message signal.
5. A data message processing method, characterized in that: Applied to the message processing end, including: Receiving a message signal sent by a message receiving end, and analyzing the message signal to obtain an analysis result; Determine the bit data corresponding to the message signal according to the preset communication matrix and the analysis result; The bit data is converted into a byte order to obtain a signal value corresponding to the message signal.
6. The method according to claim 5, characterized in that The method further comprises: Determine each signal in the message signal based on the analysis result; Determine the cache variable corresponding to each signal based on the mapping relationship between the signal and the cache vector in the preset communication matrix; A signal value corresponding to each signal in the message signal is determined based on the cache variable.
7. A data message processing device, characterized in that: Applied to a message receiving end, the device comprises: A determination module, used to receive a data message and determine an identity corresponding to the data message; an identification module, configured to identify a message type corresponding to the data message if the identity identifier indicates that the data message is in a preset whitelist of the message receiving end; An encapsulation module, used for encapsulating the identity of the data message and the original data corresponding to the data message into a message signal if the data message belongs to an event-type message; The sending module is used to send the message signal to the corresponding target processor so that the message signal can be parsed and processed by the target processor.
8. A data message processing device, characterized in that: Applied to a message processing end, the device comprises: A parsing module, used for receiving a message signal sent by a message receiving end, and parsing the message signal to obtain a parsing result; A determination module, used to determine the bit data corresponding to the message signal according to a preset communication matrix and the analysis result; The conversion module is used to perform byte order conversion on the bit data to obtain a signal value corresponding to the message signal.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the data message processing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the data message processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Vehicle-mounted data transmission method, device and equipment and storage medium
CN111245776A
Vehicle data acquisition and uploading method capable of being remotely and dynamically configured and storage medium
CN111447128A
Vehicle, data unvarnished transmission method thereof and computer readable storage medium
CN114866484A
Message detection method and device, electronic equipment and storage medium
CN115412346A
Method and device for processing vehicle data, analysis equipment and storage medium
CN118101795A
Cited By
Data acquisition method based on remote diagnosis
CN121143300A
