Bluetooth connection methods, devices, electronic devices and storage media

By sending connection requests and switching modes between Bluetooth devices, the problem of complex operation of existing Bluetooth connection methods is solved, and a more accurate and convenient Bluetooth connection process is achieved.

CN114374959BActive Publication Date: 2025-02-25XIAN WINGTECH INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210052032.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-17
Publication Date
2025-02-25
Estimated Expiration
2042-01-17

AI Technical Summary

Technical Problem

The existing Bluetooth connection method After the device is disconnected, the user needs to manually disconnect other devices and re-establish the connection, which is complicated and inconvenient.

Method used

Ensure that the Bluetooth connection is re-established accurately by sending a Bluetooth connection request to the second device in slave mode when the first device is in master mode and switching mode after disconnection to receive a reconnect request from the target device.

Benefits of technology

Improves the accuracy of Bluetooth connections between electronic devices, simplifies user operations, reduces the steps of manual disconnection and reconnection, and improves convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114374959B_ABST
    Figure CN114374959B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a Bluetooth connection method, device, electronic device and storage medium, the method is applied to a first device, including: when the first device is in master mode, sending a first Bluetooth connection request to one or more second devices in slave mode respectively; pairing with one or more second devices respectively and establishing a Bluetooth connection; after disconnecting the Bluetooth connection with a target second device in one or more second devices, switching from the master mode to the slave mode; receiving a second Bluetooth connection request sent by the target second device switched to the master mode, and establishing a Bluetooth connection with the target second device. Implementing the embodiment of the present application can improve the accuracy of establishing Bluetooth connections between electronic devices, simplify user operations, and improve convenience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a Bluetooth connection method, device, electronic device and storage medium. Background Art

[0002] With the development of technology, the types of electronic devices that can use Bluetooth modules are becoming more and more abundant, such as mobile phones, tablets, mice, computers and other electronic devices are equipped with Bluetooth functions. After the Bluetooth connection between the first device and the second device is disconnected, if there are multiple other devices that have been paired with the second device around, at this time, the second device will reselect a device with a high priority to automatically establish a Bluetooth connection. If the device that the user wants to establish a Bluetooth connection with the second device is the first device, and the device automatically selected by the second device is not the first device, it is necessary to first disconnect the Bluetooth connection between the second device and other devices, and then manually establish a Bluetooth connection between the first device and the second device. The operation of the solution for re-establishing the Bluetooth connection is very complicated. Summary of the invention

[0003] The embodiments of the present application disclose a Bluetooth connection method, device, electronic device and storage medium, which can improve the accuracy of establishing Bluetooth connections between electronic devices, simplify user operations and improve convenience.

[0004] The present application embodiment discloses a Bluetooth connection method, which is applied to a first device, and the method includes:

[0005] When the first device is in the master device mode, sending a first Bluetooth connection request to one or more second devices in the slave device mode respectively, wherein the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device;

[0006] Pairing with the one or more second devices respectively and establishing a Bluetooth connection;

[0007] After disconnecting the Bluetooth connection with the target second device among the one or more second devices, switching from the master device mode to the slave device mode;

[0008] A second Bluetooth connection request is received from the target second device that is switched to the master device mode, and a Bluetooth connection is established with the target second device according to the second Bluetooth connection request.

[0009] In one embodiment, before sending the first Bluetooth connection request to one or more second devices in slave mode respectively when the first device is in master mode, the method further includes:

[0010] When the first device is in a slave mode, if a first mode switching operation is detected, the first device is switched from the slave mode to the master mode in response to the first mode switching operation.

[0011] The present application embodiment discloses a Bluetooth connection method, which is applied to a second device, and the method includes:

[0012] When the second device is in the slave device mode, receiving a first Bluetooth connection request sent by a first device in the master device mode;

[0013] pairing with the first device and establishing a Bluetooth connection according to the first Bluetooth connection request;

[0014] After disconnecting the Bluetooth connection with the first device, switching from the slave device mode to the master device mode;

[0015] A second Bluetooth connection request is sent to the first device switched to the slave device mode, where the second Bluetooth connection request is used to request a Bluetooth connection with the first device.

[0016] In one embodiment, after pairing with the first device and establishing a Bluetooth connection according to the first Bluetooth connection request, the method further includes:

[0017] Saving second pairing information corresponding to the first device;

[0018] The sending a second Bluetooth connection request to the first device in the slave device mode comprises:

[0019] A second Bluetooth connection request is sent to the first device switched to the slave device mode according to the second pairing information.

[0020] In one embodiment, after disconnecting the Bluetooth connection with the first device, switching from the slave device mode to the master device mode includes:

[0021] After disconnecting the Bluetooth connection with the first device, obtaining the number of devices currently in the master device mode from a central control device, the central control device being used to obtain the current mode of each Bluetooth device in communication connection with the central control device, the Bluetooth devices including at least the first device and the second device;

[0022] If the number of devices is greater than the number threshold, the slave device mode is switched to the master device mode.

[0023] In one embodiment, sending the second Bluetooth connection request to the first device switched to the slave device mode includes:

