Vehicle data interaction method and device and computer readable storage medium
Through the combination of monitoring threads and connection threads, the problem of poor connection stability between TCAM and cloud platform is solved, efficient and stable data interaction between vehicles and cloud platforms is achieved, and the vehicle experience is improved.
Patent Information
- Application Number
- CN202411355537.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-03
AI Technical Summary
The connection stability of TCAM and cloud platforms is poor, affecting the efficiency and stability of vehicle data interaction.
By initializing preset threads, create a thread used to monitor the reply response status and message sending and receiving status, timely detect and reset the connection status, ensuring a stable connection with the cloud platform, including creating connection threads, sending packet empty data, and receiving platform reply , monitor the message content and sending status, continuously receive data and recreate the connection thread to ensure the success of data transmission.
It greatly improves the efficiency and stability of data interaction between the vehicle and the cloud platform, ensures the continuous connection between TCAM and the cloud platform, and improves the vehicle experience.
Smart Images

Figure CN119071346A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle communication technology, and in particular to a vehicle data interaction method, device and computer-readable storage medium. Background Art
[0002] In existing vehicle technologies, TCAM (Telematics & Connectivity Antenna Module) represents the Internet of Vehicles terminal. This product is also called TBOX (Telematics Box). TCAM is an important component of the Internet of Vehicles system. It is an intelligent terminal device that integrates body network and wireless communication functions. TCAM connects the vehicle CAN bus, Ethernet bus and external cloud platform to achieve communication and data exchange between vehicles (V2V), vehicles and infrastructure (V2I), and vehicles and the Internet (V2N). TCAM usually consists of a processor, a GPS module, and a wireless module (such as 3G, 4G, 5G), and supports multiple interfaces (such as CAN bus, Ethernet bus, USB, Bluetooth, etc.).
[0003] At present, considering that TCAM occupies a very important position in the Internet of Vehicles system, an important function of TCAM is to interact with the cloud platform for data. The premise of data interaction with the cloud platform is that TCAM and the cloud platform establish a stable data connection. It can be seen that the stability of the data connection is crucial to ensure the stable operation of TCAM.
[0004] Therefore, how to improve the connection stability between TCAM and cloud platform has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] In order to overcome the deficiencies in the prior art, an object of the present invention is to provide a vehicle data interaction method, device and computer-readable storage medium to solve the problem of poor connection stability between the current TCAM and the cloud platform.
[0006] The present invention proposes a vehicle data interaction method, which is applied to a vehicle, and the method comprises:
[0007] Initialize a preset first thread, and create a second thread for monitoring the reply response status and a third thread for monitoring the message sending and receiving status;
[0008] When the first thread has completed initialization, or the reply response state is an abnormal state, or the sending and receiving state is a failed state, creating a connection thread with a preset cloud platform;
[0009] A connection behavior with the cloud platform is initiated through the connection thread, and when the reply response status is a normal status, it is determined that the connection with the cloud platform is successful.
[0010] Optionally, the creating a second thread for monitoring the reply response status further comprises:
[0011] Sending packet empty data to the cloud platform according to a preset period through the second thread, and receiving a platform reply sent by the cloud platform accordingly;
[0012] The reply response status is determined according to the number of times the platform reply is received.
[0013] Optionally, determining the reply response status according to the number of times the packet empty data is received specifically includes:
[0014] Preset the number of detection cycles corresponding to the platform response;
[0015] If the platform reply is not received for multiple consecutive times and the number of cycles is reached, the reply response state is determined to be an abnormal state, and if the platform reply is received, the reply response state is determined to be a normal state and the number of cycles is reset.
[0016] Optionally, the creating a third thread for monitoring the message sending and receiving status further includes:
[0017] Receiving, through the third thread, a first message sent by the network module of the vehicle and / or detecting a second message sent by the business module of the vehicle to the cloud platform;
[0018] The message sending and receiving state is determined according to the first message and / or the second message.
[0019] Optionally, determining the message sending and receiving state according to the first message and / or the second message specifically includes:
[0020] Obtaining the message content of the first message and / or the message sending status of the second message;
[0021] If the message content is a network disconnection message and / or the message sending status is a sending failure, the sending and receiving status is determined to be a failure status, and if the message content is a network connection message and the message sending status is a sending success, the sending and receiving status is determined to be a success status.
[0022] Optionally, the initiating a connection with the cloud platform through the connection thread further includes:
[0023] Obtaining the reply response status;
[0024] If the reply response status is a normal status, it is determined that the connection with the cloud platform is successful, and if the reply response status is an abnormal status, a connection behavior with the cloud platform is initiated again through the connection thread.
[0025] Optionally, after determining that the connection with the cloud platform is successful, the method further comprises:
[0026] Creating a fourth thread for data transmission with the cloud platform;
[0027] When continuously receiving data sent by the cloud platform through the fourth thread, the receiving status of the data is monitored.
[0028] Optionally, the receiving status of the monitoring data further includes:
[0029] If the data is received successfully, continue to receive the data sent by the cloud platform;
[0030] If the data reception fails, a connection thread with the cloud platform is re-created.
[0031] The present invention also proposes a vehicle data interaction device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the vehicle data interaction method as described in any one of the above items when executed by the processor.
[0032] The present invention also proposes a computer-readable storage medium, on which a vehicle data interaction program is stored. When the vehicle data interaction program is executed by a processor, the steps of the vehicle data interaction method as described in any one of the above items are implemented.
[0033] The vehicle data interaction method, device and computer-readable storage medium of the present invention are implemented by initializing a preset first thread, creating a second thread for monitoring the reply response status and a third thread for monitoring the message sending and receiving status; when the first thread has completed initialization, or the reply response status is an abnormal state, or the sending and receiving status is a failed state, a connection thread with a preset cloud platform is created; a connection behavior with the cloud platform is initiated through the connection thread, and when the reply response status is a normal state, it is determined that the connection with the cloud platform is successful. A data interaction solution between the vehicle and the cloud platform is realized, which greatly improves the efficiency and stability of data interaction between the vehicle and the cloud platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0035] Figure 1 is a first flow chart of the vehicle data interaction method of the present invention;
[0036] Figure 2 is a second flow chart of the vehicle data interaction method of the present invention;
[0037] Figure 3 is a third flow chart of the vehicle data interaction method of the present invention;
[0038] Figure 4 is a fourth flow chart of the vehicle data interaction method of the present invention;
[0039] Figure 5 is a fifth flow chart of the vehicle data interaction method of the present invention;
[0040] Figure 6 is a sixth flow chart of the vehicle data interaction method of the present invention;
[0041] Figure 7 is a seventh flow chart of the vehicle data interaction method of the present invention;
[0042] Figure 8 is an eighth flow chart of the vehicle data interaction method of the present invention;
[0043] Fig. 9 This is the ninth flow chart of the vehicle data interaction method of the present invention. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0045] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0046] Figure 1 This is the first flow chart of the vehicle data interaction method of the present invention. This embodiment proposes a vehicle data interaction method, which is applied to a vehicle, and the method includes:
[0047] S1, initializing a preset first thread, and creating a second thread for monitoring a reply response status and a third thread for monitoring a message sending and receiving status;
[0048] S2. When the first thread has completed initialization, or the reply response state is in an abnormal state, or the sending and receiving state is in a failed state, create a connection thread with a preset cloud platform;
[0049] S3. Initiate a connection behavior with the cloud platform through the connection thread until the reply response status is normal, and determine that the connection with the cloud platform is successful.
[0050] In this embodiment, based on the vehicle's TCAM, a data interaction implementation solution between TCAM and a cloud service platform is implemented, thereby maintaining the connection status between TCAM and CSP (cloud service provider, i.e., cloud platform) as much as possible, making the data interaction between TCAM and CSP smooth, and improving the car owner's car experience. Specifically, in this embodiment, TCAM has the ability to integrate applications. The application is taken as a cspclient program for example. The program is used to establish a connection with the CSP and interact with data. Further, in this embodiment, when the TCAM is powered on, the cspclient is initialized, and the cspclient establishes multiple sub-thread services to interact with the CSP. For example, sub-thread 1 is responsible for establishing a connection with the CSP. When the main program is started, sub-thread 1 is started until a connection is established with the CSP. For another example, sub-thread 2 is used to start a timer to send a packet of empty data to the CSP at a preset period (for example, 1 minute), and then detect whether the CSP responds to the data, so as to diagnose the connection status between the TCAM and the CSP. Further, the diagnosis method of the above connection status is that if the data has not received a reply for a preset number of consecutive times (for example, 10 times), it is determined that there is a problem with the current connection status, and the connection needs to be disconnected, and a new connection request is initiated. If a platform reply is received at any time in the 10 times, it is determined that the current connection status is normal, and the number of detections is reset, and so on. Furthermore, in this embodiment, an IPC (Inter-Process Communication) logic will be established through the created main thread to receive messages from other applications of the vehicle. Specifically, on the one hand, if a network disconnection message is received from the network module, the current connection is disconnected and a new connection request is initiated. On the other hand, when a message is received from the business module, the message is sent to the CSP. If the sending fails, the current connection is disconnected and a new connection request is initiated.
[0051] The beneficial effect of this embodiment is that by initializing a preset first thread, creating a second thread for monitoring the reply response status and a third thread for monitoring the message sending and receiving status; when the first thread has completed initialization, or the reply response status is an abnormal state, or the sending and receiving status is a failed state, a connection thread with a preset cloud platform is created; a connection behavior with the cloud platform is initiated through the connection thread until the reply response status is a normal state, and it is determined that the connection with the cloud platform is successful. A data interaction solution between the vehicle and the cloud platform is realized, which greatly improves the efficiency and stability of data interaction between the vehicle and the cloud platform.
[0052] Figure 2is a second flow chart of the vehicle data interaction method of the present invention. Based on the above embodiment, a second thread for monitoring the reply response status is created, further comprising:
[0053] S11, sending packet empty data to the cloud platform according to a preset period through the second thread, and receiving a platform reply sent by the cloud platform accordingly;
[0054] S12: Determine the reply response status according to the number of times the platform reply is received.
[0055] In this embodiment, the second thread includes a timer function for periodically sending packet empty data to the cloud platform, and at the same time, recording the platform reply sent by the cloud platform accordingly.
[0056] Figure 3 3 is a flow chart of the vehicle data interaction method of the present invention. Based on the above embodiment, the step of determining the reply response state according to the number of times the empty packet data is received specifically includes:
[0057] S121, presetting the number of detection cycles corresponding to the platform reply;
[0058] S122: If the platform reply is not received for multiple consecutive times and the number of cycles is reached, the reply response state is determined to be an abnormal state; if the platform reply is received, the reply response state is determined to be a normal state, and the number of cycles is reset.
[0059] In this embodiment, when it is determined that the reply response state is an abnormal state, the preset period is shortened, and when it is determined that the reply response state is a normal state, the preset period is kept unchanged.
[0060] In this embodiment, when it is determined that the reply response state is an abnormal state, the number of detection cycles is reduced, and when it is determined that the reply response state is a normal state, the number of detection cycles is kept unchanged.
[0061] Figure 4 4 is a flow chart of the vehicle data interaction method of the present invention. Based on the above embodiment, a third thread for monitoring the message sending and receiving status is created, further comprising:
[0062] S13, receiving, through the third thread, a first message sent by the network module of the vehicle and / or detecting a second message sent by the service module of the vehicle to the cloud platform;
[0063] S14. Determine the message sending and receiving status according to the first message and / or the second message.
[0064] In this embodiment, the second messages sent by different business modules to the cloud platform are obtained, and the message sending and receiving status is determined according to the second message sent by any business module to the cloud platform.
[0065] Figure 5 is a fifth flow chart of the vehicle data interaction method of the present invention. Based on the above embodiment, the step of determining the message sending and receiving state according to the first message and / or the second message specifically includes:
[0066] S141. Obtain the message content of the first message and / or the message sending status of the second message;
[0067] S142. If the message content is a network disconnection message and / or the message sending status is a sending failure, the sending and receiving status is determined to be a failure status; and if the message content is a network connection message and the message sending status is a sending success, the sending and receiving status is determined to be a success status.
[0068] In this embodiment, when multiple business modules send second messages to the cloud platform, if any second message fails to be sent, the sending and receiving state is determined to be a failure state.
[0069] In this embodiment, if the message content is a network disconnection message and the message sending status is successfully sent, the first message is acquired again, and the sending and receiving status is determined according to the message content of the first message.
[0070] Figure 6 is a sixth flow chart of the vehicle data interaction method of the present invention, based on the above embodiment, initiating a connection behavior with the cloud platform through the connection thread, further comprising:
[0071] S31, obtaining the reply response status;
[0072] S32. If the reply response status is a normal status, it is determined that the connection with the cloud platform is successful. If the reply response status is an abnormal status, a connection behavior with the cloud platform is initiated again through the connection thread.
[0073] In this embodiment, if the reply response status is an abnormal state, the above-mentioned preset cycle is shortened, and the connection behavior with the cloud platform is initiated again through the connection thread, and the connection status with the cloud platform is rechecked in a shorter cycle.
[0074] Figure 7 is a seventh flow chart of the vehicle data interaction method of the present invention. Based on the above embodiment, after determining that the connection with the cloud platform is successful, it also includes:
[0075] S41, creating a fourth thread for data transmission with the cloud platform;
[0076] S42: While continuously receiving data sent by the cloud platform through the fourth thread, monitor the reception status of the data.
[0077] In this embodiment, when the data sent by the cloud platform is continuously received through the fourth thread, if the reply response status is an abnormal state, disconnection is determined, and a connection behavior with the cloud platform is initiated again through the connection thread.
[0078] Figure 8 The eighth flow chart of the vehicle data interaction method of the present invention is based on the above embodiment, and the receiving state of the monitoring data further includes:
[0079] S43, if the data is received successfully, continue to receive the data sent by the cloud platform;
[0080] S44: If the data reception fails, re-create the connection thread with the cloud platform.
[0081] In this embodiment, if the data reception fails for multiple times, the first thread is reinitialized.
[0082] In this embodiment, please refer to Fig. 9The ninth flow chart of the vehicle data interaction method of the present invention is shown. Among them: step A1, CSP connection process initialization, step A2, create CSP connection thread; step B1, create tick timer thread, step B2, wait for CSP connection to succeed, step B3, send a packet of empty data to CSP every 1 minute, step B4, continuously detect whether the cloud platform has not received a response to the empty data packet for 10 consecutive times, if so, then go to step B5, disconnect the current network connection, if not, then go to the above step B3; step C1, establish IPC receiving logic, run in the main thread, step C2, continue to receive external process messages through while (true), step C3, receive business module messages, step C4, receive network module messages, step C5, send business messages to CSP platform, step C6, detect whether the above message is sent successfully, if so, then go to step C3, if not, then go to step C8, disconnect the current network connection Similarly, in step C7, it is detected whether the network is disconnected. If so, it proceeds to step C4. If not, it proceeds to step C8 to disconnect the current network connection. After step A2, after creating the CSP connection thread, it proceeds to step A3 to initiate the CSP connection behavior. In step A4, it is determined whether the connection is successful. If so, it synchronously executes step B3 to continuously monitor the connection status. If not, it proceeds to step A3 to re-initiate the connection behavior. After the above step A4 determines that the connection is successful, it proceeds to step A5 to create a download thread for CSP data. In step A6, it continuously receives the data sent by the CSP through while(true). In step A7, it detects the download status of the above data. If the download fails, it proceeds to step A3 to re-initiate the connection behavior. If the download is successful, it proceeds to step A6 to continuously receive the data sent by the CSP through while(true).
[0083] Based on the above embodiments, the present invention also proposes a vehicle data interaction device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the vehicle data interaction method as described in any one of the above items when executed by the processor.
[0084] It should be noted that the above-mentioned device embodiment and method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the device embodiment, which will not be repeated here.
[0085] Based on the above embodiments, the present invention further proposes a computer-readable storage medium, on which a vehicle data interaction program is stored. When the vehicle data interaction program is executed by a processor, the steps of the vehicle data interaction method as described in any one of the above items are implemented.
[0086] It should be noted that the above-mentioned medium embodiment and method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the medium embodiment, which will not be repeated here.
[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0088] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0089] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A vehicle data interaction method, applied to a vehicle, It is characterized in that The method comprises: Initialize a preset first thread, and create a second thread for monitoring the reply response status and a third thread for monitoring the message sending and receiving status; When the first thread has completed initialization, or the reply response state is an abnormal state, or the sending and receiving state is a failed state, creating a connection thread with a preset cloud platform; A connection behavior with the cloud platform is initiated through the connection thread, and when the reply response status is a normal status, it is determined that the connection with the cloud platform is successful.
2. The vehicle data interaction method according to claim 1, It is characterized in that The step of creating a second thread for monitoring the reply response status further includes: Sending packet empty data to the cloud platform according to a preset period through the second thread, and receiving a platform reply sent by the cloud platform accordingly; The reply response status is determined according to the number of times the platform reply is received.
3. The vehicle data interaction method according to claim 2, It is characterized in that The step of determining the reply response state according to the number of times the packet empty data is received specifically includes: Preset the number of detection cycles corresponding to the platform response; If the platform reply is not received for multiple consecutive times and the number of cycles is reached, the reply response state is determined to be an abnormal state, and if the platform reply is received, the reply response state is determined to be a normal state and the number of cycles is reset.
4. The vehicle data interaction method according to claim 1, It is characterized in that The step of creating a third thread for monitoring the message sending and receiving status further comprises: Receiving, through the third thread, a first message sent by the network module of the vehicle and / or detecting a second message sent by the business module of the vehicle to the cloud platform; The message sending and receiving state is determined according to the first message and / or the second message.
5. The vehicle data interaction method according to claim 4, It is characterized in that The determining the message sending and receiving state according to the first message and / or the second message specifically includes: Obtaining the message content of the first message and / or the message sending status of the second message; If the message content is a network disconnection message and / or the message sending status is a sending failure, the sending and receiving status is determined to be a failure status, and if the message content is a network connection message and the message sending status is a sending success, the sending and receiving status is determined to be a success status.
6. The vehicle data interaction method according to claim 1, It is characterized in that The initiating a connection with the cloud platform through the connection thread further includes: Obtaining the reply response status; If the reply response status is a normal status, it is determined that the connection with the cloud platform is successful, and if the reply response status is an abnormal status, a connection behavior with the cloud platform is initiated again through the connection thread.
7. The vehicle data interaction method according to claim 1, It is characterized in that After the determination of successful connection with the cloud platform, the method includes: Creating a fourth thread for data transmission with the cloud platform; When continuously receiving data sent by the cloud platform through the fourth thread, the receiving status of the data is monitored.
8. The vehicle data interaction method according to claim 7, It is characterized in that The receiving status of the monitoring data further includes: If the data is received successfully, continue to receive the data sent by the cloud platform; If the data reception fails, a connection thread with the cloud platform is re-created.
9. A vehicle data interaction device, It is characterized in that The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the vehicle data interaction method as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a vehicle data interaction program, and when the vehicle data interaction program is executed by a processor, the steps of the vehicle data interaction method according to any one of claims 1 to 8 are implemented.
