Message management method and device and readable storage medium

By comparing the priority of sending messages on the CAN bus and determining the insertion position, the problem of message sending delay on the CAN bus is solved, and efficient message sending is achieved.

CN119922037APending Publication Date: 2025-05-02CHERY AUTOMOBILE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510004709.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

On the CAN bus, when there are a large number of messages waiting to be sent, messages that later enter the sending queue and need priority scheduling will cause transmission delay problems.

Method used

By obtaining the message to be sent and determining whether there are other messages to be sent in the message queue to be sent. Comparing the message type, transmission period and identifier, the transmission priority of the message to be sent is determined, and the insertion position in the queue is determined based on the priority, so that high-priority messages are sent in a timely manner.

Benefits of technology

Reduces the delay in sending important messages and ensures that high-priority messages can be sent in a timely and fast manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119922037A_ABST
    Figure CN119922037A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a message management method and device and a readable storage medium, and belongs to the technical field of network management. The method comprises the following steps: if at least one second to-be-sent message is stored in a preset to-be-sent message queue, sending a first to-be-sent message based on a message type, a message sending period and a message identifier of the first to-be-sent message and a message type, a message sending period and a message identifier of each second to-be-sent message; obtaining a comparison result of whether the sending priority of the first to-be-sent message is higher than the sending priority of at least one second to-be-sent message, thereby determining the insertion position of the to-be-sent message in the to-be-sent message queue based on the comparison result, and inserting the first to-be-sent message into the insertion position of the to-be-sent message queue. And sequentially sending the messages according to the queuing sequence of the messages to be sent. The message to be sent is inserted into the corresponding position according to the determined priority, so that the problem of sending delay when the important message is sent is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of network management, and in particular to a message management method, device and readable storage medium. Background Art

[0002] As the demand for automotive functions and configurations grows, the number of nodes connected to the controller area network (CAN) bus is also increasing. Nodes on the CAN bus communicate through messages. When a node on the CAN bus needs to send a message, the node can prepare to send a message to the CAN bus. If there are multiple messages waiting to be sent in the node, the multiple messages need to be queued and sent.

[0003] In the related art, messages waiting to be sent are sent in a first-in-first-out manner, so the messages waiting to be sent on the node can only be sent after the messages that enter the sending queue first are sent.

[0004] When there are a large number of messages waiting to be sent, it will cause a delay in sending the messages that enter the sending queue later and need to be scheduled first. Summary of the invention

[0005] Embodiments of the present application provide a message management method, device, and storage medium to reduce the sending delay of messages that require priority scheduling.

[0006] On the one hand, a message management method is provided, the method comprising:

[0007] Obtain the first message to be sent;

[0008] Determine whether at least one second message to be sent is stored in a preset message queue to be sent, the message queue to be sent being used to store the second messages to be sent waiting to be sent in the order of the sending priorities of the messages to be sent, and the second message to be sent with the highest sending priority is at the head of the message queue to be sent;

[0009] If at least one second message to be sent is stored in the message queue to be sent, a comparison result is obtained based on the message type, message sending cycle and message identifier of the first message to be sent and the message type, message sending cycle and message identifier of each second message to be sent in the at least one second message to be sent, wherein the comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of the at least one second message to be sent;

[0010] Based on the comparison result, determining an insertion position of the message to be sent in the queue of messages to be sent;

[0011] The first message to be sent is inserted into the queue of messages to be sent according to the insertion position, and the messages are sent in sequence according to the queuing order of the messages to be sent in the queue of messages to be sent.

[0012] Optionally, if at least one second message to be sent is stored in the message queue to be sent, a comparison result is obtained based on the message type, message sending cycle and message identifier of the first message to be sent and the message type, message sending cycle and message identifier of each second message to be sent in the at least one second message to be sent, including:

[0013] If the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent includes a first target message of a diagnostic message type, then obtaining the comparison result based on the message identifier of the first message to be sent and the message identifier of the first target message;

[0014] If the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent does not include a first target message of the diagnostic message type, determining that the sending priority of the first message to be sent is higher than the sending priority of all second messages to be sent;

[0015] If the message type of the first message to be sent is a periodic message type and the second message to be sent includes a second target message of a periodic message type, the comparison result is obtained based on the message sending period and message identifier of the first message to be sent and the message sending period and message identifier in the second target message;