[0024] If the disconnection of the Bluetooth connection with the first device is an active disconnection, then upon detecting a Bluetooth connection operation, a second Bluetooth connection request is sent to the first device switched to the slave device mode, wherein the active disconnection includes disconnecting the Bluetooth connection with the first device after detecting a disconnection instruction; or

[0025] If the disconnection of the Bluetooth connection with the first device is a passive disconnection, then when it is detected that the signal strength between the first device and the first device switched to the slave device mode is higher than the connection threshold, a second Bluetooth connection request is sent to the first device switched to the slave device mode, and the passive disconnection includes disconnecting the Bluetooth connection with the first device when the signal strength with the first device is lower than the connection threshold.

[0026] The present application embodiment discloses a Bluetooth connection device, which is applied to a first device, and the device includes:

[0027] A first request module, configured to send a first Bluetooth connection request to one or more second devices in a slave mode respectively when the first device is in a master mode, wherein the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device;

[0028] A first connection module, used to pair with the one or more second devices respectively and establish a Bluetooth connection;

[0029] A first switching module, configured to switch from the master device mode to the slave device mode after disconnecting the Bluetooth connection with a target second device among the one or more second devices;

[0030] The first receiving module is used to receive a second Bluetooth connection request sent by the target second device switched to the master device mode, and establish a Bluetooth connection with the target second device according to the second Bluetooth connection request.

[0031] The embodiment of the present application discloses a Bluetooth connection device, which is applied to a second device, and the device includes:

[0032] A second receiving module, configured to receive a first Bluetooth connection request sent by a first device in a master device mode when the second device is in the slave device mode;

[0033] A second connection module, configured to pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request;

[0034] A second switching module, configured to switch from the slave device mode to the master device mode after disconnecting the Bluetooth connection with the first device;

[0035] The second sending module is used to send a second Bluetooth connection request to the first device switched to the slave device mode, where the second Bluetooth connection request is used to request a Bluetooth connection with the first device.

[0036] The present application discloses an electronic device, including:

[0037] A memory storing executable program code;

[0038] a processor coupled to the memory;

[0039] The processor calls the executable program code stored in the memory to execute the method described in any one of the above embodiments.

[0040] An embodiment of the present application discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes the method described in any one of the above embodiments.

[0041] The Bluetooth connection method, apparatus, electronic device and storage medium disclosed in the embodiments of the present application, when the first device is in the master device mode, sends a first Bluetooth connection request to one or more second devices in the slave device mode respectively, so as to pair with the one or more second devices and establish a Bluetooth connection respectively; after disconnecting the Bluetooth connection with the target second device in the one or more second devices, the first device switches from the master device mode to the slave device mode, the target second device switches from the slave device mode to the master device mode, and sends a second Bluetooth connection request to the first device through the target second device switched to the master device mode, so as to ensure that the target second device accurately re-establishes the Bluetooth connection with the first device; by switching modes, the target second device switches to the master device mode after disconnecting the Bluetooth connection, so as to avoid connecting with other electronic devices in the master device mode, thereby improving the accuracy of establishing Bluetooth connections between electronic devices, reducing the operations required by users, and improving convenience. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 It is a schematic diagram of an application scenario of a Bluetooth connection method disclosed in an embodiment of the present application;

[0044] Figure 2It is a flowchart of a Bluetooth connection method disclosed in an embodiment of the present application;

[0045] Figure 3 is a timing diagram of a Bluetooth connection method disclosed in an embodiment of the present application;

[0046] Figure 4 It is a flowchart of another Bluetooth connection method disclosed in an embodiment of the present application;

[0047] Figure 5 It is a flowchart of another Bluetooth connection method disclosed in an embodiment of the present application;

[0048] Figure 6 It is a modular schematic diagram of a Bluetooth connection device disclosed in an embodiment of the present application;

[0049] Figure 7 It is a modular schematic diagram of another Bluetooth connection device disclosed in an embodiment of the present application;

[0050] Figure 8 It is a structural block diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0052] It should be noted that the terms "including" and "having" in the embodiments of the present application and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0053] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first summoning instruction may be referred to as a second summoning instruction, and similarly, a second summoning instruction may be referred to as a first summoning instruction. Both the first summoning instruction and the second summoning instruction are summoning instructions, but they are not the same summoning instruction.

[0054] Currently, some electronic devices in master mode can simultaneously connect to multiple electronic devices in slave mode via Bluetooth when in use, but an electronic device in slave mode can be paired with multiple electronic devices in master mode, but multiple electronic devices in master mode cannot be connected at the same time.

[0055] When an electronic device in slave mode exists in an environment with multiple electronic devices in master mode, and has been paired with all of these electronic devices in master mode, the electronic device in slave mode cannot actively connect to the electronic device in master mode according to the user's wishes. The current solution for re-establishing a Bluetooth connection is to automatically select a connection based on the priority of the pairing information stored in the electronic device in slave mode. If the automatically selected device is not the device the user wants to connect to, the user must first disconnect the Bluetooth connection between the electronic device in master mode and the electronic device in slave mode, and then actively set up a Bluetooth connection with the electronic device in slave mode through the electronic device in master mode that needs to be connected. The operation of this solution for re-establishing a Bluetooth connection is very complicated.

