A method, device, electronic device and medium for Bluetooth synchronization timing between devices

By using Bluetooth synchronous timing method in devices that do not have network transmission functions, the transmission time information is calculated to determine the timing time, which solves the problem that the device cannot perform accurate timing through the network, and achieves high-precision time synchronization.

CN114679714BActive Publication Date: 2025-04-25ZHAOQING STARNET HEALTHCARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210285980.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-23
Publication Date
2025-04-25
Estimated Expiration
2042-03-23

AI Technical Summary

Technical Problem

The prior art is difficult to achieve accurate time timing on devices that do not have network transmission functions, especially in wearable devices. Due to hardware performance and power consumption limitations, timing cannot be performed through the network, resulting in inaccurate timing.

Method used

By sending verification packets and time packets, the time when the slave device receives the verification packets and time packets is calculated, the transmission time information is determined, and the time time of the slave device is calculated.

Benefits of technology

It realizes accurate time timing for devices that do not have network transmission functions, improves timing accuracy and reliability, and is suitable for wearable devices and other scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114679714B_ABST
    Figure CN114679714B_ABST
Patent Text Reader

Abstract

The present application relates to the field of wireless Bluetooth transmission technology, and in particular to a method, apparatus, electronic device and medium for Bluetooth synchronization timing between devices. The method includes: sending a verification package to determine whether the transmission time information between the timing master device and the slave device meets the transmission conditions; if so, sending a timing package to obtain the time corresponding to the timing package received by the slave device; determining the corresponding timing package sending time according to the timing package; obtaining the time corresponding to the verification package received by the slave device; determining the timing time of the slave device according to the time corresponding to the timing package received by the slave device, the timing package sending time and the time corresponding to the verification package received by the slave device. The present application has the effect of performing time synchronization for devices that do not have network transmission functions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of wireless Bluetooth transmission, and in particular to a method, device, electronic device and medium for Bluetooth synchronization timing between devices. Background Art

[0002] Timing mainly includes network time protocol timing and satellite time timing. Network Time Protocol (NTP) is the most common time synchronization method today. It sends timing data packets to all slave devices by several clock sources in the network to complete the time synchronization of the slave devices.

[0003] The timing method of the Network Time Protocol is a timing master and slave device structure timing method. The slave device sends an NTP packet, which contains the time T1 when the slave device sends the packet. After receiving the NTP, the timing master device will generate a reply packet and send it back to the slave device, which contains the time T2 when the NTP packet is received and the time T3 when the reply packet is sent. When the slave device receives the reply packet, it records the received time T4. Based on these four times, the transmission delay time t between the timing master device and the slave device can be calculated:

[0004]

[0005] NTP round trip transmission time information d:

[0006]

[0007] The slave device uses the current time Tt to obtain the calibrated time.

[0008] This calculation process assumes that the communication delays of NTP request and reply packets are equal. The larger the fluctuation range of network delay, the greater the deviation of timing will be. The maximum timing error is ±d / 2.

[0009] However, due to the complexity of the network structure, the communication delay fluctuates greatly, and the timing accuracy can be achieved within 200 milliseconds, which is not accurate enough. In addition, some wearable devices, such as wearable health testing equipment, generally do not have network connection capabilities due to hardware performance and power consumption limitations, and only have wireless communication functions such as Bluetooth. In this case, the device itself cannot be synchronized through the network, which causes many inconveniences for such devices when performing timing. Summary of the invention

[0010] In order to solve the problem of time synchronization for devices that do not have network transmission function, the present application provides a method, device, electronic device and medium for Bluetooth synchronization timing between devices.

[0011] In the first aspect, the present application provides a method for Bluetooth synchronization timing between devices, which adopts the following technical solution:

[0012] A Bluetooth synchronization timing method between devices, comprising:

[0013] Send a verification packet to determine whether the transmission time information between the timing master device and the slave device meets the transmission conditions;

[0014] If the conditions are met, a timing packet is sent to obtain the time corresponding to when the timing packet is received from the device;

[0015] Determine the sending time of the timing packet according to the timing packet;

[0016] Obtain the time corresponding to when the verification package is received from the device;

[0017] The timing time of the slave device is determined according to the time corresponding to when the timing packet is received from the slave device, the time when the timing packet is sent, and the time corresponding to when the verification packet is received from the slave device.

[0018] By adopting the above technical scheme, the timing master device sends a verification package to the slave device, and the slave device records the sending time of the verification package after receiving the verification package; the timing master device records the time when the verification package is sent, and the slave device sends the receiving time when the verification package is received to the timing master device, and calculates and determines the transmission time information of a single timing information sent by the timing master device to the slave device based on the corresponding time when the slave device receives the verification package and the time when the timing master device sends the verification package; thereafter, the timing master device starts to send timing packages to the slave device to time the slave device, and determines the initial and end times of this timing process based on the time when the timing package is sent and the time when the slave device receives the timing package; the timing time of the slave device is finally obtained by calculating the transmission time information, the initial time of the timing package, and the difference and mean of the receiving time of the timing package; the timing master device sends the timing package with the timing time to the slave device for timing, thereby achieving the purpose of timing the device that does not have the network transmission function.

[0019] In a possible implementation, the sending of the verification package includes:

[0020] Send a set of verification packets to the slave device, each verification packet has a corresponding sending time;

[0021] Get the reply packet generated by the slave device according to each verification packet;

[0022] Generate the corresponding receiving time according to each reply packet;

[0023] Determine the transmission mean time information according to the corresponding sending time included in the verification packet and the corresponding receiving time generated by the reply packet;

[0024] The transmission time information included in the verification packet is determined according to the transmission mean time information.

[0025] By adopting the above technical scheme, the timing master device sends multiple verification packets to the slave device, and the timing master device records the sending time of the verification packet in the verification packet; after receiving the verification packet, the slave device sends a reply packet to the timing master device, and the timing master device records the receiving time when receiving the reply packet; then, through difference calculation, the transmission time of a single verification packet and the corresponding reply packet is determined, and the mean time of each verification packet and the corresponding reply packet transmission is calculated to determine the average transmission time between a single verification packet and the corresponding reply packet, and the transmission time between the average single verification packet and the corresponding reply packet is used as the initial calculation information and the transmission time information between the timing master device and the slave device is determined through calculation.

[0026] In a possible implementation, determining the transmission mean time information according to the corresponding sending time included in the verification packet and the corresponding receiving time generated by the reply packet includes:

[0027] Calculate the difference between the receiving time corresponding to the response packet generation and the sending time corresponding to the verification packet to determine the transmission time information;

[0028] Calculate the average of multiple transmission time information to determine the transmission average time information.

[0029] By adopting the above technical solution, the difference between the sending time of each pair of verification packets and the time when the timing master device receives the reply packet is calculated to obtain a set of timing time differences, which are recorded as d1, d2, d N ; After that, the mean of all transmission time information is calculated, and the formula is as follows:

[0030]

[0031] Above It is indicated as transmitting mean information.

[0032] In a possible implementation manner, determining the transmission time information included in the verification packet according to the mean time information includes:

[0033] Determine minimum transmission time information in the transmission time information;

[0034] Determine difference comparison information and transmission difference information according to the transmission time information, the transmission mean time information and the minimum transmission time information;

[0035] Compare each transmission difference information with the difference comparison information,

[0036] If the transmission difference information is greater than the difference comparison information, the transmission time information corresponding to the transmission difference information is eliminated;

[0037] The remaining transmission time information is averaged to generate secondary average time information;

[0038] The secondary mean time information is averaged to determine the transmission time information caused by a single transmission distance.

[0039] By adopting the above technical solution, after a single group of multiple verification packages and corresponding reply packages are interacted between the timing master device and the slave device, the timing master device compares the time spent on each interaction between the verification package and the corresponding reply package in the single group one by one, and determines the shortest time spent on the interaction between the timing synchronization package and the corresponding reply package, that is, the minimum transmission time information, and uses the minimum transmission time information as one of the comparison parameters in the elimination process.

[0040] Afterwards, the timing master device will perform difference calculations on the transmission time information and the transmission mean time information respectively, and determine the transmission comparison information between each transmission time information and the transmission mean time information; at the same time, the timing master device will perform difference calculations on the transmission mean time information and the minimum transmission time information, and determine the difference comparison information; the timing master device determines the difference comparison information that is smaller than the transmission difference information by comparing the transmission difference information with the difference comparison information respectively, and uses the difference comparison information as the comparison parameter; then, the timing master device will perform mean calculations on the remaining error information, and the generated secondary mean information represents the average time spent on the interaction between a single verification packet and the corresponding reply packet in a single group; finally, the timing master device will perform mean calculations on the secondary mean time information, and determine the average error time of a single timing master device to transmit timing data to a slave device, that is, the transmission time information caused by a single transmission distance.

[0041] In a possible implementation manner, determining the difference comparison information and the transmission difference information according to the transmission time information, the transmission mean time information, and the minimum transmission time information includes:

[0042] Calculate the difference between the transmission time information and the transmission mean time information to generate difference comparison information;

[0043] The difference between the transmission mean time information and the minimum transmission time information is calculated to generate transmission difference information.

[0044] By adopting the above technical solution, the time spent on the interaction between each verification package and the corresponding reply package in a single group is calculated by difference with the transmission mean time information, and the time spent on the interaction between each verification package and the corresponding reply package in a single group is obtained. The time difference between the transmission mean time information and the minimum transmission time information is calculated, and the generated transmission difference information is used as a conditional parameter to determine whether the time spent on the interaction between each verification package and the corresponding reply package is within the allowable error range.

[0045] In a possible implementation, the determining whether the transmission time information between the timing master device and the slave device meets the transmission condition includes:

[0046] If the transmission time information fails to meet the transmission conditions for multiple consecutive times, it is determined that the timing task in this timing cycle is completed.

[0047] By adopting the above technical solution, the timing master device determines the first transmission time information. When the second transmission time information exceeds the first transmission time information by ±10ms, the timing master device determines that the duration of the timing process corresponding to the second transmission time information meets the preset duration requirement, and generates a confirmation message to the slave device. The slave device calculates the timing time according to its own preset calculation method. If the transmission time information generated by the timing master device for multiple times in a single timing cycle is greater than Δd±10ms, the timing master device determines that the error of timing the slave device in the current state is too large, and thus it is impossible to accurately time the slave device, and the timing task in this cycle is terminated.