[0016] If the message type of the first message to be sent is a periodic message type and the second message to be sent does not include a second target message of the periodic message type, it is determined that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent.

[0017] Optionally, obtaining the comparison result based on the message sending period and the message identifier of the first message to be sent and the message sending period and the message identifier in the second target message includes:

[0018] If the message sending period of the first message to be sent is less than the message sending period of the second target message, determining that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent;

[0019] If the message sending period of the first message to be sent is greater than the message sending period of the second target message, determining that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent;

[0020] If the message sending period of the first message to be sent is equal to the message sending period of the second target message, the comparison result is obtained based on the message identifier of the first message to be sent and the message identifier in the second target message.

[0021] Optionally, determining, based on the comparison result, an insertion position of the message to be sent in the queue of messages to be sent includes:

[0022] If the comparison result is that the sending priority of the first message to be sent is higher than the sending priorities of all the second messages to be sent, determining the insertion position to be the head of the queue of messages to be sent;

[0023] If the comparison result is that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent, determining the insertion position to be the tail of the queue of messages to be sent;

[0024] If the comparison result is that the sending priority of the first message to be sent is not lower than the sending priorities of all second messages to be sent, the insertion position is determined to be between two adjacent second messages to be sent that are higher than or equal to the sending priority and lower than the sending priority.

[0025] Optionally, the method further includes: if the queue of messages to be sent does not store the second message to be sent, inserting the first message to be sent at the head of the queue of messages to be sent.

[0026] Optionally, both the first target message and the second target message are controller area network messages with variable rates.

[0027] On the other hand, a message management device is provided, the device comprising:

[0028] An acquisition module, used for acquiring a first message to be sent;

[0029] A judgment module, used to judge whether at least one second message to be sent is stored in a preset message queue to be sent, the message queue to be sent is used to store the second messages to be sent waiting to be sent in the order of the sending priorities of the messages to be sent, and the second message to be sent with the highest sending priority is at the head of the message queue to be sent;

[0030] A comparison module, for obtaining a comparison result based on a message type, a message sending period, and a message identifier of the first message to be sent and a message type, a message sending period, and a message identifier of each second message to be sent in the at least one second message to be sent, if at least one second message to be sent is stored in the message queue to be sent, wherein the comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of the at least one second message to be sent;

[0031] A determination module, used to determine the insertion position of the message to be sent in the queue of messages to be sent based on the comparison result;

[0032] The sending module is used to insert the first message to be sent into the queue of messages to be sent according to the insertion position, and send the messages in sequence according to the queuing order of the messages to be sent in the queue of messages to be sent.

[0033] Optionally, the comparison module includes:

[0034] A first comparison submodule, configured to obtain the comparison result based on the message identifier of the first message to be sent and the message identifier of the first target message if the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent includes a first target message of the diagnostic message type;

[0035] A second comparison submodule, for determining that the sending priority of the first message to be sent is higher than the sending priority of all second messages to be sent if the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent does not include a first target message of the diagnostic message type;

[0036] A third comparison submodule, for obtaining the comparison result based on the message sending period and message identifier of the first message to be sent and the message sending period and message identifier in the second target message if the message type of the first message to be sent is a periodic message type and the second message to be sent includes a second target message of a periodic message type;

[0037] The fourth comparison submodule is used to determine that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent if the message type of the first message to be sent is a periodic message type and the second message to be sent does not include a second target message of the periodic message type.

[0038] Optionally, the third comparison submodule is used to:

[0039] If the message sending period of the first message to be sent is less than the message sending period of the second target message, determining that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent;

[0040] If the message sending period of the first message to be sent is greater than the message sending period of the second target message, determining that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent;

[0041] If the message sending period of the first message to be sent is equal to the message sending period of the second target message, the comparison result is obtained based on the message identifier of the first message to be sent and the message identifier in the second target message.

[0042] Optionally, the determining module includes:

[0043] A first determining submodule, configured to determine the insertion position as the head of the queue of messages to be sent if the comparison result shows that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent;

[0044] A second determining submodule, configured to determine the insertion position as the tail of the queue of messages to be sent if the comparison result shows that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent;