[0056] The embodiments of the present application disclose a Bluetooth connection method, device, electronic device and storage medium, which can improve the accuracy of establishing Bluetooth connections between electronic devices, simplify user operations and improve convenience.

[0057] The following is a detailed description with reference to the accompanying drawings.

[0058] Please refer to Figure 1 , Figure 1 : This is a schematic diagram of an application scenario of a Bluetooth connection method disclosed in an embodiment of the present application. The application scenario may include a first device 10 and a second device 20, wherein the first device 10 may include but is not limited to mobile phones, tablet computers, wearable devices, laptops, PCs (Personal Computers), Bluetooth headsets and other electronic devices with Bluetooth modules, and the second device 20 and the first device 10 may be the same electronic device or different electronic devices, which are not limited here. In addition, the operating systems of the above-mentioned first device 10 and the second device 20 may include but are not limited to Android operating system, IOS operating system, Symbian operating system, Black Berry operating system, Windows Phone 8 operating system, etc., which are not limited in the embodiment of the present application.

[0059] The first device 10 and the second device 20 both have two modes in Bluetooth communication, namely, master mode and slave mode. In master mode, an electronic device can actively initiate a Bluetooth connection request to other electronic devices to establish a Bluetooth connection. In slave mode, an electronic device passively receives a Bluetooth connection request initiated by other devices to establish a Bluetooth connection. Both the first device 10 and the second device 20 can switch between master mode and slave mode.

[0060] It should be understood that, in order to distinguish the first device 10 from the second device 20, the first device 10 is usually in the master mode during the Bluetooth pairing connection process, and the second device 20 is usually in the slave mode during the Bluetooth pairing connection process. Among them, the Bluetooth pairing connection will only be performed when the pairing information of each other is not saved between the two electronic devices. After the pairing is completed, the pairing information of each other will be saved. After that, the first device 10 and the second device 20 re-establish the Bluetooth connection without pairing again.

[0061] Taking the first device 10 and the second device 20 as an example, when the first device 10 is in the master device mode and the second device 20 is in the slave device mode, the specific steps of the Bluetooth pairing connection between the two devices may be that the first device 10 sends a Bluetooth connection request to the second device 20. After the second device 20 receives the Bluetooth connection request sent by the first device 10, the second device 20 may establish a Bluetooth connection with the second device 20 according to the Bluetooth connection request, and pair with the first device 10 during the Bluetooth connection process (i.e., pairing).

[0062] After the first device 10 stores the pairing information corresponding to the second device 20, if the first device wants to re-establish a Bluetooth connection with the second device 20, the first device 10 can directly send a Bluetooth connection request to the second device 20 according to the pairing information of the second device 20. After the second device 20 receives the Bluetooth connection request sent by the first device 10, the second device 20 can establish a Bluetooth connection with the second device 20 according to the Bluetooth connection request. During the Bluetooth connection process, there is no need to pair with the first device 10 again.

[0063] See also Figure 2 , Figure 2 : is a flowchart of a Bluetooth connection method disclosed in an embodiment of the present application. The Bluetooth connection method can be applied to the first device mentioned above and may include the following steps:

[0064] Step 210: When the first device is in the master device mode, a first Bluetooth connection request is sent to one or more second devices in the slave device mode respectively, where the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device.

[0065] When the first device is in the master mode, the first device detects a Bluetooth connection operation, and in response to the Bluetooth connection operation, sends a first Bluetooth connection request to one or more second devices in the slave mode. The one or more second devices may be within the target distance range of the first device, and the target distance range may refer to a range in which a Bluetooth connection can be established. Upon receiving the first Bluetooth connection request sent by the first device, the one or more second devices may pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request.

[0066] As an optional implementation, devices can be limited to one-to-one connection. When the first device is in master mode, the first device detects a Bluetooth connection operation, and in response to the Bluetooth connection operation, the Bluetooth connection operation may be a Bluetooth connection operation initiated by a user to a second device in slave mode. If the first device is not currently connected to other devices via Bluetooth, a first Bluetooth connection request is directly sent to the second device in slave mode corresponding to the Bluetooth connection operation. If the first device is currently connected to other devices via Bluetooth, the Bluetooth connection with other devices is first disconnected, and then the first Bluetooth connection request is sent to the second device in slave mode corresponding to the Bluetooth connection operation. After receiving the first Bluetooth connection request, the second device can pair with the first device according to the first Bluetooth connection request and establish a Bluetooth connection. Implementing this implementation can reduce the number of devices connected to Bluetooth devices, thereby simplifying the connection relationship between Bluetooth devices.

[0067] Step 220: Pair with one or more second devices and establish a Bluetooth connection.

[0068] After the one or more second devices receive the first Bluetooth connection request sent by the first device, the first device is paired with the one or more second devices respectively and a Bluetooth connection is established.

[0069] As an optional implementation, if one or more second devices have established a Bluetooth connection with other devices, the first Bluetooth connection request sent by the first device will not be responded to, and the first device fails to establish a Bluetooth connection relationship with one or more second devices, and a prompt message is output to remind the user that the second device has established a Bluetooth connection with other devices in the master device mode. The way of outputting the prompt message may include but is not limited to voice prompt, vibration prompt, screen prompt, light prompt, etc. By implementing this implementation, the user can be prompted that the second device he wants to connect to has been connected to other devices, avoiding the user from repeating invalid Bluetooth connection operations.

