Automobile diagnosis message caching and forwarding method and device and electronic equipment

By introducing cache middleware in the ECU stacking upgrade scenario, receiving and managing diagnostic requests, the invalid communication problem caused by the diagnostic instrument's frequent sending of requests is solved, and the cache and forwarding of diagnostic requests is realized, invalid communication is reduced, and communication efficiency is improved.

CN118984337APending Publication Date: 2024-11-19NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411265627.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

In the ECU stacking upgrade scenario, when the diagnostic device frequently sends diagnostic requests, the diagnostic server fails to process in time, resulting in invalid communication, occupying resources, and failing to process in time, resulting in a large number of invalid diagnostic request messages.

Method used

Introduce cache middleware, receive diagnostic requests from the diagnostic instrument and insert them into the FIFO cache queue, and send them to the diagnostic server when the sending processor is idle, and wait for the response within the timeout time. If no response is received, try again or discard it. Request, control queue size to reduce invalid communication.

Benefits of technology

It effectively reduces invalid diagnostic requests in the communication link, reduces invalid communication of the diagnostic instrument, improves communication efficiency in ECU stacking upgrade scenarios, and alleviates the invalid communication problem of the diagnostic instrument.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984337A_ABST
    Figure CN118984337A_ABST
Patent Text Reader

Abstract

The invention provides an automobile diagnosis message caching and forwarding method and device and electronic equipment, and in the method, caching middleware can receive a diagnosis request sent by a diagnosis instrument at high frequency, and when a diagnosis server processes the diagnosis request, the newly received diagnosis request is inserted into a caching queue, and the diagnosis request is forwarded to the caching middleware. The new diagnosis request is obtained from the cache queue until the diagnosis server processes the diagnosis request (that is, the cache middleware receives the diagnosis response for the diagnosis request sent by the diagnosis server), and the new diagnosis request is continuously sent to the diagnosis server for processing; that is to say, the cache middleware realizes the caching and forwarding functions of the diagnosis requests, and reduces the number of invalid diagnosis requests in a communication link, namely, greatly reduces invalid communication of the diagnosis instrument.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automobiles, and in particular to a method, device and electronic equipment for caching and forwarding automobile diagnostic messages. Background Art

[0002] When upgrading the ECU (Electronic Control Unit), a diagnostic instrument is required. In some stack upgrade scenarios (i.e., scenarios where multiple ECUs need to be upgraded at the same time), the diagnostic instrument may frequently send diagnostic requests to the DM (diagnostic management, or diagnostic server, which is deployed on the ECU to be upgraded so that the ECU to be upgraded can be upgraded). However, it takes some time for the diagnostic server to process the diagnostic request. During the process of processing the diagnostic request by the diagnostic server, the diagnostic server cannot receive the diagnostic request sent by the diagnostic instrument. During the process of processing the diagnostic request by the diagnostic server, the diagnostic request sent by the diagnostic instrument cannot be processed by the diagnostic server in time and is discarded. This results in a large number of invalid diagnostic request messages in the communication link and occupies the resources of the diagnostic server.

[0003] In summary, in the stack upgrade scenario of ECU, how to reduce invalid communication of the diagnostic instrument (i.e., reduce invalid diagnostic request messages) has become a technical problem that urgently needs to be solved. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method, device and electronic device for caching and forwarding automobile diagnostic messages to alleviate the serious technical problem of invalid communication of diagnostic instruments in traditional ECU stacking upgrade scenarios.

[0005] In a first aspect, an embodiment of the present invention provides a method for caching and forwarding automobile diagnostic messages, comprising:

[0006] The cache middleware receives the diagnostic request sent by the diagnostic instrument, and when the sending processor is in a working state, the cache middleware inserts the diagnostic request into the cache queue of the FIFO;

[0007] When the sending processor is in an idle state, the sending processor obtains the diagnosis request from the cache queue and sends the diagnosis request to the diagnosis server, and the cache middleware starts a timer to wait;

[0008] If the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0009] Furthermore, the size of the cache queue is calculated according to a cache queue size calculation formula;

[0010] The calculation formula of the cache queue size is: cache queue size = number of diagnostic requests sent by the diagnostic instrument within the timeout period of the diagnostic instrument / number of diagnostic requests cached for each diagnostic request processed by the diagnostic server × length of the diagnostic request;