[0048] In a second aspect, the present application provides a Bluetooth synchronization timing device between devices, which adopts the following technical solution:

[0049] A Bluetooth synchronization timing device between devices includes a transmission time judgment module, a first time acquisition module, a transmission time determination module, a second time acquisition module and a timing time determination module, wherein:

[0050] The transmission time judgment module is used to send a verification packet to determine whether the transmission time information between the timing master device and the slave device meets the transmission conditions;

[0051] A first time acquisition module, used to send a timing packet when the transmission condition is met, and obtain the time corresponding to the timing packet received from the device;

[0052] A sending time determination module, used to determine the sending time of the timing packet according to the timing packet;

[0053] A second time acquisition module, used to acquire the time corresponding to when the verification package is received from the device;

[0054] The timing time determination module is used to determine the timing time of the slave device according to the time corresponding to the time when the slave device receives the timing master device, the time when the timing packet is sent, and the time corresponding to the time when the slave device receives the verification packet.

[0055] By adopting the above technical scheme, the transmission time judgment module determines whether the transmission time information between the timing master device and the slave device meets the transmission conditions after sending the verification package. If so, the first time acquisition module obtains the time corresponding to the slave device receiving the reverse timing package after sending the timing package; the sending time determination module determines the corresponding timing sending time according to the sent timing package; the second time acquisition module obtains the time corresponding to the slave device receiving the verification package after the transmission judgment module sends the verification package; thereafter, the timing time determination module performs difference and mean calculations on the time corresponding to the slave device receiving the timing master device, the timing package sending time, and the time corresponding to the slave device receiving the verification package, to determine the timing time of the slave device.

[0056] In another possible implementation, the device further includes: a verification packet sending module, a reply packet acquiring module, a receiving time generating module, a mean time determining module, and a transmission time determining module, wherein:

[0057] The verification packet sending module is used to send a set of verification packets to the slave device.

[0058] Each verification package includes its corresponding sending time;

[0059] A reply packet acquisition module, used to acquire a reply packet generated by the slave device according to each verification packet;

[0060] A receiving time generation module, used to generate a corresponding receiving time according to each reply packet;

[0061] The mean time determination module is used to determine the transmission mean time information according to the corresponding sending time included in the verification packet and the corresponding receiving time generated by the reply packet;

[0062] The transmission time determination module is used to determine the transmission time information included in the verification package according to the transmission mean time information.

[0063] In another possible implementation, the device further includes: a transmission time generation module, a mean time generation module

[0064] A transmission time determination module, used to calculate the difference between the reception time corresponding to the response packet generation and the sending time corresponding to the verification packet, and determine the transmission time information;

[0065] The mean time determination module is used to calculate the mean of multiple transmission time information and determine the transmission mean time information.

[0066] In another possible implementation, the device further includes: a first determining module, a second determining module, a first comparing module, a secondary mean generating module, and a third determining module, wherein:

[0067] A first determining module, used to determine the minimum transmission time information in the transmission time information;

[0068] A second determination module determines difference comparison information and transmission difference information according to the transmission time information, the transmission mean time information and the minimum transmission time information;

[0069] The first comparison module is used to compare each transmission difference information with the difference comparison information,

[0070] If the transmission difference information is greater than the difference comparison information, the transmission time information corresponding to the transmission difference information is eliminated;

[0071] A secondary mean value generation module is used to calculate the mean of the remaining transmission time information to generate secondary mean time information;

[0072] The third determination module calculates the mean of the secondary mean time information to determine the transmission time information caused by a single transmission distance.

[0073] In another possible implementation, the device further includes: a difference comparison information generation module and a transmission difference generation module, wherein:

[0074] A difference comparison information generation module is used to calculate the difference between the transmission time information and the transmission mean time information to generate the difference comparison information;

[0075] The transmission difference generation module is used to calculate the difference between the transmission mean time information and the minimum transmission time information to generate the transmission difference information.

[0076] In another possible implementation, the device further includes: a first judgment module, wherein:

[0077] The first judgment module is used to determine that the timing task in the current timing cycle is completed if the transmission time information fails to meet the transmission condition for multiple consecutive transmissions.

[0078] In a third aspect, the present application provides an electronic device, which adopts the following technical solution:

[0079] An electronic device, comprising:

[0080] at least one processor;

[0081] Memory;

[0082] At least one application, wherein the at least one application is stored in the memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the above-mentioned method for Bluetooth synchronization timing between devices.

[0083] In a fourth aspect, the present application provides a computer-readable medium, which adopts the following technical solution:

[0084] A computer-readable medium includes: a computer program that can be loaded by a processor and execute the above-mentioned Bluetooth synchronization timing method between devices.

[0085] In summary, this application includes the following beneficial technical effects:

[0086] The timing master device sends a verification packet to the slave device, and the slave device records the time when the verification packet is sent after receiving the verification packet; the timing master device records the time when the verification packet is sent, and the slave device sends the reception time when the verification packet is received to the timing master device, and calculates and determines the transmission time information of a single timing information sent by the timing master device to the slave device based on the corresponding time when the slave device receives the verification packet and the time when the timing master device sends the verification packet; after that, the timing master device starts to send timing packets to the slave device to time the slave device, and determines the initial and end time of this timing process based on the time when the timing packet is sent and the time when the slave device receives the timing packet; the timing time of the slave device is finally obtained by calculating the transmission time information, the initial time of the timing packet, and the difference and average of the timing packet reception time; the timing master device sends the timing packet with the timing time to the slave device for timing, thereby achieving the purpose of timing the device that does not have the network transmission function. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] Figure 1 It is a flowchart of a Bluetooth synchronization timing method between devices according to an embodiment of the present application;

[0088] Figure 2 It is a block diagram of a Bluetooth synchronization timing device between devices according to an embodiment of the present application;

[0089] Figure 3 It is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0090] The following is combined with Figure 1-3 This application is described in further detail.

[0091] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0092] The present application embodiment provides a method for Bluetooth synchronization timing between devices, which is executed by a timing master device. The method includes:

[0093] S101, sending a verification packet to determine whether the transmission time information between the timing master device and the slave device meets the transmission conditions.

[0094] Specifically, the transmission time indicates the transmission delay time that occurs between the timing master device and the slave device during the Bluetooth transmission process; the verification package includes the transmission time information of the timing master device sending information to the slave device at a single time and the sending time information of the verification package; one of the devices with Bluetooth communication function is used as the timing master device for performing the Bluetooth timing task, and the remaining devices with Bluetooth communication function are used as slave devices for receiving the timing time this time; the slave device is connected to the timing master device by Bluetooth; the timing master device performs time synchronization on the slave device through Bluetooth transmission.

[0095] Specifically, in the process of timing the master device to the slave device, the master device will send a timing packet to the slave device, and the timing packet includes the sending time of the timing packet; after receiving the timing packet, the slave device uses the sending time of the timing packet as its own time; however, the Bluetooth transmission process requires a certain amount of time, and is affected by the environment, and the time of each Bluetooth transmission is also different; if the time when the timing master device sends the timing packet is used as the timing time of the slave device, a time error will occur; therefore, before the master device performs time timing to the slave device, it is necessary to calculate and judge the time delay in the Bluetooth transmission process in the current environment to determine whether the time delay requirement for sending precise timing time is met, thereby reducing the impact of the Bluetooth transmission process on the timing time.

[0096] The timing master device sends a verification package to the slave device. After receiving the verification package, the slave device records the sending time of the verification package. The timing master device uses whether the transmission time information between the timing master device and the slave device exceeds the preset time range as the basis for judging whether the time the timing master device provides to the slave device is accurate, and decides whether to provide time to the slave device.

[0097] S102: If the conditions are met, a timing packet is sent to obtain the time corresponding to the timing packet received from the device.

[0098] Specifically, when the timing master device determines that the transmission time information in the verification package indicating that the timing master device sends information to the slave device in a single time meets the preset time range, it is determined that the time for the timing master device to provide timing to the slave device is accurate. At this time, the timing master device starts to execute the steps of providing time to the slave device, thereby ensuring the accuracy of the timing master device providing timing to the slave device.

[0099] If the timing master device and the slave device directly start to execute the steps of timing the slave device, the slave device can also successfully perform timing. However, during the data transmission process via Bluetooth, transmission loss will occur due to the influence of transmission distance, air humidity and transmission medium, resulting in unequal transmission time information in each time timing between the timing master device and the slave device. If timing is performed in an environment that seriously affects the Bluetooth transmission capability between the timing master device and the slave device, serious errors will occur in the timing time of the slave device, making it meaningless for the timing master device to perform time timing on the slave device.

[0100] S103: Determine the sending time of the corresponding timing packet according to the timing packet.

[0101] Specifically, during the period when the timing master device performs time synchronization with the slave device via Bluetooth transmission, the data transmission process in each timing process is an interactive process. During the interactive process, due to the influence of transmission, there is a certain time difference in the timing data from the timing master device to the slave device, and the time difference will also be different with the influence of the humidity, transmission distance and transmission medium in the environment. For example, the lower the humidity, the higher the transmission rate; the closer the transmission distance, the higher the transmission rate; the smaller the transmission medium density, the higher the transmission rate; for wearable slave devices, the slave device will move with the movement of the person, and the transmission rate will also change accordingly; therefore, it is necessary to calculate the time information in the data interaction process to obtain the final timing time; therefore, the timing master device will start to execute the timing steps for the slave device after determining that the conditions for timing the slave device are currently met; the timing master device will record the time when the verification package is sent, and use this time as one of the parameters for calculating the timing time of the slave device.

[0102] S104: Obtain the time corresponding to when the verification package is received from the device.

[0103] Specifically, after the timing master device sends a timing packet to the slave device, the slave device will send the reception time when receiving the verification packet to the timing master device, and use the time corresponding to the verification packet received by the slave device as one of the parameters for calculating the average transmission time spent between the timing master device and the slave device in the transmission process, and determine the transmission time information of Bluetooth transmission between the timing master device and the slave device in the current environment, so as to calculate the transmission time information to ensure the accuracy of the timing of the slave device; wherein, taking into account that the transmission time between the timing master device and the slave device each time is different due to changes in the environment, the average value of multiple transmission times is calculated, and the average value is used to represent a relatively stable transmission time under the current transmission environment.

[0104] S105 , determining the timing time of the slave device according to the time corresponding to when the timing packet is received from the slave device, the time when the timing packet is sent, and the time corresponding to when the verification packet is received from the slave device.

[0105] Specifically, the transmission time information of a single sending of timing information to the slave device is calculated and determined based on the time corresponding to the time when the slave device receives the verification packet and the time when the timing master device sends the verification packet. The transmission time information is the average time of a single transmission determined by calculating the sending time of multiple verification packets and the receiving time of the slave device, which can represent the stable communication transmission situation between the timing master device and the slave device.

[0106] After determining the average time spent in the transmission process between the timing master device and the slave device according to the verification package, the timing master device starts to send timing packages to the slave device to synchronize the slave device, and determines the initial and end times of this timing process according to the time when the timing package is sent and the time when the slave device receives the timing package; the timing time of the slave device is calculated by the transmission time information, the initial time of the timing package and the reception time of the timing package; the timing master device transmits the timing time to the slave device via Bluetooth to synchronize the slave device, thereby realizing time synchronization for devices that do not have network timing function.

[0107] The present application provides a method for Bluetooth synchronization timing between devices.

[0108] The timing master device sends a verification package to the slave device, and the slave device records the time when the verification package is sent after receiving the verification package; the timing master device uses whether the transmission time information between the timing master device and the slave device exceeds the preset time range as the basis for judging whether the time of the timing master device timing the slave device is accurate, and decides whether to perform time timing to the slave device; when the timing master device determines that the transmission time information in the verification package indicating that the timing master device sends information to the slave device once satisfies the preset time range, it is determined that the time for the timing master device to timing the slave device is accurate, and at this time the timing master device starts to execute the steps of timing the slave device.

[0109] The timing master device records the time when the verification package is sent, and the slave device sends the receiving time when the verification package is received to the timing master device, and calculates and determines the transmission time information of a single sending of timing information to the slave device based on the corresponding time when the slave device receives the verification package and the time when the timing master device sends the verification package. The transmission time information is the average time of a single transmission determined by calculating the sending time of multiple verification packages and the receiving time of the slave device, which can represent the stable communication transmission situation between the timing master device and the slave device; after that, the timing master device starts to send timing packages to the slave device to time the slave device, and determines the initial and end times of this timing process based on the sending time of the timing package and the receiving time of the timing package from the slave device; the timing time of this slave device is obtained by calculating the transmission time information, the initial time of the timing package and the receiving time of the timing package; thereby achieving the purpose of timing for devices that do not have network transmission function.

[0110] In a possible implementation of the embodiment of the present application, step S101 includes step S1011 (not shown in the figure), step S1012 (not shown in the figure), step S1013 (not shown in the figure), step S1014 (not shown in the figure), and step S1015 (not shown in the figure);

[0111] S1011. Send a group of verification packets to the slave device, each verification packet having a corresponding sending time.

[0112] S1012, obtaining a reply packet generated by each slave device according to each verification packet.

[0113] S1013. Generate a corresponding receiving time according to each reply packet.

[0114] S1014. Determine the transmission mean time information according to the corresponding sending time included in the verification packet and the corresponding receiving time generated by the reply packet.

[0115] S1015. Determine the transmission time information included in the verification packet according to the transmission mean time information.

[0116] Specifically, the reply packet indicates that the slave device has clearly received the reply information of the verification packet to the timing master device; the transmission mean time information indicates the average transmission time of the transmission time when the timing master device and the slave device exchange information multiple times; the timing master device sends multiple verification packets to the slave device, and the sending time of the verification packet recorded by the timing master device in the verification packet is recorded as T 11 、T 12 ···T 1N After receiving the verification packet, the slave device sends a reply packet to the timing master device. The timing master device records the time of receipt when receiving the reply packet, which are recorded as T 21 、T22 ···T 2N ; Calculate each pair of sending time and receiving time respectively to determine the transmission time of a single verification packet and the corresponding reply packet, and calculate the transmission time of each verification packet and the corresponding reply packet to determine the average transmission time between a single verification packet and the corresponding reply packet, and use the average transmission time between a single verification packet and the corresponding reply packet as the initial calculation information and determine the transmission time information between the timing master device and the slave device through calculation.

[0117] In a possible implementation manner of the embodiment of the present application, step S1014 (not shown in the figure) includes step S014a (not shown in the figure) and step S014b (not shown in the figure);

[0118] S014a. Calculate the difference between the receiving time corresponding to the reply packet generation and the sending time corresponding to the verification packet to determine the transmission time information.

[0119] S014b. Calculate the average of multiple transmission time information and determine the transmission average time information.

[0120] Specifically, the transmission mean time information indicates the average time spent on each group of data interaction after multiple groups of information are exchanged between the timing master device and the slave device; the difference between the sending time of each pair of verification packets and the time when the timing master device receives the reply packet is calculated to obtain a set of transmission time information, and the formula is as follows:

[0121] d1 = T 21 – T 11

[0122] d2 = T 22 – T 12 .

[0123] d N = T 2N – T 1N (1)

[0124] The above d1, d2...d N Indicates the time taken for a single information exchange between the timing master device and the slave device;

[0125] After that, the mean of all transmission time information is calculated as follows:

[0126] (2)

[0127] Above It is indicated as transmitting mean information.

[0128] In a possible implementation manner of the embodiment of the present application, step S1015 (not shown in the figure) includes step S015a (not shown in the figure), step S015b (not shown in the figure), step S015c (not shown in the figure), step S015d (not shown in the figure) and step S105e (not shown in the figure);

[0129] S015a. Determine the minimum transmission time information in the transmission time information.

[0130] Specifically, the timing master device sends a verification packet, and receiving a reply packet corresponding to the sent verification packet is regarded as an interaction process; the timing master device sends the first verification packet to the slave device, and receives the corresponding first reply packet, and then the timing master device sends the second verification packet to the slave device; until the last verification packet in a single group is sent to the slave device, and after receiving the reply packet generated by the slave device corresponding to the last verification packet, the timing master device determines that the interaction task between the group of verification packets and the corresponding reply packets is completed; however, as time goes by, the distance between the timing master device and the slave device and the transmission medium change, so that the time spent on each verification packet and the corresponding reply packet sending and receiving process in a single group will also be different, that is, the calculated transmission time information is not The same; wherein, in the sending and receiving of a single group of verification packages and the corresponding reply packages, it is inevitable that due to the drastic changes in the transmission environment, the time spent on the sending and receiving process of any single verification package and the corresponding reply package in the single group will far exceed the normal time range. In such cases, it will seriously affect the accuracy of the calculation results. Therefore, it is necessary to eliminate the time transmission information that is far beyond the normal time range due to the drastic changes in the transmission environment; after comparing the time spent on the interaction between each verification package and the corresponding reply package in the single group one by one, the timing master device determines the shortest time spent on the interaction between the timing synchronization package and the corresponding reply packet, that is, the minimum transmission time information dmin, and uses the minimum transmission time information dmin as one of the comparison parameters in the elimination process.

[0131] S015b. Determine difference comparison information and transmission difference information according to the transmission time information, the transmission mean time information, and the minimum transmission time information.

[0132] Specifically, the difference comparison information indicates the transmission time when a single verification packet in a single group interacts with the corresponding reply packet, and the maximum time error range allowed compared with the mean transmission time; the difference comparison information serves as reference information for determining whether the time for the timing master device and the slave device to interact with the verification packet and the corresponding reply packet exceeds the error time; the transmission difference information indicates the time spent on the interaction between the timing master device and the slave device for the verification packet and the corresponding reply packet, and the error time compared with the average interaction time.

[0133] S015c. Compare each transmission difference information with the difference comparison information. If the transmission difference information is greater than the difference comparison information, remove the transmission time information corresponding to the transmission difference information.

[0134] Specifically, if any transmission difference information satisfies the requirement of being less than the difference control information, it means the time spent on the interaction process between the verification packet of the corresponding transmission difference information and the corresponding reply packet, that is, the transmission time information is within a reasonable time range, and the timing master device will save the transmission time information; if any transmission difference information is greater than the difference control information, it is determined that the transmission between the timing master device and the slave device is affected by the external sudden environment, resulting in the transmission difference information being too large, and the timing master device regards the transmission difference information as useless information and chooses to eliminate it.

[0135] S015d. Calculate the mean of the remaining transmission time information to generate secondary mean time information.

[0136] Specifically, after eliminating the transmission error information with large deviations caused by the influence of external sudden environment, the remaining transmission error time and the corresponding transmission time are obtained when the timing master device and the slave device transmit in a stable transmission environment; the timing master device calculates the mean of the remaining error information, and the generated secondary mean information represents the average time spent on the interaction between a single verification packet and the corresponding reply packet in a single group.

[0137] S105e: Calculate the average of the secondary mean time information to determine the average error time caused by a single transmission distance.

[0138] Specifically, the timing master device sends the timing information to the slave device, and the slave device receives the timing information, which means that the timing master device has successfully synchronized the timing of the slave device. Therefore, the secondary mean time information represents the total time of a single interaction between the timing master device and the slave device. After averaging processing, the average error time of the single timing data transmission from the main timing master device to the slave device is finally determined.

[0139] In a possible implementation of the embodiment of the present application, step S015b (not shown in the figure) includes step S15ba (not shown in the figure) and step S15bb (not shown in the figure);

[0140] S15ba. Calculate the difference between the transmission time information and the transmission mean time information to generate difference comparison information.

[0141] Specifically, the time it takes for each verification packet in a single group to interact with the corresponding reply packet, that is, the transmission time information d1, d2, d N Respectively with the transmission mean time information Perform difference calculation to obtain the time difference between the time spent on the interaction between each verification package and the corresponding reply package in a single group and the average time required, that is, the difference comparison information a1a2 ···a N , the calculation formula is as follows:

[0142] a1 = d1–

[0143] a2 = d2– .

[0144] a N = d N – (3)

[0145] S15bb. Calculate the difference between the transmission mean time information and the minimum transmission time information to generate transmission difference information.

[0146] Specifically, the minimum transmission time information dmin means that the interaction time between the verification packet corresponding to the minimum transmission time information and the corresponding reply packet is the fastest; the timing master device will transmit the mean time information Calculate the difference between the minimum transmission time information dmin, that is, b= -dmin(4); uses the generated transmission difference information b as a criterion for judging whether the time spent on each interaction with the corresponding reply packet is within the allowable error range.

[0147] In a possible implementation manner of the embodiment of the present application, step S101 (not shown in the figure) includes step S011 (not shown in the figure),

[0148] S011. If the transmission time information fails to meet the transmission condition for multiple consecutive times, it is determined that the timing task in this timing cycle is completed.

[0149] Specifically, the timing master device determines the first transmission time information, recorded as Δd, and uses Δd±10ms as reference information for judging whether the remaining transmission time information in this timing cycle meets the acceptable delay range; the second transmission time information determined by the interaction process between the second group of delay packets and the corresponding reply packets is recorded as Δd2; when the second transmission time information exceeds the reference information, that is, Δd2<Δd±10ms (5), the timing master device determines that the duration of the timing process corresponding to the second transmission time information meets the preset duration requirement, and generates confirmation information to the slave device, and the slave device calculates the timing time according to its own preset calculation method; wherein the timing time of the slave device is calculated by adding the time difference between the time when the timing master device sends the verification packet, the transmission time information, the time when the slave device receives the timing confirmation information, and the time when the slave device receives the verification packet;

[0150] Furthermore, if the transmission time information generated by the timing master device for multiple consecutive times in a single timing cycle is greater than Δd±10ms, the timing master device determines that the error in time synchronization for the slave device in the current state is too large, and thus cannot provide accurate time synchronization for the slave device, and terminates the timing task in this cycle at the same time; if the slave device is still synchronized in this timing cycle, the timing time obtained by the slave device will have a time error that is larger than the timing time error in the previous timing cycle.

[0151] The above embodiment introduces a method for Bluetooth synchronization timing between devices from the perspective of method flow, and the following embodiment introduces an apparatus for Bluetooth synchronization timing between devices from the perspective of a virtual module or a virtual unit. For details, please refer to the following embodiment.

[0152] The inter-device Bluetooth synchronization timing device 100 may specifically include: a transmission time judgment module 1001, a first time acquisition module 1002, a transmission time determination module 1003, a second time acquisition module 1004 and a timing time determination module 1005, wherein:

[0153] The transmission time determination module 1001 is used to send a verification packet to determine whether the transmission time information between the timing master device and the slave device meets the transmission conditions;

[0154] The first time acquisition module 1002 is used to send a timing packet when the transmission condition is met, and obtain the time corresponding to the timing packet received from the device;

[0155] The sending time determination module 1003 is used to determine the sending time of the corresponding timing packet according to the timing packet;

[0156] The second time acquisition module 1004 is used to obtain the time corresponding to the receipt of the verification package from the device;

[0157] The timing time determination module 1005 is used to determine the timing time of the slave device according to the time corresponding to the reception of the timing master device by the slave device, the time of sending the timing packet and the time corresponding to the reception of the verification packet by the slave device.

[0158] In another possible implementation, the apparatus 100 further includes: a verification packet sending module, a reply packet acquiring module, a receiving time generating module, a mean time determining module, and a transmission time determining module, wherein:

[0159] The verification packet sending module is used to send a set of verification packets to the slave device.

[0160] Each verification package includes its corresponding sending time;

[0161] A reply packet acquisition module, used to acquire a reply packet generated by the slave device according to each verification packet;

[0162] A receiving time generation module, used to generate a corresponding receiving time according to each reply packet;

[0163] The mean time determination module is used to determine the transmission mean time information according to the corresponding sending time included in the verification packet and the corresponding receiving time generated by the reply packet;

[0164] The transmission time determination module is used to determine the transmission time information included in the verification package according to the transmission mean time information.

[0165] In another possible implementation, the apparatus 100 further includes: a transmission time generation module, a mean time generation module

[0166] A transmission time determination module, used to calculate the difference between the reception time corresponding to the response packet generation and the sending time corresponding to the verification packet, and determine the transmission time information;

[0167] The mean time determination module is used to calculate the mean of multiple transmission time information and determine the transmission mean time information.

[0168] In another possible implementation, the apparatus 100 further includes: a first determining module, a second determining module, a first comparing module, a secondary mean generating module, and a third determining module, wherein:

[0169] A first determining module, used to determine the minimum transmission time information in the transmission time information;

[0170] A second determination module determines difference comparison information and transmission difference information according to the transmission time information, the transmission mean time information and the minimum transmission time information;

[0171] The first comparison module is used to compare each transmission difference information with the difference comparison information,

[0172] If the transmission difference information is greater than the difference comparison information, the transmission time information corresponding to the transmission difference information is eliminated;

[0173] A secondary mean value generation module is used to calculate the mean of the remaining transmission time information to generate secondary mean time information;

[0174] The third determination module calculates the mean of the secondary mean time information to determine the transmission time information caused by a single transmission distance.

[0175] In another possible implementation, the apparatus 100 further includes: a difference comparison information generation module and a transmission difference generation module, wherein:

[0176] A difference comparison information generation module is used to calculate the difference between the transmission time information and the transmission mean time information to generate the difference comparison information;

[0177] The transmission difference generation module is used to calculate the difference between the transmission mean time information and the minimum transmission time information to generate the transmission difference information.

[0178] In another possible implementation, the apparatus 100 further includes: a first determination module, wherein:

[0179] The first judgment module is used to determine that the timing task in the current timing cycle is completed if the transmission time information fails to meet the transmission condition for multiple consecutive transmissions.

[0180] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0181] The present application also introduces an electronic device from the perspective of a physical device, such as Figure 3 As shown, Figure 3 The electronic device 1100 shown includes: a processor 1101 and a memory 1103. The processor 1101 and the memory 1103 are connected, such as through a bus 1102. Optionally, the electronic device 1100 may also include a transceiver 1104. It should be noted that in actual applications, the transceiver 1104 is not limited to one, and the structure of the electronic device 1100 does not constitute a limitation on the embodiments of the present application.

[0182] Processor 1101 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 1101 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

[0183] The bus 1102 may include a path to transmit information between the above components. The bus 1102 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 1102 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0184] The memory 1103 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0185] The memory 1103 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 1101. The processor 1101 is used to execute the application code stored in the memory 1103 to implement the contents shown in the above method embodiment.

[0186] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 3 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0187] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0188] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A Bluetooth synchronization timing method between devices, characterized in that: The method is applied to a timing master device to perform timing on a slave device through a Bluetooth transmission mode, and the method comprises: Sending a verification packet to the slave device, wherein the verification packet includes transmission time information and the sending time of the verification packet, so that after receiving the verification packet, the slave device records the receiving time of the verification packet and feeds it back to the timing master device; judging whether the transmission time information between the timing master device and the slave device meets the transmission condition according to the transmission time information; If the conditions are met, a timing packet is sent to the slave device so that the slave device determines the timing time according to a preset calculation method: the slave device obtains the time corresponding to the receipt of the timing packet; determines the corresponding sending time of the timing packet according to the timing packet; obtains the time corresponding to the receipt of the verification packet by the slave device; determines the timing time according to the transmission time information, the time corresponding to the receipt of the timing packet by the slave device, the sending time of the verification packet and the time corresponding to the receipt of the verification packet by the slave device.

2. The method according to claim 1, characterized in that The sending of the verification package includes: Send a set of verification packets to the slave device, each verification packet has a corresponding sending time; Get the reply packet generated by the slave device according to each verification packet; Generate the corresponding receiving time according to each reply packet; Determine the transmission mean time information according to the corresponding sending time included in the verification packet and the corresponding receiving time generated by the reply packet; The transmission time information included in the verification packet is determined according to the transmission mean time information.

3. The method according to claim 2, characterized in that The determining of the transmission mean time information according to the respective corresponding sending times included in the verification packets and the respective corresponding receiving times generated by the reply packets includes: Calculate the difference between the receiving time corresponding to the response packet generation and the sending time corresponding to the verification packet to determine the transmission time information; Calculate the average of multiple transmission time information to determine the transmission average time information.

4. The method according to claim 2, characterized in that: The step of determining the transmission time information included in the verification packet according to the transmission mean time information comprises: Determine minimum transmission time information in the transmission time information; Determine difference comparison information and transmission difference information according to the transmission time information, the transmission mean time information and the minimum transmission time information; Compare each transmission difference information with the difference comparison information, If the transmission difference information is greater than the difference comparison information, the transmission time information corresponding to the transmission difference information is eliminated; The remaining transmission time information is averaged to generate secondary average time information; The secondary mean time information is averaged to determine the transmission time information caused by a single transmission distance.

5. The method according to claim 4, characterized in that The determining of difference comparison information and transmission difference information according to the transmission time information, the transmission mean time information and the minimum transmission time information includes: Calculate the difference between the transmission time information and the transmission mean time information to generate difference comparison information; The difference between the transmission mean time information and the minimum transmission time information is calculated to generate transmission difference information.

6. The method according to claim 1, characterized in that The determining whether the transmission time information between the timing master device and the slave device meets the transmission condition includes: If the transmission time information fails to meet the transmission conditions for multiple consecutive times, it is determined that the timing task in this timing cycle is completed.

7. A Bluetooth synchronization timing device between devices, characterized in that: The device is applied to a timing master device to perform timing on a slave device through a Bluetooth transmission mode, and the device comprises: a transmission time judgment module and a first time acquisition module, wherein: A transmission time judgment module is used to send a verification packet to a slave device, wherein the verification packet includes transmission time information and the sending time of the verification packet, so that after receiving the verification packet, the slave device records the receiving time of the verification packet and feeds it back to the timing master device; based on the transmission time information, it is judged whether the transmission time information between the timing master device and the slave device meets the transmission condition; The first time acquisition module is used to send a timing packet to the slave device when the transmission conditions are met, so that the slave device determines the timing time according to a preset calculation method: the slave device obtains the time corresponding to the receipt of the timing packet; determines the corresponding sending time of the timing packet according to the timing packet; obtains the time corresponding to the receipt of the verification packet by the slave device; determines the timing time according to the time corresponding to the receipt of the timing master device by the slave device, the sending time of the timing packet and the time corresponding to the receipt of the verification packet by the slave device.

8. An electronic device, characterized in that: The electronic device includes: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the Bluetooth synchronization timing method between devices as described in any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed in a computer, the computer is caused to execute the Bluetooth synchronization timing method between devices as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Timing device, method and system

    CN106712889A

  • Moment calibration method and device, auxiliary slave equipment and auxiliary master equipment

    CN110971818A