[0045] The third determination submodule is used to determine the insertion position to be between two adjacent second messages to be sent that are higher than or equal to the sending priority and lower than the sending priority if the comparison result is that the sending priority of the first message to be sent is not lower than the sending priority of all second messages to be sent.

[0046] Optionally, the device further comprises:

[0047] The inserting module is used for inserting the first message to be sent into the head of the queue of messages to be sent if the queue of messages to be sent does not store the second message to be sent.

[0048] Optionally, both the first target message and the second target message are controller area network messages with variable rates.

[0049] On the other hand, a control device is provided, which includes one or more processors and one or more memories, wherein at least one instruction is stored in the one or more memories, and the instruction is loaded and executed by the one or more processors to implement the operations performed by the message management method provided in the above embodiment.

[0050] On the other hand, a computer-readable storage medium is provided, on which instructions are stored, and when the instructions are executed by a processor, the operations performed by the message management method provided in the above embodiment are implemented.

[0051] The technical solution provided by the embodiment of the present application includes at least the following beneficial effects:

[0052] A message management method provided by an embodiment of the present application, if at least one second message to be sent is stored in a preset message queue to be sent, then based on the message type, message sending period and message identifier of the first message to be sent and the message type, message sending period and message identifier of each second message to be sent in the at least one second message to be sent, a comparison result of whether the sending priority of the first message to be sent is higher than the sending priority of at least one second message to be sent is obtained, thereby determining the insertion position of the message to be sent in the message queue to be sent based on the comparison result; according to the insertion position, the first message to be sent is inserted into the message queue to be sent, and the messages are sent in sequence according to the queuing order of the messages to be sent in the message queue to be sent. Since the message to be sent is inserted into the corresponding position in the message queue to be sent according to the determined priority, the high-priority message can be sent promptly and quickly, reducing the sending delay problem when sending important messages. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0054] Figure 1 It is a flow chart of a message management method provided by an embodiment of the present application;

[0055] Figure 2 is a flow chart of another message management method provided in an embodiment of the present application;

[0056] Figure 3 It is a structural diagram of a message management device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0058] The embodiment of the present application provides a message management method, which is a message management method based on a CAN (Controller Area Network) bus. In a group of CAN networks, each node is connected to the CAN bus, and can communicate with each other through messages forwarded by the CAN bus. The message is transmitted to each node on the bus in the form of broadcast. The node may include: a controller and a transceiver, and the node may be a vehicle controller in a vehicle.

[0059] The transceiver may be a SIT1145AQ transceiver chip, which is a CAN FD (Controller Area Network with Flexible Data rate) transceiver interface chip. Each transceiver has one transceiver unit. Based on this, the transceiver can only send one message at a time during the message sending process, and can only send the next message after sending one message. During the message receiving process, only one message can be received at a time.

[0060] In the embodiment of the present application, when a node receives a message sent by another node, it first determines whether the message identifier corresponding to the received message matches the message identifier pre-stored by the node. If they match, the received message is processed. If they do not match, the received message is discarded. Therefore, in the embodiment of the present application, only messages sent to this node are received, and messages not sent to this node are not received and processed.

[0061] Figure 1 1 is a flow chart of a message management method based on a CAN bus according to an embodiment of the present application. The following is an example of applying the method to any node connected to the CAN bus. Figure 1 As shown, the method includes the following steps.

[0062] Step 101: Obtain a first message to be sent.

[0063] Step 102: determine whether at least one second message to be sent is stored in a preset message queue to be sent.

[0064] The queue of messages to be sent is used to store the second messages to be sent in the order of their sending priorities, and the second message to be sent with the highest sending priority is at the head of the queue of messages to be sent;

[0065] Step 103: If at least one second message to be sent is stored in the message queue to be sent, a comparison result is obtained based on the message type, message sending period and message identifier of the first message to be sent and the message type, message sending period and message identifier of each second message to be sent in at least one second message to be sent, and the comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of the at least one second message to be sent.

[0066] Step 104: Based on the comparison result, determine the insertion position of the message to be sent in the queue of messages to be sent.