[0011] When the diagnostic requests in the cache queue reach the size of the cache queue, the cache middleware discards the diagnostic request sent by the diagnostic instrument and prompts the diagnostic instrument that the cache queue has reached the upper limit, so that the diagnostic instrument retries the diagnostic request discarded by the cache middleware;

[0012] or

[0013] There is no upper limit on the size of the cache queue;

[0014] If the duration of the target diagnostic request in the cache queue reaches the diagnostic instrument timeout period, the diagnostic instrument retries the target diagnostic request.

[0015] Furthermore, the cache middleware timeout period is related to the service corresponding to the diagnosis request.

[0016] Furthermore, the method further comprises:

[0017] If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the cache middleware timeout period ends, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0018] Furthermore, the method further comprises:

[0019] If the cache middleware receives a continue waiting request sent by the diagnostic service end within the cache middleware timeout period, the cache middleware extends the cache middleware timeout period according to the continue waiting request and sends the continue waiting request to the diagnostic instrument;

[0020] If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the extended cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the extended cache middleware timeout period expires, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0021] Furthermore, the method further comprises:

[0022] If the cache middleware receives a busy response sent by the diagnostic server within the cache middleware timeout period, the cache middleware retries and controls the sending processor to send the diagnostic request to the diagnostic server after a preset delay, until the diagnostic request is processed by the diagnostic server or the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period;

[0023] If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the busy response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0024] Furthermore, before the cache middleware receives the diagnostic request sent by the diagnostic instrument, the method further includes:

[0025] The cache middleware and the diagnostic server are started, and after starting, the cache middleware connects to the diagnostic server, and retries the connection after a preset time interval if the connection fails.

[0026] In a second aspect, an embodiment of the present invention further provides a device for caching and forwarding automobile diagnostic messages, including:

[0027] A receiving unit, used for the cache middleware to receive the diagnostic request sent by the diagnostic instrument, and when the sending processor is in a working state, the cache middleware inserts the diagnostic request into the cache queue of the FIFO;

[0028] an acquisition and sending unit, configured to, when the sending processor is in an idle state, obtain the diagnosis request from the cache queue by the sending processor, send the diagnosis request to the diagnosis server, and start a timer for the cache middleware to wait;

[0029] A sending unit is used for, if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0030] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.

[0031] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to execute any method described in the first aspect above.

[0032] In an embodiment of the present invention, a method for caching and forwarding automobile diagnostic messages is provided, comprising: a cache middleware receives a diagnostic request sent by a diagnostic instrument, and when a sending processor is in a working state, the cache middleware inserts the diagnostic request into a FIFO cache queue; when the sending processor is in an idle state, the sending processor obtains the diagnostic request from the cache queue, and sends the diagnostic request to a diagnostic server, and the cache middleware starts a timer to wait; if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within a cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server. It can be seen from the above description that in the method for caching and forwarding automobile diagnostic messages of the present invention, the cache middleware can receive diagnostic requests sent by the diagnostic instrument at a high frequency, and when the diagnostic server processes the diagnostic request, the newly received diagnostic request is inserted into the cache queue, and the new diagnostic request will not be obtained from the cache queue until the diagnostic server has processed the diagnostic request (that is, the cache middleware receives the diagnostic response to the diagnostic request sent by the diagnostic server) and continues to send it to the diagnostic server for processing. That is to say, the cache middleware of the present invention realizes the caching and forwarding functions of the diagnostic request, reduces the number of invalid diagnostic requests in the communication link, that is, greatly reduces the invalid communication of the diagnostic instrument, and alleviates the serious technical problem of invalid communication of the diagnostic instrument in the traditional ECU stack upgrade scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A flowchart of a method for caching and forwarding automobile diagnostic messages provided by an embodiment of the present invention;

[0035] Figure 2 A schematic diagram of the structure of the cache middleware, diagnostic instrument and diagnostic server provided in an embodiment of the present invention;

[0036] Figure 3 A schematic diagram of a device for caching and forwarding automobile diagnostic messages provided by an embodiment of the present invention;

[0037] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] In traditional ECU stack upgrade scenarios, invalid communication of the diagnostic instrument is serious.

