Asynchronous message queue processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611300899.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-13
AI Technical Summary
[0005]有鉴于此,本申请实施例提供一种异步消息队列处理方法、装置、电子设备及存储介质,以解决现有RCP协议多消息打包机制缺少消息队列缓存与超时管理,导致无法满足车载复杂场景下的控制可靠性需求的问题
[0036]本申请实施例第三方面公开了一种电子设备,所述电子设备包括至少一处理器,以及与所述处理器连接的至少一存储器,总线;其中,所述处理器和所述存储器通过所述总线完成相互间的通信;所述处理器用于调用所述存储器中的程序指令,以执行如本申请实施例第一方面公开的异步消息队列处理方法。
Smart Images

Figure CN122909281A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive electronics technology, and in particular to an asynchronous message queue processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] As automotive electronic and electrical architectures evolve towards centralized and domain-controlled architectures, Ethernet is gradually replacing traditional CAN / LIN buses as the mainstream communication method in vehicles. The RCP protocol, as a lightweight Ethernet control protocol, is suitable for command interaction between edge nodes such as windows, seats, and ambient lighting and the central domain controller.
[0003] Existing RCP chips generally employ a multi-message packetization mechanism, encapsulating multiple messages within a single Ethernet frame to improve bandwidth utilization and reduce communication latency. However, current asynchronous packetization interfaces only implement a simple "request-response" mapping, lacking systematic management of key elements of message interaction, resulting in two major technical defects: firstly, the absence of a queue management mechanism makes message loss or blocking prone to occur under high load; secondly, the lack of a timeout management mechanism means that upper-layer applications are unaware of lost or delayed responses, easily leading to control failures.
[0004] As a result, the existing RCP protocol's multi-message packaging mechanism lacks message queue caching and timeout management, which makes it unable to meet the control reliability requirements of complex vehicle scenarios. Summary of the Invention
[0005] In view of this, embodiments of this application provide an asynchronous message queue processing method, apparatus, electronic device, and storage medium to solve the problem that the existing RCP protocol multi-message packaging mechanism lacks message queue caching and timeout management, resulting in the inability to meet the control reliability requirements in complex vehicle scenarios.
[0006] To address the above problems, this application provides the following technical solutions:
[0007] The first aspect of this application discloses an asynchronous message queue processing method, the method comprising:
[0008] Obtain the driving instruction, and cache the message entry generated based on the driving instruction and the initiation parameters to the message queue. The initiation parameters include the message initiation timestamp, the status identifier to be sent, and the message ID.
[0009] The message queue is periodically polled, and message entries marked as pending send are pre-packaged to obtain RCP messages;
[0010] When the load of the RCP channel is confirmed to meet the transmission conditions, the pre-packaged RCP message is sent to the edge node, and the edge node executes the driving instructions in the RCP message; and the status flag of the message entry corresponding to the sent RCP message in the message queue is changed to pending response.
[0011] Receive the RCP response message from the edge node and release the message entry in the message queue whose status is pending response and matches the RCP response message.
[0012] Optionally, when it is confirmed that the load of the RCP channel meets the transmission conditions, the currently pre-packaged RCP message is sent to the edge node, including:
[0013] Determine whether the load of the RCP channel has reached the transmission threshold;
[0014] If the sending threshold is not reached, continue to pre-package the next message entry in the message queue whose status is marked as pending sending.
[0015] If the sending threshold is reached, stop the current periodic polling and generate a start sending command. Based on the start sending command, send the currently pre-packaged RCP message to the edge node.
[0016] Optionally, receiving the RCP response message from the edge node and releasing the message entry in the message queue whose status is marked as pending response and matches the RCP response message includes:
[0017] Receive the RCP response message fed back by the edge node and confirm the message entry in the message queue whose status is pending response;
[0018] Match the RCP channel ID in the RCP response message with the RCP channel ID of the message entry to be responded to;
[0019] If the RCP channel IDs are consistent, the RCP session ID in the RCP response message is matched with the RCP session ID of the message entry to be responded to.
[0020] If the RCP session IDs match, remove the message entry to be responded to from the message queue;
[0021] If the RCP channel ID or RCP session ID is inconsistent, continue searching for the next message entry in the message queue with a status of pending response, until all message entries in the message queue have been traversed or all RCP response messages have been matched.
[0022] Optionally, if the RCP session IDs are the same, the following are also included:
[0023] If the matched message entry to be responded to contains a notification callback function, the RCP response message is fed back to the upper layer based on the notification callback function.
[0024] Optionally, when periodically polling the message queue, the method further includes:
[0025] Determine if the lifetime of a message entry with the status "Pending Response" has expired. If it has, perform timeout processing.
[0026] Optionally, determining whether the lifetime of a message entry with a status marked as pending response has expired includes:
[0027] Determine the difference between the current system time and the message initiation timestamp of the message entry whose status is pending response, and determine whether the difference is greater than or equal to a preset timeout threshold;
[0028] If yes, confirm a timeout; if no, confirm no timeout and continue polling the next message entry in the message queue.
[0029] Optionally, the timeout processing includes:
[0030] If the message entry includes a notification callback function, based on the notification callback function, the timeout result of the message entry to be responded to and the message ID of the message entry are fed back to the upper layer, and the message entry to be responded to is removed from the message queue;
[0031] If the message entry does not include a notification callback function, the message entry to be responded to is removed from the message queue.
[0032] A second aspect of this application discloses an asynchronous message queue processing apparatus, the apparatus comprising:
[0033] The upper-layer functional module is used to obtain driving instructions and cache message entries generated based on the driving instructions and initiation parameters to the message queue. The initiation parameters include message initiation timestamp, status identifier to be sent, and message ID.
[0034] The message queue management module is used to periodically poll the message queue, send message entries with a status of "to be sent" to the RCP communication module for pre-packaging; and when confirming that the load of the RCP channel meets the sending conditions, send an instruction to the RCP communication module; and change the status of message entries in the message queue corresponding to the sent RCP message to "to be responded to"; and release message entries in the message queue with a status of "to be responded to" that match the RCP response message.
[0035] The RCP communication module is used to pre-package the message entries to be sent to obtain RCP messages; send the pre-packaged RCP messages to the edge nodes according to the instructions, and have the edge nodes execute the driving instructions in the RCP messages; and receive the RCP response messages fed back by the edge nodes.
[0036] A third aspect of this application discloses an electronic device, which includes at least one processor and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the asynchronous message queue processing method disclosed in the first aspect of this application.
[0037] The fourth aspect of this application discloses a storage medium storing a program thereon, which, when executed by a controller, implements the asynchronous message queue processing method disclosed in the first aspect of this application.
[0038] Based on the asynchronous message queue processing method, apparatus, electronic device, and storage medium provided in the above embodiments of this application, message entries encapsulated with driving instructions are cached in the message queue. Message entries with a status of pending transmission are pre-packaged, and when the RCP channel load meets the conditions, all currently pre-packaged RCP messages are sent to the edge node to execute the corresponding driving action. Message entries in the message queue that match the RCP response messages fed back by the edge node are released, effectively solving the problems of blocking, packet loss, response mismatch, and timeout. This achieves and improves the reliability and real-time performance of RCP asynchronous communication, meeting the control reliability requirements of complex vehicle scenarios. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of an asynchronous message queue processing architecture disclosed in an embodiment of this application;
[0041] Figure 2 This is a flowchart illustrating an asynchronous message queue processing method disclosed in an embodiment of this application;
[0042] Figure 3 This is a flowchart illustrating another asynchronous message queue processing method disclosed in an embodiment of this application;
[0043] Figure 4 This is a schematic diagram of the structure of an asynchronous message queue processing device disclosed in an embodiment of this application;
[0044] Figure 5 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. Detailed Implementation
[0045] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0046] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0047] like Figure 1 The diagram shown is a schematic of an asynchronous message queue processing architecture disclosed in an embodiment of this application, including a region controller 11 and an edge node 12. The region controller 11 and the edge node 12 are connected via an Ethernet bus, and messages are transmitted through an RCP channel.
[0048] In some embodiments, the edge node 12 is an end controller that controls the actuator to perform corresponding actions, including but not limited to window controllers, seat adjusters, and ambient light controllers.
[0049] The area controller 11 sends drive commands to the edge node 12 via the RCP channel. These drive commands contain drive code.
[0050] The edge node 12 executes corresponding controls based on the drive command. For example, the window controller controls the window to rise and fall based on the received corresponding drive command; the seat adjuster controls the seat to move based on the received corresponding drive command; and the ambient lighting controller controls the ambient lighting to turn on and off and / or change its color based on the received corresponding drive command.
[0051] The area controller 11 includes an upper-layer functional module, a message queue management module, and an RCP communication module; the edge node 12 includes an RCP chip.
[0052] The upper-layer functional module is used to implement the business logic that the peripheral driver can perform by calling the interface of the peripheral driver and using the driver code of the peripheral driver. In other words, the upper-layer functional module calls the interface of the peripheral driver and executes the corresponding driver instructions to realize the business logic that the peripheral driver can perform.
[0053] The message queue management module is the core calling unit of this asynchronous message queue processing architecture, which can realize the functions of maintaining message queues, periodic polling, and timeout management.
[0054] The message queue is used to store message entries to be sent and / or to be responded to. Each message entry includes, but is not limited to, driver instruction content, message initiation timestamp T0, status identifier (indicating whether it is to be sent or to be responded to), RCP channel ID, and RCP session ID. The message initiation timestamp T0 is the current system timestamp when the message entry is encapsulated.
[0055] The RCP channel ID is used to indicate that the message in the message entry should be sent on the RCP channel with the corresponding ID.
[0056] The RCP session ID is assigned and fed back to the upper-layer functional module by the message queue management module when the upper-layer functional module calls the cache interface. It is used to indicate the ID of the current session, that is, when the response information is received from the edge node, it can be determined which message entry is being referred to.
[0057] In some embodiments, a notification callback function can also be configured for each message entry. This notification callback function is used to feed back the processing result to the upper-layer functional module after the message processing is completed.
[0058] The RCP communication module is used to pre-package message entries to be sent, obtain RCP messages, and send the pre-packaged RCP messages to edge node 12 when the message queue management module triggers the start of sending, as well as receive RCP response messages from edge node 12.
[0059] The RCP chip is used to receive RCP messages sent by the RCP communication module based on the RCP channel, execute the drive instructions in the RCP message, and generate an RCP response message to feed back to the RCP communication module.
[0060] When performing asynchronous message queue processing based on the above asynchronous message queue processing architecture:
[0061] The upper-layer functional module obtains the corresponding driver instructions by calling the driver code interface (driver code 1 to driver code n) of the peripheral driver. At the same time, it calls the cache interface of the message queue management module to receive the RCP session ID assigned by the message queue management module, and encapsulates the driver instruction, message initiation timestamp T0, pending status identifier, RCP channel ID, and RCP session ID into a message entry. In some embodiments, a notification callback function can also be encapsulated.
[0062] After the message entry is encapsulated, the upper-layer functional module writes the message entry into the preset message queue through this cache interface.
[0063] The message queue management module polls the message queue at a preset period and performs corresponding processing on message entries with status indicators of pending send and pending response.
[0064] When polling the message queue at a preset period, for message entries with a status of "to be sent":
[0065] The message contained in the message entry to be sent is sent to the RCP communication module via the invoked RCP asynchronous interface. The RCP communication module pre-packages the message to obtain an RCP message. At the same time, the status flag of the message entry to be sent in the message queue is updated to "Pending Response".
[0066] The message queue management module determines whether the current RCP channel's transmission load has reached the threshold. If not, it continues to poll the message queue according to the preset period and continuously sends messages in the message entries marked as pending to be sent to the RCP communication module for pre-packaging through the called RCP asynchronous interface.
[0067] If the threshold is reached, the message queue management module stops polling for the current cycle and sends a "start sending" command to the RCP communication module through the RCP asynchronous interface. The RCP communication module then sends one or more pre-packaged RCP messages to the edge node 12 through the corresponding RCP channel.
[0068] Edge node 12 processes the RCP message using the RCP chip, causing the corresponding actuator to move. It then receives the sensor signal fed back by the sensor after the actuator moves, generates a corresponding RCP response message, and sends it back to the RCP communication module via the RCP channel. This RCP response message includes the edge node processing result, the RCP channel ID, and the RCP session ID.
[0069] The RCP communication module receives the RCP response message and sends the edge node processing result, RCP channel ID, and RCP session ID obtained from parsing the RCP response message to the message queue management module. The message queue management module polls the message queue. When it finds a message entry with a status indicating it's pending a response, it matches the RCP channel ID in the pending message entry with the RCP channel ID in the RCP response message. If they match, it matches the RCP session ID in the pending message entry with the RCP session ID in the RCP response message. If they match, it removes the pending message entry from the message queue, releasing the message queue resources.
[0070] If the RCP channel ID in the pending message entry does not match the RCP channel ID in the RCP response message, or if the RCP session ID in the pending message entry does not match the RCP session ID in the RCP response message, the process continues to poll the next pending message entry for matching, until all message entries in the message queue have been traversed or all RCP response messages have been matched. If no matching message entry is found in this traversal, it is indicated that the currently received frame (Ethernet frame) response is not as expected, and the frame response is silently discarded after the current traversal ends.
[0071] In some embodiments, if the message entry to be responded to encapsulates a notification callback function, the edge node processing result in the RCP response message is fed back to the upper-layer functional module based on the notification callback function, and then the message entry to be responded to is removed from the message queue to release message queue resources.
[0072] When polling the message queue at a preset period, for message entries with a status of "pending response":
[0073] The timeout judgment is performed as follows: calculate the difference ΔT between the current system timestamp T1 and the message initiation timestamp T0 in the message entry. If the difference ΔT is greater than or equal to the preset timeout threshold, remove the message entry to be responded to.
[0074] In some embodiments, if the message entry to be responded to encapsulates a notification callback function, the timeout result and the RCP session ID in the message entry to be responded to are fed back to the upper-layer functional module based on the notification callback function.
[0075] Based on the asynchronous message queue processing architecture disclosed in this application, a driving instruction is obtained, and message entries generated based on the driving instruction and initiation parameters are cached in the message queue. The initiation parameters include a message initiation timestamp, a status identifier to be sent, an RCP channel ID, and an RCP session ID. The message queue is periodically polled, and message entries with the status identifier "to be sent" are pre-packaged to obtain RCP packets. When it is confirmed that the load of the RCP channel meets the sending conditions, the pre-packaged RCP packets are sent to the edge nodes, and the edge nodes execute the driving instructions in the RCP packets. The status identifier of the message entries in the message queue corresponding to the sent RCP packets is changed to "pending response". The RCP response packets fed back by the edge nodes are received, and the message entries with the status identifier "pending response" that match the RCP response packets in the message queue are released. In this embodiment, message entries encapsulating drive instructions are cached in a message queue. Message entries with a status of pending transmission are pre-packaged. When the RCP channel load meets the conditions, all currently pre-packaged RCP messages are sent to the edge node to execute the corresponding drive. Message entries in the message queue that match the RCP response messages fed back by the edge node are released. This effectively solves the problems of blocking, packet loss, response mismatch, and timeout, realizes and improves the reliability and real-time performance of RCP asynchronous communication, and meets the control reliability requirements of complex vehicle scenarios.
[0076] like Figure 2 The diagram shown is a flowchart of an asynchronous message queue processing method provided in an embodiment of this application. This asynchronous message queue processing method is applicable to the above-mentioned... Figure 1 The asynchronous message queue processing structure shown includes a region controller, and the asynchronous message queue processing method includes the following steps:
[0077] S201: Obtain the driver instruction and cache the message entries generated based on the driver instruction and the initiation parameters to the message queue.
[0078] In some embodiments, the driving instruction includes driving code for the end-controllers to be executed, such as window controllers, seat adjusters, and ambient lighting controllers, and drives the corresponding end-controllers to perform corresponding actions based on the driving code.
[0079] The initiation parameters include the message initiation timestamp, the status identifier to be sent, and the message ID. The message ID includes the RCP channel ID and the RCP session ID.
[0080] The message initiation timestamp is the system time when the message entry was generated.
[0081] The RCP channel ID is used to indicate that the message in the message entry should be sent on the RCP channel corresponding to the ID.
[0082] The RCP session ID is used to indicate the ID of the current session, which means that when a response is received from an edge node, it can be determined which message entry is being referred to.
[0083] S202: Periodically poll the message queue, pre-package message entries marked as pending to be sent, and obtain RCP messages.
[0084] In some embodiments, a periodic polling time is set to view the cached message entries in the message queue from beginning to end, and the contents of the message entries marked as pending are pre-packaged to obtain the RCP message corresponding to the message entry to be sent, and the RCP message is cached in the packaging queue. The RCP message contains at least the driver instruction and the message ID.
[0085] For example, the message queue is polled every 2ms-10ms, and the contents of message entries marked as pending are pre-packaged to obtain an RCP message corresponding to the message entry to be sent. The RCP message contains at least the driver instruction and the message ID.
[0086] S203: When it is confirmed that the load of the RCP channel meets the sending conditions, send the currently pre-packaged RCP message to the edge node and change the status flag of the message entry of the corresponding sent RCP message in the message queue to pending response.
[0087] In some embodiments, when it is confirmed that the load of the RCP channel meets the transmission conditions, the pre-packaged RCP message is sent to the edge node, and the edge node executes the driving instructions in the RCP message; and the status flag of the message entry corresponding to the sent RCP message in the message queue is changed to pending response.
[0088] In some embodiments, it is determined whether the load of the RCP channel has reached the transmission threshold. If the transmission threshold has not been reached, the next message entry with the status "to be sent" in the message queue of the current periodic polling is pre-packaged. If the transmission threshold has been reached, the current periodic polling is stopped, and a start transmission command is generated. Based on the start transmission command, the currently pre-packaged RCP message is sent to the edge node.
[0089] S204: Receive the RCP response message from the edge node and release the message entry in the message queue whose status flag matches the RCP response message and is pending response.
[0090] In some embodiments, an RCP response message is received from an edge node, and the RCP response message is matched with a message entry in the message queue whose status is marked as pending response. The matched pending response message entry is then removed from the message queue to release the cache resources of the message queue.
[0091] In some embodiments, the system receives RCP response messages from edge nodes and confirms message entries in the message queue whose status is pending response. It then matches the RCP channel ID in the RCP response message with the RCP channel ID of the message entry pending response. If the RCP channel IDs match, it matches the RCP session ID in the RCP response message with the RCP session ID of the message entry pending response. If the RCP session IDs match, it removes the message entry pending response from the message queue. If the RCP channel IDs or RCP session IDs do not match, it continues searching for the next message entry in the message queue until all message entries in the message queue have been traversed or all RCP response messages have been matched.
[0092] In some embodiments, if the RCP session IDs match, then when the matching message entry to be responded to contains a notification callback function, an RCP response message is fed back to the upper layer based on the notification callback function.
[0093] Based on the asynchronous message queue processing method provided in this application embodiment, message entries encapsulated with driving instructions are cached in the message queue. Message entries with a status of pending transmission are pre-packaged, and when the RCP channel load meets the conditions, all currently pre-packaged RCP messages are sent to the edge node to execute the corresponding driving. Message entries in the message queue that match the RCP response messages fed back by the edge node are released, effectively solving the problems of blocking, packet loss, response mismatch, and timeout. This realizes and improves the reliability and real-time performance of RCP asynchronous communication, meeting the control reliability requirements of complex vehicle scenarios.
[0094] like Figure 3 The diagram shown is a flowchart of an asynchronous message queue processing method provided in an embodiment of this application. This asynchronous message queue processing method is applicable to the above-mentioned... Figure 1 The asynchronous message queue processing structure shown includes a region controller, and the asynchronous message queue processing method includes the following steps:
[0095] S1: Obtain the driver instruction and cache the message entries generated based on the driver instruction and the initiation parameters to the message queue.
[0096] S2: Periodically poll the message queue and process the message entries in the message queue.
[0097] In some embodiments, S2 includes:
[0098] S21: Periodically poll the message entries in the message queue.
[0099] S22: Determine if the status flag of the message entry is pending; if yes, execute S23; otherwise, execute S27.
[0100] S23: Pre-pack the message entries marked as pending to be sent to obtain the RCP message.
[0101] S24: Determine whether the load of the RCP channel has reached the transmission threshold. If it has not reached the transmission threshold, execute S25; if it has reached the transmission threshold, execute S26.
[0102] S25: Determine whether the current periodic polling has ended. If it has not ended, continue to retrieve the next message entry in the message queue and execute S22. If it has ended, execute S26.
[0103] S26: Generate a start sending command, and send the currently pre-packaged RCP message to the edge node based on the start sending command.
[0104] S27: Determine whether the status flag of the message entry is pending response. If yes, execute S28; otherwise, execute S21.
[0105] In some embodiments, S27 can be executed first, and if the status indicator of the message entry is not pending response, then S22 can be executed.
[0106] S28: Determine whether the lifetime of a message entry with the status "pending response" has expired. If it has expired, perform timeout processing; if it has not expired, perform S21.
[0107] In some embodiments, determining whether the lifetime of a message entry with a status of pending response has expired specifically involves: determining the difference between the current system time and the message initiation timestamp of the message entry with a status of pending response, and determining whether the difference is greater than or equal to a preset timeout threshold; if yes, determining that timeout has occurred; if no, determining that timeout has not occurred, and continuing to poll the next message entry in the message queue.
[0108] In some embodiments, the timeout processing includes:
[0109] S281: Determine whether the message entry to be responded to contains a notification callback function. If it exists, execute S282. If it does not exist, execute S283.
[0110] S282: Based on the notification callback function, the timeout result and message ID of the message entry to be responded to are fed back to the upper layer, and the message entry to be responded to is removed from the message queue.
[0111] S283: Remove the message entry to be responded to from the message queue.
[0112] After executing S282 and S283 above to remove the message entries to be responded to from the message queue, S21 is then executed.
[0113] S3: Receive and process the RCP response messages from the edge nodes.
[0114] In some embodiments, S3 includes:
[0115] S31: Receive the RCP response message from the edge node.
[0116] S32: Traverse the message queue.
[0117] S33: Determine whether the status flag of the message entry is pending response; if yes, execute S34; if no, execute S32.
[0118] S34: Match the RCP channel ID in the RCP response message with the RCP channel ID of the message entry to be responded to. If they match, execute S35; otherwise, execute S32.
[0119] S35: Match the RCP session ID in the RCP response message with the RCP session ID of the message entry to be responded to. If they match, proceed to S36; otherwise, proceed to S32.
[0120] S36: Does the matched message entry contain a notification callback function? If it does, execute S37; otherwise, execute S38.
[0121] S37: Feed back the RCP response message to the upper layer, remove the matching message entry to be responded to from the message queue, and then execute S39.
[0122] S38: Remove the message entry to be responded to from the message queue and execute S39.
[0123] S39: Determine if the traversal has ended. If not, execute S32; if it has ended, wait for the next RCP response message to be received before executing S31.
[0124] Based on the asynchronous message queue processing method provided in this application embodiment, message entries encapsulated with driving instructions are cached in the message queue. Message entries with a status of pending transmission are pre-packaged, and when the RCP channel load meets the conditions, all currently pre-packaged RCP messages are sent to the edge node to execute the corresponding driving. Message entries in the message queue that match the RCP response messages fed back by the edge node are released, effectively solving the problems of blocking, packet loss, response mismatch, and timeout. This realizes and improves the reliability and real-time performance of RCP asynchronous communication, meeting the control reliability requirements of complex vehicle scenarios.
[0125] Based on the asynchronous message queue processing architecture and method disclosed in the above embodiments of this application, this application also discloses an asynchronous message queue processing apparatus, which includes:
[0126] The caching module is used to obtain the driving instruction and cache the message entries generated based on the driving instruction and the initiation parameters to the message queue. The initiation parameters include the message initiation timestamp, the status identifier to be sent, and the message ID.
[0127] The pre-packaging module is used to periodically poll the message queue, pre-packet message entries marked as pending to be sent, and obtain RCP messages.
[0128] The sending module is used to send the currently pre-packaged RCP message to the edge node when the load of the RCP channel meets the sending conditions. The edge node then executes the driving instructions in the RCP message and changes the status flag of the message entry of the corresponding sent RCP message in the message queue to pending response.
[0129] The processing module is used to receive RCP response messages from edge nodes and release message entries in the message queue whose status flag matches the RCP response message and is pending response.
[0130] This application also discloses another asynchronous message queue processing apparatus, which is as follows: Figure 4 As shown, it mainly includes:
[0131] The upper-layer functional module 401 is used to obtain the driving instruction and cache the message entries generated based on the driving instruction and the initiation parameters to the message queue. The initiation parameters include the message initiation timestamp, the status identifier to be sent, and the message ID.
[0132] The message queue management module 402 is used to periodically poll the message queue, send message entries with a status of "to be sent" to the RCP communication module for pre-packaging; and when confirming that the load of the RCP channel meets the sending conditions, send an instruction to the RCP communication module; and change the status of message entries in the message queue corresponding to the sent RCP message to "to be responded to"; and release message entries in the message queue with a status of "to be responded to" that match the RCP response message.
[0133] The RCP communication module 403 is used to pre-package message entries to be sent to obtain RCP messages; send the pre-packaged RCP messages to edge nodes according to instructions, and have the edge nodes execute the driving instructions in the RCP messages; and receive RCP response messages from edge nodes.
[0134] For details on the specific execution process and implementation of each module in the above-mentioned device, please refer to the corresponding parts of the above-mentioned asynchronous message queue processing method.
[0135] Based on the asynchronous message queue processing method and corresponding asynchronous message queue processing apparatus disclosed in the embodiments of this application above, such as Figure 5As shown in the embodiments of this application, an electronic device is also disclosed. The electronic device includes at least one processor 501, at least one memory 502 connected to the processor 501, and a bus 503. The processor 501 and the memory 502 communicate with each other through the bus 503. The processor 501 is used to call program instructions in the memory 502 to execute the asynchronous message queue processing method disclosed in the aforementioned embodiments of this application.
[0136] In one embodiment of this application, the electronic device may be a controller, whose input deserializer is communicatively connected to the serializer of a camera device containing sensors, and whose output serializer is communicatively connected to the deserializer containing a TFT display module.
[0137] Preferably, the electronic device is a region controller that includes a method for implementing asynchronous message queue processing.
[0138] This application also discloses a storage medium storing a program that, when executed by a controller, implements the asynchronous message queue processing method described above.
[0139] In the embodiments of this application, the storage medium may specifically be a computer storage medium. Computer storage media includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient media, such as modulated data signals and carrier waves.
[0140] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0141] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0142] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An asynchronous message queue processing method, characterized in that, The method includes: Obtain the driving instruction, and cache the message entry generated based on the driving instruction and the initiation parameters to the message queue. The initiation parameters include the message initiation timestamp, the status identifier to be sent, and the message ID. The message queue is periodically polled, and message entries marked as pending send are pre-packaged to obtain RCP messages; When the load of the RCP channel is confirmed to meet the transmission conditions, the pre-packaged RCP message is sent to the edge node, and the edge node executes the driving instructions in the RCP message; and the status flag of the message entry corresponding to the sent RCP message in the message queue is changed to pending response. Receive the RCP response message from the edge node and release the message entry in the message queue whose status is pending response and matches the RCP response message.
2. The method according to claim 1, characterized in that, When the load of the RCP channel is confirmed to meet the transmission conditions, the currently pre-packaged RCP message is sent to the edge node, including: Determine whether the load of the RCP channel has reached the transmission threshold; If the sending threshold is not reached, continue to pre-package the next message entry in the message queue whose status is marked as pending sending. If the sending threshold is reached, stop the current periodic polling and generate a start sending command. Based on the start sending command, send the currently pre-packaged RCP message to the edge node.
3. The method according to claim 1, characterized in that, Receiving the RCP response message from the edge node and releasing the message entry in the message queue whose status flag is pending response and matches the RCP response message includes: Receive the RCP response message fed back by the edge node and confirm the message entry in the message queue whose status is pending response; Match the RCP channel ID in the RCP response message with the RCP channel ID of the message entry to be responded to; If the RCP channel IDs are consistent, the RCP session ID in the RCP response message is matched with the RCP session ID of the message entry to be responded to. If the RCP session IDs match, remove the message entry to be responded to from the message queue; If the RCP channel ID or RCP session ID is inconsistent, continue searching for the next message entry in the message queue with a status of pending response, until all message entries in the message queue have been traversed or all RCP response messages have been matched.
4. The method according to claim 3, characterized in that, If the RCP session IDs are the same, it also includes: If the matched message entry to be responded to contains a notification callback function, the RCP response message is fed back to the upper layer based on the notification callback function.
5. The method according to any one of claims 1 to 4, characterized in that, When periodically polling the message queue, the following is also included: Determine if the lifetime of a message entry with the status "Pending Response" has expired. If it has, perform timeout processing.
6. The method according to claim 5, characterized in that, Determine whether the lifetime of a message entry with a status of pending response has expired, including: Determine the difference between the current system time and the message initiation timestamp of the message entry whose status is pending response, and determine whether the difference is greater than or equal to a preset timeout threshold; If yes, confirm a timeout; if no, confirm no timeout and continue polling the next message entry in the message queue.
7. The method according to claim 5, characterized in that, The timeout handling includes: If the message entry includes a notification callback function, based on the notification callback function, the timeout result of the message entry to be responded to and the message ID of the message entry are fed back to the upper layer, and the message entry to be responded to is removed from the message queue; If the message entry does not include a notification callback function, the message entry to be responded to is removed from the message queue.
8. An asynchronous message queue processing device, characterized in that, The device includes: The upper-layer functional module is used to obtain driving instructions and cache message entries generated based on the driving instructions and initiation parameters to the message queue. The initiation parameters include message initiation timestamp, status identifier to be sent, and message ID. The message queue management module is used to periodically poll the message queue, send message entries with a status of "to be sent" to the RCP communication module for pre-packaging; and when confirming that the load of the RCP channel meets the sending conditions, send an instruction to the RCP communication module; and change the status of message entries in the message queue corresponding to the sent RCP message to "to be responded to"; and release message entries in the message queue with a status of "to be responded to" that match the RCP response message. The RCP communication module is used to pre-package the message entries to be sent to obtain RCP messages; send the pre-packaged RCP messages to the edge nodes according to the instructions, and have the edge nodes execute the driving instructions in the RCP messages; and receive the RCP response messages fed back by the edge nodes.
9. An electronic device, characterized in that, The electronic device includes at least one processor and at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the asynchronous message queue processing method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, It stores a program that, when executed by the controller, implements the asynchronous message queue processing method as described in any one of claims 1 to 7.