[0067] Step 105 , inserting the first message to be sent into the queue of messages to be sent according to the insertion position, and sending the messages in sequence according to the queueing order of the messages to be sent in the queue of messages to be sent.

[0068] A message management method provided by an embodiment of the present application, if at least one second message to be sent is stored in a preset message queue to be sent, then based on the message type, message sending period and message identifier of the first message to be sent and the message type, message sending period and message identifier of each second message to be sent in at least one second message to be sent, a comparison result of whether the sending priority of the first message to be sent is higher than the sending priority of at least one second message to be sent is obtained, thereby determining the insertion position of the message to be sent in the message queue to be sent based on the comparison result; according to the insertion position, the first message to be sent is inserted into the message queue to be sent, and the messages are sent in sequence according to the queuing order of the messages to be sent in the message queue to be sent. Since the message to be sent is inserted into the corresponding position in the message queue to be sent according to the determined priority, the high-priority message can be sent promptly and quickly, reducing the sending delay problem when sending important messages.

[0069] Figure 2 1 is a flow chart of a message management method according to an embodiment of the present application. The following is an example of applying the method to any node connected to a CAN bus. Figure 2 As shown, the method includes the following steps.

[0070] Step 201: Obtain a first message to be sent.

[0071] The first message to be sent may be a new message to be sent at the current time, and the message may be a CAN message or a CANFD message. As for which message the node can send, it can be set according to the actual situation. For example, when the message to be sent is an application message and a diagnostic message, a controller area network message with a variable rate may be sent.

[0072] Step 202 , determining whether at least one second message to be sent is stored in the preset message queue to be sent, if so, executing step 203 , if not, executing step 209 .

[0073] The queue of messages to be sent is used to store the second messages to be sent in the order of their sending priorities, and the second message to be sent with the highest sending priority is at the head of the queue of messages to be sent.

[0074] It should be noted that the at least one second message to be sent may be one second message to be sent, or may be two or more second messages to be sent, and the number of the second messages to be sent is determined according to actual conditions. If at least one second message to be sent is stored in the preset sequence of messages to be sent, all the second messages to be sent stored in the sequence of messages to be sent are arranged in the order of sending priorities, and the order of sending priorities is also determined according to steps 201 to 208.

[0075] In an embodiment of the present application, the message type, message sending period and message identifier of the first message to be sent and the message type, message sending period and message identifier of each second message to be sent in at least one second message to be sent correspond to different situations, respectively. The determined sending priority of the first message to be sent in the queue of messages to be sent is different, and the insertion position of the first message to be sent in the queue of messages to be sent is also different. The different situations of determining the insertion position are introduced below through steps 203 to 207.

[0076] In an embodiment of the present application, the message types of the second message to be sent include: a diagnostic message type and a periodic message type.

[0077] Step 203, if the message type of the first message to be sent is a diagnostic message type and at least one second message to be sent includes a first target message of the diagnostic message type, a comparison result is obtained based on the message identifier of the first message to be sent and the message identifier of the first target message.

[0078] The comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of at least one second message to be sent. The comparison result may be that the sending priority of the first message to be sent is higher than the sending priority of all second messages to be sent, may be that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent, or may be that the sending priority of the first message to be sent is not lower than the sending priority of all second messages to be sent. In an embodiment of the present application, the case where at least one second message to be sent includes a first target message of a diagnostic message type includes that all second messages to be sent are first target messages of a diagnostic message type, and may also include a first target message of a diagnostic message type and a second target message of a periodic message type.

[0079] It should be noted that the number of the first target messages may be one, or two or more. When the number of the first target messages is two or more, the sending priorities of the first message to be sent and the first target message may be compared in descending order of the sending priority of the first target message.

[0080] In the process of determining the sending priority, if it is determined that the sending priority of the first message to be sent is greater than that of a certain first target message, there is no need to compare the sending priorities of the remaining first target messages with the sending priority of the first message to be sent, and the insertion position of the first message to be sent can be determined to be in front of the certain first target message and adjacent to the certain first target message, so that the first message to be sent is sent before the certain target message. If it is determined that the sending priority of the first message to be sent is less than the sending priority of all first target messages, there is no need to compare the sending priority of the remaining second message to be sent with the sending priority of the first message to be sent, and the insertion position of the first message to be sent can be determined to be behind all first target messages and adjacent to the last first target message. If it is determined that there are messages with a sending priority greater than the sending priority of the first message to be sent and messages with a sending priority less than the sending priority of the first message to be sent, there is no need to compare the sending priorities of the remaining messages with the sending priority of the first message to be sent, and the insertion position of the first message to be sent can be determined as: between the position of the message with a sending priority greater than the first message to be sent and the position of the message with a sending priority less than the sending priority of the first message to be sent.

