Bluetooth service synchronization method and device, storage medium and electronic equipment
By creating and broadcasting target period beacons in Bluetooth devices, the problem of time slot conflict in multi-device Bluetooth synchronization is solved, and efficient time slot allocation and stable communication between devices are achieved.
Patent Information
- Application Number
- CN202411910780.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-03-11
AI Technical Summary
In multi-device Bluetooth synchronization scenarios, time slot conflict problems caused by clock misalignment affect the stability of connection and synchronization.
Create a target periodic beacon through the first Bluetooth device and broadcast the beacon, enabling other Bluetooth devices to search and discover and create their own periodic beacon based on the beacon, thereby performing time slot allocation and avoiding conflicts.
It effectively avoids time slot conflicts between devices, and improves the collaboration efficiency and communication stability between Bluetooth devices.
Smart Images

Figure CN119603762A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and specifically to a Bluetooth service synchronization method, device, storage medium and electronic device. Background Art
[0002] With the development of communication technology, Bluetooth Low Energy (BLE) has been widely used. However, when BLE is used in multi-synchronization or multi-connection, connection or synchronization time slot conflicts often occur due to the misalignment of multiple device clocks. Summary of the invention
[0003] The embodiments of the present application provide a Bluetooth service synchronization method, device, storage medium and electronic device, which can solve the problem of time slot conflict between devices.
[0004] In a first aspect, an embodiment of the present application provides a Bluetooth service synchronization method, including:
[0005] When the first Bluetooth device creates a new service, it searches whether there is a created periodic beacon, and the created periodic beacon is created first by other Bluetooth devices;
[0006] If the created periodic beacon is not searched, create a target periodic beacon through the first Bluetooth device, and broadcast the target periodic beacon, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon;
[0007] When a new connection or synchronous broadcast service needs to be established between the first Bluetooth device and other Bluetooth devices, time slots are allocated according to the periodic beacons created by each of them.
[0008] In the Bluetooth service synchronization method provided in the embodiment of the present application, the target periodic beacon includes the transmission time of the beacon data and the window duration of the reserved time slot;
[0009] The other Bluetooth devices search for and discover the target periodic beacon and create respective periodic beacons according to the target periodic beacon, including:
[0010] The other Bluetooth devices create their own periodic beacons according to the sending time of the beacon data and the window duration of the reserved time slot.
[0011] In the Bluetooth service synchronization method provided in an embodiment of the present application, when creating the target period beacon, the first Bluetooth device sets the window duration of the reservation time slot to an integer multiple of the basic period, and dynamically adjusts the size of the basic period according to its own service type and priority.
[0012] In the Bluetooth service synchronization method provided in an embodiment of the present application, after searching for the target periodic beacon, the other Bluetooth devices calculate their own receiving time offset values by parsing the sending time of the beacon data, and synchronously adjust their own periodic beacons based on the receiving time offset value so that the start time of their time slots is aligned with the reserved time slot of the target periodic beacon.
[0013] In the Bluetooth service synchronization method provided in an embodiment of the present application, when the time slot requirement for a new connection or synchronized broadcast service between the first Bluetooth device and the other Bluetooth devices exceeds the window duration of the reserved time slot, the first Bluetooth device preferentially releases its occupied low-priority service time slot to meet new service requirements.
[0014] In the Bluetooth service synchronization method provided in an embodiment of the present application, the target periodic beacon includes time slot allocation information of the periodic service of the first Bluetooth device, and the time slot allocation information is used to instruct other Bluetooth devices to avoid service time slot conflicts when creating their own periodic beacons.
[0015] In the Bluetooth service synchronization method provided in the embodiment of the present application, when the first Bluetooth device allocates a new connection or a synchronous broadcast service within the window duration of the reserved time slot, it also includes:
[0016] Detecting an idle time slot within the window duration of the reservation time slot;
[0017] Allocating the idle time slot to a newly created connection or a simultaneous broadcast service;
[0018] The target period beacon is updated and broadcasted, so that the other Bluetooth devices adjust their own time slot allocation according to the updated target period beacon.
[0019] In a second aspect, an embodiment of the present application provides a Bluetooth service synchronization device, including:
[0020] A search unit, configured to search for a created periodic beacon when the first Bluetooth device creates a new service, wherein the created periodic beacon is created preferentially by other Bluetooth devices;
[0021] A creating unit, configured to create a target periodic beacon through the first Bluetooth device when the created periodic beacon is not searched, and broadcast the target periodic beacon, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon;
[0022] The allocation unit is used to allocate time slots according to the periodic beacons created by each of the first Bluetooth device and other Bluetooth devices when a new connection or synchronous broadcast service is required between the first Bluetooth device and other Bluetooth devices.
[0023] In a third aspect, an embodiment of the present application provides a storage medium, wherein the storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute any of the above-mentioned Bluetooth service synchronization methods.
[0024] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned Bluetooth service synchronization methods when executing the computer program.
[0025] In summary, the Bluetooth service synchronization method provided by the embodiment of the present application includes searching whether there is a created periodic beacon when the first Bluetooth device creates a new service, and the created periodic beacon is created first for other Bluetooth devices; if the created periodic beacon is not searched, a target periodic beacon is created by the first Bluetooth device, and the target periodic beacon is broadcast, so that other Bluetooth devices can search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon; when a new connection or synchronous broadcast service is required between the first Bluetooth device and other Bluetooth devices, time slots are allocated according to the periodic beacons created by each Bluetooth device. In this solution, the periodic beacons created by each Bluetooth device are allocated time slots, thereby avoiding time slot conflicts between devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 It is a flowchart of the Bluetooth service synchronization method provided in an embodiment of the present application.
[0028] Figure 2 It is a structural diagram of a Bluetooth service synchronization device provided in an embodiment of the present application.
[0029] Figure 3 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0031] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0032] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0033] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0034] In the description of the present application, it should be noted that the terms "upper", "lower", "left", "right", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, terms such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0035] In some Bluetooth usage scenarios, time slot reservation is important, but when there are multiple services or multiple connections on a device, the allocation of time slots between devices is not "uniformly scheduled". For example, one end of the device already has other services allocated to it in the negotiation area; or the time slots of broadcast services are completely determined by the master device, and it cannot participate in the negotiation mechanism; or there are multiple master devices, and they will each initiate services and cannot be uniformly negotiated because they are established one after another. In all of the above situations, there will be time slot conflicts, and neighboring nodes will not have aligned free time slots, resulting in the inability to establish a connection or synchronize broadcast information.
[0036] Based on this, the embodiments of the present application provide a Bluetooth service synchronization method, device, storage medium and electronic device, allowing high-priority node devices to pre-allocate synchronization alignment time slots. When there is a need to establish a connection or synchronize broadcast information in the node device, it can be allocated or created in the reserved alignment time slot.
[0037] The technical solutions shown in the present application will be described in detail below through specific embodiments. It should be noted that the description order of the following embodiments is not intended to limit the priority order of the embodiments.
[0038] See also Figure 1 , Figure 1 : is a flow chart of a Bluetooth service synchronization method provided in an embodiment of the present application. The specific flow of the Bluetooth service synchronization method may be as follows:
[0039] 101. When the first Bluetooth device creates a new service, it searches whether there is a created periodic beacon. The created periodic beacon is created first for other Bluetooth devices.
[0040] The periodic beacon is a signal used for communication between devices. It is broadcast periodically to ensure network synchronization and smooth device discovery. The periodic beacon can be in various forms such as periodic advertisement (PeriodicADV) and periodic audio beacon (BIS).
[0041] When the first Bluetooth device finds a created periodic beacon during the search process, by using the periodic beacons created by other Bluetooth devices, the first Bluetooth device can avoid time slot conflicts without coordination, thereby improving the collaboration efficiency between Bluetooth devices. In addition, the created periodic beacons have already arranged time slots and allocated resources, so the first Bluetooth device only needs to follow these periodic beacons, reducing the complexity of self-coordinating time slots and broadcasting. When the first Bluetooth device uses the created periodic beacon, it can quickly adapt according to the periodic beacons and business needs of other Bluetooth devices, thereby ensuring efficient communication between devices.
[0042] 102. If the created periodic beacon is not searched, create a target periodic beacon through the first Bluetooth device, and broadcast the target periodic beacon, so that other Bluetooth devices search for and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon.
[0043] When the first Bluetooth device does not find the created periodic beacon during the search process, it means that there are no other Bluetooth devices around that have priority to create periodic beacons or these Bluetooth devices have not yet broadcast. In this case, the first Bluetooth device will start its own periodic beacon creation process, generate a target periodic beacon and broadcast it, so that other devices can synchronize to this periodic beacon and create their own periodic beacons. This process ensures that the first Bluetooth device can still coordinate time slots and allocate resources even if there are no other Bluetooth devices broadcasting periodic beacons.
[0044] The target periodic beacon may include the transmission time of the beacon data and the window duration of the reserved time slot. Specifically, other Bluetooth devices may create their own periodic beacons according to the transmission time of the beacon data and the window duration of the reserved time slot.
[0045] In some embodiments, after searching for the target periodic beacon, other Bluetooth devices can parse the sending time of the beacon data, calculate their own receiving time offset value, and synchronously adjust their own periodic beacons based on the receiving time offset value to align the start time of their time slots with the reserved time slots of the target periodic beacon, thereby ensuring that the time slots between multiple devices will not conflict and ensuring the smooth progress of subsequent communication or synchronization services.
[0046] It is understandable that when other Bluetooth devices receive the target periodic beacon, the signal propagation time may also be different due to the different distances between the devices. Therefore, the device can calculate the reception time offset value based on the transmission time of the beacon data and its own reception time. The reception time offset value refers to the time difference between the time when the device receives the target periodic beacon and the time when the target beacon is broadcast.
[0047] The receive time is the moment when the device actually receives the target period beacon, and the send time of the beacon data is the timestamp contained in the target period beacon. In this way, other Bluetooth devices can understand the difference between their own clocks and the time slot arrangement in the target period beacon.
[0048] After calculating the receive time offset value, other Bluetooth devices need to adjust their own periodic beacons. Since the target periodic beacon already contains the window duration of the reserved time slot, other Bluetooth devices can align their own periodic beacons based on the receive time offset value they calculated, so that their time slots are completely aligned with the time slots of the target periodic beacon. Time slot alignment means that other Bluetooth devices will adjust the start time of their own periodic beacons to coincide with the start time of the time slot of the target periodic beacon. In this way, the time slots of each device will be synchronized to avoid time slot conflicts caused by time differences.
[0049] It should be noted that when creating the target periodic beacon, the first Bluetooth device can set the window duration of the reservation time slot according to its business needs and network environment. In order to facilitate coordination between devices, the first Bluetooth device usually sets the window duration of the reservation time slot to an integer multiple of the basic period to ensure that the periodic beacons of all devices can be synchronized at the same time granularity, reducing time slot conflicts caused by inconsistent period settings.
[0050] In addition, the first Bluetooth device can dynamically adjust the size of the basic cycle according to its own business type and priority. For example, if the business load of the device is heavy, the first Bluetooth device can select a longer basic cycle to provide more sufficient time slot resources; if the business of the device is light, the first Bluetooth device can select a shorter basic cycle to save resources and improve network efficiency. By dynamically adjusting the size of the basic cycle, the first Bluetooth device can flexibly respond to different business needs and network environments. That is, by dynamically adjusting the size of the basic cycle, the first Bluetooth device can reasonably allocate time slots according to the priorities of different business types (such as data transmission, audio streaming, etc.), ensuring that high-priority businesses can obtain sufficient resources.
[0051] In some embodiments, the target periodic beacon may also include time slot allocation information of the periodic service of the first Bluetooth device, where the time slot allocation information is used to instruct other Bluetooth devices to avoid service time slot conflicts when creating their own periodic beacons.
[0052] 103. When a new connection or synchronous broadcast service needs to be established between the first Bluetooth device and other Bluetooth devices, time slots are allocated according to the periodic beacons created by each device.
[0053] In some embodiments, when the time slot demand for a new connection or synchronous broadcast service between the first Bluetooth device and other Bluetooth devices exceeds the window duration of the reserved time slot, the first Bluetooth device can preferentially release its occupied low-priority service time slot to meet new service demands.
[0054] In some embodiments, when the first Bluetooth device allocates a new connection or a synchronous broadcast service within the window duration of the reserved time slot, it may also include: detecting an idle time slot within the window duration of the reserved time slot; allocating the idle time slot to the new connection or the synchronous broadcast service; updating and broadcasting the target period beacon so that other Bluetooth devices adjust their own time slot allocation according to the updated target period beacon.
[0055] For example, in the actual application scenario of the smart home system, multiple Bluetooth devices need to frequently exchange and synchronize data. When a Bluetooth thermostat needs to establish a new connection with a Bluetooth light bulb to synchronize temperature information, it will allocate time slots according to the preset periodic beacon. If a new Bluetooth device, such as a smart door lock, needs to join the network and establish a connection at this time, and the current reservation time slot window length cannot meet the needs of the two devices to connect at the same time, then the Bluetooth thermostat will release low-priority time slots according to its business priority to ensure that high-priority businesses (such as secure connections to door locks) can proceed smoothly. In addition, after releasing the low-priority time slot, the Bluetooth thermostat will update its periodic beacon and notify other Bluetooth devices of this change through broadcasting. In this way, other devices such as Bluetooth light bulbs can adjust their own time slot allocations according to the new periodic beacon to avoid time slot conflicts and ensure the stable operation of the entire smart home system.
[0056] In summary, the Bluetooth service synchronization method provided by the embodiment of the present application includes searching whether there is a created periodic beacon when the first Bluetooth device creates a new service, and the created periodic beacon is created first for other Bluetooth devices; if the created periodic beacon is not searched, a target periodic beacon is created by the first Bluetooth device, and the target periodic beacon is broadcasted, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon; when a new connection or synchronous broadcast service is required between the first Bluetooth device and other Bluetooth devices, time slots are allocated according to the periodic beacons created by each Bluetooth device. In this solution, the periodic beacons created by each Bluetooth device are allocated time slots, thereby avoiding time slot conflicts between devices.
[0057] In order to better implement the Bluetooth service synchronization method provided in the embodiment of the present application, the embodiment of the present application also provides a Bluetooth service synchronization device. The meanings of the terms are the same as those in the above Bluetooth service synchronization method, and the specific implementation details can refer to the description in the method embodiment.
[0058] See also Figure 2 , Figure 2 201 is a schematic diagram of the structure of a Bluetooth service synchronization device provided in an embodiment of the present application. The Bluetooth service synchronization device may include a search unit 201, a creation unit 202 and an allocation unit 203.
[0059] A search unit 201, configured to search for a created periodic beacon when the first Bluetooth device creates a new service, wherein the created periodic beacon is created preferentially by other Bluetooth devices;
[0060] A creating unit 202, configured to create a target periodic beacon through the first Bluetooth device when the created periodic beacon is not searched, and broadcast the target periodic beacon, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon;
[0061] The allocation unit 203 is configured to allocate time slots according to periodic beacons created by each of the first Bluetooth device and other Bluetooth devices when a new connection or synchronous broadcast service is required between the first Bluetooth device and other Bluetooth devices.
[0062] The specific implementation of each of the above units can refer to the above-mentioned embodiment of the Bluetooth service synchronization method, which will not be described one by one here.
[0063] In summary, the Bluetooth service synchronization device provided in the embodiment of the present application can search whether there is a created periodic beacon through the search unit 201 when the first Bluetooth device creates a new service, and the created periodic beacon is created first for other Bluetooth devices; when the created periodic beacon is not searched, the creation unit 202 creates a target periodic beacon through the first Bluetooth device, and broadcasts the target periodic beacon, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon; when a new connection or synchronous broadcast service is required between the first Bluetooth device and other Bluetooth devices, the allocation unit 203 allocates time slots according to the periodic beacons created by each. This solution can solve the problem of time slot conflicts between devices.
[0064] The present application also provides an electronic device, in which the Bluetooth service synchronization device of the present application can be integrated, such as Figure 3 As shown, it shows a structural schematic diagram of an electronic device involved in an embodiment of the present application, and the electronic device includes a memory 301, a processor 302, and a computer program stored in the memory 301 and executable on the processor 302, wherein the processor 302 implements the above-mentioned Bluetooth service synchronization method in the embodiment of the present application when executing the computer program.
[0065] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the Bluetooth service synchronization method above, and will not be repeated here.
[0066] It should be noted that, for the Bluetooth service synchronization method in the embodiment of the present application, those skilled in the art can understand that all or part of the processes of the Bluetooth service synchronization method in the embodiment of the present application can be implemented by controlling the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, such as stored in the memory of the terminal, and executed by at least one processor in the terminal. During the execution process, it can include processes such as the embodiments of the Bluetooth service synchronization method.
[0067] For the Bluetooth service synchronization device of the embodiment of the present application, each functional module can be integrated into a processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0068] To this end, an embodiment of the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the Bluetooth service synchronization methods provided in the embodiment of the present application. The storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.
[0069] The above respectively introduces in detail the Bluetooth service synchronization method, device, storage medium and electronic device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the core idea of the present application; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A Bluetooth service synchronization method, characterized in that: include: When the first Bluetooth device creates a new service, it searches whether there is a created periodic beacon, and the created periodic beacon is created first by other Bluetooth devices; If the created periodic beacon is not searched, create a target periodic beacon through the first Bluetooth device, and broadcast the target periodic beacon, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon; When a new connection or synchronous broadcast service needs to be established between the first Bluetooth device and other Bluetooth devices, time slots are allocated according to the periodic beacons created by each of them.
2. The Bluetooth service synchronization method according to claim 1, characterized in that: The target period beacon includes the sending time of the beacon data and the window duration of the reserved time slot; The other Bluetooth devices search for and discover the target periodic beacon and create respective periodic beacons according to the target periodic beacon, including: The other Bluetooth devices create their own periodic beacons according to the sending time of the beacon data and the window duration of the reserved time slot.
3. The Bluetooth service synchronization method according to claim 2, characterized in that: When creating the target period beacon, the first Bluetooth device sets the window duration of the reservation time slot to an integer multiple of the basic period, and dynamically adjusts the size of the basic period according to its own service type and priority.
4. The Bluetooth service synchronization method according to claim 2, characterized in that: After searching for the target periodic beacon, the other Bluetooth devices calculate their own receiving time offset values by parsing the sending time of the beacon data, and synchronously adjust their own periodic beacons based on the receiving time offset value so that the start time of their time slots is aligned with the reserved time slot of the target periodic beacon.
5. The Bluetooth service synchronization method according to claim 2, characterized in that: When the time slot requirement for a new connection or synchronous broadcast service between the first Bluetooth device and the other Bluetooth devices exceeds the window duration of the reserved time slot, the first Bluetooth device preferentially releases its occupied low-priority service time slot to meet new service requirements.
6. The Bluetooth service synchronization method according to claim 1, characterized in that: The target periodic beacon includes time slot allocation information of the periodic service of the first Bluetooth device, and the time slot allocation information is used to instruct other Bluetooth devices to avoid service time slot conflicts when creating their own periodic beacons.
7. The Bluetooth service synchronization method according to claim 2, characterized in that: When the first Bluetooth device allocates a new connection or a synchronous broadcast service within the window duration of the reserved time slot, it also includes: Detecting an idle time slot within the window duration of the reservation time slot; Allocating the idle time slot to a newly created connection or a simultaneous broadcast service; The target period beacon is updated and broadcasted, so that the other Bluetooth devices adjust their own time slot allocation according to the updated target period beacon.
8. A Bluetooth service synchronization device, characterized in that: include: A search unit, configured to search for a created periodic beacon when the first Bluetooth device creates a new service, wherein the created periodic beacon is created preferentially by other Bluetooth devices; A creating unit, configured to create a target periodic beacon through the first Bluetooth device when the created periodic beacon is not searched, and broadcast the target periodic beacon, so that other Bluetooth devices search and find the target periodic beacon and create their own periodic beacons according to the target periodic beacon; The allocation unit is used to allocate time slots according to the periodic beacons created by each of the first Bluetooth device and other Bluetooth devices when a new connection or synchronous broadcast service is required between the first Bluetooth device and other Bluetooth devices.
9. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the Bluetooth service synchronization method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the Bluetooth service synchronization method as claimed in any one of claims 1 to 7 when executing the computer program.