Bluetooth-based Time Synchronization Method, Readable Medium, and Electronic Device
By employing a method with N time synchronization sub-processes to determine M effective sub-time offsets, the method improves the accuracy of Bluetooth-based time synchronization and distance measurement between electronic devices.
Patent Information
- Application Number
- JP2024573579
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-06-15
- Filing Date
- 2023-06-13
- Publication Date
- 2025-07-15
AI Technical Summary
Existing Bluetooth-based time synchronization methods for electronic devices suffer from inaccuracies in distance measurement due to high dispersion of sub-time offsets, which affect the accuracy of distance measurement between devices.
A method involving N sequentially executed time synchronization sub-processes with M effective sub-time offsets is used to determine the comprehensive time offset between electronic devices, where N ≥ M, reducing the dispersion of sub-time offsets to improve accuracy.
This approach enhances the accuracy of time synchronization and subsequent distance measurement by minimizing the dispersion of sub-time offsets, leading to more precise distance calculations.
Smart Images

Figure 2025522444000001_ABST
Abstract
Description
Technical Field
[0001] [Related Application] This application claims priority to Chinese Patent Application No. 202210681347.1, filed with the China National Intellectual Property Administration on June 15, 2022, and entitled "BLUETOOTH BASED TIME SYNCHRONIZATION METHOD, READABLE MEDIUM, AND ELECTRONIC DEVICE", which is incorporated herein by reference in its entirety. [Technical Field] The present invention relates to the field of communication technologies, and in particular, to a Bluetooth-based time synchronization method, a readable medium, and an electronic device.
Background Art
[0002] Distance is an important parameter that needs to be detected in different scenarios and controls. For example, when one electronic device is used to search for another electronic device, the distance and included angle between the two electronic devices are accurately measured using Ultra-wideband (UWB) technology, and in order to perform an accurate search for the other electronic device, the user is notified of the specific distance and direction from the other electronic device being searched. However, in the "Bluetooth + ultrasonic" joint distance measurement solution, in order to improve the accuracy of distance measurement between two electronic devices, before measuring the distance, it is further necessary to perform Bluetooth-based time synchronization between the two electronic devices and determine the comprehensive time offset between the two electronic devices (i.e., the offset value between the clock times of the two electronic devices).
Summary of the Invention
[0003] To improve the accuracy of the included time offset, the present application provides a Bluetooth-based time synchronization method. The Bluetooth-based time synchronization is performed between a first electronic device and a second electronic device. The Bluetooth-based time synchronization includes N time synchronization sub-processes that are sequentially executed, and each time synchronization sub-process has one round-trip time. In the process of the first electronic device and the second electronic device performing Bluetooth-based time synchronization, the first electronic device obtains M effective sub-time offsets corresponding to M time synchronization sub-processes based on the N round-trip times of the N time synchronization sub-processes, where N≥M. It can be seen that the above-mentioned M time synchronization sub-processes are M time synchronization sub-processes among the above-mentioned N time synchronization sub-processes. The first electronic device determines the included time offset between the first electronic device and the second electronic device based on the M effective sub-time offsets.
[0004] In the above Bluetooth-based time synchronization method, in the process of performing Bluetooth-based time synchronization including N time synchronization sub-processes that are sequentially executed, the M effective sub-time offsets corresponding to the M time synchronization sub-processes are obtained based on the round-trip time of the time synchronization sub-process, and the dispersion of the M effective sub-time offsets is low. It can be easily seen that the accuracy of the included time offset between the first electronic device and the second electronic device in the short-period Bluetooth-based time synchronization process can be effectively improved by reducing the dispersion of the sub-time offsets used to calculate the included time offset. Furthermore, when the Bluetooth-based time synchronization method is applied to distance measurement, the accuracy of the distance measurement between the first electronic device and the second electronic device can be improved.
[0005] The first aspect of this application provides a Bluetooth-based time synchronization method applicable to a first electronic device and a second electronic device. The Bluetooth-based time synchronization method includes steps for the first electronic device to perform Bluetooth-based time synchronization with the second electronic device. The Bluetooth-based time synchronization includes N sequentially executed time synchronization sub-processes, and each time synchronization sub-process has one round-trip time and one initial sub-time offset. In the process of performing Bluetooth-based time synchronization, the first electronic device obtains M effective sub-time offsets corresponding to M time synchronization sub-processes based on the N round-trip times and N initial sub-time offsets of the N time synchronization sub-processes, where M ≤ N, and the M time synchronization sub-processes are M of the N time synchronization sub-processes. The first electronic device obtains the time offset between the first electronic device and the second electronic device based on the M effective sub-time offsets.
[0006] The first electronic device may be any portable and mobile electronic device such as a mobile phone, a watch, a tablet computer, a notebook computer, a laptop computer, a wearable device, a head-mounted display, a portable game console, a portable music player, or a reader device. The second electronic device may be any portable and mobile electronic device such as an electronic tag (Tag) device, a mobile phone, a watch, a tablet computer, a notebook computer, a laptop computer, a wearable device, a head-mounted display, a portable game console, a portable music player, a reader device, or a stylus. For ease of explanation and understanding, hereinafter, an example where the first electronic device is a mobile phone and the second electronic device is a tag device is used.
[0007] The Bluetooth-based time synchronization process between the mobile phone and the tag device includes a plurality of time synchronization sub-processes. The Bluetooth-based time synchronization process represents the entire transmission process of Bluetooth signals between the mobile phone and the tag device in the overall Bluetooth-based time synchronization solution. The time synchronization sub-process represents the transmission period of Bluetooth signals between the mobile phone and the tag device. The time synchronization sub-process is a constituent unit of the Bluetooth-based time synchronization process. As is understood, in the Bluetooth-based time synchronization method, the mobile phone calculates an initial sub-time offset corresponding to each time synchronization sub-process, and then, based on the initial sub-time offsets corresponding to all time synchronization sub-processes, can obtain an overall time offset between the mobile phone and the tag device.
[0008] The initial sub-time offset represents an offset value between the clock time of the mobile phone and the clock time of the tag device obtained by the mobile phone based on the time synchronization sub-process in the Bluetooth-based time synchronization process. The round-trip time represents the round-trip time of a group of messages exchanged in the time synchronization process.
[0009] The effective sub-time offset represents a sub-time offset obtained by processing the initial sub-time offset in the mobile phone. It is easily understood that the effective sub-time offset is the sub-time offset obtained by processing in the mobile phone. Therefore, the effective sub-time offset is closer to the overall time offset of the long-period Bluetooth-based time synchronization process than the initial sub-time offset. The overall time offset represents an offset value between the clock value of the first electronic device and the clock value of the second electronic device determined based on the entire Bluetooth-based time synchronization process.
[0010] That is, in this embodiment of the present application, a Bluetooth-based time synchronization process including N time synchronization sub-processes is executed between the mobile phone and the tag device. In the process of executing N time synchronization sub-processes between the mobile phone and the tag device, the mobile phone may determine an initial sub-time offset corresponding to each time synchronization sub-process based on the Bluetooth signal corresponding to each time synchronization sub-process. The mobile phone determines whether each time synchronization sub-process meets the preset adjustment condition, and based on the determination result, different processes are executed on the initial sub-time offset corresponding to each time synchronization sub-process. For example, when it is determined that the time synchronization sub-process meets the preset adjustment condition, the mobile phone adjusts (for example, corrects and / or deletes) the initial sub-time offset corresponding to the time synchronization sub-process. As another example, when it is determined that the time synchronization sub-process does not meet the preset adjustment condition, the mobile phone reserves the initial sub-time offset corresponding to the time synchronization sub-process. Finally, the mobile phone can obtain M effective sub-time offsets corresponding to M time synchronization sub-processes based on the N initial sub-time offsets corresponding to the N time synchronization sub-processes, where N≥M, and the N time synchronization sub-processes include the M time synchronization sub-processes. The mobile phone determines the overall time offset between the mobile phone and the tag device based on the M effective sub-time offsets corresponding to the M time synchronization sub-processes.
[0011] In some possible implementations, Bluetooth-based time synchronization includes N time synchronization sub-processes that are executed sequentially. Each time synchronization sub-process corresponds to a start time synchronization frame (which can be understood as the first transmission signal in the time synchronization sub-process). The start time synchronization frames of the N time synchronization sub-processes are executed sequentially. For example, in Bluetooth-based time synchronization, in the N time synchronization sub-processes, after the previous time synchronization sub-process is completed, the subsequent time synchronization sub-process is executed. In another example, in the N time synchronization sub-processes, the previous time synchronization sub-process is executed, but the subsequent time synchronization sub-process is executed before the previous time synchronization sub-process is completed. This is not specifically limited in this application.
[0012] In the above Bluetooth-based time synchronization method, in the process of executing Bluetooth-based time synchronization including N time synchronization sub-processes that are executed sequentially, M effective sub-time offsets corresponding to the M time synchronization sub-processes are obtained based on the round-trip time of the time synchronization sub-processes, and the dispersion of the M effective sub-time offsets is low. It can be easily understood that the accuracy of the comprehensive time offset between the first electronic device and the second electronic device in the short-period Bluetooth-based time synchronization process can be effectively improved by reducing the dispersion of the sub-time offsets used to calculate the comprehensive time offset.
[0013] In some possible implementations of the first aspect, in the Bluetooth-based time synchronization method, the first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process is a step of receiving, by the first electronic device, a time synchronization frame transmitted by the second electronic device, where the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the second electronic device, and the instruction may be an instruction frame, A step in which a first electronic device transmits a confirmation response message to a second electronic device in response to a time synchronization frame, where the confirmation response message is transmitted by a confirmation transmitted by the Bluetooth module of the first electronic device, and the confirmation can be a confirmation frame, T LPi =T Ei -T TXi , where T LPi is the round-trip time of the first time synchronization subprocess, and T Ei is the time point when the second electronic device receives the confirmation response message, and T TXi is the time point when the second electronic device transmits the time synchronization frame, and the step includes.
[0014] The time synchronization frame represents a Bluetooth signal used to perform time synchronization between two electronic devices. The confirmation response message refers to a spontaneous message of the electronic device that responds to the time synchronization frame in the Bluetooth protocol layer, and the spontaneous message is not a message actively transmitted by the upper-layer application of the electronic device. For example, the confirmation response message refers to a spontaneous message of the tag device that responds to the time synchronization frame in the Bluetooth protocol layer, and the spontaneous message is not a message actively transmitted by the upper-layer application of the tag device.
[0015] Specifically, in this embodiment of the present application, in one of the time synchronization sub - processes, the tag device transmits a time synchronization frame to the mobile phone, and the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the tag device. After receiving the time synchronization frame, the mobile phone feeds back a confirmation response message to the tag device in response to the time synchronization frame, and the confirmation response message is transmitted according to a confirmation transmitted by the Bluetooth module of the mobile phone. The mobile phone does not need to transmit a time synchronization frame or a response frame to the tag device. The round - trip time may be expressed as the period between the time point when the tag device receives the confirmation response message and the time point when the tag device transmits the time synchronization frame.
[0016] The above Bluetooth - based time synchronization method is one - way time synchronization, has a shorter time synchronization period, is more suitable for real - time applications, saves time, and improves practicability. Also, by adjusting the initial sub - time offset, abnormal sub - time offsets in the time synchronization sub - process are reduced, and the accuracy and stability of the overall time offset are improved. When the overall time offset is used for distance calculation, the distance measurement accuracy can be improved.
[0017] In some possible implementations of the first aspect, in the Bluetooth - based time synchronization method, the time synchronization frame includes T TXi and T Ei-1 where T TXi is the time synchronization transmission time point when the second electronic device transmits the time synchronization frame, and T Ei-1 is the confirmation response reception time point when the second electronic device receives the previous confirmation response message before the confirmation response message.
[0018] Specifically, in this embodiment of the present application, the time synchronization frame corresponding to the i - th time synchronization sub - process includes the time synchronization transmission time point T TXi of the time synchronization frame in the i - th time synchronization sub - process and the confirmation response reception time point T when the tag device receives the previous confirmation response messageEi-1 including T Ei-1 may be the time point when the acknowledgment response message in the (i - 1)-th time synchronization sub-process is received.
[0019] However, it should be noted that in the first time synchronization sub-process, there is no time point for receiving the acknowledgment response of the previous acknowledgment response message. Therefore, the time synchronization frame in the first time synchronization sub-process is the time synchronization transmission time point T of the time synchronization frame in the first time synchronization sub-process TX1 including T and any value. For example, the value may be 0. In the last time synchronization sub-process, the time point when the acknowledgment response message in the sub-process is received may be transmitted to the mobile phone using a subsequent independent frame. Alternatively, the last time synchronization sub-process is deleted. Specifically, in Bluetooth-based time synchronization including N + 1 time synchronization sub-processes, N time synchronization sub-processes can be actually used.
[0020] In some possible implementations of the first aspect, in the Bluetooth-based time synchronization method, the initial sub-time offset is as follows:
Number
Number
[0021] It should be understood that the initial sub-time offset in this application can be calculated by any one of the four aforementioned calculation methods. This is not specifically limited in this application.
[0022] In some possible implementations of the first aspect, in a Bluetooth-based time synchronization method, the first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process includes: a step of transmitting a time synchronization frame from the first electronic device to the second electronic device, where the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the first electronic device; a step of receiving, by the first electronic device, a confirmation response message transmitted by the second electronic device in response to the time synchronization frame, where the confirmation response message is transmitted by a confirmation transmitted by the Bluetooth module of the second electronic device; a step of receiving, by the first electronic device, a response frame transmitted by the second electronic device,
Number
[0023] The confirmation response message may be a spontaneous message of the mobile phone that responds to the time synchronization frame in the Bluetooth protocol layer, and the spontaneous message is not a message actively transmitted by the upper-layer application of the mobile phone. The response frame refers to the Bluetooth signal used to implement time synchronization between the two electronic devices and occurs after the time synchronization frame.
[0024] Specifically, in this embodiment of the present application, in one of the time synchronization sub-processes, the mobile phone transmits a time synchronization frame to the tag device, and the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the mobile phone. After receiving the time synchronization frame, the tag device feeds back a confirmation response message to the mobile phone in response to the time synchronization frame, and the confirmation response message is transmitted according to a confirmation transmitted by the Bluetooth module of the tag device. The tag device transmits a response frame to the mobile phone. The round-trip time may be represented as the period between the time point when the mobile phone receives the confirmation response message for the confirmation response and the time point when the mobile phone transmits the time synchronization frame for time synchronization.
[0025] The above Bluetooth-based time synchronization method is unidirectional time synchronization, has a shorter time synchronization period, is more suitable for real-time applications, saves time, and improves practicability. In addition, by adjusting the initial sub-time offset, abnormal sub-time offsets in the time synchronization sub-process are reduced, and the accuracy and stability of the comprehensive time offset are improved. When the comprehensive time offset is used for distance calculation, the distance measurement accuracy can be improved.
[0026] In some possible implementations of the first aspect, the response frame includes T RXi and T RXi is the time synchronization reception time when the second electronic device receives the time synchronization frame.
[0027] Specifically, in this embodiment of the present application, the time synchronization frame corresponding to the i-th time synchronization sub-process includes the time synchronization transmission time T RXi of the time synchronization frame in the i-th time synchronization sub-process.
[0028] In some possible implementations of the first aspect, the initial sub-time offset is as follows:
Number
Number
[0029] It should be understood that the initial sub - time offset in this application can be calculated by any one of the above - mentioned four calculation methods. This is not specifically limited in this application.
[0030] In some possible implementations of the first aspect, the response frame includes T RXi,T and T TXi,T where T RXi,T is the time - synchronization reception time when the second electronic device receives a time - synchronization frame, and T TXi,T is the response - transmission time when the second electronic device transmits a response frame.
[0031] Specifically, in this embodiment of this application, the response frame corresponding to the i - th time - synchronization sub - process includes the time - synchronization reception time T RXi,T of the time - synchronization frame in the i - th time - synchronization sub - process, and the response - transmission time T TXi,T of the response frame.
[0032] In the above Bluetooth - based time - synchronization method, since the initial sub - time offset is adjusted, abnormal sub - time offsets in the time - synchronization sub - process are reduced, and the accuracy and stability of the comprehensive time offset are improved. When the comprehensive time offset is used for distance calculation, the distance - measurement accuracy can be improved.
[0033] In some possible implementations of the first aspect, the initial sub-time offset is as follows:
Number
Number
Number
Number
[0034] It should be understood that the initial sub-time offset in this application can be calculated by any one of the above eight calculation methods. This is not specifically limited in this application.
[0035] In some possible implementations of the first aspect, the first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process receiving, by the first electronic device, a time synchronization frame transmitted by the second electronic device, wherein the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the second electronic device; transmitting, by the first electronic device, a confirmation response message to the second electronic device in response to the time synchronization frame, wherein the confirmation response message is transmitted by a confirmation transmitted by the Bluetooth module of the first electronic device; transmitting, by the first electronic device, a response frame to the second electronic device,
Number
[0036] Specifically, in this embodiment of the present application, in one of the time synchronization sub-processes, the tag device transmits a time synchronization frame to the mobile phone, and the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the tag device. After receiving the time synchronization frame, the mobile phone feeds back an acknowledgement message to the tag device in response to the time synchronization frame, and the acknowledgement message is transmitted according to an acknowledgement transmitted by the Bluetooth module of the mobile phone. The mobile phone transmits a response frame to the tag device. The round-trip time may be represented as the period between the time point when the tag device receives the acknowledgement message (acknowledgement reception time) and the time point when the tag device transmits the time synchronization frame (time synchronization transmission time).
[0037] In the above Bluetooth-based time synchronization method, since the initial sub-time offset is adjusted, abnormal sub-time offsets in the time synchronization sub-process are reduced, and the accuracy and stability of the overall time offset are improved. When the overall time offset is used for distance calculation, the distance measurement accuracy can be improved.
[0038] In some embodiments of the first aspect, the time synchronization frame includes T E(i-1) , T RX(i-1),T , and T TXi,T , where T E(i-1) is the acknowledgement reception time when the second electronic device receives the previous acknowledgement message before the acknowledgement message, T RX(i-1),T is the response reception time when the second electronic device receives the previous response frame before the response frame, and T TXi,T is the time point when the second electronic device transmits the time synchronization frame.
[0039] Specifically, in this embodiment of the present application, the time synchronization frame corresponding to the i-th time synchronization sub-process includes the acknowledgement reception time T Ei-1 when the tag device receives the previous acknowledgement message, the response reception time T RX(i-1),T when the tag device receives the previous response frame, and the time synchronization transmission time T TXi,T of the time synchronization frame in the i-th time synchronization sub-processIt includes.
[0040] However, in the first time synchronization sub-process, it should be noted that there is no time point for receiving the confirmation response of the previous confirmation response message and no time point for receiving the response of the previous response frame. Therefore, the time synchronization frame in the first time synchronization sub-process is the time synchronization transmission time point T of the time synchronization frame in the first time synchronization sub-process TX1 and any two values. For example, both values may be 0. In the last time synchronization sub-process, the time points for receiving the confirmation response of the confirmation response message and the response of the response frame in the sub-process may be transmitted to the mobile phone using subsequent independent frames. Alternatively, the last time synchronization sub-process is deleted. Specifically, in Bluetooth-based time synchronization including N + 1 time synchronization sub-processes, N time synchronization sub-processes can actually be used.
[0041] In some possible implementations of the first aspect, the initial sub-time offset is as follows:
Number
Number
Number
Number
[0042] It should be understood that the initial sub-time offset in this application can be calculated by any one of the above eight calculation methods. This is not specifically limited in this application.
[0043] In some possible implementations of the first aspect, the time synchronization frame further includes a sequence number, and the sequence number indicates the rank of the time synchronization frame among N time synchronization sub-processes, and / or, the time synchronization frame further includes a Bluetooth interval T0.
[0044] The sequence number identifies the sub-process number index of the time synchronization sub-process. For example, the SEQ of the first time synchronization sub-process is equal to 1, the SEQ of the second time synchronization sub-process is equal to 2, and so on. The electronic device can determine the specific time synchronization sub-process corresponding to the time synchronization frame based on the sequence number.
[0045] In some possible implementations of the first aspect, the response frame further includes a sequence number, and the sequence number indicates the rank of the response frame among N time synchronization sub-processes, and / or, The response frame further includes a Bluetooth interval T0.
[0046] The sequence number identifies the sub-process number index of the time synchronization sub-process. For example, the SEQ of the first time synchronization sub-process is equal to 1, the SEQ of the second time synchronization sub-process is equal to 2, and so on. The electronic device can determine the specific time synchronization sub-process to which the response frame corresponds based on the sequence number.
[0047] In some possible implementations of the first aspect, in the Bluetooth-based time synchronization method, for the first electronic device to obtain M effective sub-time offsets corresponding to M time synchronization sub-processes based on N round-trip times, it includes the following. The first electronic device performs the following operations for each of the N round-trip times: The first electronic device determines whether the first round-trip time meets the preset condition, and If the first round-trip time meets the preset condition, use the initial sub-time offset corresponding to the first round-trip time as the effective sub-time offset, or If the first round-trip time does not meet the preset condition, delete the initial sub-time offset corresponding to the first round-trip time. The first round-trip time is the round-trip time of the first time synchronization sub-process, and the first time synchronization sub-process is any one of the N time synchronization sub-processes. The preset condition includes the following:
Number
[0048] The preset conditions represent the distribution range of the round-trip time used to determine how to adjust the initial sub-time offset. When the round-trip time of the time synchronization sub-process meets the preset conditions, the time synchronization sub-process is regarded as meeting the preset adjustment conditions. Specifically, the mobile phone needs to perform related operations on the initial sub-time offset corresponding to the time synchronization sub-process.
[0049] For example, when the round-trip time of the time synchronization sub-process meets the preset conditions, the mobile phone deletes the initial sub-time offset. As another example, when the round-trip time of the time synchronization sub-process does not meet the preset conditions, the mobile phone reserves the initial sub-time offset.
[0050] In some possible implementations of the first aspect, for the first electronic device to obtain M valid sub-time offsets corresponding to M time synchronization sub-processes based on N round-trip times, it includes the following. The first electronic device performs the following operations for each of the N round-trip times: The first electronic device determines whether the first round-trip time meets the preset conditions, and When the first round-trip time meets the preset conditions, the first electronic device modifies the initial sub-time offset corresponding to the first round-trip time and uses the modified initial sub-time offset as the valid sub-time offset, or When the first round-trip time does not meet the preset conditions, the first electronic device uses the initial sub-time offset corresponding to the first round-trip time as the valid sub-time offset. The first round-trip time is the round-trip time of the first time synchronization sub-process, and the first time synchronization sub-process is any one of the N time synchronization sub-processes. The preset conditions include the following:
Number
[0051] The preset conditions refer to the distribution range of the round-trip time used to determine how to adjust the initial sub-time offset. When the round-trip time of the time synchronization sub-process meets the preset conditions, the time synchronization sub-process is regarded as meeting the preset adjustment conditions. Specifically, the mobile phone needs to perform related operations on the initial sub-time offset corresponding to the time synchronization sub-process.
[0052] For example, when the round-trip time of the time synchronization sub-process meets the preset conditions, the time synchronization sub-process is regarded as meeting the preset adjustment conditions. Specifically, the mobile phone needs to correct the initial sub-time offset. As another example, when the round-trip time of the time synchronization sub-process does not meet the preset conditions, the mobile phone reserves the initial sub-time offset.
[0053] In some possible implementations of the first aspect, the initial sub-time offset is corrected as follows:
Number
[0054] In some possible implementations of the first aspect, the correction compensation amount is the Bluetooth interval T0.
[0055] In some possible implementations of the first aspect, before the process of performing Bluetooth-based time synchronization is executed, the Bluetooth-based time synchronization method includes the following. The first electronic device and the second electronic device use a synchronization message to synchronize the clock value of the local clock of the first electronic device and the clock value of the local clock of the second electronic device.
[0056] In the above Bluetooth-based time synchronization method, a synchronization message is used to keep the mobile phone clock value of the mobile phone synchronized with the tag clock value of the tag device. That is, the time deviation between the mobile phone and the tag device is minimized, and the difficulty of Bluetooth-based time synchronization between the mobile phone and the tag device is reduced.
[0057] The second aspect of the present application further provides a Bluetooth-based time synchronization method. The Bluetooth-based time synchronization includes the following. A second electronic device performs Bluetooth-based time synchronization with a first electronic device, and the Bluetooth-based time synchronization includes N sequentially executed time synchronization sub-processes, and each time synchronization sub-process has a round-trip time. The first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process is a step of transmitting a time synchronization frame from the second electronic device to the first electronic device, where the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the second electronic device, a step of receiving, by the second electronic device, a confirmation response message transmitted by the first electronic device in response to the time synchronization frame, where the confirmation response message is transmitted according to a confirmation transmitted by the Bluetooth module of the first electronic device, and includes. The time synchronization frame includes T TXi and T Ei-1 where T TXi is the time when the second electronic device transmits the time synchronization frame, and T Ei-1 is the time when the second electronic device receives the previous confirmation response message of the confirmation response message.
Number
[0058] In some possible implementations of the second aspect, the round-trip times of N time synchronization sub-processes are used to correct N valid sub-time offsets corresponding to the N time synchronization sub-processes, obtain M valid sub-time offsets, and use the M valid sub-time offsets to determine the time offset between the second electronic device and the first electronic device, where M ≤ N.
[0059] In some possible implementations of the second aspect, the initial sub-time offset is as follows:
Number
Number
[0060] In some possible implementations of the second aspect, the time synchronization frame further includes a sequence number, where the sequence number indicates the rank of the time synchronization frame among the N time synchronization sub-processes, and / or the time synchronization frame further includes a Bluetooth interval T0.
[0061] In some possible implementations of the second aspect, before the second electronic device executes a process of performing Bluetooth-based time synchronization with the first electronic device, the method includes the following. The first electronic device and the second electronic device use a synchronization message to synchronize the clock value of the local clock of the first electronic device with the clock value of the local clock of the second electronic device.
[0062] The third aspect of the present application further provides an electronic device. The electronic device further includes a memory configured to store instructions and one or more processors. When the instructions are executed by the one or more processors, a Bluetooth-based time synchronization method according to any one of the first aspect and possible implementations of the first aspect is implemented.
[0063] The fourth aspect of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are executed on an electronic device, the electronic device is enabled to execute a Bluetooth-based time synchronization method according to any one of the first aspect and possible implementations of the first aspect.
[0064] The fifth aspect of the present application further provides a computer program product. The computer program product includes instructions that, when executed by one or more processors, are used to implement a Bluetooth-based time synchronization method according to any one of the first aspect and possible implementations of the first aspect.
Brief Description of the Drawings
[0065]
Figure 1(a)
[0066]
Figure 1(b)
[0067]
Figure 2
[0068]
Figure 3
[0069]
Figure 4
[0070]
Figure 5
[0071]
Figure 6
[0072]
Figure 7(a)
[0073]
Figure 7(b)
[0074]
Figure 7(c)
[0075]
Figure 8(a)
[0076]
Figure 8(b)
[0077]
Figure 9
[0078]
Figure 10
[0079]
Figure 11(a)
[0080]
Figure 11(b)
[0081]
Figure 12
[0082]
Figure 13
[0083]
Figure 14(a)
[0084]
Figure 14(b)
[0085]
Figure 15
[0086]
Figure 16
[0087]
Figure 17(a)
[0088]
Figure 17(b)
[0089]
Figure 18
[0090]
Figure 19A
Figure 19B
[0091]
Figure 20
[0092]
Figure 21
[0093]
Figure 22
Mode for Carrying Out the Invention
[0094] Exemplary embodiments of the present application include, but are not limited to, Bluetooth-based time synchronization methods, devices, readable media, and electronic devices.
[0095] To clarify the objectives, technical solutions, and advantages of the present application, the implementation of the present application will be described in detail below with reference to the accompanying drawings.
[0096] The present application provides a time synchronization system applicable to the Bluetooth-based time synchronization solution in the present application. The time synchronization system includes a first electronic device and a second electronic device capable of performing Bluetooth-based time synchronization. Fig. 1(a) is a schematic diagram of the time synchronization system 1 according to some embodiments of the present application. As shown in Fig. 1(a), the time synchronization system 1 includes a first electronic device 10 and a second electronic device 20. The first electronic device 10 includes a Bluetooth module 11, the second electronic device 20 includes a Bluetooth module 21, and the first electronic device 10 and the second electronic device 20 perform Bluetooth communication using the Bluetooth module 11 and the Bluetooth module 21 to achieve Bluetooth-based time synchronization between the first electronic device 10 and the second electronic device 20.
[0097] Furthermore, the Bluetooth-based time synchronization solution in the present application can be applied to multiple scenarios.
[0098] In some application scenarios, the Bluetooth-based time synchronization method provided in this application is applicable to distance measurement scenarios. Figure 1(b) shows a distance measurement scenario to which some embodiments of this application are applicable. As shown in Figure 1(b), the first electronic device 10 in the time synchronization system 1 may be a mobile phone 100, and the second electronic device 20 in the time synchronization system 1 may be an electronic tag (Tag) device 200. The tag device 200 may be an electronic tag device configured to indicate an object.
[0099] Specifically, when the user wants to know the specific positions of a stylus, a backpack, a bicycle, and a key, the user operates the mobile phone 100 to connect the mobile phone 100 to the tag device 200 via Bluetooth. Next, when the mobile phone 100 performs Bluetooth-based time synchronization with the tag device 200, the comprehensive time offset between the mobile phone 100 and the tag device 200 is determined. Thereafter, the mobile phone 100 receives the sound wave signal transmitted by the tag device 200, determines the distance between the mobile phone 100 and the tag device 200 based on the comprehensive time offset and the sound wave signal, and provides a reference for the user to search for objects such as a stylus, a backpack, a bicycle, and a key.
[0100] Furthermore, in some other application scenarios, the time synchronization system provided in this application is further applicable to other communication (such as sleep and power saving) solutions. Details are not described herein.
[0101] In addition to the mobile phone 100, the first electronic device 10 may be any portable and mobile electronic device such as a clock, a tablet computer, a notebook computer, a laptop computer, a wearable device, a head-mounted display, a portable game console, a portable music player, or a reader device. It is understood that in addition to the tag device 200, the second electronic device 20 may be any portable and mobile electronic device such as a mobile phone, a clock, a tablet computer, a notebook computer, a laptop computer, a wearable device, a head-mounted display, a portable game console, a portable music player, a reader device, or a stylus. Furthermore, the first electronic device 10 and the second electronic device 20 include, but are not limited to, various electronic devices that execute a Linux operating system, an operating system developed by Microsoft (Windows), a mobile operating system developed by Apple (iOS), an Android open-source operating system, HarmonyOS (HUAWEI Harmony OS), or other operating systems. This is not specifically limited in the present application.
[0102] For the sake of easy explanation, hereinafter, an example in which the Bluetooth-based time synchronization solution provided in the present application is applicable to a distance measurement scenario, the first electronic device 10 is the mobile phone 100, and the second electronic device 20 is the tag device 200 will be used to explain the technical solution in the present application. To better understand the technical solution in the present application, hereinafter, with reference to the specific structures of the mobile phone 100 and the tag device 200, the technical solution in the present application will be further explained.
[0103] In some embodiments of the present application, the mobile phone 100 includes a first communication module, a first audio module, a first processor, a first memory, and a display module. The first communication module, the first audio module, the first processor, the first memory, and the display module are connected via a bus and perform data exchange. The tag device 200 includes a second communication module and a second audio module. The second communication module and the second audio module establish a signal connection and perform data exchange. The first communication module and the second communication module are configured to establish a communication connection between the mobile phone 100 and the tag device 200. The first audio module and the second audio module are configured to transmit and / or receive acoustic signals between the mobile phone 100 and the tag device 200. The first processor can call relevant instructions to control the first communication module and the second communication module to execute the Bluetooth-based time synchronization method and distance measurement method in the present application. For example, the first processor may be a processing chip incorporated in the mobile phone 100. The first memory is configured to store instructions related to Bluetooth-based time synchronization and distance measurement, received data such as Bluetooth signals or acoustic signals, and the comprehensive time offset obtained using the Bluetooth-based time synchronization solution. The display module is configured to display the distance obtained by the first processor through processing. For example, the display module may be a display screen or a speaker. The distance display method is not particularly limited in the present application.
[0104] In some other embodiments of the present application, the mobile phone 100 includes a first communication module, a first audio module, a first processor, a first memory, and a display module, and the tag device 200 includes a second communication module, a second audio module, a second processor, and a second memory. The first communication module, the first audio module, the first memory, the first processor, the display module, the second communication module, the second audio module, the second processor, and the second memory are the same as those in the foregoing embodiments, and detailed descriptions thereof are omitted.
[0105] In other alternative embodiments of the present application, the mobile phone 100 includes a first communication module, a first audio module, and a display module, and the tag device 200 includes a second communication module, a second audio module, a second processor, and a second memory. The first communication module, the first audio module, and the display module, the second communication module, and the second audio module are the same as those in the foregoing embodiments, and detailed descriptions thereof are omitted. The second processor can call relevant instructions to control the first communication module and the second communication module to execute the Bluetooth-based time synchronization method and distance measurement method in the present application. For example, the second processor may be a processing chip integrated in the tag device 200, and the second memory is configured to store instructions related to Bluetooth-based time synchronization and distance measurement, received data such as Bluetooth signals or sound wave signals, parameters related to the comprehensive time offset in the Bluetooth-based time synchronization solution, and the comprehensive time offset in the Bluetooth-based time synchronization solution.
[0106] FIG. 2 is an interaction diagram of a distance measurement solution according to some embodiments of the present application. As shown in FIG. 2, in some embodiments of the present application, the mobile phone 100 includes a Bluetooth module 101 (i.e., the first communication module) and an ultrasonic module 102 (i.e., the first audio module). The Bluetooth module 101 includes an application layer, a Bluetooth baseband, and a Bluetooth radio frequency module. For example, the ultrasonic module 102 may be any device capable of receiving sound waves / ultrasonic waves, such as a microphone or a ceramic piezoelectric plate. This is not specifically limited in the present application. The tag device 200 includes a Bluetooth module 201 (i.e., the second communication module) and an ultrasonic module 202 (i.e., the second audio module). The Bluetooth module 201 includes an application layer, a Bluetooth baseband, and a Bluetooth radio frequency module. For example, the ultrasonic module 202 may be any device capable of transmitting sound waves / ultrasonic waves, such as a speaker or a ceramic piezoelectric plate. This is not specifically limited in the present application.
[0107] Hereinafter, with reference to FIG. 2, the distance measurement solution in some embodiments of the present application will be described in detail. As shown in FIG. 2, the distance measurement solution in some embodiments of the present application specifically includes the following steps.
[0108] Step S201: The Bluetooth module 101 of the mobile phone 100 and the Bluetooth module 201 of the tag device 200 perform Bluetooth-based time synchronization so that the mobile phone 100 can determine the comprehensive time offset Δ between the mobile phone 100 and the tag device 200. The comprehensive time offset Δ represents an offset value between the clock time of the mobile phone 100 and the clock time of the tag device 200, which is obtained based on the Bluetooth-based time synchronization process.
[0109] In some embodiments of the present application, the comprehensive time offset Δ can be expressed by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100. In some other alternative embodiments of the present application, the comprehensive time offset Δ can be expressed by subtracting the clock time of the mobile phone 100 from the clock time of the tag device 200. For the sake of easy explanation and understanding, hereinafter, an example in which the comprehensive time offset Δ is the result of subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100 will be used for explanation.
[0110] Step S202: The ultrasonic module 202 of the tag device 200 transmits an ultrasonic signal to the ultrasonic module 102 of the mobile phone 100. Here, the time point when the ultrasonic module 202 transmits the ultrasonic signal is the ultrasonic transmission time point t1, and the time point when the ultrasonic module 102 receives the ultrasonic signal is the ultrasonic reception time point t2.
[0111] It can be understood that the ultrasonic signal is an implementation of the signal transmitted from the ultrasonic module 202 to the ultrasonic module 102. In some other alternative implementations, the ultrasonic module 202 can transmit a sound wave signal to the ultrasonic module 102. The operating principles in the two implementations are the same, and the difference lies only in a specific frequency band. Details are not described here. Further, for the sake of easy explanation and understanding, hereinafter, an example in which the ultrasonic module 202 transmits an ultrasonic signal to the ultrasonic module 102 will continue to be used for explanation.
[0112] Step S203: The tag device 200 transmits the ultrasonic transmission time point t1 to the mobile phone 100.
[0113] After receiving the ultrasonic transmission time point t1, the mobile phone 100 determines the distance between the mobile phone 100 and the tag device 200 based on the comprehensive time offset Δ, the ultrasonic transmission time point t1, and the ultrasonic reception time point t2.
[0114] In some implementations of the present application, after receiving the ultrasonic transmission time point t1, the mobile phone 100 determines the distance between the mobile phone 100 and the tag device 200 using Equation (1) based on the overall time offset Δ, the ultrasonic transmission time point t1, and the ultrasonic reception time point t2.
Equation
[0115] In Equation (1), L is the distance between the mobile phone 100 and the tag device 200, v is the speed of sound, t1 is the ultrasonic transmission time point, t2 is the ultrasonic reception time point, Δ is the overall time offset between the mobile phone 100 and the tag device 200, and Δ0 is the time compensation value between the mobile phone 100 and the tag device 200.
[0116] In the above distance measurement method, the overall time offset Δ between the mobile phone 100 and the tag device 200 is determined by Bluetooth-based time synchronization. Then, it can be easily understood that the distance between the mobile phone 100 and the tag device 200 is calculated based on the time of flight (ToF) of the ultrasonic signal and the overall time offset Δ between the mobile phone 100 and the tag device 200. Note that Bluetooth signals are electromagnetic waves with a propagation speed of the speed of light, while ultrasonic signals are mechanical waves with a propagation speed of the speed of sound. There is a propagation delay at the nanosecond level in the Bluetooth-based time synchronization between the mobile phone 100 and the tag device 200, but this delay can be ignored compared to the ultrasonic signal propagating at the speed of sound. Therefore, the above distance measurement method can ensure a specific distance measurement accuracy.
[0117] Figure 3 is an interaction diagram of a Bluetooth-based time synchronization solution according to some embodiments of the present application. As shown in Figure 3, the Bluetooth-based time synchronization process includes a plurality of time synchronization subprocesses. The mobile phone 100 determines the sub-time offset Δ corresponding to the time synchronization subprocess based on the Bluetooth signal corresponding to each time synchronization subprocess. ican be determined. The sub-time offset Δ i represents an offset value between the clock time of the mobile phone 100 and the clock time of the tag device 200, which is obtained based on a time synchronization sub-process in a Bluetooth-based time synchronization process.
[0118] In some implementations of the present application, the sub-time offset Δ i can be represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100. In some other alternative embodiments of the present application, the sub-time offset Δ i can be represented by subtracting the clock time of the mobile phone 100 from the clock time of the tag device 200. For ease of explanation and understanding, hereinafter, an example in which the sub-time offset Δ i is obtained by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100 will be used for explanation.
[0119] The sub-time offset Δ of each time synchronization sub-process i is affected by system scheduling in the Bluetooth chip. Therefore, in order to reduce errors, the mobile phone 100 can obtain an overall time offset Δ between the mobile phone 100 and the tag device 200 based on a plurality of sub-time offsets Δ i corresponding to a plurality of time synchronization sub-processes. For example, the mobile phone 100 averages the sub-time offsets Δ i corresponding to the time synchronization sub-processes to reduce the influence of system scheduling on the overall time offset Δ.
[0120] For ease of understanding, hereinafter, one of the time synchronization sub-processes (for example, the first time synchronization sub-process) will be used to explain the Bluetooth-based time synchronization principle in detail. In some embodiments of the present application, FIG. 3 shows a Bluetooth-based time synchronization process based on the Precision Time Protocol (PTP). In the first time synchronization sub-process, the mobile phone 100 is at the first point in time TP1 transmits the first time synchronization frame to the tag device 200 at time point T1 T, and the tag device 200 receives the first time synchronization frame at time point T2 T. After receiving the first time synchronization frame, the tag device 200 transmits the first response frame to the mobile phone 100 at time point P2 T, and the mobile phone 100 receives the first response frame at time point T1 T. The first response frame transmits time points T2 T and
[0121] T P1 is the time recorded by the mobile phone 100 based on its local clock when the mobile phone 100 transmits the first time synchronization frame, and P2 T is the time recorded by the mobile phone 100 based on its local clock when the mobile phone 100 receives the first response frame, and T1 T is the time recorded by the tag device 200 based on its local clock when the tag device 200 receives the first time synchronization frame, and T2 T is the time recorded by the tag device 200 based on its local clock when the tag device 200 transmits the first response frame.
[0122] It can be easily understood that the following can be obtained. Based on the process of transmitting the first time synchronization frame from the mobile phone 100 to the tag device 200, the sub-time offset Δ 11 = P1 T T1 - 12 T P2 - T2 T between the mobile phone 100 and the tag device 200, and based on the process of transmitting the first response frame from the tag device 200 to the mobile phone 100, the sub-time offset Δ
[0123] Based on this, in the first time synchronization sub-process,
Equation
[0124] Similarly, in the i-th time synchronization sub-process, △i is the sub-time offset between the mobile phone 100 and the tag device 200 determined based on the i-th time synchronization sub-process,
Number
[0125] After explaining the solution for determining the sub-time offset Δ i between the mobile phone 100 and the tag device 200 based on any one of the time synchronization sub-processes, the sub-time offset Δ iContinue to describe the solution for determining the comprehensive time offset Δ using [specific method]. FIG. 4 is a schematic diagram of the principle of a solution for determining the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 according to some embodiments of the present application. As shown in FIG. 4, in some embodiments of the present application, the Bluetooth-based time synchronization process includes N time synchronization sub-processes, and the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 is the sub-time offset Δ i of all N time synchronization sub-processes.
[0126] That is, the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 can be calculated using Equation (2).
Equation
[0127] In Equation (2), Δ is the comprehensive time offset between the mobile phone 100 and the tag device 200 determined based on the Bluetooth-based time synchronization process, N is the number of time synchronization sub-processes included in the Bluetooth-based time synchronization process, and Δ i is the sub-time offset between the mobile phone 100 and the tag device 200 determined based on the i-th time synchronization sub-process.
[0128] Substitute the expressions of Δ1, Δ2, Δ3,..., Δ N into Equation (2) individually to obtain Equation (3).
Equation
[0129] In Equation (3), △ is the comprehensive time offset between the mobile phone 100 and the tag device 200 determined based on the Bluetooth-based time synchronization process, N is the number of time synchronization sub-processes included in the Bluetooth-based time synchronization process, T P(2i-1) is the time when the mobile phone 100 records based on its local clock and transmits the i-th time synchronization frame, and T P2i is the time when the mobile phone 100 records based on its local clock and receives the i-th response frame, and T T(2i-1) is the time when the tag device 200 records based on its local clock and receives the i-th time synchronization frame, and T T2i is the time when the tag device 200 records based on its local clock and transmits the i-th response frame.
[0130] FIG. 5 is a relational diagram between the sub-time offset Δ i and the sub-process number i in a Bluetooth-based time synchronization solution according to some embodiments. In FIG. 5, the horizontal axis represents the sub-process sequence number of the time synchronization sub-process, that is, a specific time synchronization sub-process, and the vertical axis represents the sub-time offset Δ i (unit: ms).
[0131] As shown in FIG. 5, the sub-time offset Δ i of the 150th sub-process varies greatly compared to the overall average value. Also, when calculating the overall time offset Δ between the mobile phone 100 and the tag device 200 using the sub-time offsets Δ i of all the time synchronization sub-processes in FIG. 5 (i.e., the 1500th sub-process), the overall time offset Δ obtained according to the Bluetooth-based time synchronization solution in FIG. 3 can be represented as a straight line l0.
[0132] However, depending on the scenario of real-time applications, it is necessary to complete Bluetooth-based time synchronization in a short time. That is, it is necessary to shorten the period of the Bluetooth-based time synchronization process. When the period of the Bluetooth-based time synchronization process is short, the amount of time synchronization sub-processes in the Bluetooth-based time synchronization process is also small. For example, when calculating the overall time offset Δ between the mobile phone 100 and the tag device 200 using the sub-time offset Δ of the 1100th sub-process in FIG. 5, the overall time offset Δ obtained according to the Bluetooth-based time synchronization solution in FIG. 3 can be represented as a straight line l1. i When calculating the overall time offset Δ between the mobile phone 100 and the tag device 200 using the sub-time offset Δ of the 1100th sub-process, the overall time offset Δ obtained according to the Bluetooth-based time synchronization solution in FIG. 3 can be represented as a straight line l1.
[0133] Note that since the sub-time offset of the 150th sub-process varies greatly, the overall time offset Δ between the mobile phone 100 and the tag device 200 calculated based on the sub-time offset Δ i of the 1100th sub-process (corresponding to the straight line l1) is significantly different from the overall time offset Δ between the mobile phone 100 and the tag device 200 calculated based on the sub-time offset Δ i of the 1500th sub-process (corresponding to the straight line l0).
[0134] Based on this, in the foregoing embodiments, the overall time offset Δ between the mobile phone 100 and the tag device 200 can be calculated. However, the calculated overall time offset Δ is accurate only when the period of the Bluetooth-based time synchronization process is long, that is, when the number of time synchronization sub-processes in the Bluetooth-based time synchronization process is large. When the period of the Bluetooth-based time synchronization process is short, that is, when the amount of time synchronization sub-processes in the Bluetooth-based time synchronization process is small, since the first part of the sub-time offset Δ i varies rapidly, there is a high possibility of an error in the estimation of the overall time offset Δ, that is, the accuracy of the calculated overall time offset Δ becomes low.
[0135] Generally, if the error of the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 is less than 3 ms, the distance measurement accuracy between the mobile phone 100 and the tag device 200 can be maintained within ±1 m. From this, when the Bluetooth-based time synchronization period is short, that is, when there are only a few Bluetooth-based time synchronization subprocesses, how to improve the accuracy of the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 is a technical problem that should be urgently solved to improve the distance measurement accuracy in the above distance measurement solution.
[0136] Based on this, in order to improve the accuracy of the comprehensive time offset Δ, the present application provides a Bluetooth-based time synchronization solution. In the present application, the mobile phone 100 calculates and obtains the sub-time offset Δ i (i = 1 to N) corresponding to each time synchronization subprocess. After determining that the time synchronization subprocess satisfies the preset adjustment condition, the sub-time offset Δ i corresponding to the time synchronization subprocess is adjusted to determine the adjusted sub-time offset Δ j (j = 1 to M, and N ≥ M), and the dispersion degree of all sub-time offsets corresponding to the Bluetooth-based time synchronization process is reduced. Then, the mobile phone 100 obtains the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 based on the adjusted sub-time offset Δ j (j = 1 to M, and N ≥ M).
[0137] A method for determining whether a time synchronization subprocess meets preset adjustment conditions may be to determine whether the round-trip time corresponding to the time synchronization subprocess meets the preset conditions. In some implementations of the present application, it is possible to determine whether the round-trip time corresponding to the time synchronization subprocess meets the preset conditions based on whether the round-trip time corresponding to the time synchronization subprocess is within the preset round-trip range. The round-trip time represents the period of a group of round-trip transmission signals in the time synchronization process. The preset round-trip range represents a range outside the critical range of the round-trip time when the initial sub-time offset corresponding to the time synchronization subprocess converges. Since the details will be described later, they will not be elaborated here. Specifically, when the round-trip time is within the range of the preset round-trip time, it indicates that the time synchronization subprocess meets the preset adjustment conditions. Alternatively, when the round-trip time is outside the range of the preset round-trip time, it indicates that the time synchronization subprocess does not meet the preset adjustment conditions.
[0138] FIG. 6 is a schematic diagram of a Bluetooth-based time synchronization solution according to some embodiments of the present application, showing the principle of determining the overall time offset Δ between the mobile phone 100 and the tag device 200 in some embodiments of the present application. As shown in FIG. 6, after the mobile phone 100 obtains the sub-time offset Δ corresponding to each time synchronization subprocess through calculation, it determines whether the time synchronization subprocess meets the preset adjustment conditions. For example, in FIG. 6, the time synchronization subprocess in which the sub-time offset Δ i exceeds the convergence range (the gray area in the figure) meets the preset adjustment conditions, and the sub-time offset Δ i is within the preset round-trip range. iThe time synchronization sub-process within the convergence range (the gray area in the figure) does not meet the preset adjustment conditions. The convergence range represents the preset distribution range of the sub-time offset obtained using the round-trip time in a Bluetooth-based time synchronization solution. It should be understood that the convergence range in FIG. 6 is only a part of the implementation in this application. In this application, the convergence range may be in another form of implementation. This is not specifically limited in this application.
[0139] Modify the sub-time offset Δi corresponding to the time synchronization sub-process that meets the preset adjustment conditions (for example, in FIG. 6, Δ1 is adjusted to Δ1', and as another example, Δ3 in FIG. 6 is adjusted to Δ3'), and / or delete it (for example, Δ N is deleted in FIG. 6) to minimize the variation range of the sub-time offset corresponding to the Bluetooth-based time synchronization process. Let the modified sub-time offset and / or the deleted sub-time offset be Δ j . Then, the mobile phone 100 obtains the overall time offset Δ between the mobile phone 100 and the tag device 200 based on the sub-time offset Δ j that converges within the convergence range.
[0140] FIG. 7(a) is a correspondence diagram between the sub-time offset Δ i and the sub-process number i according to some embodiments of this application. FIG. 7(b) is a correspondence diagram between the round-trip time T LPi and the sub-process number i according to some embodiments of this application. FIG. 7(c) is the adjusted sub-time offset Δ jIt is a correspondence diagram between and the sub - process number i. The above - mentioned process is performed based on measurement data. The sub - time offset value is shown in FIG. 7(a). The sub - time offset in the initial phase has a large error. When directly using the first W sub - processes to calculate the average time offset, if W is set to different values (for example, W = 20, 40, 60, 80, or 100), the comprehensive time offset is clearly very different. Therefore, the sub - time offset is adjusted based on the round - trip time in FIG. 7(b). In this case, the adjusted sub - time offset is shown in FIG. 7(c), and the comprehensive time offset Δ obtained based on the Bluetooth - based time synchronization solution in FIG. 7(c) can be represented as a straight line l2. Comparing FIG. 7(a) and FIG. 7(c), it can be easily seen that regardless of the value of W, based on the adjusted sub - time offset, the comprehensive time offset Δ is close to a stable value.
[0141] Hereinafter, with reference to a specific application scenario, the Bluetooth - based time synchronization solution in the present application will be described in detail.
[0142] Application scenario 1
[0143] In application scenario 1, the tag device 200 transmits a time - synchronization frame to the mobile phone 100, and then the mobile phone 100 feeds back a confirmation response message to the tag device 200. Note that the mobile phone 100 does not need to transmit a time - synchronization frame or a response frame to the tag device 200. Based on this, the Bluetooth - based time synchronization solution applicable to application scenario 1 can also be defined as an inverse unidirectional Bluetooth - based time synchronization solution.
[0144] FIG. 8(a) is an interaction diagram of a reverse unidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. FIG. 8(b) is an interaction diagram of a part of the i-th time synchronization subprocess and the (i + 1)-th time synchronization subprocess in the reverse unidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. The shaded area represents the i-th time synchronization subprocess, and the white area below the shaded area represents a part of the (i + 1)-th time synchronization subprocess. From FIG. 8(a), it can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization subprocesses. FIG. 9 is a flowchart of a reverse unidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. As shown in FIG. 9, in some embodiments of the present application, the reverse unidirectional Bluetooth-based time synchronization solution applicable to Application Scenario 1 of the present application specifically includes the following steps.
[0145] S901: The mobile phone 100 transmits a synchronization message to the tag device 200, and the synchronization message transmits the mobile phone clock value T of the mobile phone 100. Sync The tag device 200 sets the tag clock value of the tag device 200 based on the mobile phone clock value T. Sync The mobile phone clock value T represents the clock value of the local clock of the mobile phone 100. The tag clock value represents the clock value of the local clock of the tag device 200. Sync
[0146] The synchronization message represents instruction information transmitted from one electronic device to another electronic device. The instruction information instructs another electronic device to reset the clock value of the other electronic device based on the clock value of the electronic device, so that the clock value of the electronic device is maintained in synchronization with the clock value of the other electronic device as much as possible. For example, the synchronization message may be the time synchronization start message in FIG. 8(a).
[0147] In this embodiment, the synchronization message is transmitted by the mobile phone 100 to the tag device 200, and the tag device 200 is instructed to reset the tag clock value of the tag device 200 based on the mobile phone clock value of the mobile phone 100, so as to ensure that the mobile phone clock value of the mobile phone 100 is maintained in synchronization with the tag clock value of the tag device 200 as much as possible.
[0148] In some implementations of the present application, the mobile phone 100 includes a mobile phone local clock, and the clock value of the mobile phone local clock is the mobile phone clock value T Sync The tag device 200 includes a tag local clock. The mobile phone 100 transmits a synchronization message to the tag device 200. After receiving the synchronization message, the tag device 200 sets the tag clock value of the tag local clock of the tag device 200 based on the mobile phone clock value T Sync transmitted in the synchronization message.
[0149] In some other embodiments, the synchronization message is transmitted by the tag device 200 to the mobile phone 100, and the mobile phone 100 is instructed to reset the mobile phone clock value of the mobile phone 100 based on the tag clock value of the tag device 200, so as to ensure that the mobile phone clock value of the mobile phone 100 is synchronized and maintained with the tag clock value of the tag device 200 as much as possible. It is easily understood.
[0150] In some embodiments of the present application, the tag device 200 includes a tag local clock, and the clock value of the tag local clock is the tag clock value T Sync '. The mobile phone 100 includes a mobile phone local clock. The tag device 200 transmits a synchronization message to the mobile phone 100. After receiving the synchronization message, the mobile phone 100 sets the mobile phone clock value of the mobile phone local clock of the mobile phone 100 based on the tag clock value T Sync ' transmitted in the synchronization message.
[0151] Based on this, any embodiment in which the mobile phone clock value of the mobile phone 100 and / or the tag clock value of the tag device 200 is set to synchronize and maintain the mobile phone clock value of the mobile phone 100 and the tag clock value of the tag device 200 as much as possible is included in the protection scope of this application. This is not specifically limited in this application.
[0152] In the above embodiment, a synchronization message is used to keep the mobile phone clock value of the mobile phone 100 synchronized with the tag clock value of the tag device 200. That is, the time deviation between the mobile phone 100 and the tag device 200 is minimized, and the difficulty of Bluetooth-based time synchronization between the mobile phone 100 and the tag device 200 is reduced.
[0153] In some embodiments of this application, the synchronization message further includes the amount N of time synchronization subprocesses in the Bluetooth-based time synchronization process. The mobile phone 100 and / or the tag device 200 can determine the amount of time synchronization subprocesses that need to be executed based on the amount N of time synchronization subprocesses in the synchronization message.
[0154] In some other embodiments of this application, the mobile phone 100 and / or the tag device 200 use another transmission signal to obtain the amount N of time synchronization subprocesses in the Bluetooth-based time synchronization process. This is not specifically limited in this application.
[0155] S902: The mobile phone 100 performs Bluetooth-based time synchronization with the tag device 200. The mobile phone 100 determines a sub-time offset Δ i (i = 1, 2, 3,..., or N) corresponding to each time synchronization subprocess in the Bluetooth-based time synchronization process. When the time synchronization subprocess meets the preset adjustment condition, according to the preset adjustment logic, the sub-time offset Δ i corresponding to each time synchronization subprocess is adjusted, and the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization processj Obtain (j = 1, 2, 3, …, or M). Here, N ≥ M.
[0156] From FIG. 8(a), it can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. The Bluetooth-based time synchronization process represents the entire transmission process of the Bluetooth signal between the mobile phone 100 and the tag device 200 in the entire Bluetooth-based time synchronization solution. The time synchronization sub-process represents the transmission period of the Bluetooth signal between the mobile phone 100 and the tag device 200. The Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes.
[0157] In some implementations of the present application, the Bluetooth-based time synchronization includes N time synchronization sub-processes that are sequentially executed. Each time synchronization sub-process corresponds to a start time synchronization frame (which can be understood as the first transmission signal in the time synchronization sub-process). The start time synchronization frames of the N time synchronization sub-processes are sequentially executed. For example, in the Bluetooth-based time synchronization, in the N time synchronization sub-processes, after the previous time synchronization sub-process is completed, the subsequent time synchronization sub-process is executed. In another example, in the N time synchronization sub-processes, the previous time synchronization sub-process is executed, but the subsequent time synchronization sub-process is executed before the previous time synchronization sub-process is completed. This is not specifically limited in the present application.
[0158] Hereinafter, for the sake of easy explanation and understanding, taking one of the time synchronization sub-processes as an example, the specific processing will be described in detail.
[0159] FIG. 10 is a flowchart of a time synchronization solution in one of the time synchronization sub - processes of FIG. 8(a). Hereinafter, with reference to FIGS. 8(a), 8(b) and 10, the time synchronization solution in one of the time synchronization sub - processes in the present application will be described in detail. As shown in FIG. 10, the time synchronization solution in one of the time synchronization sub - processes in the present application specifically includes the following steps.
[0160] S1001: The tag device 200 transmits a time synchronization frame to the mobile phone 100 and records the time synchronization transmission time point T TX at which the time synchronization frame is transmitted. The time synchronization frame represents a Bluetooth signal used to perform time synchronization between two electronic devices. The time synchronization transmission time point T TX is recorded by the tag device 200 based on the local clock and is the time when the tag device 200 starts transmitting the time synchronization frame.
[0161] In some implementations of the present application, the time synchronization frame may be request information transmitted by an instruction. The instruction is a lower - layer transmission signal triggered by an upper - layer application and transmits upper - layer data from the upper - layer application. Based on this, the time synchronization transmission time point T TX may be upper - layer data. For example, the time synchronization transmission time point T TX may be the time when the upper - layer application writes data to the chip. The T of the i - th sub - process TX may be transmitted in the time synchronization frame of the i - th sub - process. Specifically, the application layer in the tag device 200 reads the current system clock T TXi , generates a time synchronization frame for the i - th sub - process based on the time T TXi , and immediately writes the time synchronization frame of the i - th sub - process to the Bluetooth chip. Thus, the device immediately transmits the time synchronization frame of the i - th sub - process via Bluetooth.
[0162] In some alternative implementations of the present application, the time synchronization frame may be another form of transmission signal, which is not specifically limited in the present application.
[0163] In some embodiments of the present application, the time synchronization frame can include a sequence number. The sequence number may be SEQ in FIGS. 8(a) and 8(b). The sequence number identifies the sub-process number index of the time synchronization sub-process. For example, the SEQ of the first time synchronization sub-process is equal to 1, the SEQ of the second time synchronization sub-process is equal to 2, and so on. The mobile phone 100 can determine the specific time synchronization sub-process corresponding to the time synchronization frame based on the SEQ.
[0164] S1002: The mobile phone 100 receives the time synchronization frame transmitted by the tag device 200 and records the time synchronization reception time point T RX when the time synchronization frame is received. The time synchronization reception time point T RX is recorded by the mobile phone 100 based on the local clock and is the time when the mobile phone 100 receives the time synchronization frame.
[0165] Note that since the time synchronization transmission time point T TX is the time recorded by the tag device 200 based on the local clock, in order for the mobile phone 100 to realize the time synchronization solution between the mobile phone 100 and the tag device 200 using the time synchronization transmission time point T TX , it is necessary to transmit the time synchronization transmission time point T TX to the mobile phone 100. Hereinafter, several transmission methods for the tag device 200 to transmit the time synchronization transmission time point T TX to the mobile phone 100 will be briefly described.
[0166] In some embodiments of the present application, the tag device 200 uses another transmission signal to transmit the time synchronization transmission time point T TXIt is transmitted to the mobile phone 100. Specifically, after the tag device 200 transmits the time synchronization frame to the mobile phone 100, the tag device 200 uses another transmission signal to determine the time synchronization transmission time point T corresponding to the time synchronization frame TX It is transmitted to the mobile phone 100.
[0167] In some implementations of the present application, the another transmission signal may be a transmission signal in any subsequent sub-process. For example, the tag device 200 uses the time synchronization frame corresponding to the i-th time synchronization sub-process to determine the time synchronization transmission time point T corresponding to the (i - 1)-th time synchronization sub-process TX(i-1) It is transmitted to the mobile phone 100. That is, the time synchronization frame in the i-th time synchronization sub-process transmitted by the tag device 200 to the mobile phone 100 is used to determine the time synchronization transmission time point T corresponding to the (i - 1)-th time synchronization sub-process TX(i-1) It is transmitted.
[0168] In some other alternative implementations of the present application, the another transmission signal may be a separate transmission signal after the time synchronization frame. Details are not described here.
[0169] Also, depending on the application scenario, it can be understood from the above that the time synchronization transmission time point T TX may be upper layer data. That is, the time synchronization transmission time point T may be a time determined before the tag device 200 transmits the time synchronization frame. For example, the time synchronization transmission time point T TX may be the current system time read by the tag device 200 before the tag device 200 transmits the time synchronization frame. Based on this, in some other embodiments of the present application, the time synchronization transmission time point T TX is transmitted in the time synchronization frame. For example, the tag device 200 uses the time synchronization frame corresponding to the i-th time synchronization sub-process to transmit the time synchronization transmission time point T corresponding to the i-th time synchronization sub-process TXi It is transmitted to the mobile phone 100.
[0170] S1003: The mobile phone 100 transmits a confirmation response message to the tag device 200 in response to the time synchronization frame. The confirmation response message represents a spontaneous message of the mobile phone 100 that responds to the time synchronization frame in the Bluetooth protocol layer, and the spontaneous message is not a message actively transmitted by the upper layer application of the mobile phone 100.
[0171] In some implementations of the present application, the confirmation response message may be a confirmation. The confirmation is a spontaneous message of the mobile phone 100 that responds to the instruction of the Bluetooth protocol layer. The confirmation does not transmit upper layer data.
[0172] S1004: The tag device 200 receives the confirmation response message transmitted by the mobile phone 100, and records the confirmation response reception time point T E when the confirmation response message is received. The confirmation response reception time point T E is recorded by the tag device 200 based on the local clock, and represents the time when the tag device 200 receives the confirmation response message.
[0173] In some implementations of the present application, the confirmation response reception time point T E may be the callback time reported by the lowest layer chip in the tag device 200 after the lowest layer chip receives the confirmation. That is, the confirmation response reception time point T E is recorded by the tag device 200 based on the local clock, and is the time when the tag device 200 receives the confirmation.
[0174] S1005: The tag device 200 transmits a feedback message including the confirmation response reception time point T E to the mobile phone 100. The feedback message is transmitted by the tag device 200 to the mobile phone 100, and represents a message used to transmit the confirmation response reception time point T E .
[0175] The confirmation response reception time point T ESince it is the time recorded by the tag device 200 based on the local clock, the mobile phone 100 can surely implement the time synchronization solution between the mobile phone 100 and the tag device 200 by using the confirmation response reception time point T E To ensure that the time synchronization solution between the mobile phone 100 and the tag device 200 can be implemented using the confirmation response reception time point T E It should be noted that it is necessary to transmit the confirmation response reception time point T E to the mobile phone 100. Hereinafter, several transmission methods for the tag device 200 to transmit the confirmation response reception time point T
[0176] In some embodiments of the present application, the feedback message may be another transmission signal used by the tag device 200 to obtain the confirmation response reception time point T E
[0177] In some implementations of the present application, the other transmission signal may be a time synchronization frame in a subsequent time synchronization subprocess. In other words, the feedback message may reuse the time synchronization frame corresponding to the subsequent time synchronization subprocess. For example, as shown in FIG. 8(a), the tag device 200 uses the time synchronization frame corresponding to the i-th time synchronization subprocess to transmit the confirmation response reception time point T Ei corresponding to the (i - 1)-th time synchronization subprocess to the mobile phone 100. That is, the time synchronization frame in the i-th time synchronization subprocess transmitted by the tag device 200 to the mobile phone 100 transmits the confirmation response reception time point T E(i-1) corresponding to the (i - 1)-th time synchronization subprocess.
[0178] In some other alternative implementations of the present application, the other transmission signal may be a separate frame. That is, the feedback message is separately transmitted from the tag device 200 to the mobile phone 100 after the tag device 200 receives the confirmation response message transmitted from the mobile phone 100. This is not specifically limited in the present application.
[0179] In some embodiments of the present application, based on the multi - transmission solution of FIG. 8(a), the time point T of receiving the acknowledgment response in the Nth time synchronization sub - process EN cannot be transmitted to the mobile phone 100. Since the mobile phone 100 does not receive the time point T of receiving the acknowledgment response, EN the time point T of time synchronization transmission corresponding to the Nth time synchronization sub - process TXN and the time point T of time synchronization reception RXN cannot be used. Therefore, in the Nth time synchronization sub - process, only the data of the first N - 1 sub - processes can be actually used.
[0180] In some other embodiments of the present application, after the mobile phone 100 transmits confirm N to the tag device 200, the mobile phone 100 may feedback the time point T of receiving the acknowledgment response using another frame. EN Therefore, the data of the Nth time synchronization sub - process (for example, the time point T of time synchronization transmission TXN and the time point T of time synchronization reception RXN ) can also be effectively used by the mobile phone 100.
[0181] S1006: The mobile phone 100 receives a feedback message and calculates a sub - time offset Δ TX based on at least some of the data of the time point T of time synchronization transmission, the time point T of time synchronization reception, RX and the time point T of receiving the acknowledgment response. E The sub - time offset represents an offset value between the clock time of the mobile phone 100 and the clock time of the tag device 200, which is obtained based on the time synchronization sub - process in the Bluetooth - based time synchronization process. i
[0182] In some embodiments of the present application, the sub-time offset can be represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100. In some other alternative embodiments of the present application, the sub-time offset can be represented by subtracting the clock time of the mobile phone 100 from the clock time of the tag device 200. For ease of explanation and understanding, the former implementation is used as an example for explanation below.
[0183] In some embodiments of the present application, for the i-th time synchronization sub-process, the mobile phone 100, based on the time synchronization transmission time point T TXi and the time synchronization reception time point T RXi corresponding to the i-th time synchronization sub-process, calculates the sub-time offset Δ i1 corresponding to the i-th time synchronization sub-process. In some implementations of the present application, the sub-time offset Δ i1 corresponding to the i-th time synchronization sub-process can be calculated using Equation (4).
Equation
[0184] In Equation (4), Δ i1 is the sub-time offset determined based on the i-th time synchronization sub-process, T RXi is the time synchronization reception time point in the i-th time synchronization sub-process, and T TXi is the time synchronization transmission time point in the i-th time synchronization sub-process.
[0185] Note that when the sub-time offset is as follows:
Equation
[0186] In some other embodiments of this application, for the i-th time synchronization sub-process, the mobile phone 100 calculates the sub-time offset Δ RX corresponding to the i-th time synchronization sub-process based on the time synchronization reception time point T E and the confirmation response reception time point T i2 In some implementations of this application, the sub-time offset Δ i2 corresponding to the i-th time synchronization sub-process can alternatively be calculated using Equation (5).
Equation
[0187] In Equation (5), Δ i2 is the sub-time offset determined based on the i-th time synchronization sub-process, T RXi is the time synchronization reception time point in the i-th time synchronization sub-process, and T Ei is the confirmation response reception time point in the i-th time synchronization sub-process.
[0188] Note that when the sub-time offset is as follows:
Equation
[0189] In some other embodiments of the present application, for one of the time synchronization subprocesses, for the i-th time synchronization subprocess, the mobile phone 100 has a time synchronization reception time point T corresponding to the time synchronization subprocess and a plurality of time synchronization subprocesses adjacent to the time synchronization subprocess TX and a confirmation response reception time point T E Based on this, a sub-time offset Δ i corresponding to the time synchronization subprocess is calculated.
[0190] For example, the mobile phone 100 has a time synchronization transmission time point T in the time synchronization subprocess and a plurality of adjacent round-trip time synchronization subprocesses TX , a time synchronization reception time point T RX , and a confirmation response reception time point T E Based on this, an average time synchronization transmission time point T TX ', an average time synchronization reception time point T RX ', and an average confirmation response reception time point T E corresponding to the time synchronization subprocess are calculated. Then, the mobile phone 100 has an average time synchronization transmission time point T TX ', an average time synchronization reception time point T RX ', and an average confirmation response reception time point T E Based on this, a sub-time offset Δ i corresponding to the time synchronization subprocess is calculated. Details are not described here.
[0191] Note that in the "Bluetooth + ultrasonic" joint unidirectional distance measurement solution, the sub-time offset Δ i1 and the sub-time offset Δ i2 are different. The sub-time offset Δ i1 and the sub-time offset Δ i2The difference is related to the Bluetooth Interval (BI) T0 corresponding to the current time synchronization subprocess. The Bluetooth interval T0 is the connection interval defined in the Bluetooth protocol, and the value of the Bluetooth interval T0 is an integer multiple of 1.25 ms.
[0192] In some embodiments of the present application,
Number
[0193] In the Bluetooth-based time synchronization process, Bluetooth signals are transmitted between the mobile phone 100 and the tag device 200.
[0194] In some embodiments of the present application, the Bluetooth interval T0 is stored in the local information of the mobile phone 100, and the mobile phone 100 can obtain the Bluetooth interval T0 from the local information. Specifically, in some implementations of the present application, the Bluetooth chip of the mobile phone 100 can report the Bluetooth interval T0. In some other alternative embodiments of the present application, the mobile phone chip of the mobile phone 100 supports the upper-layer application when querying the Bluetooth interval T0.
[0195] In some embodiments of the present application, the tag device 200 stores the Bluetooth interval T0, and the tag device 200 feeds back the Bluetooth interval T0 to the mobile phone 100 by using the transmission signal. The specific form of the transmission signal is not particularly limited in the present application, and it is understood that any transmission signal that can be used to feed back the Bluetooth interval T0 to the mobile phone 100 is included within the protection scope of the present application.
[0196] In some embodiments of the present application, the Bluetooth interval T0 corresponding to all time synchronization sub - processes in the Bluetooth - based time synchronization process is equal, that is, the Bluetooth interval T0 is a fixed value. In some implementations of the present application, before the time synchronization start message, the tag device 200 can use any transmission signal (e.g., Bluetooth message) to feedback the Bluetooth interval T0 to the mobile phone 100. In some other alternative embodiments of the present application, the tag device 200 can use any transmission signal (e.g., Bluetooth message) to feedback the Bluetooth interval T0 to the mobile phone 100 in the Bluetooth - based time synchronization process or after the Bluetooth - based time synchronization process ends. It can be understood that the tag device 200 can use a single transmission signal (e.g., Bluetooth message) to feedback the Bluetooth intervals T0 of multiple time synchronization sub - processes to the mobile phone 100. The tag device 200 can also use multiple transmission signals (e.g., Bluetooth messages) to feedback the Bluetooth intervals T0 of multiple time synchronization sub - processes to the mobile phone 100. This is not specifically limited in the present application.
[0197] In some other embodiments of the present application, the Bluetooth intervals T0 corresponding to all time synchronization sub - processes in the Bluetooth - based time synchronization process are not exactly equal, that is, the Bluetooth interval T0 is a variable. In some implementations of the present application, the tag device 200 obtains the Bluetooth interval T 0i corresponding to the current sub - process. After the tag device 200 obtains the Bluetooth interval T 0i , it can use any transmission signal (e.g., Bluetooth message) to feedback the Bluetooth interval T 0i to the mobile phone 100. Specifically, the mobile phone 100 can obtain the Bluetooth interval T0 corresponding to the current time synchronization sub - process in the following several possible ways.
[0198] In some implementations of the present application, the time synchronization frame transmitted by the tag device 200 to the mobile phone 100 transmits the Bluetooth interval T0 corresponding to the current time synchronization subprocess. That is, the tag device 200 uses the time synchronization frame to transmit the Bluetooth interval T0 corresponding to the current time synchronization subprocess to the mobile phone 100.
[0199] In some other alternative implementations of the present application, another frame transmitted by the tag device 200 to the mobile phone 100 transmits the Bluetooth interval T0. That is, the tag device 200 uses another frame to transmit the Bluetooth interval T0 to the mobile phone 100.
[0200] Note that if the Bluetooth interval T0 corresponding to the time synchronization subprocess in the Bluetooth-based time synchronization process is different from the Bluetooth interval T0 corresponding to another time synchronization subprocess, the sub-time offset corresponding to the time synchronization subprocess is deleted.
[0201] S1007: The mobile phone 100 calculates the round-trip time T LPi and determines whether the time synchronization subprocess corresponding to the sub-time offset Δ LPi satisfies the preset adjustment condition based on the round-trip time T i . If the determination result is negative, the time synchronization subprocess does not satisfy the preset adjustment condition, indicating that the sub-time offset Δ i corresponding to the time synchronization subprocess satisfies the preset requirements (for example, within the above convergence range). That is, there is no need to adjust the sub-time offset Δ i , and S1008 is executed. In other cases, if the determination result is affirmative, the time synchronization subprocess satisfies the preset adjustment condition, and the sub-time offset Δ i corresponding to the time synchronization subprocess does not satisfy the preset requirements (for example, outside the above convergence range). That is, the sub-time offset Δ iIt is necessary to make an adjustment, and S1009 is executed.
[0202] Round-trip time T LPi represents the period of a group of round-trip transmission signals in one time synchronization sub-process. In some implementations of the present application, the group of round-trip transmission signals may be a time synchronization frame transmitted from the tag device 200 to the mobile phone 100 and a confirmation response message transmitted from the mobile phone 100 to the tag device 200 in response to the time synchronization frame. Based on this, the round-trip time T LPi may be the period between the time synchronization transmission time of the time synchronization frame in the time synchronization sub-process and the confirmation response reception time of the confirmation response message in the time synchronization sub-process.
[0203] Based on this, the round-trip time T of the time synchronization sub-process LPi can be calculated using Equation (6).
Equation
[0204] In Equation (6), Δ LPi is the round-trip time of the i-th time synchronization sub-process, T Ei is the confirmation response reception time in the i-th time synchronization sub-process, T TXi is the time synchronization transmission time in the i-th time synchronization sub-process.
[0205] Note that in other embodiments of the present application, in the time synchronization sub-process, the group of round-trip transmission signals may alternatively be another form of transmission signal. This is not specifically limited in the present application.
[0206] The preset adjustment condition may be that the round-trip time T corresponding to the time synchronization sub-process LPi is within the preset round-trip range. The preset round-trip range is the sub-time offset Δi The round-trip time T when it converges LPi may be in a range outside the distribution range. The round-trip time T corresponding to the time synchronization sub-process LPi is within the preset round-trip range, indicating that the time synchronization sub-process meets the preset adjustment conditions. That is, the sub-time offset Δ i corresponding to the time synchronization sub-process needs to be adjusted. In other cases, the round-trip time T corresponding to the time synchronization sub-process LPi is outside the preset round-trip range, indicating that the time synchronization sub-process does not meet the preset adjustment conditions. That is, the sub-time offset Δ i corresponding to the time synchronization sub-process does not need to be adjusted.
[0207] In some implementations of the present application, the preset adjustment condition is that the round-trip time T LPi corresponding to the time synchronization sub-process may be greater than the first preset threshold thr1. The first preset threshold thr1 may be a parameter related to the Bluetooth interval T0.
[0208] For example, the first preset threshold thr1 may be calculated using Equation (7).
Number
[0209] In Equation (7), thr1 represents the first preset threshold, T0 represents the Bluetooth interval, and is as follows:
Number
[0210] In some specific implementations of the present application,
Number
[0211] In some other alternative implementations of the present application, the preset adjustment condition may be that the round-trip time T corresponding to the time synchronization sub-process LPi is less than the second preset threshold thr2, or the round-trip time T LPi is greater than the third preset threshold thr3. The second preset threshold thr2 may be a parameter related to the Bluetooth interval T0, and the third preset threshold thr3 may be a parameter related to the Bluetooth interval T0.
[0212] For example, the second preset threshold thr2 may be calculated using Equation (8).
Number
[0213] In Equation (8), thr2 represents the second preset threshold, T0 represents the Bluetooth interval, and is as follows:
Number
[0214] ε may be a small value. In some implementations,
Number
[0215] For example, the third preset threshold thr3 may be calculated using Equation (9).
Number
[0216] In Equation (9), thr3 represents the third preset threshold, and T0 represents the Bluetooth interval, as follows:
Number
[0217] ε may be a small value. In some implementations,
Number
[0218] Furthermore, in some specific implementations of the present application, for example, ε = 1 ms. In this case, the preset adjustment condition may be that the round-trip time T LPi corresponding to the time synchronization subprocess is greater than the following equation:
Number
[0219] S1008: The mobile phone 100 uses the adjusted sub-time offset Δ i as the adjusted sub-time offset Δ i ' and executes S1010.
[0220] In some embodiments of the present application, when the mobile phone 100 determines that the time synchronization subprocess corresponding to the sub-time offset Δ LPi does not meet the preset adjustment condition based on the round-trip time T i , that is, when it is determined that the round-trip time T LPi corresponding to the time synchronization subprocess exceeds the preset round-trip range, the mobile phone 100 does not need to adjust the sub-time offset Δ i and may directly use the sub-time offset Δ i as the adjusted sub-time offset Δ i '. The adjusted sub-time offset Δ i ' may be understood as a concept related to the time synchronization subprocess.
[0221] S1009: The mobile phone 100 adjusts the sub-time offset Δ i in accordance with the preset adjustment logic, obtains the adjusted sub-time offset Δ i ', and executes S1010.
[0222] In some embodiments of the present application, when it is determined that the round-trip time T LPi of the mobile phone 100 based on the round-trip time T i corresponding to the sub-time offset Δ LPi satisfies the preset adjustment condition, that is, when it is determined that the round-trip time T i is within the preset round-trip range, the mobile phone 100 needs to adjust the sub-time offset Δ i in accordance with the preset adjustment logic and obtains the adjusted sub-time offset Δ
[0223] In some implementations of the present application, the preset adjustment logic may be a preset correction logic. The correction logic is preset instruction information that instructs the mobile phone 100 to correct the sub-time offset Δ i . The mobile phone 100 may correct the sub-time offset Δ i in accordance with the preset correction logic and obtain the corrected sub-time offset Δ i '.
[0224] For example, when it is determined that the round-trip time T LPi is greater than the first preset threshold thr1, the mobile phone 100 subtracts the correction compensation amount δ from the sub-time offset value Δ i . Note that the correction compensation amount δ may be an empirical value obtained by model training.
[0225] Specifically, the correction compensation amount δ can be obtained in the following manner. Determine the chips in the mobile phone 100 and the chips in the tag device 200, and the sub-time offset Δ iMeasure it. Then, measure the difference between the sub-time offset Δ with a large variation range and other sub-time offsets from i , and use the measured difference as the correction compensation amount δ. i From ,
[0226] , , in some implementations of the present application, the correction compensation amount δ may be the Bluetooth interval T0.
[0226] In some implementations of the present application, the correction compensation amount δ may be the Bluetooth interval T0.
[0227] The above process is performed based on measurement data. The sub-time offset values are shown in Fig. 7(a). The sub-time offset in the initial phase has a large error. When directly using the first W sub-processes to calculate the average time offset, if W is set to different values (for example, W = 20, 40, 60, 80, or 100), the comprehensive time offset is clearly very different. Therefore, set thr1 to 45 ms, set delta to 15 ms, and the sub-time offset can be corrected based on the round-trip time in Fig. 7(b). In this case, the corrected sub-time offset is shown in Fig. 7(c). Comparing Fig. 7(a) and Fig. 7(c), it can be easily seen that based on the corrected sub-time offset, the comprehensive time offset Δ is a stable value regardless of the value of W.
[0228] In some other alternative implementations of the present application, the preset adjustment logic may be preset filtering logic. The filtering logic is preset instruction information for instructing the mobile phone 100 to filter the sub-time offset Δ. The mobile phone 100 may filter the sub-time offset Δ according to the preset filtering logic and obtain the selected sub-time offset Δ'. The filtering logic filters the sub-time offset Δ corresponding to the time synchronization sub-process when the round-trip time T meets the preset adjustment condition, and filters the sub-time offset Δ corresponding to the time synchronization sub-process when the round-trip time T does not meet the preset adjustment condition. i is preset instruction information for instructing the mobile phone 100 to filter the sub-time offset Δ. The mobile phone 100 filters the sub-time offset Δ according to the preset filtering logic and may obtain the selected sub-time offset Δ i '. i The filtering logic filters the sub-time offset Δ corresponding to the time synchronization sub-process when the round-trip time T LPi meets the preset adjustment condition, and filters the sub-time offset Δ corresponding to the time synchronization sub-process when the round-trip time T i does not meet the preset adjustment condition, and when the round-trip time T LPi does not meet the preset adjustment condition, the sub-time offset Δ corresponding to the time synchronization sub-processi can be reserved. The mobile phone 100 uses preset filtering logic to filter the sub-time offsets Δ corresponding to N time-synchronized sub-processes, and obtains M selected sub-time offsets Δ i '. Here, N ≥ M. i Based on this, when the round-trip time T satisfies the preset adjustment condition, the mobile phone 100 filters the sub-time offset Δ corresponding to the time-synchronized sub-process using filtering logic. When the round-trip time T does not satisfy the preset adjustment condition, the sub-time offset Δ corresponding to the time-synchronized sub-process can be reserved. The selected sub-time offset is denoted as Δ
[0229] '. For example, when the mobile phone 100 determines that the round-trip time T is less than the second preset threshold thr2, or when the mobile phone 100 determines that the round-trip time T is greater than the third preset threshold thr3, the sub-time offset Δ corresponding to the time-synchronized sub-process is deleted. Alternatively, when the mobile phone 100 determines that the round-trip time T of the time-synchronized sub-process is greater than or equal to the second preset threshold thr2 and less than or equal to the third preset threshold thr3, the sub-time offset Δ corresponding to the time-synchronized sub-process is reserved. LPi '. i '. LPi '. i '. i '. LPi '. LPi '. i '. LPi '. i '.
[0230] Note that in the above implementation, the mobile phone 100 may correct the sub-time offset Δ using correction logic, or filter the sub-time offset Δ using filtering logic. However, the above implementation is based on the mobile phone 100 having the sub-time offset Δ i '. i '. iis just a part of the implementation for adjustment. In some other implementations of this application, in this application, the mobile phone 100 uses a combination of the above two implementations to obtain the sub-time offset Δ i may be further adjusted. This is not specifically limited in this application.
[0231] For example, the mobile phone 100 first uses the correction logic to correct the sub-time offset Δ i to obtain the corrected sub-time offset Δ i '. Next, the mobile phone 100 uses the filtering logic to filter the corrected sub-time offset Δ i ' to obtain the selected sub-time offset Δ i ''. That is, the mobile phone 100 first compensates the sub-time offset Δ i and then filters the sub-time offset Δ i ' obtained by the compensation to determine whether to discard the sub-time offset Δ i '.
[0232] As another example, the mobile phone 100 first uses the filtering logic to filter the sub-time offset Δ i to obtain the selected sub-time offset Δ i '. Next, the mobile phone 100 corrects the selected sub-time offset Δ i ' to obtain the corrected sub-time offset Δ i ''. That is, the mobile phone 100 first filters the sub-time offset Δ i to determine whether to discard the sub-time offset Δ i and then compensates the reserved sub-time offset Δ i ’.
[0233] S1010: The mobile phone 100 uses the adjusted sub-time offset Δ j corresponding to the Bluetooth-based time synchronization process as the adjusted sub-time offset Δ i '. The range of the value of j is as follows:
Number
[0234] The foregoing embodiments are merely part of the implementation of the time synchronization solution in one of the time synchronization sub - processes in the present application. The tag device 200 can send a time synchronization frame to the mobile phone 100, the mobile phone 100 can send a confirmation response message to the tag device 200 in response to the time synchronization frame, and the tag device 200 can send the time synchronization transmission time point T TX and the confirmation response reception time point T E to the mobile phone 100. The implementation of the time synchronization solution is within the protection scope of the present application and will not be described one by one in the present application.
[0235] It can be seen that the Bluetooth - based time synchronization process includes a plurality of time synchronization sub - processes. After explaining the time synchronization solution in one of the sub - processes, the following several Bluetooth - based time synchronization processes will be briefly described.
[0236] In some implementations of the present application, the mobile phone 100 and the tag device 200 sequentially complete a plurality of time synchronization sub - processes. That is, after the previous time synchronization sub - process between the mobile phone 100 and the tag device 200 ends, the subsequent time synchronization sub - process between the mobile phone 100 and the tag device 200 starts.
[0237] In some implementations of the present application, the mobile phone 100 and the tag device 200 complete a plurality of time synchronization sub - processes in an interleaved manner. That is, before the previous time synchronization sub - process between the mobile phone 100 and the tag device 200 ends, the subsequent time synchronization sub - process between the mobile phone 100 and the tag device 200 has started.
[0238] In some implementations of the present application, when the mobile phone 100 and the tag device 200 complete a plurality of time synchronization sub-processes in an interleaved manner, it can be understood that the time synchronization steps of different time synchronization sub-processes may be combined into one step. Details are not described here.
[0239] In some embodiments of the present application, after S1001 - S1006 corresponding to a plurality of time synchronization sub-processes are completed between the mobile phone 100 and the tag device 200, S1007 - S1010 corresponding to the plurality of time synchronization sub-processes are executed. The execution order of S1001 - S1006 corresponding to the plurality of time synchronization sub-processes is not particularly limited in the present application, and the execution order of S1007 - S1010 corresponding to the plurality of time synchronization sub-processes is also not particularly limited in the present application.
[0240] It will be understood that the above implementations are part of the embodiments of the plurality of time synchronization sub-processes between the mobile phone 100 and the tag device 200. The plurality of time synchronization sub-processes between the mobile phone 100 and the tag device 200 in the present application can also be obtained, alternatively, by splitting and combining the above implementations. Any implementation capable of completing a plurality of time synchronization sub-processes between the mobile phone 100 and the tag device 200 is within the protection scope of the present application and will not be described individually in this specification.
[0241] S903: The mobile phone 100 obtains the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 based on the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process j (j = 1, 2, 3,... or M).
[0242] The comprehensive time offset represents the offset value between the clock time of the mobile phone 100 and the clock time of the tag device 200, which is obtained based on the entire Bluetooth-based time synchronization process.
[0243] In some embodiments of the present application, the mobile phone 100 is the adjusted sub-time offset Δj Based on this, a comprehensive time offset Δ between the mobile phone 100 and the tag device 200 is determined. In some implementations of the present application, the mobile phone 100 uses the average value of M adjusted sub-time offsets Δ j as the comprehensive time offset Δ between the mobile phone 100 and the tag device 200.
[0244] In the above implementation, the two-way time synchronization in PTP-based time synchronization is adjusted to one-way time synchronization, so the time synchronization period is shortened. This provides further assistance for real-time applications, saves time, and improves practicality. In addition, by adjusting the sub-time offset, abnormal sub-time offsets in the time synchronization sub-process are reduced, and the accuracy and stability of the comprehensive time offset are improved. When the comprehensive time offset is used for distance calculation, the distance measurement accuracy can be improved compared with PTP-based time synchronization.
[0245] In particular, when the sub-time offset is represented by the clock time of the mobile phone 100 - the clock time of the tag device 200, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated as follows:
Equation
Equation
[0246] However, when the sub-time offset is represented by the clock time of the tag device 200 - the clock time of the mobile phone 100, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated as follows:
Number
Number
[0247] Application scenario 2
[0248] In application scenario 2, the mobile phone 100 sends a time synchronization frame to the tag device 200, and then the tag device 200 feeds back a confirmation response message to the mobile phone 100. Furthermore, the tag device 200 needs to send a response frame to the mobile phone 100. Based on this, a Bluetooth-based time synchronization solution applicable to application scenario 2 can also be defined as a sequential unidirectional Bluetooth-based time synchronization solution.
[0249] FIG. 11(a) is an interaction diagram of a forward unidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. FIG. 11(b) is an interaction diagram of the i-th time synchronization sub-process in the forward unidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. From FIG. 11(a), it can be seen that the Bluetooth-based time synchronization process includes multiple time synchronization sub-processes. FIG. 12 is a flowchart of a forward unidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. As shown in FIG. 12, in some embodiments of the present application, the forward unidirectional Bluetooth-based time synchronization solution applicable to application scenario 2 of the present application specifically includes the following steps:
[0250] S1201: The mobile phone 100 transmits a synchronization message to the tag device 200. The synchronization message is transmitted based on the mobile phone clock value T Sync The tag device 200 transmits the mobile phone clock value T Sync It is understood that S1201 is the same as S901, and the details will not be described again here.
[0251] S1202: The mobile phone 100 executes Bluetooth-based time synchronization with the tag device 200. The mobile phone 100 calculates a sub-time offset Δ corresponding to each time synchronization sub-process in the Bluetooth-based time synchronization process. i (i=1, 2, 3, ..., or N), and if the time synchronization sub-process satisfies the preset adjustment condition, determine the sub-time offset Δ i and adjust the adjusted sub-time offset Δ j (j=1, 2, 3, ..., or M), where N≧M.
[0252] As can be seen from FIGS. 11(a) and 11(b), the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. The Bluetooth-based time synchronization process represents the entire Bluetooth signal transmission process between the mobile phone 100 and the tag device in the entire Bluetooth-based time synchronization solution. The time synchronization sub-process represents the Bluetooth signal transmission period between the mobile phone 100 and the tag device. The Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes.
[0253] Hereinafter, for the sake of easy explanation and understanding, taking one of the time synchronization sub-processes as an example, the specific processing will be described in detail.
[0254] FIG. 13 is a flowchart of a time synchronization solution in one of the time synchronization sub-processes of FIG. 11(a). Hereinafter, with reference to FIGS. 11(a), 11(b) and FIG. 13, the time synchronization solution in one of the time synchronization sub-processes in the present application will be described in detail. As shown in FIG. 13, the time synchronization solution in one of the time synchronization sub-processes in the present application specifically includes the following steps.
[0255] S1301: The mobile phone 100 transmits a time synchronization frame to the tag device 200 and records the time synchronization transmission time point T when the time synchronization frame is transmitted. TX for recording.
[0256] The difference between the time synchronization frame of Application Scenario 1 and that of Application Scenario 2 is that the time synchronization frame of Application Scenario 2 represents the Bluetooth signal used to achieve time synchronization between two electronic devices and is transmitted from the mobile phone 100 to the tag device 200. The time synchronization reception time point T TX is recorded by the mobile phone 100 based on the local clock and is the time when the mobile phone 100 starts to transmit the time synchronization frame.
[0257] S1302: The tag device 200 receives the time synchronization frame transmitted by the mobile phone 100, and records the time synchronization reception time point T RX when the time synchronization frame is received. The time synchronization reception time point T RX is recorded by the tag device 200 based on the local clock, and is the time when the tag device 200 receives the time synchronization frame.
[0258] Note that since the time synchronization reception time point T RX is the time recorded by the tag device 200 based on the local clock, in order for the mobile phone 100 to realize the time synchronization solution between the mobile phone 100 and the tag device 200 using the time synchronization reception time point T RX , it is necessary to transmit the time synchronization reception time point T RX to the mobile phone 100. Hereinafter, several transmission methods for the tag device 200 to transmit the time synchronization reception time point T RX to the mobile phone 100 will be briefly described.
[0259] In some embodiments of the present application, the tag device 200 uses another transmission signal to transmit the time synchronization reception time point T RX to the mobile phone 100. Specifically, after the tag device 200 transmits the time synchronization frame to the mobile phone 100, the tag device 200 uses another transmission signal to transmit the time synchronization reception time point T RX corresponding to the time synchronization frame to the mobile phone 100.
[0260] In some implementations of the present application, the other transmission signal may be a transmission signal in any subsequent sub-process. For example, the tag device 200 uses the time synchronization frame corresponding to the i-th time synchronization sub-process to transmit the time synchronization reception time point T RX(i-1) corresponding to the (i - 1)-th time synchronization sub-process to the mobile phone 100. That is, the time synchronization frame in the i-th time synchronization sub-process transmitted by the tag device 200 to the mobile phone 100 transmits the time synchronization reception time point T RX(i-1) corresponding to the (i - 1)-th time synchronization sub-process.
[0261] In some other alternative implementations of the present application, another transmission signal may be a separate transmission signal after the time synchronization frame. Details are not described herein.
[0262] S1303: In response to the time synchronization frame, the tag device 200 transmits a confirmation response message to the mobile phone 100. The confirmation response message refers to a spontaneous message of the tag device 200 that responds to the time synchronization frame in the Bluetooth protocol layer, and the spontaneous message is not a message actively transmitted by the upper layer application of the tag device 200.
[0263] In some implementations of the present application, the confirmation response message may be a confirmation. The confirmation is a spontaneous message of the tag device 200 that responds to the instruction of the Bluetooth protocol layer. The confirmation does not transmit upper layer data.
[0264] S1304: The mobile phone 100 receives the confirmation response message transmitted by the tag device 200, and records the confirmation response reception time point T E when the confirmation response message is received. The confirmation response reception time point T E is recorded by the mobile phone 100 based on the local clock, and represents the time when the mobile phone 100 receives the confirmation response message.
[0265] In some implementations of the present application, the confirmation response reception time point T E may be the callback time reported by the lowest layer chip in the mobile phone 100 after the lowest layer chip receives the confirmation. That is, the confirmation response reception time point T E is the time recorded by the mobile phone 100 based on the local clock and when the mobile phone 100 receives the confirmation.
[0266] S1305: The tag device 200 transmits a response frame to the mobile phone 100, and the response frame transmits the time synchronization reception time point T RX .
[0267] Note that the time synchronization reception time point TRX Since it is the time recorded by the tag device 200 based on the local clock, when the mobile phone 100 receives time synchronization RX To achieve a time synchronization solution between the mobile phone 100 and the tag device 200 using the time synchronization reception time point T RX it is necessary to send it to the mobile phone 100.
[0268] In some embodiments of the present application, after the mobile phone 100 sends a time synchronization frame to the tag device 200, the tag device 200 uses a response frame to send the time synchronization reception time point T RX to the mobile phone 100.
[0269] In some embodiments of the present application, after the tag device 200 sends a confirmation response message to the mobile phone 100, the tag device 200 sends a response frame to the mobile phone 100. In some other alternative implementations of the present application, after the mobile phone 100 sends a time synchronization frame to the tag device 200 and before the tag device 200 sends a confirmation response message to the mobile phone 100, the tag device 200 sends a response frame to the mobile phone 100.
[0270] S1306: The mobile phone 100 receives a response frame and calculates a sub-time offset Δ TX based on at least some of the data of the time synchronization transmission time point T RX , the time synchronization reception time point T E , and the confirmation response reception time point T. i
[0271] The difference from Application Scenario 1 is as follows: When the sub-time offset is represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100, the sub-time offset Δ i1 corresponding to the i-th time synchronization subprocess can be calculated using Equation (10).
Equation
[0272] In Equation (10), Δ i1 is the sub-time offset determined based on the i-th time synchronization sub-process, and T TXi is the time synchronization transmission time in the i-th time synchronization sub-process, and T RXi is the time synchronization reception time in the i-th time synchronization sub-process.
[0273] The difference from Application Scenario 1 is as follows: When the sub-time offset is represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100, alternatively, Equation (11) is used to calculate the sub-time offset Δ i1 corresponding to the i-th time synchronization sub-process.
Equation
[0274] In Equation (11), Δ i2 is the sub-time offset determined based on the i-th time synchronization sub-process, and T Ei is the confirmation response reception time in the i-th time synchronization sub-process, and T RXi is the time synchronization reception time in the i-th time synchronization sub-process.
[0275] S1307: The mobile phone 100 calculates the round-trip time T LPi and determines whether the time synchronization sub-process corresponding to the sub-time offset Δ LPi satisfies the preset adjustment condition based on the round-trip time T i . For the definition and calculation method of the round-trip time T LPi , refer to S1007. Details are not described again here. If the determination result is negative, the time synchronization sub-process does not satisfy the preset adjustment condition, indicating that the sub-time offset Δ i corresponding to the time synchronization sub-process satisfies the preset requirements (for example, within the above convergence range). That is, the sub-time offset Δ iThere is no need to adjust, and S1308 is executed. In other cases, if the determination result is affirmative, the time synchronization sub-process satisfies the preset adjustment condition, and the sub-time offset Δ i does not meet the preset requirements (for example, it is outside the above convergence range). That is, it is necessary to adjust the sub-time offset Δ i , and S1309 is executed. It is understood that S1307 is the same as S1007, and the details will not be described again here.
[0276] S1308: The mobile phone 100 uses the adjusted sub-time offset Δ i as the adjusted sub-time offset Δ i ' and executes S1310. It is understood that S1308 is the same as S1008, and the details will not be described again here.
[0277] S1309: The mobile phone 100 adjusts the sub-time offset Δ i according to the preset adjustment logic, obtains the adjusted sub-time offset Δ i ', and executes S1310. It is understood that S1309 is the same as S1009, and the details will not be described again here.
[0278] S1310: The mobile phone 100 uses the adjusted sub-time offset Δ j corresponding to the Bluetooth-based time synchronization process as the adjusted sub-time offset Δ i '. It is understood that S1310 is the same as S1010, and the details will not be described again here. The foregoing embodiments are only part of the implementation of the time synchronization solution in one of the time synchronization sub-processes in the present application. The mobile phone 100 can send a time synchronization frame to the tag device 200, the tag device 200 can send an acknowledgment message to the mobile phone 100 in response to the time synchronization frame, and the tag device 200 can send the time synchronization reception time point T RX to the mobile phone 100. Any implementation of the time synchronization solution can be within the protection scope of the present application, and will not be described one by one in the present application.
[0279] It can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. For a specific Bluetooth-based time synchronization process in Application Scenario 2, refer to the Bluetooth-based time synchronization process in Application Scenario 1. Details will not be described again here.
[0280] S1203: The mobile phone 100 obtains an adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process j (j = 1, 2, 3,... or M) to obtain an overall time offset Δ between the mobile phone 100 and the tag device 200. It is understood that S1203 is the same as S903, and details will not be described again here.
[0281] In the foregoing implementation, the two-way time synchronization in PTP-based time synchronization is adjusted to one-way time synchronization, so the time synchronization period is shortened. This provides further assistance to real-time applications, saves time, and improves practicality. In addition, by adjusting the sub-time offset, abnormal sub-time offsets in the time synchronization sub-process are reduced, and the accuracy and stability of the overall time offset are improved. When using the overall time offset for distance calculation, the distance measurement accuracy can be improved compared to PTP-based time synchronization.
[0282] In particular, when the sub-time offset is represented by the clock time of the mobile phone 100 - the clock time of the tag device 200, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated as follows:
Equation
Equation
[0283] However, when the sub-time offset is represented by the clock time of the tag device 200 - the clock time of the mobile phone 100, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated as follows:
Equation
Equation
[0284] Application scenario 3
[0285] In application scenario 3, the mobile phone 100 transmits a time synchronization frame to the tag device 200, and then the tag device 200 feeds back a confirmation response message to the mobile phone 100. Furthermore, the tag device 200 needs to transmit a response frame to the mobile phone 100. Based on this, a Bluetooth-based time synchronization solution applicable to application scenario 3 can also be defined as a forward and backward Bluetooth-based time synchronization solution.
[0286] FIG. 14(a) is an interaction diagram of a forward bidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. FIG. 14(b) is an interaction diagram of the i-th time synchronization sub-process in the forward bidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. From FIG. 14(b), it can be seen that the Bluetooth-based time synchronization process includes multiple time synchronization sub-processes. FIG. 15 is a flowchart of a forward bidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. As shown in FIG. 15, in some embodiments of the present application, the forward bidirectional Bluetooth-based time synchronization solution applicable to application scenario 3 of the present application specifically includes the following steps:
[0287] S1501: The mobile phone 100 transmits a synchronization message to the tag device 200. The synchronization message is transmitted based on the mobile phone clock value T Sync The tag device 200 transmits the mobile phone clock value T Sync Based on this, set the tag clock value of the tag device 200. It is understood that S1501 is the same as S1201, and the details will not be described again here.
[0288] S1502: The mobile phone 100 executes Bluetooth-based time synchronization with the tag device 200. The mobile phone 100 calculates a sub-time offset Δ corresponding to each time synchronization sub-process in the Bluetooth-based time synchronization process. i (i=1, 2, 3, ..., or N), and if the time synchronization sub-process satisfies the preset adjustment condition, determine the sub-time offset Δ i and adjust the adjusted sub-time offset Δ j (j=1, 2, 3, ..., or M), where N≧M.
[0289] From FIGS. 14(a) and 14(b), it can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. The Bluetooth-based time synchronization process represents the entire transmission process of the Bluetooth signal between the mobile phone 100 and the tag device in the entire Bluetooth-based time synchronization solution. The time synchronization sub-process represents the transmission period of the Bluetooth signal between the mobile phone 100 and the tag device. The Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes.
[0290] Hereinafter, for the sake of easy explanation and understanding, taking one of the time synchronization sub-processes as an example, the specific processing will be described in detail.
[0291] FIG. 16 is a flowchart of the time synchronization solution in one of the time synchronization sub-processes of FIG. 14(a). Hereinafter, with reference to FIGS. 14(a), 14(b) and 16, the time synchronization solution in one of the time synchronization sub-processes in the present application will be described in detail. As shown in FIG. 16, the time synchronization solution in the time synchronization sub-process in the present application specifically includes the following steps.
[0292] S1601: The mobile phone 100 transmits a time synchronization frame to the tag device 200 and records the time synchronization transmission time point T when the time synchronization frame is transmitted. TX,P It is understood that S1601 is the same as S1301. For details, refer to S1301. Details will not be described again here.
[0293] S1602: The tag device 200 receives the time synchronization frame transmitted by the mobile phone 100 and records the time synchronization reception time point T when the time synchronization frame is received. RX,T It is understood that S1602 is the same as S1302. For details, refer to S1302. Details will not be described again here.
[0294] S1603: The tag device 200 transmits a confirmation response message to the mobile phone 100 in response to the time synchronization frame. It is understood that S1603 is the same as S1303, and the details will not be described again here.
[0295] S1604: The mobile phone 100 receives the confirmation response message transmitted by the tag device 200, and records the confirmation response reception time point T E at which the confirmation response message is received. It is understood that S1604 is the same as S1304, and the details will not be described again here.
[0296] S1605: The tag device 200 transmits a response frame to the mobile phone 100, and the response frame transmits the time synchronization reception time point T RX,T and the response transmission time point T TX,T . The response transmission time point T TX,T is the time when the tag device 200 starts to transmit the response frame to the mobile phone 100, and may be a predetermined value. That is, the response transmission time point T TX,T is a value determined before the tag device 200 transmits the response frame to the mobile phone 100.
[0297] Note that since the time synchronization reception time point T RX,T and the response transmission time point T TX,T are the times recorded by the tag device 200 based on the local clock, in order to realize the time synchronization solution between the mobile phone 100 and the tag device 200 using the time synchronization reception time point T RX,T and the response transmission time point T TX,T , it is necessary to transmit the time synchronization reception time point T RX,T and the response transmission time point T TX,T to the mobile phone 100.
[0298] In some embodiments of the present application, after the mobile phone 100 transmits the time synchronization frame to the tag device 200, the tag device 200 uses the response frame to transmit the time synchronization reception time point T RX,T and the response transmission time point T TX,T to the mobile phone 100.
[0299] In some embodiments of the present application, after the tag device 200 transmits a confirmation response message to the mobile phone 100, the tag device 200 transmits a response frame to the mobile phone 100. In some other alternative implementations of the present application, after the mobile phone 100 transmits a time synchronization frame to the tag device 200 and before the tag device 200 transmits a confirmation response message to the mobile phone 100, the tag device 200 transmits a response frame to the mobile phone 100.
[0300] S1606: The mobile phone 100 receives a response frame and, based on at least some of the data of TX,P the time synchronization transmission time point T, RX,T the time synchronization reception time point T, E the confirmation response reception time point T, TX,T and the response transmission time point T, i calculate a sub-time offset Δ.
[0301] Similar to Application Scenario 2, when the sub-time offset is represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100, the sub-time offset Δ i1 corresponding to the i-th time synchronization sub-process can be calculated using Equation (12).
Equation
[0302] In Equation (12), Δ i1 is the sub-time offset determined based on the i-th time synchronization sub-process, T TXi,P is the time synchronization transmission time point in the i-th time synchronization sub-process, and T RXi,T is the time synchronization reception time point in the i-th time synchronization sub-process.
[0303] Similar to Application Scenario 2, when the sub-time offset is represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100, alternatively, the sub-time offset Δ i1can be calculated.
Number
[0304] In Equation (13), Δ i2 is the sub-time offset determined based on the i-th time synchronization sub-process, and T Ei is the time point when the confirmation response is received in the i-th time synchronization sub-process, and T RXi,T is the time point when the time synchronization is received in the i-th time synchronization sub-process.
[0305] The difference from Application Scenario 2 is as follows: The sub-time offset Δ i3 in Application Scenario 3 can, alternatively, be calculated using the time synchronization transmission time point T TXi,P the time synchronization reception time point T RXi,T the response reception time point T RXi,P and the response transmission time point T TXi,T Specifically, the sub-time offset Δ i3 in Application Scenario 3 can, alternatively, be calculated using Equation (14).
Number
[0306] In Equation (14), Δ i3 is the sub-time offset determined based on the i-th time synchronization sub-process, and T TXi,P is the time synchronization transmission time point in the i-th time synchronization sub-process, and T RXi,T is the time synchronization reception time point in the i-th time synchronization sub-process, and T RXi,P is the response reception time point in the i-th time synchronization sub-process, and T TXi,T is the response transmission time point in the i-th time synchronization sub-process.
[0307] The difference from Application Scenario 2 is as follows: The sub-time offset Δ i4 in Application Scenario 3 can, alternatively, be the response reception time point TRXi,P and the response transmission time point T TXi,T can be calculated using. Specifically, the sub-time offset Δ i4 can alternatively be calculated using Equation (15).
Equation
[0308] In Equation (15), Δ i4 is the sub-time offset determined based on the i-th time synchronization sub-process, T RXi,P is the response reception time point in the i-th time synchronization sub-process, and T TXi,T is the response transmission time point in the i-th time synchronization sub-process.
[0309] S1607: The mobile phone 100 calculates the round-trip time T LPi and determines whether the time synchronization sub-process corresponding to the sub-time offset Δ LPi satisfies the preset adjustment conditions based on the round-trip time T i . For the definition and calculation method of the round-trip time T LPi , refer to S1007. Details are not described again here. If the determination result is negative, the time synchronization sub-process does not satisfy the preset adjustment conditions, indicating that the sub-time offset Δ i corresponding to the time synchronization sub-process satisfies the preset requirements (for example, within the above convergence range). That is, there is no need to adjust the sub-time offset Δ i , and S1608 is executed. In other cases, if the determination result is positive, the time synchronization sub-process satisfies the preset adjustment conditions, indicating that the sub-time offset Δ i corresponding to the time synchronization sub-process does not satisfy the preset requirements (for example, outside the above convergence range). That is, it is necessary to adjust the sub-time offset Δ i , and S1609 is executed. It is understood that S1607 is the same as S1007, and details are not described again here.
[0310] S1608: The mobile phone 100 uses the adjusted sub-time offset Δ i as the adjusted sub-time offset Δ i ' and executes S1610. It is understood that S1608 is the same as S1008, and the details will not be described again here.
[0311] S1609: The mobile phone 100 adjusts the sub-time offset Δ i according to the preset adjustment logic, obtains the adjusted sub-time offset Δ i ' and executes S1610. It is understood that S1609 is the same as S1009, and the details will not be described again here.
[0312] S1610: The mobile phone 100 uses the adjusted sub-time offset Δ j as the adjusted sub-time offset Δ i ' for the Bluetooth-based time synchronization process. It is understood that S1610 is the same as S1010, and the details will not be described again here. The foregoing embodiments are only part of the implementation of the time synchronization solution in one of the time synchronization sub-processes in the present application. The mobile phone 100 can send a time synchronization frame to the tag device 200, the tag device 200 can send a confirmation response message to the mobile phone 100 in response to the time synchronization frame, and the tag device 200 can send the time synchronization reception time point T RX,T and the response transmission time point T TX,T to the mobile phone 100. Any implementation of the time synchronization solution can be within the protection scope of the present application, and will not be described one by one in the present application.
[0313] It can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. For the specific Bluetooth-based time synchronization process in Application Scenario 3, refer to the Bluetooth-based time synchronization process in Application Scenario 1. The details will not be described again here.
[0314] S1503: The mobile phone 100 obtains the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 based on the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process (j = 1, 2, 3,... or M). It is understood that S1503 is the same as S903, and the details will not be described again here. j (j = 1, 2, 3,... or M). It is understood that S1503 is the same as S903, and the details will not be described again here.
[0315] In the above-described embodiment, by adjusting the sub-time offset, abnormal sub-time offsets in the time synchronization sub-process are reduced, and the accuracy and stability of the comprehensive time offset are improved. When the comprehensive time offset is used for distance calculation, the distance measurement accuracy can be improved compared to PTP-based time synchronization.
[0316] In particular, when the sub-time offset is represented by the clock time of the mobile phone 100 - the clock time of the tag device 200, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated by any one of the following methods:
Equation
Equation
[0317] However, when the sub-time offset is represented by the clock time of the tag device 200 - the clock time of the mobile phone 100, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated by any one of the following methods:
Equation
Number
[0318] Application scenario 4
[0319] In application scenario 4, the tag device 200 sends a time synchronization frame to the mobile phone 100, and then the mobile phone 100 feeds back a confirmation response message to the tag device 200. Furthermore, the mobile phone 100 needs to send a response frame to the tag device 200. Based on this, a Bluetooth-based time synchronization solution applicable to application scenario 4 can also be defined as an inverse bidirectional Bluetooth-based time synchronization solution.
[0320] FIG. 17(a) is an interaction diagram of a reverse bidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. FIG. 17(b) is an interaction diagram of a part of the i-th time synchronization subprocess and the (i + 1)-th time synchronization subprocess in the reverse bidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. The shaded area represents the i-th time synchronization subprocess, and the white area below the shaded area represents a part of the (i + 1)-th time synchronization subprocess. From FIG. 17(a), it can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization subprocesses. FIG. 18 is a flowchart of a reverse bidirectional Bluetooth-based time synchronization solution according to some embodiments of the present application. As shown in FIG. 18, in some embodiments of the present application, the reverse bidirectional Bluetooth-based time synchronization solution applicable to application scenario 4 of the present application specifically includes the following steps.
[0321] S1801: The mobile phone 100 sends a synchronization message to the tag device 200, and the synchronization message transmits the mobile phone clock value T of the mobile phone 100. Sync The tag device 200 sets the tag clock value of the tag device 200 based on the mobile phone clock value T. Sync It is understood that S1801 is the same as S901, and the details will not be described again here.
[0322] S1802: The mobile phone 100 performs Bluetooth-based time synchronization with the tag device 200. The mobile phone 100 determines the sub-time offset Δ corresponding to each time synchronization subprocess in the Bluetooth-based time synchronization process (i = 1, 2, 3,..., or N). When the time synchronization subprocess meets the preset adjustment condition, according to the preset adjustment logic, the sub-time offset Δ corresponding to each time synchronization subprocess is adjusted, and the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process is obtained (j = 1, 2, 3,..., or M). Here, N≥M. i (i = 1, 2, 3,..., or N) and, when the time synchronization subprocess meets the preset adjustment condition, according to the preset adjustment logic, the sub-time offset Δ corresponding to each time synchronization subprocess is adjusted to obtain the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process (j = 1, 2, 3,..., or M). Here, N≥M. i corresponding to each time synchronization subprocess is adjusted to obtain the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process (j = 1, 2, 3,..., or M). Here, N≥M. j (j = 1, 2, 3,..., or M). Here, N≥M.
[0323] As can be seen from FIGS. 17(a) and 17(b), the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. The Bluetooth-based time synchronization process represents the entire Bluetooth signal transmission process between the mobile phone 100 and the tag device in the entire Bluetooth-based time synchronization solution. The time synchronization sub-process represents the Bluetooth signal transmission period between the mobile phone 100 and the tag device. The Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes.
[0324] Hereinafter, for the sake of easy explanation and understanding, one of the time synchronization sub-processes will be taken as an example to explain the specific processing in detail.
[0325] FIGS. 19A and 19B are flowcharts of the time synchronization solution in one of the time synchronization sub-processes of FIG. 17(a). Hereinafter, with reference to FIGS. 17(a), 17(b), 19A and 19B, the time synchronization solution in the time synchronization sub-process in the present application will be described in detail. As shown in FIGS. 19A and 19B, the time synchronization solution in one of the time synchronization sub-processes in the present application specifically includes the following steps.
[0326] S1901: The tag device 200 transmits a time synchronization frame to the mobile phone 100 and records the time synchronization transmission time point T when the time synchronization frame is transmitted. TX,T It is understood that S1901 is the same as S1001. For details, refer to S1001. Details will not be described again here.
[0327] S1902: The mobile phone 100 receives the time synchronization frame transmitted by the tag device 200 and records the time synchronization reception time point T when the time synchronization frame is received. RX,P It is understood that S1902 is the same as S1002. For details, refer to S1002. Details will not be described again here.
[0328] S1903: The mobile phone 100 transmits a confirmation response message to the tag device 200 in response to the time synchronization frame. It is understood that S1603 is the same as S1003, and the details will not be described again here.
[0329] S1904: The tag device 200 receives the confirmation response message transmitted by the mobile phone 100, and records the confirmation response reception time point T E at which the confirmation response message is received. It is understood that S1904 is the same as S1004, and the details will not be described again here.
[0330] S1905: The mobile phone 100 transmits a response frame to the tag device 200, and records the response transmission time point T TX,P when the response frame is transmitted. The response transmission time point T TX,P is the time when the mobile phone 100 starts to transmit the response frame to the tag device 200, and may be a predetermined value. That is, the response transmission time point T TX,P is a value determined before the mobile phone 100 transmits the response frame to the tag device 200.
[0331] S1906: The tag device 200 receives the response frame, and records the response reception time point T RX,T when the response frame is received.
[0332] S1907: The tag device 200 transmits a feedback message to the mobile phone 100. The feedback message includes the time synchronization transmission time point T TX,T , the response reception time point T RX,T , and the confirmation response reception time point T E .
[0333] Note that since the time synchronization transmission time point T TX,T , the response reception time point T RX,T , and the confirmation response reception time point T E are the times recorded by the tag device 200 based on its local clock, the time synchronization transmission time point T TX,T , the response reception time point T RX,T, and the confirmation response reception time point T E To enable the mobile phone 100 to implement a time synchronization solution between the mobile phone 100 and the tag device 200 using the time synchronization transmission time point T TX,T , the response reception time point T RX,T , and the confirmation response reception time point T E need to be transmitted to the mobile phone 100.
[0334] In some embodiments of the present application, after the tag device 200 transmits a response frame to the mobile phone 100, the tag device 200 uses the time synchronization frame in a subsequent sub-process to determine the time synchronization transmission time point T TX,T , the response reception time point T RX,T , and the confirmation response reception time point T E and transmit them to the mobile phone 100. That is, the feedback message reuses the time synchronization frame in a subsequent sub-process. For example, the time synchronization frame of the i-th sub-process includes the time synchronization transmission time point T TX(i-1),T , the response reception time point T RX(i-1),T , and the confirmation response reception time point T E(i-1) corresponding to the (i - 1)-th time synchronization sub-process. The tag device 200 uses the time synchronization frame of the i-th sub-process to transmit the time synchronization transmission time point T TX(i-1),T , the response reception time point T RX(i-1),T , and the confirmation response reception time point T E(i-1) to the mobile phone 100.
[0335] In some implementations of the present application, alternatively, after the tag device 200 transmits a frame to the mobile phone 100, it uses another frame to transmit the time synchronization transmission time point T TX,T , the response reception time point T RX,T , and the confirmation response reception time point T E to the mobile phone 100. There may be one or more separate frames, which are not specifically limited in the present application.
[0336] S1908: The mobile phone 100 receives the feedback message and determines the time synchronization transmission time point T TX,T , the time synchronization reception time point T RX,P, response transmission time point T TX,P , response reception time point T RX,T and confirmation response reception time point T E Based on at least some of the data of, sub-time offset Δ i is calculated.
[0337] Similar to Application Scenario 1, when the sub-time offset is represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100, the sub-time offset Δ i1 corresponding to the i-th time synchronization sub-process can be calculated using Equation (16).
Equation
[0338] In Equation (16), Δ i1 is the sub-time offset determined based on the i-th time synchronization sub-process, T RXi,P is the time synchronization transmission time point in the i-th time synchronization sub-process, T TXi,T is the time synchronization reception time point in the i-th time synchronization sub-process.
[0339] Similar to Application Scenario 1, when the sub-time offset is represented by subtracting the clock time of the tag device 200 from the clock time of the mobile phone 100, alternatively, the sub-time offset Δ i2 corresponding to the i-th time synchronization sub-process can be calculated using Equation (17).
Equation
[0340] In Equation (17), Δ i2 is the sub-time offset determined based on the i-th time synchronization sub-process, T RXi,P is the time synchronization reception time point in the i-th time synchronization sub-process, T Ei is the confirmation response reception time point in the i-th time synchronization sub-process.
[0341] The difference from Application Scenario 1 is as follows: the sub-time offset Δ i3 can, alternatively, be calculated using the time synchronization transmission time T TXi,P , the time synchronization reception time T RXi,T , the response reception time T RXi,P , and the response transmission time T TXi,T Specifically, the sub-time offset Δ i3 can, alternatively, be calculated using Equation (18).
Equation
[0342] In Equation (18), Δ i3 is the sub-time offset determined based on the i-th time synchronization sub-process, T RXi,P is the time synchronization reception time in the i-th time synchronization sub-process, T TXi,T is the time synchronization transmission time in the i-th time synchronization sub-process, T TXi,P is the response transmission time in the i-th time synchronization sub-process, T RXi,T is the response reception time in the i-th time synchronization sub-process.
[0343] The difference from Application Scenario 2 is as follows: the sub-time offset Δ i4 in Application Scenario 3 can, alternatively, be calculated using the response transmission time T TXi,P and the response reception time T RXi,T Specifically, the sub-time offset Δ i4 can, alternatively, be calculated using Equation (19).
Equation
[0344] In Equation (19), Δ i4 is the sub-time offset determined based on the i-th time synchronization sub-process, T TXi,Pis the response transmission time point in the i-th time synchronization sub-process, and T RXi,T is the response reception time point in the i-th time synchronization sub-process.
[0345] S1909: The mobile phone 100 calculates the round-trip time T LPi and determines whether the time synchronization sub-process corresponding to the sub-time offset Δ LPi satisfies the preset adjustment condition based on the round-trip time T i . For the definition and calculation method of the round-trip time T LPi , refer to S1007. Details are not described again here. If the determination result is negative, the time synchronization sub-process does not satisfy the preset adjustment condition, indicating that the sub-time offset Δ i corresponding to the time synchronization sub-process satisfies the preset requirements (for example, within the above convergence range). That is, there is no need to adjust the sub-time offset Δ i , and S1910 is executed. In other cases, if the determination result is affirmative, the time synchronization sub-process satisfies the preset adjustment condition, indicating that the sub-time offset Δ i corresponding to the time synchronization sub-process does not satisfy the preset requirements (for example, outside the above convergence range). That is, it is necessary to adjust the sub-time offset Δ i , and S1911 is executed. It is understood that S1909 is the same as S1007, and details are not described again here.
[0346] S1910: The mobile phone 100 uses the adjusted sub-time offset Δ i as the adjusted sub-time offset Δ i ' and executes S1912. It is understood that S1910 is the same as S1008, and details are not described again here.
[0347] S1911: The mobile phone 100 adjusts the sub-time offset Δ i to obtain the adjusted sub-time offset Δ iObtain ', and then execute S1912. It is understood that S1911 is the same as S1009, and the details will not be described again here.
[0348] S1912: The mobile phone 100 uses the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process. j As the adjusted sub-time offset Δ i '. It is understood that S1912 is the same as S1011, and the details will not be described again here. The foregoing embodiments are only part of the implementation of the time synchronization solution in one of the time synchronization sub-processes in this application. The tag device 200 can transmit a time synchronization frame to the mobile phone 100, the mobile phone 100 can transmit a confirmation response message to the tag device 200 in response to the time synchronization frame, and the tag device 200 can transmit the time synchronization transmission time point T TX,T , the response reception time point T RX,T , and the confirmation response reception time point T E to the mobile phone 100. Any implementation of the time synchronization solution can be within the protection scope of this application, and will not be described one by one in this application.
[0349] It can be seen that the Bluetooth-based time synchronization process includes a plurality of time synchronization sub-processes. For the specific Bluetooth-based time synchronization process in Application Scenario 4, refer to the Bluetooth-based time synchronization process in Application Scenario 1. The details will not be described again here.
[0350] S1803: The mobile phone 100 obtains the comprehensive time offset Δ between the mobile phone 100 and the tag device 200 based on the adjusted sub-time offset Δ corresponding to the Bluetooth-based time synchronization process. j (j = 1, 2, 3,... or M). It is understood that S1803 is the same as S903, and the details will not be described again here.
[0351] In the foregoing embodiments, by adjusting the sub-time offset, abnormal sub-time offsets in the time synchronization sub-process are reduced, and the accuracy and stability of the comprehensive time offset are improved. When the comprehensive time offset is used for distance calculation, the distance measurement accuracy can be improved compared with PTP-based time synchronization.
[0352] In particular, when the sub-time offset is represented by the clock time of the mobile phone 100 - the clock time of the tag device 200, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated by any one of the following methods:
Number
Number
[0353] However, when the sub-time offset is represented by the clock time of the tag device 200 - the clock time of the mobile phone 100, the sub-time offset between the mobile phone 100 and the tag device 200 may be calculated by any one of the following methods:
Number
Number
[0354] Furthermore, in some embodiments of the present application, Bluetooth interaction information (e.g., time synchronization information, transmission time information, temperature information) between the mobile phone 100 and the tag device 200 is stored in a log. The sound wave signal is stored in the recording module of the microphone.
[0355] FIG. 20 is a schematic diagram of the hardware structure of the mobile phone 100 according to an embodiment of the present application.
[0356] As shown in FIG. 20, a mobile phone 100 is used as an example. The mobile phone 100 includes a processor 110 (i.e., the processor of the mobile phone 100 described above), an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160 (i.e., the first communication module of the mobile phone 100 described above), an audio module 170 (i.e., the first audio module of the mobile phone 100 described above), a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 (i.e., the display module of the mobile phone 100 described above), a subscriber identification module (SIM) card interface 195, an EDL mode protection circuit, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, an optical proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0357] Processor 110 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent components or may be integrated into one or more processors.
[0358] The memory may also be disposed within processor 110 and configured to store instructions and data. In some embodiments, the memory within processor 110 is a cache memory. The memory can store instructions or data that have been recently or cyclically used by processor 110. When processor 110 needs to reuse an instruction or data, processor 110 can directly call the instruction or data from the memory. This avoids repeated accesses, reduces the latency of processor 110, thereby improving system efficiency. In some embodiments, processor 110 can call and execute instructions stored in the memory for the Bluetooth-based time synchronization method provided in the embodiments of the present application to implement the Bluetooth-based time synchronization method provided in the embodiments of the present application. In some other embodiments, the memory within processor 110 can be further configured to store data related to mobile phone 100.
[0359] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, a universal serial bus (USB) interface, and the like. In some other embodiments, after the mobile phone 100 enters the EDL mode, the host device can establish a communication connection to the mobile phone 100 via the USB interface and access the data in the mobile phone 100.
[0360] The charging management module 140 is configured to receive a charging input from a charger. When charging the battery 142, the charging management module 140 uses the power management module 141 to supply power to the mobile phone 100.
[0361] The power management module 141 is configured to connect to the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives inputs from the battery 142 and / or the charging management module 140 and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like.
[0362] The wireless communication function of the mobile phone 100 can be realized through the antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, baseband processor, etc.
[0363] Antenna 1 and antenna 2 are configured to transmit and receive electromagnetic wave signals.
[0364] The mobile communication module 150 can provide solutions for wireless communication including 2G, 3G, 4G, 5G, etc. applicable to the mobile phone 100. The mobile communication module 150 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through antenna 1, perform processing such as filtering or amplification on the received electromagnetic waves, and transmit the electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can further amplify the signal modulated by the modem processor and convert the signal into electromagnetic waves for radiation through antenna 1. In some embodiments, at least some functional modules in the mobile communication module 150 may be arranged in the processor 110. In some embodiments, at least some functional modules in the mobile communication module 150 may be arranged in the same component as at least some modules in the processor 110.
[0365] The wireless communication module 160 can provide a solution applicable to the mobile phone 100 for wireless communication including wireless local area network (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. The wireless communication module 160 may be one or more components that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering on the electromagnetic wave signal, and transmits the processed signal to the processor 110. The wireless communication module 160 can further receive the signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the processed signal into electromagnetic waves for radiation via the antenna 2.
[0366] The mobile phone 100 implements the display function by using a GPU, a display screen 194, an application processor, etc. The GPU is a microprocessor for image processing and is connected to the display screen 194 and the application processor. The GPU is configured to execute arithmetic and geometric calculations and render images. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0367] The display screen 194 is configured to display images, videos, etc. The display screen 194 includes a display panel. The display panel may use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini LED, a micro LED, a micro OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone 100 may include one display screen or N display screens 194, where N is a positive integer greater than 1.
[0368] The camera 193 is configured to capture still images or videos. The optical image of the object is generated through the lens and projected onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into a standard image signal in a format such as RGB or YUV. In some embodiments, the mobile phone 100 may include one camera or N cameras 193, where N is a positive integer greater than 1.
[0369] The external memory interface 120 can be configured to connect to an external memory card, such as a micro SD card, to expand the storage capacity of the mobile phone 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.
[0370] The internal memory 121 can be configured to store computer-executable program code. The executable program code includes instructions. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required by at least one function (e.g., an application function corresponding to a related function), etc. The data storage area can store data generated during the process of using the mobile phone 100. Further, the internal memory 121 may include a high-speed random access memory, and may further include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or a universal flash storage (UFS). The processor 110 executes the instructions stored in the internal memory 121 and / or the instructions stored in the memory disposed within the processor 110 to execute various functional applications of the mobile phone 100.
[0371] The mobile phone 100 can implement audio functions such as music playback or recording functions using an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, an application processor, etc.
[0372] The audio module 170 is configured to convert digital audio information into an analog audio signal for output, and is also configured to convert an analog audio input into a digital audio signal. The audio module 170 may be further configured to encode and decode audio signals.
[0373] Speaker 170A, also called a "loudspeaker", is configured to convert an audio electrical signal into an audio signal.
[0374] Receiver 170B, also called an "earpiece", is configured to convert an audio electrical signal into an audio signal.
[0375] Microphone 170C, also called a "mic", is configured to convert an audio signal into an electrical signal.
[0376] Headset jack 170D is configured to connect to a wired headset.
[0377] For example, mobile phone 100 may further include one or more of button 190, motor 191, indicator 192, and SIM card interface 195 (or eSIM card).
[0378] The EDL mode protection circuit is coupled to at least one pin of processor 110, and the EDL mode protection circuit includes at least one connection terminal. When the EDL mode protection circuit is enabled, for example, when the circuit enables at least one pin of the processor, mobile phone 100 can enter the EDL mode.
[0379] In some embodiments, the mobile phone 100 can further include buttons (not shown), for example, a volume up button, a volume down button, or a power button. The user can enable the mobile phone 100 to enter the EDL mode by operating the buttons of the mobile phone 100 in combination. For example, when the mobile phone 100 is in the off state, if it is detected that a plurality of buttons among the volume up button, the volume down button, and the power button are pressed simultaneously, the mobile phone 100 enters the EDL mode. For example, when the mobile phone 100 is in the off state, if it is detected that a plurality of buttons among the volume up button, the volume down button, and the power button are pressed simultaneously and the EDL mode protection circuit of the mobile phone 100 is in the enabled state, the mobile phone 100 enters the EDL mode.
[0380] It can be understood that the structure of the mobile phone 100 shown in this embodiment of the present application does not constitute a specific limitation on the mobile phone 100. In some other embodiments of the present application, the mobile phone 100 may include more or fewer components than those shown in the figures, combine some components, divide some components, or have different component arrangements. The components in the figures may be implemented by hardware, software, or a combination of software and hardware.
[0381] Furthermore, FIG. 21 is a schematic diagram of the structure of an electronic device in some other embodiments of the present application. In some embodiments of the present application, the electronic device may be a notebook computer 300. As shown in FIG. 21, the notebook computer 300 includes one or more processors 301, a system memory 302, a non-volatile memory (NVM) 303, a communication interface 304, an input / output (I / O) device 305, and a system control logic 306 configured to be coupled to the processor 301, the system memory 302, the non-volatile memory 303, the communication interface 304, and the input / output (I / O) device 305.
[0382] The processor 301 may include one or more processing units. For example, it can include a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Digital Signal Processor (DSP), a Micro-programmed Control Unit (MCU), an Artificial Intelligence (AI) processor, or a Field Programmable Gate Array (FPGA). A processing module or processing circuit that can include one or more single-core or multi-core processors. The processor 301 can be configured to execute instructions for implementing the access control method provided in the embodiments of the present application.
[0383] The system memory 302 is a volatile memory, for example, a Random Access Memory (RAM) or a Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM). The system memory is configured to temporarily store data and / or instructions. For example, in some embodiments, the system memory 302 can be configured to store the aforementioned information, etc., or can be configured to store instructions for a Bluetooth-based time synchronization method.
[0384] The non-volatile memory 303 can include one or more tangible and non-transitory computer-readable media configured to store data and / or instructions. In some embodiments, the non-volatile memory 303 can include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device such as a hard disk drive (HDD), a compact disc (CD), a digital versatile disc (DVD), or a solid-state drive (SSD). In some embodiments, the non-volatile memory 303 may be a removable storage medium, such as a Secure Digital (SD) memory card. In some other embodiments, the non-volatile memory 303 may be configured to store key identifiers, signature information, device identifiers of the mobile phone 100, etc., or may be configured to store instructions of a preset signature method corresponding to the key identifier.
[0385] In particular, the system memory 302 and the non-volatile memory 303 may each include a temporary copy and a persistent copy of the instruction 307. When the instruction 307 is executed by the processor 301, the notebook computer 300 may be enabled to implement the access control method provided in the embodiments of the present application.
[0386] The communication interface 304 includes a transceiver configured to provide a wired or wireless communication interface to the notebook computer 300, and can communicate with any other suitable device using one or more networks. In some embodiments, the communication interface 304 may be integrated with another component of the notebook computer 300. For example, the communication interface 304 may be integrated with the processor 301. In some embodiments, the notebook computer 300 can communicate with other devices via the communication interface 304.
[0387] The input / output (I / O) device 305 can include an input device such as a keyboard or a mouse, and an output device such as a display. A user can interact with the notebook computer 300 using the input / output (I / O) device 305. For example, the user can input commands to a first application executed on the notebook computer 300 to obtain, from the mobile phone 100, a fuse position file, a device identifier file, etc. of the mobile phone 100.
[0388] The system control logic 206 can include any suitable interface controller so that another module of the notebook computer 300 provides any suitable interface. For example, in some embodiments, the system control logic 306 can include one or more memory controllers to provide an interface connected to the system memory 302 and the non-volatile memory 303.
[0389] In some embodiments, at least one of the processors 301 can be packaged together with the logic of one or more controllers used for the system control logic 306 to form a System in Package (SiP). In some other embodiments, at least one of the processors 301 can be further integrated on the same chip with the logic of one or more controllers used for the system control logic 306 to form a System-on-Chip (SoC).
[0390] It can be understood that the structure of the notebook computer 300 shown in this embodiment of the present application does not constitute a specific limitation on the notebook computer 300. In some other embodiments of the present application, the notebook computer 300 may include more or fewer components than those shown in the figures, combine some components, divide some components, or have different component arrangements. The components in the figures may be implemented by hardware, software, or a combination of software and hardware.
[0391] Embodiments of the mechanisms disclosed in the present application can be implemented by hardware, software, firmware, or a combination of these implementation methods. Embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, and the programmable system includes at least one processor, a memory system (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device.
[0392] The program code can be used to input instructions, execute the functions described in the present application, and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of the present application, the processing system includes any system having a processor such as a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.
[0393] The program code may be implemented in a high-level procedural language or an object-oriented programming language in order to communicate with the processing system portion. The program code can alternatively be implemented using assembly language or machine language, if necessary. In fact, the mechanisms described in this application are not limited to the scope of any particular programming language. In any case, the language may be a compiled language or an interpreter-type language.
[0394] FIG. 22 is an architecture diagram of a mobile phone 100 according to some embodiments of the present application. As shown in FIG. 22, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0395] The window manager is configured to manage window programs. The window manager obtains the size of the display screen, determines whether there is a status bar, executes a screen lock, takes a screenshot, and so on.
[0396] The content provider is configured to store and obtain data and make the data accessible to applications. The data may include videos, images, audio, outgoing and incoming calls, browsing history, bookmarks, address books, and the like.
[0397] The view system includes visual controls such as controls for displaying text and controls for displaying pictures. The view system may be configured to build an application. The display interface may include one or more views. For example, a display interface including an SMS message notification icon may include a text display view and a picture display view.
[0398] The phone manager is configured to provide the communication functions of the mobile phone 100, for example, the management of the call state (including answering, rejecting, etc.).
[0399] The resource manager provides various resources such as localized strings, icons, pictures, layout files, and video files to the application.
[0400] The notification manager can be configured to enable the application to display notification information in the status bar and transmit notification type messages. The display information may automatically disappear without user interaction after a short pause. For example, the notification manager is configured to notify of download completion or provide message notifications. Alternatively, the notification manager may provide notifications that appear in the top status bar of the system in the form of a graph or scroll bar text, for example, notifications of applications running in the background, or provide notifications that appear on the screen in the form of a dialog window. For example, text information is displayed in the status bar, a prompt sound is played, the electronic device vibrates, or the indicator light blinks.
[0401] The Android runtime includes a kernel library and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
[0402] The kernel library includes two parts: functions that need to be called using the Java language and the Android kernel library.
[0403] The application layer and the application framework layer operate on a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is configured to implement functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0404] The kernel layer is a layer between hardware and software. The kernel layer includes at least a display driver, a camera driver, an audio driver, and a sensor driver.
[0405] The system library may include multiple functional modules, such as a surface manager (SM), a media library (ML), a 3D graphics processing library (e.g., OpenGL ES), and a 2D graphics engine (e.g., SGL).
[0406] The media library supports playback and recording in multiple commonly used audio and video formats, still image files, etc. The media library can support multiple audio and video coding formats such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0407] Embodiments of the mechanisms disclosed in this application can be implemented by hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as a computer program or program code executed on a programmable system, and the programmable system includes at least one processor, a storage system (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device.
[0408] The program code can be used to input instructions, execute the functions described in the present application, and generate output information. The output information can be applied to one or more output devices by known methods. For the purposes of the present application, the processing system includes any system having a processor such as a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.
[0409] The program code may be implemented in a high-level procedural language or an object-oriented programming language to communicate with the processing system portion. The program code can alternatively be implemented using assembly language or machine language as needed. In practice, the mechanisms described in the present application are not limited to the scope of any particular programming language. In any case, the language may be a compiled language or an interpreter-type language.
[0410] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. Alternatively, the disclosed embodiments may be implemented as instructions transmitted or stored by one or more transient or non-transient machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed through a network or another computer-readable medium. Accordingly, the machine-readable medium includes, but is not limited to, any mechanism for storing or transmitting information (e.g., a carrier wave, infrared signal, or digital signal) in a machine-readable (e.g., computer-readable) form using a floppy disk, compact disk, optical disk, read-only memory (CD-ROM), magnetic disk, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical card, flash memory, or a tangible machine-readable memory configured to transmit information in electrical, optical, acoustic, or other forms via the Internet. Accordingly, the machine-readable medium can include any type of machine-readable medium suitable for storing or transmitting electronic instructions and information in a machine-readable (e.g., computer-readable) form.
[0411] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or order is not necessary. In some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative accompanying drawings. Further, including a structural or method feature in a particular figure does not mean that such a feature is required in all embodiments. In some embodiments, these features may not be included or may be combined with other features.
[0412] Note that all units / modules mentioned in the embodiments of the apparatus of this application are logical units / modules. Physically, one logical unit / module may be one physical unit / module, may be a part of one physical unit / module, or may be implemented by a combination of multiple physical units / modules. The physical implementation of these logical units / modules is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Further, to emphasize the innovative part of this application, units / modules not closely related to solving the technical problems proposed in this application are not introduced in the foregoing embodiments of the apparatus of this application. This does not mean that there are no other units / modules in the foregoing embodiments of the apparatus.
[0413] In the examples of this patent and in this specification, it should be noted that relative terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of an actual relationship or order between these entities or operations. Further, the term "include (include or contain)" or any other variation is intended to cover non-exclusive inclusion, so that a process, method, object, or device that includes a series of elements includes not only those elements, but also other elements not explicitly described, or further includes elements inherent to such a process, method, object, or device. Elements with "including a~" do not exclude the existence of additional identical elements in the process, method, object, or device that includes that element, unless there are more restrictions.
[0414] This application has been illustrated and described with reference to certain specific embodiments of this application, but those skilled in the art should understand that various changes can be made to this application in form and detail without departing from the scope of this application.
Claims
1. A Bluetooth-based time synchronization method, a step of performing Bluetooth-based time synchronization with a second electronic device by a first electronic device, wherein the Bluetooth-based time synchronization includes N sequentially-executed time synchronization sub-processes, and each time synchronization sub-process has one round-trip time and one initial sub-time offset, the step; in the process of performing the Bluetooth-based time synchronization, a step of obtaining, by the first electronic device, M valid sub-time offsets corresponding to M time synchronization sub-processes based on the N round-trip times and N initial sub-time offsets of the N time synchronization sub-processes, where M ≤ N, and the M time synchronization sub-processes are M time synchronization sub-processes among the N time synchronization sub-processes, the step; a step of obtaining, by the first electronic device, a time offset between the first electronic device and the second electronic device based on the M valid sub-time offsets; A method including the above.
2. The first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process a step of receiving, by the first electronic device, a time synchronization frame transmitted by the second electronic device, where the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the second electronic device, the step; a step of transmitting, by the first electronic device, a confirmation response message to the second electronic device in response to the time synchronization frame, where the confirmation response message is transmitted by a confirmation transmitted by the Bluetooth module of the first electronic device, 【Number 1】 Here, T LPi is the round-trip time of the first time synchronization sub-process, and T Ei is the confirmation response reception time when the second electronic device receives the confirmation response message, and T TXi is the time synchronization transmission time when the second electronic device transmits the time synchronization frame, step The method according to claim 1, including the above.
3. The time synchronization frame is T TXi and T Ei-1 and includes T Ei-1 is the time point of receiving a confirmation response when the second electronic device receives a confirmation response message preceding the confirmation response message, according to the method of claim 2.
4. The initial sub-time offset includes any one of the following: 【Number 2】 △ i is the initial sub-time offset, T RXi is the time synchronization reception time when the first electronic device receives the time synchronization frame, T TXi is the time synchronization transmission time when the second electronic device transmits the time synchronization frame, or, [Number 3] △ i is the initial sub-time offset, T RXi is the time synchronization reception time when the first electronic device receives the time synchronization frame, T Ei is the confirmation response reception time when the second electronic device receives the confirmation response message The method according to claim 2 or 3, including any one of the above.
5. The first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process a step of transmitting, by the first electronic device, a time synchronization frame to the second electronic device, where the time synchronization frame is transmitted according to an instruction transmitted by the Bluetooth module of the first electronic device, the step; A step of receiving, by the first electronic device, a confirmation response message transmitted by the second electronic device in response to the time synchronization frame, wherein the confirmation response message is transmitted by a confirmation by the Bluetooth module of the second electronic device, and the step; A step of receiving, by the first electronic device, a response frame transmitted by the second electronic device, 【Number 4】 Here, T LPi is the round-trip time of the first time synchronization subprocess, and T Ei is the time point when the first electronic device receives the confirmation response message, and T TXi is the time point when the first electronic device transmits the time synchronization frame, step The method according to claim 1, including the above.
6. The response frame is T RXi and includes T RXi which is the time synchronization reception time when the second electronic device receives the time synchronization frame, according to the method of claim 5.
7. The initial sub-time offset is as follows: [Number 5] △ i is the initial sub-time offset, T TXi is the time synchronization transmission time when the first electronic device transmits the time synchronization frame, T RXi is the time synchronization reception time when the second electronic device receives the time synchronization frame, or 【Number 6】 △ i is the initial sub-time offset, T Ei is the confirmation response reception time when the first electronic device receives the confirmation response message, T RXi is the time synchronization reception time when the second electronic device receives the time synchronization frame The method according to claim 5 or 6, including any one of the following.
8. The response frame is T RXi,T and T TXi,T and the T RXi,T is the time synchronization reception time when the second electronic device receives the time synchronization frame, and the T TXi,T is the response transmission time when the second electronic device transmits the response frame. The method according to claim 5
9. The initial sub-time offset is as follows: 【Number 7】 Δ i is the initial sub-time offset, T TXi,P is the time synchronization transmission time point at which the first electronic device transmits the time synchronization frame, T RXi,T is the time synchronization reception time point at which the second electronic device receives the time synchronization frame 【Number 8】 Δ i is the initial sub-time offset, T Ei is the confirmation response reception time when the first electronic device receives the confirmation response message, T RXi,T is the time synchronization reception time when the second electronic device receives the time synchronization frame 【Number 9】 Δ i is the initial sub-time offset, T TXi,P is the time synchronization transmission time when the first electronic device transmits the time synchronization frame, T RXi,T is the time synchronization reception time when the second electronic device receives the time synchronization frame, T RXi,P is the response reception time when the first electronic device receives the response frame, T TXi,T is the response transmission time when the second electronic device transmits the response frame, or, 【Number 10】 Δ i is the initial sub-time offset, T RXi,P is the response reception time when the first electronic device receives the response frame, T TXi,T is the response transmission time when the second electronic device transmits the response frame The method according to claim 5 or 8, including any one of the following.
10. The first time synchronization sub-process is one of the N time synchronization sub-processes, and the first time synchronization sub-process is A step of receiving, by the first electronic device, a time synchronization frame transmitted by the second electronic device, wherein the time synchronization frame is transmitted by an instruction transmitted by the Bluetooth module of the second electronic device, and the step; A step of transmitting, by the first electronic device, a confirmation response message to the second electronic device in response to the time synchronization frame, wherein the confirmation response message is transmitted by a confirmation transmitted by the Bluetooth module of the first electronic device, and the step; A step of transmitting, by the first electronic device, a response frame to the second electronic device, 【Number 11】 Here, T LPi is the round-trip time of the first time synchronization sub-process, and T Ei is the time point when the second electronic device receives the confirmation response message, and T TXi,T is the time point when the second electronic device transmits the time synchronization frame, step The method according to claim 1, including the above.
11. The time synchronization frame is T E(i-1) , T RX(i-1),T , and T TXi,T , where T E(i-1) is the time point when the second electronic device receives the previous confirmation response message of the confirmation response message, and T RX(i-1),T is the time point when the second electronic device receives the previous response frame of the response frame, and T TXi,T is the time point when the second electronic device transmits the time synchronization frame. The method according to claim 10.
12. The initial sub-time offset is as follows: 【Number 12】 Δ i is the initial sub-time offset, T RXi,P is the time synchronization reception time point at which the first electronic device receives the time synchronization frame, T TXi,T is the time synchronization transmission time point at which the second electronic device transmits the time synchronization frame 【Number 13】 Δ i is the initial sub-time offset, T RXi,P is the time synchronization reception time when the first electronic device receives the time synchronization frame, T Ei is the confirmation response reception time when the second electronic device receives the confirmation response message 【Number 14】 Δ i is the initial sub-time offset, T RXi,P is the time synchronization reception time when the first electronic device receives the time synchronization frame, T TXi,T is the time synchronization transmission time when the second electronic device transmits the time synchronization frame, T TXi,P is the response transmission time when the first electronic device transmits the response frame, T RXi,T is the response reception time when the second electronic device receives the response frame, or 【Number 15】 Δ i is the initial sub-time offset, T TXi,P is the response transmission time when the first electronic device transmits the response frame, T RXi,T is the response reception time when the second electronic device receives the response frame The method according to claim 10 or 11, including any one of the following.
13. The time synchronization frame further includes a sequence number, and the sequence number indicates the rank of the time synchronization frame among the N time synchronization sub-processes, and / or The time synchronization frame includes a Bluetooth interval T 0 and further includes The method according to claim 3 or 11.
14. The response frame further includes a sequence number, and the sequence number indicates the rank of the response frame among the N time synchronization sub-processes, and / or The response frame further includes a Bluetooth interval T 0 The method according to claim 6 or 8.
15. The step of the first electronic device obtaining M valid sub-time offsets corresponding to M time synchronization sub-processes based on the N round-trip times and the N initial sub-time offsets of the N time synchronization sub-processes includes the following operations for each of the N round-trip times by the first electronic device: The first electronic device determines whether the first round-trip time satisfies a preset condition, and when the first round-trip time satisfies the preset condition, whether to use the initial sub-time offset corresponding to the first round-trip time as a valid sub-time offset, or when the first round-trip time does not satisfy the preset condition, deleting the initial sub-time offset corresponding to the first round-trip time, including the step of executing, wherein the first round-trip time is the round-trip time of the first time synchronization sub-process, the first time synchronization sub-process is any one of the N time synchronization sub-processes, and the preset condition is as follows: 【Number 16】 The method according to any one of claims 1 to 14.
16. The step of the first electronic device obtaining M valid sub-time offsets corresponding to M time synchronization sub-processes based on the N round-trip times includes the following operations for each of the N round-trip times by the first electronic device: The first electronic device determines whether the first round-trip time satisfies a preset condition, and when the first round-trip time satisfies the preset condition, modifies the initial sub-time offset corresponding to the first round-trip time, and whether to use the modified initial sub-time offset as a valid sub-time offset, or when the first round-trip time does not satisfy the preset condition, using the initial sub-time offset corresponding to the first round-trip time as a valid sub-time offset, where the first round-trip time is the round-trip time of the first time synchronization sub-process, the first time synchronization sub-process is any one of the N time synchronization sub-processes, and the preset condition includes the following: 【Number 17】 The method according to any one of claims 1 to 14.
17. The initial sub-time offset is modified as follows: 【Number 18】 △ i ' is the corrected initial sub-time offset, △ i is the initial sub-time offset, and δ is the correction compensation amount. The method according to claim 16.
18. The correction compensation amount is the Bluetooth interval T 0 The Bluetooth-based time synchronization method according to claim 17, which is such.
19. Before the process of performing the Bluetooth-based time synchronization is executed, the Bluetooth-based time synchronization method A step of synchronizing the clock value of the local clock of the first electronic device and the clock value of the local clock of the second electronic device by using a synchronization message by the first electronic device and the second electronic device; The Bluetooth-based time synchronization method according to any one of claims 1 to 18, further comprising.
20. An electronic device, A memory configured to store instructions; One or more processors, wherein when the instructions are executed by the one or more processors, the Bluetooth-based time synchronization method according to any one of claims 1 to 19 is implemented; one or more processors; An electronic device including.
21. A computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on an electronic device, the electronic device is enabled to execute the Bluetooth-based time synchronization method according to any one of claims 1 to 19.
22. A computer program product, wherein the computer program product includes instructions, and the instructions are used to implement the Bluetooth-based time synchronization method according to any one of claims 1 to 19 when executed by one or more processors.
Citation Information
Patent Citations
Method and apparatus for over-the-air anchor-anchor synchronization
CN108474834A
High-precision clock synchronization method by considering round-trip time delay asymmetry
CN111698049A
Time synchronization method, system and related device
CN114222360A
Electronic apparatus, display system, time synchronization method, and program
JP2018063171A
Device synchronization over bluetooth
US20150092642A1