[0070] In one embodiment, after establishing Bluetooth connection and pairing with one or more second devices respectively, the first device saves first pairing information corresponding to the one or more second devices respectively. Correspondingly, the one or more second devices connected to the first device respectively save second pairing information with the first device. The pairing information may include but is not limited to MAC (Media Access Control Address), device type, etc.

[0071] Step 230: After disconnecting the Bluetooth connection with the target second device among the one or more second devices, switch from the master device mode to the slave device mode.

[0072] In one embodiment, the target second device in the one or more second devices may be any second device. After the first device establishes a Bluetooth connection with the one or more second devices, if the Bluetooth connection with the target second device in the one or more second devices is disconnected, the first device may switch from the master device mode to the slave device mode, and the target second device may switch from the slave device mode to the master device mode.

[0073] In one embodiment, the target second device in the one or more second devices may be a specific second device. The first device establishes a Bluetooth connection with the one or more second devices. If a specific second device in the one or more second devices disconnects the Bluetooth connection with the first device, the first device switches from the master device mode to the slave device mode, and the specific second device switches from the slave device mode to the master device mode. When the Bluetooth connection is disconnected with other non-specific second devices in the one or more second devices, the first device does not switch modes, and the other non-specific second devices do not switch modes either.

[0074] As an optional implementation, the specific second device may be a second device of a preset specific product type, and the preset second device of a specific product type may include but is not limited to a Bluetooth headset, a Bluetooth speaker, etc. For example, when the second device disconnected from the Bluetooth connection is a Bluetooth headset, the first device may detect that the second device disconnected from the Bluetooth connection is the Bluetooth headset, and switch the master device state to the slave device state. When the Bluetooth headset is disconnected from the first device, the Bluetooth headset is switched from the slave device state to the master device state.

[0075] As an optional implementation, the specific second device can also be set by the user. For example, the first device can provide the user with option information for the second device that has established a Bluetooth connection and is in slave mode, and the option information is used to set the second device to a specific second device. When a setting operation of the user to set any second device to a specific second device is detected, the second device corresponding to the setting operation is set to a specific second device. The setting operation may include but is not limited to a click operation, a voice operation, or a gesture operation. It can be seen that the user can flexibly adjust the specific second device according to their own needs, thereby improving the applicability of the user when actually using the Bluetooth connection method.

[0076] In one embodiment, within a certain distance range, there is a central control device, which can be a specially set device or any Bluetooth device. The central control device can communicate and connect with the Bluetooth devices within the distance range, and obtain the current mode of each Bluetooth device that is communicated and connected with the central control device, wherein the Bluetooth device includes at least a first device and a second device, and can also include but is not limited to other electronic devices in master device mode and other electronic devices in slave device mode.

[0077] As an optional implementation, after the first device disconnects the Bluetooth connection with the second device, the first device and the second device obtain the number of devices currently in master device mode from the central control device. If the number of devices currently in master device mode is greater than a quantity threshold, the first device switches from master device mode to slave device mode, and the second device switches from slave device mode to master device mode.

[0078] As an optional implementation, after the first device disconnects the Bluetooth connection with the target second device in one or more second devices, the first device and the target second device send a device quantity acquisition instruction to the central control device. The central control device acquires the number of devices currently in master device mode according to the device quantity acquisition instruction, and sends it to the first device and the target second device. If the number of devices currently in master device mode is greater than the quantity threshold, the first device switches from master device mode to slave device mode, and the target second device switches from slave device mode to master device mode. For example, when the first device disconnects the Bluetooth connection with one of the target second devices, the number of Bluetooth devices currently in master device mode acquired by the central control device is 1, and the quantity threshold may be 0. If the number of devices is greater than the quantity threshold, the first device switches from master device mode to slave device mode, and the target second device switches from slave device mode to master device mode. By implementing this implementation, when there are other electronic devices in master device mode within a certain distance range, it is possible to avoid the target second device from establishing a Bluetooth connection with other electronic devices.

[0079] As an optional implementation, after the first device disconnects the Bluetooth connection with the target second device in one or more second devices, the first device and the target second device send a device number acquisition instruction to the central control device. The central control device acquires the number of devices currently in master device mode and having pairing information with the target second device according to the device number acquisition instruction, and sends it to the first device and the target second device. If the number of devices is greater than the number threshold, the first device switches from master device mode to slave device mode, and the target second device switches from slave device mode to master device mode. By implementing this implementation, when there are other electronic devices in master device mode and paired with the target second device within a certain distance range, the target second device can be prevented from establishing a Bluetooth connection with other electronic devices.

[0080] Step 240: receiving a second Bluetooth connection request sent by a target second device switched to the master device mode, and establishing a Bluetooth connection with the target second device according to the second Bluetooth connection request.

[0081] If the target second device switched to slave mode has not established a Bluetooth connection with other first devices in master mode, the target second device sends a second Bluetooth request to the first device, the first device receives the second Bluetooth connection request sent by the target second device, and a Bluetooth connection is established between the first device and the second device.

