CN114374959A - Bluetooth connection method and device, electronic equipment and storage medium - Google Patents

Bluetooth connection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114374959A
CN114374959A CN202210052032.0A CN202210052032A CN114374959A CN 114374959 A CN114374959 A CN 114374959A CN 202210052032 A CN202210052032 A CN 202210052032A CN 114374959 A CN114374959 A CN 114374959A
Authority
CN
China
Prior art keywords
bluetooth connection
mode
slave
bluetooth
devices
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210052032.0A
Other languages
Chinese (zh)
Inventor
张军
金志成
吴泽先
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Wingtech Information Technology Co Ltd
Original Assignee
Xian Wingtech Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Wingtech Information Technology Co Ltd filed Critical Xian Wingtech Information Technology Co Ltd
Priority to CN202210052032.0A priority Critical patent/CN114374959A/en
Publication of CN114374959A publication Critical patent/CN114374959A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/50Secure pairing of devices
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/50Secure pairing of devices
    • H04W12/55Secure pairing of devices involving three or more devices, e.g. group pairing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup

Abstract

The embodiment of the application discloses a Bluetooth connection method, a Bluetooth connection device, electronic equipment and a storage medium, wherein the method is applied to first equipment and comprises the following steps: under the condition that a first device is in a master device mode, respectively sending first Bluetooth connection requests to one or more second devices in a slave device mode; pairing with one or more second devices and establishing Bluetooth connection; switching from the master device mode to the slave device mode after disconnecting the bluetooth connection with a target second device of the one or more second devices; and receiving a second Bluetooth connection request sent by the target second equipment switched to the master equipment mode, and establishing Bluetooth connection with the target second equipment. According to the embodiment of the application, the accuracy of establishing the Bluetooth connection between the electronic devices can be improved, the user operation is simplified, and the convenience is improved.

Description