[0040] Based on this, in the method for caching and forwarding automobile diagnostic messages of the present invention, the cache middleware can receive diagnostic requests sent by the diagnostic instrument at a high frequency, and when the diagnostic server processes the diagnostic requests, the newly received diagnostic requests are inserted into the cache queue. The new diagnostic requests will not be obtained from the cache queue until the diagnostic server has processed the diagnostic requests (that is, the cache middleware receives the diagnostic response to the diagnostic request sent by the diagnostic server) and continues to send it to the diagnostic server for processing. In other words, the cache middleware of the present invention realizes the caching and forwarding functions of diagnostic requests, reduces the number of invalid diagnostic requests in the communication link, and greatly reduces the invalid communication of the diagnostic instrument.

[0041] To facilitate understanding of this embodiment, a method for caching and forwarding automobile diagnostic messages disclosed in an embodiment of the present invention is first introduced in detail.

[0042] Embodiment 1:

[0043] According to an embodiment of the present invention, an embodiment of a method for caching and forwarding automobile diagnostic messages is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0044] Figure 1 is a flow chart of a method for caching and forwarding automobile diagnostic messages according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0045] Step S102, the cache middleware receives the diagnostic request sent by the diagnostic instrument, and when the sending processor is in a working state, the cache middleware inserts the diagnostic request into the FIFO cache queue;

[0046] Specifically, the structures of the cache middleware, diagnostic instrument and diagnostic server are as follows: Figure 2 shown.

[0047] When working, the cache middleware receives the diagnostic request sent by the diagnostic instrument through the TCP protocol. After receiving the diagnostic request, it checks whether the message format of the diagnostic request is correct and determines whether the sending processor is in an idle state. If the sending processor is in an idle state, the sending processor directly forwards the diagnostic request to the diagnostic server for processing, and the cache middleware starts a timer to wait; if the sending processor is in a working state, the cache middleware inserts the diagnostic request into the FIFO cache queue. When the sending processor is in an idle state, the sending processor obtains the diagnostic request from the cache queue and sends the diagnostic request to the diagnostic server for processing.

[0048] The sending processor is specifically a part of the cache middleware, and may be a functional code in the cache middleware responsible for sending the diagnosis request.

[0049] Step S104, when the processor to be sent is in an idle state, the sending processor obtains the diagnosis request from the cache queue and sends the diagnosis request to the diagnosis server, and the cache middleware starts a timer to wait;

[0050] Step S106, if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0051] Specifically, the above-mentioned cache middleware timeout period is specifically the time length from the cache middleware sending a diagnostic request to the receipt of a diagnostic response corresponding to the diagnostic request, which cannot exceed this time length. The diagnostic instrument can send diagnostic requests to the cache middleware at a high frequency, but the cache middleware and the diagnostic server are in a question-and-answer format, and the diagnostic instrument sends diagnostic requests at a high frequency, while the diagnostic server processes them at a low frequency, which will cause an excess of diagnostic requests. The excess diagnostic requests are cached in the cache queue in the cache middleware, and then the cache middleware forwards the diagnostic requests in the cache queue to the diagnostic server for processing. This will reduce the number of invalid diagnostic requests in the communication link, that is, greatly reduce the invalid communication of the diagnostic instrument.

[0052] In an embodiment of the present invention, a method for caching and forwarding automobile diagnostic messages is provided, comprising: a cache middleware receives a diagnostic request sent by a diagnostic instrument, and when a sending processor is in a working state, the cache middleware inserts the diagnostic request into a FIFO cache queue; when the sending processor is in an idle state, the sending processor obtains the diagnostic request from the cache queue, and sends the diagnostic request to a diagnostic server, and the cache middleware starts a timer to wait; if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within a cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server. It can be seen from the above description that in the method for caching and forwarding automobile diagnostic messages of the present invention, the cache middleware can receive diagnostic requests sent by the diagnostic instrument at a high frequency, and when the diagnostic server processes the diagnostic request, the newly received diagnostic request is inserted into the cache queue, and the new diagnostic request will not be obtained from the cache queue until the diagnostic server has processed the diagnostic request (that is, the cache middleware receives the diagnostic response to the diagnostic request sent by the diagnostic server) and continues to send it to the diagnostic server for processing. That is to say, the cache middleware of the present invention realizes the caching and forwarding functions of the diagnostic request, reduces the number of invalid diagnostic requests in the communication link, that is, greatly reduces the invalid communication of the diagnostic instrument, and alleviates the serious technical problem of invalid communication of the diagnostic instrument in the traditional ECU stack upgrade scenario.