[0082] As an optional implementation manner, the target second device sends a second Bluetooth connection request to the first device switched to the slave device mode according to the second pairing information.

[0083] In one embodiment, if the Bluetooth connection between the first device and the second device is disconnected actively, that is, the first device detects a disconnection instruction and sends a disconnection message to the second device, or the second device detects a disconnection instruction and sends a disconnection message to the first device, the first device and the second device disconnect the Bluetooth connection, then the second device switched to the master device mode sends a second Bluetooth connection request to the first device switched to the slave device mode when detecting a send request operation, the first device receives the second Bluetooth connection request sent by the second device, and the first device establishes a Bluetooth connection with the second device.

[0084] In one embodiment, if the Bluetooth connection between the first device and the second device is disconnected passively, that is, the signal strength between the first device and the second device is lower than the connection threshold, the first device and the second device disconnect the Bluetooth connection, then the second device switched to the master device mode sends a second Bluetooth connection request to the first device switched to the slave device mode when it detects that the signal strength between the second device and the first device switched to the slave device mode is higher than the connection threshold, the first device receives the second Bluetooth connection request sent by the second device, and the first device establishes a Bluetooth connection with the second device.

[0085] Figure 3 FIG. 1 is a timing diagram of a Bluetooth connection method, illustrating a connection process between a first device and a target second device among one or more second devices. Figure 3 As shown, when the first device is in the master device mode and the target second device is in the slave device mode, the first device in the master device mode detects the target second device in the slave device mode, provides the user with option information for establishing a Bluetooth connection with the target second device, and after detecting the Bluetooth connection operation triggered by the user according to the option information, sends a first Bluetooth connection request to the target second device. After the target second device receives the first Bluetooth connection request, the first device establishes a Bluetooth connection with the target second device. After the first device disconnects the Bluetooth connection with the target second device, the first device switches from the master device mode to the slave device mode, and the target second device switches from the slave device mode to the master device mode. The target second device in the master device mode detects the first device in the slave device mode, sends the target second Bluetooth connection request to the first device, and after the first device receives the target second Bluetooth connection request, the first device establishes a Bluetooth connection with the target second device.

[0086] In an embodiment of the present application, when the first device is in the master device mode, it sends a first Bluetooth connection request to one or more second devices in the slave device mode respectively, so as to pair with the one or more second devices and establish a Bluetooth connection respectively. After disconnecting the Bluetooth connection with the target second device in the one or more second devices, the first device switches from the master device mode to the slave device mode, and the target second device switches from the slave device mode to the master device mode. The target second device switches to the master device mode and sends a second Bluetooth connection request to the first device, so as to ensure that the target second device accurately re-establishes the Bluetooth connection with the first device. By switching modes, the target second device switches to the master device mode after disconnecting the Bluetooth connection, avoiding connection with other electronic devices in the master device mode. The accuracy of establishing Bluetooth connections between electronic devices can be improved, the operations required by the user are reduced, and the convenience is improved.

[0087] See also Figure 4 , Figure 4 This is a flow chart of another Bluetooth connection method disclosed in an embodiment of the present application. The Bluetooth connection method can be applied to the first device mentioned above and may include the following steps:

[0088] Step 410: When the first device is in the slave mode, if a first mode switching operation is detected, the first device is switched from the slave mode to the master mode in response to the first mode switching operation.

[0089] When the first device is in slave mode, if a first mode switching operation is detected, which may include but is not limited to a click operation, a voice operation, or a gesture operation, the first device switches from slave mode to master mode in response to the first mode switching operation to establish a Bluetooth connection with the device in slave mode.

[0090] As an optional implementation, when the first device is in master device mode, if a second mode switching operation is detected, the second mode switching operation may include but is not limited to a click operation, a voice operation, or a gesture operation, etc., the first device responds to the second mode switching operation by switching from master device mode to slave device mode to establish a Bluetooth connection with the device in master device mode.

[0091] It should be understood that the first device and the second device may be the same device. Therefore, the switching operation performed by the first device in the above content may also be performed by the second device.

[0092] Step 420: When the first device is in the master device mode, a first Bluetooth connection request is sent to one or more second devices in the slave device mode respectively, where the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device.

[0093] Step 430: Pair with one or more second devices and establish Bluetooth connections.

[0094] Step 440: After disconnecting the Bluetooth connection with the target second device among the one or more second devices, switch from the master device mode to the slave device mode.

[0095] As an optional implementation, after the first device switches from the master device mode to the slave device mode, if the Bluetooth connection with other second devices in one or more second devices is disconnected, since the first device is already in the slave device mode, the mode will no longer be switched automatically, and the second device disconnected from the first device will switch from the slave device mode to the master device mode, thereby preventing other second devices that are not the target second devices from establishing a Bluetooth connection with other electronic devices in the master device mode, so that when the first device re-establishes a Bluetooth connection with other second devices that are not the target second devices, it is also necessary to use the other electronic devices to disconnect the Bluetooth connection with the other second devices that are not the target second devices, thereby reducing the operations required by the user and improving convenience.

[0096] Step 450: receiving a second Bluetooth connection request sent by a target second device switched to the master device mode, and establishing a Bluetooth connection with the target second device according to the second Bluetooth connection request.

