A clock synchronization method, apparatus, device, and storage medium

By determining the clock offset through data packets transmitted between Bluetooth devices for clock synchronization, the problems of hardware resource consumption and offset error in existing technologies are solved, and the long-term stable operation and service coordination of the Bluetooth system are achieved.

CN115987440BActive Publication Date: 2026-05-05伟光有限公司(CN)
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
伟光有限公司(CN)
Filing Date
2022-12-28
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

When multiple Bluetooth devices exist in the same terminal, existing technologies require the addition of a synchronization module for clock synchronization, which increases hardware resource consumption. Furthermore, clock synchronization depends on the write frequency of the Bluetooth devices and cannot self-calibrate, resulting in increased offset errors and making it impossible to achieve long-term stable system operation.

Method used

By establishing a data packet transmission connection between Bluetooth devices, determining the clock offset using the data packet reception time, and performing clock synchronization based on the offset, the increase in hardware resources is avoided, achieving self-calibration and long-term stable system operation.

Benefits of technology

It enables clock synchronization between Bluetooth devices, avoids business conflicts, saves hardware costs, and ensures the long-term stability of the Bluetooth system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115987440B_ABST
    Figure CN115987440B_ABST
Patent Text Reader

Abstract

This application discloses a clock synchronization method, apparatus, device, and storage medium. The method is applied to a first Bluetooth device of a first terminal. The method includes: receiving a first data packet from a second Bluetooth device of the first terminal; determining a first offset between the clocks of the first Bluetooth device and the second Bluetooth device based on the time the first Bluetooth device receives the first data packet and a time specified in the protocol for the first Bluetooth device to receive the first data packet; and sending the first offset to a third Bluetooth device of the second terminal. The first offset is used for clock synchronization among the first, second, and third Bluetooth devices. The clock sources of the first and second Bluetooth devices are different, and the third Bluetooth device is a Bluetooth device communicating with the first Bluetooth device. In this method, the Bluetooth devices can synchronize their clocks with other Bluetooth devices at the time of receiving data packets, thereby enabling the Bluetooth system to operate stably for a long period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a method, apparatus, device and storage medium for clock synchronization. Background Technology

[0002] With the development of Bluetooth technology, two or more Bluetooth devices can now exist within the same terminal. For example, a terminal may contain two Bluetooth devices with different clock sources operating simultaneously, including Bluetooth device #1 and Bluetooth device #2. Bluetooth device #1 needs to exchange services with Bluetooth devices in other terminals (such as Bluetooth device #3). In this scenario, to ensure that Bluetooth devices #1, #2, and #3 can perform their services correctly and to avoid conflicts between services, clock synchronization is required for Bluetooth devices #1, #2, and #3. Summary of the Invention

[0003] This application provides at least one method, apparatus, device, and storage medium for clock synchronization.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] In a first aspect, embodiments of this application provide a clock synchronization method applied to a first Bluetooth device of a first terminal. The method includes: receiving a first data packet from a second Bluetooth device of the first terminal; determining a first offset between the clocks of the first Bluetooth device and the second Bluetooth device based on the time at which the first Bluetooth device receives the first data packet and the time at which the first Bluetooth device receives the first data packet as specified in the protocol; and sending the first offset to a third Bluetooth device of the second terminal, wherein the first offset is used for clock synchronization of the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device; wherein the clock sources of the first Bluetooth device and the second Bluetooth device are different, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

[0006] Secondly, embodiments of this application provide a clock synchronization method applied to a second Bluetooth device of a first terminal. The method includes: sending a first data packet to a first Bluetooth device of the first terminal, the first data packet being used to determine a first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device, the first offset being used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device, and a third Bluetooth device of the second terminal; wherein the clock sources of the first Bluetooth device and the second Bluetooth device are different, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

[0007] Thirdly, embodiments of this application provide a clock synchronization method applied to a third Bluetooth device of a second terminal. The method includes: receiving a first offset from a first Bluetooth device of a first terminal, wherein the first offset is the offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device of the first terminal; the first offset is used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device; wherein the clock sources of the first Bluetooth device and the second Bluetooth device are different, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

[0008] Fourthly, embodiments of this application provide a clock synchronization device deployed on a first terminal. The device includes: a receiving module for receiving a first data packet from a second Bluetooth device of the first terminal; a determining module for determining a first offset between the clock of the device and the clock of the second Bluetooth device based on the time at which the device receives the first data packet and the time at which the device receives the first data packet as specified in the protocol; and a first transmitting module for transmitting the first offset to a third Bluetooth device of the second terminal. The first offset is used for clock synchronization among the device, the second Bluetooth device, and the third Bluetooth device. The clock source of the device is different from that of the second Bluetooth device, and the third Bluetooth device is a Bluetooth device communicating with the device.

[0009] Fifthly, embodiments of this application provide a clock synchronization device deployed on a first terminal. The device includes: a transmitting module for sending a first data packet to a first Bluetooth device of the first terminal. The first data packet is used to determine a first offset between the clock of the first Bluetooth device and the clock of the device. The first offset is used to synchronize the clocks of the first Bluetooth device, the device, and a third Bluetooth device of the second terminal. The clock source of the first Bluetooth device is different from that of the device, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

[0010] In a sixth aspect, embodiments of this application provide a clock synchronization device deployed on a second terminal. The device includes: a first receiving module, configured to receive a first offset from a first Bluetooth device of the first terminal, the first offset being the offset between the clock of the first Bluetooth device and the clock of a second Bluetooth device of the first terminal; the first offset is used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device, and the device; wherein the clock sources of the first Bluetooth device and the second Bluetooth device are different, and the device is a Bluetooth device that communicates with the first Bluetooth device.

[0011] In a seventh aspect, embodiments of this application provide a communication device, which includes a memory and a processor; wherein the memory is used to store computer-executable instructions; and the processor is connected to the memory and is used to implement the method described in any one of the first to third aspects by executing the computer-executable instructions.

[0012] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by at least one processor, implements the method described in any one of the first to third aspects.