[0081] In an embodiment of the present application, the sending priority is determined by a message identifier, and the sending priority corresponding to the message identifier is pre-set. For example, the sending priority can be determined according to the size of the message identifier, wherein the smaller the message identifier, the higher the sending priority. The corresponding sending priority can also be pre-set for the message identifier.

[0082] It should be noted that if the message type is a diagnostic message, the message identifier corresponding to the diagnostic message is generally 7E8 or 7DF, and the sending priority of the diagnostic message corresponding to the message identifier 7E8 is higher than the sending priority of the diagnostic message corresponding to the message identifier 7DF.

[0083] In the embodiment of the present application, a comparison result is obtained based on the message identifier of the first message to be sent and the message identifier of the first target message, including:

[0084] Based on the preset correspondence between the message identifier and the sending priority, the sending priority corresponding to the message identifier of the first message to be sent and the sending priority corresponding to the message identifier corresponding to the first target message are determined to obtain a comparison result.

[0085] Step 204: if the message type of the first message to be sent is a diagnostic message type and at least one second message to be sent does not include a first target message of the diagnostic message type, determine that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent.

[0086] In an embodiment of the present application, the sending priority of a diagnostic message type message is higher than the sending priority of a periodic message type.

[0087] It should be noted that when at least one second message to be sent does not include a first target message of a diagnostic message type, it means that at least one second message to be sent is a message to be sent of a periodic message type. Since the sending priority of the message of the diagnostic message type is higher than the sending priority of the periodic message type, it is determined that the sending priority of the first message to be sent is higher than the sending priority of all second messages to be sent.

[0088] Step 205: If the message type of the first message to be sent is a periodic message type and the second message to be sent includes a second target message of the periodic message type, then based on the message sending period and message identifier of the first message to be sent and the message sending period and message identifier in the second target message, compare the sending priority of the first message to be sent with the sending priority of the second target message to obtain a second comparison result.

[0089] The first target message and the second target message are both controller area network messages with variable rates.

[0090] In an embodiment of the present application, the second message to be sent includes a second target message of a periodic message type. The situation may be that the second message to be sent only includes a second target message of a periodic message type, or may include a second target message of a periodic message type and a first target message of a diagnostic message type.

[0091] It should be noted that if the message type of the first message to be sent is a periodic message type, since the sending priority of the diagnostic type message is higher than the sending priority of the periodic message type, it is only necessary to compare the sending priority of the first message to be sent with the priority of the second target message. When comparing the sending priority of the message based on the message sending cycle and the message identifier, the sending priority of the comparison message is first determined by the message sending cycle, and when the message sending cycles are the same, the sending priority of the message is determined by the message identifier.

[0092] In an embodiment of the present application, the shorter the message sending period of the message, the higher the sending priority.

[0093] Wherein, based on the message sending period and the message identifier of the first message to be sent and the message sending period and the message identifier in the second target message, a comparison result is obtained, including:

[0094] If the message sending period of the first message to be sent is smaller than the message sending period of the second target message, it is determined that the sending priority of the first message to be sent is higher than the sending priorities of all the second messages to be sent.

[0095] If the message sending period of the first message to be sent is greater than the message sending period of the second target message, it is determined that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent.

[0096] If the message sending period of the first message to be sent is equal to the message sending period of the second target message, based on the message identifier of the first message to be sent and the message identifier in the second target message, the sending priority of the first message to be sent is compared with the sending priority of the second target message to obtain a second comparison result.

[0097] Among them, the smaller the message identifier, the higher the sending priority.

[0098] Step 206: If the message type of the first message to be sent is a periodic message and the second message to be sent does not include a second target message of the periodic message type, determine that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent.

[0099] In an embodiment of the present application, if the second message to be sent is a message of a diagnostic message type, the sending priority of the message can be determined by the message type.