[0097] Steps 420 to 450 are the same as the methods in the above steps 210 to 240, and will not be described again here.

[0098] In an embodiment of the present application, when the first device is in slave mode, in order to establish a Bluetooth connection with the second device in slave mode, the master mode is switched to the slave mode, thereby enhancing the flexibility of establishing the Bluetooth connection.

[0099] See also Figure 5 , Figure 5 This is a flow chart of another Bluetooth connection method disclosed in an embodiment of the present application, which is applied to the second device mentioned above, and the specific steps are as follows:

[0100] Step 510: When the second device is in the slave mode, a first Bluetooth connection request sent by the first device in the master mode is received.

[0101] Step 520: Pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request.

[0102] In one embodiment, after the second device is paired with the first device according to the first Bluetooth connection request and establishes a Bluetooth connection, the second device saves second pairing information corresponding to the first device.

[0103] Step 530: After disconnecting the Bluetooth connection with the first device, switch from the slave device mode to the master device mode.

[0104] In one embodiment, step 530 includes: after disconnecting the Bluetooth connection with the first device, obtaining the number of devices currently in master device mode from the central control device, the central control device is used to obtain the current mode of each Bluetooth device connected to the central control device for communication, the Bluetooth device includes at least a first device and a second device; if the number of devices is greater than a quantity threshold, switching from slave device mode to master device mode.

[0105] Step 540: Send a second Bluetooth connection request to the first device switched to the slave device mode, where the second Bluetooth connection request is used to request a Bluetooth connection with the first device.

[0106] In one embodiment, step 540 includes: the second device sends a second Bluetooth connection request to the first device switched to the slave device mode according to the second pairing information corresponding to the first device.

[0107] In one embodiment, step 540 includes: if the Bluetooth connection is disconnected from the first device by an active disconnection, then when a Bluetooth connection operation is detected, a second Bluetooth connection request is sent to the first device switched to slave mode, and the active disconnection includes disconnecting the Bluetooth connection from the first device after detecting a disconnection instruction.

[0108] In one embodiment, step 540 includes: if the Bluetooth connection disconnection with the first device is a passive disconnection, then when it is detected that the signal strength between the first device switched to the slave device mode is higher than the connection threshold, a second Bluetooth connection request is sent to the first device switched to the slave device mode. The passive disconnection includes disconnecting the Bluetooth connection with the first device when the signal strength with the first device is lower than the connection threshold.

[0109] For the description of steps 510 to 540 of this embodiment, reference may be made to the relevant description of the Bluetooth connection method applied to the first device provided in the above embodiments, and the present application will not repeat them here.

[0110] In an embodiment of the present application, a second device in slave mode can receive a first Bluetooth connection request sent by a first device in master mode, and pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request. After disconnecting the Bluetooth connection with the first device, the second device switches from slave mode to master mode to avoid establishing a Bluetooth connection with other first devices in master mode, thereby improving the accuracy of establishing Bluetooth connections between electronic devices. When re-establishing a Bluetooth connection with the first device, the second device sends a second Bluetooth connection request to the first device, the first device receives the second Bluetooth connection request, and a Bluetooth connection is established between the first device and the second device, thereby reducing the user's need to perform more operations, such as operating the first device to establish a Bluetooth connection with the second device, disconnecting the Bluetooth connection between the second device and other first devices in master mode, etc., thereby improving convenience.

[0111] See also Figure 6 , Figure 6 1 is a modular schematic diagram of a Bluetooth connection device disclosed in an embodiment of the present application. The Bluetooth connection device 600 can be applied to the first device mentioned above. The Bluetooth connection device 600 includes a first request module 610, a first connection module 620, a first switching module 630 and a first receiving module 640, wherein:

[0112] The first request module 610 is used to send a first Bluetooth connection request to one or more second devices in the slave device mode respectively when the first device is in the master device mode, and the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device.

[0113] The first connection module 620 is used to pair with one or more second devices and establish a Bluetooth connection.

[0114] The first switching module 630 is configured to switch from the master device mode to the slave device mode after disconnecting the Bluetooth connection with the target second device among the one or more second devices.

[0115] The first receiving module 640 is configured to receive a second Bluetooth connection request sent by a target second device switched to the master device mode, and establish a Bluetooth connection with the target second device according to the second Bluetooth connection request.

[0116] In one embodiment, the Bluetooth connection device 600 includes a first request module 610, a first connection module 620, a first switching module 630 and a first receiving module 640, and further includes a first storage module, wherein:

[0117] The first storage module is used to store first pairing information corresponding to one or more second devices respectively.

[0118] In one embodiment, the Bluetooth connection device 600 includes a first request module 610, a first connection module 620, a first switching module 630, a first receiving module 640 and a storage module, and further includes a first response operation module, wherein:

[0119] The first response operation module is used to switch the first device from the slave device mode to the master device mode in response to the first mode switching operation if a first mode switching operation is detected when the first device is in the slave device mode.

