Wireless Communication Method, Terminal Device, Server, and Readable Storage Medium
By establishing at least two types of wireless communication links in the battery swap site scenario and using the precise time protocol for time synchronization, the problem of difficulty in ensuring the stability of wireless communication between the terminal device and the station-side server is solved, and stable information resource sharing and service message transmission are achieved.
Patent Information
- Application Number
- CN202510149167.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-02-11
AI Technical Summary
In the battery swap site scenario, the stability of wireless communication between the terminal equipment and the station server is difficult to ensure, especially in urban environments with dense population and complex traffic, the parking plan for the vehicle-side parking solution in extreme scenarios is not enough to meet the needs.
By establishing at least two types of wireless communication links between the terminal device and the station-side server, subscription and publication of data topics are realized, and time synchronization is performed through the Precision Time Protocol (PTP), ensuring the stability and accuracy of data transmission.
The wireless communication stability and information resource sharing capabilities between the terminal device and the station-side server are improved, and when one type of wireless communication link is unavailable, another link can be used to ensure stable publication and subscription of service messages, and realize stable information resource sharing.
Smart Images

Figure CN119629775B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technologies, and particularly to a wireless communication method, a terminal device, a server, and a readable storage medium. Background Art
[0002] Currently, battery swapping station manufacturers in the industry all perform battery swapping by manually parking into the battery swapping station. The narrow space and slope of the battery swapping station pose challenges to parking for each battery swapping user. The vehicle-end parking solution, while liberating users, reduces collision accidents and improves the parking speed and success rate. However, since most battery swapping stations are located in urban areas with dense population and complex traffic scenarios, there are still some extreme scenarios where the vehicle-end parking alone cannot meet the requirements. In addition, the vehicle-end parking solution also has high requirements for vehicle-end sensors and computing power.
[0003] Based on these problems, it is proposed to control the vehicle by installing lidar and sensors at the station end of the battery swapping station. The station-end sensors have a better perspective to handle more complex scenarios, can further improve the parking speed, and no longer have high requirements for vehicle-end sensors and computing power, which provides the possibility for opening the battery swapping station to more external customers in the future. However, the station end and the vehicle end communicate through a wireless network. How to achieve stable data transmission between the station end and the vehicle end is the key to ensuring the success of station-end parking.
[0004] Correspondingly, a new wireless communication solution is needed in this field to solve the above problems. Summary of the Invention
[0005] In order to overcome the above defects, the present application is proposed to solve or at least partially solve the technical problem of how to improve the stability of the wireless communication process between the terminal device and the station-end server.
[0006] In a first aspect, a wireless communication method is provided. The method is applied to a terminal device, and the terminal device is wirelessly communicatively connected to a station-end server through at least two types of wireless communication links. The method includes:
[0007] Based on a preset service requirement, subscribing to a first data topic through at least two types of wireless communication links; and receiving service messages of the first data topic published by the station-end server through at least two types of wireless communication links; and,
[0008] Based on the service requirement, publishing service messages of a second data topic to the station-end server through at least two types of wireless communication links.
[0009] In a technical solution of the above wireless communication method, the service messages of the first data topic include at least one service message; each service message includes the precise time protocol time when the service message is published.
[0010] Receiving the service messages of the first data topic published by the station-side server through at least two types of wireless communication links includes:
[0011] For each received service message, using the precise time protocol time of the latest service message retained as the latest time of the first data topic;
[0012] When receiving the next service message of the first data topic, deduplicating the service message according to the precise time protocol time of the next service message and the latest time, so as to implement the reception of the service messages of the first data topic.
[0013] In a technical solution of the above wireless communication method, the deduplicating the service message according to the precise time protocol time of the next service message and the latest time includes:
[0014] Comparing the precise time protocol time of the next service message with the latest time;
[0015] If the precise time protocol time of the next service message is less than or equal to the latest time, ignoring the service message;
[0016] If the precise time protocol time of the next service message is greater than the latest time, retaining the service message and updating the precise time protocol time of the service message to the latest time.
[0017] In a technical solution of the above wireless communication method, the method further includes:
[0018] Responding to a preset operation to reset the latest time of the first data topic;
[0019] Wherein, the preset operation is at least one of successfully receiving all service messages of the first data topic, canceling the subscription of the service messages of the first data topic, and the subscription of the service messages of the first data topic becoming invalid.
[0020] In a technical solution of the above wireless communication method, the service message includes the precise time protocol time and the Coordinated Universal Time when the service message is published; the method further includes:
[0021] Obtaining the precise time protocol time difference between the station-side server and the terminal device according to the precise time protocol time and the Coordinated Universal Time when the service message is published;
[0022] Based on the Precision Time Protocol time difference, implement time synchronization of the Precision Time Protocol time between the terminal device and the station-side server.
[0023] In a technical solution of the above wireless communication method, the obtaining of the Precision Time Protocol time difference between the station-side server and the terminal device includes:
[0024] Obtain the Coordinated Universal Time difference between the terminal device and the Coordinated Universal Time of the station-side server;
[0025] Obtain the first time deviation between the Precision Time Protocol time of the terminal device and the time standard time;
[0026] Obtain the second time deviation between the Precision Time Protocol time of the station-side server and the time standard time;
[0027] Based on the Coordinated Universal Time difference, the first time deviation, and the second time deviation, obtain the Precision Time Protocol time difference.
[0028] In a second aspect, a wireless communication method is provided. The method is applied to a station-side server, and the station-side server is wirelessly communicatively connected to a terminal device through at least two types of wireless communication links. The method includes:
[0029] Based on a preset service requirement, publish service messages of a first data topic to the terminal device through at least two types of wireless communication links; and,
[0030] Based on the service requirement, subscribe to a second data topic through at least two types of wireless communication links; and receive service messages of the second data topic published by the terminal device through at least two types of wireless communication links.
[0031] In a technical solution of the above wireless communication method, the service messages of the second data topic include at least one service message; each service message includes the Precision Time Protocol time when the service message is published;
[0032] The receiving of the service messages of the second data topic published by the terminal device includes:
[0033] For each received service message, use the Precision Time Protocol time of the latest service message retained as the latest time of the second data topic;
[0034] When receiving the next service message of the second data topic, perform duplicate removal on the service message according to the Precision Time Protocol time of the next service message and the latest time, so as to implement the receiving of the service messages of the second data topic.
[0035] In a technical solution of the above wireless communication method, the de-duplication of the service message according to the Precision Time Protocol (PTP) time of the next service message and the latest time includes:
[0036] Comparing the PTP time of the next service message with the latest time;
[0037] If the PTP time of the next service message is less than or equal to the latest time, the service message is ignored;
[0038] If the PTP time of the next service message is greater than the latest time, the service message is retained, and the PTP time of the service message is updated to the latest time.
[0039] In a technical solution of the above wireless communication method, the method further includes:
[0040] Resetting the latest time of the second data topic in response to a preset operation;
[0041] Wherein, the preset operation is at least one of successfully receiving all service messages of the second data topic, canceling the subscription of the service messages of the second data topic, and the subscription of the service messages of the second data topic becoming invalid.
[0042] In a technical solution of the above wireless communication method, the service message includes the PTP time when the service message is published and the Coordinated Universal Time (UTC); the method further includes:
[0043] Obtaining the PTP time difference between the station-side server and the terminal device according to the PTP time when the service message is published and the UTC;
[0044] Implementing time synchronization of the PTP time between the terminal device and the station-side server according to the PTP time difference.
[0045] In a technical solution of the above wireless communication method, the obtaining of the PTP time difference between the station-side server and the terminal device includes:
[0046] Obtaining the UTC difference between the UTCs of the terminal device and the station-side server;
[0047] Obtaining the first time deviation between the PTP time of the terminal device and the time standard time;
[0048] Obtaining the second time deviation between the PTP time of the station-side server and the time standard time;
[0049] Obtain the Precision Time Protocol time difference according to the world standard time difference, the first time deviation, and the second time deviation.
[0050] In a third aspect, a terminal device is provided. The terminal device includes at least one processor; and a memory communicatively connected to the at least one processor; wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any one of the technical solutions of the above wireless communication method is implemented.
[0051] In a fourth aspect, a station-side server is provided. The station-side server includes at least one processor; and a memory communicatively connected to the at least one processor; wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any one of the technical solutions of the above wireless communication method is implemented.
[0052] In a fifth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores multiple program codes, and the program codes are adapted to be loaded and run by a processor to execute the method described in any one of the technical solutions of the above wireless communication method.
[0053] One or more of the above technical solutions of this application have at least one or more of the following beneficial effects:
[0054] In implementing the technical solution of the wireless communication method provided by this application, the terminal device of this application is wirelessly communicatively connected to the station-side server through at least two types of wireless communication links. Based on the preset service requirements, the terminal device subscribes to the first data topic through at least two types of wireless communication links and receives the service messages of the first data topic published by the station-side server; the terminal device can also publish the service messages of the second data topic to the station-side server through at least two types of wireless communication links. Similarly, based on the preset service requirements, the station-side server publishes the service messages of the first data topic to the terminal device through at least two types of wireless communication links; the station-side server can also subscribe to the second data topic through at least two types of wireless communication links and receive the service messages of the second data topic published by the terminal device. Through the above configuration method, this application publishes and subscribes to the first data topic and the second data topic through at least two types of wireless communication links, and can realize effective information resource sharing between the station-side server and the terminal device. At the same time, the station-side server and the terminal device are wirelessly communicatively connected through at least two types of wireless communication links. In the case where one type of wireless communication link is unavailable, it can still ensure the stable publication and subscription of the service messages of the first data topic and the second data topic, and can realize stable information resource sharing between the station-side server and the terminal device.
[0055] Furthermore, this application obtains the precise time protocol time difference between the station-side server and the terminal device through the precise time protocol time and the world standard time of the service message publication; it can accurately obtain the precise time protocol time difference between the station-side server and the terminal device. And, according to the precise time protocol time difference, it realizes the time synchronization of the precise time protocol time between the terminal device and the station-side server, can realize the precise time synchronization between the terminal device and the station-side server, and effectively eliminates the influence of link delay on the service message. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Referring to the accompanying drawings, the disclosure of this application will become easier to understand. It is easy for those skilled in the art to understand that: these drawings are only for illustrative purposes and are not intended to limit the protection scope of this application. Among them:
[0057] Figure 1 is a schematic diagram of the main step flow of the wireless communication method according to an embodiment of this application;
[0058] Figure 2 is a schematic diagram of the main step flow of the terminal device for deduplicating the service messages of the first data topic according to an embodiment of this application;
[0059] Figure 3It is a schematic diagram of the main steps of the time synchronization process of the Precision Time Protocol (PTP) time for the terminal device and the station server according to an embodiment of the present application.
[0060] Figure 4 It is a schematic diagram of the connection relationship between the terminal device and the station server according to an embodiment of the present application. Specific Embodiments
[0061] Some embodiments of the present application will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application and are not intended to limit the protection scope of the present application.
[0062] In the description of the present application, "module" and "processor" may include hardware, software, or a combination of both. A module may include a hardware circuit, various suitable sensors, communication ports, memories, and may also include a software part, such as program code, or a combination of software and hardware. The term "A and / or B" represents all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B" and may include only A, only B, or A and B. The singular terms "a" and "this" may also include the plural form.
[0063] In each embodiment of the present application, the relevant user personal information that may be involved is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy, and necessity, and for a reasonable purpose based on the business scenario, to process the personal information actively provided by the user during the use of the product / service or generated due to the use of the product / service, as well as the personal information obtained with the user's authorization.
[0064] The user personal information processed by the present application will vary depending on the specific product / service scenario. It is subject to the specific scenario of the user's use of the product / service and may involve the user's account information, device information, driving information, vehicle information, or other relevant information. The present application will treat the user's personal information and its processing with a high degree of diligence.
[0065] The present application attaches great importance to the security of user personal information and has taken security protection measures that meet industry standards and are reasonable and feasible to protect the user's information and prevent personal information from being accessed, publicly disclosed, used, modified, damaged, or lost without authorization.
[0066] Some terms involved in the present application will be explained here first.
[0067] A data topic is a channel for data exchange between nodes. A data topic may include one or more business messages.
[0068] The Publisher is responsible for publishing business messages to data topics.
[0069] The Subscriber receives business messages by subscribing to data topics.
[0070] MQTT (Message Queuing Telemetry Transport) is a message protocol based on the publish-subscribe paradigm under the ISO standard.
[0071] The MQTT Broker is an intermediary entity that helps MQTT clients communicate. As a central hub, the MQTT Broker can efficiently manage the information flow between devices and applications. Specifically, the MQTT Broker receives messages published by clients, filters the messages according to topics, and distributes them to subscribers.
[0072] PTP (Precision Time Protocol) is a high-precision protocol used to synchronize the clocks of network devices. It is usually used in local area networks (LANs) and can achieve clock synchronization accuracy at the sub-microsecond level.
[0073] UTC (Universal Time Coordinated) is a time measurement system based on the second of atomic time and is as close as possible to world time in terms of time.
[0074] TLS (Transport Layer Security) is used to provide confidentiality, data integrity, and authenticity between two communicating applications.
[0075] TCP / UDP protocols, TCP (Transport Control Protocol) and UDP (User Datagram Protocol) are the two most important protocols in the transport layer, providing communication reliability at the upper layer for users.
[0076] 4G (the fourth generation of mobile communication technology) is developed on the basis of 3G (the third generation of mobile communication technology), mainly using LTE (Long-Term Evolution) technology, providing higher data transmission rates and lower latency. 5G (the fifth generation of mobile communication technology) is further developed on the basis of 4G, adopting new wireless communication technologies such as millimeter waves and massive MIMO (Multiple Input Multiple Output), greatly improving the transmission rate, spectral efficiency, and network capacity.
[0077] Wi-Fi, also known as "Mobile Hotspot" in Chinese, is a trademark of Wi-Fi Alliance manufacturers for product brand certification and is a wireless local area network communication technology based on the IEEE 802.11 standard.
[0078] V2X (Vehicle to Everything) is a vehicle wireless communication technology aimed at connecting vehicles to other things to achieve information exchange.
[0079] The Clockdiff tool is a tool used to measure the clock offset and delay between two hosts. It calculates the network delay by comparing the timestamps between two systems. The working principle of the Clockdiff tool is to send a UDP packet to the target system. The target system immediately returns the packet after receiving it and includes the current timestamp of its system clock in the packet. The Clockdiff command records the timestamps of sending and receiving the packet and calculates the difference between the two timestamps to obtain the clock offset.
[0080] See the appendix Figure 1 , Figure 1 is a schematic diagram of the main steps of a wireless communication method according to an embodiment of the present application. As Figure 1 shown, the wireless communication method in the embodiment of the present application mainly includes the following steps S101 to step S106.
[0081] Step S101: Based on a preset service requirement, the terminal device subscribes to a first data topic through at least two types of wireless communication links. Among them, the station-side server and the terminal device are wirelessly connected through at least two types of wireless communication links.
[0082] In this embodiment, based on a preset service requirement, the terminal device can subscribe to a first data topic through a wireless communication link. Among them, the first data topic refers to the data topic published by the station-side server related to the service requirement and subscribed to by the terminal device.
[0083] In one implementation, the types of wireless communication links can be wireless communication links based on Wi-Fi, wireless communication links based on mobile communication technologies (such as 4G, 5G), wireless communication links based on V2X, etc.
[0084] In one implementation, the station-side server can be a server set in places such as battery swapping stations and parking lots. The terminal device can be devices such as vehicles, smartphones, and tablets. The service requirement can be a battery swapping requirement, a parking requirement, etc.
[0085] In one embodiment, different data topics can be divided according to specific business requirements, and each data topic can include one or more business messages.
[0086] In one embodiment, the subscription of the first data topic can be implemented by subscribing to messages, and the subscription message can include the device identifier of the terminal device.
[0087] Step S102: The station-side server publishes the business messages of the first data topic to the terminal device through at least two types of wireless communication links.
[0088] In this embodiment, the station-side server publishes the business messages of the first data topic.
[0089] Step S103: The terminal device receives the business messages of the first data topic published by the station-side server through at least two types of wireless communication links.
[0090] In this embodiment, the terminal device can receive the business messages of the first data topic published by the station-side server through at least two types of wireless communication links.
[0091] Step S104: Based on the preset business requirements, the station-side server subscribes to the second data topic through at least two types of wireless communication links.
[0092] In this embodiment, the station-side server can subscribe to the second data topic through at least two types of wireless communication links. The second data topic refers to the data topic related to the business requirements, published by the terminal device, and subscribed to by the station-side server.
[0093] Step S105: The terminal device publishes the business messages of the second data topic to the station-side server through at least two types of wireless communication links.
[0094] In this embodiment, the terminal device can publish the business messages of the second data topic to the station-side server through at least two types of wireless communication links.
[0095] Step S106: The station-side server receives the business messages of the second data topic published by the terminal device through at least two types of wireless communication links.
[0096] In this embodiment, the station-side server can receive the business messages of the second data topic published by the terminal device through at least two types of wireless communication links.
[0097] In one embodiment, the wireless communication link may include a first wireless link and a second wireless link; the first wireless link may establish a direct wireless communication connection between the terminal device and the station-side server; the second wireless link may establish a wireless communication connection between the terminal device and the station-side server based on the cloud server.
[0098] For the first wireless link, the subscription message of the first data topic subscribed by the terminal device through the first wireless link may include the device identifier of the terminal device, and the station-side server may perform matching of the first data topic according to the device identifier, so as to obtain the service message of the first data topic, and send the service message of the first data topic to the terminal device based on the first wireless link.
[0099] For the second wireless link, the station-side server may publish the service message of the first data topic to the cloud server, and the terminal device may subscribe to the service message of the first data topic from the cloud server. The terminal device may publish the service message of the second data topic to the cloud server, and the station-side server may subscribe to the service message of the second data topic from the cloud server.
[0100] Taking the terminal device subscribing to the service message of the first data topic from the cloud server as an example, the process of publishing and subscribing service messages based on the second wireless link is described as follows:
[0101] Since the second wireless link needs to perform one-to-one transfer of service messages through the cloud server, the station-side server may send the published service message of the first data topic to the cloud server, and the service message sent to the cloud server may have the following encapsulation format:
[0102] 1. string buzz_msg saves the serialized content of the service message
[0103] 2. string source_id The device identifier of the service message sender (publisher)
[0104] 3. string target_id The device identifier of the service message receiver (subscriber)
[0105] When the cloud server receives the subscription message for subscribing to the first data topic of the terminal device, it may obtain the device identifier of the terminal device according to the subscription message. When the cloud server receives the service message of the first data topic published by the station-side server, it may match the device identifier of the receiver in the encapsulation format of the service message with the device identifier of the terminal device. If the match is successful, the service message may be sent to the terminal device.
[0106] It should be noted that the process by which the station-side server subscribes to the service messages of the second data topic from the cloud server is similar to the process by which the terminal device subscribes to the service messages of the first data topic from the cloud server. For simplicity of description, it will not be elaborated here.
[0107] Based on the method described in the above steps S101 to S106, the terminal device and the station-side server of the embodiment of the present application are wirelessly communicatively connected through at least two types of wireless communication links. The terminal device subscribes to the service messages of the first data topic through at least two types of wireless communication links based on a preset service requirement, and receives the service messages of the first data topic published by the station-side server; the terminal device can also publish the service messages of the second data topic to the station-side server through at least two types of wireless communication links. Similarly, based on a preset service requirement, the station-side server publishes the service messages of the first data topic to the terminal device through at least two types of wireless communication links; the station-side server can also subscribe to the service messages of the second data topic through at least two types of wireless communication links and receive the service messages of the second data topic published by the terminal device. Through the above configuration method, the embodiment of the present application publishes and subscribes to the service messages of the first data topic and the second data topic through at least two types of wireless communication links, and can realize effective information resource sharing between the station-side server and the terminal device. At the same time, the station-side server and the terminal device are wirelessly communicatively connected through at least two types of wireless communication links. In the case where one type of wireless communication link is unavailable, it can still ensure the stable publication and subscription of the service messages of the first data topic and the second data topic, and can realize stable information resource sharing between the station-side server and the terminal device.
[0108] In an implementation manner of the embodiment of the present application, each service message includes the precise time protocol time when the service message is published. Reference can be made to the appendix Figure 2 , Figure 2 is a schematic diagram of the main step process for the terminal device to deduplicate the service messages of the first data topic according to an implementation manner of the embodiment of the present application. As Figure 2 shown, the terminal device can deduplicate the service messages of the first data topic according to the following steps S201 to S202:
[0109] Step S201: For each received service message, use the precise time protocol time of the latest service message retained as the latest time of the first data topic.
[0110] In this embodiment, since the terminal device receives service messages of the first data topic through at least two types of wireless communication links, the service messages sent on each wireless communication link are the same, but the arrival times at the terminal device are different. Then, it is necessary to filter out the later-arriving and duplicate service messages, that is, to deduplicate the service messages, to avoid the situation of status rollback and disordered timing logic of the service messages of the first data topic received by the terminal device. For example, the station-side server publishes service messages M1, M2, and M3 of the first data topic at three time points T1, T2, and T3 respectively. After the terminal device receives all the service messages through the Wi-Fi-based wireless communication link, it receives the service message M1 sent through the 4G / 5G-based wireless communication link. At this time, it is necessary to filter out M1 from the 4G / 5G wireless communication link to avoid the problems of status rollback and disordered timing logic of the terminal device. Therefore, for the first data topic, the terminal device can set the latest time of the first data topic, and use the precise time protocol time (publish_ptp_ts) when the latest service message received and retained by the terminal device is published as the latest time (latest_ts) of the first data topic.
[0111] Step S202: When receiving the next service message of the first data topic, deduplicate the service message according to the precise time protocol time and the latest time of the next service message, so as to realize the reception of the service message of the first data topic.
[0112] In this embodiment, step S202 may further include the following steps S2021 to S2023:
[0113] Step S2021: Compare the precise time protocol time of the next service message with the latest time.
[0114] Step S2022: If the precise time protocol time of the next service message is less than or equal to the latest time, ignore the service message.
[0115] Step S2023: If the precise time protocol time of the next service message is greater than the latest time, retain the service message and update the precise time protocol time of the service message to the latest time.
[0116] Specifically, when the terminal device receives the next service message of the first data topic, it can compare the precise time protocol time (publish_ptp_ts) at the time of publishing of the next service message with the latest time (latest_ts). If publish_ptp_ts is less than or equal to latest_ts, it means that the next service message is a duplicate service message, and then the service message can be ignored. If publish_ptp_ts is greater than latest_ts, the service message can be retained, and the publish_ptp_ts of the service message is updated to latest_ts. In this way, the situation where the terminal device receives duplicate service messages of the first data topic can be effectively avoided.
[0117] In one embodiment, the terminal device can reset the latest time of the first data topic in response to a preset operation. Among them, the preset operation can be at least one of successfully receiving all service messages of the first data topic, canceling the subscription of the service messages of the first data topic, and the invalidation of the subscription of the service messages of the first data topic. Of course, those skilled in the art can also define the preset operation according to the actual application needs.
[0118] In one embodiment of the embodiments of the present application, the station-side server can deduplicate the service messages of the second data topic according to the following steps S301 to step S302:
[0119] Step S301: For each received service message, use the precise time protocol time of the latest retained service message as the latest time of the second data topic.
[0120] Step S302: When receiving the next service message of the second data topic, deduplicate the service messages according to the precise time protocol time of the next service message and the latest time to realize the reception of the service messages of the second data topic.
[0121] In this embodiment, step S302 can further include the following steps S3021 to step S3023:
[0122] Step S3021: Compare the precise time protocol time of the next service message with the latest time.
[0123] Step S3022: If the precise time protocol time of the next service message is less than or equal to the latest time, ignore the service message.
[0124] Step S3023: If the precise time protocol time of the next service message is greater than the latest time, retain the service message and update the precise time protocol time of the service message to the latest time.
[0125] In one embodiment, the station-side server may reset the latest time of the second data topic in response to a preset operation. The preset operation may be at least one of successfully receiving all service messages of the second data topic, cancellation of the subscription to the service messages of the second data topic, and expiration of the subscription to the service messages of the second data topic. Of course, those skilled in the art can also define the preset operation according to the actual application needs.
[0126] It should be noted that the method for deduplicating the service messages of the second data topic by the station-side server is similar to the method for deduplicating the service messages of the first data topic by the terminal device. For the sake of simplicity of description, it will not be elaborated here.
[0127] In one embodiment of the embodiments of the present application, the service messages may be transmitted based on the Message Queuing Telemetry Transport (MQTT) protocol.
[0128] In other embodiments of the embodiments of the present application, the service messages may also be transmitted based on other custom application layer protocols based on TCP / UDP.
[0129] In one embodiment of the embodiments of the present application, reference may be made to the attached Figure 3 , Figure 3 is a schematic diagram of the main steps of the time synchronization process of the Precision Time Protocol (PTP) time for the terminal device and the station-side server according to one embodiment of the embodiments of the present application. As Figure 3 shown, the service messages may include the PTP time and the Coordinated Universal Time (UTC) at which the service messages are published. The time synchronization process of the PTP time for the terminal device and the station-side server may include the following steps S401 and S402:
[0130] Step S401: Obtain the PTP time difference between the station-side server and the terminal device according to the PTP time and the UTC at which the service messages are published.
[0131] In this embodiment, step S401 may further include the following steps S4011 to S4014:
[0132] Step S4011: Obtain the UTC difference between the UTCs of the terminal device and the station-side server.
[0133] Step S4012: Obtain the first time deviation between the PTP time of the terminal device and the UTC.
[0134] Step S4013: Obtain the second time deviation between the PTP time of the station-side server and the UTC.
[0135] Step S4014: Obtain the Precision Time Protocol time difference based on the world standard time difference, the first time deviation, and the second time deviation
[0136] In this embodiment, the time synchronization between the terminal device and the station server can be achieved by calculating the Precision Time Protocol time difference between the terminal device and the station server.
[0137] Specifically, taking the calculation of the Precision Time Protocol time difference on the station server side as an example, after establishing a wireless communication connection between the terminal device and the station server (for example, establishing a wireless communication connection through a Wi-Fi-based wireless communication link), the terminal device can use the clockdiff tool to obtain the world standard time difference between the terminal device and the station server. Among them, the world standard time difference can be obtained according to the following formula (1):
[0138] (1)
[0139] Among them, is the world standard time difference, is the world standard time of the station server, is the world standard time of the terminal device.
[0140] The terminal device can calculate the first time deviation between the Precision Time Protocol time of the terminal device and the time standard time according to the following formula (2).
[0141] (2)
[0142] Among them, is the first time deviation, is the Precision Time Protocol time of the terminal device.
[0143] The terminal device can send the world standard time difference and the first time deviation , to the station server through the time synchronization message. The station server can calculate the second time deviation between the Precision Time Protocol time of the station server and the time standard time according to the following formula (3).
[0144] (3)
[0145] Among them, is the second time deviation, is the Precision Time Protocol time of the station server.
[0146] The precise time protocol time difference can be obtained according to the world standard time difference, the first time deviation, and the second time deviation, using the following formula (4):
[0147] (4)
[0148] where is the precise time protocol time difference.
[0149] Step S402: Implement time synchronization of the precise time protocol time between the terminal device and the station-side server according to the precise time protocol time difference.
[0150] In this embodiment, the precise time protocol time of the local end when the peer end sends the current service message can be calculated according to the calculated precise time protocol time difference; or the current precise time protocol time of the peer end can be calculated according to the calculated precise time protocol time difference and the precise time protocol time of the local end. Among them, the terminal device and the station-side server are peer ends to each other.
[0151] Taking the server of the battery swapping station as the station-side server, the vehicle end and the mobile phone end as the terminal devices, the first wireless link as the wireless communication link based on Wi-Fi, and the second wireless link as the wireless communication link based on 4G / 5G as an example, the wireless communication method of the embodiments of the present application is applied to controlling the battery swapping vehicle based on the battery swapping station to realize the parking in and out of the battery swapping vehicle. For example, in combination with the attached Figure 4 , the wireless communication method of the embodiments of the present application will be described.
[0152] Refer to the attached Figure 4 , Figure 4 is a schematic diagram of the connection relationship between the terminal device and the station-side server according to an embodiment of the present application. As Figure 4 shown, the MQTT Client is deployed on the mobile phone end and the vehicle end respectively, the MQTT Broker is deployed on the cloud server and the station-side server respectively, the vehicle end is connected to the station-side server through the wireless communication link based on Wi-Fi, the vehicle end is connected to the cloud server through the wireless communication link based on 4G / 5G, the mobile phone end is connected to the station-side server through the wireless communication link based on Wi-Fi, and the station-side server is connected to the cloud server through the wireless communication link based on 4G / 5G.
[0153] To avoid increasing the load on the cloud server and causing traffic waste, for the vehicle side and the mobile phone side, the wireless communication link based on 4G / 5G can be established when needed. The premise for establishing the wireless communication link based on Wi-Fi is that the vehicle side or the mobile phone side enters the Wi-Fi coverage area of the battery swapping station. The connection of the two types of wireless communication links can be triggered when queuing for a battery swapping order, and the connection of the two types of wireless communication links can be disconnected when the battery swapping order is cancelled, the queuing number is exceeded, or during the battery swapping process.
[0154] For the station side, the wireless communication link based on Wi-Fi and the wireless communication link based on 4G / 5G need to maintain a long connection, so as to always be active as the server side and seamlessly serve different battery swapping vehicles.
[0155] After the vehicle side or the mobile phone side cancels the battery swapping order, the queuing number of the battery swapping order is exceeded, or after parking in the battery swapping station is completed, it is necessary to notify the station side server so that it no longer sends service messages to the vehicle side or the mobile phone side, to avoid wasting the traffic of the station side server, and also to avoid the situation where after the vehicle fails to park, it places an order at other battery swapping stations, causing interference between the service messages of the two battery swapping stations.
[0156] The data topics can be divided according to the specific business requirements of the battery swapping parking service, so as to publish and subscribe to service messages according to different data topics.
[0157] After the vehicle side or the mobile phone side establishes a wireless communication connection with the station side server and the cloud server, the MQTT Client of the vehicle side and the mobile phone side, carrying the TLS communication security certificate, publishes and subscribes to service messages of different data topics with the MQTT Broker of the station side, so as to transmit the positioning data and planning control data obtained by the station side to the vehicle side or the mobile phone side, and transmit the status information of the vehicle side (such as vehicle speed, vehicle running status, etc.) to the station side, so as to achieve low-latency information resource sharing between the vehicle side and the station side, and further achieve a stable and efficient data transmission link between the vehicle side and the station side, so as to realize the parking in and out of the battery swapping vehicle controlled by the station side, and be able to effectively utilize the characteristics of the station side sensor with a better perspective to realize the parking of the battery swapping vehicle in a complex scenario, and at the same time be able to meet the parking needs of the battery swapping vehicle without radar, camera or insufficient computing power.
[0158] For the cloud server, when the scale of the vehicle side and the station side continues to grow and the amount of service messages processed is relatively large, the sending frequency of service messages can be reduced.
[0159] For the mobile phone side, due to its limited computing and storage resources, a lower sending frequency can also be set during the wireless communication process with the station side, and the data volume of service messages should not be too large.
[0160] It should be noted that although the above embodiments describe the various steps in a specific order, those skilled in the art can understand that in order to achieve the effects of this application, it is not necessary to execute the different steps in such an order. They can be executed simultaneously (in parallel) or in other orders. These adjusted solutions are equivalent technical solutions to the technical solutions described in this application, and therefore will also fall within the protection scope of this application.
[0161] Those skilled in the art can understand that all or part of the processes in the method of the above-mentioned embodiment of this application can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable storage medium can include: any entity or device, medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal, and software distribution medium that can carry the computer program code.
[0162] On the other hand, this application also provides a computer-readable storage medium.
[0163] In an embodiment of a computer-readable storage medium according to this application, the computer-readable storage medium can be configured to store a program for executing the wireless communication method of the above-mentioned method embodiment. This program can be loaded and run by a processor to implement the above-mentioned wireless communication method. For the sake of convenience of description, only the parts related to the embodiments of this application are shown. For the specific technical details not disclosed, please refer to the method part of the embodiments of this application. The computer-readable storage medium can be a storage device formed by various electronic devices, such as magnetic disks, hard disks, optical discs, flash memories, read-only memories, random access memories, etc. Optionally, the computer-readable storage medium in the embodiments of this application is a non-transitory computer-readable storage medium.
[0164] On the other hand, this application also provides a terminal device.
[0165] In an embodiment of a terminal device according to the present application, the terminal device may include at least one processor; and a memory communicatively connected to the at least one processor; wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any of the above embodiments is implemented. The terminal device described in the present application may include a driving device, a smart vehicle, a robot, a mobile phone, a tablet computer, a desktop type, a laptop, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device, etc.
[0166] In some embodiments of the present application, the terminal device may further include at least one sensor for sensing information. The sensor is communicatively connected to any type of processor mentioned in the present application. Optionally, the terminal device may further include an autonomous driving system for guiding the terminal device to drive itself or assist in driving. The processor communicates with the sensor and / or the autonomous driving system and is used to implement the method described in any of the above embodiments. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, in hardware, or in a combination of both.
[0167] On the other hand, the present application also provides a station-side server.
[0168] In an embodiment of a station-side server according to the present application, the station-side server may include at least one processor; and a memory communicatively connected to the at least one processor; wherein, a computer program is stored in the memory, and when the computer program is executed by the at least one processor, the method described in any of the above embodiments is implemented.
[0169] So far, the technical solution of the present application has been described in conjunction with an embodiment shown in the accompanying drawings. However, those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Without departing from the principle of the present application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the protection scope of the present application.
Claims
1. A wireless communication method, characterized in that: The method is applied to a terminal device, wherein the terminal device is wirelessly connected to a station-side server via at least two types of wireless communication links; the method comprises: Based on preset business requirements, subscribing to a first data topic through at least two types of wireless communication links; and receiving business messages of the first data topic published by the station-side server through at least two types of wireless communication links; and Based on the business demand, publishing a business message of a second data topic to the station-side server through at least two types of wireless communication links; The service message includes the precise time protocol time and the world standard time of the service message; the method further includes: According to the precise time protocol time and the world standard time published by the service message, obtaining the world standard time difference between the world standard time of the terminal device and the world standard time of the station server; obtaining the first time deviation between the precise time protocol time of the terminal device and the world standard time; obtaining the second time deviation between the precise time protocol time of the station server and the world standard time; Acquire a precise time protocol time difference between the terminal device and the station server according to the world standard time difference, the first time deviation and the second time deviation; According to the precision time protocol time difference, time synchronization of the precision time protocol between the terminal device and the station-side server is achieved.
2. The wireless communication method according to claim 1, characterized in that: The service message of the first data subject includes at least one service message; each of the service messages includes the precise time protocol time at which the service message is published; The receiving, through at least two types of wireless communication links, a service message of the first data topic published by the station-side server comprises: For each of the received service messages, retaining the precise time protocol time of the latest service message as the latest time of the first data subject; When the next service message of the first data subject is received, the service message is deduplicated according to the precise time protocol time of the next service message and the latest time to achieve reception of the service message of the first data subject.
3. The wireless communication method according to claim 2, characterized in that: Deduplication of the service message according to the precise time protocol time of the next service message and the latest time includes: Comparing the precise time agreement time of the next service message with the latest time; If the precise time agreement time of the next service message is less than or equal to the latest time, the service message is ignored; If the precise time protocol time of the next service message is greater than the latest time, the service message is retained, and the precise time protocol time of the service message is updated to the latest time.
4. The wireless communication method according to claim 2, characterized in that: The method further comprises: In response to a preset operation, resetting the latest time of the first data subject; Among them, the preset operation is at least one of successfully receiving all business messages of the first data topic, canceling the subscription to the business messages of the first data topic, and invalidating the subscription to the business messages of the first data topic.
5. A wireless communication method, characterized in that: The method is applied to a station-side server, wherein the station-side server is wirelessly connected to a terminal device via at least two types of wireless communication links; the method comprises: Based on preset business requirements, publishing business messages of the first data topic to the terminal device through at least two types of wireless communication links; and Based on the service demand, subscribing to a second data topic through at least two types of wireless communication links; and receiving a service message of the second data topic published by the terminal device through at least two types of wireless communication links; The service message includes the precise time protocol time and the world standard time of the service message; the method further includes: According to the precise time protocol time and the world standard time published by the service message, obtaining the world standard time difference between the world standard time of the terminal device and the world standard time of the station server; obtaining the first time deviation between the precise time protocol time of the terminal device and the world standard time; obtaining the second time deviation between the precise time protocol time of the station server and the world standard time; Acquire a precise time protocol time difference between the terminal device and the station server according to the world standard time difference, the first time deviation and the second time deviation; According to the precision time protocol time difference, time synchronization of the precision time protocol between the terminal device and the station-side server is achieved.
6. The wireless communication method according to claim 5, characterized in that: The service message of the second data subject includes at least one service message; each of the service messages includes the precise time protocol time when the service message is released; The receiving a service message of the second data topic published by the terminal device includes: For each of the received service messages, retaining the precise time protocol time of the latest service message as the latest time of the second data subject; When the next business message of the second data subject is received, the business message is deduplicated according to the precise time protocol time of the next business message and the latest time to achieve reception of the business message of the second data subject.
7. The wireless communication method according to claim 6, characterized in that: Deduplication of the service message according to the precise time protocol time of the next service message and the latest time includes: Comparing the precise time agreement time of the next service message with the latest time; If the precise time agreement time of the next service message is less than or equal to the latest time, the service message is ignored; If the precise time protocol time of the next service message is greater than the latest time, the service message is retained, and the precise time protocol time of the service message is updated to the latest time.
8. The wireless communication method according to claim 6, characterized in that: The method further comprises: In response to a preset operation, resetting the latest time of the second data subject; Among them, the preset operation is at least one of successfully receiving all business messages of the second data topic, canceling the subscription to the business messages of the second data topic, and invalidating the subscription to the business messages of the second data topic.
9. A terminal device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores a computer program, and when the computer program is executed by the at least one processor, the wireless communication method according to any one of claims 1 to 4 is implemented.
10. A station-side server, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores a computer program, and when the computer program is executed by the at least one processor, the wireless communication method according to any one of claims 5 to 8 is implemented.
11. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and executed by a processor to execute the wireless communication method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Information acquisition method, device and system, readable storage medium and electronic equipment
CN111131358A
Alarm information processing method and device and electronic equipment
CN113077615A
Vehicle state monitoring system, monitoring method, equipment and storage medium
CN116233793A