Bluetooth connection method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a bluetooth connection method and apparatus, an electronic device, and a storage medium.
Background
Along with the development of science and technology, the types of electronic equipment capable of using the Bluetooth module are more and more abundant, and other electronic equipment such as a mobile phone, a tablet, a mouse and a computer have the Bluetooth function. After the bluetooth connection between the first device and the second device is disconnected, if a plurality of other devices paired with the second device exist around the first device, the second device will reselect the device with the high priority to automatically establish the bluetooth connection, and if the device that the user wants to establish the bluetooth connection with the second device is the first device and the device that the user automatically selects is not the first device, the bluetooth connection between the second device and the other devices needs to be disconnected first, and then the bluetooth connection between the first device and the second device needs to be manually established, so that the operation of the scheme for reestablishing the bluetooth connection is very complicated.
Disclosure of Invention
The embodiment of the application discloses a Bluetooth connection method, a Bluetooth connection device, electronic equipment and a storage medium, which can improve the accuracy of establishing Bluetooth connection between the electronic equipment, simplify user operation and improve convenience.
The embodiment of the application discloses a Bluetooth connection method, which is applied to first equipment and comprises the following steps:
under the condition that the first device is in a master device mode, respectively sending first Bluetooth connection requests to one or more second devices in a slave device mode, wherein the first Bluetooth connection requests are used for requesting Bluetooth pairing connection with the second devices;
pairing the one or more second devices and establishing Bluetooth connection respectively;
switching from the master device mode to the slave device mode after disconnecting Bluetooth from a target second device of the one or more second devices;
and receiving a second Bluetooth connection request sent by the target second equipment switched to the master equipment mode, and establishing Bluetooth connection with the target second equipment according to the second Bluetooth connection request.
In one embodiment, before the sending the first bluetooth connection requests to the one or more second devices in the slave device mode respectively in the case that the first device is in the master device mode, the method further includes:
under the condition that the first equipment is in a slave equipment mode, if a first mode switching operation is detected, responding to the first mode switching operation, and switching the first equipment from the slave equipment mode to a master equipment mode.
The embodiment of the application discloses a Bluetooth connection method, which is applied to second equipment and comprises the following steps:
under the condition that the second device is in the slave device mode, receiving a first Bluetooth connection request sent by a first device in a master device mode;
pairing the first equipment according to the first Bluetooth connection request and establishing Bluetooth connection;
switching from the slave device mode to the master device mode after disconnecting the Bluetooth connection with the first device;
sending a second Bluetooth connection request to the first device switched to the slave device mode, the second Bluetooth connection request being for requesting Bluetooth connection with the first device.
In one embodiment, after said pairing with said first device and establishing a bluetooth connection according to said first bluetooth connection request, said method further comprises:
saving second pairing information corresponding to the first device;
said sending a second Bluetooth connection request to said first device in said slave mode, comprising:
and sending a second Bluetooth connection request to the first equipment switched to the slave equipment mode according to the second pairing information.
In one embodiment, said switching from said slave mode to said master mode after disconnecting bluetooth from said first device comprises:
after the Bluetooth connection with the first device is disconnected, acquiring the number of devices currently in a master device mode from a central control device, wherein the central control device is used for acquiring the current mode of each Bluetooth device in communication connection with the central control device, and the Bluetooth devices at least comprise the first device and the second device;
and if the number of the devices is larger than a number threshold, switching from the slave device mode to the master device mode.
In one embodiment, said sending a second bluetooth connection request to said first device switching to said slave device mode comprises:
if the Bluetooth connection with the first equipment is active disconnection, when the Bluetooth connection operation is detected, sending a second Bluetooth connection request to the first equipment switched to the slave equipment mode, wherein the active disconnection comprises the Bluetooth connection with the first equipment after a disconnection instruction is detected; or the like, or, alternatively,
if the Bluetooth connection with the first device is a passive disconnection, sending a second Bluetooth connection request to the first device switched to the slave device mode when detecting that the signal strength between the first device and the slave device mode is higher than a connection threshold, wherein the passive disconnection comprises the Bluetooth connection with the first device when the signal strength between the first device and the passive device is lower than the connection threshold.
The embodiment of the application discloses bluetooth connecting device is applied to first equipment, the device includes:
the first request module is used for respectively sending first Bluetooth connection requests to one or more second devices in a slave device mode under the condition that the first device is in a master device mode, wherein the first Bluetooth connection requests are used for requesting Bluetooth pairing connection with the second devices;
the first connection module is used for respectively pairing with the one or more second devices and establishing Bluetooth connection;
a first switching module for switching from the master device mode to the slave device mode after disconnecting a Bluetooth connection with a target second device of the one or more second devices;
the first receiving module is configured to receive a second bluetooth connection request sent by the target second device switched to the master device mode, and establish bluetooth connection with the target second device according to the second bluetooth connection request.
The embodiment of the application discloses bluetooth connecting device is applied to the second equipment, the device includes:
a second receiving module, configured to receive, when the second device is in the slave device mode, a first bluetooth connection request sent by a first device in a master device mode;
the second connection module is used for pairing with the first equipment according to the first Bluetooth connection request and establishing Bluetooth connection;
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;
a second sending module, configured 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.
The embodiment of the application discloses electronic equipment, includes:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to execute the method of any of the above embodiments.
The embodiment of the application discloses a computer-readable storage medium, which stores a computer program, wherein the computer program, when executed by a processor, causes the processor to execute the method of any one of the above embodiments.
In the bluetooth connection method, apparatus, electronic device and storage medium disclosed in the embodiments of the present application, a first device sends first bluetooth connection requests to one or more second devices in a slave device mode respectively under the condition that the first device is in a master device mode, so as to pair with the one or more second devices and establish bluetooth connection respectively, after the bluetooth connection is disconnected with a target second device of 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 reestablishes bluetooth connection with the first device, and the target second device switches to the master device mode after the bluetooth connection is disconnected through the mode switching, the method and the device avoid connection with other electronic equipment in a main equipment mode, can improve the accuracy of establishing Bluetooth connection between the electronic equipment, reduce the operation required by a user, and improve convenience.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a bluetooth connection method disclosed in an embodiment of the present application;
fig. 2 is a flowchart illustrating a bluetooth connection method according to an embodiment of the present disclosure;
fig. 3 is a timing diagram of a bluetooth connection method disclosed in an embodiment of the present application;
fig. 4 is a flowchart illustrating another bluetooth connection method disclosed in an embodiment of the present application;
fig. 5 is a flowchart illustrating another bluetooth connection method disclosed in an embodiment of the present application;
FIG. 6 is a block diagram of a Bluetooth connection device according to an embodiment of the present disclosure;
FIG. 7 is a block diagram of another embodiment of a Bluetooth connection device;
fig. 8 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "comprises" and "comprising," and any variations thereof, in the embodiments of the present application, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, 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, without departing from the scope of the present application. Both the first and second call instructions are call instructions, but they are not the same call instruction.
When the electronic device in the master device mode is used, a plurality of electronic devices in the slave device mode can be simultaneously connected through bluetooth, but the electronic device in the slave device mode can be paired with the plurality of electronic devices in the master device mode, and the plurality of electronic devices in the master device mode cannot be simultaneously connected.
When a plurality of electronic devices in the master device mode exist in an environment where an electronic device in the slave device mode exists, and are paired with the electronic devices in the master device mode, the electronic device in the slave mode cannot actively connect with the electronic device in the master mode as intended by the user, and the current scheme for re-establishing the bluetooth connection is to automatically select connection according to the priority of the pairing information stored in the electronic device in the slave mode, if the automatically selected device is not the device that the user wants to connect to, the user must first disconnect the bluetooth connection between the electronic device in the master device mode and the electronic device in the slave device mode, and then actively set up the bluetooth connection with the electronic device in the slave device mode through the electronic device in the master device mode that needs to be connected, and the operation of the scheme for reestablishing the bluetooth connection is very complicated.
The embodiment of the application discloses a Bluetooth connection method, a Bluetooth connection device, electronic equipment and a storage medium, which can improve the accuracy of establishing Bluetooth connection between the electronic equipment, simplify user operation and improve convenience.
The following detailed description is made with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario of a bluetooth connection method disclosed in an embodiment of the present application, where the application scenario may include a first device 10 and a second device 20, where the first device 10 may include, but is not limited to, an electronic device with a bluetooth module, such as a mobile phone, a tablet, a wearable device, a notebook Computer, a PC (Personal Computer), a bluetooth headset, and the second device 20 and the first device 10 may be the same electronic device or different electronic devices, and are not limited herein. In addition, the operating systems of the first device 10 and the second device 20 may include, but are not limited to, an Android operating system, an IOS operating system, a Symbian operating system, a Black Berry operating system, a Windows Phone8 operating system, and the like, and the embodiments of the present application are not limited thereto.
The first device 10 and the second device 20 both have two modes in bluetooth communication, a master mode and a slave mode, respectively. In the master device mode, the electronic device can actively initiate a Bluetooth connection request to other electronic devices to establish the Bluetooth connection, and in the slave device mode, the electronic device passively receives the Bluetooth connection request initiated by other devices to establish the Bluetooth connection. Both the first device 10 and the second device 20 may be switched between a master mode and a slave mode.
It is to be understood that in order to distinguish the first device 10 from the second device 20, the first device 10 is typically in a master device mode during a bluetooth pairing connection, and the second device 20 is typically in a slave device mode during a bluetooth pairing connection. When the pairing information of the other party is not stored between the two electronic devices, the bluetooth pairing connection is performed, after the pairing is completed, the pairing information of the other party is stored, and then the bluetooth connection is reestablished between the first device 10 and the second device 20, so that the pairing is not required to be performed again.
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, and 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 in the bluetooth connection process (i.e., pairing).
After the first device 10 stores the pairing information corresponding to the second device 20, if the first device wants to establish bluetooth connection with the second device 20 again, the first device 10 may directly send a bluetooth connection request to the second device 20 according to the pairing information of the second device 20, and after the second device 20 receives the bluetooth connection request sent by the first device 10, the second device 20 may establish bluetooth connection with the second device 20 according to the bluetooth connection request, and does not need to pair with the first device 10 again in the bluetooth connection process.
Referring to fig. 2, fig. 2 is a flowchart illustrating a bluetooth connection method according to an embodiment of the present disclosure, where the bluetooth connection method is applicable to the first device, and includes the following steps:
step 210, under the condition that 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, where the first bluetooth connection request is used to request a bluetooth pairing connection with the second devices.
The first device detects a bluetooth connection operation in a case where the first device is in a master device mode, and transmits first bluetooth connection requests to one or more second devices in a slave device mode, respectively, in response to the bluetooth connection operation. The one or more second devices may be within a target range of distance of the first device, which may refer to a range in which a bluetooth connection can be established. The one or more second devices, after receiving the first bluetooth connection request sent by the first device, may pair with the first device and establish a bluetooth connection according to the first bluetooth connection request.
As an alternative embodiment, only one-to-one connections between devices may be restricted. The method comprises the steps that under the condition that a first device is in a master device mode, the first device detects a Bluetooth connection operation, then responds to the Bluetooth connection operation, the Bluetooth connection operation can be a Bluetooth connection operation initiated by a user to a certain second device in a slave device mode, if the current first device is not in Bluetooth connection with other devices, a first Bluetooth connection request is directly sent to the second device in the slave device mode corresponding to the Bluetooth connection operation, if the current first device is in Bluetooth connection with other devices, the Bluetooth connection with other devices is disconnected firstly, then the first Bluetooth connection request is sent to the second device in the slave device mode corresponding to the Bluetooth connection operation, and after the second device receives the first Bluetooth connection request, the second device can be paired with the first device according to the first Bluetooth connection request and establish Bluetooth connection. By implementing the embodiment, the number of devices connected by the Bluetooth device can be reduced, thereby simplifying the connection relationship between the Bluetooth devices.
And step 220, pairing with one or more second devices and establishing Bluetooth connection respectively.
After one or more second devices receive a first Bluetooth connection request sent by a first device, the first device and the one or more second devices are respectively paired and Bluetooth connection is established.
As an optional implementation manner, if one or more second devices have established bluetooth connections with other devices, the first device fails to establish bluetooth connection relationship with the one or more second devices without responding to the first bluetooth connection request sent by the first device, and a prompt message is output to prompt the user that the second device has established bluetooth connections with other devices in the master device mode. The manner of outputting the prompt information may include, but is not limited to, voice prompt, vibration prompt, picture prompt, light prompt, and the like. By implementing the embodiment, the user can be prompted that the second device which the user wants to connect to is connected with other devices, and the user is prevented from repeatedly carrying out invalid Bluetooth connection operation.
In one embodiment, after establishing bluetooth connections with one or more second devices and performing pairing, a first device stores first pairing information corresponding to the one or more second devices, respectively. Correspondingly, one or more second devices connected with the first device respectively store second pairing information of the first device. The pairing information may include, but is not limited to, a MAC (Media Access Control Address), a device type, and the like.
In step 230, after disconnecting bluetooth from a target second device of the one or more second devices, switching from the master device mode to the slave device mode.
In one embodiment, the target second device of the one or more second devices may be any second device. After the first device establishes the bluetooth connection with the one or more second devices, if the bluetooth connection is disconnected with a target second device of the one or more second devices, the first device may be switched from the master device mode to the slave device mode, and the target second device may be switched from the slave device mode to the master device mode.
In one embodiment, the target second device of the one or more second devices may be a particular second device. The first device establishes a bluetooth connection with one or more second devices, and among the one or more second devices, a specific second device is disconnected from the first device in a bluetooth connection, the first device is switched from a master device mode to a slave device mode, and the specific second device is switched from the slave device mode to the master device mode. When the bluetooth connection is disconnected from other non-specific second devices of the one or more second devices, the first device does not switch modes, nor do the other non-specific second devices switch modes.
As an alternative embodiment, the specific second device may be a preset second device of a 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, and the like. 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 a bluetooth headset and switch the master device state to the slave device state, and when the bluetooth headset is disconnected from the first device, switch the slave device state to the master device state.
As an alternative embodiment, the specific second device may also be user-set. For example, the first device may provide option information of the second device that has established the bluetooth connection and is in the slave device mode, where the option information is used to set the second device as a specific second device, and when a setting operation that the user sets any one of the second devices as the specific second device is detected, the second device corresponding to the setting operation is set as the specific second device. The setting operation may include, but is not limited to, a click operation, a voice operation, a gesture operation, or the like. Therefore, the user can flexibly adjust the specific second equipment according to the self requirement, and the applicability of the user in the actual use of the Bluetooth connection method is improved.
In one embodiment, within a certain distance range, there is one central control device, which may be a specially configured device or any bluetooth device. The central control device may be communicatively connected to bluetooth devices within the distance range, and acquire a current mode of each bluetooth device communicatively connected to the central control device, where the bluetooth devices at least include the first device and the second device, and may further include, but are not limited to, other electronic devices in a master device mode and other electronic devices in a slave device mode.
As an optional implementation manner, after the bluetooth connection between the first device and the second device is disconnected, the first device and the second device obtain, from the central control device, the number of devices currently in the master device mode, and if the number of devices currently in the master device mode is greater than the number threshold, the first device switches from the master device mode to the slave device mode, and the second device switches from the slave device mode to the master device mode.
As an optional implementation manner, after the first device and a target second device in the one or more second devices are disconnected from the bluetooth connection, the first device and the target second device send a device number obtaining instruction to the central control device, the central control device obtains the number of devices currently in the master device mode according to the device number obtaining instruction, and sends the number of devices currently in the master device mode to the first device and the target second device, if the number of devices currently in the master device mode is greater than a number threshold, the first device is switched from the master device mode to the slave device mode, and the target second device is switched from the slave device mode to the master device mode. For example, after the first device disconnects bluetooth from one of the target second devices, the number of the bluetooth devices currently in the master device mode, which is acquired by the central control device, is 1, the number threshold may be 0, the number of the devices is greater than the number threshold, the first device is switched from the master device mode to the slave device mode, and the target second device is switched from the slave device mode to the master device mode. By implementing the embodiment, when other electronic devices in the main device mode exist in a certain distance range, the target second device is prevented from establishing Bluetooth connection with other electronic devices.
As an optional implementation manner, after the first device and a target second device of the one or more second devices are disconnected from the bluetooth connection, the first device and the target second device send a device number obtaining instruction to the central control device, the central control device obtains, according to the device number obtaining instruction, the number of devices which are currently in the master device mode and have pairing information with the target second device, and sends the number of devices to the first device and the target second device, if the number of devices is greater than a number threshold, the first device is switched from the master device mode to the slave device mode, and the target second device is switched from the slave device mode to the master device mode. By implementing the embodiment, when other electronic equipment which is in the master equipment mode and paired with the target second equipment exists in a certain distance range, the target second equipment is prevented from establishing Bluetooth connection with the other electronic equipment.
Step 240, receiving a second bluetooth connection request sent by the target second device switched to the master device mode, and establishing bluetooth connection with the target second device according to the second bluetooth connection request.
If the target second device switched to the slave device mode does not establish Bluetooth connection with other first devices in the master device 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 Bluetooth connection is established between the first device and the second device.
As an optional implementation manner, the target second device sends the second bluetooth connection request to the first device switched to the slave device mode according to the second pairing information.
In one embodiment, if the bluetooth connection between the first device and the second device is active disconnection, that is, the first device detects a disconnection command and sends disconnection information to the second device, or the second device detects a disconnection command and sends disconnection information to the first device, and the first device and the second device are disconnected from bluetooth, 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 sending request operation, the first device receives the second bluetooth connection request sent by the second device, and the first device and the second device establish bluetooth connection.
In one embodiment, if the bluetooth disconnection between the first device and the second device is a passive disconnection, that is, the signal strength between the first device and the second device is lower than a connection threshold, and the first device disconnects bluetooth from the second device, 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 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 bluetooth connection with the second device.
Fig. 3 is a timing diagram of a bluetooth connection method illustrating a connection process of a first device with a target second device of one or more second devices. As shown in fig. 3, in the case that a first device is in a master device mode and a target second device is in a slave device mode, the first device in the master device mode detects the target second device in the slave device mode, provides option information for a user to establish a bluetooth connection with the target second device, transmits a first bluetooth connection request to the target second device after detecting a bluetooth connection operation triggered by the user according to the option information, the target second device establishes a bluetooth connection with the target second device after receiving the first bluetooth connection request, the first device switches from the master device mode to the slave device mode after the first device disconnects the bluetooth connection with the target second device, 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, and sending a target second Bluetooth connection request to the first equipment, and after the first equipment receives the target second Bluetooth connection request, establishing Bluetooth connection between the first equipment and the target second equipment.
In the embodiment of the application, a first device sends a first bluetooth connection request to one or more second devices in a slave device mode under the condition of being in a master device mode, so as to pair with the one or more second devices and establish bluetooth connection respectively, after the bluetooth connection is disconnected with a target second device in the one or more second devices, the first device is switched from the master device mode to the slave device mode, the target second device is switched 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 that the target second device is ensured to accurately reestablish the bluetooth connection with the first device, and the target second device is switched to the master device mode after the bluetooth connection is disconnected through the mode switching, so as to avoid connection with other electronic devices in the master device mode, the accuracy of establishing Bluetooth connection between electronic equipment can be improved, the operation that the user needs to carry out is reduced, and the convenience is improved.
Referring to fig. 4, fig. 4 is a flowchart illustrating another bluetooth connection method disclosed in the embodiment of the present application, where the bluetooth connection method is applicable to the first device, and includes the following steps:
step 410, under the condition that the first device is in the slave device mode, if the first mode switching operation is detected, responding to the first mode switching operation, and switching the first device from the slave device mode to the master device mode.
In the case that the first device is in the slave device mode, if a first mode switching operation is detected, the first mode switching operation may include, but is not limited to, a click operation, a voice operation, or a gesture operation, and the first device switches from the slave device mode to the master device mode in response to the first mode switching operation, so as to establish a bluetooth connection with the device in the slave device mode.
As an optional implementation manner, in a case where the first device is in the 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, and the first device switches from the master device mode to the slave device mode in response to the second mode switching operation, so as to establish a bluetooth connection with the device in the master device mode.
It is to 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-described manner can be performed by the second device as well.
Step 420, under the condition that the first device is in the master device mode, respectively sending a first bluetooth connection request to one or more second devices in the slave device mode, where the first bluetooth connection request is used to request a bluetooth pairing connection with the second devices.
And 430, respectively pairing with one or more second devices and establishing Bluetooth connection.
At step 440, after disconnecting bluetooth from a target second device of the one or more second devices, switching from the master device mode to the slave device mode.
As an optional implementation manner, after the first device is switched from the master device mode to the slave device mode, if the bluetooth connection is disconnected with another second device in the one or more second devices, because the first device is already in the slave device mode, the mode is not automatically switched, the second device disconnected from the first device is switched from the slave device mode to the master device mode, and it is avoided that another second device that is not the target second device establishes bluetooth connection with another electronic device that is in the master device mode, so that when the first device reestablishes bluetooth connection with another second device that is not the target second device, the another electronic device needs to be used to disconnect bluetooth connection with the another second device that is not the target second device, which reduces operations that need to be performed by a user, and improves convenience.
Step 450, receiving a second bluetooth connection request sent by the target second device switched to the master device mode, and establishing bluetooth connection with the target second device according to the second bluetooth connection request.
Steps 420-450 are the same as the above steps 210-240, and are not described herein.
In the embodiment of the application, when the first device is in the slave device mode, in order to establish the bluetooth connection with the second device in the slave device mode, the master device mode is switched to the slave device mode, so that the flexibility of establishing the bluetooth connection is enhanced.
Referring to fig. 5, fig. 5 is a schematic flowchart of another bluetooth connection method disclosed in the embodiment of the present application, which is applied to the second device, and includes the following specific steps:
in step 510, a first bluetooth connection request sent by a first device in a master device mode is received when a second device is in a slave device mode.
And step 520, pairing the first device according to the first Bluetooth connection request and establishing Bluetooth connection.
In one embodiment, after the second device pairs with the first device according to the first bluetooth connection request and establishes bluetooth connection, second pairing information corresponding to the first device is stored.
Step 530, after disconnecting the bluetooth connection with the first device, switching from the slave device mode to the master device mode.
In one embodiment, step 530 includes: after the Bluetooth connection with the first equipment is disconnected, acquiring the number of the equipment currently in the master equipment mode from the central control equipment, wherein the central control equipment is used for acquiring the current mode of each Bluetooth equipment in communication connection with the central control equipment, and the Bluetooth equipment at least comprises the first equipment and the second equipment; and if the number of the devices is larger than the number threshold, switching from the slave device mode to the master device mode.
And 540, sending a second bluetooth connection request to the first device switched to the slave device mode, wherein the second bluetooth connection request is used for requesting bluetooth connection with the first device.
In one embodiment, step 540, comprises: the second device sends a second Bluetooth connection request to the first device switched to the slave device mode according to second pairing information corresponding to the first device.
In one embodiment, step 540, comprises: and if the Bluetooth connection with the first equipment is active disconnection, sending a second Bluetooth connection request to the first equipment switched to the slave equipment mode when the Bluetooth connection operation is detected, wherein the active disconnection comprises the Bluetooth connection with the first equipment after a disconnection instruction is detected.
In one embodiment, step 540, comprises: if the disconnection of the Bluetooth connection from the first device is a passive disconnection, sending a second Bluetooth connection request to the first device switched to the slave device mode when detecting that the signal strength with the first device switched to the slave device mode is higher than a connection threshold, wherein the passive disconnection comprises the disconnection of the Bluetooth connection from the first device when the signal strength with the first device is lower than the connection threshold.
For the description of steps 510 to 540 of this embodiment, reference may be made to the related description of the bluetooth connection method applied to the first device provided in the foregoing embodiments, and details of this application are not repeated herein.
In this embodiment of the application, the second device in the slave device mode may receive the first bluetooth connection request sent by the first device in the master device mode, pair with the first device according to the first bluetooth connection request and establish a bluetooth connection, and after the bluetooth connection is disconnected with the first device, the second device switches from the slave device mode to the master device mode to avoid establishing a bluetooth connection with other first devices in the master device mode, so as to improve the accuracy of establishing a bluetooth connection between the electronic devices And the Bluetooth connection between the second equipment and other first equipment in the master equipment mode is disconnected, and the convenience is improved.
Referring to fig. 6, fig. 6 is a schematic block diagram of a bluetooth connection apparatus 600 disclosed in an embodiment of the present application, where the bluetooth connection apparatus 600 is applicable to the first device, and the bluetooth connection apparatus 600 includes a first request module 610, a first connection module 620, a first switching module 630, and a first receiving module 640, where:
a first requesting module 610, configured to send, when a first device is in a master device mode, first bluetooth connection requests to one or more second devices in a slave device mode, where the first bluetooth connection requests are used to request bluetooth pairing connection with the second devices.
And the first connection module 620 is configured to pair with one or more second devices and establish a bluetooth connection.
A first switching module 630 for switching from the master device mode to the slave device mode after disconnecting the bluetooth connection with a target second device of the one or more second devices.
The first receiving module 640 is configured 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.
In one embodiment, the bluetooth connection apparatus 600 further includes a first saving module in addition to the first requesting module 610, the first connecting module 620, the first switching module 630 and the first receiving module 640, wherein:
the first storage module is used for storing first pairing information respectively corresponding to one or more second devices.
In one embodiment, the bluetooth connection apparatus 600 further includes a first response operation module in addition to the first request module 610, the first connection module 620, the first switching module 630, the first receiving module 640 and the saving module, wherein:
the first response operation module is used for responding to the first mode switching operation and switching the first equipment from the slave equipment mode to the master equipment mode if the first mode switching operation is detected under the condition that the first equipment is in the slave equipment mode.
In the embodiment of the application, a first device sends a first bluetooth connection request to one or more second devices in a slave device mode under the condition of being in a master device mode, so as to pair with the one or more second devices and establish bluetooth connection respectively, after the bluetooth connection is disconnected with a target second device in the one or more second devices, the first device is switched from the master device mode to the slave device mode, the target second device is switched 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 that the target second device is ensured to accurately reestablish the bluetooth connection with the first device, and the target second device is switched to the master device mode after the bluetooth connection is disconnected through the mode switching, so as to avoid connection with other electronic devices in the master device mode, the accuracy of establishing Bluetooth connection between electronic equipment can be improved, the operation that the user needs to carry out is reduced, and the convenience is improved.
Referring to fig. 7, fig. 7 is a block diagram of another bluetooth connection apparatus according to an embodiment of the disclosure, where the bluetooth connection apparatus 700 is applicable to the second device. The bluetooth connection apparatus 700 includes a second receiving module 710, a second connecting module 720, a second switching module 730, and a second requesting module 740, wherein:
a second receiving module 710, configured to receive, when the second device is in the slave device mode, a first bluetooth connection request sent by the first device in the master device mode.
And a second connection module 720, configured to pair with the first device according to the first bluetooth connection request and establish a bluetooth connection.
And a second switching module 730, configured to switch from the slave device mode to the master device mode after disconnecting the bluetooth connection with the first device.
The second request module 740 is configured 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.
In one embodiment, the bluetooth connection apparatus 700 further includes a second saving module in addition to the second receiving module 710, the second connecting module 720, the second switching module 730, and the second requesting module 740, wherein:
and the second storage module is used for storing second pairing information corresponding to the first equipment.
The second requesting 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.
In an embodiment, the second switching module 730 is further configured to, after the bluetooth connection is disconnected from the first device, acquire the number of devices currently in the master device mode from the central control device, where the central control device refers to a device capable of acquiring the current modes of all bluetooth devices, and the bluetooth devices include the first device and the second device, and if the number of devices currently in the master device mode is greater than the number threshold, switch from the slave device mode to the master device mode.
In the embodiment of the present application, as an optional implementation manner, the disconnecting of the bluetooth connection from the first device is active disconnection, where the active disconnection includes disconnecting the bluetooth connection from the first device after detecting a disconnection instruction; or, the disconnection of the bluetooth connection from the first device is a passive type disconnection, the passive type disconnection including disconnection of the bluetooth connection from the first device when the signal strength with the first device is lower than a connection threshold.
In one embodiment, the second requesting module 740 is further configured to, if the bluetooth connection with the first device is active disconnection, send a second bluetooth connection request to the first device switched to the slave device mode when the sending request operation is detected; if the disconnection of the bluetooth connection from the first device is a passive type disconnection, a second bluetooth connection request is sent to the first device switched to the slave device mode upon detecting that the signal strength with the first device switched to the slave device mode is higher than a connection threshold.
In this embodiment of the application, the second device in the slave device mode may receive the first bluetooth connection request sent by the first device in the master device mode, pair with the first device according to the first bluetooth connection request and establish a bluetooth connection, and after the bluetooth connection is disconnected with the first device, the second device switches from the slave device mode to the master device mode to avoid establishing a bluetooth connection with other first devices in the master device mode, so as to improve the accuracy of establishing a bluetooth connection between the electronic devices And the Bluetooth connection between the second equipment and other first equipment in the master equipment mode is disconnected, and the convenience is improved.
Referring to fig. 8, a block diagram of an electronic device disclosed in the embodiment of the present application may include:
a memory 810 storing executable program code;
a processor 820 coupled to the memory 810;
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 embodiments described above.
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, code, sets of codes, or sets of instructions. The memory 810 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like. The storage data area may also store data created by the electronic device in use, and the like.
Processor 820 may include one or more processing cores. The processor 820 interfaces with various interfaces and circuitry throughout the electronic device to perform various functions of the electronic device and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 810, as well as invoking data stored in the memory 810. Alternatively, the processor 820 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 820 may integrate one or a combination of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is to be appreciated that the modem can be implemented solely via a communication chip without being integrated into the processor 820.
It is understood that the electronic device may include more or less structural elements than those shown in the above structural block diagrams, for example, a power module, a physical button, a WiFi (Wireless Fidelity) module, a speaker, a bluetooth module, a sensor, etc., and is not limited herein.
In one embodiment, there is provided an electronic device comprising:
a memory storing executable program code;
a processor coupled to the memory;
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.
The embodiment of the application discloses a computer-readable storage medium, which stores a computer program, wherein the computer program enables a computer to execute the bluetooth connection method applied to the first device provided in the above embodiments.
In one embodiment, a computer-readable storage medium is provided, which stores a computer program, wherein the computer program causes a computer to execute the bluetooth connection method applied to the second device provided in the above embodiments.
In addition, the present application further discloses a computer program product, which when running on a computer, enables the computer to execute all or part of the steps of the bluetooth connection method applied to the first device described in the above embodiments.
In one embodiment, a computer program product is provided, which when run on a computer, enables the computer to perform all or part of the steps of a bluetooth connection method applied to a second device as described in the above embodiments.
It will be understood by those skilled in the art that all or part of the steps in the methods of the embodiments described above may be implemented by hardware instructions of a program, and the program may be stored in a computer-readable storage medium, where the storage medium includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM), or other Memory, such as a magnetic disk, or a combination thereof, A tape memory, or any other medium readable by a computer that can be used to carry or store data.
The foregoing describes in detail a bluetooth connection method disclosed in an embodiment of the present application, and a specific example is applied to explain the principle and the implementation of the present application, and the description of the foregoing embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A Bluetooth connection method applied to a first device, the method comprising:
under the condition that the first device is in a master device mode, respectively sending first Bluetooth connection requests to one or more second devices in a slave device mode, wherein the first Bluetooth connection requests are used for requesting Bluetooth pairing connection with the second devices;
pairing the one or more second devices and establishing Bluetooth connection respectively;
switching from the master device mode to the slave device mode after disconnecting Bluetooth from a target second device of the one or more second devices;
and receiving a second Bluetooth connection request sent by the target second equipment switched to the master equipment mode, and establishing Bluetooth connection with the target second equipment according to the second Bluetooth connection request.
2. The method of claim 1, wherein before the first bluetooth connection request is respectively sent to one or more second devices in a slave device mode while the first device is in a master device mode, the method further comprises:
under the condition that the first equipment is in a slave equipment mode, if a first mode switching operation is detected, responding to the first mode switching operation, and switching the first equipment from the slave equipment mode to a master equipment mode.
3. A Bluetooth connection method, applied to a second device, the method comprising:
under the condition that the second device is in the slave device mode, receiving a first Bluetooth connection request sent by a first device in a master device mode;
pairing the first equipment according to the first Bluetooth connection request and establishing Bluetooth connection;
switching from the slave device mode to the master device mode after disconnecting the Bluetooth connection with the first device;
sending a second Bluetooth connection request to the first device switched to the slave device mode, the second Bluetooth connection request being for requesting Bluetooth connection with the first device.
4. The method of claim 3, wherein after the pairing with the first device and establishing a Bluetooth connection according to the first Bluetooth connection request, the method further comprises:
saving second pairing information corresponding to the first device;
said sending a second Bluetooth connection request to said first device in said slave mode, comprising:
and sending a second Bluetooth connection request to the first equipment switched to the slave equipment mode according to the second pairing information.
5. The method of claim 3, wherein switching from the slave device mode to the master device mode after disconnecting the Bluetooth connection from the first device comprises:
after the Bluetooth connection with the first device is disconnected, acquiring the number of devices currently in a master device mode from a central control device, wherein the central control device is used for acquiring the current mode of each Bluetooth device in communication connection with the central control device, and the Bluetooth devices at least comprise the first device and the second device;
and if the number of the devices is larger than a number threshold, switching from the slave device mode to the master device mode.
6. The method of claim 4, wherein sending the second Bluetooth connection request to the first device switching to the slave mode comprises:
if the Bluetooth connection with the first equipment is active disconnection, when the Bluetooth connection operation is detected, sending a second Bluetooth connection request to the first equipment switched to the slave equipment mode, wherein the active disconnection comprises the Bluetooth connection with the first equipment after a disconnection instruction is detected; or the like, or, alternatively,
if the Bluetooth connection with the first device is a passive disconnection, sending a second Bluetooth connection request to the first device switched to the slave device mode when detecting that the signal strength between the first device and the slave device mode is higher than a connection threshold, wherein the passive disconnection comprises the Bluetooth connection with the first device when the signal strength between the first device and the passive device is lower than the connection threshold.
7. An apparatus for bluetooth connection, applied to a first device, the apparatus comprising:
the first request module is used for respectively sending first Bluetooth connection requests to one or more second devices in a slave device mode under the condition that the first device is in a master device mode, wherein the first Bluetooth connection requests are used for requesting Bluetooth pairing connection with the second devices;
the first connection module is used for respectively pairing with the one or more second devices and establishing Bluetooth connection;
a first switching module for switching from the master device mode to the slave device mode after disconnecting a Bluetooth connection with a target second device of the one or more second devices;
the first receiving module is configured to receive a second bluetooth connection request sent by the target second device switched to the master device mode, and establish bluetooth connection with the target second device according to the second bluetooth connection request.
8. An apparatus for bluetooth connection, applied to a second device, the apparatus comprising:
a second receiving module, configured to receive, when the second device is in the slave device mode, a first bluetooth connection request sent by a first device in a master device mode;
the second connection module is used for pairing with the first equipment according to the first Bluetooth connection request and establishing Bluetooth connection;
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;
a second sending module, configured 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, comprising:
a memory storing executable program code;
a processor coupled with the memory;
the processor calls the executable program code stored in the memory to perform the method of any 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 the computer program, when executed by a processor, causes the processor to perform the method of any of claims 1 to 2 or 3 to 6.
CN202210052032.0A 2022-01-17 2022-01-17 Bluetooth connection method and device, electronic equipment and storage medium Pending CN114374959A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210052032.0A CN114374959A (en) 2022-01-17 2022-01-17 Bluetooth connection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210052032.0A CN114374959A (en) 2022-01-17 2022-01-17 Bluetooth connection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114374959A true CN114374959A (en) 2022-04-19