[0120] In an embodiment of the present application, when the first device is in the master device mode, it sends a first Bluetooth connection request to one or more second devices in the slave device mode respectively, so as to pair with the one or more second devices and establish a Bluetooth connection respectively. After disconnecting the Bluetooth connection with the target second device in the one or more second devices, the first device switches from the master device mode to the slave device mode, and the target second device switches from the slave device mode to the master device mode. The target second device switches to the master device mode and sends a second Bluetooth connection request to the first device, so as to ensure that the target second device accurately re-establishes the Bluetooth connection with the first device. By switching modes, the target second device switches to the master device mode after disconnecting the Bluetooth connection, avoiding connection with other electronic devices in the master device mode. The accuracy of establishing Bluetooth connections between electronic devices can be improved, the operations required by the user are reduced, and the convenience is improved.

[0121] See also Figure 7 , Figure 7 1 is a modular schematic diagram of another Bluetooth connection device disclosed in an embodiment of the present application. The Bluetooth connection device 700 can be applied to the second device mentioned above. The Bluetooth connection device 700 includes a second receiving module 710, a second connection module 720, a second switching module 730 and a second request module 740, wherein:

[0122] The second receiving module 710 is configured to receive a first Bluetooth connection request sent by a first device in a master mode when the second device is in a slave mode.

[0123] The second connection module 720 is configured to pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request.

[0124] The second switching module 730 is configured to switch from the slave device mode to the master device mode after disconnecting the Bluetooth connection with the first device.

[0125] The second request module 740 is used to send a second Bluetooth connection request to the first device switched to the slave device mode, where the second Bluetooth connection request is used to request a Bluetooth connection with the first device.

[0126] In one embodiment, the Bluetooth connection device 700 includes, in addition to the second receiving module 710, the second connecting module 720, the second switching module 730 and the second requesting module 740, a second saving module, wherein:

[0127] The second saving module is used to save the second pairing information corresponding to the first device.

[0128] The second request module 740 is further configured to send a second Bluetooth connection request to the first device switched to the slave device mode according to the second pairing information.

[0129] In one embodiment, the second switching module 730 is also used to obtain the number of devices currently in master device mode from the central control device after disconnecting the Bluetooth connection with the first device. The central control device refers to a device that can obtain the current mode of all Bluetooth devices. The Bluetooth devices include the first device and the second device. If the number of devices currently in master device mode is greater than the number threshold, the slave device mode is switched to the master device mode.

[0130] In an embodiment of the present application, as an optional implementation, disconnecting the Bluetooth connection with the first device is an active disconnection, and the active disconnection includes disconnecting the Bluetooth connection with the first device after detecting a disconnection instruction; or, disconnecting the Bluetooth connection with the first device is a passive disconnection, and the passive disconnection includes disconnecting the Bluetooth connection with the first device when the signal strength with the first device is lower than a connection threshold.

[0131] In one embodiment, the second request module 740 is also used to send a second Bluetooth connection request to the first device switched to slave device mode when a request sending operation is detected if the Bluetooth connection with the first device is disconnected actively; if the Bluetooth connection with the first device is disconnected passively, send a second Bluetooth connection request to the first device switched to slave device mode when it is detected that the signal strength between the device and the first device switched to slave device mode is higher than a connection threshold.

[0132] In an embodiment of the present application, a second device in slave mode can receive a first Bluetooth connection request sent by a first device in master mode, and pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request. After disconnecting the Bluetooth connection with the first device, the second device switches from slave mode to master mode to avoid establishing a Bluetooth connection with other first devices in master mode, thereby improving the accuracy of establishing Bluetooth connections between electronic devices. When re-establishing a Bluetooth connection with the first device, the second device sends a second Bluetooth connection request to the first device, the first device receives the second Bluetooth connection request, and a Bluetooth connection is established between the first device and the second device, thereby reducing the user's need to perform more operations, such as operating the first device to establish a Bluetooth connection with the second device, disconnecting the Bluetooth connection between the second device and other first devices in master mode, etc., thereby improving convenience.

[0133] See also Figure 8 , a structural block diagram of an electronic device disclosed in an embodiment of the present application, the electronic device may include:

[0134] A memory 810 storing executable program codes;

[0135] a processor 820 coupled to the memory 810;

[0136] The processor 820 calls the executable program code stored in the memory 810 to implement the Bluetooth connection method applied to the first device as provided in the above embodiments.

[0137] The memory 810 may include a random access memory (RAM) or a read-only memory (ROM). The memory 810 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 810 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device during use, etc.

[0138] The processor 820 may include one or more processing cores. The processor 820 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 810, and calling data stored in the memory 810. Optionally, the processor 820 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 820 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 820, but may be implemented separately through a communication chip.

[0139] It is understandable that the electronic device may include more or fewer structural elements than those in the above structural block diagram, for example, a power module, physical buttons, a WiFi (Wireless Fidelity) module, a speaker, a Bluetooth module, a sensor, etc., and no limitation is made here.

[0140] In one embodiment, an electronic device is provided, comprising:

[0141] A memory storing executable program code;

[0142] a processor coupled to the memory;

[0143] The processor calls the executable program code stored in the memory to implement the Bluetooth connection method applied to the second device provided in the above embodiments.

[0144] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the Bluetooth connection method applied to a first device provided in each of the above embodiments.

[0145] In one embodiment, a computer-readable storage medium is provided, which stores a computer program, wherein the computer program enables a computer to execute the Bluetooth connection method applied to a second device provided in each of the above embodiments.

