Communication message processing method, apparatus, device, medium, and product
By receiving and processing target messages at the slave protocol end, the functions of the slave protocol and the slave device are decoupled, solving the problem that existing technologies cannot support communication between multiple slave devices, achieving efficient multi-device communication connections and reducing development and maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU TD TECH LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-05-29
AI Technical Summary
The existing DNet slave protocol is strongly coupled with the functions of the slave device, and does not support a single slave protocol to establish communication connections with multiple slave devices, resulting in a huge workload for development and maintenance.
A communication message processing method is provided, which receives target messages at the slave protocol end, determines the message type based on the identifier message, obtains valid data, and calls a pre-configured message callback function to send the data to the target slave device, thereby achieving functional decoupling between the slave protocol and the slave device and supporting communication connections of multiple slave devices.
It enables the establishment of communication connections with multiple slave devices using a single slave protocol, reducing development and maintenance workload and improving communication efficiency and flexibility.
Smart Images

Figure CN122120054A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a communication message processing method, apparatus, device, medium and product. Background Technology
[0002] DeviceNet (DNet) is an industrial fieldbus based on the Controller Area Network (CAN) bus, employing a master-slave communication architecture. Slave devices are the various devices connected on the bus, while the master device controls the slave devices. The DNet slave protocol specifies the communication protocols that slave devices must follow in order to communicate with the master.
[0003] Existing DNet slave protocols are mostly designed and written based on the functions of slave devices. The slave protocol corresponds one-to-one with the slave device and is integrated into each slave device.
[0004] However, the existing DNet slave protocol is strongly coupled with the functions of the slave device, and does not support a single slave protocol to establish communication connections with multiple slave devices, resulting in a huge workload for development and maintenance. Summary of the Invention
[0005] This application provides a communication message processing method, apparatus, device, medium, and product to solve the technical problem of not being able to establish communication connections with multiple slave devices using a single DNet slave protocol.
[0006] In a first aspect, this application provides a communication message processing method, which is applied to the slave protocol end of an industrial fieldbus DNet, and the method includes:
[0007] Receive a target message sent by the target slave device through the parsing protocol interface. The target message includes an identification message and valid data.
[0008] The type of the target message is determined based on the identification message, and whether the target message is a first pending message related to virtual device function data is determined based on the type of the target message.
[0009] If so, then obtain the valid data from the first message to be processed;
[0010] The message callback function corresponding to the type of the target message is called to send the valid data of the first message to be processed to the target slave device, so that the target slave device calls the corresponding message processing module to process the valid data of the first message to be processed in order to obtain the message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol end based on the message type with corresponding function.
[0011] The system receives the message to be sent and sends it to the CAN bus of the controller area network to complete the response.
[0012] In one possible design, determining the type of the target message based on the identification message includes:
[0013] Based on the identification message, the group, identity, and media access control MAC address corresponding to the target message are determined from the predefined standard, which is pre-configured to the slave protocol end based on the communication standard;
[0014] The type of the target message is determined from the predefined standard identifier purpose based on the group, identity identifier, and MAC address corresponding to the target message.
[0015] In one possible design, determining whether the target message is a first pending message related to virtual device function data based on the type of the target message includes:
[0016] According to the type of the target message, a query is performed in a preset first pending message list to obtain the query result. The preset first pending message list stores multiple message type names related to virtual device function data.
[0017] If the query result is yes, then the target message is identified as the first message to be processed;
[0018] If the query result is negative, the target message is sent to the CAN bus to complete the response.
[0019] In one possible design, obtaining valid data from the first message to be processed includes:
[0020] Obtain the service code of the first message to be processed;
[0021] The valid data in the first message to be processed is extracted based on the service code.
[0022] In one possible design, extracting valid data from the first message to be processed based on the service code includes:
[0023] The length of the byte stream corresponding to the valid data is determined based on the service code;
[0024] The valid data in the first message to be processed is extracted based on the length of the byte stream.
[0025] In one possible design, receiving the message to be sent and sending the message to be sent to the controller area network CAN bus to complete the acknowledgment includes:
[0026] Determine whether the message to be sent needs to be segmented;
[0027] If so, the message to be sent is segmented according to its type, and the segmented message is sent sequentially to the CAN bus to complete the response. The type of the message to be sent is consistent with the type of the target message.
[0028] If not, the message to be sent is sent to the CAN bus to complete the response.
[0029] In one possible design, multiple slave devices have communication connections with the slave protocol end of the DNet. Before receiving the target message sent by the target slave device through parsing the protocol interface, the method further includes:
[0030] Receive the relevant parameters and message callback functions corresponding to each slave device sent by each slave device through the initialization configuration interface;
[0031] Configure the relevant parameters and message callback functions corresponding to the slave device.
[0032] In one possible design, after configuring the relevant parameters and message callback functions corresponding to the slave device, the method further includes:
[0033] The slave device is controlled to start a thread so that it can call the receive data interface to receive the target information sent by the master device on the CAN bus.
[0034] In one possible design, the method further includes:
[0035] The system receives a new message call function sent by the slave device. The new message call function is a new message call function added when the message type corresponding to the updated function on the slave device is not within the range of message types that the slave device can currently process.
[0036] Configure the newly added message callback function.
[0037] Secondly, this application provides a communication message processing apparatus, the apparatus comprising:
[0038] The receiving module is used to receive the target message sent by the target slave device through the parsing protocol interface. The target message includes an identification message and valid data.
[0039] The determining module is configured to determine the type of the target message based on the identification message, and determine whether the target message is a first pending message related to virtual device function data based on the type of the target message;
[0040] The acquisition module is used to acquire valid data from the first message to be processed if the condition is met.
[0041] The calling module is used to call the message callback function corresponding to the type of the target message to send the valid data of the first message to be processed to the target slave device, so that the target slave device can call the corresponding message processing module to process the valid data of the first message to be processed in order to obtain the message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol end based on the message type with corresponding function.
[0042] The receiving module is also used to receive the message to be sent and send the message to be sent to the controller local area network CAN bus to complete the response.
[0043] Thirdly, this application provides a communication message processing device, the device comprising: a processor, and a memory and a transceiver communicatively connected to the processor;
[0044] The memory stores computer-executed instructions; the transceiver is used for sending and receiving data.
[0045] The processor executes computer execution instructions stored in the memory to implement the method as described in the first aspect.
[0046] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in any of the first aspects above.
[0047] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the first aspects above.
[0048] The communication message processing method, apparatus, device, medium, and product provided in this application receive a target message sent by a target slave device through a parsing protocol interface. The target message includes an identification message and valid data. The method determines the type of the target message based on the identification message and determines whether the target message is a first pending message related to virtual device function data based on the target message type. If so, it obtains the valid data from the first pending message. The method calls a message callback function corresponding to the type of the target message to send the valid data of the first pending message to the target slave device, so that the target slave device calls the corresponding message processing module to process the valid data of the first pending message to obtain a message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol based on a message type with corresponding function. The method receives the message to be sent and sends it to the CAN bus of the controller local area network to complete the acknowledgment. The target slave device sends a target message to the slave protocol end through the parsing protocol interface, which triggers the slave protocol end to process the received target message. Since the parsing protocol interface is a public interface, the slave protocol end can receive target messages sent by different target slave devices through this interface, enabling the slave protocol end to establish communication connections with multiple slave devices. Because the target message includes an identification message, the type of the target message can be determined based on the identification message, and whether the target message is the first pending message related to virtual device function data can be determined. Through the classification and processing of target messages, it is possible to accurately determine whether the received target message needs to be sent to the target slave device for processing. If it is determined to be the first pending message, the valid data is obtained, and the corresponding message callback function is called to send the valid data. The message is sent to the target slave device. Since the message callback function is pre-configured by the target slave device on the slave protocol based on the message type corresponding to the function, it can send different types of messages. The target slave device calls the corresponding message processing module to process the valid data and obtain the message to be sent. The slave protocol then sends the received message to be sent to the CAN bus to complete the response. The protocol is responsible for classifying and processing messages, obtaining valid data, and sending the message to be sent. The device is responsible for processing messages related to the virtual device function data. Both ends are responsible for different function implementations. The protocol does not need to process messages related to the virtual device function data, which realizes the decoupling of the slave protocol and the slave device functions. A single slave protocol can be used to establish communication connections with multiple slave devices, reducing the workload of development and maintenance. Attached Figure Description
[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0050] Figure 1 This is an application scenario diagram of a communication message processing method provided in an embodiment of this application;
[0051] Figure 2 A flowchart of a communication message processing method provided in an embodiment of this application;
[0052] Figure 3 This is a signaling interaction flowchart of a communication message processing method provided in an embodiment of this application;
[0053] Figure 4 This is a schematic diagram of the structure of a communication message processing device provided in an embodiment of this application;
[0054] Figure 5 This is a schematic diagram of the structure of a communication message processing device provided in an embodiment of this application.
[0055] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0057] It should be noted that certain software, components, and models may be mentioned in the embodiments of this application. These should be considered as exemplary and are intended only to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.
[0058] To clearly understand the technical solution of this application, the solutions of the prior art will be described in detail first.
[0059] DeviceNet (DNet) is an industrial fieldbus based on the Controller Area Network (CAN) bus, employing a master-slave communication architecture. Slaves are various devices connected to the bus, such as sensors and actuators, while the master is the device that controls the slaves, such as a Programmable Logic Controller (PLC) or a Personal Computer (PC). The DNet slave protocol specifies the communication protocols that slaves must follow, including data transmission formats, data frame structures, and error handling. Slaves must implement these protocols to communicate with the master. Existing DNet slave protocols are mostly designed and written based on the functions of the slave devices, resulting in strong coupling between the slave protocol and the slave device functions. Upon receiving messages, the slave protocol is directly used for device function implementation, including register settings and controller function control. There is a one-to-one correspondence between the slave protocol and the slave device, and these protocols are integrated into each slave device. However, this strong coupling between the DNet slave protocol and the slave device functions does not support establishing communication connections between a single slave protocol and multiple slave devices, leading to a significant workload for development and maintenance.
[0060] Therefore, to address the technical problems in existing technologies and enable communication connections between a single slave protocol and multiple slave devices, the slave protocol provides a common interface. The target slave device can send target messages to the slave protocol through this common parsing interface. This allows the slave protocol to establish communication with different slave devices and begin processing upon receiving the target message. To decouple the slave protocol from the functions of the slave devices, the slave protocol first classifies the target message based on identification information. Then, it determines whether the target message is the first pending message related to the virtual device's functional data. If so, it retrieves the valid data within it. Since the slave protocol does not need to process messages related to the virtual device's functional data, the slave protocol can be designed without considering the slave device's functionality, thus achieving decoupling from the slave device's functionality. In order to send different types of messages to the target slave device, message callback functions are pre-configured on the slave protocol. Then, the message callback function corresponding to the type of the target message can be called to send the valid data of the first message to be processed to the target slave device. This allows the target slave device to call the corresponding message processing module to process the first message to be processed to obtain the message to be sent. Finally, the received message to be sent is sent to the CAN bus to complete the acknowledgment.
[0061] Figure 1 This is an application scenario diagram of a communication message processing method provided in an embodiment of this application, such as... Figure 1As shown in the diagram, the application scenario of the communication message processing method provided in this embodiment includes: a target slave device 101, a communication message processing device 102, and a CAN bus 103. The communication message processing device 102 is equipped with a communication message processing unit. Optionally, if the slave device is a virtual device, a communication message processing unit can also be configured in each slave device to operate together with each slave device. This embodiment does not limit this aspect.
[0062] Specifically, the communication message processing device 102 receives a target message sent by the target slave device 101 through a parsing protocol interface. The target message includes an identification message and valid data. Then, the communication message processing device 102 determines the type of the target message based on the identification message, and determines whether the target message is a first pending message related to virtual device function data based on the type of the target message. If it is the first pending message, the valid data is obtained. The communication message processing device 102 calls the message callback function corresponding to the type of the target message to send the valid data of the first pending message to the target slave device 101. After receiving the valid data, the target slave device 101 calls the corresponding message processing module to process it to obtain the message to be sent. The communication message processing device 102 receives the message to be sent from the target slave device 101 and sends the message to be sent to the CAN bus 103 to complete the response. The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0063] Figure 2 A flowchart of a communication message processing method provided in an embodiment of this application is shown below. Figure 2 As shown, the execution entity in this embodiment is a communication message processing device. This communication message processing device can be implemented through a computer program, or through a medium storing the relevant computer program, such as a USB flash drive and / or optical disc, or it can be integrated into a communication message processing device. The direct communication message processing method provided in this embodiment includes the following steps:
[0064] Step 201: Receive the target message sent by the target slave device through the parsing protocol interface. The target message includes an identification message and valid data.
[0065] The target message refers to the message sent by the CAN bus to a specified slave device. The target message includes an identification message and valid data. The identification message may include an identification bit, which determines which slave device the message is sent to.
[0066] It is understandable that there can be multiple slave devices. The target slave device refers to one of the multiple slave devices, which is the slave device specified in the target message, that is, the slave device used to receive the target message.
[0067] Specifically, after the slave device starts working, it calls the common interface provided by the slave protocol: the receive data interface, to wait for messages sent by the CAN bus. When the slave protocol receives the target message sent by the CAN bus, it sends it to the target slave device through the receive data interface. The target slave device then sends the target message back to the slave protocol through the parsing protocol interface. The parsing protocol interface is also one of the common interfaces provided by the slave protocol. The target slave device sends the target message to the slave protocol by calling the parsing protocol interface, so that the slave protocol can process the target message after receiving it.
[0068] It should be noted that after receiving the target message sent by the CAN bus, the slave protocol end will also perform operations such as decapsulation, encapsulation, and error detection on the target message according to the protocol standard data frame. It can also control the flow when sending the target message and retransmit if the transmission fails, so as to ensure that the message will not suffer from loss, duplication, or damage during the transmission process, and ensure the reliability of message transmission at the data link layer.
[0069] Optionally, when receiving the target message sent by the target slave device through the parsing protocol interface, it can also be determined whether the target message needs to be received in segments. If the length of the target message is greater than the length of the CAN standard frame, the target message can be segmented and each segment of the target message can be received in sequence. It can also be determined whether the target message needs to be received in segments according to the standards of other protocol specifications. This embodiment does not limit this.
[0070] Step 202: Determine the type of the target message based on the identification message, and determine whether the target message is a first pending message related to virtual device function data based on the type of the target message.
[0071] The identification message is a message in the target message used to identify and distinguish the differences between the messages. The identification message may include an identification bit. By identifying the identification bit, the identity identifier, media access control address and other information corresponding to the target message can be determined.
[0072] Understandably, the target message may or may not need to be processed by the slave device. The target message related to the virtual device function data is the first message to be processed that needs to be sent to the slave device for processing.
[0073] The target message type may include Group 2 duplicate ID check, Group 2 only display connection request, Group 2 only display connection release, Group 2 display connection, master station IO polling message, and may also include other types, which are not limited in this embodiment.
[0074] Specifically, after receiving the target message from the station protocol end, the type of the target message is determined based on the identification information, such as whether the target message is a display type message or a polling type message. Some types of messages are the first pending messages related to virtual device function data, so the target message type is then used to determine whether the target message is the first pending message.
[0075] Optionally, a mapping table of identifier messages, message types, and first messages to be processed can be defined and stored in advance. Then, the slave protocol can query the mapping table according to the identifier message to determine the type of the target message and whether it is the first message to be processed. Other methods can also be used to determine the type of the target message and whether it is the first message to be processed. This embodiment does not limit this method.
[0076] Step 203: If yes, then obtain the valid data from the first message to be processed.
[0077] Among them, valid data refers to the specific data that needs to be transmitted in the target message.
[0078] Specifically, if the target message is determined to be the first message to be processed, the valid data in the first message to be processed is obtained. Since the length of the byte stream corresponding to the valid data is different in different types of messages, the length of the byte stream corresponding to the valid data can be determined according to the service code included in the first message to be processed, and then the valid data can be extracted according to the length of the byte stream. Other methods can also be used to obtain the valid data, but this embodiment does not limit this.
[0079] Optionally, if it is determined that the target message is not the first message to be processed, it means that the target message is not related to the virtual device function data and does not need to be processed by the slave device. In this case, the target message is directly sent to the CAN bus to complete the response.
[0080] Step 204: Call the message callback function corresponding to the type of the target message to send the valid data of the first message to be processed to the target slave device, so that the target slave device can call the corresponding message processing module to process the valid data of the first message to be processed in order to obtain the message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol end based on the message type with corresponding function.
[0081] The message callback function is used to send the first message to be processed to the target slave device. The message callback function may include a display message processing function, a connection message processing function, a connection release message processing function, a polling read message processing function, and a polling write message processing function.
[0082] It is understood that the message callback function may also include other types of functions. If the functions that can be implemented on the slave device change, the message callback function can be updated as needed. This embodiment does not limit this.
[0083] Among them, connection-type messages involve the DNet protocol message body format definition, and different slave devices have their own custom message body formats. Therefore, this type of message needs to be sent to the slave device for processing. Display-type messages are processed according to the message body format and data content that the slave device is concerned with, and the slave device processes the valid data that is not at the protocol layer. Polling-type messages involve custom memory mappings when the protocol end and the device end interact with data. The slave device parses and fills the data according to the custom data length and format.
[0084] It should be noted that the message callback function is pre-configured on the slave device side. During initialization, the slave device calls the public interface provided by the slave protocol side: the initial configuration interface, and sends the message callback function to the slave protocol side so that the slave protocol side can configure the message callback function. The slave device side also includes a message processing module corresponding to the message callback function.
[0085] Optionally, if the slave device is a physical device, the communication message processing device can be configured to operate in a separate device, and the slave device and the slave protocol end can communicate remotely through a protocol stack.
[0086] Specifically, after obtaining valid data, the pre-configured message callback function corresponding to the target message type is called to send the valid data of the first message to be processed to the target slave device. After receiving the valid data, the target slave device calls the corresponding message processing module to process it according to the type of the message callback function to obtain the message to be sent.
[0087] Step 205: Receive the message to be sent and send the message to be sent to the CAN bus of the controller area network to complete the response.
[0088] Specifically, after the target slave device obtains the message to be sent, it will send the message to the slave protocol. The slave protocol receives the message and then sends it to the CAN bus to complete the response.
[0089] Optionally, after receiving the message to be sent from the slave protocol end, it can also determine whether the message to be sent needs to be sent in segments. For example, polling type messages need to be sent according to a custom data length. When the message to be sent needs to be sent in segments, the message to be sent is segmented and then sent to the CAN bus in sequence to complete the response.
[0090] The communication message processing method provided in this application embodiment receives a target message sent by a target slave device through a parsing protocol interface. The target message includes an identification message and valid data. The method determines the type of the target message based on the identification message and determines whether the target message is a first message to be processed related to virtual device function data based on the target message type. If so, it obtains the valid data from the first message to be processed. It calls a message callback function corresponding to the type of the target message to send the valid data of the first message to be processed to the target slave device, so that the target slave device calls the corresponding message processing module to process the valid data of the first message to be processed to obtain a message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol based on a message type with corresponding function. Finally, it receives the message to be sent and sends it to the controller local area network (CAN) bus to complete the acknowledgment. The target slave device sends a target message to the slave protocol end through the parsing protocol interface, which triggers the slave protocol end to process the received target message. Since the parsing protocol interface is a public interface, the slave protocol end can receive target messages sent by different target slave devices through this interface, enabling the slave protocol end to establish communication connections with multiple slave devices. Because the target message includes an identification message, the type of the target message can be determined based on the identification message, and whether the target message is the first pending message related to virtual device function data can be determined. Through the classification and processing of target messages, it is possible to accurately determine whether the received target message needs to be sent to the target slave device for processing. If it is determined to be the first pending message, the valid data is obtained, and the corresponding message callback function is called to send the valid data. The message is sent to the target slave device. Since the message callback function is pre-configured by the target slave device on the slave protocol based on the message type corresponding to the function, it can send different types of messages. The target slave device calls the corresponding message processing module to process the valid data and obtain the message to be sent. The slave protocol then sends the received message to be sent to the CAN bus to complete the response. The protocol is responsible for classifying and processing messages, obtaining valid data, and sending the message to be sent. The device is responsible for processing messages related to the virtual device function data. Both ends are responsible for different function implementations. The protocol does not need to process messages related to the virtual device function data, which realizes the decoupling of the slave protocol and the slave device functions. A single slave protocol can be used to establish communication connections with multiple slave devices, reducing the workload of development and maintenance.
[0091] As an optional implementation, based on the above embodiments, determining the type of the target message according to the identification message includes:
[0092] Based on the identification message, the group, identity, and media access control MAC address corresponding to the target message are determined from the predefined standard. The predefined standard is pre-configured to the slave protocol end based on the communication standard.
[0093] The type of the target message is determined from the predefined standard identifier purpose based on the group, identity, and MAC address corresponding to the target message.
[0094] Among them, the predefined standard is a standard used to determine the target message type. The predefined standard can be in tabular form, but this embodiment does not limit it.
[0095] Specifically, the identification message may include identification bits. In the predefined standard, different identification bits correspond to different groups, identities, and MAC addresses. Based on the identification message in the target message, the group, identity, and MAC address corresponding to the target message can be determined from the predefined standard. The predefined standard also includes the identification purpose, which includes different message types. After determining the group, identity, and MAC address corresponding to the target message, the target message type corresponding to the group, identity, and MAC address can be found from the identification purpose of the predefined standard.
[0096] The communication message processing method provided in this application determines the type of a target message based on an identification message. This includes: determining the group, identity identifier, and media access control (MAC) address corresponding to the target message from a predefined standard based on the identification message; and determining the type of the target message from the identification purpose of the predefined standard based on the group, identity identifier, and MAC address corresponding to the target message. Since the identification information is used to distinguish between different messages, and the predefined standard allows for quick and accurate determination of the group, identity identifier, and MAC address corresponding to the target message, and further determination of the type of the target message from the identification purpose of the predefined standard based on the group, identity identifier, and MAC address, the reliability of the classification results is further improved.
[0097] As an optional implementation, based on the above embodiments, determining whether the target message is a first message to be processed related to virtual device function data according to the type of the target message includes:
[0098] Based on the type of the target message, a query is performed in the preset first pending message list to obtain the query results. The preset first pending message list stores multiple message type names related to virtual device function data.
[0099] If the query result is yes, then the target message is identified as the first message to be processed;
[0100] If the query result is negative, the target message is sent to the CAN bus to complete the response.
[0101] The preset first pending message list is a list pre-configured on the slave protocol side to determine whether the target message is the first pending message.
[0102] Specifically, after determining the type of the target message, a query is performed in the preset first pending message list based on the name of the target message type. Since the preset first pending message list includes multiple message type names related to virtual device function data, if the name of the target message type is found in the preset first pending message list, the query result is "yes," and the target message is identified as the first pending message. If the name of the target message type is not found in the preset first pending message list, the query result is "no," indicating that the target message is not related to virtual device function data and does not need to be sent to the slave device for processing. Instead, the target message is sent to the CAN bus to complete the response.
[0103] The communication message processing method provided in this application determines whether a target message is a first pending message related to virtual device functional data based on the type of the target message. This includes: querying a preset first pending message list based on the type of the target message to obtain a query result; the preset first pending message list stores multiple message type names related to virtual device functional data; if the query result is yes, the target message is determined as the first pending message; if the query result is no, the target message is sent to the CAN bus to complete the response. By using a preset first pending message list and querying within it to determine whether a message is a first pending message, it is possible to quickly determine whether the message is related to the virtual device's functional data, simplifying the communication message processing logic, ensuring the stability of the determination result while improving the efficiency of communication message processing. Furthermore, the preset first pending message list can be easily updated or modified to adapt to new message types or slave device functions; if it is a first pending message, it is handed over to the slave device for processing; otherwise, it is sent to the CAN bus to complete the response, improving the overall response speed.
[0104] As an optional implementation, based on the above embodiments, obtaining valid data from the first message to be processed includes:
[0105] Obtain the service code of the first pending message;
[0106] Extract the valid data from the first pending message based on the service code.
[0107] Among them, the service code is a code in the target message used to identify a specific service request, such as 4B, 4C, 07, etc.
[0108] Specifically, the service code is found from the first message to be processed. Different service codes can be used to indicate the data format, data length, etc. of the valid data in the message. The valid data in the first message to be processed is extracted according to the meaning represented by the service code.
[0109] The communication message processing method provided in this application, which obtains valid data from a first message to be processed, includes: obtaining the service code of the first message to be processed; and extracting valid data from the first message to be processed based on the service code. The service code is typically unique; using the service code as an index, valid data in the first message to be processed can be quickly located and extracted, ensuring the accuracy of the extracted data.
[0110] As an optional implementation, based on the above embodiments, valid data is extracted from the first message to be processed according to the service code, including:
[0111] Determine the length of the byte stream corresponding to the valid data based on the service code;
[0112] Extract the valid data from the first message to be processed based on the length of the byte stream.
[0113] Specifically, after obtaining the service code, different service codes correspond to different byte stream lengths. That is, the byte stream length corresponding to the valid data can be determined based on the service code, and then the valid data can be extracted from the first message to be processed according to the byte stream length of the valid data.
[0114] The communication message processing method provided in this application extracts valid data from a first message to be processed based on a service code. This includes: determining the byte stream length corresponding to the valid data based on the service code; and extracting the valid data from the first message to be processed based on the byte stream length. By directly associating the service code with the byte stream length of the valid data, the valid data portion of the message can be accurately located, avoiding erroneous extraction due to inconsistent data formats or data offsets. Once the byte stream length is determined, valid data of the corresponding length can be quickly extracted from the message without additional data parsing or filtering, thus improving the efficiency of communication message processing.
[0115] As an optional implementation, based on the above embodiments, receiving the message to be sent and sending the message to be sent to the controller area network CAN bus to complete the response includes:
[0116] Determine whether the message to be sent needs to be segmented;
[0117] If so, the message to be sent is segmented according to its type, and the segmented message is sent to the CAN bus in sequence to complete the response. The type of the message to be sent is consistent with the type of the target message.
[0118] If not, the message to be sent is sent to the CAN bus to complete the response.
[0119] Specifically, after receiving a message to be sent from the slave protocol end, it needs to determine whether the message needs to be segmented based on its type. For example, for display-type messages, it checks if the message length is greater than the CAN standard frame length; if so, the message needs to be segmented. Similarly, for polling-type messages, it checks if the message length is greater than the custom communication message length defined between the protocol end and the device end; if so, the message needs to be segmented. When a message needs to be segmented, it is segmented according to its type. For example, display-type messages are segmented according to the CAN standard frame length, or polling-type messages are segmented according to the custom length. The segmented messages are then sent sequentially to the CAN bus to complete the acknowledgment. When a message does not need to be segmented, it is sent directly to the CAN bus to complete the acknowledgment.
[0120] The communication message processing method provided in this application embodiment receives a message to be sent and sends it to a Controller Area Network (CAN) bus to complete the acknowledgment. The method includes: determining whether the message to be sent needs to be segmented; if so, segmenting the message according to its type and sequentially sending the segmented message to the CAN bus to complete the acknowledgment, wherein the type of the message to be sent is consistent with the type of the target message; if not, sending the message to the CAN bus directly to complete the acknowledgment. By determining whether segmentation is needed before sending the message to the CAN bus, and processing messages requiring segmentation before sending, the integrity of data frames for each type of message is ensured. Different message types have different data frame lengths; segmenting according to the message type ensures that different types of messages can be accurately and completely sent to the CAN bus to complete the acknowledgment.
[0121] As an optional implementation, based on the above embodiments, if multiple slave devices have communication connections with the slave protocol end of DNet, the method further includes the following before receiving the target message sent by the target slave device through the parsing protocol interface:
[0122] Receive relevant parameters and message callback functions for each slave device sent through the initialization configuration interface;
[0123] Configure the relevant parameters and message callback functions for the slave devices.
[0124] The initialization configuration interface is a public interface provided by the slave protocol side, which is used to complete the initialization configuration of the slave protocol side when the slave device is initialized.
[0125] Specifically, during initialization, each slave device calls the initialization configuration interface to send its corresponding parameters and message callback functions to the slave protocol end. After receiving the parameters and message callback functions of each slave device, the slave protocol end configures the parameters and message callback functions of the slave device to prepare for subsequent processing of communication messages.
[0126] Optionally, the slave protocol can also provide a public interface: a maintenance and testing interface, which is used to add maintenance and testing logs to the slave protocol. The slave device can call the maintenance and testing interface to set which logs need to be enabled, or message statistics, etc. This embodiment does not limit this.
[0127] The communication message processing method provided in this application embodiment has multiple slave devices communicating with the slave protocol end of DNet. Before receiving the target message sent by the target slave device through the parsing protocol interface, the method further includes: receiving the relevant parameters and message callback functions corresponding to each slave device sent by each slave device through the initialization configuration interface; and configuring the relevant parameters and message callback functions corresponding to the slave devices. During initialization, the relevant parameters and message callback functions of each slave device are sent to the slave protocol end for configuration, so that when processing communication messages, the slave protocol end clearly knows the status of each slave device and can accurately send the target message to the corresponding target slave device end, ensuring that the communication between each slave device is not interfered with. The use of message callback functions decouples the relationship between the slave protocol and the slave device functions, allowing communication to be established with multiple slave devices using only one slave protocol.
[0128] As an optional implementation, based on the above embodiments, after configuring the relevant parameters and message callback functions corresponding to the slave device, the method further includes:
[0129] Control the slave device to start a thread so that the slave device can call the receive data interface to receive the target information sent by the master device on the CAN bus.
[0130] The data receiving interface is a public interface provided by the slave protocol side, used to receive messages from the CAN bus. It can also perform message category statistics and other function injections. This embodiment does not limit this.
[0131] Specifically, after the initial configuration is completed, the slave device starts a thread. After the slave device starts, it calls the receive data interface to wait for messages sent by the master device on the CAN bus. When there is target information sent by the CAN bus, the slave device receives the target message through the receive data interface.
[0132] The repeater control method provided in this application, after configuring the relevant parameters and message callback functions corresponding to the slave device, further includes: controlling the slave device to start a thread, so that the slave device calls the receive data interface to receive the target information sent by the master device on the CAN bus. Starting the thread and calling the receive data interface to process messages on the CAN bus can significantly improve the real-time performance and response speed of message processing.
[0133] As an optional implementation, based on the above embodiments, the method further includes:
[0134] Receive the new message call function sent by the slave device. The new message call function is a new message call function added when the message type corresponding to the updated function on the slave device is not within the range of message types that the current slave device can handle.
[0135] Configure the callback function for new messages.
[0136] Specifically, when the functions that the slave device can perform change, and the message type corresponding to the updated function is not within the range of message types that the current slave device can handle, the corresponding message callback function needs to be updated. The slave device sends the newly added message call function to the slave protocol so that the slave protocol can configure the newly added message callback function.
[0137] The communication message processing method provided in this application further includes: receiving a new message call function sent by the slave device, wherein the new message call function is a new message call function added when the message type corresponding to the updated function on the slave device is not within the range of message types that the current slave device can handle; and configuring the new message callback function. After the slave device updates the implementable functions, communication between the slave device and the slave protocol can be realized by updating the message call function, making the maintenance and expansion of the slave protocol simpler, ensuring the integrity of the slave device's functions, and allowing developers to focus more on the development of the slave device's business functions without having to invest time and effort in the protocol.
[0138] Figure 3This is a signaling interaction flowchart of a communication message processing method provided in an embodiment of this application. The execution entities in this embodiment are the slave device, the slave protocol, and the CAN bus. Figure 3 As shown, the communication message processing method provided in this embodiment includes a specific processing method for the target message by the slave protocol end. The communication message processing method flow provided in this embodiment includes the following steps:
[0139] Step 301: The slave device calls the receive data interface to wait for the CAN bus to send a message.
[0140] Step 302: The slave protocol receives the target message sent by the CAN bus. The target message includes an identification message and valid data.
[0141] Step 303: The slave protocol end sends the target message to the slave device end through the data receiving interface.
[0142] Step 304: The slave device sends the target message to the slave protocol end through the parsing protocol interface.
[0143] Step 305: The slave protocol end determines the group, identity, and media access control MAC address corresponding to the target message from the predefined standard based on the identification message.
[0144] Step 306: The slave protocol determines the type of the target message from the predefined standard identifier purpose based on the group, identity identifier and MAC address corresponding to the target message.
[0145] Step 307: The slave protocol terminal queries the preset first pending message list according to the type of the target message to obtain the query results. The preset first pending message list stores multiple message type names related to virtual device function data.
[0146] Step 308: If the query result is yes, the slave protocol end will identify the target message as the first message to be processed.
[0147] Step 309: If the query result is negative, the slave protocol will send the target message to the CAN bus to complete the response.
[0148] Step 310: Obtain the service code of the first message to be processed from the slave protocol end.
[0149] Step 311: The slave protocol end determines the length of the byte stream corresponding to the valid data based on the service code.
[0150] Step 312: The slave protocol end extracts the valid data from the first message to be processed based on the length of the byte stream.
[0151] Step 313: The slave protocol end calls the message callback function corresponding to the type of the target message to send the valid data of the first message to be processed to the slave device end.
[0152] Step 314: The slave device calls the corresponding message processing module to process the valid data of the first message to be processed in order to obtain the message to be sent.
[0153] Step 315: The slave device sends the message to be sent to the slave protocol.
[0154] Step 316: The slave protocol side determines whether the message to be sent needs to be segmented.
[0155] Step 317: If yes, the slave protocol end will segment the message to be sent according to its type and send the segmented message to the CAN bus in sequence to complete the response.
[0156] Step 318: If not, the slave protocol will send the message to be sent to the CAN bus to complete the acknowledgment.
[0157] In this embodiment, the implementation method and technical effect of steps 301-318 are similar to those of the corresponding solutions in the above embodiments, and will not be repeated here.
[0158] Figure 4 This is a schematic diagram of the structure of a communication message processing device provided in an embodiment of this application, as shown below. Figure 4 As shown, the communication message processing device provided in this embodiment is located in the communication message processing equipment. The communication message processing device 40 provided in this embodiment includes: a receiving module 41, a determining module 42, an acquiring module 43, and a calling module 44.
[0159] The system includes a receiving module 41, which receives a target message sent by the target slave device through a parsing protocol interface. The target message includes an identification message and valid data. A determining module 42 determines the type of the target message based on the identification message and determines whether the target message is a first message to be processed related to the virtual device's functional data based on the type of the target message. An obtaining module 43 obtains the valid data in the first message to be processed if the target message is a first message to be processed. A calling module 44 calls the message callback function corresponding to the type of the target message to send the valid data of the first message to be processed to the target slave device, so that the target slave device can call the corresponding message processing module to process the message based on the valid data of the first message to be processed to obtain the message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol based on the message type with corresponding function. The receiving module 41 also receives the message to be sent and sends it to the CAN bus of the controller local area network to complete the response.
[0160] The communication message processing device provided in this embodiment can perform... Figure 2 The methods provided in the embodiments are similar in their specific implementation principles and technical effects, and will not be described in detail here.
[0161] Optionally, when determining the type of the target message based on the identification message, the determining module 42 is specifically used to: determine the group, identity, and media access control MAC address corresponding to the target message from a predefined standard based on the identification message, wherein the predefined standard is pre-configured to the slave protocol based on the communication standard; and determine the type of the target message from the identification purpose of the predefined standard based on the group, identity, and MAC address corresponding to the target message.
[0162] Optionally, the determining module 42, when determining whether the target message is a first pending message related to virtual device function data based on the type of the target message, specifically performs the following: queries a preset first pending message list based on the type of the target message to obtain the query result; the preset first pending message list stores multiple message type names related to virtual device function data; if the query result is yes, the target message is determined as the first pending message; if the query result is no, the target message is sent to the CAN bus to complete the response.
[0163] Optionally, the acquisition module 43, when acquiring valid data in the first message to be processed, is specifically used to: acquire the service code of the first message to be processed; and extract the valid data in the first message to be processed based on the service code.
[0164] Optionally, when the acquisition module 43 extracts valid data from the first message to be processed based on the service code, it is specifically used to: determine the length of the byte stream corresponding to the valid data based on the service code; and extract the valid data from the first message to be processed based on the byte stream length.
[0165] Optionally, when receiving a message to be sent and sending it to the CAN bus of the controller area network to complete the response, the receiving module 41 is specifically configured to: determine whether the message to be sent needs to be segmented; if so, segment the message according to its type and send the segmented message to the CAN bus sequentially to complete the response, wherein the type of the message to be sent is consistent with the type of the target message; if not, send the message to be sent to the CAN bus to complete the response.
[0166] Optionally, the communication message processing device provided in this embodiment further includes a configuration module.
[0167] Accordingly, the receiving module 41 is also used to receive the relevant parameters and message callback functions of each slave device sent by each slave device through the initialization configuration interface; the configuration module is used to configure the relevant parameters and message callback functions of the slave devices.
[0168] Optionally, the communication message processing device provided in this embodiment further includes a control module.
[0169] Accordingly, the control module is used to control the slave device to start a thread so that the slave device can call the receive data interface to receive the target information sent by the CAN bus.
[0170] Optionally, the receiving module 41 is further configured to receive a new message call function sent by the slave device, wherein the new message call function is a new message call function added when the message type corresponding to the updated function on the slave device is not within the range of message types that the current slave device can handle; the configuration module is further configured to configure the new message callback function.
[0171] Figure 5 This is a schematic diagram of the structure of a communication message processing device provided in an embodiment of this application, as shown below. Figure 5 As shown, the communication message processing device 50 provided in this embodiment includes: a processor 51, a memory 52 and a transceiver 53 that are communicatively connected to the processor.
[0172] The memory 52 stores computer-executed instructions; the processor 51 executes the computer-executed instructions stored in the memory 52 and controls the transceiver 53 to send and receive data, thereby implementing the communication message processing method provided in the above embodiment. Related explanations can be understood by referring to the relevant descriptions and effects corresponding to the steps in the accompanying drawings, and will not be elaborated upon here.
[0173] The program may include program code, which includes computer-executable instructions. Memory 52 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device.
[0174] In this embodiment, the processor 51, memory 52, and transceiver 53 are connected via a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as CAN bus, address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0175] This application also provides a computer-readable storage medium storing computer-executable instructions. When the controller executes the computer-executable instructions, it implements the various steps in the methods described above.
[0176] This application also provides a computer program product, including a computer program that, when executed by a controller, implements the various steps in the methods described above.
[0177] The various embodiments described above in this application can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard parts (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0178] The computer-executable instructions used to implement the methods of this application may be written in any combination of one or more programming languages. These computer-executable instructions may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the computer-executable instructions cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer-executable instructions may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a standalone software package, or entirely on a remote machine or electronic device.
[0179] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be a machine-readable signal medium or a machine-readable storage medium. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. Alternatively, computer-readable storage media may include: resistive random access memory (RRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (EDRAM), high-bandwidth memory (HBM), hybrid memory cube (HMC), and so on.
[0180] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as data electronic devices), or computing systems that include middleware components (e.g., application electronic devices), or computing systems that include front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0181] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps can be performed in other orders or simultaneously according to this application. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application. In other words, the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps disclosed in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0182] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0183] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0184] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0185] When an integrated unit / module is implemented in hardware, that hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc.
[0186] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing computer-executable instructions, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0187] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0188] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only.
[0189] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. Therefore, the specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this application should be included within the scope of protection of this application.
Claims
1. A communication message processing method, characterized in that, The method is applied to the slave protocol side of the industrial fieldbus DNet, and the method includes: Receive a target message sent by the target slave device through the parsing protocol interface. The target message includes an identification message and valid data. The type of the target message is determined based on the identification message, and whether the target message is a first pending message related to virtual device function data is determined based on the type of the target message. If so, then obtain the valid data from the first message to be processed; The message callback function corresponding to the type of the target message is called to send the valid data of the first message to be processed to the target slave device, so that the target slave device calls the corresponding message processing module to process the valid data of the first message to be processed in order to obtain the message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol end based on the message type with corresponding function. The system receives the message to be sent and sends it to the CAN bus of the controller area network to complete the response.
2. The method according to claim 1, characterized in that, Determining the type of the target message based on the identification message includes: Based on the identification message, the group, identity, and media access control MAC address corresponding to the target message are determined from the predefined standard, which is pre-configured to the slave protocol end based on the communication standard; The type of the target message is determined from the predefined standard identifier purpose based on the group, identity identifier, and MAC address corresponding to the target message.
3. The method according to claim 1, characterized in that, The step of determining whether the target message is a first pending message related to virtual device function data based on the type of the target message includes: According to the type of the target message, a query is performed in a preset first pending message list to obtain the query result. The preset first pending message list stores multiple message type names related to virtual device function data. If the query result is yes, then the target message is identified as the first message to be processed; If the query result is negative, the target message is sent to the CAN bus to complete the response.
4. The method according to claim 1, characterized in that, The step of obtaining valid data from the first message to be processed includes: Obtain the service code of the first message to be processed; The valid data in the first message to be processed is extracted based on the service code.
5. The method according to claim 4, characterized in that, The step of extracting valid data from the first message to be processed based on the service code includes: The length of the byte stream corresponding to the valid data is determined based on the service code; The valid data in the first message to be processed is extracted based on the length of the byte stream.
6. The method according to claim 1, characterized in that, The step of receiving the message to be sent and sending the message to be sent to the controller area network CAN bus to complete the acknowledgment includes: Determine whether the message to be sent needs to be segmented; If so, the message to be sent is segmented according to its type, and the segmented message is sent sequentially to the CAN bus to complete the response. The type of the message to be sent is consistent with the type of the target message. If not, the message to be sent is sent to the CAN bus to complete the response.
7. The method according to claim 1, characterized in that, Multiple slave devices have communication connections with the slave protocol end of the DNet. Before receiving the target message sent by the target slave device through the parsing protocol interface, the method further includes: Receive the relevant parameters and message callback functions corresponding to each slave device sent by each slave device through the initialization configuration interface; Configure the relevant parameters and message callback functions corresponding to the slave device.
8. The method according to claim 7, characterized in that, After configuring the relevant parameters and message callback functions corresponding to the slave device, the method further includes: The slave device is controlled to start a thread so that it can call the receive data interface to receive the target information sent by the master device on the CAN bus.
9. The method according to claim 7, characterized in that, The method further includes: The system receives a new message call function sent by the slave device. The new message call function is a new message call function added when the message type corresponding to the updated function on the slave device is not within the range of message types that the slave device can currently process. Configure the newly added message callback function.
10. A communication message processing device, characterized in that, The device includes: The receiving module is used to receive the target message sent by the target slave device through the parsing protocol interface. The target message includes an identification message and valid data. The determining module is configured to determine the type of the target message based on the identification message, and determine whether the target message is a first pending message related to virtual device function data based on the type of the target message; The acquisition module is used to acquire valid data from the first message to be processed if the condition is met. The calling module is used to call the message callback function corresponding to the type of the target message to send the valid data of the first message to be processed to the target slave device, so that the target slave device can call the corresponding message processing module to process the valid data of the first message to be processed in order to obtain the message to be sent. The message callback function is pre-configured by the target slave device to the slave protocol end based on the message type with corresponding function. The receiving module is also used to receive the message to be sent and send the message to be sent to the controller local area network CAN bus to complete the response.
11. A communication message processing device, characterized in that, The device includes: a processor, and a memory and a transceiver communicatively connected to the processor; The memory stores computer-executed instructions; the transceiver is used for sending and receiving data. The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 9.
13. A computer program product comprising a computer program that, when executed by a processor, implements the method of any one of claims 1 to 9.