Bluetooth communication method and device of intelligent equipment, and readable storage medium
By monitoring and rescanning the smart devices with the strongest signal strength, the problem of easy disconnection of Bluetooth connection between mobile terminals and smart devices was solved, and the stability and efficiency of communication were improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU OPPLE LIGHTING
- Filing Date
- 2024-10-30
- Publication Date
- 2026-05-01
AI Technical Summary
Bluetooth connections between mobile terminals and smart devices are prone to disconnection during user movement, leading to unstable communication and reduced efficiency of smart device systems.
By monitoring the number of smart devices that have established Bluetooth connections, rescanning for the device with the strongest signal strength, and establishing a Bluetooth connection, at least one device remains connected, thus achieving real-time communication stability.
It improves the working efficiency of smart device systems, reduces the probability of Bluetooth connection drops, and ensures communication stability and control success rate.
Smart Images

Figure CN121968059A_ABST
Abstract
Description
Bluetooth communication methods and devices for smart devices, and readable storage media Technical Field
[0001] This application relates to the field of smart device technology, and in particular to a Bluetooth communication method and apparatus for smart devices, and a readable storage medium. Background Technology
[0002] Currently, users' mobile devices, such as smartphones, can be managed and controlled as part of a smart device system. A mobile device establishes a Bluetooth connection with only one smart device at a time. When a user moves their mobile device, the limited range of Bluetooth communication can cause the connection to drop, resulting in a Bluetooth connection failure. To restore normal communication, it is necessary to rescan for smart devices and reconnect.
[0003] Rescanning and reconnecting takes time, which leads to unstable communication between the mobile terminal and the smart device, reducing the efficiency of the smart device system. Summary of the Invention
[0004] The purpose of this application is to provide a Bluetooth communication method and apparatus for smart devices, as well as a readable storage medium, to solve the problem of low working efficiency of smart device systems.
[0005] To solve the above-mentioned technical problems, this specification provides the following: Firstly, a Bluetooth communication method for a smart device is provided, applied to a mobile terminal. The method includes: monitoring a first number of smart devices that have established Bluetooth connections with the mobile terminal, wherein the smart devices have Bluetooth connection functionality and belong to the same group, and the first number is greater than 1; if a second number of smart devices are detected to have failed Bluetooth connections, a rescan is performed, wherein the second number is less than the first number; Bluetooth connections are established based on the second number of smart devices with the strongest signal strength after scanning and belonging to the group; and the target smart device in the corresponding group of the smart devices that have currently established Bluetooth connections is controlled.
[0006] Optionally, the step of establishing a Bluetooth connection based on a second number of smart devices with the strongest signal strength after scanning and belonging to the group includes: identifying a target first smart device among the first smart devices with currently established Bluetooth connections whose signal strength is less than a preset signal strength threshold; disconnecting the Bluetooth connection between the target first smart device and the mobile terminal; selecting a target second smart device with the strongest signal strength from the second smart devices that have not currently established Bluetooth connections and belong to the group, based on the number of target first smart devices and the second number; and establishing a Bluetooth connection between the target second smart device and the mobile terminal.
[0007] Optionally, controlling the target smart device in the group corresponding to the smart devices that have established a Bluetooth connection includes: selecting the smart device with the strongest signal strength among the smart devices that have established a Bluetooth connection as the main communication device; sending control commands to the target smart devices in the group through the main communication device to control the target smart devices, wherein the target smart devices include one or more of the smart devices that have established a Bluetooth connection and the smart devices that have not established a Bluetooth connection in the group.
[0008] Optionally, sending control commands to target smart devices in the group via the main communication device includes: the mobile terminal sending control commands to the main communication device via a Bluetooth GATT network; and the main communication device sending the received control commands to the target smart devices in the group via a Bluetooth Mesh network.
[0009] Optionally, controlling the target smart device in the group corresponding to the smart device with the currently established Bluetooth connection includes: simultaneously sending control commands to the smart devices with the currently established Bluetooth connection in the group to control the smart devices with the currently established Bluetooth connection respectively.
[0010] Optionally, simultaneously sending control commands to smart devices in the group that have already established Bluetooth connections includes: the mobile terminal simultaneously sending control commands to smart devices in the group that have already established Bluetooth connections via the Bluetooth GATT network.
[0011] Optionally, the smart device includes one or more of smart lighting, smart curtains, smart home appliances, and smart sensors.
[0012] Optionally, the mobile terminal establishes a Bluetooth connection with the smart device via a Bluetooth GATT network.
[0013] In a second aspect, a Bluetooth communication device for a smart device is provided, comprising a processor and a memory, wherein the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0014] Thirdly, a readable storage medium is provided that stores a program or instructions which, when executed by a processor, implement the steps of the method described in the first aspect.
[0015] In this embodiment, the mobile terminal monitors a first number of smart devices that have established Bluetooth connections with the mobile terminal. These smart devices have Bluetooth connectivity and belong to the same group, and the first number is greater than 1. If a second number of smart devices are detected to have failed Bluetooth connections, a rescan is performed, where the second number is less than the first number. Bluetooth connections are established based on the second number of smart devices with the strongest signal strength after scanning and belonging to the group. This allows the mobile terminal to maintain a real-time Bluetooth connection and communicate with at least one smart device, ensuring the stability of communication between the mobile terminal and the smart device even while the mobile terminal is in motion. This reduces the probability of Bluetooth connection drops and further improves the stability of Bluetooth communication by promptly rescanning and re-establishing Bluetooth connections, thereby increasing the control speed and success rate of the smart device and ultimately improving the working efficiency of the smart device system. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: FIG1 is a schematic flowchart of a Bluetooth communication method for a smart device according to an embodiment of this application.
[0017] Figure 2 is a schematic diagram of the application scenario of the Bluetooth communication method of the smart device according to an embodiment of this application.
[0018] Figure 3 is a structural block diagram of the Bluetooth communication device of the smart device according to an embodiment of this application. Detailed Implementation
[0019] 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 some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. The drawing numbers in this application are only used to distinguish the various steps in the solution and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0020] To address the problems existing in the prior art, this application provides a Bluetooth communication method and apparatus for smart devices, as well as a readable storage medium. The method involves monitoring a first number of smart devices with established Bluetooth connections on a mobile terminal. These smart devices have Bluetooth connectivity and belong to the same group, and the first number is greater than one. If a second number of smart devices are detected with failed Bluetooth connections, a rescan is performed, where the second number is less than the first number. Bluetooth connections are established based on the second number of smart devices with the strongest signal strength after scanning and belonging to the same group. This allows the mobile terminal to maintain a real-time Bluetooth connection and communicate with at least one smart device, ensuring stable communication between the mobile terminal and the smart device even during movement. This reduces the probability of Bluetooth connection drops and further improves Bluetooth communication stability by promptly rescanning and re-establishing Bluetooth connections, thereby increasing the control speed and success rate of the smart device and ultimately improving the efficiency of the smart device system.
[0021] Figure 1 is a flowchart illustrating a Bluetooth communication method for a smart device according to an embodiment of this application. The method is applied to a mobile terminal. As shown in Figure 1, the method includes steps 102 to 106.
[0022] Step 102: Monitor the first number of smart devices that have established Bluetooth connections with the mobile terminal. The smart devices have Bluetooth connection capabilities and belong to the same group, and the first number is greater than 1.
[0023] Mobile terminals can be, for example, mobile phones, tablets, laptops, handheld computers, in-vehicle electronic devices, mobile internet devices (MID), wearable devices, ultra-mobile personal computers (UMPC), netbooks, or personal digital assistants (PDAs), etc., and the embodiments of this application do not impose specific limitations.
[0024] The smart device has Bluetooth connectivity and is a device that allows users to perform control operations via a mobile terminal. Optionally, the smart device includes one or more of the following: smart lighting, smart curtains, smart home appliances, and smart sensors.
[0025] In this embodiment, the mobile terminal has established Bluetooth connections with multiple smart devices, and the multiple smart devices are pre-established in the same target group.
[0026] Smart devices are devices set up within the local area network where the mobile terminal is located. Each smart device can communicate with the mobile terminal via Bluetooth network, and smart devices within the same target group can also communicate with each other via Bluetooth.
[0027] The mobile terminal can communicate via Bluetooth with at least one of the smart devices that have established a Bluetooth connection. For example, it can select one of multiple smart devices with established Bluetooth connections as the master communication device and use the master communication device as an intermediary to control other smart devices with established Bluetooth connections, or smart devices that are in the same target group but have not yet established a Bluetooth connection with the mobile terminal. Alternatively, the mobile terminal can communicate via Bluetooth with multiple smart devices with established connections simultaneously and send instructions to these smart devices.
[0028] The mobile terminal monitors multiple smart devices with established Bluetooth connections in real time to determine if any smart devices have lost their Bluetooth connection. The mobile terminal can only maintain Bluetooth communication with smart devices with which a Bluetooth connection has been established; smart devices with disconnected Bluetooth connections, or whose Bluetooth connections have failed, cannot communicate with the mobile terminal via Bluetooth.
[0029] Step 104: If a second number of smart devices are detected to have failed Bluetooth connections, a new scan is performed, where the second number is less than the first number.
[0030] To ensure that the mobile terminal always maintains Bluetooth communication with at least one smart device, if the Bluetooth connection of a second number of smart devices (less than the first number) that have established a Bluetooth connection with the mobile terminal fails, the mobile terminal needs to be triggered to rescan in order to find a suitable smart device to establish a Bluetooth connection with the mobile terminal.
[0031] The second quantity being less than the first quantity ensures that the mobile terminal always maintains a Bluetooth connection with at least one smart device, enabling normal Bluetooth communication. For example, if the first quantity is 3 and the second quantity is 2, then if two smart devices' Bluetooth connections are detected to have failed, the scan will be performed again while maintaining a Bluetooth connection with the remaining smart device. Alternatively, if the first quantity is 3 and the second quantity is 1, then if one smart device's Bluetooth connection is detected to have failed, the scan will be performed again while maintaining a Bluetooth connection with the remaining two smart devices.
[0032] Referring to Figure 2, for example, mobile terminal 10 has established Bluetooth connections with three smart devices at location A: smart device 22, smart device 24, and smart device 26. Then, mobile terminal 10 moves from location A to location B. At this point, it is detected that the Bluetooth connection between mobile terminal 10 and smart device 22 at location B has failed (referred to as "..." in the figure). (This indicates that) the mobile terminal 10 still maintains a Bluetooth connection with smart devices 24 and 26. If the pre-set rescan condition is that a smart device's Bluetooth connection fails, then the mobile terminal 10 will rescan to search for suitable smart devices to re-establish the Bluetooth connection. Step 106: Bluetooth connection is established based on the second number of smart devices with the strongest signal strength after scanning that belong to the group.
[0033] After rescanning, the mobile terminal obtains the signal strength of each scanned smart device. In one embodiment, the smart devices to be selected for establishing a Bluetooth connection can be determined according to the following strategy: 1. After scanning, the signal strengths of smart devices belonging to the same group as the first number of smart devices that have previously established Bluetooth connections with the mobile terminal are sorted; 2. Based on the sorting results, a second number of smart devices are directly selected from the strongest to the weakest signal strength as the targets for establishing a Bluetooth connection.
[0034] In this embodiment, if k smart devices that have previously established a Bluetooth connection with the terminal device are detected to be currently disconnected from the mobile terminal, then the k smart devices with the strongest signal strength obtained from the current scan and belonging to the same group are selected as the objects to currently establish a Bluetooth connection with the mobile terminal.
[0035] In another embodiment, establishing a Bluetooth connection based on a second number of smart devices with the strongest signal strength after scanning and belonging to the group includes: identifying a target first smart device among the first smart devices with currently established Bluetooth connections whose signal strength is less than a preset signal strength threshold; disconnecting the Bluetooth connection between the target first smart device and the mobile terminal; selecting a target second smart device with the strongest signal strength from the second smart devices that have not currently established Bluetooth connections and belong to the group, based on the number of target first smart devices and the second number; and establishing a Bluetooth connection between the target second smart device and the mobile terminal.
[0036] In this embodiment, if it is detected that k smart devices that previously established a Bluetooth connection with the terminal device are currently disconnected from the mobile terminal, and m of the terminal devices currently maintaining a Bluetooth connection with the mobile terminal have signal strengths lower than a preset signal strength threshold, then the Bluetooth connection between these m smart devices and the mobile terminal is disconnected. At this point, there are currently m+k smart devices disconnected from the mobile terminal. Then, from the smart devices that have not yet established a Bluetooth connection and belong to the group, the m+k smart devices with the strongest signal strength are selected as the objects to establish a Bluetooth connection with the mobile terminal.
[0037] Referring to Figure 2, for example, if the mobile terminal 10 detects that the Bluetooth connection of a smart device has failed at location B, it will rescan and scan for signals of smart devices 24, 26, 28, 21 and 23 belonging to the same group. However, smart device 25 was not scanned by the mobile terminal 10. The signal strength of these scanned smart devices belonging to the same group will be sorted.
[0038] Mobile terminal 10 maintains Bluetooth connections with smart devices 24 and 26 at location B, but disconnects from smart device 22. It then determines whether the signal strength of smart devices 24 and 26 is less than a preset signal strength threshold. If not, it sorts the currently disconnected smart devices 28, 21, and 23 by signal strength from strongest to weakest, and selects the strongest smart device, such as smart device 28, as the connection target for Bluetooth connection.
[0039] If the signal strength of one or more of smart devices 24 or 26 is determined to be less than a preset signal strength threshold, taking smart device 24 as an example, the Bluetooth connection between smart device 24 and mobile terminal 10 is actively disconnected. Furthermore, the signal strengths of smart devices 28, 21, and 23 that currently lack a Bluetooth connection are ranked from strongest to weakest, and the two strongest smart devices, such as smart devices 28 and 21, are selected as the connection targets for Bluetooth connection.
[0040] In the above embodiments, if the number of smart devices that meet the criteria obtained based on the search results is less than the number of smart devices that need to establish a Bluetooth connection, then the current Bluetooth connection is established with the mobile terminal using the maximum number of smart devices that meet the criteria.
[0041] Therefore, no matter where the mobile terminal is located within the local area network, it can maintain a Bluetooth connection with at least one smart device and communicate via Bluetooth at any time. This ensures that communication between the mobile terminal and smart devices is not interrupted due to the failure of Bluetooth connections of some smart devices while the user is moving. Furthermore, even if the Bluetooth connections of some smart devices fail, the system can promptly rescan and re-establish Bluetooth connections, and even if this takes some time, communication between the mobile terminal and smart devices can continue normally. This guarantees the stability of communication between the mobile terminal and smart devices and improves the working efficiency of the smart device system.
[0042] Specifically, controlling the target smart device in the group corresponding to the smart devices that have established a Bluetooth connection includes: selecting the smart device with the strongest signal strength among the smart devices that have established a Bluetooth connection as the main communication device; sending control commands to the target smart devices in the group through the main communication device to control the target smart devices, wherein the target smart devices include one or more of the smart devices that have established a Bluetooth connection and the smart devices that have not established a Bluetooth connection in the group.
[0043] For example, the device with the strongest signal strength among multiple smart devices that have already established a Bluetooth connection can be selected as the primary communication device. For smart devices that have already established a Bluetooth connection, the mobile terminal can directly obtain the signal strength of the smart device without scanning. Then, the primary communication device acts as an intermediary to control other smart devices that have established a Bluetooth connection with the primary communication device and are in the same target group as the primary communication device, or to control smart devices that are in the same target group as the primary communication device but are not currently connected to the mobile terminal via Bluetooth, or simultaneously to control other smart devices that have established a Bluetooth connection with the primary communication device and smart devices that are not currently connected to the mobile terminal via Bluetooth.
[0044] If there is only one smart device with an established Bluetooth connection, then that single smart device with an established Bluetooth connection will be used as the primary communication device.
[0045] The aforementioned main communication device can be any of the following: smart lighting, smart curtains, smart home appliances, and smart sensors. The main communication device can send control commands while in motion to other smart devices of different or the same type.
[0046] For example, if a mobile terminal needs to control the brightness of four smart lights in a group of smart lights, and the main communication device with which a Bluetooth connection has been established is a smart curtain, then the mobile terminal can send control commands to the smart curtain, which in turn sends control commands to the four smart lights to control their brightness.
[0047] Sending control commands to target smart devices in the group via the main communication device includes: the mobile terminal sending control commands to the main communication device via a Bluetooth GATT network; and the main communication device sending the received control commands to the target smart devices in the group via a Bluetooth Mesh network.
[0048] In other words, mobile terminals and smart devices communicate via Bluetooth GATT network, while smart devices communicate with each other via Bluetooth Mesh network.
[0049] Specifically, controlling the target smart device in the group corresponding to the smart device with the currently established Bluetooth connection includes: simultaneously sending control commands to the smart devices with the currently established Bluetooth connection in the group to control the smart devices with the currently established Bluetooth connection respectively.
[0050] For example, a mobile terminal can simultaneously communicate with multiple smart devices whose Bluetooth connections are still active, sending commands to these devices. This fulfills scenarios where a mobile terminal needs to communicate with multiple devices simultaneously, such as when multiple smart devices require simultaneous firmware upgrades. In such cases, the mobile terminal can send firmware upgrade control commands to each smart device with an established Bluetooth connection at the same time. This enables concurrent control and communication of smart devices, improving control speed and success rate.
[0051] Optionally, simultaneously sending control commands to smart devices in the group that have already established Bluetooth connections includes: the mobile terminal simultaneously sending control commands to smart devices in the group that have already established Bluetooth connections via the Bluetooth GATT network.
[0052] In other words, mobile terminals communicate with various smart devices via the Bluetooth GATT network.
[0053] In this embodiment, the mobile terminal monitors a first number of smart devices that have established Bluetooth connections with the mobile terminal. These smart devices have Bluetooth connectivity and belong to the same group, and the first number is greater than 1. If a second number of smart devices are detected to have failed Bluetooth connections, a rescan is performed, where the second number is less than the first number. Bluetooth connections are established based on the second number of smart devices with the strongest signal strength after scanning and belonging to the group. This allows the mobile terminal to maintain a real-time Bluetooth connection and communicate with at least one smart device, ensuring the stability of communication between the mobile terminal and the smart device even while the mobile terminal is in motion. This reduces the probability of Bluetooth connection drops and further improves the stability of Bluetooth communication by promptly rescanning and re-establishing Bluetooth connections, thereby increasing the control speed and success rate of the smart device and ultimately improving the working efficiency of the smart device system.
[0054] Optionally, as shown in FIG3, this application embodiment also provides a Bluetooth communication device 2000 for a smart device, including a processor 2400 and a memory 2200. The memory 2200 stores a program or instructions that can run on the processor 2400. When the program or instructions are executed by the processor 2400, they implement the various steps of the Bluetooth communication method embodiment of the smart device described above and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0055] This application also provides a readable storage medium storing a program or instructions. When executed by a processor, the program or instructions implement the various processes of any of the Bluetooth communication method embodiments of the above-described smart devices, achieving the same technical effects. To avoid repetition, these will not be described again here. The readable storage medium includes computer-readable storage media, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0056] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. The computer program is operable to enable a computer to execute various processes of any of the Bluetooth communication method embodiments of the above-described smart devices, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0057] It should be noted that, in this document, 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. Unless otherwise specified, 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.
[0058] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0059] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A Bluetooth communication method for a smart device, characterized in that, Applied to a mobile terminal, the method includes: monitoring a first number of smart devices that have established Bluetooth connections with the mobile terminal, wherein the smart devices have Bluetooth connection functionality and belong to the same group, and the first number is greater than 1; if a second number of smart devices are detected to have failed Bluetooth connections, then rescanning is performed, wherein the second number is less than the first number; Bluetooth connections are established based on the second number of smart devices with the strongest signal strength after scanning and belonging to the group; and the target smart device in the corresponding group of the smart devices that have currently established Bluetooth connections is controlled.
2. The method according to claim 1, characterized in that, The step of establishing a Bluetooth connection based on a second number of smart devices with the strongest signal strength after scanning and belonging to the group includes: identifying a target first smart device among the first smart devices that have already established a Bluetooth connection, whose signal strength is less than a preset signal strength threshold; disconnecting the Bluetooth connection between the target first smart device and the mobile terminal; selecting a target second smart device with the strongest signal strength from the second smart devices that have not yet established a Bluetooth connection and belong to the group, based on the number of target first smart devices and the second number; and establishing a Bluetooth connection between the target second smart device and the mobile terminal.
3. The method according to claim 1, characterized in that, The control of a target smart device in the group corresponding to a smart device with an established Bluetooth connection includes: selecting the smart device with the strongest signal strength among the smart devices with an established Bluetooth connection as the main communication device; sending a control command to the target smart device in the group through the main communication device to control the target smart device, wherein the target smart device includes one or more of the smart devices in the group with an established Bluetooth connection and smart devices without an established Bluetooth connection.
4. The method according to claim 3, characterized in that, The step of sending control commands to target smart devices in the group via the main communication device includes: the mobile terminal sending control commands to the main communication device via a Bluetooth GATT network; and the main communication device sending the received control commands to the target smart devices in the group via a Bluetooth Mesh network.
5. The method according to claim 1, characterized in that, Controlling the target smart device in the group corresponding to the smart device with the currently established Bluetooth connection includes: simultaneously sending control commands to the smart devices with the currently established Bluetooth connection in the group to control the smart devices with the currently established Bluetooth connection respectively.
6. The method according to claim 5, characterized in that, The step of simultaneously sending control commands to smart devices in the group that have already established Bluetooth connections includes: the mobile terminal simultaneously sending control commands to smart devices in the group that have already established Bluetooth connections via the Bluetooth GATT network.
7. The method according to claim 1, characterized in that, The smart devices include one or more of the following: smart lighting, smart curtains, smart home appliances, and smart sensors.
8. The method according to claim 1, characterized in that, The mobile terminal establishes a Bluetooth connection with the smart device via the Bluetooth GATT network.
9. A Bluetooth communication device for a smart device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1-8.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-8.