[0146] In addition, an embodiment of the present application further discloses a computer program product. When the computer program product is run on a computer, the computer can execute all or part of the steps in a Bluetooth connection method applied to a first device described in the above embodiment.

[0147] In one embodiment, a computer program product is provided. When the computer program product is run on a computer, the computer can execute all or part of the steps in a Bluetooth connection method applied to a second device described in the above embodiment.

[0148] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0149] The above is a detailed introduction to a Bluetooth connection method disclosed in an embodiment of 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 method of the present application and its core idea. At the same time, for general technicians 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 connection method, characterized in that: Applied to a first device, the method includes: When the first device is in the master device mode, sending a first Bluetooth connection request to one or more second devices in the slave device mode respectively, wherein the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device; Pairing with the one or more second devices respectively and establishing a Bluetooth connection; After disconnecting the Bluetooth connection with the target second device among the one or more second devices, switching from the master device mode to the slave device mode; A second Bluetooth connection request is received from the target second device that is switched to the master device mode, and a Bluetooth connection is established with the target second device according to the second Bluetooth connection request.

2. The method according to claim 1, characterized in that Before respectively sending the first Bluetooth connection request to one or more second devices in slave mode when the first device is in master mode, the method further includes: When the first device is in a slave mode, if a first mode switching operation is detected, the first device is switched from the slave mode to the master mode in response to the first mode switching operation.

3. A Bluetooth connection method, characterized in that: Applied to the second device, the method includes: When the second device is in slave mode, receiving a first Bluetooth connection request sent by a first device in master mode; pairing with the first device and establishing a Bluetooth connection according to the first Bluetooth connection request; After disconnecting the Bluetooth connection with the first device, switching from the slave device mode to the master device mode; A second Bluetooth connection request is sent to the first device switched to the slave device mode, where the second Bluetooth connection request is used to request a Bluetooth connection with the first device.

4. The method according to claim 3, characterized in that After pairing with the first device and establishing a Bluetooth connection according to the first Bluetooth connection request, the method further includes: Saving second pairing information corresponding to the first device; The sending a second Bluetooth connection request to the first device in the slave device mode comprises: A second Bluetooth connection request is sent to the first device switched to the slave device mode according to the second pairing information.

5. The method according to claim 3, characterized in that: After disconnecting the Bluetooth connection with the first device, switching from the slave device mode to the master device mode includes: After disconnecting the Bluetooth connection with the first device, obtaining the number of devices currently in the master device mode from a central control device, the central control device being used to obtain the current mode of each Bluetooth device in communication connection with the central control device, the Bluetooth devices including at least the first device and the second device; If the number of devices is greater than the number threshold, the slave device mode is switched to the master device mode.

6. The method according to claim 4, characterized in that The sending a second Bluetooth connection request to the first device switched to the slave device mode comprises: If the disconnection of the Bluetooth connection with the first device is an active disconnection, then upon detecting a Bluetooth connection operation, a second Bluetooth connection request is sent to the first device switched to the slave device mode, wherein the active disconnection includes disconnecting the Bluetooth connection with the first device after detecting a disconnection instruction; or If the disconnection of the Bluetooth connection with the first device is a passive disconnection, then when it is detected that the signal strength between the first device and the first device switched to the slave device mode is higher than the connection threshold, a second Bluetooth connection request is sent to the first device switched to the slave device mode, and the passive disconnection includes disconnecting the Bluetooth connection with the first device when the signal strength with the first device is lower than the connection threshold.

7. A Bluetooth connection device, characterized in that: Applied to a first device, the apparatus comprises: A first request module, configured to send a first Bluetooth connection request to one or more second devices in a slave mode respectively when the first device is in a master mode, wherein the first Bluetooth connection request is used to request a Bluetooth pairing connection with the second device; A first connection module, used to pair with the one or more second devices respectively and establish a Bluetooth connection; A first switching module, configured to switch from the master device mode to the slave device mode after disconnecting the Bluetooth connection with a target second device among the one or more second devices; The first receiving module is used to receive a second Bluetooth connection request sent by the target second device switched to the master device mode, and establish a Bluetooth connection with the target second device according to the second Bluetooth connection request.

8. A Bluetooth connection device, characterized in that: Applied to a second device, the apparatus comprises: A second receiving module, configured to receive a first Bluetooth connection request sent by a first device in a master device mode when the second device is in a slave device mode; A second connection module, configured to pair with the first device and establish a Bluetooth connection according to the first Bluetooth connection request; A second switching module, configured to switch from the slave device mode to the master device mode after disconnecting the Bluetooth connection with the first device; The second sending module is used to send a second Bluetooth connection request to the first device switched to the slave device mode, where the second Bluetooth connection request is used to request a Bluetooth connection with the first device.

9. An electronic device, characterized in that: include: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the method according to any one of claims 1 to 2 or 3 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 2 or 3 to 6.

Citation Information

Patent Citations

  • Bluetooth connection method and device, storage medium and terminal

    CN110944313A

  • Mode-switchable Bluetooth equipment, Bluetooth connection system and Bluetooth connection method

    CN111083746A