[0053] The above content briefly introduces the method for caching and forwarding automobile diagnostic messages of the present invention. The specific contents involved are described in detail below.

[0054] In an optional embodiment of the present invention, the size of the cache queue is calculated according to a cache queue size calculation formula;

[0055] The calculation formula for the cache queue size is: cache queue size = the number of diagnostic requests sent by the diagnostic instrument within the timeout period of the diagnostic instrument / the number of diagnostic requests cached for each diagnostic request processed by the diagnostic server × the length of the diagnostic request;

[0056] When the diagnostic requests in the cache queue reach the size of the cache queue, the cache middleware discards the diagnostic request sent by the diagnostic instrument and prompts the diagnostic instrument that the cache queue has reached the upper limit, so that the diagnostic instrument retries the diagnostic request discarded by the cache middleware;

[0057] or

[0058] There is no upper limit on the size of the cache queue;

[0059] If the target diagnostic request in the cache queue has been in the cache queue for a timeout period of the diagnostic instrument, the diagnostic instrument retries the target diagnostic request.

[0060] Specifically, the size of the cache queue can be modified through configuration, and can be determined according to the following two strategies, as illustrated below:

[0061] 1. When the diagnostic instrument is downloading or uploading data, the frequency of sending diagnostic requests by the diagnostic instrument will reach once every 1ms. The data size of each diagnostic request can reach 1MB, and the timeout period of the diagnostic instrument is 5s (the maximum timeout period defined by the diagnostic instrument, specifically, the time from the diagnostic instrument sending a diagnostic request to the time it receives the diagnostic response corresponding to the diagnostic request cannot exceed this time), and the time it takes for the diagnostic server to process a diagnostic request is 5ms. At this time, the size of the cache queue should be set to: 5000 (specifically, the number of diagnostic requests sent by the diagnostic instrument within the timeout period of the diagnostic instrument, that is, 5s / 1ms) ÷ (5-1) (the number of diagnostic requests cached for each diagnostic request processed by the diagnostic server, that is, 5ms-1ms) × diagnostic request length (each cached diagnostic request will delay the response of the next diagnostic request by 4ms). Calculation shows that when the number of cached diagnostic requests exceeds 1250, a new diagnostic request cannot be responded to within 5 seconds (diagnostic instrument timeout period). The cache middleware will discard the diagnostic request and prompt the diagnostic instrument that the cache queue exceeds the upper limit. The diagnostic instrument will retry the discarded diagnostic request (i.e., the diagnostic instrument will resend the discarded diagnostic request to the cache middleware) to ensure that the sending sequence is correct.

[0062] 2. There is no upper limit on the size of the cache queue (the number of diagnostic requests will not reach the theoretical upper limit). At this time, the cache middleware will not discard the diagnostic requests of the diagnostic instrument. When the number of caches is too large, the target diagnostic requests in the cache queue (that is, the diagnostic requests when the length of the cache queue reaches the timeout time of the diagnostic instrument) will time out. The diagnostic instrument will retry these timed-out diagnostic requests (that is, the target diagnostic requests) to ensure that the sending sequence is correct.

[0063] In an optional embodiment of the present invention, the cache middleware timeout period is related to the service corresponding to the diagnosis request, and the cache middleware timeout period is different for different services corresponding to the diagnosis request.

[0064] Specifically, according to different services of the diagnostic request, or sub-functions of different services, the cache middleware will set different cache middleware timeout periods. For diagnostic requests corresponding to services with long processing time (requesting download, transmitting data, clearing error codes), the tolerated cache middleware timeout period will be longer.

[0065] In an optional embodiment of the present invention, the method further comprises the following steps:

[0066] If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the cache middleware timeout period ends, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0067] Specifically, the cache middleware has a timeout control mechanism. When a diagnostic request is wrong and the internal processing logic of the diagnostic server is abnormal, the cache middleware cannot obtain a diagnostic response for a long time (not received within the cache middleware timeout period). To ensure that the communication link is unobstructed, the cache middleware stops processing the current diagnostic request after the cache middleware timeout period expires. The cache middleware obtains a new diagnostic request in the cache queue and enters a new round of processing status.

[0068] In an optional embodiment of the present invention, the method further comprises the following steps:

[0069] (1) If the cache middleware receives a continue waiting request sent by the diagnostic server within the cache middleware timeout period, the cache middleware will extend the cache middleware timeout period according to the continue waiting request and will continue waiting request to the diagnostic instrument;