[0100] Step 207: Based on the comparison result, determine the insertion position of the message to be sent in the queue of messages to be sent.

[0101] Wherein, based on the comparison result, determining the insertion position of the message to be sent in the message queue to be sent includes:

[0102] If the comparison result is that the sending priority of the first message to be sent is higher than the sending priorities of all the second messages to be sent, then determining the insertion position to be the head of the queue of messages to be sent;

[0103] If the comparison result shows that the sending priority of the first message to be sent is lower than the sending priorities of all the second messages to be sent, then the insertion position is determined to be the tail of the queue of messages to be sent;

[0104] If the comparison result is that the sending priority of the first message to be sent is not lower than the sending priorities of all second messages to be sent, the insertion position is determined to be between two adjacent second messages to be sent with a sending priority higher than or equal to the sending priority and lower than the sending priority.

[0105] Step 208: insert the first message to be sent into the queue of messages to be sent according to the insertion position.

[0106] Step 209: insert the first message to be sent into the head of the queue of messages to be sent.

[0107] It should be noted that if the queue of messages to be sent does not store at least one second message to be sent, it means that the queue of messages to be sent does not store any message to be sent, and the first message to be sent is inserted at the head of the queue of messages to be sent.

[0108] Step 210: Send the messages in sequence according to the queueing order of the messages to be sent in the message queue to be sent.

[0109] A message management method provided by an embodiment of the present application, if at least one second message to be sent is stored in a preset message queue to be sent, then based on the message type, message sending period and message identifier of the first message to be sent and the message type, message sending period and message identifier of each second message to be sent in at least one second message to be sent, a comparison result of whether the sending priority of the first message to be sent is higher than the sending priority of at least one second message to be sent is obtained, thereby determining the insertion position of the message to be sent in the message queue to be sent; according to the insertion position, the first message to be sent is inserted into the message queue to be sent, and the messages are sent in sequence according to the queuing order of the messages to be sent in the message queue to be sent. Since the message to be sent is inserted into the corresponding position in the message queue to be sent according to the determined priority, the high-priority message can be sent promptly and quickly, reducing the sending delay problem when sending important messages.

[0110] Figure 3 A message management device 300 provided in an embodiment of the present application includes:

[0111] An acquisition module 301 is used to acquire a first message to be sent;

[0112] A judgment module 302 is used to judge whether at least one second message to be sent is stored in a preset message queue to be sent, the message queue to be sent is used to store the second messages to be sent in the order of the sending priorities of the messages to be sent, and the second message to be sent with the highest sending priority is at the head of the message queue to be sent;

[0113] A comparison module 303 is used to obtain a comparison result based on the message type, message sending period and message identifier of the first message to be sent and the message type, message sending period and message identifier of each second message to be sent in the at least one second message to be sent, if at least one second message to be sent is stored in the message queue to be sent. The comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of the at least one second message to be sent;

[0114] A determination module 304, configured to determine, based on the comparison result, an insertion position of the message to be sent in the message queue to be sent;

[0115] The sending module 305 is used to insert the first message to be sent into the queue of messages to be sent according to the insertion position, and send the messages in sequence according to the queuing order of the messages to be sent in the queue of messages to be sent.

[0116] Optionally, the comparison module 302 includes:

[0117] A first comparison submodule, configured to obtain a comparison result based on a message identifier of the first message to be sent and a message identifier of the first target message if the message type of the first message to be sent is a diagnostic message type and at least one second message to be sent includes a first target message of the diagnostic message type;

[0118] a second comparison submodule, for determining that a sending priority of the first message to be sent is higher than a sending priority of all second messages to be sent if the message type of the first message to be sent is a diagnostic message type and at least one second message to be sent does not include a first target message of the diagnostic message type;

[0119] A third comparison submodule, for obtaining a comparison result based on the message sending period and message identifier of the first message to be sent and the message sending period and message identifier in the second target message if the message type of the first message to be sent is a periodic message type and the second message to be sent includes a second target message of the periodic message type;

[0120] The fourth comparison submodule is used to determine that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent if the message type of the first message to be sent is a periodic message type and the second message to be sent does not include a second target message of the periodic message type.

[0121] Optionally, the third comparison submodule is used to:

[0122] If the message sending period of the first message to be sent is less than the message sending period of the second target message, determining that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent;

[0123] If the message sending period of the first message to be sent is greater than the message sending period of the second target message, it is determined that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent;

[0124] If the message sending period of the first message to be sent is equal to the message sending period of the second target message, a comparison result is obtained based on the message identifier of the first message to be sent and the message identifier in the second target message.

[0125] Optionally, the determination module 304 includes:

[0126] A first determination submodule, configured to determine the insertion position as the head of the queue of messages to be sent if the comparison result shows that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent;

[0127] A second determination submodule, configured to determine the insertion position as the tail of the queue of messages to be sent if the comparison result shows that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent;

[0128] The third determination submodule is used to determine the insertion position to be between two adjacent second messages to be sent with a higher than or equal to the sending priority and lower than the sending priority if the comparison result shows that the sending priority of the first message to be sent is not lower than the sending priority of all second messages to be sent.

[0129] Optionally, the device further comprises:

[0130] The inserting module is used for inserting the first message to be sent into the head of the queue of messages to be sent if the queue of messages to be sent does not store the second message to be sent.

[0131] Optionally, the first target message and the second target message are both controller area network messages with variable rates.

[0132] A message management method provided by an embodiment of the present application, if at least one second message to be sent is stored in a preset message queue to be sent, then based on the message type, message sending cycle and message identifier of the first message to be sent and the message type, message sending cycle and message identifier of each second message to be sent in at least one second message to be sent, it is obtained whether the sending priority of the first message to be sent is higher than the sending priority of at least one second message to be sent, thereby determining the insertion position of the message to be sent in the message queue to be sent; according to the insertion position, the first message to be sent is inserted into the message queue to be sent, and the messages are sent in sequence according to the queuing order of the messages to be sent in the message queue to be sent. Since the message to be sent is inserted into the corresponding position in the message queue to be sent according to the determined priority, the high-priority message can be sent promptly and quickly, reducing the sending delay problem when sending important messages.

[0133] It should be noted that: the message management device provided in the above embodiment only uses the division of the above functional modules as an example when performing network management. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the message management device provided in the above embodiment and the message management method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0134] An embodiment of the present application also provides a control device, which includes one or more processors and one or more memories, wherein at least one instruction is stored in the one or more memories, and the instruction is loaded and executed by the one or more processors to implement the operations performed by the message management method.

[0135] An embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the operations performed by the message management method.

[0136] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a terminal, enables the terminal to execute the operations performed by the message management method provided in the above embodiment.

[0137] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0138] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0139] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A message management method, characterized in that: The method comprises: Obtain the first message to be sent; Determine whether at least one second message to be sent is stored in a preset message queue to be sent, the message queue to be sent being used to store the second messages to be sent waiting to be sent in the order of the sending priorities of the messages to be sent, and the second message to be sent with the highest sending priority is at the head of the message queue to be sent; If at least one second message to be sent is stored in the message queue to be sent, a comparison result is obtained based on the message type, message sending cycle and message identifier of the first message to be sent and the message type, message sending cycle and message identifier of each second message to be sent in the at least one second message to be sent, wherein the comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of the at least one second message to be sent; Based on the comparison result, determining an insertion position of the message to be sent in the queue of messages to be sent; The first message to be sent is inserted into the queue of messages to be sent according to the insertion position, and the messages are sent in sequence according to the queuing order of the messages to be sent in the queue of messages to be sent.

2. The method according to claim 1, characterized in that If at least one second message to be sent is stored in the message queue to be sent, a comparison result is obtained based on the message type, message sending cycle, and message identifier of the first message to be sent and the message type, message sending cycle, and message identifier of each second message to be sent in the at least one second message to be sent, including: If the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent includes a first target message of a diagnostic message type, then obtaining the comparison result based on the message identifier of the first message to be sent and the message identifier of the first target message; If the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent does not include a first target message of the diagnostic message type, determining that the sending priority of the first message to be sent is higher than the sending priority of all second messages to be sent; If the message type of the first message to be sent is a periodic message type and the second message to be sent includes a second target message of a periodic message type, the comparison result is obtained based on the message sending period and message identifier of the first message to be sent and the message sending period and message identifier in the second target message; If the message type of the first message to be sent is a periodic message type and the second message to be sent does not include a second target message of the periodic message type, it is determined that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent.

3. The method according to claim 2, characterized in that The obtaining the comparison result based on the message sending period and the message identifier of the first message to be sent and the message sending period and the message identifier in the second target message includes: If the message sending period of the first message to be sent is less than the message sending period of the second target message, determining that the sending priority of the first message to be sent is higher than the sending priorities of all second messages to be sent; If the message sending period of the first message to be sent is greater than the message sending period of the second target message, determining that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent; If the message sending period of the first message to be sent is equal to the message sending period of the second target message, the comparison result is obtained based on the message identifier of the first message to be sent and the message identifier in the second target message.

4. The method according to claim 1, characterized in that: The step of determining, based on the comparison result, an insertion position of the message to be sent in the queue of messages to be sent, comprises: If the comparison result is that the sending priority of the first message to be sent is higher than the sending priorities of all the second messages to be sent, determining the insertion position to be the head of the queue of messages to be sent; If the comparison result is that the sending priority of the first message to be sent is lower than the sending priorities of all second messages to be sent, determining the insertion position to be the tail of the queue of messages to be sent; If the comparison result is that the sending priority of the first message to be sent is not lower than the sending priorities of all second messages to be sent, the insertion position is determined to be between two adjacent second messages to be sent that are higher than or equal to the sending priority and lower than the sending priority.

5. The method according to claim 1, characterized in that The method further includes: if the queue of messages to be sent does not store the second message to be sent, inserting the first message to be sent into the head of the queue of messages to be sent.

6. The method according to claim 1, characterized in that The first target message and the second target message are both controller area network messages with variable rates.

7. A message management device, characterized in that: The device comprises: An acquisition module, used for acquiring a first message to be sent; A judgment module, used to judge whether at least one second message to be sent is stored in a preset message queue to be sent, the message queue to be sent is used to store the second messages to be sent waiting to be sent in the order of the sending priorities of the messages to be sent, and the second message to be sent with the highest sending priority is at the head of the message queue to be sent; A comparison module, for obtaining a comparison result based on a message type, a message sending period, and a message identifier of the first message to be sent and a message type, a message sending period, and a message identifier of each second message to be sent in the at least one second message to be sent, if at least one second message to be sent is stored in the message queue to be sent, wherein the comparison result indicates whether the sending priority of the first message to be sent is higher than the sending priority of the at least one second message to be sent; A determination module, used to determine the insertion position of the message to be sent in the queue of messages to be sent based on the comparison result; The sending module is used to insert the first message to be sent into the queue of messages to be sent according to the insertion position, and send the messages in sequence according to the queuing order of the messages to be sent in the queue of messages to be sent.

8. The device according to claim 7, characterized in that The comparison module comprises: A first comparison submodule, configured to obtain the comparison result based on the message identifier of the first message to be sent and the message identifier of the first target message if the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent includes a first target message of the diagnostic message type; A second comparison submodule, for determining that the sending priority of the first message to be sent is higher than the sending priority of all second messages to be sent if the message type of the first message to be sent is a diagnostic message type and the at least one second message to be sent does not include a first target message of the diagnostic message type; A third comparison submodule, for obtaining the comparison result based on the message sending period and message identifier of the first message to be sent and the message sending period and message identifier in the second target message if the message type of the first message to be sent is a periodic message type and the second message to be sent includes a second target message of a periodic message type; The fourth comparison submodule is used to determine that the sending priority of the first message to be sent is lower than the sending priority of all second messages to be sent if the message type of the first message to be sent is a periodic message type and the second message to be sent does not include a second target message of the periodic message type.

9. A control device, characterized in that: The control device includes one or more processors and one or more memories, and at least one instruction is stored in the one or more memories. The instruction is loaded and executed by the one or more processors to implement the operations performed by the message management method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to implement the operations performed by the message management method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Message sending method and device, storage medium and electronic device

    CN117389766A

  • Custom message sending method and device based on Basic CAN

    CN118921330A

  • Broadcast message queuing method and apparatus, storage device, and electronic device

    WO2018161579A1