[0013] This application provides a clock synchronization method, apparatus, and computer-readable storage medium. On the first Bluetooth device side of a first terminal, a first data packet is received from a second Bluetooth device of the first terminal. Based on the time when the first Bluetooth device receives the first data packet and the time specified in the protocol for the first Bluetooth device to receive the first data packet, a first offset between the clocks of the first Bluetooth device and the second Bluetooth device is determined. The first offset is then sent to a third Bluetooth device of the second terminal. The first offset is used for clock synchronization among the first, second, and third Bluetooth devices. The clock sources of the first and second Bluetooth devices are different, and the third Bluetooth device communicates with the first Bluetooth device. This allows the clock offset between Bluetooth devices to be automatically obtained at the time the Bluetooth devices receive the data packet, and the clocks of the Bluetooth devices can be calibrated based on this offset, thereby enabling the Bluetooth system composed of the aforementioned Bluetooth devices to operate stably for a long period. Attached Figure Description

[0014] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0015] Figure 1 This is a schematic diagram of a Bluetooth system from a different source.

[0016] Figure 2 An example diagram illustrating the addition of a synchronization module to Bluetooth systems from different sources;

[0017] Figure 3 A schematic diagram illustrating the process of clock synchronization between Bluetooth systems from different sources via a synchronization module;

[0018] Figure 4 This is a schematic diagram of an example of a Bluetooth system applicable to embodiments of this application;

[0019] Figure 5 A flowchart illustrating a clock synchronization method provided in an embodiment of this application;

[0020] Figure 6 A schematic diagram illustrating clock synchronization based on clock offset between different Bluetooth devices, provided as an embodiment of this application.

[0021] Figure 7A schematic diagram illustrating a possible implementation flow of the clock synchronization method provided in the embodiments of this application;

[0022] Figure 8 A schematic diagram illustrating the structural composition of a clock synchronization device provided in an embodiment of this application;

[0023] Figure 9 A schematic diagram illustrating the composition of another clock synchronization device provided in an embodiment of this application;

[0024] Figure 10 A schematic diagram illustrating the composition of another clock synchronization device provided in this application embodiment;

[0025] Figure 11 This is a schematic diagram of a hardware entity of a communication device in an embodiment of this application. Detailed Implementation

[0026] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.

[0027] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.

[0028] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. It should also be noted that the terms "first, second, third" used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0029] It should be understood that the term "and / or" in the embodiments of this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, the character " / " in this document generally indicates that the related objects before and after it have an "or" relationship.

[0030] It should also be understood that the term "terminal" in the embodiments of this application can refer to terminal equipment, access terminal, user equipment (UE), user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device. Access terminals can be cellular phones, cordless phones, Session Initiation Protocol (SIP) phones, IoT devices, satellite handheld terminals, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, wearable devices, terminals in 5G networks, or terminals in future evolved networks, etc.

[0031] In current Bluetooth technology, each Bluetooth device must have a local clock (CLKN), which is derived from a freely running reference clock. An offset can be added to the reference clock to synchronize the local clock with other non-Bluetooth systems. To synchronize with other Bluetooth devices, an offset is used; when the local clock is added to the offset, a temporary Bluetooth clock for mutual synchronization is provided.

[0032] With the development of Bluetooth technology, two or more Bluetooth devices can now exist within the same terminal. For example, a terminal may contain two Bluetooth devices operating simultaneously with different clock sources (or simply different sources), including Bluetooth device #1 and Bluetooth device #2. Bluetooth device #1 needs to exchange services with Bluetooth devices in other terminals (such as Bluetooth device #3). In this scenario, to ensure that Bluetooth devices #1, #2, and #3 can perform their services correctly and avoid conflicts, clock synchronization is required for Bluetooth devices #1, #2, and #3. The following is an example... Figure 1 The following example will be used to illustrate the point.

[0033] Figure 1 A schematic diagram of a Bluetooth system with different sources is shown. Bluetooth device #1 and Bluetooth device #2 are two Bluetooth devices with different clock sources in terminal #1. Bluetooth device #1 can establish connections with Bluetooth devices in other terminals (such as Bluetooth device #3 in terminal #2, Bluetooth device #4 in terminal #3, and Bluetooth device #5 in terminal #4), thereby enabling Bluetooth device #1 to communicate, or in other words, exchange services, with the connected Bluetooth devices. Figure 1In the Bluetooth system shown, since a terminal typically presents only one address, Bluetooth devices #1 and #2 generally do not communicate with other terminals' Bluetooth devices simultaneously. For example, in this system, Bluetooth device #1 has established a connection with other terminals' Bluetooth devices and can communicate with them, while Bluetooth device #2 has not established a connection with other terminals' Bluetooth devices and therefore cannot communicate with them. In this case, because Bluetooth devices #1 and #2 have different clock sources, Bluetooth device #1 cannot deduce the clock of Bluetooth device #2 from its own clock. Furthermore, since Bluetooth device #2 has no connection with other terminals' Bluetooth devices (such as Bluetooth devices #3, #4, and #5), it cannot forward its clock to other terminals' Bluetooth devices. Therefore… Figure 1 The various Bluetooth devices in the system cannot synchronize their clocks.

[0034] Currently, in existing solutions, to enable Bluetooth device #1 to know the clock (such as a local clock) of Bluetooth device #2 within the same terminal, and to achieve clock synchronization between Bluetooth device #1 and Bluetooth device #2, a synchronization module can be added between Bluetooth device #1 and Bluetooth device #2, such as... Figure 2 As shown. At this time, the process of clock synchronization between Bluetooth device #1 and Bluetooth device #2 is as follows: Figure 3 As shown, the implementation process may include:

[0035] S301, Bluetooth device #2 writes the local clock to hardware interfaces such as SPI / UART / IIC or to shared memory.

[0036] Bluetooth device #2 can synchronize its local clock with Bluetooth device #1 through hardware interfaces such as Serial Peripheral Interface (SPI), Universal Asynchronous Receiver / Transmitter, and Inter-Integrated Circuit (IIC) or through shared memory.

[0037] S302, Bluetooth device #1 receives clock data from hardware interfaces such as SPI / UART / IIC, or reads shared memory.

[0038] Bluetooth device #1 can obtain the clock data of Bluetooth device #2, such as the local clock of Bluetooth device #2, by receiving clock data from hardware interfaces such as SPI / UART / IIC or by reading shared memory.

[0039] S303, Bluetooth device #1 calculates the offset between the clock of Bluetooth device #1 and the clock of Bluetooth device #2.

[0040] In this step, Bluetooth device #1 can calculate the offset between the local clock of Bluetooth device #1 and the local clock of Bluetooth device #2 based on the local clock of Bluetooth device #2 obtained in S302, and then synchronize the clock with Bluetooth device #2 based on the offset.

[0041] exist Figure 2 and Figure 3 The clock synchronization scheme shown requires an additional synchronization module, which increases hardware resource consumption. This limits its application in resource-constrained systems. Furthermore, clock errors accumulate at the read / write hardware interface or shared memory, and these errors are difficult to estimate accurately, significantly impacting the calculated offset. In addition, clock synchronization depends entirely on the write frequency of Bluetooth device #2. If Bluetooth device #2 does not write for an extended period, Bluetooth device #1 cannot obtain accurate clock data from Bluetooth device #2. If Bluetooth device #1 continues to use previously obtained clock data from Bluetooth device #2 for offset calculation, the offset calculation error will increase.

[0042] Therefore, embodiments of this application provide a method, apparatus, device, and storage medium for clock synchronization. In this method, a first Bluetooth device of a first terminal can determine a first offset between the clocks of the first Bluetooth device and the second Bluetooth device by receiving data packets from a second Bluetooth device of the first terminal, and then send the first offset to a third Bluetooth device of the second terminal. Based on this offset, clock synchronization, or clock calibration, can be performed on the first, second, and third Bluetooth devices. This allows the clock offset between Bluetooth devices to be automatically obtained when the Bluetooth device receives a data packet, and the clocks of the Bluetooth devices can be calibrated based on this offset, thereby enabling the Bluetooth system composed of the aforementioned Bluetooth devices to operate stably for a long period. Furthermore, since this method can synchronize the clocks of Bluetooth devices by sending and receiving data packets, it does not require additional hardware resources (such as…). Figure 2 (Including the synchronization module), thereby saving hardware costs.

[0043] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0044] It should be noted that the clocks of the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device mentioned multiple times in the embodiments of this application refer to the local clocks of the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device, unless otherwise specified.

[0045] Figure 4A schematic diagram of a Bluetooth system applicable to embodiments of this application is shown. For example... Figure 4 As shown, the system may include, for example, Bluetooth device #1 and Bluetooth device #2, wherein Bluetooth device #1 and Bluetooth device #2 are Bluetooth devices with different clock sources that operate simultaneously in terminal #1, and data packets can be transmitted between Bluetooth device #1 and Bluetooth device #2. Figure 4 As shown, the system may also include Bluetooth device #3 in terminal #2, Bluetooth device #4 in terminal #3, and Bluetooth device #5 in terminal #4. Bluetooth devices #3 to #5 can communicate with Bluetooth device #1, or in other words, can exchange services with Bluetooth device #1.

[0046] It should be understood that Figure 4 This is a simplified illustration for ease of understanding only. Other terminals or Bluetooth devices may also be included in this Bluetooth system. Figure 4 It was not drawn in the middle.

[0047] Figure 5 This application illustrates a clock synchronization method provided in an embodiment. This method can be executed by a Bluetooth device or implemented by components of the Bluetooth device (such as chips or circuits), without limitation. In some implementations, the Bluetooth device in this application embodiment may be, for example, a Bluetooth chip.

[0048] like Figure 5 As shown, the method may include:

[0049] S501, the second Bluetooth device sends the first data packet to the first Bluetooth device.

[0050] Accordingly, the first Bluetooth device receives the first data packet from the second Bluetooth device.

[0051] In this embodiment, the second Bluetooth device is a Bluetooth device in the first terminal other than the first Bluetooth device; in other words, the first Bluetooth device and the second Bluetooth device are different Bluetooth devices in the same terminal. The clock sources of the first Bluetooth device and the second Bluetooth device are different. Figure 4 For example, the second Bluetooth device could be... Figure 4 Bluetooth device #2 in the system.

[0052] It should be understood that the second Bluetooth device may include one Bluetooth device, or two or more Bluetooth devices, without limitation. When the second Bluetooth device includes two or more Bluetooth devices, each of the two or more Bluetooth devices may send a first data packet to the first Bluetooth device. It should also be understood that the embodiments of this application do not limit the type of the first data packet or the information carried by the first data packet.

[0053] For example, the first data packet can be used to determine a first offset between the clocks of the first Bluetooth device and the second Bluetooth device. This first offset can then be used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device, and a third Bluetooth device of the second terminal. The third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device; in other words, a connection (such as a Bluetooth connection) has been established between the third Bluetooth device and the first Bluetooth device. Alternatively, it can be understood that the third Bluetooth device and the first Bluetooth device can exchange services.

[0054] In some embodiments, before the second Bluetooth device sends the first data packet to the first Bluetooth device, or before the first Bluetooth device receives the first data packet, the method further includes: establishing a Bluetooth connection between the first Bluetooth device and the second Bluetooth device. In this case, the second Bluetooth device may send the first data packet to the first Bluetooth device, for example, by sending the first data packet to the first Bluetooth device through the Bluetooth connection, and correspondingly, the first Bluetooth device may receive the first data packet from the second Bluetooth device through the Bluetooth connection.

[0055] As an example, the Bluetooth connection in this application embodiment may include a classic Bluetooth (BT) connection or a Bluetooth Low Energy (BLE) connection. It should be noted that the aforementioned Bluetooth connection can also be replaced by other types of software connections that can be used to transmit data packets, and this application embodiment does not limit this to such connections.

[0056] S502, the first Bluetooth device determines a first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device.

[0057] After receiving the first data packet, the first Bluetooth device can determine a first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device based on the time when the first data packet was received.

[0058] In one implementation, the first Bluetooth device can determine a first offset between the clocks of the first Bluetooth device and the second Bluetooth device based on the time when it receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol.

[0059] The moment when the first Bluetooth device receives the first data packet can be understood as the actual moment when the first Bluetooth device receives the first data packet; correspondingly, the moment when the first Bluetooth device receives the first data packet as specified in the protocol can be understood as the theoretical moment when the first Bluetooth device receives the first data packet. For example, if the protocol divides the time slice into 625μs (microseconds) as a time unit (e.g., 625μs is a time slot), and specifies that the first Bluetooth device can receive the first data packet at the 625μs of a certain time slot, then the moment when the first Bluetooth device receives the first data packet as specified in the protocol is the 625μs of that time slot.

[0060] For example, the first Bluetooth device may determine the first offset by the following steps: determining the time when the first Bluetooth device receives the first data packet as specified in the protocol; and determining the offset between the time when the first Bluetooth device receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol as the first offset.

[0061] For example, the first Bluetooth device can determine the time specified in the protocol for receiving the first data packet based on its local clock and the relevant protocol provisions. Since the time when the first Bluetooth device receives the first data packet can be considered the actual reception time, and the time specified in the protocol can be considered the theoretical reception time, the offset between the actual reception time and the protocol-specified reception time can be considered the offset between the clocks of the first and second Bluetooth devices, i.e., the first offset. In other words, the first Bluetooth device can obtain the first offset between its clock and the clocks of the second Bluetooth device by calculating the offset between the actual and theoretical reception times of the first data packet.

[0062] It should be noted that the first offset can be obtained by calculating the difference between the actual reception time and the theoretical reception time of the first Bluetooth device receiving the first data packet, or by calculating the difference between the theoretical reception time and the actual reception time of the first Bluetooth device receiving the first data packet, or by taking the absolute value of the difference calculated above. This application embodiment does not limit this.

[0063] As an example, suppose the first offset is calculated as the difference between the actual reception time (the time when the first Bluetooth device receives the first data packet) and the theoretical reception time (the time when the first Bluetooth device receives the first data packet as specified in the protocol). In this case, if the protocol specifies that the first Bluetooth device can receive the first data packet at the 625th μs of a certain time slot (for example, denoted as the first time slot), which is also the 0th μs of the next time slot of the first time slot, and the first Bluetooth device actually receives the first data packet at the 2nd μs of the next time slot of the first time slot, then the first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device can be determined as 2 μs.

[0064] In some embodiments, the method further includes: the first Bluetooth device synchronizing its clock with the second Bluetooth device based on a first offset to obtain a first synchronized clock. Here, clock synchronization can also be understood as clock calibration.

[0065] For example, after determining the first offset, the first Bluetooth device can add or subtract its clock from the first offset to obtain the first synchronization clock. As an example, assuming the clock of the first Bluetooth device is denoted as C1, the first offset as offset1, and the first synchronization clock as C2, the first synchronization clock can be expressed as C2 = C1 ± offset1, where the sign "±" between C1 and offset1—whether it is "+" or "-"—can be determined based on how offset1 is calculated. Figure 6 For example, suppose the first offset is calculated by calculating the difference between the time when the first Bluetooth device actually receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol. If the difference is positive, it means that after shifting the clock of the first Bluetooth device to the left by offset1 in the time domain, it can be synchronized with the clock of the second Bluetooth device. At this time, the first synchronization clock can be expressed as C2 = C1 - offset1.

[0066] According to the method of this embodiment, the first Bluetooth device can automatically obtain the first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device when it receives the first data packet from the second Bluetooth device, and can synchronize the clock with the clock of the second Bluetooth device based on the first offset, thereby avoiding service conflicts between the first Bluetooth device and the second Bluetooth device, so that the system can operate stably for a long time.

[0067] S503, the first Bluetooth device sends a first offset to the third Bluetooth device.

[0068] Accordingly, the third Bluetooth device receives a first offset from the first Bluetooth device.

[0069] The first offset is the offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device determined in S502. This first offset can be used for clock synchronization of the first Bluetooth device, the second Bluetooth device and the third Bluetooth device.

[0070] In this embodiment, the third Bluetooth device is the Bluetooth device in the second terminal. This third Bluetooth device can communicate with the first Bluetooth device, or in other words, a connection (such as a Bluetooth connection) has been established between the third Bluetooth device and the first Bluetooth device. Alternatively, it can be understood that the third Bluetooth device can exchange services with the first Bluetooth device.

[0071] It should be understood that the third Bluetooth device may include one Bluetooth device, or two or more Bluetooth devices, without limitation. When the third Bluetooth device includes two or more Bluetooth devices, the first Bluetooth device may send a first offset to each of the two or more Bluetooth devices. It should also be understood that the second terminal may include one terminal, or multiple terminals, without limitation. Figure 4 For example, the second terminal may include terminal #2, terminal #3, and terminal #4, and the third Bluetooth device may include Bluetooth device #3, Bluetooth device #4, and Bluetooth device #5, wherein the deployment method of each terminal and Bluetooth device is as follows: Figure 4 As shown, it will not be elaborated further here.

[0072] In some embodiments, the method further includes S504:

[0073] S504, the first Bluetooth device sends a second data packet to the third Bluetooth device.

[0074] Accordingly, the third Bluetooth device receives the second data packet from the first Bluetooth device. Therefore, the third Bluetooth device can synchronize its clock with the first synchronization clock based on the moment it receives the second data packet; or, in other words, the third Bluetooth device can synchronize its local clock to the first synchronization clock based on the moment it receives the second data packet.

[0075] It should be understood that the embodiments of this application do not limit the type of the second data packet or the information carried by the second data packet.

[0076] For example, the third Bluetooth device can determine a second offset between the clock of the first Bluetooth device and the clock of the third Bluetooth device based on the time when the second data packet is received and the time when the third Bluetooth device receives the second data packet as specified in the protocol. For instance, the third Bluetooth device can determine the time when the third Bluetooth device receives the second data packet as specified in the protocol based on its local clock and the relevant provisions of the protocol, thereby determining the offset between the time when the third Bluetooth device receives the second data packet and the time when the third Bluetooth device receives the second data packet as specified in the protocol as the second offset.

[0077] Furthermore, the third Bluetooth device can synchronize with the first synchronization clock based on the received first offset and its own determined second offset to obtain a second synchronization clock. Alternatively, the third Bluetooth device can synchronize with the first synchronization clock based on the sum of the first and second offsets to obtain a second synchronization clock.

[0078] According to the method of this embodiment, the first Bluetooth device can synchronize its clock with the second Bluetooth device to obtain a first synchronized clock. Furthermore, the third Bluetooth device can synchronize its clock with the first synchronized clock to obtain a second synchronized clock, thereby realizing clock synchronization among the first Bluetooth device, the second Bluetooth device and the third Bluetooth device, and thus avoiding service conflicts among the first Bluetooth device, the second Bluetooth device and the third Bluetooth device.

[0079] For example, if the calculated first offset is 2μs and the second offset is 3μs, the third Bluetooth device can synchronize with the first synchronization clock based on the sum of the first and second offsets (i.e., 5μs) to obtain the second synchronization clock. Assuming the clock of the third Bluetooth device is denoted as C3, the first offset as offset1, and the second synchronization clock as C4, the second synchronization clock can be expressed as C4 = C3 ± (offset1 + offset2), where the sign "±" is either "+" or "-" depending on how offset1 and offset2 are calculated.

[0080] by Figure 6For example, suppose the first offset is calculated as the difference between the actual time the first Bluetooth device receives the first data packet and the time specified in the protocol. If this difference is positive, it means that shifting the clock of the first Bluetooth device to the left by offset 1 in the time domain will synchronize it with the clock of the second Bluetooth device, thus obtaining the first synchronization clock. Suppose the second offset is calculated as the difference between the actual time the third Bluetooth device receives the second data packet and the time specified in the protocol. If this difference is positive, it means that shifting the clock of the third Bluetooth device to the left by offset 2 in the time domain will synchronize it with the clock of the first Bluetooth device. Since the clock of the first Bluetooth device needs to be shifted to the left by offset 1 in the time domain to synchronize with the clock of the second Bluetooth device, in other words, the first synchronization clock is obtained by shifting the clock of the first Bluetooth device to the left by offset 1 in the time domain. Therefore, for the third Bluetooth device, the total leftward offset of its clock in the time domain must be offset 1 + offset 2 to achieve synchronization with the first synchronization clock. At this point, the second synchronization clock can be expressed as C4 = C3 - (offset1 + offset2).

[0081] According to the method of this embodiment, the third Bluetooth device can receive a first offset from the first Bluetooth device, and can automatically obtain a second offset between the clocks of the first and third Bluetooth devices at the moment of receiving the second data packet from the first Bluetooth device. Then, based on the first and second offsets, the clock of the third Bluetooth device can be synchronized to the first synchronization clock, that is, the clock of the third Bluetooth device is calibrated. This avoids service conflicts between the first, second, and third Bluetooth devices, enabling the Bluetooth system composed of these devices to operate stably for a long time. Furthermore, the clock synchronization method of this embodiment does not require additional hardware resources, thus saving hardware costs.

[0082] It should be noted that, in Figure 5 In the method shown, the second Bluetooth device can send a first data packet to the first Bluetooth device via a Bluetooth connection (such as a BT / BLE connection) to enable clock synchronization for the first Bluetooth device. Furthermore, the first Bluetooth device can send a first offset and a second data packet to the third Bluetooth device to enable clock synchronization for the third Bluetooth device. In some scenarios, it is also possible to... Figure 5 By modifying the method shown, other similar clock synchronization methods can be obtained:

[0083] Example 1: The second Bluetooth device may establish a Bluetooth connection (such as a BT / BLE connection) with a third Bluetooth device. The second Bluetooth device can then send data packets (e.g., denoted as the third data packet) to the third Bluetooth device through this Bluetooth connection to enable clock synchronization for the third Bluetooth device. Furthermore, the third Bluetooth device may send data packets (e.g., denoted as the fourth data packet) and the offset between the clocks of the second and third Bluetooth devices (e.g., denoted as the third offset) to the first Bluetooth device to enable clock synchronization for the first Bluetooth device. In this case, a connection may not be required between the first and second Bluetooth devices.

[0084] Example 2: In Figure 5 In the method shown, the transmission direction of the data packets can be changed, for example, as follows: the third Bluetooth device sends data packets to the first Bluetooth device to enable clock synchronization of the first Bluetooth device; correspondingly, the first Bluetooth device can send data packets and a related offset (the offset between the clocks of the first Bluetooth device and the third Bluetooth device) to the second Bluetooth device to enable clock synchronization of the second Bluetooth device. Similarly, in the method described in Example 1, the transmission direction of the data packets can be changed, for example, as follows: the first Bluetooth device sends data packets to the third Bluetooth device to enable clock synchronization of the third Bluetooth device; correspondingly, the third Bluetooth device can send data packets and a related offset (the offset between the clocks of the first Bluetooth device and the third Bluetooth device) to the second Bluetooth device to enable clock synchronization of the second Bluetooth device.

[0085] The above text combined Figures 1 to 6 This application introduces a clock synchronization method provided by an embodiment. To facilitate understanding of the embodiments of this application, the following description is provided in conjunction with... Figure 7 This application describes a possible implementation flow of the clock synchronization method provided in its embodiments. The relationship between the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device can be referred to the description in the foregoing embodiments, and will not be repeated here.

[0086] like Figure 7 As shown, the implementation process may include:

[0087] S701, the first Bluetooth device establishes a BT / BLE connection with the second Bluetooth device.

[0088] S702, the second Bluetooth device sends a first data packet to the first Bluetooth device. Correspondingly, the first Bluetooth device receives the first data packet from the second Bluetooth device.

[0089] S703, the first Bluetooth device determines the first offset and performs clock synchronization.

[0090] In this step, the first Bluetooth device can determine a first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device based on the time when the first data packet is received and the time when the first Bluetooth device receives the first data packet as specified in the protocol.

[0091] For example, the first Bluetooth device may determine the time when the first Bluetooth device receives the first data packet as specified in the protocol based on the local clock of the first Bluetooth device and the relevant provisions of the protocol, and thus determine the offset between the time when the first Bluetooth device receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol as the first offset.

[0092] Furthermore, the first Bluetooth device can synchronize its clock with the second Bluetooth device based on the first offset to obtain a first synchronization clock. For example, after determining the first offset, the first Bluetooth device can add or subtract its clock from the first offset to obtain the first synchronization clock based on the result.

[0093] S704, the first Bluetooth device establishes a BT / BLE connection with the third Bluetooth device.

[0094] S705, the first Bluetooth device sends a first offset to the third Bluetooth device. Accordingly, the third Bluetooth device receives the first offset from the first Bluetooth device.

[0095] S706, the first Bluetooth device sends a second data packet to the third Bluetooth device. Correspondingly, the third Bluetooth device receives the second data packet from the first Bluetooth device.

[0096] It should be understood that the execution order of S705 and S706 is not limited in the embodiments of this application. As one implementation, the first offset may, for example, be carried in the second data packet, and thus sent from the first Bluetooth device to the third Bluetooth device.

[0097] S707, the third Bluetooth device determines the second offset and performs clock synchronization.

[0098] In this step, the third Bluetooth device can determine a second offset between the clock of the first Bluetooth device and the clock of the third Bluetooth device based on the time when the second data packet is received and the time when the third Bluetooth device receives the second data packet as specified in the protocol.

[0099] For example, the third Bluetooth device can determine the time when the third Bluetooth device receives the second data packet as specified in the protocol based on the local clock of the third Bluetooth device and the relevant provisions of the protocol, and thus determine the offset between the time when the third Bluetooth device receives the second data packet and the time when the third Bluetooth device receives the second data packet as specified in the protocol as the second offset.

[0100] Furthermore, the third Bluetooth device can synchronize with the first synchronization clock based on the received first offset and its own determined second offset to obtain a second synchronization clock. Alternatively, the third Bluetooth device can synchronize with the first synchronization clock based on the sum of the first and second offsets to obtain a second synchronization clock.

[0101] S708, the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device adjust their scheduling according to the application policy.

[0102] After the first, second, and third Bluetooth devices complete clock synchronization, they can adjust relevant scheduling based on their own application strategies to avoid service conflicts among them. For example, by performing clock synchronization, a Bluetooth device can accurately know the current working status or behavior (such as packet sending and receiving status) of the Bluetooth devices connected to it, and thus make corresponding processing strategies according to actual business needs, thereby avoiding conflicts between services.

[0103] According to the method of this embodiment, after the first Bluetooth device and the second Bluetooth device establish a connection, when the first Bluetooth device receives the first data packet from the second Bluetooth device, it can obtain the first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device. Since there is a connection between the first Bluetooth device and the third Bluetooth device, the first Bluetooth device can forward the first offset to the third Bluetooth device when sending and receiving packets with the third Bluetooth device. At this time, the third Bluetooth device can obtain the offset between the clock of the third Bluetooth device and the clock of the second Bluetooth device based on the first offset and the second offset between the clock of the first Bluetooth device and the clock of the third Bluetooth device, so as to adjust the relevant scheduling according to the corresponding strategy.

[0104] As mentioned earlier, in many Bluetooth systems, multiple Bluetooth devices can exist within a single device (such as a terminal). For example, in... Figure 1 In the Bluetooth system shown, there are two Bluetooth devices in terminal #1. These two Bluetooth devices are generally not in a connected state. When Bluetooth device #1, which is in a connected state, wants to obtain the clock of the unconnected Bluetooth device #2 and make corresponding application processing strategies for Bluetooth devices #3, #4, and #5, it often becomes very difficult.

[0105] exist Figure 1In the Bluetooth system shown, Bluetooth devices #1 and #2 in terminal #1 are not from the same source, and Bluetooth device #1 cannot deduce the clock of Bluetooth device #2 based on its own clock. Furthermore, Bluetooth devices #3, #4, and #5 are not connected to Bluetooth device #2 and cannot forward the clock of Bluetooth device #2 to Bluetooth device #1. Therefore, clock synchronization between these Bluetooth devices is impossible in this system. To solve this problem, existing solutions add a synchronization module to the system to achieve clock synchronization between Bluetooth devices. However, this solution has the following drawbacks:

[0106] 1) Adding a synchronization module for clock synchronization requires increased hardware resource consumption, which limits its application in resource-constrained systems.

[0107] 2) There is a time accumulation when reading and writing hardware interfaces or shared memory. This time difference is difficult to assess accurately and will have a significant impact on the actual calculated offset.

[0108] 3) Clock synchronization depends entirely on the write frequency of Bluetooth device #2. If it is not written for a long time, the clock offset error will increase.

[0109] 4) This method cannot achieve self-calibration. All offsets are calculated based on the read / write hardware interface or shared memory, and cannot be reflected in the actual packet sending and receiving.

[0110] In this embodiment, to address the shortcomings of the prior art, the corresponding solution includes: unlike the method of adding a synchronization module, this solution adds a BT / BLE connection, which can synchronize the clocks of multiple Bluetooth devices.

[0111] Since the timing of packet transmission and reception is particularly important in Bluetooth systems, as it affects the long-term stable operation of the entire system, and any hardware modification or addition will lead to increased costs and a significant increase in workload, the solution of this application embodiment is superior to the existing solution in terms of cost and clock offset synchronization.

[0112] The solution in this application embodiment can produce the following beneficial effects:

[0113] 1) No new hardware resources are required. In this embodiment, neither additional memory nor additional hardware interfaces, such as general-purpose input / output (GPIO) ports, are required.

[0114] 2) No changes are required to the existing system. For existing systems, no hardware changes are needed; only a new BT / BLE software connection needs to be added, and unnecessary parts can be removed, resulting in minimal modifications.

[0115] 3) It can automatically calibrate the offset after sending and receiving packets, making the clock calibration more accurate and enabling the system to run stably for a long time.

[0116] It is understood that in the embodiments of this application... Figures 4 to 7 The examples provided are merely to facilitate understanding of the embodiments of this application by those skilled in the art, and are not intended to limit the embodiments of this application to the specific scenarios illustrated. Figures 4 to 7 The examples are obviously subject to various equivalent modifications or changes, and such modifications or changes also fall within the scope of the embodiments of this application.

[0117] It is also understood that the solutions in the various embodiments of this application can be used in reasonable combinations, and the explanations or descriptions of the various terms appearing in the embodiments can be referenced or explained to each other in the various embodiments, without limitation.

[0118] It should also be understood that the various numerical sequences in the embodiments of this application do not imply the order of execution, but are merely a distinction for the convenience of description, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0119] It is also understood that the formulas involved in the various embodiments of this application are illustrative and do not limit the scope of protection of the embodiments of this application. In the process of calculating the above-mentioned parameters, calculations can be performed according to the above formulas, or based on variations of the above formulas, or according to the formulas determined by the methods provided in the embodiments of this application, or calculations can be performed in other ways to satisfy the results of the formula calculations.