[0070] (2) If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the extended cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the extended cache middleware timeout period expires, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0071] Specifically, for pending requests from the diagnostic server (the resources required to execute the vibration request have not yet been prepared, and the cache middleware and the diagnostic instrument need to continue waiting, that is, continue to wait for the request), the cache middleware will extend the cache middleware timeout period, continue to wait, and the cache middleware will pass the pending request to the diagnostic instrument for subsequent processing. Specifically: if the diagnostic request still times out (that is, the cache middleware does not receive the diagnostic response to the diagnostic request sent by the diagnostic server within the extended cache middleware timeout period), the cache middleware obtains the new diagnostic request in the cache queue and enters a new round of processing status.

[0072] In an optional embodiment of the present invention, the method further comprises the following steps:

[0073] (1) If the cache middleware receives a busy response from the diagnostic server within the cache middleware timeout period, the cache middleware retries and controls the sending processor to send the diagnostic request to the diagnostic server after a preset delay, until the diagnostic request is processed by the diagnostic server or the cache middleware does not receive a diagnostic response to the diagnostic request from the diagnostic server within the cache middleware timeout period;

[0074] (2) If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends a busy response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0075] Specifically, for the busy response from the diagnostic server (the diagnostic server is busy and the diagnostic request cannot be processed, i.e., busy response), the cache middleware will automatically execute the retry mechanism. After a 5ms delay (to prevent frequent requests from further occupying resources), the cache middleware retries the current diagnostic request until the diagnostic request is processed (i.e., the cache middleware receives the diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period) or the cache middleware does not receive the diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period.

[0076] If the cache middleware does not receive the diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware will transparently pass the busy response to the diagnostic instrument for subsequent processing. The subsequent processing is as follows: the cache middleware obtains the new diagnostic request in the cache queue and enters a new round of processing state.

[0077] In an optional embodiment of the present invention, before the cache middleware receives the diagnostic request sent by the diagnostic instrument, the method further includes the following steps:

[0078] The cache middleware and the diagnostic server are started, and after starting, the cache middleware connects to the diagnostic server, and retries the connection after a preset time interval if the connection fails.

[0079] Specifically, during the startup phase of the domain controller (ECU includes the domain controller), the execution management program EM (startup program, which needs to be started for process startup) will sequentially start various services and applications including the cache middleware and the diagnostic server. The diagnostic instrument will be started after the diagnostic server and the cache middleware due to its lower priority. In order to avoid excessive delays in the initial diagnostic request after the diagnostic instrument is started (resources are tight during the startup phase, and overall performance is poor), the cache middleware will actively try to connect to the diagnostic server after startup, and try to reconnect three times after failure, with an interval of 500ms each time. During the actual test, the connection success rate reached 100%, the average number of reconnections was 1.5 times, and the processing time of the first diagnostic request was reduced by 2 to 3ms.

[0080] The method for caching and forwarding automobile diagnostic messages of the present invention has the following advantages:

[0081] 1. Realize the caching and forwarding functions of automobile diagnostic requests to reduce invalid communications;

[0082] 2. In the stack upgrade scenario, the diagnostic instrument can upgrade multiple ECUs at the same time without paying attention to the diagnostic response, greatly improving the efficiency of data transmission;

[0083] 3. The cache middleware puts less pressure on the system during operation and does not cause excessive burden;

[0084] 4. Perform timeout control;

[0085] 5. Diagnostic requests can be automatically retried.

[0086] The main technical points of the present invention include:

[0087] 1. The cache middleware has cache and forwarding functions to ensure the correctness of the request sequence;

[0088] 2. Based on the timeout control function of the service, extend the timeout period;

[0089] 3. Perform a timed retry based on the peer's response;

[0090] 4. Small system resource usage for caching, timeout control, and retry;

[0091] 5. Optimization of processing time during the startup phase.

[0092] Embodiment 2:

[0093] An embodiment of the present invention also provides a caching and forwarding device for automobile diagnostic messages, which is mainly used to execute the caching and forwarding method for automobile diagnostic messages provided in the first embodiment of the present invention. The following is a specific introduction to the caching and forwarding device for automobile diagnostic messages provided in the embodiment of the present invention.

[0094] Figure 3 is a schematic diagram of a buffering and forwarding device for automobile diagnostic messages according to an embodiment of the present invention, such as Figure 3 As shown, the device includes: a receiving unit 10, an acquisition and sending unit 20 and a sending unit 30, wherein:

[0095] The receiving unit is used for the cache middleware to receive the diagnostic request sent by the diagnostic instrument, and when the sending processor is in a working state, the cache middleware inserts the diagnostic request into the cache queue of the FIFO;

[0096] The acquisition and sending unit is used for when the waiting sending processor is in an idle state, the sending processor acquires the diagnosis request from the cache queue and sends the diagnosis request to the diagnosis server, and the cache middleware starts a timer to wait;

[0097] The sending unit is used for, if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0098] In an embodiment of the present invention, a cache and forwarding device for automobile diagnostic messages is provided, including: a cache middleware receives a diagnostic request sent by a diagnostic instrument, and when a sending processor is in a working state, the cache middleware inserts the diagnostic request into a FIFO cache queue; when the sending processor is in an idle state, the sending processor obtains the diagnostic request from the cache queue, and sends the diagnostic request to a diagnostic server, and the cache middleware starts a timer to wait; if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within a cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server. From the above description, it can be seen that in the caching and forwarding device for automobile diagnostic messages of the present invention, the cache middleware can receive diagnostic requests sent by the diagnostic instrument at a high frequency, and when the diagnostic server processes the diagnostic request, the newly received diagnostic request is inserted into the cache queue. The new diagnostic request will not be obtained from the cache queue until the diagnostic server has processed the diagnostic request (that is, the cache middleware receives the diagnostic response to the diagnostic request sent by the diagnostic server) and continues to send it to the diagnostic server for processing. That is to say, the cache middleware of the present invention realizes the caching and forwarding functions of the diagnostic request, reduces the number of invalid diagnostic requests in the communication link, that is, greatly reduces the invalid communication of the diagnostic instrument, and alleviates the serious technical problem of invalid communication of the diagnostic instrument in the traditional ECU stack upgrade scenario.

[0099] Optionally, the size of the cache queue is calculated according to a cache queue size calculation formula; the cache queue size calculation formula is: cache queue size = number of diagnostic requests sent by the diagnostic instrument within the diagnostic instrument timeout period ÷ number of diagnostic requests cached for each diagnostic request processed by the diagnostic server × length of diagnostic request; when the diagnostic requests in the cache queue reach the size of the cache queue, the cache middleware discards the diagnostic requests sent by the diagnostic instrument, and prompts the diagnostic instrument that the cache queue has reached the upper limit, so that the diagnostic instrument retries the diagnostic requests discarded by the cache middleware; or, the size of the cache queue does not set an upper limit; if the target diagnostic request in the cache queue reaches the diagnostic instrument timeout period when the length of time in the cache queue reaches the diagnostic instrument timeout period, the diagnostic instrument retries the target diagnostic request.

[0100] Optionally, the cache middleware timeout period is related to the service corresponding to the diagnosis request.

[0101] Optionally, the device is also used for: if the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, then after the cache middleware timeout period ends, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0102] Optionally, the device is also used for: if the cache middleware receives a continue waiting request sent by the diagnostic server within the cache middleware timeout period, the cache middleware extends the cache middleware timeout period according to the continue waiting request, and continues to wait for the request to the diagnostic instrument; if the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the extended cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the extended cache middleware timeout period ends, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0103] Optionally, the device is also used for: if the cache middleware receives a busy response sent by the diagnostic server within the cache middleware timeout period, the cache middleware retries and controls the sending processor to send the diagnostic request to the diagnostic server after a preset delay, until the diagnostic request is processed by the diagnostic server or the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period; if the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends a busy response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

[0104] Optionally, the device is also used to: start the cache middleware and the diagnostic server, and after starting, the cache middleware connects to the diagnostic server, and after a connection failure, retries the connection after a preset time interval.

[0105] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0106] like Figure 4 As shown, an electronic device 600 provided in an embodiment of the present application includes: a processor 601, a memory 602 and a bus, wherein the memory 602 stores machine-readable instructions executable by the processor 601. When the electronic device is running, the processor 601 communicates with the memory 602 through the bus, and the processor 601 executes the machine-readable instructions to perform the steps of the above-mentioned method for caching and forwarding automobile diagnostic messages.

[0107] Specifically, the memory 602 and the processor 601 can be general-purpose memories and processors, which are not specifically limited here. When the processor 601 runs the computer program stored in the memory 602, the method for caching and forwarding the above-mentioned automobile diagnostic message can be executed.

