Device synchronization methods, electronic devices and Bluetooth communication systems
By calculating the latency of slave devices in a Bluetooth communication system, the problem of the master device being unable to send data to multiple slave devices simultaneously was solved, enabling synchronization of slave devices and expanding the application scenarios of Bluetooth communication technology. In particular, it improved the accuracy of data statistics and the fairness of the competition in rope skipping competitions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-06
- Publication Date
- 2026-03-10
AI Technical Summary
In existing Bluetooth communication technology, the host device cannot send data to multiple slave devices simultaneously, resulting in inconsistent timing of instruction reception and execution among the slave devices. This cannot meet the needs of application scenarios with high synchronization requirements, such as inaccurate counting by slave devices in rope skipping competitions, which affects the fairness of the competition.
By calculating the difference between the maximum delayed transmission duration and the target delayed transmission duration, the delayed execution duration of the target slave device is determined, and the delayed execution duration is sent to the slave device so that it will execute after receiving the start command, thereby achieving synchronization of all slave devices.
This ensures that all slave devices execute the start command at the same time, improving the application effect of Bluetooth communication technology in scenarios with high synchronization requirements, such as the accuracy of statistical data and the fairness of the competition in rope skipping competitions.
Smart Images

Figure CN116456447B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Bluetooth communication technology, specifically to a device synchronization method, an electronic device, and a Bluetooth communication system. Background Technology
[0002] Currently, the main way to connect multiple devices via Bluetooth is through a master-slave mode, which extends the devices into a tree-like network at the application layer.
[0003] In related technologies, the host connects to each slave device individually, and each connection establishes a communication channel. The host can send data to the corresponding slave device through the established communication channel, and can also receive data from the slave device through the communication channel.
[0004] However, in this connection method, the master cannot send data to all slaves at the same time. In other words, the communication between them is not a transparent transmission mode. The master needs to communicate with different slaves at different times by sending instructions. This results in the slaves receiving instructions at different times, and thus the slaves executing instructions at different times. This method cannot be used in application scenarios with high requirements for slave synchronization. Summary of the Invention
[0005] In view of the above problems, this application provides a device synchronization method, an electronic device, and a Bluetooth communication system to solve the above technical problems.
[0006] In a first aspect, this application provides a device synchronization method, which is applied to a host device in a Bluetooth communication system. The Bluetooth communication system further includes multiple slave devices networked with the host device. The method includes:
[0007] The delayed execution time of the target slave device is determined based on the difference between the maximum delayed transmission time and the target delayed transmission time. The target delayed transmission time is the delay between sending the target start command to the target slave device and sending the start command to the first slave device; the maximum delayed transmission time is the delay between sending the end start command to the end slave device and sending the start command. The delayed execution time represents the interval between receiving the target start command and executing it.
[0008] Send the delay execution duration to the target slave device so that the target slave device executes the target startup command based on the delay execution duration.
[0009] This device synchronization method compensates for the time interval between receiving and executing the start command by delaying the execution time of each slave device, enabling each slave device to start executing the start command simultaneously with the end slave device, thus achieving synchronization of all slave devices and expanding the application scenarios of Bluetooth communication technology.
[0010] Secondly, this application also provides a device synchronization method, which is applied to any slave device in a Bluetooth communication system. The Bluetooth communication system further includes a master device networked with each slave device. The method includes:
[0011] Obtain the delayed execution duration sent by the host device; where the delayed execution duration represents the interval between the target slave device receiving the target start command and executing the target start command. The delayed execution duration is determined by the host device based on the difference between the maximum delayed transmission duration and the target delayed transmission duration. The target delayed transmission duration is the delay time between the host device sending the target start command and sending the first start command to the first slave device. The maximum delayed transmission duration is the delay time between the host device sending the last start command to the last slave device and sending the first start command.
[0012] In response to the target startup command, a timer is started. When the timer duration reaches the delay execution duration, the target startup command is executed.
[0013] Thirdly, this application also provides an electronic device including a processor and a memory, the memory being used to store a computer program, which, when executed by the processor, is used to implement the steps in the device synchronization method of the first or second aspect.
[0014] Fourthly, this application also provides a Bluetooth communication system, which includes a host device and multiple slave devices networked with the host device;
[0015] For each of the multiple slave devices, the master device determines the delayed execution duration of that slave device based on the difference between the maximum delayed transmission duration and the target delayed transmission duration, and sends the delayed execution duration to that slave device. The target delayed transmission duration is the delay between sending the target start command to that slave device and sending the start command to the first slave device; the maximum delayed transmission duration is the delay between sending the end start command to the end slave device and sending the start command; the delayed execution duration represents the interval between receiving the target start command and executing the target start command.
[0016] The slave device is configured to start timing in response to a target startup command, and execute the target startup command when the timing duration reaches the delay execution duration.
[0017] The device synchronization method provided in this application determines the delayed execution time of the target slave device by the host device based on the difference between the maximum delayed transmission time and the target delayed transmission time. The target delayed transmission time is the delay between the host device issuing the target start command and issuing the first start command, and the maximum delayed transmission time is the delay between the host device issuing the last start command and issuing the first start command. Therefore, the delayed execution time can compensate for the time difference between the time when the target slave device executes the target start command and the time when the last slave device executes the last start command, ensuring that the execution time of the start command of the target slave device and the last slave device is consistent, realizing the synchronization of each slave device and expanding the application scenarios of Bluetooth communication technology.
[0018] These or other aspects of this application will become more apparent in the following description of the embodiments. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of a master-slave tree network structure in a Bluetooth communication system in related technologies.
[0021] Figure 2 This is a schematic diagram of an application scenario of the device synchronization method provided in the embodiments of this application;
[0022] Figure 3 This is a flowchart illustrating a device synchronization method provided in an embodiment of this application;
[0023] Figure 4 This is another schematic flowchart of the device synchronization method provided in the embodiments of this application;
[0024] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0025] Figure 6 This is a schematic diagram of a three-level tree network provided in the embodiments of this application. Detailed Implementation
[0026] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0027] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0028] In the embodiments of this application, it should be noted that, in this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0029] Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that 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 inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0030] In the description of the embodiments of this application, the words "example" or "for example" are used to indicate exemplification, illustration, or description. Any embodiment or design described as "example" or "for example" in the embodiments of this application is not to be construed as being more preferred or having more advantages than another embodiment or design. The use of the words "example" or "for example" is intended to present relative concepts in a clear manner.
[0031] In addition, "multiple" in the embodiments of this application refers to two or more. Therefore, "multiple" in the embodiments of this application can also be understood as "at least two".
[0032] Before introducing the device synchronization method, electronic device and Bluetooth communication system of this application, we will first introduce the relevant background information of the embodiments of this application.
[0033] Currently, connecting multiple devices via Bluetooth primarily involves using a master-slave device model to extend the devices into a tree-like network at the application layer. Please refer to [link / reference]. Figure 1 , Figure 1 This is a schematic diagram of a master-slave tree network structure in a Bluetooth communication system of related technologies. The Bluetooth communication system 100 includes a master terminal 110, a first slave terminal 121, a second slave terminal 122, a third slave terminal 123, and a fourth slave terminal 124. During the Bluetooth networking phase, the master terminal 110 pairs and connects with each of the four slave terminals one by one, establishing corresponding communication channels. Thus, the master terminal 110 can send data to the corresponding slave terminal or receive data from the corresponding slave terminal through the corresponding communication channel.
[0034] However, in this multi-device connection method, the host terminal 110 cannot send data to all slave terminals simultaneously. Instead, it needs to communicate with different slave terminals by sending commands at different times. Therefore, the timing of receiving commands by each slave terminal in the Bluetooth communication system 100 varies, resulting in a time difference in the execution time of the commands by each slave terminal. This makes it unsuitable for application scenarios that require synchronous operation of the slave terminals.
[0035] For example, Figure 1 The illustrated Bluetooth communication system is applied in a rope skipping competition scenario. The host terminal 110 sequentially sends start commands to each slave terminal. Because the command sending uses a synchronous queue, there is a time interval between each start command. Therefore, there is a time difference between when the first slave terminal 121, the second slave terminal 122, the third slave terminal 123, and the fourth slave terminal 124 receive their respective start commands. When athletes start skipping rope simultaneously according to the starting gun or whistle, each slave terminal will start counting sequentially due to the time difference. However, when athletes stop skipping rope simultaneously according to the whistle, the slave terminals that start counting later will not have their jump counts recorded for the earlier periods, leading to inaccurate skipping scores and affecting the fairness and impartiality of the rope skipping competition.
[0036] An average person jumps rope about 180 times per minute, averaging 3 jumps per second. The current world record is 316 jumps per minute, averaging 5.27 jumps per second. This demonstrates that in jump rope competitions, the time delay between the device and the receiver in receiving the start command significantly impacts the outcome.
[0037] Based on this, this application provides a device synchronization method, an electronic device, and a Bluetooth communication system, which will be described in detail below.
[0038] Please see Figure 2 , Figure 2This is a schematic diagram illustrating an application scenario of the device synchronization method provided in this application embodiment. The device synchronization method is applied to a rope skipping competition system 200, which may include a host device 210, a first slave device 221, a second slave device 222, and a third slave device 223. The three slave devices correspond to three rope skipping athletes, respectively. Before the comparison begins, the host device 210 pairs with each of the three slave devices via Bluetooth to complete the network setup.
[0039] The host device 210 can sequentially send control commands to each slave device based on a synchronization queue to control the operation of each slave device. The slave devices can be smart jump ropes, or general or special devices that can count the number of jump ropes by athletes, etc. This application does not limit the device types of the host device and slave devices mentioned above.
[0040] Those skilled in the art will understand that Figure 2 The application environment shown is merely one application scenario adapted to the solution of this application, and does not constitute a limitation on the application scenario of the solution of this application. Other application scenarios may include more than one application scenario. Figure 2 The number of more or fewer slave devices shown, for example Figure 2 Only three slave devices are shown in the diagram. It is understood that the jump rope competition system 200 may also include more slave devices that are networked with the host device 210. The specific details are not limited here.
[0041] In this application, the host device 210 is mainly used to determine the delayed execution duration of the target slave device based on the difference between the maximum delayed transmission duration and the target delayed transmission duration. The target delayed transmission duration is the delay between sending the target start command to the target slave device and sending the start command to the first slave device; the maximum delayed transmission duration is the delay between sending the end start command to the end slave device and sending the start command. The delayed execution duration represents the interval between receiving the target start command and executing the target start command. The delayed execution duration is sent to the target slave device so that the target slave device executes the target start command based on the delayed execution duration.
[0042] The target slave device can be any one of the three slave devices. The master device 210 can determine the arrangement of each slave device according to the pairing order during the Bluetooth networking phase.
[0043] For example, if the devices are paired sequentially from left to right, the first slave device 221 is the head slave device and the third slave device 223 is the tail slave device. In this case, when the target slave device is the first slave device 221, the target delay transmission time is 0; when the target slave device is the third slave device 223, the target delay transmission time is the maximum delay transmission time.
[0044] Conversely, if the pairing proceeds from right to left, the third slave device 223 becomes the first slave device, and the first slave device 221 becomes the last slave device. In this case, when the target slave device is the first slave device 221, the target delayed transmission time is the maximum delayed transmission time; when the target slave device is the third slave device 223, the target delayed transmission time is 0.
[0045] It is understood that, in addition to the two pairing orders mentioned above, Bluetooth pairing between the host device 210 and each slave device can also be performed according to other pairing orders, but the specific order is not limited here.
[0046] It should be noted that, in addition to the scenario of rope skipping competitions, the device synchronization method of this application can also be applied to other application scenarios that require the synchronous startup of slave devices. Those skilled in the art will know that, with the evolution of technology and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0047] First, this application provides a device synchronization method. The executing entity of this device synchronization method can be a device synchronization device, or a host device, server device, or user equipment (UE) integrating the device synchronization device, etc., which can be determined according to the actual application scenario and is not limited here. Specifically, the UE can be a terminal device such as a smartphone, tablet computer, laptop computer, PDA, or desktop computer. The device synchronization method of this application will be described in detail below using a host device as the executing entity as an example.
[0048] Please see Figure 3 , Figure 3 This is a flowchart illustrating a device synchronization method provided in an embodiment of this application. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0049] In this embodiment of the application, the device synchronization method can be applied to a host device in a Bluetooth communication system. The Bluetooth communication system may also include multiple slave devices networked with the host device. The device synchronization method may include the following steps.
[0050] Step S301: Determine the delayed execution time of the target slave device based on the difference between the maximum delayed transmission time and the target delayed transmission time; wherein, the target delayed transmission time is the delay time between sending the target start command to the target slave device and sending the first start command to the first slave device, and the maximum delayed transmission time is the delay time between sending the last start command to the last slave device and sending the first start command; the delayed execution time characterizes the interval time from when the target slave device receives the target start command to when it executes the target start command.
[0051] Because the master device sends the start command to different slave devices at different times, there is a time difference between the times when each slave device receives the corresponding start command.
[0052] It is understandable that slave devices listed later receive the start command later than slave devices listed earlier. Specifically, the first slave device in the list, also known as the head slave device, is the first slave device to receive the start command, while the last slave device in the list, also known as the tail slave device, is the last slave device to receive the start command.
[0053] To ensure that all slave devices can start synchronously, the slave device that receives the start command first needs to wait for the end slave device to receive the start command before starting to execute the start command together with the end slave device.
[0054] Therefore, in this embodiment of the application, the time difference between the first slave device and the last slave device receiving the start command can be used as a benchmark to determine the waiting time required for other slave devices arranged in front of the last slave device.
[0055] For the target slave device, its waiting time can be the difference between the time it takes for the end slave device to receive the start command later than the time it takes for the target slave device to receive the start command later than the time it takes for the end slave device to receive the start command. This difference can be regarded as the delayed execution time of the target slave device. In other words, the target slave device needs to go through the time delay from receiving the corresponding start command (target start command) to executing the command, so that the target slave device can start executing the start command together with the end slave device.
[0056] For the master device that issues the start command, the delay time for sending the start command to the end slave device is longer than the delay time for sending start commands to other slave devices. Therefore, the master device can determine the waiting time of the target slave device, i.e. the delay execution time, based on the difference between the maximum delay transmission time and the target delay transmission time.
[0057] Step S302: Send the delayed execution duration to the target slave device so that the target slave device executes the target startup command based on the delayed execution duration.
[0058] After obtaining the delayed execution duration of the target slave device according to step S301, the host device can send the delayed execution duration to the target slave device via the Bluetooth network. This allows the target slave device to execute the target startup command after a delay of the time length represented by the delayed execution duration when it receives the target startup command, thereby achieving the effect of synchronously executing the startup command with the end slave device.
[0059] For example, if the slave devices networked with the host device include the first slave device, intermediate slave devices, and last slave devices, the time interval between the host device sending the first start command to the first slave device and sending the intermediate start command to the intermediate slave device is 30ms, and the time interval between the host device sending the first start command to the first slave device and sending the last start command to the last slave device is 60ms. Therefore, the maximum delay transmission time is 60ms.
[0060] When the target slave device is the first slave device, the target delay transmission time is 0, and the target slave device's delay execution time is 60ms. Therefore, after receiving the first start command from the host device, the first slave device needs to wait 60ms before executing the command.
[0061] If the target slave device is an intermediate slave device, the target delay transmission time is 30ms. At this time, the target slave device's delay execution time is 60ms-30ms=30ms. In other words, after receiving the intermediate start command, the intermediate slave device needs to wait 30ms before executing the command.
[0062] When the target slave device is the end slave device, the target delay transmission time is equal to the maximum delay transmission time. At this time, the delay execution time of the target slave device is 0. That is to say, when the end slave device receives the end start command, it can execute the command immediately, so that the first slave device, the intermediate slave device and the end slave device can execute the start command synchronously.
[0063] In the context of rope skipping competitions, this allows each slave device to simultaneously collect and analyze the rope skipping data of the respective athletes, ensuring the accuracy of the collected results and improving the fairness and impartiality of the competition.
[0064] In this embodiment, the host device determines the delayed execution time of the target slave device based on the difference between the maximum delayed transmission time and the target delayed transmission time. The target delayed transmission time is the delay between the host device issuing the target start command and issuing the initial start command, while the maximum delayed transmission time is the delay between the host device issuing the final start command and issuing the initial start command. Therefore, the delayed execution time can compensate for the time difference between the time when the target slave device executes the target start command and the time when the final slave device executes the final start command, ensuring that the execution time of the start command by the target slave device and the final slave device is consistent, realizing the synchronization of each slave device and expanding the application scenarios of Bluetooth communication technology.
[0065] Next, continue with Figure 3 The possible implementation methods for each step shown are explained in detail.
[0066] In some embodiments of this application, the delayed execution duration of the target slave device is determined based on the difference between the maximum delayed transmission duration and the target delayed transmission duration. Prior to this, the method may further include:
[0067] The target delay transmission duration is determined based on the arrangement position of the target slave device in the Bluetooth communication system and the time interval between the start command issued by the master device.
[0068] In this embodiment of the application, during the Bluetooth networking phase, the host device can determine the arrangement order of each slave device according to the pairing order, that is, the arrangement position of each slave device in the Bluetooth communication system.
[0069] Meanwhile, since the host device issues start commands based on a synchronous queue, there is a time interval between the issuance of each start command for each slave device. Therefore, the host device can determine the issuance time of the target start command for the target slave device based on the time interval and the arrangement position of the target slave device, thereby obtaining the target delay transmission time of issuing the target start command to the target slave device compared to issuing the first start command to the first slave device.
[0070] For example, in a system with three slave devices, the master device sends the start command at a time interval of 20ms. That is, after the master device sends the start command to the first slave device, it sends the intermediate start command to the middle slave device after a 20ms interval, and then sends the end start command to the end slave device after a 20ms interval. Therefore, if the target slave device is the end slave device, the target delay transmission time is 40ms.
[0071] Understandably, in other application scenarios, the time interval between the host device sending start commands to each slave device can also be different. For example, after the host device sends the first start command, it sends the intermediate start command after a 20ms interval, and then sends the last start command after a 30ms interval. In this case, the target delay sending time is 50ms.
[0072] Therefore, the target delay transmission duration can be determined based on the location of the target slave device and the time interval between the master device issuing the start command in the actual application scenario.
[0073] In some embodiments of this application, sending the delayed execution duration to the target slave device may include:
[0074] According to the agreed instruction protocol, the delay duration is added to the target startup instruction;
[0075] Based on the target delay transmission duration, the target start command carrying the delay execution duration is sent to the target slave device.
[0076] In this embodiment of the application, the host device can determine the delay execution duration corresponding to each slave device at any time before issuing the start command, such as during the Bluetooth pairing phase or after pairing is completed.
[0077] Normally, communication between the master device and each slave device is based on an agreed-upon communication protocol. However, since this application involves the delayed execution of the startup command by the slave device, a protocol can be agreed upon for the communication commands before applying the method of this application. This allows the slave device to parse the received startup command based on the agreed-upon command protocol and obtain the information carried within it.
[0078] In one implementation, the host device can add the determined delay duration to the target startup command according to the command protocol. Then, when the time to send the target startup command arrives, the delay duration can be sent to the target slave device along with the target startup command.
[0079] The target slave device then reads the target startup command based on the agreed instruction protocol, extracts the delayed execution duration carried in it, and starts timing at the same time. When the timing duration reaches the delayed execution duration, the target startup command is then executed.
[0080] As shown in Table 1 below, this is an instruction protocol provided in an embodiment of this application. The instruction protocol can also define the working state (mode) and working parameters (param) of the slave device.
[0081]
[0082]
[0083] In some embodiments of this application, sending the delayed execution duration to the target slave device may further include:
[0084] Generate a delayed execution instruction based on the delay duration;
[0085] Send a delayed execution instruction to the target slave device, wherein the sending time of the delayed execution instruction is earlier than the sending time of the target start instruction, or the delayed execution instruction is sent to the target slave device after the target delayed sending time, wherein the sending time of the delayed execution instruction is the same as the sending time of the target start instruction.
[0086] In this embodiment of the application, the delayed execution duration may not be added to the target startup instruction. Instead, a corresponding delayed execution instruction may be generated based on the delayed execution duration, and then the delayed execution instruction may be sent to the target slave device, so that the target slave device can determine the waiting time from receiving the target startup instruction to executing the target startup instruction based on the delayed execution instruction.
[0087] In one implementation, the host device can send the delayed execution command to the target slave device earlier than the time it sends the target start command to the target slave device. For example, the host device can generate the delayed execution command based on the delayed execution duration and send the delayed execution command to the target slave device when Bluetooth pairing ends, and then send the target start command to the target slave device when the target delayed transmission duration is reached.
[0088] In another implementation, the host device can also send a delayed execution instruction simultaneously with the target startup instruction to the target slave device. That is, when the target delay time for sending the target startup instruction is reached, the host device can send both the target startup instruction and the delayed execution instruction to the target slave device at the same time, so that the target slave device can delay the execution of the target startup instruction according to the delayed execution instruction.
[0089] In some embodiments of this application, the host device may be configured with a display unit, and the method may further include:
[0090] Based on the maximum delay transmission duration, the control display unit synchronously displays the data when the target slave device executes the target start command.
[0091] In the application scenario of rope skipping competition, when the host device starts to issue the start command, its display unit will start to display the countdown of the competition time. However, since each slave device will only execute the start command synchronously when the end slave device receives the end start command, the display unit and each slave device will be out of sync, which will cause the user to feel a visual discrepancy.
[0092] Therefore, in this embodiment, the display unit can also perform synchronous display when the end slave device receives the end start command. The host module sends the end start command after a delay of the maximum delay duration. Therefore, the host device can control the display unit to display synchronously when all slave devices execute the start command according to the maximum delay duration, so as to achieve visual synchronization.
[0093] In some embodiments of this application, controlling the display unit to synchronously display when the target slave device executes the target startup command, based on the maximum delay transmission duration, may include:
[0094] The first timing duration is obtained by the difference between the preset preparation time corresponding to the first-end start command and the maximum delay transmission time; wherein the preset preparation time is greater than or equal to the maximum delay transmission time.
[0095] After the host device responds to the start sending command to start the first timer, when the current timer duration reaches the first timer duration, it sends a start command and continues timing;
[0096] When the current timeout reaches the preset preparation time, the control display unit will display synchronously.
[0097] When a user triggers the start of a jump rope competition, the display unit typically shows a countdown of a certain duration. The competition officially begins the instant the countdown ends, and the host device sends out the initial start command. This countdown can be considered the preset preparation time corresponding to the issuance of the initial start command; understandably, this preset preparation time should be greater than or equal to the maximum delay transmission time.
[0098] Since it is necessary to control the display unit to display synchronously when each slave device executes the start command, the first start command can be issued before the countdown ends, that is, the first start command can be issued in advance to ensure that the last start command is issued just as the countdown ends, that is, the last slave device just receives the last start command.
[0099] It should be noted that the transmission time from when the start command is sent from the host device to when it is received by the slave device is not considered here. In some application scenarios, the time spent in this process can be taken into account based on the ideas and principles of this method.
[0100] In this embodiment, the first timing duration obtained by subtracting the maximum delay transmission duration from the preset preparation duration can be used as the condition for triggering the issuance of the start command.
[0101] In other words, when the host device receives the start sending command, the start sending command can be used to instruct the host device to send a start-up command to the first slave device, which can then start the timer for the first time. When the current timeout reaches the first timeout duration, the host device can send the start-up command.
[0102] Meanwhile, since the countdown has not yet ended, the timer continues to count down. When the current countdown duration reaches the preset preparation duration, it indicates that the countdown has ended. At this time, the end slave devices also receive the end start command, and all slave devices begin to execute the start command. Therefore, at this time, the display unit can be controlled simultaneously to display the progress of the competition, so as to achieve the effect of visual synchronization.
[0103] Understandably, if the preset preparation time is equal to the maximum delay transmission time, the first timing duration is 0. At this time, the host device can issue the first-end start command at the same time as receiving the start transmission command, and then the timer continues to count until the host device issues the end-end start command, and then synchronously controls the display unit to display.
[0104] The above embodiment describes issuing the start command before the countdown ends, i.e. before the preset preparation time is reached. In other application scenarios, the host device can also issue the start command when the countdown ends, but the display unit does not display the competition progress at this time. Instead, after the maximum delay transmission time, the host device issues the end command and controls the display unit to display the competition progress at the same time.
[0105] Therefore, in some embodiments of this application, controlling the display unit to perform synchronous display when the target slave device executes the target startup command, based on the maximum delay transmission duration, may further include:
[0106] In response to the start of the sending command, the second timing is initiated;
[0107] When the second timing duration reaches the preset preparation duration, a start command is issued and the third timing is initiated.
[0108] When the third timing duration reaches the maximum delay transmission duration, the control display unit will display synchronously.
[0109] In this embodiment, when the host device receives the start sending command, it can start the timer for the second timing. When the second timing duration reaches the preset preparation duration, it indicates that the countdown has ended. At this time, the host device can send the first-end start command to the first-end slave device. At the same time, the timer is cleared and the third timing is restarted. During the third timing process, the host device sends start commands to other slave devices in sequence until the third timing duration reaches the maximum delay sending duration. At this time, the host device sends the last-end start command to the last-end slave device. At this time, all slave devices start to execute the start command. Therefore, controlling the display unit to display the competition progress at the same time can also achieve the effect of visual synchronization.
[0110] The above embodiments illustrate the device synchronization method of this application with the host device as the execution subject. It can be understood that in a Bluetooth communication system, a slave device that is networked with the host device can also act as the execution subject to implement the device synchronization method of this application.
[0111] Please see Figure 4 , Figure 4 This is another schematic flowchart of the device synchronization method provided in this application embodiment. The device synchronization method can be applied to any slave device in a Bluetooth communication system. The Bluetooth communication system may also include a master device that is networked with each slave device. The device synchronization method may include the following steps:
[0112] Step S401: Obtain the delayed execution duration sent by the host device; wherein, the delayed execution duration represents the interval between the target slave device receiving the target start command and executing the target start command. The delayed execution duration is determined by the host device based on the difference between the maximum delayed transmission duration and the target delayed transmission duration. The target delayed transmission duration is the delay time between the host device sending the target start command and sending the first start command to the first slave device. The maximum delayed transmission duration is the delay time between the host device sending the last start command to the last slave device and sending the first start command.
[0113] Step S402: In response to the target startup command, start timing. When the timing duration reaches the delay execution duration, execute the target startup command.
[0114] As can be seen from the description in the above embodiments, the delayed execution duration can be used to compensate for the time difference between the target slave device receiving the target start command and the end slave device receiving the end start command.
[0115] When the target slave device receives the target start command, it can start a timer to keep track of time. When the end slave device receives the end start command, the timer duration of the target slave device will also reach the delay execution duration. At this time, the target slave device and the end slave device will execute the corresponding start command synchronously, thus achieving the effect of synchronization of all slave devices.
[0116] The device synchronization method in this application embodiment involves the target slave device executing the target startup command after a delay of a specified execution duration. This delay execution duration is the difference between the maximum delay transmission duration and the target delay transmission duration. The target delay transmission duration is the delay between the host device issuing the target startup command and issuing the initial startup command, while the maximum delay transmission duration is the delay between the host device issuing the final startup command and issuing the initial startup command. Therefore, the delay execution duration can compensate for the time difference between the time when the target slave device executes the target startup command and the time when the final slave device executes the final startup command, ensuring that the execution times of the startup commands by the target slave device and the final slave device are consistent, achieving synchronization of all slave devices and expanding the application scenarios of Bluetooth communication technology.
[0117] like Figure 5 As shown, this application embodiment also provides an electronic device 500, which may include a processor 501 and a memory 502. The memory 502 is used to store a computer program 503. When the computer program 503 is executed by the processor 501, it is used to implement the steps in any of the above-described method embodiments, for example... Figure 3 and Figure 4 The steps in the device synchronization method shown.
[0118] For example, computer program 503 may be divided into one or more modules / units, which are stored in memory 502 and executed by processor 501 to complete the method of this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 503 in electronic device 500.
[0119] Those skilled in the art will understand that Figure 5 This is merely an example of an electronic device and does not constitute a limitation on electronic devices. Electronic devices may include more or fewer components than those shown in the illustration, or combinations of certain components, or different components, such as input / output devices, network access devices, buses, etc.
[0120] The processor 501 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0121] The memory 502 can be an internal storage unit of the electronic device, such as on-chip flash memory or random access memory (RAM), or it can be an external storage device, such as off-chip flash memory. The memory 502 can also include both internal and external storage units. The memory 502 is used to store computer programs and other programs and data required by the electronic device. The memory 502 can also be used to temporarily store data that has been output or will be output.
[0122] This electronic device can achieve the functions described in this application. Figures 3 to 4 The device synchronization method corresponding to any embodiment can therefore achieve the functionality described in this application. Figures 3 to 4 For details on the beneficial effects that the device synchronization method can achieve in any embodiment, please refer to the preceding description, which will not be repeated here.
[0123] Based on the above embodiments, this application also provides a Bluetooth communication system, which may include a host device and multiple slave devices networked with the host device.
[0124] For each of the multiple slave devices, the master device can determine the delayed execution duration of the slave device based on the difference between the maximum delayed transmission duration and the target delayed transmission duration, and send the delayed execution duration to the slave device. Here, the target delayed transmission duration is the delay time between sending the target start command to the slave device and sending the start command to the first slave device, and the maximum delayed transmission duration is the delay time between sending the end start command to the end slave device and sending the start command. The delayed execution duration represents the interval between the slave device receiving the target start command and executing the target start command.
[0125] The slave device can be configured to start a timer in response to a target start command, and execute the target start command when the timer duration reaches the delay execution duration.
[0126] The host device in this Bluetooth communication system can implement the functions described in this application. Figure 3 The device synchronization method corresponding to any embodiment can therefore achieve the functionality described in this application. Figure 3Corresponding to the beneficial effects achievable by the device synchronization method in any embodiment; the slave device in this Bluetooth communication system can realize the advantages described in this application. Figure 4 The device synchronization method corresponding to any embodiment can therefore achieve the functionality described in this application. Figure 4 For details on the beneficial effects that the device synchronization method can achieve in any embodiment, please refer to the preceding description, which will not be repeated here.
[0127] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of devices and units is merely an example. In practical applications, the above functions can be assigned to different functional units or modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the devices and units in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0128] The technical solution of this application will be explained below in conjunction with specific application scenarios to aid understanding.
[0129] Application Scenario 1
[0130] like Figure 6 The diagram shown is a three-level tree network structure for Bluetooth networking used in a rope skipping competition. The host device corresponds to 7 first-level slave devices, each first-level slave device corresponds to 8 second-level slave devices, and each second-level slave device corresponds to one athlete to count the number of rope skips for them.
[0131] This network forwards startup commands from primary slave devices to secondary slave devices, avoiding the problem of excessive maximum latency caused by the master device directly sending startup commands to all secondary slave devices.
[0132] The interval between each pair of adjacent slave devices receiving the start command is 50ms. Figure 6It can be seen that slave device 7, one of the seven primary slave devices, receives the start command 300ms later than slave device 1. Therefore, the first slave device under slave device 7, namely slave device 56, also receives the start command 300ms later than the first slave device under slave device 1, namely slave device 8. Furthermore, the last slave device under slave device 7, namely slave device 63, receives the start command 350ms later than slave device 56. Thus, slave device 63 receives the start command a total of 650ms later than slave device 8. Therefore, the maximum transmission delay in this network is 650ms.
[0133] If the target slave device is slave device number 8, and its target delay transmission time is 0ms, then its corresponding delay execution time is 650ms - 0ms = 650ms. Therefore, after receiving the target start command, slave device number 8 needs to wait 650ms before executing the target start command.
[0134] If the target slave device is slave device number 9, and its target delay transmission time is 50ms, then its corresponding delay execution time is 650ms - 50ms = 600ms. Therefore, after receiving the target start command, slave device number 9 needs to wait 600ms before executing the target start command.
[0135] By analogy, all secondary slave devices can execute the start command synchronously with slave device 63 to ensure the accuracy of the rope skipping results.
[0136] Application Scenario 2
[0137] Figure 6 The host device is equipped with a display that displays a countdown before the start of the match and the current match duration during the match. The countdown is 3 seconds, and the maximum delay transmission time is 650ms. Therefore, the first timing duration is 3s-650ms=2350ms.
[0138] When the host device receives the start sending command, it triggers the display to show a 3-second countdown and starts the first countdown of the timer. When the current countdown time reaches 2350ms, the host device starts to send a start command to slave device 1, and slave device 1 then starts to send a start command to slave device 8.
[0139] When the current timer duration reaches 3 seconds, slave device 7 sends a start command to slave device 63. All secondary slave devices begin executing the start command, and the master device controls the display to display synchronously.
[0140] Application Scenario 3
[0141] Figure 6 The host device is equipped with a display that displays a countdown before the start of the match and the current match duration during the match. The countdown is 3 seconds and the maximum delay transmission time is 650ms.
[0142] When the host device receives the start sending command, it triggers the display to show a 3-second countdown and starts the second countdown of the timer. When the current countdown time reaches 3 seconds, the host device starts to send a start command to slave device 1, which then starts to send a start command to slave device 8. At the same time, the timer is reset to zero and the third countdown starts.
[0143] When the current timer duration reaches 650ms, slave device 7 sends a start command to slave device 63. All secondary slave devices begin executing the start command, and the master device controls the display to display synchronously.
[0144] The above are merely preferred embodiments of this application and are not intended to limit this application in any way. Although this application has disclosed preferred embodiments as above, it is not intended to limit this application. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the technical solution of this application. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of this application without departing from the scope of the technical solution of this application shall still fall within the scope of the technical solution of this application.
Claims
1. A method of device synchronization, the method comprising: The application relates to a host device applied to a Bluetooth communication system, wherein the Bluetooth communication system further comprises a plurality of slave devices networked with the host device; the host device sequentially sends starting instructions to the slave devices based on a synchronization queue; and the method comprises the following steps: determining a delay execution time length of a target slave device according to a difference between a maximum delay sending time length and a target delay sending time length; wherein the target delay sending time length is a delay time length of sending a target starting instruction to the target slave device compared with sending a head starting instruction to a head slave device, and the maximum delay sending time length is a delay time length of sending an end starting instruction to an end slave device compared with sending the head starting instruction; the delay execution time length represents an interval time length from receiving the target starting instruction to executing the target starting instruction of the target slave device; and the target delay sending time length is obtained by the host device according to an arrangement position of the target slave device in the Bluetooth communication system and a time interval of sending the starting instruction in a Bluetooth network stage; sending the delay execution time length to the target slave device, so that the target slave device executes the target starting instruction based on the delay execution time length.
2. The device synchronization method of claim 1, wherein, The step of sending the delay execution time length to the target slave device comprises the following steps: adding the delay execution time length to the target starting instruction according to an agreed instruction protocol; sending the target starting instruction carrying the delay execution time length to the target slave device based on the target delay sending time length.
3. The device synchronization method of claim 1, wherein, The step of sending the delay execution time length to the target slave device comprises the following steps: generating a delay execution instruction according to the delay execution time length; sending the delay execution instruction to the target slave device, wherein the sending time of the delay execution instruction is earlier than the sending time of the target starting instruction, or sending the delay execution instruction to the target slave device after the target delay sending time length, wherein the sending time of the delay execution instruction is consistent with the sending time of the target starting instruction.
4. The device synchronization method of claim 1, wherein, The host device is configured with a display unit, and the method further comprises the following steps: controlling the display unit to synchronously display when the target slave device executes the target starting instruction according to the maximum delay sending time length.
5. The device synchronization method of claim 4, wherein, The step of controlling the display unit to synchronously display when the target slave device executes the target starting instruction according to the maximum delay sending time length comprises the following steps: obtaining a first timing time length according to a difference between a preset preparation time length corresponding to sending the head starting instruction and the maximum delay sending time length; wherein the preset preparation time length is greater than or equal to the maximum delay sending time length; when a current timing time length reaches the first timing time length after the host device starts a first timing in response to a starting sending instruction, sending the head starting instruction and continuing timing; when the current timing time length reaches the preset preparation time length, controlling the display unit to synchronously display.
6. The device synchronization method of claim 4, wherein, The step of controlling the display unit to synchronously display when the target slave device executes the target starting instruction according to the maximum delay sending time length comprises the following steps: in response to the start sending instruction, starting a second timing; when the second timing reaches a preset preparation time length, issuing the head end start instruction and starting a third timing; when the third timing reaches the maximum delay sending time length, controlling the display unit to perform synchronous display.
7. A method of device synchronization, the method comprising: The method is applied to any slave device in a Bluetooth communication system, the Bluetooth communication system further comprising a master device networking with each slave device, the master device issuing start instructions to each slave device in turn based on a synchronization queue, and the method comprising: obtaining a delay execution time length issued by the master device; wherein the delay execution time length represents an interval time length from when a target slave device receives a target start instruction to when the target slave device executes the target start instruction, the delay execution time length being determined by the master device according to a difference between a maximum delay sending time length and a target delay sending time length, the target delay sending time length being a delay time length of the master device issuing the target start instruction compared to issuing a head end start instruction to a head end slave device, and the maximum delay sending time length being a delay time length of the master device issuing an end start instruction to an end slave device compared to issuing the head end start instruction; the target delay sending time length being obtained by the master device in a Bluetooth networking stage according to a position of the target slave device in the Bluetooth communication system and a time interval of issuing the start instruction; in response to the target start instruction, starting a timing, and when the timing reaches the delay execution time length, executing the target start instruction.
8. An electronic device, comprising: The device comprises a processor and a memory, the memory being used to store a computer program, the computer program being executed by the processor to implement steps in the device synchronization method of any one of claims 1 to 7.
9. A Bluetooth communication system characterized by The Bluetooth communication system comprises a master device and a plurality of slave devices networking with the master device, the master device issuing start instructions to each slave device in turn based on a synchronization queue; for each slave device of the plurality of slave devices, the master device is configured to determine a delay execution time length of the slave device according to a difference between a maximum delay sending time length and a target delay sending time length, and send the delay execution time length to the slave device; wherein the target delay sending time length is a delay time length of the master device issuing a target start instruction to the slave device compared to issuing a head end start instruction to a head end slave device, and the maximum delay sending time length is a delay time length of the master device issuing an end start instruction to an end slave device compared to issuing the head end start instruction; the delay execution time length representing an interval time length from when the slave device receives the target start instruction to when the slave device executes the target start instruction; the target delay sending time length being obtained by the master device in a Bluetooth networking stage according to a position of the target slave device in the Bluetooth communication system and a time interval of issuing the start instruction; the slave device being configured to, in response to the target start instruction, start a timing, and when the timing reaches the delay execution time length, execute the target start instruction.
Citation Information
Patent Citations
Delay compensation for synchronizing shared video content within web conference session
CN115053518A