[0120] Based on the foregoing embodiments, this application provides a clock synchronization device, which includes the included modules and can be implemented by a processor in a terminal; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0121] Figure 8 The diagram illustrates the structural composition of a clock synchronization device 800 provided in an embodiment of this application. This device 800 is deployed in a first terminal, such as... Figure 8 As shown, device 800 may include:

[0122] The receiving module 801 is used to receive a first data packet from a second Bluetooth device of the first terminal; the determining module 802 is used to determine a first offset between the clock of the device 800 and the clock of the second Bluetooth device based on the time when the device 800 receives the first data packet and the time when the device 800 receives the first data packet as specified in the protocol; the first sending module 803 is used to send the first offset to a third Bluetooth device of the second terminal, the first offset being used for clock synchronization of the device 800, the second Bluetooth device and the third Bluetooth device; wherein the clock source of the device 800 is different from that of the second Bluetooth device, and the third Bluetooth device is a Bluetooth device that communicates with the device 800.

[0123] In some embodiments, the device 800 further includes: an establishment module, configured to establish a Bluetooth connection between the device 800 and a second Bluetooth device before the device 800 receives the first data packet; and a receiving module 801, specifically configured to receive the first data packet from the second Bluetooth device of the first terminal via the Bluetooth connection.

[0124] In some embodiments, the determining module 802 is specifically configured to: determine the time when the device 800 receives the first data packet as specified in the protocol; and determine the offset between the time when the device 800 receives the first data packet and the time when the device 800 receives the first data packet as specified in the protocol as a first offset.

[0125] In some embodiments, the device 800 further includes a synchronization module for synchronizing a clock with a second Bluetooth device based on a first offset to obtain a first synchronization clock.

[0126] In some embodiments, the device 800 further includes: a second transmitting module, configured to transmit a second data packet to a third Bluetooth device; wherein the third Bluetooth device synchronizes its clock with a first synchronization clock based on the time at which it receives the second data packet.

[0127] Based on the foregoing embodiments, this application provides another clock synchronization device, which includes the included modules and can be implemented by a processor in a terminal; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0128] Figure 9 The present application illustrates the composition of another clock synchronization device 900 provided in an embodiment of the present application.

[0129] The device 900 is deployed at the first terminal, such as Figure 9 As shown, device 900 may include:

[0130] The sending module 901 is used to send a first data packet to a first Bluetooth device of the first terminal. The first data packet is used to determine a first offset between the clock of the first Bluetooth device and the clock of the device 900. The first offset is used to synchronize the clocks of the first Bluetooth device, the device 900, and the third Bluetooth device of the second terminal. The clock source of the first Bluetooth device is different from that of the device 900, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

[0131] Based on the foregoing embodiments, this application provides another clock synchronization device, which includes the included modules and can be implemented by a processor in a terminal; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0132] Figure 10 This illustration shows the structural composition of another clock synchronization device 1000 provided in an embodiment of this application. The device 1000 is deployed in a second terminal, such as... Figure 10 As shown, the device 1000 may include:

[0133] The first receiving module 1001 is used to receive a first offset from the first Bluetooth device of the first terminal. The first offset is the offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device of the first terminal. The first offset is used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device and the device 1000. The clock sources of the first Bluetooth device and the second Bluetooth device are different. The device 1000 is a Bluetooth device that communicates with the first Bluetooth device.

[0134] In some embodiments, the first offset is used for clock synchronization between the first Bluetooth device and the second Bluetooth device to obtain a first synchronization clock; the device 1000 further includes: a second receiving module for receiving a second data packet from the first Bluetooth device; a determining module for determining a second offset between the clock of the first Bluetooth device and the clock of the device 1000 based on the time when the device 1000 receives the second data packet and the time when the device 1000 receives the second data packet as specified in the protocol; and a synchronization module for clock synchronization with the first synchronization clock based on the sum of the first offset and the second offset to obtain a second synchronization clock.

[0135] The descriptions of the apparatus embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. In some embodiments, the functions or modules included in the apparatus provided in this application can be used to perform the methods described in the method embodiments above. For technical details not disclosed in the apparatus embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0136] It should be noted that, in the embodiments of this application, if the above-described methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0137] This application also provides a communication device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.

[0138] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium may be transient or non-transient.

[0139] This application also provides a computer program including computer-readable code, wherein when the computer-readable code is run in a Bluetooth device (such as a first Bluetooth device, a second Bluetooth device, or a third Bluetooth device), the processor in the Bluetooth device performs some or all of the steps in the above method.

[0140] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.

[0141] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0142] It should be noted that, Figure 11 This is a schematic diagram of a hardware entity of a communication device in an embodiment of this application, such as... Figure 11 As shown, the hardware entity of the device 1100 includes: a processor 1101, a communication interface 1102, and a memory 1103, wherein:

[0143] Processor 1101 typically controls the overall operation of device 1100.

[0144] The communication interface 1102 enables the device 1100 to communicate with other terminals or servers via a network.

[0145] The memory 1103 is configured to store instructions and applications executable by the processor 1101, and can also cache data to be processed or already processed by the processor 1101 and various modules in the device 1100 (e.g., image data, audio data, voice communication data, and video communication data), which can be stored in flash memory.

[0146] Alternatively, it can be implemented using Random Access Memory (RAM). Data transfer between the processor 1101, communication interface 1102, and memory 1103 can be achieved via bus 11011.

[0147] In some embodiments, the communication device 1100 may specifically be a Bluetooth device (such as a first Bluetooth device, a second Bluetooth device, or a third Bluetooth device) in the embodiments of this application, and the communication device 1100 may implement the corresponding processes implemented by the Bluetooth device (such as a first Bluetooth device, a second Bluetooth device, or a third Bluetooth device) in the various methods of the embodiments of this application. For the sake of brevity, it will not be described in detail here.

[0148] It should be understood that the phrase "an embodiment" or "one embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in one embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner.

[0149] In one or more embodiments. It should be understood that in various embodiments of this application, the sequence number of each step / process 5 does not imply the order of execution; the execution order of each step / process should be based on its function.

[0150] The underlying logic is determined, and should not be construed as limiting the implementation process of the embodiments in this application. The sequence numbers of the embodiments in this application above are merely for description and do not represent the superiority or inferiority of the embodiments.

[0151] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof mean...

[0152] In the context of non-exclusivity inclusion, a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements that are included for the purpose of...

[0153] The elements inherent in such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0154] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the embodiments described may be different.

[0155] The division of units described above is merely a logical functional division. In actual implementation, there may be other division methods, such as: multiple units or components may be combined, integrated into another system, or some features may be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0156] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0157] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0158] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0159] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.

[0160] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for clock synchronization, characterized in that, The method, applied to a first Bluetooth device of a first terminal, includes: The first data packet is received from the second Bluetooth device through the Bluetooth connection between the first Bluetooth device and the second Bluetooth device of the first terminal. Based on the time when the first Bluetooth device receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol, a first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device is determined; The first offset is sent to the third Bluetooth device of the second terminal, and the first offset is used for clock synchronization of the first Bluetooth device, the second Bluetooth device and the third Bluetooth device; The first Bluetooth device and the second Bluetooth device have different clock sources, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

2. The method according to claim 1, characterized in that, The step of determining the first offset between the clocks of the first Bluetooth device and the second Bluetooth device based on the time when the first Bluetooth device receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol includes: Determine the moment when the first Bluetooth device receives the first data packet, as specified in the protocol. The offset between the time when the first Bluetooth device receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol is determined as the first offset.

3. The method according to claim 1, characterized in that, The method further includes: Based on the first offset, clock synchronization is performed with the second Bluetooth device to obtain the first synchronization clock.

4. The method according to claim 3, characterized in that, The method further includes: A second data packet is sent to the third Bluetooth device; wherein, based on the time of receiving the second data packet, the third Bluetooth device synchronizes its clock with the first synchronization clock.

5. A method for clock synchronization, characterized in that, The method, applied to a second Bluetooth device of a first terminal, includes: Through the Bluetooth connection between the first Bluetooth device and the second Bluetooth device of the first terminal, a first data packet is sent to the first Bluetooth device. The time when the first Bluetooth device receives the first data packet and the time when the first Bluetooth device receives the first data packet as specified in the protocol are used to determine a first offset between the clock of the first Bluetooth device and the clock of the second Bluetooth device. The first offset is used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device and the third Bluetooth device of the second terminal. The first Bluetooth device and the second Bluetooth device have different clock sources, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

6. A method for clock synchronization, characterized in that, A third Bluetooth device applied to a second terminal, the method comprising: The system receives a first offset from a first Bluetooth device of a first terminal, wherein the first offset is the offset between the clock of the first Bluetooth device and the clock of a second Bluetooth device of the first terminal; the first offset is used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device. Wherein, the first Bluetooth device and the second Bluetooth device have different clock sources, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device; The first offset is used for clock synchronization between the first Bluetooth device and the second Bluetooth device to obtain a first synchronization clock; the method further includes: Receive a second data packet from the first Bluetooth device; Based on the time when the third Bluetooth device receives the second data packet and the time when the third Bluetooth device receives the second data packet as specified in the protocol, a second offset between the clock of the first Bluetooth device and the clock of the third Bluetooth device is determined; Based on the sum of the first offset and the second offset, the clock is synchronized with the first synchronization clock to obtain the second synchronization clock.

7. A clock synchronization device, characterized in that, The device is deployed at a first terminal, and the device includes: The receiving module is configured to receive a first data packet from the second Bluetooth device via a Bluetooth connection between the device and the second Bluetooth device of the first terminal. The determining module is configured to determine a first offset between the clock of the device and the clock of the second Bluetooth device based on the time when the device receives the first data packet and the time when the device receives the first data packet as specified in the protocol. The first transmitting module is used to transmit the first offset to the third Bluetooth device of the second terminal. The first offset is used for clock synchronization of the device, the second Bluetooth device and the third Bluetooth device. The device has a different clock source than the second Bluetooth device, and the third Bluetooth device is a Bluetooth device that communicates with the device.

8. A clock synchronization device, characterized in that, The device is deployed at a first terminal, and the device includes: The sending module is used to send a first data packet to the first Bluetooth device through the Bluetooth connection between the first Bluetooth device of the first terminal and the device. The first Bluetooth device receives the first data packet at the time specified by the protocol and the first Bluetooth device receives the first data packet at the same time. The module is used to determine a first offset between the clock of the first Bluetooth device and the clock of the device. The first offset is used to synchronize the clocks of the first Bluetooth device, the device, and the third Bluetooth device of the second terminal. The first Bluetooth device has a different clock source than the device, and the third Bluetooth device is a Bluetooth device that communicates with the first Bluetooth device.

9. A clock synchronization device, characterized in that, The device is deployed on a second terminal, and the device includes: A first receiving module is configured to receive a first offset from a first Bluetooth device of a first terminal, wherein the first offset is the offset between the clock of the first Bluetooth device and the clock of a second Bluetooth device of the first terminal; the first offset is used to synchronize the clocks of the first Bluetooth device, the second Bluetooth device, and the device. Wherein, the clock sources of the first Bluetooth device and the second Bluetooth device are different, and the device is a Bluetooth device that communicates with the first Bluetooth device; The first offset is used for clock synchronization between the first Bluetooth device and the second Bluetooth device to obtain a first synchronization clock; the device further includes: The second receiving module is used to receive a second data packet from the first Bluetooth device; The determining module is configured to determine a second offset between the clock of the first Bluetooth device and the clock of the device based on the time when the device receives the second data packet and the time when the device receives the second data packet as specified in the protocol; The synchronization module is used to synchronize the clock with the first synchronization clock based on the sum of the first offset and the second offset, so as to obtain the second synchronization clock.

10. A communication device, characterized in that, The communication device includes: Memory is used to store executable instructions for a computer; A processor, connected to the memory, is configured to implement the method of any one of claims 1 to 4, or the method of claim 5, or the method of claim 6 by executing the computer-executable instructions.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by at least one processor, implements the method as claimed in any one of claims 1 to 4, or implements the method as claimed in claim 5, or implements the method as claimed in claim 6.

Citation Information

Patent Citations

  • Bluetooth media device time synchronization

    CN111052817A