[0108] The processor 601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 601. The above processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the above method in combination with its hardware.

[0109] Corresponding to the above-mentioned method for caching and forwarding automobile diagnostic messages, an embodiment of the present application also provides a computer-readable storage medium, which stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the steps of the above-mentioned method for caching and forwarding automobile diagnostic messages.

[0110] The caching and forwarding device for automobile diagnostic messages provided in the embodiment of the present application can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in the embodiment of the present application are the same as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding contents in the aforementioned method embodiment. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.

[0111] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0112] For another example, the flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0114] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0115] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or partly contribute to the prior art or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions for an electronic device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the vehicle marking method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0116] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0117] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solution of the present application, rather than to limit it. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the aforementioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solution recorded in the aforementioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiment of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for caching and forwarding automobile diagnostic messages, characterized in that: include: The cache middleware receives the diagnostic request sent by the diagnostic instrument, and when the sending processor is in a working state, the cache middleware inserts the diagnostic request into the cache queue of the FIFO; When the sending processor is in an idle state, the sending processor obtains the diagnosis request from the cache queue and sends the diagnosis request to the diagnosis server, and the cache middleware starts a timer to wait; If the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

2. The method according to claim 1, characterized in that The size of the cache queue is calculated according to a cache queue size calculation formula; The calculation formula of the cache queue size is: cache queue size = number of diagnostic requests sent by the diagnostic instrument within the timeout period of the diagnostic instrument / number of diagnostic requests cached for each diagnostic request processed by the diagnostic server × length of the diagnostic request; When the diagnostic requests in the cache queue reach the size of the cache queue, the cache middleware discards the diagnostic request sent by the diagnostic instrument and prompts the diagnostic instrument that the cache queue has reached the upper limit, so that the diagnostic instrument retries the diagnostic request discarded by the cache middleware; or There is no upper limit on the size of the cache queue; If the duration of the target diagnostic request in the cache queue reaches the diagnostic instrument timeout period, the diagnostic instrument retries the target diagnostic request.

3. The method according to claim 1, characterized in that: The cache middleware timeout period is related to the service corresponding to the diagnosis request.

4. The method according to claim 1, characterized in that The method further comprises: If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the cache middleware timeout period ends, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

5. The method according to claim 1, characterized in that The method further comprises: If the cache middleware receives a continue waiting request sent by the diagnostic service end within the cache middleware timeout period, the cache middleware extends the cache middleware timeout period according to the continue waiting request and sends the continue waiting request to the diagnostic instrument; If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the extended cache middleware timeout period, the cache middleware controls the sending processor to obtain a new diagnostic request from the cache queue after the extended cache middleware timeout period expires, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

6. The method according to claim 1, characterized in that The method further comprises: If the cache middleware receives a busy response sent by the diagnostic server within the cache middleware timeout period, the cache middleware retries and controls the sending processor to send the diagnostic request to the diagnostic server after a preset delay, until the diagnostic request is processed by the diagnostic server or the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period; If the cache middleware does not receive a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the busy response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

7. The method according to claim 1, characterized in that Before the cache middleware receives the diagnostic request sent by the diagnostic instrument, the method further includes: The cache middleware and the diagnostic server are started, and after starting, the cache middleware connects to the diagnostic server, and retries the connection after a preset time interval if the connection fails.

8. A device for caching and forwarding automobile diagnostic messages, characterized in that: include: A receiving unit, used for the cache middleware to receive the diagnostic request sent by the diagnostic instrument, and when the sending processor is in a working state, the cache middleware inserts the diagnostic request into the cache queue of the FIFO; an acquisition and sending unit, configured to, when the sending processor is in an idle state, obtain the diagnosis request from the cache queue by the sending processor, send the diagnosis request to the diagnosis server, and the cache middleware starts a timer to wait; A sending unit is used for, if the cache middleware receives a diagnostic response to the diagnostic request sent by the diagnostic server within the cache middleware timeout period, the cache middleware sends the diagnostic response to the diagnostic instrument, controls the sending processor to obtain a new diagnostic request from the cache queue, and uses the new diagnostic request as the diagnostic request, and returns to execute the step of sending the diagnostic request to the diagnostic server.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to execute the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Vehicle diagnosis response method and device, equipment and storage medium

    CN120972883A