Family

ID=81187757

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210052032.0A Pending CN114374959A (en) 2022-01-17 2022-01-17 Bluetooth connection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114374959A (en)

Similar Documents

Publication Publication Date Title
US20210243831A1 (en) Method for establishing classic bluetooth connection between dual-mode bluetooth devices, and dual-mode bluetooth device
EP3537734B1 (en) Method and device for connecting a bluetooth device
CN108965306B (en) Call processing method and mobile terminal
US11224027B2 (en) Cell registration method and device
CN107770759B (en) Bluetooth voice link establishing method and device, storage medium and mobile terminal
US8897825B2 (en) Wireless communication device and wireless communication method
US11109281B2 (en) Methods and devices for reducing temperature for user equipment
CN109819489B (en) Terminal calling method and terminal
CN110933704B (en) Network communication method, device, storage medium and electronic equipment
CN115190197B (en) Bluetooth headset-based communication method and device and storage medium
WO2019011324A1 (en) Method for determining access method of mobile terminal, storage medium, and mobile terminal
CN111131951A (en) Wireless earphone positioning method, wireless earphone, electronic equipment and storage medium
CN110475312B (en) Access control method, message broadcasting method and related equipment
EP4021026B1 (en) Notification message control method and related apparatus
KR20210049585A (en) Electronic device for providing communication service and method thereof
WO2019154183A1 (en) Method for registration to network, and mobile terminal
EP3499857B1 (en) Audio data processing method, terminal device, and storage medium
US11678391B2 (en) Communication methods and electronic devices
CN114374959A (en) Bluetooth connection method and device, electronic equipment and storage medium
KR102596801B1 (en) PC5 link establishment methods, equipment and systems
CN111356183B (en) Transmission method, network equipment and terminal
CN113852962A (en) Network connection control method, device, storage medium and software program product
CN112291722A (en) Call waiting state setting method, device, terminal and storage medium
WO2018103442A1 (en) Information processing method and terminal device
CN111654578B (en) Mobile terminal sensor restoration method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination