WO2023071993A1 - 蓝牙配对方法、设备、***和存储介质 - Google Patents
蓝牙配对方法、设备、***和存储介质 Download PDFInfo
- Publication number
- WO2023071993A1 WO2023071993A1 PCT/CN2022/127076 CN2022127076W WO2023071993A1 WO 2023071993 A1 WO2023071993 A1 WO 2023071993A1 CN 2022127076 W CN2022127076 W CN 2022127076W WO 2023071993 A1 WO2023071993 A1 WO 2023071993A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- bluetooth
- electronic device
- information
- pairing
- bluetooth device
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
Definitions
- the embodiment of the present application relates to the technical field of communication, and in particular to a Bluetooth pairing method, device, system and storage medium.
- Bluetooth (Bluetooth) technology is a short-distance wireless communication technology, which is widely used in communication devices, such as smart phones, Bluetooth headsets, and the like.
- the Bluetooth headset Before the first Bluetooth communication between the Bluetooth headset and the smartphone, it needs to be paired. After pairing, normal calls, audio and other services can be performed. When the Bluetooth headset is paired, it needs to be in the pairing mode, scan and reply the query request sent by the smart phone, so that the smart phone can find the Bluetooth headset.
- Embodiments of the present application provide a Bluetooth pairing method, device, system, and storage medium, which realize successful pairing between an electronic device and a Bluetooth device that is not used for the first time.
- a Bluetooth pairing method is provided, which is applied to a communication system, the communication system includes a first electronic device, a second electronic device and a Bluetooth device, the second electronic device and the Bluetooth device have been paired, and the first electronic device and the Bluetooth device Not paired.
- the Bluetooth pairing method includes: the second electronic device establishes a Bluetooth connection with the Bluetooth device; the second electronic device sends notification information to the Bluetooth device, and the notification information is used to instruct the Bluetooth device to enter the pairing mode; the Bluetooth device enters the pairing mode according to the notification information; the first electronic The device obtains pairing information from the second electronic device or the Bluetooth device or the third electronic device, and the pairing information includes the Bluetooth address of the Bluetooth device; the first electronic device sends a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device.
- the second electronic device can control the Bluetooth device to enter the pairing mode, which avoids the need for the user to operate the Bluetooth device. Trigger the Bluetooth device to enter the pairing mode, eliminating the inconvenience for the user to operate the Bluetooth device.
- the first electronic device can obtain the Bluetooth address of the Bluetooth device without sending a query request to the Bluetooth device, which simplifies the message flow of the pairing process and improves the possibility of completing the pairing process between a Bluetooth device that is not used for the first time and an electronic device that has not been paired. Realization and efficiency have improved the user experience.
- the sending the notification information to the Bluetooth device by the second electronic device includes: the second electronic device receives a first operation of the user; and the second electronic device sends the notification information to the Bluetooth device in response to the first operation.
- the user's operation triggers the second electronic device to send notification information to the Bluetooth device, which improves operational flexibility.
- the second electronic device sends notification information to the Bluetooth device, including: the second electronic device sends an L2CAP_ECHO_REQ message to the Bluetooth device, where the L2CAP_ECHO_REQ message includes notification information; and the Bluetooth device sends an L2CAP_ECHO_RSP message to the second electronic device.
- the second electronic device sends notification information to the Bluetooth device through the echo request, confirms that the Bluetooth device successfully receives the notification information through the echo response, and improves the success rate of the second electronic device sending notification information.
- the first electronic device acquires the pairing information from the second electronic device, including: the second electronic device generates two-dimensional code information according to the pairing information, and displays the two-dimensional code information; the first electronic device scans the two-dimensional Code information, and parse the QR code information to obtain pairing information.
- the first electronic device does not need to communicate with the second electronic device, and can obtain pairing information in a visualized form by scanning or taking pictures, and then obtain the pairing information.
- the first electronic device obtains the pairing information from the second electronic device, involving a small number of devices, few processing steps, and a simple implementation.
- the method before the second electronic device generates the two-dimensional code information according to the pairing information, the method further includes: the second electronic device receives a second operation of the user.
- the user's operation triggers the second electronic device to generate two-dimensional code information according to the pairing information, which improves the flexibility of operation.
- the acquiring the pairing information from the second electronic device by the first electronic device includes: establishing a communication connection between the second electronic device and the first electronic device; and sending the pairing information to the Bluetooth device by the second electronic device through the communication connection; The first electronic device receives pairing information.
- the second electronic device provides pairing information to the first electronic device through a communication connection with the first electronic device, and the number of devices involved is small, and the implementation manner is simple.
- the method before establishing the communication connection between the second electronic device and the first electronic device, the method further includes: receiving a third operation of the user.
- the communication connection includes any one of the following: a Bluetooth connection, a WiFi connection, or a cellular communication connection.
- the first electronic device acquires pairing information from the Bluetooth device, including: after the Bluetooth device enters the pairing mode according to the notification information, generates two-dimensional code information according to the pairing information, and displays the two-dimensional code information; the first electronic device The device scans the QR code information, and parses the QR code information to obtain pairing information.
- the first electronic device does not need to communicate with the Bluetooth device, and can obtain pairing information in visual form from the Bluetooth device by scanning or taking pictures, and then obtain the pairing information, which improves the efficiency of the first electronic device to obtain pairing information.
- the implementation methods are more diverse.
- the third electronic device communicates with the Bluetooth device, and the first electronic device acquires pairing information from the third electronic device, including: after the Bluetooth device enters the pairing mode according to the notification information, generates two-dimensional code information according to the pairing information ;
- the Bluetooth device sends two-dimensional code information to the third electronic device;
- the third electronic device displays the two-dimensional code information after receiving the two-dimensional code information;
- the first electronic device scans the two-dimensional code information, and analyzes the two-dimensional code information to obtain pairing information .
- the Bluetooth device provides pairing information to the third electronic device.
- the first electronic device does not need to communicate with the third electronic device, and can obtain pairing information in a visualized form by scanning or taking pictures, and then obtain pairing information, which improves the security of the first electronic device to obtain pairing information, and the implementation methods are more diverse sex.
- the pairing information further includes capability information of the Bluetooth device.
- a Bluetooth pairing method is provided, which is applied to a second electronic device.
- the second electronic device has been paired with the Bluetooth device.
- the Bluetooth pairing method includes: establishing a Bluetooth connection with the Bluetooth device; sending notification information to the Bluetooth device, and the notification information Used to instruct a Bluetooth device to enter pairing mode.
- sending the notification information to the Bluetooth device includes: receiving a first operation of the user; and sending the notification information to the Bluetooth device in response to the first operation.
- sending notification information to the Bluetooth device includes: sending an L2CAP_ECHO_REQ message to the Bluetooth device, where the L2CAP_ECHO_REQ message includes notification information; and receiving an L2CAP_ECHO_RSP message sent by the Bluetooth device.
- the method further includes: generating two-dimensional code information according to the pairing information, where the pairing information includes the Bluetooth address of the Bluetooth device; and displaying the two-dimensional code information.
- the method before generating the two-dimensional code information according to the pairing information, the method further includes: receiving a second user operation.
- the method further includes: establishing a communication connection with the first electronic device, and the first electronic device is not paired with the Bluetooth device; sending pairing information to the Bluetooth device through the communication connection, and the pairing information includes the Bluetooth address of the Bluetooth device.
- the method before establishing a communication connection with the first electronic device, the method further includes: receiving a third operation of the user.
- the communication connection includes any one of the following: a Bluetooth connection, a WiFi connection, or a cellular communication connection.
- sending the pairing information to the Bluetooth device through the communication connection includes: generating shared information according to the pairing information; and sending the shared information to the Bluetooth device through the communication connection.
- the pairing information further includes capability information of the Bluetooth device.
- a Bluetooth pairing method is provided, which is applied to a Bluetooth device.
- the Bluetooth device is not paired with the first electronic device, and the Bluetooth device is paired with the second electronic device.
- the Bluetooth pairing method includes: establishing a Bluetooth connection with the second electronic device ; Receive notification information sent by the second electronic device, the notification information is used to instruct the Bluetooth device to enter the pairing mode; enter the pairing mode according to the notification information; receive a pairing request sent by the first electronic device.
- receiving the notification information sent by the second electronic device includes: receiving an L2CAP_ECHO_REQ message sent by the second electronic device, where the L2CAP_ECHO_REQ message includes the notification information; and sending an L2CAP_ECHO_RSP message to the second electronic device.
- the method further includes: generating two-dimensional code information according to the pairing information, where the pairing information includes the Bluetooth address of the Bluetooth device; and sending the two-dimensional code information to the third electronic device.
- the method further includes: generating two-dimensional code information according to the pairing information, where the pairing information includes the Bluetooth address of the Bluetooth device; and displaying the two-dimensional code information.
- the pairing information further includes capability information of the Bluetooth device.
- a Bluetooth pairing method is provided, which is applied to a first electronic device.
- the first electronic device is not paired with the Bluetooth device, and the Bluetooth device is paired with the second electronic device.
- the Bluetooth pairing method includes: from the second electronic device or The Bluetooth device or the third electronic device acquires pairing information, and the pairing information includes the Bluetooth address of the Bluetooth device; the third electronic device communicates with the Bluetooth device; and sends a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device.
- the pairing information further includes capability information of the Bluetooth device.
- obtaining the pairing information from the second electronic device includes: scanning the two-dimensional code information displayed by the second electronic device, the two-dimensional code information is generated by the second electronic device according to the pairing information; parsing the two-dimensional code information to obtain pairing information.
- obtaining the pairing information from the second electronic device includes: establishing a communication connection with the second electronic device; and obtaining the pairing information from the second electronic device through the communication connection.
- obtaining pairing information from the second electronic device through a communication connection includes: receiving shared information sent by the second electronic device; the shared information is generated by the second electronic device according to the pairing information; parsing the shared information to obtain pairing information.
- the communication connection includes any one of the following: a Bluetooth connection, a WiFi connection, or a cellular communication connection.
- obtaining the pairing information from the Bluetooth device or the third electronic device includes: scanning the two-dimensional code information displayed by the Bluetooth device or the third electronic device, where the two-dimensional code information is generated by the Bluetooth device according to the pairing information; Analyze the QR code information to obtain pairing information.
- an electronic device which is applied to a third electronic device, and the third electronic device communicates with a Bluetooth device.
- the Bluetooth pairing method includes: receiving two-dimensional code information sent by the Bluetooth device, and the two-dimensional code information is used by the Bluetooth device according to The pairing information is generated, and the pairing information includes the Bluetooth address of the Bluetooth device; display the QR code information.
- the pairing information further includes capability information of the Bluetooth device.
- an electronic device As the second electronic device, the second electronic device has been paired with the Bluetooth device, and the second electronic device includes: a processing module, configured to establish a Bluetooth connection with the Bluetooth device; a sending module, configured to Notification information is sent to the Bluetooth device, and the notification information is used to instruct the Bluetooth device to enter a pairing mode.
- the processing module is further configured to: receive a first operation of the user; and the sending module is further configured to send notification information to the Bluetooth device in response to the first operation.
- it also includes a receiving module; a sending module, configured to send an L2CAP_ECHO_REQ message to the Bluetooth device, where the L2CAP_ECHO_REQ message includes notification information; and a receiving module, configured to receive an L2CAP_ECHO_RSP message sent by the Bluetooth device.
- the processing module is further configured to: generate two-dimensional code information according to the pairing information, where the pairing information includes the Bluetooth address of the Bluetooth device; and display the two-dimensional code information.
- the processing module is further configured to: before generating the two-dimensional code information according to the pairing information, receive a second user operation.
- the processing module is also used to: establish a communication connection with the first electronic device, and the first electronic device is not paired with the Bluetooth device; the sending module is also used to send pairing information to the Bluetooth device through the communication connection, and the pairing The information includes the Bluetooth address of the Bluetooth device.
- the processing module is further configured to: before establishing a communication connection with the first electronic device, receive a third operation of the user.
- the communication connection includes any one of the following: a Bluetooth connection, a WiFi connection, or a cellular communication connection.
- the processing module is further configured to generate shared information according to the pairing information; the sending module is configured to send the shared information to the Bluetooth device through a communication connection.
- the pairing information further includes capability information of the Bluetooth device.
- a Bluetooth device is provided.
- the Bluetooth device is not paired with the first electronic device, and the Bluetooth device is paired with the second electronic device.
- the Bluetooth device includes: a processing module, configured to establish a Bluetooth connection with the second electronic device; receiving The module is configured to receive the notification information sent by the second electronic device, the notification information is used to instruct the Bluetooth device to enter the pairing mode; the processing module is also used to enter the pairing mode according to the notification information; the receiving module is also used to receive the notification information sent by the first electronic device. pairing request.
- it further includes a sending module; a receiving module, configured to receive the L2CAP_ECHO_REQ message sent by the second electronic device, where the L2CAP_ECHO_REQ message includes notification information; and a sending module, configured to send the L2CAP_ECHO_RSP message to the second electronic device.
- it also includes a sending module; a processing module is also used to generate two-dimensional code information according to the pairing information after entering the pairing mode according to the notification information, and the pairing information includes the Bluetooth address of the Bluetooth device; the sending module uses to send the two-dimensional code information to the third electronic device.
- the processing module is further configured to: after entering the pairing mode according to the notification information, generate two-dimensional code information according to the pairing information, where the pairing information includes the Bluetooth address of the Bluetooth device; and display the two-dimensional code information.
- the pairing information further includes capability information of the Bluetooth device.
- an electronic device As the first electronic device, the first electronic device is not paired with the Bluetooth device, and the Bluetooth device is paired with the second electronic device.
- the first electronic device includes: a processing module configured to obtain The second electronic device or the Bluetooth device or the third electronic device acquires pairing information, and the pairing information includes the Bluetooth address of the Bluetooth device; the third electronic device communicates with the Bluetooth device; the sending module is used to send a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device .
- the pairing information further includes capability information of the Bluetooth device.
- the processing module is specifically configured to: scan the two-dimensional code information displayed by the second electronic device, the two-dimensional code information is generated by the second electronic device according to the pairing information; analyze the two-dimensional code information to obtain the pairing information .
- the processing module is configured to: establish a communication connection with the second electronic device; obtain pairing information from the second electronic device through the communication connection.
- the receiving module is configured to receive the shared information sent by the second electronic device; the shared information is generated by the second electronic device according to the pairing information; the processing module is configured to parse the shared information, Get pairing information.
- the communication connection includes any one of the following: a Bluetooth connection, a WiFi connection, or a cellular communication connection.
- the processing module is configured to: scan the two-dimensional code information displayed by the Bluetooth device or the third electronic device, the two-dimensional code information is generated by the Bluetooth device according to the pairing information; analyze the two-dimensional code information to obtain the pairing information .
- an electronic device As the third electronic device, the third electronic device communicates with the Bluetooth device, and the third electronic device includes: a receiving module for receiving the two-dimensional code information sent by the Bluetooth device, the two-dimensional code The information is generated by the Bluetooth device according to the pairing information, and the pairing information includes the Bluetooth address of the Bluetooth device; the processing module is used to display the two-dimensional code information.
- the pairing information further includes capability information of the Bluetooth device.
- an electronic device As a second electronic device, the electronic device includes a processor, and the processor is configured to be coupled with a memory, read instructions in the memory, and make the electronic device execute the method provided in the second aspect according to the instructions.
- a Bluetooth device includes a processor, and the processor is configured to be coupled with a memory, read instructions in the memory, and make the Bluetooth device execute the method provided in the third aspect according to the instructions.
- an electronic device is provided.
- the electronic device includes a processor, and the processor is used to be coupled with the memory, and read instructions in the memory and make the electronic device execute the method provided in the fourth aspect according to the instructions .
- an electronic device is provided.
- the electronic device includes a processor, and the processor is used to be coupled with the memory, and read instructions in the memory and make the electronic device execute the method provided in the fifth aspect according to the instructions .
- a fourteenth aspect provides a communication system, and the communication system includes the second electronic device provided in the tenth aspect, the bluetooth device provided in the eleventh aspect, and the first electronic device provided in the twelfth aspect.
- the communication system further includes the third electronic device provided in the thirteenth aspect.
- a fifteenth aspect provides a program, which is used to execute the method provided in the first aspect, the second aspect, the third aspect, the fourth aspect or the fifth aspect when executed by a processor.
- a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium. When the instructions are run on a computer or a processor, the first aspect, the second aspect, the third aspect, and the fourth aspect are realized. Aspect or the method provided by the fifth aspect.
- a program product includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of the device can read the computer program from the readable storage medium. program, the at least one processor executes the computer program so that the device implements the method provided in the first aspect, the second aspect, the third aspect, the fourth aspect or the fifth aspect.
- FIG. 1 is a schematic diagram of a scenario of Bluetooth communication
- FIG. 2 is a message interaction diagram between the Bluetooth device and the electronic device in the pairing process in FIG. 1;
- 3A-3B are schematic diagrams of the user operating the Bluetooth device to enter the pairing mode
- 4A to 4C are schematic diagrams of a set of interfaces after the Bluetooth function is enabled on the electronic device
- FIG. 5 is a schematic diagram of a scene of Bluetooth communication applicable to the embodiment of the present application.
- FIG. 6 is a message interaction diagram of the Bluetooth pairing method provided by the embodiment of the present application.
- FIGS. 7A to 7F are schematic diagrams of a group of interfaces of the second electronic device
- 8A to 8F are schematic diagrams of another set of interfaces of the second electronic device.
- FIG. 9 is a message interaction diagram for sending notification information by the second electronic device provided in the embodiment of the present application.
- FIG. 10A is a schematic diagram of the format of the data packet corresponding to the L2CAP_ECHO_REQ message provided by the embodiment of the present application;
- FIG. 10B is a schematic diagram of the format of the data packet corresponding to the L2CAP_ECHO_RSP message provided by the embodiment of the present application;
- FIG. 11 is a message interaction diagram for obtaining configuration information by the first electronic device provided in the embodiment of the present application.
- FIG. 12 is another message interaction diagram of the Bluetooth pairing method provided by the embodiment of the present application.
- FIG. 13 is another message interaction diagram for obtaining configuration information by the first electronic device provided in the embodiment of the present application.
- FIG. 14 is another message interaction diagram of the Bluetooth pairing method provided by the embodiment of the present application.
- FIG. 15 is another message interaction diagram for obtaining configuration information by the first electronic device provided in the embodiment of the present application.
- FIG. 16 is another message interaction diagram of the Bluetooth pairing method provided by the embodiment of the present application.
- FIG. 17 is another message interaction diagram for obtaining configuration information by the first electronic device provided in the embodiment of the present application.
- FIG. 18 is a schematic structural diagram of a device provided by an embodiment of the present application.
- Fig. 19 is another schematic structural diagram of the device provided by the embodiment of the present application.
- Fig. 20 is another schematic structural diagram of the device provided by the embodiment of the present application.
- the Bluetooth pairing method provided in the embodiment of the present application is applicable to a pairing process between devices in Bluetooth communication. First, the pairing process is introduced.
- Bluetooth communication before two devices conduct Bluetooth communication for the first time, they need to go through a pairing process first. After the pairing of the two devices is completed, information such as the Bluetooth device address (BD_ADDR) and key are stored in the device, so that Bluetooth communication can be performed. Subsequently, if the Bluetooth address, key and other information stored in the two devices are not cleared, when the Bluetooth communication is performed again, the two devices can send a Bluetooth connection request according to the Bluetooth address, and there is no need to perform the pairing process again.
- BD_ADDR Bluetooth device address
- key key and other information stored in the two devices are not cleared, when the Bluetooth communication is performed again, the two devices can send a Bluetooth connection request according to the Bluetooth address, and there is no need to perform the pairing process again.
- FIG. 1 is a schematic diagram of a scenario of Bluetooth communication. As shown in FIG. 1 , both the electronic device 100 and the Bluetooth device 200 support the Bluetooth function, and the electronic device 100 and the Bluetooth device 200 can perform Bluetooth communication.
- the types and names of the electronic device 100 and the Bluetooth device 200 are not limited.
- examples of some electronic devices are: mobile phones, tablet computers, notebook computers, handheld computers, wearable devices, smart screens, teaching equipment, Internet of Things (internet of things, IOT) devices, or smart home (smart home) wireless terminals, etc.
- the electronic device 100 has a display screen.
- Examples of some bluetooth devices are: bluetooth earphones, bluetooth speakers, bluetooth stylus and so on.
- the embodiment of the present application takes the electronic device 100 as a mobile phone and the Bluetooth device 200 as a Bluetooth headset as an example for description.
- the pairing process may include a device discovery phase and a pairing phase.
- the electronic device can discover a Bluetooth device that can be paired, and exchange relevant information required in the pairing phase with the Bluetooth device, for example, the Bluetooth address of the Bluetooth device.
- the electronic device and the Bluetooth device can exchange information such as keys for subsequent Bluetooth communication.
- FIG. 2 is a diagram of message interaction between the Bluetooth device and the electronic device in FIG. 1 during the pairing process.
- the pairing process between devices in Bluetooth communication may include:
- the Bluetooth device enters a pairing mode in response to the user's operation on the Bluetooth device.
- the user needs to operate the Bluetooth device so that the Bluetooth device enters a pairing mode.
- the Bluetooth device When the Bluetooth device is in the pairing mode, it can search for an inquiry request (inquiry request) sent by the electronic device, and reply an inquiry response (inquiry response) to the electronic device, so that the electronic device can discover the Bluetooth device.
- the usage status of the Bluetooth device is different, the user may operate the Bluetooth device differently.
- the Bluetooth headset is first unpacked and used.
- the Bluetooth headset includes a case cover 201 and a case body 202 .
- the bluetooth headset has never been used out of the box after leaving the factory.
- the Bluetooth headset can be triggered to enter a pairing mode.
- the Bluetooth headset enters the pairing mode in response to the user's operation.
- the Bluetooth headset is not used for the first time.
- the Bluetooth headset has been used out of the box, and Bluetooth communication has been performed with at least one electronic device.
- the user can press the box body 202
- the physical button 203 on the keyboard triggers the Bluetooth headset to enter pairing mode.
- the Bluetooth headset enters the pairing mode in response to the operation of pressing the physical button 203 by the user.
- the embodiment of the present application does not limit the name of the pairing mode.
- the pairing mode may also be called a pairing state or an inquiry scan (inquiry scan) state.
- the electronic device sends an inquiry request (inquiry request).
- the Bluetooth devices in the pairing mode around the electronic device can scan the query request and receive the query request.
- the electronic device After the electronic device turns on the bluetooth function, it can enter an inquiry state and send an inquiry request to surrounding devices.
- the inquiry request can be scanned, and an inquiry response (inquiry response) can be returned to the electronic device, so that the electronic device can discover the Bluetooth device.
- the execution order of S21 and S22 is not limited.
- the user first triggers the Bluetooth headset to enter the pairing mode by pressing a physical button on the Bluetooth headset box, and then the electronic device turns on the Bluetooth function, that is, first executes S21 and then executes S22.
- the electronic device first turns on the bluetooth function, and then the user opens the box and uses the bluetooth earphone for the first time to trigger the bluetooth earphone to enter the pairing mode, that is, first execute S22 and then execute S21.
- the query request includes the bluetooth address of the electronic device, and the bluetooth address can refer to related content in the bluetooth protocol, which will not be repeated here.
- the electronic device may send the query request according to the first cycle.
- the Bluetooth device in the pairing mode may scan for query requests according to the second cycle.
- the first period and the second period may be the same or different.
- the Bluetooth device sends an inquiry response (inquiry response) to the electronic device.
- the electronic device receives the inquiry response sent by the Bluetooth device.
- the query response includes the Bluetooth address of the Bluetooth device.
- the Bluetooth device in the pairing mode scans the query request sent by the electronic device, it can return a query response to the electronic device according to the Bluetooth address of the electronic device in the query request, so that the electronic device can discover the Bluetooth device and continue to communicate with the electronic device.
- the device goes through the subsequent pairing process.
- the stage of discovering devices includes but not limited to S21-S23.
- the electronic device and the Bluetooth device can also obtain at least one of the following information through message interaction: the device name of the Bluetooth device, the device supported feature information of the electronic device, and the device information of the Bluetooth device. Support feature information.
- the device support feature information may also be referred to as capability information, and reference may be made to the content about device features in the Bluetooth protocol, which will not be repeated here.
- FIG. 4A shows a schematic interface of an electronic device in a device discovery stage.
- the bluetooth main interface 40 of the mobile phone includes a switch control 41 of the bluetooth function, a switch control 42 of open detection, a "device name” tab 43, a "received file” tab 44, and a paired device 45 and 46 devices available. It can be known from the "device name" tab 43 that the name of the mobile phone is "mobile phone 2".
- Paired devices 45 shows devices that have been successfully paired with phone 2 in history, eg, phone 1 .
- the available devices 46 display currently pairable devices discovered by the mobile phone 2, for example, Bluetooth headsets.
- the user can click on the Bluetooth headset in the available devices 46 to pair the mobile phone 2 with the Bluetooth headset.
- the mobile phone 2 starts the pairing stage in the pairing process in response to the user's operation.
- a prompt message may also be displayed before the mobile phone 2 and the Bluetooth headset are paired.
- the changes of the Bluetooth main interface 40 can be seen in FIG. 4B .
- the mobile phone 2 pops up a pairing window 47 in the Bluetooth main interface 40 .
- the user operates by viewing the prompt information in the pairing pop-up window 47 .
- the prompt information includes: "To pair with the following device: Bluetooth headset”.
- the pairing pop-up window 47 also includes a cancel button and a pairing button.
- the user can click the pairing button 48 to make the mobile phone 2 pair with the Bluetooth headset.
- the mobile phone 2 executes the message flow of the pairing phase, see S24 for details.
- the electronic device sends a pairing request (pairing request) to the Bluetooth device.
- the Bluetooth device receives the pairing request sent by the electronic device.
- the Bluetooth device sends a pairing response (pairing response) to the electronic device.
- the electronic device receives the pairing response sent by the Bluetooth device.
- the electronic device may send a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device, and the Bluetooth device may send a pairing response to the electronic device according to the Bluetooth address of the electronic device, and the pairing request and the pairing response are used to exchange configuration information, Configuration information is used to determine the pairing method and distribute keys.
- the configuration information may include the input and output capabilities of the electronic device.
- Different electronic devices have different types, different hardware configurations, and different input and output capabilities.
- the input/output capability may indicate at least one of the following: whether the electronic device can input, an input method when the electronic device can input, whether the electronic device can display, and so on.
- the input and output capabilities of the electronic device may include any of the following: no input and no output, only a display screen, a display screen with the option of "yes/no", a keyboard only, a keyboard and a display screen .
- the pairing stage includes but not limited to S24-S25.
- the pairing phase it is also necessary to determine the pairing algorithm of the electronic device and the Bluetooth device, establish an encrypted link, transmit a key, etc., and refer to the content about pairing authentication in the Bluetooth protocol, which will not be repeated here.
- FIG. 4C shows a schematic diagram of an interface of the electronic device after the electronic device and the Bluetooth device are paired.
- the paired devices 45 include the mobile phone 1 and the Bluetooth headset, indicating that the mobile phone 2 and the Bluetooth headset have been paired, and subsequent Bluetooth communication can be performed.
- call service includes but are not limited to: voice calls or video calls; audio services include but are not limited to: playing music, notification sounds, navigation sounds, alarm clocks, games, videos, etc.
- the Bluetooth device needs to be in a pairing mode, so that the Bluetooth device can scan the query request sent by the electronic device and reply with a query response.
- the electronic device discovers a Bluetooth device that can be paired, obtains the Bluetooth address of the Bluetooth device from the query response sent by the Bluetooth device, and then sends a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device to continue the pairing process.
- controlling the Bluetooth headset to enter the pairing mode requires the user to operate the Bluetooth headset.
- the Bluetooth device When the Bluetooth device is used for the first time, the user opens the box to trigger the Bluetooth headset to enter the pairing mode.
- the first use of the Bluetooth headset is only once. In most application scenarios, the Bluetooth device is in use. At this time, the user needs to manually operate the physical button on the Bluetooth headset box to allow the Bluetooth headset to enter the pairing mode.
- many users are not aware of this operation, resulting in the non-first-use Bluetooth headsets being unable to enter the pairing mode, unable to complete the pairing process with electronic devices, and therefore unable to perform subsequent Bluetooth communications and services, seriously affecting the use of Bluetooth headsets by users feel.
- the embodiment of the present application provides a Bluetooth pairing method.
- the third-party device can control the Bluetooth device to enter the pairing mode, avoiding that the user must operate the Bluetooth device to trigger
- the Bluetooth device enters the pairing mode, which eliminates the inconvenience for the user to operate the Bluetooth device.
- the electronic device can obtain the Bluetooth address of the Bluetooth device without sending a query request to the Bluetooth device, which simplifies the message flow of the pairing process and improves the feasibility of completing the pairing process between a Bluetooth device that is not used for the first time and an electronic device that has not been paired. And convenience, enhance the user experience.
- the electronic device that needs to be paired with the Bluetooth device is called the first electronic device, and the third-party device other than the first electronic device and the Bluetooth device is called the second electronic device.
- the history of the Bluetooth device and the second electronic device The pairing is successful and the data has not been cleared.
- FIG. 5 is a schematic diagram of a scene of Bluetooth communication applicable to the embodiment of the present application.
- the scene includes a Bluetooth device, a first electronic device, and a second electronic device.
- the Bluetooth device and the second electronic device can perform Bluetooth communication.
- the first electronic device and the second electronic device may or may not communicate.
- the communication between the first electronic device and the second electronic device includes but is not limited to at least one of the following: wired communication, Bluetooth communication, wireless fidelity (wireless fidelity, WiFi) communication, near field communication (near field communication, NFC) or cellular communication.
- the scene may further include a third electronic device.
- the bluetooth device can communicate with the third electronic device.
- the communication between the Bluetooth device and the third electronic device includes but is not limited to at least one of the following: wired communication, Bluetooth communication, WiFi communication or NFC communication.
- the first electronic device and the third electronic device may or may not communicate.
- the communication between the first electronic device and the third electronic device includes but is not limited to at least one of the following: wired communication, Bluetooth communication, WiFi communication, NFC communication or cellular communication.
- the third electronic device may also be a device for displaying related information of the Bluetooth device, for example, a display screen or a monitor.
- the embodiment of the present application does not limit the number of the first electronic device, the second electronic device, and the third electronic device.
- FIG. 6 is a message interaction diagram of the Bluetooth pairing method provided by the embodiment of the present application.
- the Bluetooth pairing method provided in this embodiment is applicable to the scenario shown in FIG. 5 , and the execution subject involves the Bluetooth device, the first electronic device, and the second electronic device.
- the execution subject may also involve a third electronic device.
- the Bluetooth device is a Bluetooth headset
- the first electronic device is a mobile phone 1
- the second electronic device is a mobile phone 2
- the third electronic device is a display 3 .
- the Bluetooth pairing method provided in this embodiment may include:
- the Bluetooth device establishes a Bluetooth connection with the second electronic device.
- the Bluetooth connection may include an asynchronous connection-oriented (ACL) connection.
- ACL asynchronous connection-oriented
- the ACL connection is a connection on the physical layer in the Bluetooth protocol, and reference may be made to related content in the Bluetooth protocol, so details will not be repeated here.
- the Bluetooth connection may also include at least one of the following: a synchronous connection-oriented connection (synchronous connection-oriented link, SCO) connection, an advanced audio distribution profile (A2DP) connection, or a hands-free profile ( hands-free profile, HFP) connection.
- a synchronous connection-oriented connection synchronous connection-oriented link, SCO
- A2DP advanced audio distribution profile
- HFP hands-free profile
- this embodiment does not limit the time for establishing the Bluetooth connection between the Bluetooth device and the second electronic device in the application scenario.
- no Bluetooth connection is currently established between the Bluetooth device and the second electronic device.
- the Bluetooth device needs to be paired with the first electronic device, the Bluetooth device establishes a Bluetooth connection with the second electronic device.
- the mobile phone 2 does not currently have the Bluetooth function turned on.
- the Bluetooth headset needs to be paired with the mobile phone 1, the user turns on the Bluetooth function of the mobile phone 2, and the mobile phone 2 can automatically establish a Bluetooth connection with the Bluetooth headset.
- the Bluetooth device when the Bluetooth device needs to be paired with the first electronic device, the Bluetooth device has established a Bluetooth connection with the second electronic device. For example, the user is listening to the music played on the mobile phone 2 through the Bluetooth headset. At this time, the Bluetooth headset needs to be paired with the mobile phone 1 .
- the second electronic device sends notification information to the Bluetooth device, where the notification information is used to instruct the Bluetooth device to enter a pairing mode.
- the Bluetooth device receives the notification information sent by the second electronic device.
- the second electronic device may be triggered to send notification information to the Bluetooth device.
- a user wants to pair a Bluetooth headset with a mobile phone 1 .
- the user usually knows the second electronic device in the environment, for example, the mobile phone 2 .
- mobile phone 1 and mobile phone 2 are mobile phones used by user 1; or, user 1 uses mobile phone 1, and user 1 knows that user 2 uses mobile phone 2.
- the Bluetooth function of the mobile phone 2 can be turned on, and the mobile phone 2 establishes a Bluetooth connection with the Bluetooth headset, and triggers the mobile phone 2 to send a notification message to the Bluetooth headset, indicating that the Bluetooth headset enters pairing mode.
- the user may perform a first operation on the second electronic device, thereby triggering the second electronic device to send notification information to the Bluetooth device.
- this embodiment does not limit the first operation performed by the user on the second electronic device.
- the user's first operation may be any of the following: a touch operation performed by the user on the relevant interface displayed by the second electronic device, a gesture operation performed by the user on the display screen of the second electronic device, An operation performed by a physical button on the second electronic device, a user inputs voice through a microphone of the second electronic device, or a user inputs an image through a camera of the second electronic device.
- the second electronic device may be installed with an application program (application, APP) for managing Bluetooth devices. This embodiment does not limit the name and function of the APP, and does not limit the content and layout of the relevant interface of the APP. .
- the mobile phone 2 is currently running a system application, and displays a Bluetooth main interface 70 in the system application. It can be known from the paired device 71 in the Bluetooth main interface 70 that currently, the mobile phone 2 has been connected to the mobile phone 1 and the Bluetooth earphone via Bluetooth. The user can click on the Bluetooth headset in the paired device 71 to trigger the mobile phone 2 to send notification information to the Bluetooth headset. Correspondingly, the mobile phone 2 sends notification information to the Bluetooth headset in response to the user's operation.
- the Bluetooth main interface 70 includes prompt information for guiding the user to perform the first operation. For example, in FIG. 7A , there is a prompt message "click the Bluetooth headset to enter pairing mode" below the Bluetooth headset.
- the second electronic device may display prompt information to the user.
- the user clicks on the Bluetooth headset in the paired device 71 to trigger the mobile phone 2 to send notification information to the Bluetooth headset.
- the mobile phone 2 pops up a pop-up window 72 in the Bluetooth main interface 70 in response to the user's operation.
- the user operates by viewing the prompt information in the pop-up window 72 .
- the prompt information includes: "The Bluetooth headset enters pairing mode”.
- the pop-up window 72 also includes a cancel button and a confirm button.
- the user can click the OK button 73 to trigger the mobile phone 2 to send notification information to the Bluetooth headset.
- the mobile phone 2 sends notification information to the Bluetooth headset in response to the user's operation of clicking the OK button 73, instructing the Bluetooth headset to enter the pairing mode.
- FIG. 8A shows another interface diagram of the mobile phone 2 .
- the difference between Fig. 8A and Fig. 7A is: in Fig. 7A, the mobile phone 2 runs the system application program, and displays the bluetooth main interface 70 in the system application program; while in Fig. 8A, the mobile phone 2 runs the third-party application program, and the third-party application program Other equipment for managing communication with the mobile phone 2.
- the embodiment of the present application does not limit the name, function and interface layout of the third-party application program.
- the mobile phone 2 currently displays the "My Devices" interface 80 in the third-party application program, and the devices communicating with the mobile phone 2 include: door lock 001, Bluetooth headset, home gateway 1 and mobile phone 1.
- the interface 80 includes prompt information for guiding the user to perform the first operation. For example, in FIG. 8A , there is a prompt message "click the right button, and the Bluetooth headset enters pairing mode" below the Bluetooth headset.
- FIGS. 7A to 7B and FIGS. 8A to 8B are only examples, and do not limit the relevant interface and the first operation of the user.
- the user can enter the setting interface of the Bluetooth headset through relevant operations, and perform the first operation in the setting interface to trigger the mobile phone 2 to send notification information to the Bluetooth headset.
- the notification information can be carried in the interactive message defined in the Bluetooth protocol, or in the private message defined between the second electronic device and the Bluetooth device.
- the name of the message and the notification information are included in the message The way of carrying is not limited.
- the second electronic device may send the notification information through an echo (echo or Echo or ECHO) channel of a logical link control and adaptation layer protocol (L2CAP).
- ECHO protocol can refer to the CORE Host (core host) chapter of the Bluetooth protocol, for example, Section 4.8 of PartA.
- FIG. 9 is a message interaction diagram for sending notification information by the second electronic device provided in the embodiment of the present application.
- the notification information sent by the second electronic device to the Bluetooth device may include:
- the second electronic device sends an L2CAP_ECHO_REQ (Logical Link Control and Adaptation Protocol Echo Request) message to the Bluetooth device, where the L2CAP_ECHO_REQ message includes notification information.
- the Bluetooth device receives the L2CAP_ECHO_REQ message sent by the second electronic device.
- the Bluetooth device sends an L2CAP_ECHO_RSP (Logical Link Control and Adaptation Protocol Echo Response) message to the second electronic device, where the L2CAP_ECHO_RSP message is used to indicate that the Bluetooth device has received the L2CAP_ECHO_REQ message.
- L2CAP_ECHO_RSP Logical Link Control and Adaptation Protocol Echo Response
- an echo request (Echo request or ECHO_REQ or L2CAP_ECHO_REQ) is usually used to request a response from a remote L2CAP entity, and the echo request can be used to test a link or transmit specific information using an optional data field.
- the L2CAP entity After the L2CAP entity receives a valid echo request packet, it responds with an echo response (Echo response or ECHO_RSP or L2CAP_ECHO_RSP) packet.
- the specific information is notification information.
- FIG. 10A is a schematic diagram of the format of the data packet corresponding to the L2CAP_ECHO_REQ message provided by the embodiment of the present application
- FIG. 10B is a schematic diagram of the format of the data packet corresponding to the L2CAP_ECHO_RSP message provided by the embodiment of the present application.
- the left side of the data packet (Packet) corresponding to the L2CAP_ECHO_REQ message is the least significant bit (least significant bit, LSB), and the right side is the most significant bit (most significant bit, MSB)
- the data packet includes: encoding ( Code) field, identifier (Identifier) field, length (Length) field and data (Data) field.
- the data field is an optional field.
- user-defined information can be carried in the optional data field.
- the notification information may be carried in the data field.
- the format of the data packet corresponding to the L2CAP_ECHO_RSP message shown in FIG. 10B is similar to the format of the data packet corresponding to the L2CAP_ECHO_REQ message shown in FIG. 10A , wherein the identifier field in the L2CAP_ECHO_RSP message matches the L2CAP_ECHO_REQ message, and the encoding field matches.
- the value of the identifier field in FIG. 10A and FIG. 10B is the same.
- the encoding field in FIG. 10A takes a value of 0x08
- the encoding field in FIG. 10B takes a value of 0x09.
- the Bluetooth device enters a pairing mode according to the notification information.
- the first electronic device acquires pairing information from the second electronic device or the Bluetooth device or the third electronic device, where the pairing information includes a Bluetooth address of the Bluetooth device.
- the second electronic device since the Bluetooth device and the second electronic device have been paired successfully, the second electronic device stores the Bluetooth address of the Bluetooth device, and the first electronic device can obtain the Bluetooth address of the Bluetooth device from the second electronic device. Bluetooth address.
- the second electronic device notifies the Bluetooth device to enter the pairing mode, and the second electronic device provides pairing information to the first electronic device, and the first electronic device and the Bluetooth device are paired only by means of the second electronic device,
- the number of devices involved is small, the processing steps are few, and the implementation method is simple.
- the first electronic device and the second electronic device may perform wired communication or wireless communication, and through the communication connection between the first electronic device and the second electronic device, the second electronic device sends pairing information to the first electronic device, Correspondingly, the first electronic device receives the pairing information sent by the second electronic device.
- the wireless communication includes but is not limited to any one of the following: Bluetooth communication, WiFi communication, NFC communication or cellular communication.
- the first electronic device and the second electronic device do not communicate, and the second electronic device displays the pairing information in a visualized form.
- Form pairing information is processed to obtain pairing information.
- the pairing information in a visualized form is generated according to the pairing information, for example, including but not limited to any one of the following: two-dimensional code or barcode.
- the third electronic device may obtain pairing information, and the first electronic device may obtain pairing information from the third electronic device.
- the third electronic device does not limit the manner in which the third electronic device acquires the pairing information.
- the Bluetooth device and the third electronic device can perform Bluetooth communication, and the third electronic device stores pairing information such as the Bluetooth address of the Bluetooth device.
- the Bluetooth device may send pairing information to the third electronic device.
- the Bluetooth device may send the pairing information to the third electronic device after receiving the notification information sent by the second electronic device.
- the second electronic device notifies the Bluetooth device to enter the pairing mode
- the third electronic device provides pairing information to the first electronic device
- the first electronic device and the Bluetooth device need to use the second electronic device and the second electronic device to pair Three electronic devices, flexible implementation.
- the first electronic device and the third electronic device may perform wired communication or wireless communication, and through the communication connection between the first electronic device and the third electronic device, the third electronic device sends pairing information to the first electronic device, Correspondingly, the first electronic device receives the pairing information sent by the third electronic device.
- the wireless communication includes but is not limited to any one of the following: Bluetooth communication, WiFi communication, NFC communication or cellular communication.
- the first electronic device and the third electronic device do not communicate, and the third electronic device displays the pairing information in a visualized form.
- the pairing information of the form is processed, and the pairing information can be obtained.
- the pairing information in a visualized form is generated according to the pairing information, for example, including but not limited to any one of the following: two-dimensional code or barcode.
- the third electronic device is an external display device of the Bluetooth device.
- the Bluetooth device After receiving the notification information sent by the second electronic device, the Bluetooth device enters the pairing mode, generates pairing information in a visualized form according to the pairing information, and sends the pairing information in a visualized form to the third electronic device.
- the third electronic device receives and displays the pairing information in visual form sent by the Bluetooth device.
- the first electronic device may acquire pairing information from the Bluetooth device.
- the bluetooth device may have a display screen, and after receiving the notification information sent by the second electronic device and entering the pairing mode, the bluetooth device may generate and display pairing information in a visual form according to the pairing information.
- the first electronic device can obtain the pairing information by scanning the pairing information in the visualized form or taking a picture of the pairing information in the visualized form and processing the pairing information in the visualized form.
- the pairing information in a visual form includes but is not limited to any one of the following: two-dimensional code or barcode.
- the Bluetooth device is notified by the second electronic device to enter the pairing mode, and the Bluetooth device provides pairing information to the first electronic device, and the pairing between the first electronic device and the Bluetooth device only relies on the second electronic device, and the number of devices involved Less, simple implementation.
- this embodiment does not limit the execution sequence between S62-S63 and S64.
- S62 is executed first, and the second electronic device notifies the Bluetooth device to enter the pairing mode, and then S64 is executed, and the first electronic device can obtain pairing information.
- S64 is executed first, and the first electronic device may acquire pairing information, and then S62 is executed, and the second electronic device notifies the Bluetooth device to enter the pairing mode.
- S62 and S64 may be executed simultaneously.
- the first electronic device sends a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device.
- the Bluetooth device receives the pairing request sent by the first electronic device.
- the Bluetooth device sends a pairing response to the first electronic device.
- the first electronic device receives the pairing response sent by the Bluetooth device.
- the application environment of the Bluetooth pairing method provided in this embodiment includes a Bluetooth device, a second electronic device that has been successfully paired with the Bluetooth device, and a first electronic device that needs to be paired with the Bluetooth device.
- the Bluetooth device After the Bluetooth device establishes a Bluetooth connection with the second electronic device, the second electronic device sends notification information to the Bluetooth device, instructing the Bluetooth device to enter a pairing mode.
- the first electronic device can obtain pairing information from the second electronic device or the Bluetooth device or other devices in the application environment, so that the first electronic device and the Bluetooth device can complete pairing according to the pairing information.
- the Bluetooth pairing method provided in this embodiment notifies the Bluetooth device to enter the pairing mode by means of the second electronic device except the first electronic device and the Bluetooth device, which avoids that the user must operate the Bluetooth device to trigger the Bluetooth device to enter the pairing mode, Eliminates the inconvenience for the user to operate the Bluetooth device.
- the first electronic device can obtain the Bluetooth address of the Bluetooth device without sending a query request to the Bluetooth device when the Bluetooth device is in the pairing mode, which simplifies the message flow of the pairing process and improves the The realization and convenience of completing the pairing process between the Bluetooth device that is not used for the first time and the first electronic device that has not been paired improves the user's experience of using the Bluetooth headset.
- the pairing information may also include capability information of the Bluetooth device.
- Acquiring the capability information of the Bluetooth device facilitates subsequent pairing between the first electronic device and the Bluetooth device, and improves the accuracy and adaptability of pairing between the first electronic device and the Bluetooth device.
- the capability information may also indicate that the Bluetooth device supports the capability of entering the pairing mode by receiving notification information sent by the second electronic device.
- this embodiment does not limit the order in which the first electronic device acquires the Bluetooth address and capability information of the Bluetooth device in S64.
- the first electronic device may acquire the Bluetooth address and capability information of the Bluetooth device at the same time.
- the pairing information in a visualized form is generated according to the Bluetooth address and capability information of the Bluetooth device.
- the first electronic device may first obtain the Bluetooth address of the Bluetooth device, and then obtain the capability information of the Bluetooth device.
- the first electronic device may first obtain the capability information of the Bluetooth device, and then obtain the Bluetooth address of the Bluetooth device.
- the Bluetooth address and capability information may be carried in an interaction message, or They are respectively carried in different interaction messages.
- the first electronic device sends a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device, which may include:
- the first electronic device sends a pairing request to the Bluetooth device according to the Bluetooth address and capability information of the Bluetooth device.
- the pairing between the first electronic device and the Bluetooth device is performed through the Bluetooth address and capability information of the Bluetooth device, which improves the accuracy and adaptability of the pairing between the first electronic device and the Bluetooth device.
- the first electronic device acquires pairing information from the second electronic device or the Bluetooth device or the third electronic device in S64 is provided.
- the pairing information includes the Bluetooth address and capability information of the Bluetooth device.
- the first electronic device obtains the pairing information by scanning the pairing information displayed by the second electronic device in a visualized form.
- the pairing information in a visualized form is QR code information.
- the first electronic device acquires pairing information from the second electronic device, which may include:
- the second electronic device generates two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth device.
- the second electronic device performs Bluetooth communication with the Bluetooth device, and stores the Bluetooth address and capability information of the Bluetooth device.
- the second electronic device may generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth device, so as to provide it to the first electronic device later.
- existing algorithms may be used to generate the two-dimensional code information, which will not be described in detail in this embodiment.
- S111 is executed after S61, but the execution sequence between S111 and S62-S63 is not limited.
- S111 is executed before S62, and after the Bluetooth device establishes a Bluetooth connection with the second electronic device in S61, the second electronic device is triggered to execute S111.
- the user uses mobile phone 1 and mobile phone 2, and mobile phone 2 has successfully paired with the Bluetooth headset, but mobile phone 1 has never been paired with the Bluetooth headset.
- the Bluetooth function of the mobile phone 2 can be turned on, and the mobile phone 2 establishes a Bluetooth connection with the Bluetooth headset, triggering the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- S111 is executed before S62, and the second electronic device is triggered to execute S111 by the user performing a second operation on the second electronic device.
- the mobile phone 2 is currently running a system application program, and displays a Bluetooth main interface 70 in the system application program.
- the paired device 71 in the Bluetooth main interface 70 it can be known that the mobile phone 2 has been connected with the mobile phone 1 and the Bluetooth headset.
- the user can click on the Bluetooth headset in the paired device 71 to trigger the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 2 generates two-dimensional code information in response to the user's operation.
- the Bluetooth main interface 70 includes prompt information for guiding the user to perform the second operation. For example, a prompt message "click on the Bluetooth headset to share the pairing information of the Bluetooth headset" may be displayed.
- the second electronic device may display prompt information to the user.
- the user clicks on the Bluetooth headset in the paired device 71 .
- the mobile phone 2 pops up a pop-up window 74 in the Bluetooth main interface 70 in response to the user's operation.
- the user operates by viewing the prompt information in the pop-up window 74 .
- the prompt information includes: "display pairing information of the Bluetooth headset".
- the pop-up window 74 also includes a cancel button and a confirm button.
- the user can click the OK button to trigger the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 2 generates two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset in response to the user's operation of clicking the OK button.
- the user clicks on the Bluetooth headset in the paired device 71 .
- the mobile phone 2 pops up a pop-up window 75 in the Bluetooth main interface 70 in response to the user's operation.
- the user operates by viewing the prompt information in the pop-up window 75 .
- the prompt information includes: "Share the pairing information of the Bluetooth headset”.
- the pop-up window 75 includes multiple ways of sharing pairing information, for example, displaying a QR code, Bluetooth sharing, WiFi sharing and network sharing.
- Bluetooth sharing refers to providing pairing information to mobile phone 1 through Bluetooth communication between mobile phone 2 and mobile phone 1
- WiFi sharing refers to providing pairing information to mobile phone 1 through WiFi communication between mobile phone 2 and mobile phone 1
- network sharing refers to Pairing information is provided to mobile phone 1 through cellular communication between mobile phone 2 and mobile phone 1.
- the pop-up window 75 also includes a cancel button and a confirm button, which are used to cancel the sharing of the pairing information and confirm the sharing of the pairing information.
- the user can click the selection control 76 displaying the two-dimensional code mode to select the two-dimensional code sharing mode. As shown in FIG.
- the display state of the selection control 76 changes, and the user continues to click the OK button, triggering the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 2 generates two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset in response to the user's operation.
- the second operation and the first operation may be the same operation.
- the user clicks on the Bluetooth headset in the paired device 71 in the Bluetooth main interface 70, and triggers the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- the Bluetooth headset sends a notification message.
- FIG. 7A the user clicks on the Bluetooth headset in the paired device 71 in the Bluetooth main interface 70, and triggers the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- the OK button 73 in the pop-up window 72 to trigger the mobile phone 2 to send notification information to the Bluetooth headset, and at the same time, trigger the mobile phone 2 to generate two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth headset.
- the headset sends a notification message.
- S111 is executed after S62, and after the second electronic device sends notification information to the Bluetooth device in S62, the second electronic device is triggered to execute S111.
- S111 is executed after S62, and the second electronic device is triggered to execute S111 by the user performing a second operation on the second electronic device.
- FIGS. 7A to 7E are only examples, and do not limit the second operation of the user on the second electronic device.
- the user's second operation may be any of the following: a touch operation performed by the user on the relevant interface displayed by the second electronic device, a gesture operation performed by the user on the display screen of the second electronic device, An operation performed by a physical button on the second electronic device, a user inputs voice through a microphone of the second electronic device, or a user inputs an image through a camera of the second electronic device.
- the second electronic device may be installed with an APP for managing the Bluetooth device.
- the name and function of the APP are not limited, and the content and layout of the relevant interface of the APP are not limited.
- the second electronic device displays the two-dimensional code information.
- this embodiment does not limit the interface and interface layout of the second electronic device for displaying the two-dimensional code information.
- the mobile phone 2 is currently running a system application program, and displays the Bluetooth main interface 70 in the system application program.
- the Bluetooth main interface 70 includes a two-dimensional code interface 77 .
- the two-dimensional code interface 77 includes two-dimensional code information and prompt information.
- the two-dimensional code information is generated by the mobile phone 2 according to the Bluetooth address and capability information of the Bluetooth headset.
- the prompt information includes: "Please scan the QR code”. The user operates by viewing the prompt information in the two-dimensional code interface 77, for example, using the mobile phone 1 to scan the two-dimensional code information, so that the mobile phone 1 can obtain the pairing information of the Bluetooth headset.
- Fig. 8C shows the mobile phone 2 running the system application program, and displays the bluetooth main interface 70 in the system application program; while in Fig. 8C, the mobile phone 2 runs the third-party application program, and the third-party application program It is used to manage other devices communicating with the mobile phone 2.
- the mobile phone 2 currently displays the “My Device” interface 80 in the third-party application program, and the interface 80 includes a two-dimensional code interface 82 .
- the two-dimensional code interface 82 refer to the two-dimensional code interface 77 in FIG. 7F , the principle is similar and will not be repeated here.
- the first electronic device scans the two-dimensional code information displayed by the second electronic device.
- this embodiment does not limit the process of running the scanning function on the first electronic device.
- the first electronic device may run an APP with the scanning function, and activate the scanning function through human-computer interaction with the user.
- the first electronic device parses the two-dimensional code information to obtain the Bluetooth address and capability information of the Bluetooth device.
- the first electronic device obtains the pairing information of the Bluetooth device from the second electronic device. Since the second electronic device and the Bluetooth headset perform Bluetooth communication, the Bluetooth address and capability information of the Bluetooth device is stored in the second electronic device, which does not need to be obtained through an additional method.
- the second electronic device generates and displays pairing information in a visualized form according to the pairing information of the Bluetooth device.
- the first electronic device does not need to communicate with the second electronic device, and can obtain pairing information in a visualized form by scanning or taking pictures, and then obtain the pairing information.
- the first electronic device obtains pairing information from the second electronic device, the number of devices involved is small, the processing steps are few, and the implementation is simple.
- the flow of the Bluetooth pairing method provided in this embodiment is exemplarily described with reference to FIG. 12 .
- the Bluetooth pairing method provided in this embodiment may include:
- the mobile phone 2 establishes a Bluetooth connection with the Bluetooth headset.
- the mobile phone 2 acquires the Bluetooth address and capability information of the Bluetooth headset, generates a QR code according to the Bluetooth address and capability information of the Bluetooth headset, and displays the QR code.
- the mobile phone 2 sends notification information to the Bluetooth headset, and the notification information is used to instruct the Bluetooth headset to enter the pairing mode.
- the Bluetooth headset receives the notification information sent by the mobile phone 2, and enters the pairing mode according to the notification information.
- Mobile phone 1 starts the scanning function, and scans the QR code displayed on mobile phone 2.
- the mobile phone 1 parses the scanned QR code to obtain the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 1 sends a pairing request to the Bluetooth headset according to the Bluetooth address and capability information of the Bluetooth headset, and initiates pairing.
- the Bluetooth headset After receiving the pairing request sent by mobile phone 1, the Bluetooth headset sends a pairing response to the mobile phone.
- the first electronic device acquires pairing information from the second electronic device through a communication connection with the second electronic device.
- the first electronic device acquires pairing information from the second electronic device, which may include:
- the second electronic device establishes a communication connection with the first electronic device.
- the communication connection includes any one of the following: Bluetooth connection, WiFi connection or cellular communication connection.
- the time for establishing a communication connection between the second electronic device and the first electronic device is not limited, and the execution sequence between S131 and S62-S63 is not limited.
- the second electronic device and the first electronic device have not currently established a communication connection.
- the Bluetooth device establishes a Bluetooth connection with the second electronic device in S61
- the second electronic device and the first electronic device The device establishes a communication connection.
- S131 may be performed before S62, may be performed after S62, or may be performed simultaneously with S62.
- S131 is performed before S62, and after the Bluetooth device establishes a Bluetooth connection with the second electronic device in S61, the second electronic device is triggered to execute S131.
- This implementation is applicable to a scenario where only the first electronic device, the second electronic device and the Bluetooth device exist in the environment.
- the user uses mobile phone 1 and mobile phone 2, and mobile phone 2 has successfully paired with the Bluetooth headset, but mobile phone 1 has never been paired with the Bluetooth headset.
- the Bluetooth headset is powered on, and the user turns on the Bluetooth functions of the mobile phone 1 and the mobile phone 2. In this way, the mobile phone 2 can search for the mobile phone 1 through the Bluetooth technology.
- the mobile phone 2 After the mobile phone 2 establishes a Bluetooth connection with the Bluetooth headset, it can trigger the mobile phone 2 to establish a communication connection with the mobile phone 1, so as to send pairing information of the Bluetooth device to the mobile phone 1 subsequently.
- the mobile phone 1, the mobile phone 2 and the Bluetooth headset can log in to the same user account.
- S131 is performed before S62, and the second electronic device is triggered to perform S131 by the user performing a third operation on the second electronic device.
- the third operation performed by the user on the second electronic device is not limited, and may be any operation for sharing files or information between devices.
- the third operation is an operation in which the user transmits a file to the mobile phone 1 on the mobile phone 2 via Bluetooth.
- the third operation is an operation in which the user uses a chat app on the mobile phone 2 to send information to the mobile phone 1 through the mobile network.
- the user's third operation may be any of the following: a touch operation performed by the user on a relevant interface displayed on the second electronic device, a gesture operation performed by the user on the display screen of the second electronic device, The user operates the physical keys on the second electronic device, the user inputs voice through the microphone of the second electronic device, or the user inputs images through the camera of the second electronic device.
- the second electronic device may be installed with an APP for managing the Bluetooth device. This embodiment does not limit the name and function of the APP, and does not limit the content and layout of the relevant interface of the APP.
- the relevant interface of the second electronic device may include prompt information for guiding the user to perform the third operation, and the content of the prompt information is not limited in this embodiment.
- the mobile phone 2 runs a third-party application program, and the third-party application program is used to manage other devices communicating with the mobile phone 2, and the mobile phone 2 currently displays the "my device" interface 80 in the third-party application program .
- the interface 80 includes the mobile phone 1, and the mobile phone 1 is not connected to the mobile phone 2 currently.
- the user can click on the mobile phone 1 to trigger the mobile phone 2 to establish a communication connection with the mobile phone 1, so that the subsequent mobile phone 2 can send the Bluetooth device pairing information to the mobile phone 1.
- the mobile phone 2 establishes a communication connection with the mobile phone 1 in response to the user's operation. This scenario is applicable when the user knows that the pairing information of the Bluetooth headset needs to be shared with the mobile phone 1 .
- the second electronic device may display prompt information to the user.
- the user clicks on the mobile phone 1 .
- the mobile phone 2 pops up a pop-up window 83 on the interface 80 in response to the user's operation.
- the pop-up window 83 refer to the description of the pop-up frame 75 in FIG. 7E , the principle is similar, and will not be repeated here.
- the user can click the selection control 84 for WiFi sharing, so that the mobile phone 2 can send pairing information to the mobile phone 1 through the WiFi communication between the mobile phone 2 and the mobile phone 1 .
- the selection control 84 for WiFi sharing
- the display state of the selection control 84 changes, and the user continues to click the OK button, which triggers the mobile phone 2 to establish a WiFi connection with the mobile phone 1 .
- the mobile phone 2 establishes a WiFi connection with the mobile phone 1 in response to the user's operation.
- S131 is performed after S62, and after the second electronic device sends notification information to the Bluetooth device in S62, the second electronic device is triggered to perform S131.
- This implementation is applicable to a scenario where only the first electronic device, the second electronic device and the Bluetooth device exist in the environment.
- S131 is performed after S62, and the second electronic device is triggered to perform S131 by the user performing a third operation on the second electronic device.
- an interface change process is as follows: as shown in FIG. 8A , the user clicks the button 85 to trigger the mobile phone 2 to send notification information to the Bluetooth headset, and at the same time, trigger the mobile phone 2 to share the pairing information.
- the mobile phone 2 responds to the user's operation of clicking the button 85 , as shown in FIG. 8D , a pop-up window 83 pops up on the interface 80 .
- the user can click the selection control 84 for WiFi sharing, so that the mobile phone 2 can share the pairing information through WiFi communication.
- the display state of the selection control 84 changes, and the user continues to click the OK button.
- the mobile phone 2 searches for surrounding devices that can perform WiFi communication in response to the operation of the user clicking the OK button, and displays a WiFi device list 86.
- the devices that the mobile phone 2 can perform WiFi communication include mobile phone 1 , mobile phone 3 and mobile phone 4 .
- Each handset has selection controls 87 on the right side. The user can click the selection control 87 on the right side of the mobile phone 1, and then click the sharing button 88 to trigger the mobile phone 2 and the mobile phone 1 to establish a WiFi connection.
- the mobile phone 2 establishes a WiFi connection with the mobile phone 1 in response to the user's operation.
- the mobile phone 2 can search for and display the surrounding communicable devices and display a device list to the user, so that the user can select a device to share the pairing information of the Bluetooth headset, which is convenient for the user to operate.
- the second electronic device when the Bluetooth device needs to be paired with the first electronic device, the second electronic device has established a communication connection with the first electronic device. For example, when the user needs to pair the mobile phone 1 with the Bluetooth headset, the mobile phone 1 and the mobile phone 2 have already transmitted audio files through the Bluetooth connection.
- the second electronic device generates shared information according to the Bluetooth address and capability information of the Bluetooth device.
- the second electronic device performs Bluetooth communication with the Bluetooth device, and stores the Bluetooth address and capability information of the Bluetooth device.
- the second electronic device generates shared information according to the Bluetooth address and capability information of the Bluetooth device.
- shared information can be in any of the following forms: text format, file format, or image.
- the second electronic device may encrypt the Bluetooth address and capability information of the Bluetooth device to generate shared information.
- This embodiment does not limit the encryption algorithm.
- the second electronic device sends the sharing information to the first electronic device through the communication connection.
- the first electronic device receives the sharing information sent by the second electronic device through the communication connection.
- the first electronic device parses the shared information to obtain the Bluetooth address and capability information of the Bluetooth device.
- the first electronic device may decrypt the shared information to obtain the Bluetooth address and capability information of the Bluetooth device.
- the decryption algorithm used by the first electronic device matches the encryption algorithm used by the second electronic device.
- the first electronic device after receiving the shared information, automatically parses the shared information to obtain the Bluetooth address and capability information of the Bluetooth device. This method is simple to implement.
- the first electronic device after receiving the shared information, requires the user to operate the second electronic device, so that the second electronic device parses the shared information in response to the user's operation.
- the first electronic device stores the shared information in a default folder after receiving it. Users can open the default folder and click Share Information.
- the second electronic device analyzes the shared information in response to the user's click operation. This method is more flexible, and improves the accuracy and security of the second electronic device in parsing the shared information.
- the first electronic device obtains the pairing information of the Bluetooth device from the second electronic device. Since the second electronic device and the Bluetooth headset perform Bluetooth communication, the Bluetooth address and capability information of the Bluetooth device is stored in the second electronic device, which does not need to be obtained through an additional method.
- the second electronic device provides pairing information to the first electronic device through a communication connection with the first electronic device.
- the first electronic device obtains pairing information from the second electronic device, the number of devices involved is small, and the implementation method is simple.
- the flow of the Bluetooth pairing method provided in this embodiment is exemplarily described with reference to FIG. 14 .
- the Bluetooth pairing method provided in this embodiment may include:
- the mobile phone 2 establishes a Bluetooth connection with the Bluetooth headset.
- the mobile phone 2 sends notification information to the Bluetooth headset, and the notification information is used to instruct the Bluetooth headset to enter the pairing mode.
- the mobile phone 2 generates shared information according to the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 2 sends the shared information to the mobile phone 1 through the communication connection with the mobile phone 1 .
- the Bluetooth headset receives the notification information sent by the mobile phone 2, and enters the pairing mode according to the notification information.
- the mobile phone 1 receives the shared information sent by the mobile phone 2, analyzes the shared information, and obtains the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 1 sends a pairing request to the Bluetooth headset according to the Bluetooth address and capability information of the Bluetooth headset, and initiates pairing.
- the Bluetooth headset After receiving the pairing request sent by the mobile phone 1, the Bluetooth headset sends a pairing response to the mobile phone.
- the third electronic device is used as an external display device of the Bluetooth device.
- the first electronic device may acquire pairing information by scanning the pairing information displayed by the third electronic device in a visual form, S64 is executed after S62.
- the pairing information in a visualized form is QR code information.
- the first electronic device acquires pairing information from the third electronic device, which may include:
- the Bluetooth device generates two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth device.
- the bluetooth device sends the two-dimensional code information to the third electronic device, and correspondingly, the third electronic device receives the two-dimensional code information sent by the bluetooth device.
- the third electronic device displays the two-dimensional code information.
- this embodiment does not limit the interface and interface layout of the third electronic device for displaying the two-dimensional code information.
- the first electronic device scans the two-dimensional code information displayed by the third electronic device.
- this embodiment does not limit the process of running the scanning function on the first electronic device.
- the first electronic device may run an APP with the scanning function, and activate the scanning function through human-computer interaction with the user.
- the first electronic device parses the two-dimensional code information to obtain the Bluetooth address and capability information of the Bluetooth device.
- the first electronic device obtains the pairing information of the Bluetooth device from the third electronic device. After receiving the notification information sent by the second electronic device, the Bluetooth device determines that it needs to enter the pairing mode.
- the bluetooth device can generate pairing information in a visual form according to the bluetooth address and capability information of the bluetooth device, and display it through the third electronic device. Since the pairing information is determined to be provided by the Bluetooth device, the security of obtaining the pairing information by the first electronic device is improved.
- the first electronic device does not need to communicate with the third electronic device, and can obtain pairing information in a visualized form by scanning or taking pictures, and then obtain the pairing information.
- the Bluetooth pairing method provided in this embodiment improves the security of the pairing information obtained by the first electronic device, and the implementation method is more flexible.
- the Bluetooth device as a Bluetooth headset
- the first electronic device as a mobile phone 1
- the second electronic device as a mobile phone 2
- the third electronic device as a display 3
- the flow of the Bluetooth pairing method provided in this embodiment is described in conjunction with FIG. 16 Give an example.
- the Bluetooth pairing method provided in this embodiment may include:
- the mobile phone 2 establishes a Bluetooth connection with the Bluetooth headset.
- the mobile phone 2 sends notification information to the Bluetooth headset, and the notification information is used to instruct the Bluetooth headset to enter the pairing mode.
- the Bluetooth headset receives the notification information sent by the mobile phone 2, enters the pairing mode according to the notification information, and generates a QR code according to the Bluetooth address and capability information of the Bluetooth headset.
- the Bluetooth headset sends a QR code to the display 3 .
- the display 3 receives the two-dimensional code sent by the Bluetooth headset, and displays the two-dimensional code.
- the mobile phone 1 activates the scanning function, and scans the QR code displayed on the display 3 .
- the mobile phone 1 parses the scanned QR code to obtain the Bluetooth address and capability information of the Bluetooth headset.
- the mobile phone 1 sends a pairing request to the Bluetooth headset according to the Bluetooth address and capability information of the Bluetooth headset, and initiates pairing.
- the Bluetooth headset After receiving the pairing request sent by the mobile phone 1, the Bluetooth headset sends a pairing response to the mobile phone.
- the Bluetooth device itself may have a display screen.
- the first electronic device may obtain pairing information by scanning the pairing information in visual form displayed by the Bluetooth device. S64 is performed after S62.
- the pairing information in a visualized form is QR code information.
- the first electronic device acquires pairing information from the Bluetooth device, which may include:
- the Bluetooth device generates two-dimensional code information according to the Bluetooth address and capability information of the Bluetooth device.
- the Bluetooth device displays the two-dimensional code information.
- this embodiment does not limit the interface and interface layout of the bluetooth device displaying the two-dimensional code information.
- the first electronic device scans the two-dimensional code information displayed by the Bluetooth device.
- this embodiment does not limit the process of running the scanning function on the first electronic device.
- the first electronic device may run an APP with the scanning function, and activate the scanning function through human-computer interaction with the user.
- the first electronic device parses the two-dimensional code information to obtain the Bluetooth address and capability information of the Bluetooth device.
- the first electronic device acquires pairing information of the Bluetooth device from the Bluetooth device. After receiving the notification information sent by the second electronic device, the Bluetooth device determines that it needs to enter the pairing mode.
- the Bluetooth device can generate and display pairing information in a visualized form according to the Bluetooth address and capability information of the Bluetooth device. Since the pairing information is determined to be provided by the Bluetooth device, the security of obtaining the pairing information by the first electronic device is improved.
- the first electronic device does not need to communicate with the Bluetooth device, and can obtain pairing information in a visualized form by scanning or taking pictures, and then obtain the pairing information.
- the Bluetooth pairing method provided in this embodiment improves the security of the pairing information obtained by the first electronic device, and the implementation method is more flexible.
- the first electronic device, the second electronic device, the bluetooth device and the third electronic device include corresponding hardware and/or software modules for performing respective functions.
- the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software drives hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions in combination with the embodiments for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
- the embodiment of the present application can divide the functional modules of the first electronic device, the second electronic device, the Bluetooth device and the third electronic device according to the above method example, for example, each functional module can be divided corresponding to each function, or two or More than two functions are integrated in one module.
- each functional module can be divided corresponding to each function, or two or More than two functions are integrated in one module.
- the division of modules in the embodiment of the present application is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
- the names of the modules in the embodiments of the present application are illustrative, and the names of the modules are not limited during actual implementation.
- FIG. 18 is a schematic structural diagram of a device provided in an embodiment of the present application, and the device may be the first electronic device, the second electronic device, the Bluetooth device, and the third electronic device in the embodiment of the present application.
- the device may include: a receiving module 1801 , a processing module 1802 and a sending module 1803 .
- the device shown in FIG. 18 is a second electronic device, configured to perform operations of the second electronic device in the foregoing method embodiments, and the technical principles and technical effects are similar.
- the second electronic device has been paired with the Bluetooth device, and the second electronic device includes:
- a processing module 1802 configured to establish a Bluetooth connection with the Bluetooth device
- the sending module 1803 is configured to send notification information to the Bluetooth device, where the notification information is used to instruct the Bluetooth device to enter a pairing mode.
- the processing module 1802 is further configured to: receive a user's first operation;
- the sending module 1803 is further configured to send the notification information to the Bluetooth device in response to the first operation.
- a receiving module 1801 is also included;
- the sending module 1803 is configured to send an L2CAP_ECHO_REQ message to the Bluetooth device, where the L2CAP_ECHO_REQ message includes the notification information;
- the receiving module 1801 is configured to receive the L2CAP_ECHO_RSP message sent by the Bluetooth device.
- processing module 1802 is also used for:
- the pairing information including the Bluetooth address of the Bluetooth device
- the processing module 1802 is further configured to: before generating the two-dimensional code information according to the pairing information, receive a second user operation.
- the processing module 1802 is further configured to: establish a communication connection with a first electronic device, and the first electronic device is not paired with the Bluetooth device;
- the sending module 1803 is further configured to send pairing information to the Bluetooth device through the communication connection, where the pairing information includes the Bluetooth address of the Bluetooth device.
- the processing module 1802 is further configured to: receive a third user operation before establishing a communication connection with the first electronic device.
- the communication connection includes any one of the following: Bluetooth connection, WiFi connection or cellular communication connection.
- processing module 1802 is further configured to generate shared information according to the pairing information
- the sending module 1803 is configured to send the sharing information to the Bluetooth device through the communication connection.
- the pairing information also includes capability information of the Bluetooth device.
- the device shown in FIG. 18 is a Bluetooth device, configured to perform the operations of the Bluetooth device in the foregoing method embodiments, and the technical principles and technical effects are similar.
- the Bluetooth device is not paired with the first electronic device, and the Bluetooth device is paired with the second electronic device, and the Bluetooth device includes:
- a processing module 1802 configured to establish a Bluetooth connection with the second electronic device
- a receiving module 1801 configured to receive notification information sent by the second electronic device, where the notification information is used to instruct the Bluetooth device to enter a pairing mode;
- the processing module 1802 is further configured to enter a pairing mode according to the notification information
- the receiving module 1801 is further configured to receive the pairing request sent by the first electronic device.
- a sending module 1803 is also included;
- the receiving module 1801 is configured to receive the L2CAP_ECHO_REQ message sent by the second electronic device, where the L2CAP_ECHO_REQ message includes the notification information;
- the sending module 1803 is configured to send an L2CAP_ECHO_RSP message to the second electronic device.
- a sending module 1803 is also included;
- the processing module 1802 is further configured to generate two-dimensional code information according to the pairing information after entering the pairing mode according to the notification information, and the pairing information includes the Bluetooth address of the Bluetooth device;
- the sending module 1803 is configured to send the two-dimensional code information to a third electronic device.
- processing module 1802 is also used for:
- the pairing information After entering the pairing mode according to the notification information, generate two-dimensional code information according to the pairing information, the pairing information including the Bluetooth address of the Bluetooth device;
- the pairing information also includes capability information of the Bluetooth device.
- the device shown in FIG. 18 is a first electronic device, configured to perform operations of the first electronic device in the foregoing method embodiments, and the technical principles and technical effects are similar.
- the first electronic device is not paired with the Bluetooth device, and the Bluetooth device is paired with the second electronic device, and the first electronic device includes:
- a processing module 1802 configured to acquire pairing information from the second electronic device or the Bluetooth device or a third electronic device, the pairing information includes the Bluetooth address of the Bluetooth device; the third electronic device and the Bluetooth device communication;
- the sending module 1803 is configured to send a pairing request to the Bluetooth device according to the Bluetooth address of the Bluetooth device.
- the pairing information also includes capability information of the Bluetooth device.
- processing module 1802 is specifically configured to:
- the two-dimensional code information is generated by the second electronic device according to the pairing information
- processing module 1802 is used for:
- the pairing information is acquired from the second electronic device through the communication connection.
- a receiving module 1801 is also included;
- the receiving module 1801 is configured to receive sharing information sent by the second electronic device; the sharing information is generated by the second electronic device according to the pairing information;
- the processing module 1802 is configured to parse the shared information to obtain the pairing information.
- the communication connection includes any one of the following: Bluetooth connection, WiFi connection or cellular communication connection.
- processing module 1802 is used for:
- the two-dimensional code information is generated by the Bluetooth device according to the pairing information
- the device shown in FIG. 18 is a third electronic device, configured to perform operations of the third electronic device in the foregoing method embodiments, and the technical principles and technical effects are similar.
- the third electronic device communicates with the Bluetooth device, and the third electronic device includes:
- the receiving module 1801 is configured to receive the two-dimensional code information sent by the Bluetooth device, the two-dimensional code information is generated by the Bluetooth device according to the pairing information, and the pairing information includes the Bluetooth address of the Bluetooth device;
- the processing module 1802 is configured to display two-dimensional code information.
- the pairing information also includes capability information of the Bluetooth device.
- FIG. 19 shows a structure of a device provided by an embodiment of the present application.
- the device may be a first electronic device, a second electronic device, a third electronic device or a Bluetooth device.
- the device includes: a processor 1901 , a receiver 1902 , a transmitter 1903 , a memory 1904 and a bus 1905 .
- the processor 1901 includes one or more processing cores, and the processor 1901 executes applications of various functions and information processing by running software programs and modules.
- the receiver 1902 and the transmitter 1903 can be realized as a communication component, and the communication component can be a baseband chip.
- the memory 1904 is connected to the processor 1901 through a bus 1905 .
- the memory 1904 may be used to store at least one program instruction, and the processor 1901 may be used to execute the at least one program instruction, so as to implement the technical solutions of the foregoing embodiments. Its implementation principle and technical effect are similar to those of the related embodiments of the method above, and will not be repeated here.
- the processor can read the software program in the memory, interpret and execute the instructions of the software program, and process the data of the software program.
- the processor performs baseband processing on the data to be sent, and then outputs the baseband signal to the control circuit in the control circuit. send.
- the control circuit receives the radio frequency signal through the antenna, converts the radio frequency signal into a baseband signal, and outputs the baseband signal to the processor, and the processor converts the baseband signal into data and processes the data.
- FIG. 19 only shows a memory and a processor. In an actual device, there may be multiple processors and memories.
- a storage may also be called a storage medium or a storage device, etc., which is not limited in this embodiment of the present application.
- the processor may include a baseband processor and a central processing unit, the baseband processor is mainly used for processing communication data, and the central processing unit is mainly used for executing software programs and processing data of the software programs.
- the baseband processor and the central processing unit may be integrated into one processor, or may be independent processors interconnected through technologies such as a bus.
- the device may include multiple baseband processors to adapt to different network standards, the device may include multiple central processors to enhance its processing capability, and various components of the device may be connected through various buses.
- the baseband processor may also be expressed as a baseband processing circuit or a baseband processing chip.
- the central processing unit may also be expressed as a central processing circuit or a central processing chip.
- the function of processing the communication protocol and communication data can be built in the processor, or can be stored in the memory in the form of a software program, and the processor executes the software program to realize the baseband processing function.
- the memory can be integrated in the processor, or it can be independent from the processor.
- the memory includes a high-speed cache, which can store frequently accessed data/instructions.
- the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or Execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application.
- a general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
- the memory may be a non-volatile memory, such as a hard disk (hard disk drive, HDD) or a solid-state drive (solid-state drive, SS), etc., or a volatile memory (volatile memory), such as Random-access memory (RAM).
- a memory is, without limitation, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
- the memory in the embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, and is used for storing program instructions and/or data.
- the methods provided in the various embodiments of the present application may be fully or partially implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product.
- the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part.
- the computer may be a general purpose computer, a special purpose computer, a computer network, network equipment, user equipment or other programmable devices.
- the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL) or wireless (such as infrared, wireless, microwave, etc.).
- the readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media integrated.
- the available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape, etc.) ), optical media (for example, digital video disc (DWD), or semiconductor media (for example, SSD), etc.
- FIG. 20 is another schematic structural diagram of a device provided in an embodiment of the present application, and the device may be a Bluetooth device, for example, a Bluetooth headset.
- the Bluetooth headset may include at least one processor 101, at least one memory 102, a wireless communication module 103, an audio module 104, a power supply module 105, an input/output interface 106, and the like.
- the processor may include one or more interfaces for connecting with other components of the Bluetooth headset.
- the Bluetooth headset is stored through the headset box. The components of the Bluetooth headset will be specifically introduced below in conjunction with FIG. 20 .
- the memory 102 can be used to store program codes, such as for the physical connection between the Bluetooth headset and multiple electronic devices, as well as the service specification connection between the electronic devices, and the processing of audio services of the electronic devices (such as music playing, receiving, etc.). / phone calls, etc.), and the program codes for charging the Bluetooth headset, wireless pairing and connection between the Bluetooth headset and other electronic devices, etc.
- the memory 102 can also be used to store other information, such as the priority of the electronic device.
- the processor 101 may be configured to execute the above application codes, and call related modules to realize the functions of the Bluetooth headset in the embodiment of the present application. For example, realize the physical connection between the Bluetooth headset and multiple electronic devices, business standard connection, audio playback, answering/calling and other functions.
- the processor 101 may include one or more processing units, and different processing units may be independent devices, or may be integrated in one or more processors 101 .
- the processor 101 may be an integrated control chip, or may be composed of a circuit including various active and/or passive components, and the circuit is configured to execute the functions belonging to the processor 101 described in the embodiments of this application.
- the wireless communication module 103 can be used to support the data exchange between the Bluetooth headset and other electronic devices or earphone boxes through wireless communication technology, such as BT, WLAN (such as Wi-Fi), Zigbee, FM, NFC, IR , or general 2.4G/5G wireless communication technology, etc.
- wireless communication technology such as BT, WLAN (such as Wi-Fi), Zigbee, FM, NFC, IR , or general 2.4G/5G wireless communication technology, etc.
- the wireless communication module 103 may be a Bluetooth chip.
- the bluetooth earphone can be paired with the bluetooth chip of other electronic devices and establish a wireless connection through the bluetooth chip, so as to realize wireless communication and business processing between the bluetooth earphone and other electronic devices through the wireless connection.
- the Bluetooth chip can support basic rate (basic rate, BR)/enhanced data rate (enhanced data rate, EDR) Bluetooth and BLE, for example, it can receive/send paging (page) information, receive/send BLE broadcast messages, etc.
- the wireless communication module 103 may further include an antenna.
- the wireless communication module 103 receives electromagnetic waves via the antenna, frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 101 .
- the wireless communication module 103 can also receive the signal to be sent from the processor 101, frequency-modulate it, amplify it, and convert it into electromagnetic wave and radiate it through the antenna.
- the audio module 104 can be used to manage audio data, and realize input and output audio streams of Bluetooth earphones.
- the audio module 104 can obtain the audio stream from the wireless communication module 103, or transfer the audio stream to the wireless communication module 103, so as to realize making and receiving calls, playing music, starting/closing the voice assistant of the electronic device connected to the earphone, receiving /Send the user's voice data and other functions.
- the audio module 104 may include a speaker (or earpiece, receiver) assembly for outputting audio streams, a microphone (or microphone, microphone), a microphone receiving circuit matched with the microphone, and the like. Loudspeakers can be used to convert audio electrical signals into sound signals and play them back. Microphones can be used to convert sound signals into audio electrical signals.
- the power supply module 105 can be used to provide the system power supply of the Bluetooth headset, supply power for each module of the Bluetooth headset; support the Bluetooth headset to receive charging input, etc.
- the power module 105 may include a power management unit (power management unit, PMU) and a battery.
- the power management unit can receive an external charging input; transform the electrical signal input from the charging circuit and supply it to the battery for charging; it can also transform the electrical signal provided by the battery and provide it to the audio module 104, the wireless communication module 103, etc. modules; and to prevent battery overcharge, overdischarge, short circuit or overcurrent, etc.
- the power module 105 may also include a wireless charging coil for wirelessly charging the Bluetooth headset.
- the power management unit can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
- Multiple input/output interfaces 106 can be used to provide a wired connection for charging or communication between the Bluetooth headset and the headset box.
- the input/output interface may be a USB interface.
- the input/output interface 106 can be an earphone electrical connector.
- the Bluetooth earphone When the Bluetooth earphone is placed in the earphone box, the Bluetooth earphone can establish an electrical connection with the electrical connector in the earphone box through the earphone electrical connector, thereby Charge the battery in the Bluetooth headset.
- the Bluetooth earphone can also perform data communication with the earphone box, for example, can receive a pairing instruction from the earphone box.
- the Bluetooth headset may further include a sensor 107 .
- the sensor 107 can be a distance sensor or a proximity light sensor, which can be used to determine whether the Bluetooth headset is worn by the user.
- the Bluetooth headset can use a distance sensor to detect whether there is an object near the Bluetooth headset, so as to determine whether the Bluetooth headset is worn by the user. When it is determined that the Bluetooth headset is worn, the Bluetooth headset can turn on the speaker.
- the sensor 107 may also include a bone conduction sensor, combined into a bone conduction earphone.
- the Bluetooth headset can obtain the vibration signal of the vibrating bone of the human voice, analyze the voice signal, realize the voice function, and receive the user's voice command.
- the Bluetooth headset can also perform voice authentication based on the user's voice signal obtained by the bone conduction headset, so as to authenticate the user's identity in business scenarios such as payment transactions.
- the sensor 107 may also include: a touch sensor, used to detect the user's touch operation; a fingerprint sensor, used to detect the user's fingerprint, identify the user's identity, etc.; Adjust some parameters (such as volume); and possibly other sensors.
- a touch sensor used to detect the user's touch operation
- a fingerprint sensor used to detect the user's fingerprint, identify the user's identity, etc.
- Adjust some parameters such as volume
- the touch sensor can detect the user's touch operations such as single click, double click, multiple clicks, long press, heavy pressure, etc., and can also perform user fingerprint recognition to authenticate the user's identity in business scenarios such as payment transactions. right.
- the structure shown in the embodiment of the present application does not constitute a specific limitation on the Bluetooth headset. It may have more or fewer components than shown in FIG. 20, may combine two or more components, or may have a different configuration of components.
- the outer surface of the bluetooth headset can also include buttons 108, indicator lights (which can indicate the status of battery power, incoming/outgoing calls, pairing mode, etc.), display screens (which can prompt users for relevant information), dust-proof nets (which can be used with earpieces) ) and other components.
- the button 108 may be a physical button or a touch button (used in conjunction with a touch sensor), etc., and is used to trigger operations such as power on, power off, pause, play, record, start pairing, and reset.
- the bluetooth earphone is usually stored in an earphone box. There may be one or more magnets inside the earphone box to attract the earphone body into the cavity in the earphone box.
- the headset box may include a battery and multiple input/output interfaces.
- the input/output interface may be a box electrical connector.
- At least one touch control can be provided on the earphone box, which can be used to trigger functions such as pairing and resetting of the Bluetooth earphone or charging of the Bluetooth earphone.
- the earphone box can also be provided with one or more power indicator lights, to remind the user of the power level of the battery in the earphone box, and the power level of the battery in each earphone body in the earphone box.
- An embodiment of the present application provides a computer program product, which, when running on a device, enables the device to execute the technical solution in the above embodiment, and its realization principle and technical effect are similar to those of the above related embodiments, here No longer.
- the device may be a first electronic device, a second electronic device, a third electronic device or a Bluetooth device.
- An embodiment of the present application provides a computer-readable storage medium, on which program instructions are stored, and when the program instructions are executed by a device, the device executes the technical solutions of the foregoing embodiments. Its implementation principle and technical effect are similar to those of the above-mentioned related embodiments, and will not be repeated here.
- the device may be a first electronic device, a second electronic device, a third electronic device or a Bluetooth device.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本申请实施例涉及通信技术领域,提供一种蓝牙配对方法、设备、***和存储介质。在第一电子设备、第二电子设备和蓝牙设备组成的通信***中,蓝牙设备和第一电子设备未配对,和第二电子设备已配对。蓝牙配对方法包括:第二电子设备和蓝牙设备建立蓝牙连接,向蓝牙设备发送通知信息;蓝牙设备根据通知信息进入配对模式;第一电子设备从第二电子设备或蓝牙设备或第三电子设备获取蓝牙设备的蓝牙地址,并向蓝牙设备发送配对请求。通过第二电子设备指示蓝牙设备进入配对模式,避免了用户必须操作蓝牙设备才能使蓝牙设备进入配对模式,并且,第一电子设备根据获取的蓝牙设备的蓝牙地址可以发起配对流程,实现了第一电子设备和蓝牙设备的成功配对。
Description
本申请要求于2021年11月01日提交国家知识产权局、申请号为202111285181.3、申请名称为“蓝牙配对方法、设备、***和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请实施例涉及通信技术领域,尤其涉及一种蓝牙配对方法、设备、***和存储介质。
蓝牙(Bluetooth)技术是一种短距离无线通信技术,被广泛的应用于通信设备中,例如,智能手机、蓝牙耳机等。
蓝牙耳机与智能手机首次进行蓝牙通信之前需要先进行配对,配对之后才能进行正常的通话、音频等业务。蓝牙耳机进行配对时需要处于配对模式,对智能手机发送的查询请求进行扫描并回复,从而使得智能手机发现蓝牙耳机。
目前,对于非首次使用的蓝牙耳机,当蓝牙耳机需要与没有配对的设备进行蓝牙通信时,需要用户对蓝牙耳机上的物理按键进行手动操作,人为的使得蓝牙耳机进入配对模式,才能与其他没有配对的设备进行配对。但是,很多用户并不清楚需要在蓝牙耳机上人为操作,导致蓝牙耳机无法与其他设备进行蓝牙通信。
发明内容
本申请实施例提供一种蓝牙配对方法、设备、***和存储介质,实现了电子设备和非首次使用的蓝牙设备的成功配对。
第一方面,提供了一种蓝牙配对方法,应用于通信***,通信***包括第一电子设备、第二电子设备和蓝牙设备,第二电子设备和蓝牙设备已配对,第一电子设备和蓝牙设备未配对。蓝牙配对方法包括:第二电子设备和蓝牙设备建立蓝牙连接;第二电子设备向蓝牙设备发送通知信息,通知信息用于指示蓝牙设备进入配对模式;蓝牙设备根据通知信息进入配对模式;第一电子设备从第二电子设备或蓝牙设备或第三电子设备获取配对信息,配对信息包括蓝牙设备的蓝牙地址;第一电子设备根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求。
第一方面提供的蓝牙配对方法,借助于除了第一电子设备和蓝牙设备之外的第二电子设备,通过第二电子设备可以控制蓝牙设备进入配对模式,避免了用户必须对蓝牙设备进行操作才能触发蓝牙设备进入配对模式,消除了用户操作蓝牙设备的不便利性。而且,第一电子设备不通过向蓝牙设备发送查询请求也可以获得蓝牙设备的蓝牙地址,简化了配对过程的消息流程,提升了非首次使用的蓝牙设备与没有配对的电子设备完成配对过程的可实现性和效率,提升了用户的使用感受。
一种可能的实现方式中,第二电子设备向蓝牙设备发送通知信息,包括:第二电子设备接收用户的第一操作;第二电子设备响应于第一操作,向蓝牙设备发送通知信息。
在该实现方式中,通过用户的操作触发第二电子设备向蓝牙设备发送通知信息,提高了操作的灵活性。
一种可能的实现方式中,第二电子设备向蓝牙设备发送通知信息,包括:第二电子设备向蓝牙设备发送L2CAP_ECHO_REQ消息,L2CAP_ECHO_REQ消息包括通知信息;蓝牙设备向第二电子设备向发送L2CAP_ECHO_RSP消息。
在该实现方式中,通过回声请求实现了第二电子设备向蓝牙设备发送通知信息,通过回声响应确认了蓝牙设备成功接收通知信息,提高了第二电子设备发送通知信息的成功率。
一种可能的实现方式中,第一电子设备从第二电子设备获取配对信息,包括:第二电子设备根据配对信息生成二维码信息,并显示二维码信息;第一电子设备扫描二维码信息,并解析二维码信息获得配对信息。
在该实现方式中,第一电子设备不需要与第二电子设备进行通信,通过扫描或拍照等方式可以获取可视化形式的配对信息,进而获得配对信息。第一电子设备从第二电子设备获得配对信息,涉及的设备数量少,处理步骤少,实现方式简单。
一种可能的实现方式中,第二电子设备根据配对信息生成二维码信息之前,还包括:第二电子设备接收用户的第二操作。
在该实现方式中,通过用户的操作触发第二电子设备根据配对信息生成二维码信息,提高了操作的灵活性。
一种可能的实现方式中,第一电子设备从第二电子设备获取配对信息,包括:第二电子设备和第一电子设备建立通信连接;第二电子设备通过通信连接向蓝牙设备发送配对信息;第一电子设备接收配对信息。
在该实现方式中,第二电子设备通过与第一电子设备之间的通信连接向第一电子设备提供配对信息,涉及的设备数量少,实现方式简单。
一种可能的实现方式中,第二电子设备和第一电子设备建立通信连接之前,还包括:接收用户的第三操作。
一种可能的实现方式中,通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂窝通信连接。
在该实现方式中,通信连接具有多种类型,提高了实现的灵活性。
一种可能的实现方式中,第一电子设备从蓝牙设备获取配对信息,包括:蓝牙设备根据通知信息进入配对模式后,根据配对信息生成二维码信息,并显示二维码信息;第一电子设备扫描二维码信息,并解析二维码信息获得配对信息。
在该实现方式中,第一电子设备不需要与蓝牙设备进行通信,通过扫描或拍照等方式可以从蓝牙设备获取可视化形式的配对信息,进而获得配对信息,提高了第一电子设备获得配对信息的安全性,实现方式更加多样性。
一种可能的实现方式中,第三电子设备和蓝牙设备通信,第一电子设备从第三电子设备获取配对信息,包括:蓝牙设备根据通知信息进入配对模式后,根据配对信息生成二维码信息;蓝牙设备向第三电子设备发送二维码信息;第三电子设备接收二维码信息后,显示二维码信息;第一电子设备扫描二维码信息,并解析二维码信息获得配对信息。
在该实现方式中,由蓝牙设备向第三电子设备提供配对信息。第一电子设备不需要与第三电子设备进行通信,通过扫描或拍照等方式可以获取可视化形式的配对信息,进而获得配对信息,提高了第一电子设备获得配对信息的安全性,实现方式更加多样性。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第二方面,提供了一种蓝牙配对方法,应用于第二电子设备,第二电子设备与蓝牙设备已配对,蓝牙配对方法包括:和蓝牙设备建立蓝牙连接;向蓝牙设备发送通知信息,通知信息用于指示蓝牙设备进入配对模式。
一种可能的实现方式中,向蓝牙设备发送通知信息,包括:接收用户的第一操作;响应于第一操作,向蓝牙设备发送通知信息。
一种可能的实现方式中,向蓝牙设备发送通知信息,包括:向蓝牙设备发送L2CAP_ECHO_REQ消息,L2CAP_ECHO_REQ消息包括通知信息;接收蓝牙设备发送的L2CAP_ECHO_RSP消息。
一种可能的实现方式中,还包括:根据配对信息生成二维码信息,配对信息包括蓝牙设备的蓝牙地址;显示二维码信息。
一种可能的实现方式中,根据配对信息生成二维码信息之前,还包括:接收用户的第二操作。
一种可能的实现方式中,还包括:和第一电子设备建立通信连接,第一电子设备和蓝牙设备未配对;通过通信连接向蓝牙设备发送配对信息,配对信息包括蓝牙设备的蓝牙地址。
一种可能的实现方式中,和第一电子设备建立通信连接之前,还包括:接收用户的第三操作。
一种可能的实现方式中,通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂窝通信连接。
一种可能的实现方式中,通过通信连接向蓝牙设备发送配对信息,包括:根据配对信息生成共享信息;通过通信连接向蓝牙设备发送共享信息。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第三方面,提供了一种蓝牙配对方法,应用于蓝牙设备,蓝牙设备与第一电子设备未配对,蓝牙设备与第二电子设备已配对,蓝牙配对方法包括:和第二电子设备建立蓝牙连接;接收第二电子设备发送的通知信息,通知信息用于指示蓝牙设备进入配对模式;根据通知信息进入配对模式;接收第一电子设备发送的配对请求。
一种可能的实现方式中,接收第二电子设备发送的通知信息,包括:接收第二电子设备发送的L2CAP_ECHO_REQ消息,L2CAP_ECHO_REQ消息包括通知信息;向第二电子设备发送L2CAP_ECHO_RSP消息。
一种可能的实现方式中,根据通知信息进入配对模式之后,还包括:根据配对信息生成二维码信息,配对信息包括蓝牙设备的蓝牙地址;向第三电子设备发送二维码信息。
一种可能的实现方式中,根据通知信息进入配对模式之后,还包括:根据配对信息生成二维码信息,配对信息包括蓝牙设备的蓝牙地址;显示二维码信息。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第四方面,提供了一种蓝牙配对方法,应用于第一电子设备,第一电子设备与蓝牙设 备未配对,蓝牙设备与第二电子设备已配对,蓝牙配对方法包括:从第二电子设备或蓝牙设备或第三电子设备获取配对信息,配对信息包括蓝牙设备的蓝牙地址;第三电子设备和蓝牙设备通信;根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
一种可能的实现方式中,从第二电子设备获取配对信息,包括:扫描第二电子设备显示的二维码信息,二维码信息为第二电子设备根据配对信息生成的;解析二维码信息,获得配对信息。
一种可能的实现方式中,从第二电子设备获取配对信息,包括:和第二电子设备建立通信连接;通过通信连接从第二电子设备获取配对信息。
一种可能的实现方式中,通过通信连接从第二电子设备获取配对信息,包括:接收第二电子设备发送的共享信息;共享信息为第二电子设备根据配对信息生成的;解析共享信息,获得配对信息。
一种可能的实现方式中,通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂窝通信连接。
一种可能的实现方式中,从蓝牙设备或第三电子设备获取配对信息,包括:扫描蓝牙设备或第三电子设备显示的二维码信息,二维码信息为蓝牙设备根据配对信息生成的;解析二维码信息,获得配对信息。
第五方面,提供了一种电子设备,应用于第三电子设备,第三电子设备与蓝牙设备通信,蓝牙配对方法包括:接收蓝牙设备发送的二维码信息,二维码信息为蓝牙设备根据配对信息生成的,配对信息包括蓝牙设备的蓝牙地址;显示二维码信息。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第六方面,提供了一种电子设备,作为第二电子设备,第二电子设备与蓝牙设备已配对,第二电子设备包括:处理模块,用于和蓝牙设备建立蓝牙连接;发送模块,用于向蓝牙设备发送通知信息,通知信息用于指示蓝牙设备进入配对模式。
一种可能的实现方式中,处理模块还用于:接收用户的第一操作;发送模块,还用于响应于第一操作,向蓝牙设备发送通知信息。
一种可能的实现方式中,还包括接收模块;发送模块,用于向蓝牙设备发送L2CAP_ECHO_REQ消息,L2CAP_ECHO_REQ消息包括通知信息;接收模块,用于接收蓝牙设备发送的应L2CAP_ECHO_RSP消息。
一种可能的实现方式中,处理模块还用于:根据配对信息生成二维码信息,配对信息包括蓝牙设备的蓝牙地址;显示二维码信息。
一种可能的实现方式中,处理模块还用于:在根据配对信息生成二维码信息之前,接收用户的第二操作。
一种可能的实现方式中,处理模块还用于:和第一电子设备建立通信连接,第一电子设备和蓝牙设备未配对;发送模块,还用于通过通信连接向蓝牙设备发送配对信息,配对信息包括蓝牙设备的蓝牙地址。
一种可能的实现方式中,处理模块还用于:在和第一电子设备建立通信连接之前,接收用户的第三操作。
一种可能的实现方式中,通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂 窝通信连接。
一种可能的实现方式中,处理模块,还用于根据配对信息生成共享信息;发送模块,用于通过通信连接向蓝牙设备发送共享信息。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第七方面,提供了一种蓝牙设备,蓝牙设备与第一电子设备未配对,蓝牙设备与第二电子设备已配对,蓝牙设备包括:处理模块,用于和第二电子设备建立蓝牙连接;接收模块,用于接收第二电子设备发送的通知信息,通知信息用于指示蓝牙设备进入配对模式;处理模块,还用于根据通知信息进入配对模式;接收模块,还用于接收第一电子设备发送的配对请求。
一种可能的实现方式中,还包括发送模块;接收模块,用于接收第二电子设备发送的L2CAP_ECHO_REQ消息,L2CAP_ECHO_REQ消息包括通知信息;发送模块,用于向第二电子设备发送L2CAP_ECHO_RSP消息。
一种可能的实现方式中,还包括发送模块;处理模块,还用于在根据通知信息进入配对模式之后,根据配对信息生成二维码信息,配对信息包括蓝牙设备的蓝牙地址;发送模块,用于向第三电子设备发送二维码信息。
一种可能的实现方式中,处理模块还用于:在根据通知信息进入配对模式之后,根据配对信息生成二维码信息,配对信息包括蓝牙设备的蓝牙地址;显示二维码信息。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第八方面,提供了一种电子设备,作为第一电子设备,第一电子设备与蓝牙设备未配对,蓝牙设备与第二电子设备已配对,第一电子设备包括:处理模块,用于从第二电子设备或蓝牙设备或第三电子设备获取配对信息,配对信息包括蓝牙设备的蓝牙地址;第三电子设备和蓝牙设备通信;发送模块,用于根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
一种可能的实现方式中,处理模块具体用于:扫描第二电子设备显示的二维码信息,二维码信息为第二电子设备根据配对信息生成的;解析二维码信息,获得配对信息。
一种可能的实现方式中,处理模块用于:和第二电子设备建立通信连接;通过通信连接从第二电子设备获取配对信息。
一种可能的实现方式中,还包括接收模块;接收模块,用于接收第二电子设备发送的共享信息;共享信息为第二电子设备根据配对信息生成的;处理模块,用于解析共享信息,获得配对信息。
一种可能的实现方式中,通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂窝通信连接。
一种可能的实现方式中,处理模块用于:扫描蓝牙设备或第三电子设备显示的二维码信息,二维码信息为蓝牙设备根据配对信息生成的;解析二维码信息,获得配对信息。
第九方面,提供了一种电子设备,作为第三电子设备,第三电子设备与蓝牙设备通信,第三电子设备包括:接收模块,用于接收蓝牙设备发送的二维码信息,二维码信息为蓝牙设备根据配对信息生成的,配对信息包括蓝牙设备的蓝牙地址;处理模块,用于显示二维码信息。
一种可能的实现方式中,配对信息还包括蓝牙设备的能力信息。
第十方面,提供一种电子设备,作为第二电子设备,电子设备包括处理器,处理器用于与存储器耦合,并读取存储器中的指令并根据指令使得电子设备执行第二方面提供的方法。
第十一方面,提供一种蓝牙设备,蓝牙设备包括处理器,处理器用于与存储器耦合,并读取存储器中的指令并根据指令使得蓝牙设备执行第三方面提供的方法。
第十二方面,提供一种电子设备,作为第一电子设备,电子设备包括处理器,处理器用于与存储器耦合,并读取存储器中的指令并根据指令使得电子设备执行第四方面提供的方法。
第十三方面,提供一种电子设备,作为第三电子设备,电子设备包括处理器,处理器用于与存储器耦合,并读取存储器中的指令并根据指令使得电子设备执行第五方面提供的方法。
第十四方面,提供一种通信***,通信***包括第十方面提供的第二电子设备、第十一方面提供的蓝牙设备和第十二方面提供的第一电子设备。
一种可能的实现方式中,通信***还包括第十三方面提供的第三电子设备。
第十五方面,提供一种程序,该程序在被处理器执行时用于执行第一方面、第二方面、第三方面、第四方面或第五方面提供的方法。
第十六方面,提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,当指令在计算机或处理器上运行时,实现第一方面、第二方面、第三方面、第四方面或第五方面提供的方法。
第十七方面,提供一种程序产品,所述程序产品包括计算机程序,所述计算机程序存储在可读存储介质中,设备的至少一个处理器可以从所述可读存储介质读取所述计算机程序,所述至少一个处理器执行所述计算机程序使得该设备实施第一方面、第二方面、第三方面、第四方面或第五方面提供的方法。
图1为蓝牙通信的一种场景示意图;
图2为图1中蓝牙设备与电子设备在配对过程中的一种消息交互图;
图3A~图3B为用户操作蓝牙设备进入配对模式的示意图;
图4A~图4C为电子设备开启蓝牙功能后的一组界面示意图;
图5为本申请实施例适用的蓝牙通信的一种场景示意图;
图6为本申请实施例提供的蓝牙配对方法的一种消息交互图;
图7A~图7F为第二电子设备的一组界面示意图;
图8A~图8F为第二电子设备的另一组界面示意图;
图9为本申请实施例提供的第二电子设备发送通知信息的一种消息交互图;
图10A为本申请实施例提供的L2CAP_ECHO_REQ消息对应的数据包的格式示意图;
图10B为本申请实施例提供的L2CAP_ECHO_RSP消息对应的数据包的格式示意图;
图11为本申请实施例提供的第一电子设备获取配置信息的一种消息交互图;
图12为本申请实施例提供的蓝牙配对方法的另一种消息交互图;
图13为本申请实施例提供的第一电子设备获取配置信息的另一种消息交互图;
图14为本申请实施例提供的蓝牙配对方法的又一种消息交互图;
图15为本申请实施例提供的第一电子设备获取配置信息的又一种消息交互图;
图16为本申请实施例提供的蓝牙配对方法的又一种消息交互图;
图17为本申请实施例提供的第一电子设备获取配置信息的又一种消息交互图;
图18为本申请实施例提供的设备的一种结构示意图;
图19为本申请实施例提供的设备的另一种结构示意图;
图20为本申请实施例提供的设备的又一种结构示意图。
下面结合附图描述本申请实施例。
本申请实施例提供的蓝牙配对方法,适用于蓝牙通信中设备间的配对过程。首先,对配对过程进行介绍。
在蓝牙通信中,两个设备初次进行蓝牙通信之前,需要首先进行配对过程。两个设备在完成配对之后,设备中存储有蓝牙地址(bluetooth device address,BD_ADDR)、密钥等信息,从而可以进行蓝牙通信。后续,如果两个设备中存储的蓝牙地址、密钥等信息没有被清空,当再次进行蓝牙通信时,两个设备之间可以根据蓝牙地址发送蓝牙连接请求,不需要再次进行配对过程。
示例性的,图1为蓝牙通信的一种场景示意图。如图1所示,电子设备100和蓝牙设备200均支持蓝牙功能,电子设备100和蓝牙设备200可以进行蓝牙通信。
其中,对电子设备100和蓝牙设备200的类型和名称不做限定。例如,一些电子设备的举例为:手机、平板电脑、笔记本电脑、掌上电脑、可穿戴设备、智慧屏、教学设备、物联网(internet of things,IOT)设备、或智慧家庭(smart home)中的无线终端等。可选的,电子设备100具有显示屏。一些蓝牙设备的举例为:蓝牙耳机、蓝牙音箱、蓝牙手写笔等。
为了方便说明,本申请实施例以电子设备100为手机、蓝牙设备200为蓝牙耳机为例进行说明。
下面,对配对过程中的消息流程进行说明。为了便于理解,配对过程可以包括发现设备阶段和配对阶段。在发现设备阶段,电子设备能够发现可配对的蓝牙设备,与蓝牙设备交互配对阶段所需的相关信息,例如,蓝牙设备的蓝牙地址。在配对阶段,电子设备和蓝牙设备可以交换密钥等信息,用于后续的蓝牙通信。
图2为图1中蓝牙设备与电子设备在配对过程中的一种消息交互图。如图2所示,蓝牙通信中设备间的配对过程可以包括:
S21、蓝牙设备响应于用户对蓝牙设备的操作,进入配对模式。
具体的,用户需要操作蓝牙设备,使得蓝牙设备进入配对模式。蓝牙设备处于配对模式时,可以搜索电子设备发送的查询请求(inquiry request),并向电子设备回复查询响应(inquiry response),从而使得电子设备发现蓝牙设备。其中,蓝牙设备的使用状态不同时,用户对蓝牙设备的操作可以不同。
可选的,在一种实现方式中,为蓝牙耳机首次开盒使用的场景。如图3A中左侧所示, 蓝牙耳机包括盒盖201和盒体202。蓝牙耳机在出厂后从未开盒使用过。如图3A中右侧所示,当蓝牙耳机第一次开盒使用时,可以触发蓝牙耳机进入配对模式。相应的,蓝牙耳机响应于用户的操作,进入配对模式。
可选的,在另一种实现方式中,为蓝牙耳机非首次使用的场景。如图3B中左侧所示,蓝牙耳机已经开盒使用过,与至少一个电子设备进行过蓝牙通信。如图3B中右侧所示,当蓝牙耳机需要与从未配对的电子设备进行蓝牙通信时,或者,与历史上配对过但需要重新配对的电子设备进行蓝牙通信时,用户可以按压盒体202上的物理按键203,触发蓝牙耳机进入配对模式。相应的,蓝牙耳机响应于用户按压物理按键203的操作,进入配对模式。
需要说明,本申请实施例对配对模式的名称不做限定。例如,配对模式也可以称为配对状态或查询扫描(inquiry scan)状态。
S22、电子设备发送查询请求(inquiry request)。相应的,电子设备周围处于配对模式的蓝牙设备可以对查询请求进行扫描,接收查询请求。
具体的,电子设备打开蓝牙功能后,可以进入查询(inquiry)状态,向周围的设备发送查询请求。相应的,如果周围的蓝牙设备处于配对模式,则可以对查询请求进行扫描,并向电子设备回复查询响应(inquiry response),从而使得电子设备发现蓝牙设备。
其中,对S21和S22的执行顺序不做限定。例如,用户先通过按压蓝牙耳机盒上的物理按键触发蓝牙耳机进入配对模式,然后,电子设备打开蓝牙功能,即,先执行S21再执行S22。又例如,电子设备先打开蓝牙功能,然后,用户首次开盒使用蓝牙耳机触发蓝牙耳机进入配对模式,即,先执行S22再执行S21。
其中,查询请求中包括电子设备的蓝牙地址,蓝牙地址可以参见蓝牙协议中的相关内容,此处不再赘述。
可选的,电子设备可以按照第一周期发送查询请求。可选的,处于配对模式的蓝牙设备可以按照第二周期扫描查询请求。可选的,第一周期和第二周期可以相同,也可以不同。
S23、蓝牙设备向电子设备发送查询响应(inquiry response)。相应的,电子设备接收蓝牙设备发送的查询响应。
其中,查询响应中包括蓝牙设备的蓝牙地址。
具体的,当处于配对模式的蓝牙设备扫描到电子设备发送的查询请求后,可以根据查询请求中电子设备的蓝牙地址向电子设备返回查询响应,从而,电子设备可以发现蓝牙设备,并继续与电子设备进行后续的配对过程。
需要说明,发现设备阶段包括但不限于S21~S23。例如,在发现设备阶段,电子设备和蓝牙设备还可以通过消息的交互获取下列信息中的至少一项:蓝牙设备的设备名称、电子设备的设备支持特性(device supported feature)信息、蓝牙设备的设备支持特性信息。其中,设备支持特性信息也可以称为能力信息,可以参考蓝牙协议中有关设备特性(device feature)的内容,此处不再赘述。
通过发现设备阶段,电子设备可以发现周围可配对的蓝牙设备。示例性的,图4A示出了电子设备在发现设备阶段的一种界面示意图。如图4A所示,手机的蓝牙主界面40中包括蓝牙功能的开关控件41、开放检测的开关控件42、“设备名称”选项卡43、“接收的文件”选项卡44、已配对的设备45和可用设备46。通过“设备名称”选项卡43可知, 手机的名称为“手机2”。已配对的设备45显示有手机2历史上成功配对的设备,例如,手机1。可用设备46显示有手机2发现的当前可配对的设备,例如,蓝牙耳机。如图4A所示,用户可以点击可用设备46中的蓝牙耳机,进行手机2与蓝牙耳机的配对。相应的,手机2响应于用户的操作,开始配对过程中的配对阶段。
可选的,手机2与蓝牙耳机在配对之前,还可以显示提示信息。示例性的,用户点击图4A中的可用设备46中的蓝牙耳机后,蓝牙主界面40的变化可以参见图4B。如图4B所示,手机2在蓝牙主界面40中弹出配对弹窗47。用户通过查看配对弹窗47中的提示信息进行操作。例如,提示信息包括:“要与以下设备配对:蓝牙耳机”。配对弹窗47中还包括取消按键和配对按键。用户可以点击配对按键48,使得手机2与蓝牙耳机配对。相应的,手机2响应于用户点击配对按键48的操作,执行配对阶段的消息流程,具体参见S24。
S24、电子设备向蓝牙设备发送配对请求(pairing request)。相应的,蓝牙设备接收电子设备发送的配对请求。
S25、蓝牙设备向电子设备发送配对响应(pairing response)。相应的,电子设备接收蓝牙设备发送的配对响应。
具体的,在配对阶段,电子设备可以根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求,蓝牙设备可以根据电子设备的蓝牙地址向电子设备发送配对响应,配对请求和配对响应用于交换配置信息,配置信息用于确定配对方式和分配密钥。
可选的,配置信息可以包括电子设备的输入输出能力。不同电子设备的类型不同、硬件配置不同,输入输出能力不同。例如,输入输出能力可以指示下列中的至少一项:电子设备是否可以输入、电子设备可以输入时的输入方式、电子设备是否可以显示,等等。可选的,电子设备的输入输出能力可以包括下列中的任意一种:无输入无输出、仅有显示屏、具有显示屏并可以选择“是/否”、仅有键盘、具有键盘和显示屏。
需要说明,配对阶段包括但不限于S24~S25。例如,在配对阶段,还需要确定电子设备和蓝牙设备的配对算法、建立加密链路、传输密钥等,可以参见蓝牙协议中关于配对认证的内容,此处不再赘述。
电子设备和蓝牙设备完成配对后,设备中存储了密钥等信息,电子设备和蓝牙设备后续可以进行蓝牙通信。示例性的,图4C示出了电子设备和蓝牙设备完成配对后电子设备的一种界面示意图。相比于图4A,如图4C所示,在蓝牙主界面40中,已配对的设备45中包括手机1和蓝牙耳机,说明手机2和蓝牙耳机已经完成配对,后续可以进行蓝牙通信。
S26、电子设备与蓝牙设备完成配对后,可以建立蓝牙连接,进行业务。
其中,本申请实施例对业务的类型不做限定。例如,通话业务和音频业务。可选的,通话业务包括但不限于:语音通话或视频通话;音频业务包括但不限于:播放音乐、提示音、导航音、闹钟、游戏、视频等。
通过图2所示的配对过程的消息流程,可知,蓝牙设备与电子设备配对时,需要蓝牙设备处于配对模式,从而,蓝牙设备可以扫描电子设备发送的查询请求并回复查询响应。相应的,电子设备发现可配对的蓝牙设备,从蓝牙设备发送的查询响应中获取蓝牙设备的蓝牙地址,后续,可以根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求,继续配对过程。
目前,控制蓝牙耳机进入配对模式需要用户对蓝牙耳机进行操作。蓝牙设备首次使用时,用户开盒触发蓝牙耳机进入配对模式。蓝牙耳机的首次使用仅有一次,在大部分的应 用场景中,蓝牙设备都为已使用状态,此时,需要用户手动操作蓝牙耳机盒上的物理按键才能让蓝牙耳机进入配对模式。但是,很多用户并不清楚这个操作,导致非首次使用的蓝牙耳机无法进入配对模式,无法与电子设备完成配对过程,因此也无法进行后续的蓝牙通信和业务,严重影响了用户对蓝牙耳机的使用感受。
本申请实施例提供了一种蓝牙配对方法,借助于除了电子设备和蓝牙设备之外的第三方设备,通过第三方设备可以控制蓝牙设备进入配对模式,避免了用户必须对蓝牙设备进行操作才能触发蓝牙设备进入配对模式,消除了用户操作蓝牙设备的不便利性。而且,电子设备不通过向蓝牙设备发送查询请求也可以获得蓝牙设备的蓝牙地址,简化了配对过程的消息流程,提升了非首次使用的蓝牙设备与没有配对的电子设备完成配对过程的可实现性和便利性,提升了用户的使用感受。
为了方便说明,将需要与蓝牙设备配对的电子设备称为第一电子设备,将除了第一电子设备和蓝牙设备之外的第三方设备称为第二电子设备,蓝牙设备与第二电子设备历史上配对成功且未清除数据。
示例性的,图5为本申请实施例适用的蓝牙通信的一种场景示意图。如图5所示,场景中包括蓝牙设备、第一电子设备和第二电子设备。蓝牙设备与第二电子设备可以进行蓝牙通信。可选的,第一电子设备和第二电子设备可以通信,也可以不通信。可选的,第一电子设备和第二电子设备之间的通信包括但不限于下列中的至少一项:有线通信、蓝牙通信、无线保真(wireless fidelity,WiFi)通信、近场通信(near field communication,NFC)或蜂窝通信。
可选的,在图5中,场景中还可以包括第三电子设备。蓝牙设备与第三电子设备可以通信。蓝牙设备与第三电子设备之间的通信包括但不限于下列中的至少一项:有线通信、蓝牙通信、WiFi通信或NFC通信。可选的,第一电子设备和第三电子设备可以通信,也可以不通信。第一电子设备和第三电子设备之间的通信包括但不限于下列中的至少一项:有线通信、蓝牙通信、WiFi通信、NFC通信或蜂窝通信。
其中,第一电子设备、第二电子设备和第三电子设备的类型和名称可以参见图1中的电子设备100。可选的,第三电子设备还可以为用于显示蓝牙设备的相关信息的设备,例如,显示屏或显示器等。本申请实施例对第一电子设备、第二电子设备和第三电子设备的数量不做限定。
下面通过具体的实施例对本申请的技术方案进行详细说明。下面的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。
本申请实施例中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
图6为本申请实施例提供的蓝牙配对方法的一种消息交互图。本实施例提供的蓝牙配对方法,适用于图5所示场景,执行主体涉及蓝牙设备、第一电子设备和第二电子设备。可选的,执行主体还可以涉及第三电子设备。为了方便说明,在一些示例中,蓝牙设备为蓝牙耳机,第一电子设备为手机1,第二电子设备为手机2,第三电子设备为显示器3。如图6所示,本实施例提供的蓝牙配对方法,可以包括:
S61、蓝牙设备与第二电子设备建立蓝牙连接。
可选的,蓝牙连接可以包括异步连接(asynchronous connection-oriented,ACL)连接。ACL连接为蓝牙协议中物理层上的连接,可以参见蓝牙协议中的相关内容,此处不再赘述。
可选的,蓝牙连接还可以包括下列中的至少一种:同步定向连接(synchronous connection-oriented link,SCO)连接、高级音频分发规范(advanced audio distribution profile,A2DP)连接,或者,免提规范(hands-free profile,HFP)连接。其中,SCO连接为蓝牙协议中物理层上的连接,A2DP连接和HFP连接为蓝牙协议中应用层上的连接,可以参见蓝牙协议中的相关内容,此处不再赘述。
其中,本实施例对应用场景中蓝牙设备与第二电子设备建立蓝牙连接的时间不做限定。
可选的,在一种应用场景中,蓝牙设备与第二电子设备当前未建立蓝牙连接。当蓝牙设备需要与第一电子设备配对时,蓝牙设备才与第二电子设备建立蓝牙连接。例如,手机2当前没有打开蓝牙功能。当蓝牙耳机需要与手机1配对时,用户打开手机2的蓝牙功能,手机2可以与蓝牙耳机自动建立蓝牙连接。
可选的,在另一种应用场景中,当蓝牙设备需要与第一电子设备配对时,蓝牙设备与第二电子设备已经建立有蓝牙连接。例如,用户正在通过蓝牙耳机收听手机2上播放的音乐,此时,蓝牙耳机还需要与手机1配对。
S62、第二电子设备向蓝牙设备发送通知信息,通知信息用于指示蓝牙设备进入配对模式。相应的,蓝牙设备接收第二电子设备发送的通知信息。
通过第二电子设备向蓝牙设备发送通知信息,指示蓝牙设备进入配对模式,避免了用户必须在蓝牙设备上操作才能使蓝牙设备进入配对模式,避免了用户对蓝牙设备操作的不便,提升了用户使用蓝牙设备的感受。
可选的,在一种实现方式中,可以在蓝牙设备与第二电子设备建立蓝牙连接后,即触发第二电子设备向蓝牙设备发送通知信息。例如,用户希望将蓝牙耳机与手机1配对,在蓝牙耳机和手机1所在的环境中,用户通常知道环境中的第二电子设备,例如,手机2。比如,手机1和手机2均为用户1使用的手机;或者,用户1使用手机1,用户1知道用户2使用手机2。这样,当用户1需要将蓝牙耳机与手机1配对时,可以打开手机2的蓝牙功能,手机2与蓝牙耳机建立蓝牙连接,并触发手机2向蓝牙耳机发送通知信息,指示蓝牙耳机进入配对模式。
可选的,在另一种实现方式中,可以通过用户对第二电子设备进行第一操作,从而触发第二电子设备向蓝牙设备发送通知信息。
其中,本实施例对用户对第二电子设备的第一操作不做限定。例如,用户的第一操作可以为下列中的任意一种:用户在第二电子设备显示的相关界面上进行的触控操作、用户在第二电子设备的显示屏上进行的手势操作、用户对第二电子设备上的物理按键进行的操作、用户通过第二电子设备的麦克风输入语音,或者,用户通过第二电子设备的摄像头输入图像。可选的,第二电子设备可以安装有用于管理蓝牙设备的应用程序(application,APP),本实施例对APP的名称和功能不做限定,对APP的相关界面中的内容和布局不做限定。
下面通过示例进行说明。
可选的,在一个示例中,如图7A所示,手机2当前运行***应用程序,显示***应用程序中的蓝牙主界面70。通过蓝牙主界面70中的已配对的设备71可知,当前,手机2 与手机1和蓝牙耳机均已进行了蓝牙连接。用户可以点击已配对的设备71中的蓝牙耳机,触发手机2向蓝牙耳机发送通知信息。相应的,手机2响应于用户的操作,向蓝牙耳机发送通知信息。
可选的,蓝牙主界面70中包括用于引导用户进行第一操作的提示信息。例如,在图7A中,蓝牙耳机的下方有提示信息“点击蓝牙耳机进入配对模式”。
可选的,第二电子设备向蓝牙设备发送通知信息之前,可以向用户显示提示信息。示例性的,如图7A所示,用户点击已配对的设备71中的蓝牙耳机,触发手机2向蓝牙耳机发送通知信息。相应的,如图7B所示,手机2响应于用户的操作,在蓝牙主界面70中弹出弹窗72。用户通过查看弹窗72中的提示信息进行操作。例如,提示信息包括:“蓝牙耳机进入配对模式”。弹窗72中还包括取消按键和确定按键。用户可以点击确定按键73,触发手机2向蓝牙耳机发送通知信息。相应的,手机2响应于用户点击确定按键73的操作,向蓝牙耳机发送通知信息,指示蓝牙耳机进入配对模式。
可选的,在另一个示例中,图8A示出了手机2的另一种界面图。图8A和图7A的区别在于:在图7A中,手机2运行***应用程序,显示***应用程序中的蓝牙主界面70;而在图8A中,手机2运行第三方应用程序,第三方应用程序用于管理与手机2通信的其他设备。本申请实施例对第三方应用程序的名称、功能和界面布局不做限定。例如,如图8A所示,手机2当前显示第三方应用程序中的“我的设备”界面80,与手机2通信的设备包括:门锁001、蓝牙耳机、家里的网关1和手机1。界面80中蓝牙耳机的右侧有按钮85。用户可以点击按钮85触发手机2向蓝牙耳机发送通知信息。相应的,手机2响应于用户的操作,在界面80中弹出弹窗81,参见图8B。弹窗81可以参见图7B中的弹窗72,原理相似,此处不再赘述。可选的,界面80中包括用于引导用户进行第一操作的提示信息。例如,在图8A中,蓝牙耳机的下方有提示信息“点击右侧按钮,蓝牙耳机进入配对模式”。
需要说明,图7A~图7B、图8A~图8B仅是示例,并不对相关界面和用户的第一操作形成限定。例如,在图7A或图8A中,可以通过用户的相关操作进入蓝牙耳机的设置界面,通过在设置界面中进行第一操作,触发手机2向蓝牙耳机发送通知信息。
可选的,通知信息可以携带在蓝牙协议中定义的交互消息中,也可以携带在第二电子设备和蓝牙设备之间定义的私有消息中,本实施例对消息的名称和通知信息在消息中的携带方式不作限定。
可选的,第二电子设备可以通过逻辑链路控制和适配协议(logical link control and adaptation layer protocol,L2CAP)的回声(echo或Echo或ECHO)通道发送通知信息。ECHO协议可以参考蓝牙协议的CORE Host(核心主机)章节,例如,PartA 4.8节。
示例性的,图9为本申请实施例提供的第二电子设备发送通知信息的一种消息交互图。如图9所示,第二电子设备向蓝牙设备发送通知信息,可以包括:
S91、第二电子设备向蓝牙设备发送L2CAP_ECHO_REQ(逻辑链路控制和适配协议回声请求)消息,L2CAP_ECHO_REQ消息中包括通知信息。相应的,蓝牙设备接收第二电子设备发送的L2CAP_ECHO_REQ消息。
S92、蓝牙设备向第二电子设备向发送L2CAP_ECHO_RSP(逻辑链路控制和适配协议回声响应)消息,L2CAP_ECHO_RSP消息用于指示蓝牙设备接收到L2CAP_ECHO_REQ 消息。
具体的,在ECHO协议中,回声请求(Echo request或ECHO_REQ或L2CAP_ECHO_REQ)通常用于从远程L2CAP实体请求响应,回声请求可以用于测试链路或利用可选的数据字段传输特定信息。L2CAP实体接收到有效的回声请求数据包后,使用回声响应(Echo response或ECHO_RSP或L2CAP_ECHO_RSP)数据包进行应答。在本实施例中,特定信息为通知信息。
示例性的,图10A为本申请实施例提供的L2CAP_ECHO_REQ消息对应的数据包的格式示意图,图10B为本申请实施例提供的L2CAP_ECHO_RSP消息对应的数据包的格式示意图。如图10A所示,L2CAP_ECHO_REQ消息对应的数据包(Packet)的左侧为最低有效位(least significant bit,LSB),右侧为最高有效位(most significant bit,MSB),数据包包括:编码(Code)字段、标识符(Identifier)字段、长度(Length)字段和数据(Data)字段。其中,数据字段为可选字段。ECHO协议提供的数据包中,可以在可选的数据字段中携带自定义信息。在本实施例中,可以在数据字段中携带通知信息。图10B所示的L2CAP_ECHO_RSP消息对应的数据包的格式与图10A所示的L2CAP_ECHO_REQ消息对应的数据包的格式相似,其中,L2CAP_ECHO_RSP消息和L2CAP_ECHO_REQ消息中的标识符字段匹配,编码字段匹配。例如,图10A和图10B中的标识符字段的取值相同。例如,图10A中的编码字段取值为0x08,图10B中的编码字段取值为0x09。
S63、蓝牙设备根据通知信息进入配对模式。
S64、第一电子设备从第二电子设备或蓝牙设备或第三电子设备获取配对信息,配对信息包括蓝牙设备的蓝牙地址。
可选的,在第一种实现方式中,由于蓝牙设备和第二电子设备已经配对成功,第二电子设备存储有蓝牙设备的蓝牙地址,第一电子设备可以从第二电子设备获取蓝牙设备的蓝牙地址。
在该实现方式中,由第二电子设备通知蓝牙设备进入配对模式,并且,由第二电子设备向第一电子设备提供配对信息,第一电子设备和蓝牙设备配对只借助于第二电子设备,涉及的设备数量少,处理步骤少,实现方式简单。
可选的,第一电子设备和第二电子设备可以进行有线通信或者无线通信,通过第一电子设备和第二电子设备之间的通信连接,第二电子设备向第一电子设备发送配对信息,相应的,第一电子设备接收第二电子设备发送的配对信息。可选的,无线通信包括但不限于下列中的任意一种:蓝牙通信、WiFi通信、NFC通信或蜂窝通信。
可选的,第一电子设备和第二电子设备没有通信,第二电子设备显示可视化形式的配对信息,第一电子设备通过扫描可视化形式的配对信息或者对可视化形式的配对信息进行拍照,对可视化形式的配对信息进行处理从而获得配对信息。可选的,可视化形式的配对信息为根据配对信息生成的,例如,包括但不限于下列中的任意一项:二维码或条形码。
可选的,在第二种实现方式中,第三电子设备可以获取配对信息,第一电子设备可以从第三电子设备获取配对信息。本实施例对第三电子设备获取配对信息的方式不做限定。例如,蓝牙设备和第三电子设备可以进行蓝牙通信,第三电子设备存储有蓝牙设备的蓝牙地址等配对信息。又例如,蓝牙设备可以向第三电子设备发送配对信息。可选的,为了提高配对信息的安全性,蓝牙设备可以在接收到第二电子设备发送的通知信息后,再向第三 电子设备发送配对信息。
在该实现方式中,由第二电子设备通知蓝牙设备进入配对模式,由第三电子设备向第一电子设备提供配对信息,第一电子设备和蓝牙设备配对时需要借助于第二电子设备和第三电子设备,实现方式灵活。
可选的,第一电子设备和第三电子设备可以进行有线通信或者无线通信,通过第一电子设备和第三电子设备之间的通信连接,第三电子设备向第一电子设备发送配对信息,相应的,第一电子设备接收第三电子设备发送的配对信息。可选的,无线通信包括但不限于下列中的任意一种:蓝牙通信、WiFi通信、NFC通信或蜂窝通信。
可选的,第一电子设备和第三电子设备没有通信,第三电子设备显示可视化形式的配对信息,第一电子设备通过扫描可视化形式的配对信息或者对可视化形式的配对信息进行拍照,对可视化形式的配对信息进行处理,可以获得配对信息。可选的,可视化形式的配对信息为根据配对信息生成的,例如,包括但不限于下列中的任意一项:二维码或条形码。
可选的,第三电子设备为蓝牙设备的外接显示设备。蓝牙设备接收第二电子设备发送的通知信息进入配对模式后,根据配对信息生成可视化形式的配对信息,并向第三电子设备发送可视化形式的配对信息。相应的,第三电子设备接收蓝牙设备发送的可视化形式的配对信息,并显示。
可选的,在第三种实现方式中,第一电子设备可以从蓝牙设备获取配对信息。在该实现方式中,蓝牙设备可以具有显示屏,蓝牙设备接收第二电子设备发送的通知信息进入配对模式后,可以根据配对信息生成可视化形式的配对信息,并显示。相应的,第一电子设备通过扫描可视化形式的配对信息或者对可视化形式的配对信息进行拍照,对可视化形式的配对信息进行处理,可以获得配对信息。可选的,可视化形式的配对信息包括但不限于下列中的任意一项:二维码或条形码。
在该实现方式中,由第二电子设备通知蓝牙设备进入配对模式,由蓝牙设备向第一电子设备提供配对信息,第一电子设备和蓝牙设备配对只借助于第二电子设备,涉及的设备数量少,实现方式简单。
需要说明,本实施例不限定S62~S63和S64之间的执行顺序。例如,先执行S62,第二电子设备通知蓝牙设备进入配对模式,之后再执行S64,第一电子设备可以获取配对信息。又例如,先执行S64,第一电子设备可以获取配对信息,之后再执行S62,第二电子设备通知蓝牙设备进入配对模式。又例如,S62和S64可以同时执行。
S65、第一电子设备根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求。相应的,蓝牙设备接收第一电子设备发送的配对请求。
S66、蓝牙设备向第一电子设备发送配对响应。相应的,第一电子设备接收蓝牙设备发送的配对响应。
其中,配对请求和配对响应可以分别参见图2中S24和S25的说明,此处不再赘述。
可见,本实施例提供的蓝牙配对方法,应用环境中包括蓝牙设备、已经与蓝牙设备成功配对的第二电子设备和需要与蓝牙设备配对的第一电子设备。蓝牙设备与第二电子设备建立蓝牙连接后,第二电子设备向蓝牙设备发送通知信息,指示蓝牙设备进入配对模式。而且,第一电子设备可以从第二电子设备或蓝牙设备或应用环境中的其他设备获取配对信息,从而,第一电子设备和蓝牙设备可以根据配对信息完成配对。本实施例提供的蓝牙配 对方法,借助于除了第一电子设备和蓝牙设备之外的第二电子设备通知蓝牙设备进入配对模式,避免了用户必须对蓝牙设备进行操作才能触发蓝牙设备进入配对模式,消除了用户操作蓝牙设备的不便利性。而且,相比于现有的配对过程,第一电子设备不需要在蓝牙设备处于配对模式时通过向蓝牙设备发送查询请求也可以获取蓝牙设备的蓝牙地址,简化了配对过程的消息流程,提升了非首次使用的蓝牙设备与没有配对的第一电子设备完成配对过程的可实现性和便利性,提升了用户使用蓝牙耳机的感受。
可选的,S64中,配对信息还可以包括蓝牙设备的能力信息。
通过获取蓝牙设备的能力信息,有利于后续第一电子设备和蓝牙设备的配对,提高了第一电子设备和蓝牙设备配对的准确性和适配性。
其中,能力信息可以参见图2中关于设备支持特性信息的说明,此处不再赘述。
可选的,能力信息还可以指示蓝牙设备支持通过接收第二电子设备发送的通知信息进入配对模式的能力。
需要说明,本实施例对S64中第一电子设备获取蓝牙设备的蓝牙地址和能力信息的顺序不做限定。可选的,在第一种实现方式中,第一电子设备可以同时获取蓝牙设备的蓝牙地址和能力信息。可选的,在该种实现方式中,如果第一电子设备通过扫描可视化形式的配对信息的方式获取配对信息,可视化形式的配对信息为根据蓝牙设备的蓝牙地址和能力信息生成的。可选的,在第二种实现方式中,第一电子设备可以先获取蓝牙设备的蓝牙地址,再获取蓝牙设备的能力信息。可选的,在第三种实现方式中,第一电子设备可以先获取蓝牙设备的能力信息,再获取蓝牙设备的蓝牙地址。可选的,若第一电子设备通过与第二电子设备或第三电子设备进行消息交互获取蓝牙设备的蓝牙地址和能力信息,那么,蓝牙地址和能力信息可以携带在一条交互消息中,也可以分别携带在不同的交互消息中。
可选的,S65中,第一电子设备根据蓝牙设备的蓝牙地址向蓝牙设备发送配对请求,可以包括:
第一电子设备根据蓝牙设备的蓝牙地址和能力信息,向蓝牙设备发送配对请求。
通过蓝牙设备的蓝牙地址和能力信息进行第一电子设备与蓝牙设备的配对,提高了第一电子设备和蓝牙设备配对的准确性和适配性。
下面,基于图6所示的实施例,提供S64中第一电子设备从第二电子设备或蓝牙设备或第三电子设备获取配对信息的具体实施方式。为了方便说明,以配对信息包括蓝牙设备的蓝牙地址和能力信息为示例。
可选的,在一个实施例中,在S64中,第一电子设备通过扫描第二电子设备显示的可视化形式的配对信息的方式获取配对信息。为了方便说明,可视化形式的配对信息为二维码信息。如图11所示,S64中,第一电子设备从第二电子设备获取配对信息,可以包括:
S111、第二电子设备根据蓝牙设备的蓝牙地址和能力信息生成二维码信息。
具体的,第二电子设备和蓝牙设备进行蓝牙通信,存储有蓝牙设备的蓝牙地址和能力信息。第二电子设备可以根据蓝牙设备的蓝牙地址和能力信息生成二维码信息,以便后续提供给第一电子设备。其中,生成二维码信息可以采用现有算法,本实施例不做详细说明。
其中,S111在S61之后执行,但并不限定S111和S62~S63之间的执行顺序。
可选的,在第一种实现方式中,S111在S62之前执行,并且,S61中蓝牙设备与第二 电子设备建立蓝牙连接之后,即触发第二电子设备执行S111。例如,用户使用手机1和手机2,手机2与蓝牙耳机成功配对过,手机1从未与蓝牙耳机配对。这样,当用户需要将蓝牙耳机与手机1配对时,可以打开手机2的蓝牙功能,手机2与蓝牙耳机建立蓝牙连接,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。
可选的,在第二种实现方式中,S111在S62之前执行,并且,通过用户对第二电子设备进行第二操作,从而触发第二电子设备执行S111。
示例性的,如图7A所示,手机2当前运行***应用程序,显示***应用程序中的蓝牙主界面70。通过蓝牙主界面70中的已配对的设备71可知,手机2与手机1和蓝牙耳机均已进行了蓝牙连接。用户可以点击已配对的设备71中的蓝牙耳机,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。相应的,手机2响应于用户的操作,生成二维码信息。
可选的,蓝牙主界面70中包括用于引导用户进行第二操作的提示信息。例如,可以显示提示信息“点击蓝牙耳机分享蓝牙耳机的配对信息”。
可选的,第二电子设备根据蓝牙设备的蓝牙地址和能力信息生成二维码信息之前,可以向用户显示提示信息。
示例性的,在一个示例中,如图7A所示,用户点击已配对的设备71中的蓝牙耳机。相应的,如图7C所示,手机2响应于用户的操作,在蓝牙主界面70中弹出弹窗74。用户通过查看弹窗74中的提示信息进行操作。例如,提示信息包括:“显示蓝牙耳机的配对信息”。弹窗74中还包括取消按键和确定按键。用户可以点击确定按键,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。相应的,手机2响应于用户点击确定按键的操作,根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。
示例性的,在另一个示例中,如图7A所示,用户点击已配对的设备71中的蓝牙耳机。相应的,如图7D所示,手机2响应于用户的操作,在蓝牙主界面70中弹出弹窗75。用户通过查看弹窗75中的提示信息进行操作。例如,提示信息包括:“共享蓝牙耳机的配对信息”。弹窗75中包括多种配对信息的共享方式,例如,显示二维码、蓝牙分享、WiFi分享和网络分享。其中,蓝牙分享是指通过手机2和手机1之间的蓝牙通信向手机1提供配对信息,WiFi分享是指通过手机2和手机1之间的WiFi通信向手机1提供配对信息,网络分享是指通过手机2和手机1之间的蜂窝通信向手机1提供配对信息。弹窗75中还包括取消按键和确定按键,用于取消分享配对信息和确认分享配对信息。用户可以点击显示二维码方式的选择控件76,选择二维码的分享方式。如图7E所示,选择控件76的显示状态发生改变,用户继续点击确定按键,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。相应的,手机2响应于用户的操作,根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。
可选的,第二操作和第一操作可以为同一操作。例如,如图7A所示,用户在蓝牙主界面70中点击已配对的设备71中的蓝牙耳机,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息,同时,触发手机2向蓝牙耳机发送通知信息。又例如,如图7B所示,用户在弹窗72中点击确定按键73,触发手机2向蓝牙耳机发送通知信息,同时,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息。又例如,如图7C所示,用户在弹窗74中点击确定按键,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二 维码信息,同时,触发手机2向蓝牙耳机发送通知信息。又例如,如图7E所示,用户在弹窗75中选中选择控件76,并点击确定按键,触发手机2根据蓝牙耳机的蓝牙地址和能力信息生成二维码信息,同时,触发手机2向蓝牙耳机发送通知信息。
可选的,在第三种实现方式中,S111在S62之后执行,并且,S62中第二电子设备向蓝牙设备发送通知信息之后,即触发第二电子设备执行S111。
可选的,在第四种实现方式中,S111在S62之后执行,并且,通过用户对第二电子设备进行第二操作,从而触发第二电子设备执行S111。
需要说明,图7A~图7E仅是示例,并不对用户对第二电子设备的第二操作形成限定。例如,用户的第二操作可以为下列中的任意一种:用户在第二电子设备显示的相关界面上进行的触控操作、用户在第二电子设备的显示屏上进行的手势操作、用户对第二电子设备上的物理按键进行的操作、用户通过第二电子设备的麦克风输入语音,或者,用户通过第二电子设备的摄像头输入图像。可选的,第二电子设备可以安装有用于管理蓝牙设备的APP,本实施例对APP的名称和功能不做限定,对APP的相关界面中的内容和布局不做限定。
S112、第二电子设备显示二维码信息。
其中,本实施例对第二电子设备显示二维码信息的界面和界面布局不做限定。
示例性的,在一个示例中,如图7F所示,手机2当前运行***应用程序,显示***应用程序中的蓝牙主界面70。蓝牙主界面70中包括二维码界面77。二维码界面77中包括二维码信息和提示信息。二维码信息为手机2根据蓝牙耳机的蓝牙地址和能力信息生成的。提示信息包括:“请扫描二维码”。用户通过查看二维码界面77中的提示信息进行操作,例如,使用手机1扫描二维码信息,从而,手机1可以获取到蓝牙耳机的配对信息。
可选的,在另一个示例中,如图8C所示。图8C和图7F的区别在于:在图7F中,手机2运行***应用程序,显示***应用程序中的蓝牙主界面70;而在图8C中,手机2运行第三方应用程序,第三方应用程序用于管理与手机2通信的其他设备,手机2当前显示第三方应用程序中的“我的设备”界面80,界面80中包括二维码界面82。二维码界面82可以参见图7F中的二维码界面77,原理相似,此处不再赘述。
S113、第一电子设备扫描第二电子设备显示的二维码信息。
其中,本实施例对第一电子设备运行扫描功能的过程不做限定,例如,第一电子设备可以运行具有扫描功能的APP,通过与用户之间的人机互动启动扫描功能。
S114、第一电子设备解析二维码信息,获得蓝牙设备的蓝牙地址和能力信息。
可见,本实施例提供的蓝牙配对方法,第一电子设备从第二电子设备获取蓝牙设备的配对信息。由于第二电子设备和蓝牙耳机进行蓝牙通信,第二电子设备中存储有蓝牙设备的蓝牙地址和能力信息,不需要通过额外的方式获取。第二电子设备根据蓝牙设备的配对信息生成可视化形式的配对信息并显示。第一电子设备不需要与第二电子设备进行通信,通过扫描或拍照等方式可以获取可视化形式的配对信息,进而获得配对信息。本实施例提供的蓝牙配对方法,第一电子设备从第二电子设备获得配对信息,涉及的设备数量少,处理步骤少,实现方式简单。
示例性的,以蓝牙设备为蓝牙耳机、第一电子设备为手机1、第二电子设备为手机2为例,结合图12对本实施例提供的蓝牙配对方法的流程进行示例性说明。
如图12所示,本实施例提供的蓝牙配对方法,可以包括:
11.手机2和蓝牙耳机建立蓝牙连接。
12.手机2获取蓝牙耳机的蓝牙地址和能力信息,根据蓝牙耳机的蓝牙地址和能力信息生成二维码,并显示二维码。
13.手机2向蓝牙耳机发送通知信息,通知信息用于指示蓝牙耳机进入配对模式。
14.蓝牙耳机接收手机2发送的通知信息,根据通知信息进入配对模式。
15.手机1启动扫描功能,扫描手机2显示的二维码。
16.手机1解析扫描的二维码,获取蓝牙耳机的蓝牙地址和能力信息。
17.手机1根据蓝牙耳机的蓝牙地址和能力信息,向蓝牙耳机发送配对请求,发起配对。
18.蓝牙耳机接收手机1发送的配对请求后,向手机发送配对响应。
可选的,在另一个实施例中,在S64中,第一电子设备通过与第二电子设备之间的通信连接从第二电子设备获取配对信息。如图13所示,S64中,第一电子设备从第二电子设备获取配对信息,可以包括:
S131、第二电子设备和第一电子设备建立通信连接。其中,通信连接包括下列中的任意一种:蓝牙连接、WiFi连接或蜂窝通信连接。
本实施例对第二电子设备和第一电子设备建立通信连接的时间不做限定,对S131和S62~S63之间的执行顺序不做限定。
可选的,在第一种实现方式中,第二电子设备和第一电子设备当前未建立通信连接,在S61中蓝牙设备与第二电子设备建立蓝牙连接之后,第二电子设备和第一电子设备建立通信连接。可选的,S131可以在S62之前执行,也可以在S62之后执行,也可以与S62同时执行。
在第一种实现方式中,可选的,S131在S62之前执行,并且,S61中蓝牙设备与第二电子设备建立蓝牙连接之后,即触发第二电子设备执行S131。该实现方式适用于环境中仅存在第一电子设备、第二电子设备和蓝牙设备的场景。例如,用户使用手机1和手机2,手机2与蓝牙耳机成功配对过,手机1从未与蓝牙耳机配对。当用户需要将蓝牙耳机与手机1配对时,蓝牙耳机上电,用户打开手机1和手机2的蓝牙功能。这样,通过蓝牙技术,手机2可以搜索到手机1。手机2与蓝牙耳机建立蓝牙连接后,可以触发手机2与手机1建立通信连接,以便于后续向手机1发送蓝牙设备的配对信息。可选的,手机1、手机2和蓝牙耳机可以登录同一用户账号。
在第一种实现方式中,可选的,S131在S62之前执行,并且,通过用户对第二电子设备进行第三操作,从而触发第二电子设备执行S131。
需要说明,本实施例对用户对第二电子设备的第三操作不做限定,可以为设备间用于分享文件或信息的任意操作。例如,第三操作为用户在手机2上通过蓝牙向手机1传输文件的操作。又例如,第三操作为用户在手机2上利用聊天类APP通过移动网络向手机1发送信息的操作。可选的,用户的第三操作可以为下列中的任意一种:用户在第二电子设备显示的相关界面上进行的触控操作、用户在第二电子设备的显示屏上进行的手势操作、用户对第二电子设备上的物理按键进行的操作、用户通过第二电子设备的麦克风输入语音,或者,用户通过第二电子设备的摄像头输入图像。可选的,第二电子设备可以安装有用于 管理蓝牙设备的APP,本实施例对APP的名称和功能不做限定,对APP的相关界面中的内容和布局不做限定。
可选的,第二电子设备的相关界面中可以包括用于引导用户进行第三操作的提示信息,本实施例对提示信息的内容不做限定。
示例性的,如图8A所示,手机2运行第三方应用程序,第三方应用程序用于管理与手机2通信的其他设备,手机2当前显示第三方应用程序中的“我的设备”界面80。界面80中包括手机1,手机1当前与手机2未连接。用户可以点击手机1,触发手机2与手机1建立通信连接,以便于后续手机2向手机1发送蓝牙设备的配对信息。相应的,手机2响应于用户的操作,与手机1建立通信连接。该场景适用于用户知道需要向手机1分享蓝牙耳机的配对信息。
可选的,第二电子设备与第一电子设备建立通信连接前,可以向用户显示提示信息。
示例性的,如图8A所示,用户点击手机1。相应的,如图8D所示,手机2响应于用户的操作,在界面80中弹出弹窗83。弹窗83可以参见图7E中弹框75的描述,原理相似,此处不再赘述。用户可以点击WiFi分享的选择控件84,使得手机2通过手机2和手机1之间的WiFi通信向手机1发送配对信息。如图8E所示,选择控件84的显示状态发生改变,用户继续点击确定按键,触发手机2和手机1建立WiFi连接。相应的,手机2响应于用户的操作,和手机1建立WiFi连接。
在第一种实现方式中,可选的,S131在S62之后执行,并且,S62中第二电子设备向蓝牙设备发送通知信息之后,即触发第二电子设备执行S131。该实现方式适用于环境中仅存在第一电子设备、第二电子设备和蓝牙设备的场景。
在第一种实现方式中,可选的,S131在S62之后执行,并且,通过用户对第二电子设备进行第三操作,从而触发第二电子设备执行S131。
示例性的,一种界面变化过程如下:如图8A所示,用户点击按钮85,触发手机2向蓝牙耳机发送通知信息,同时,触发手机2分享配对信息。手机2响应于用户点击按钮85的操作,如图8D所示,在界面80中弹出弹窗83。用户可以点击WiFi分享的选择控件84,使得手机2通过WiFi通信分享配对信息。如图8E所示,选择控件84的显示状态发生改变,用户继续点击确定按键,相应的,手机2响应于用户点击确定按键的操作,搜索周围可进行WiFi通信的设备,显示WiFi设备列表86,如图8F所示。在WiFi设备列表86中,手机2可进行WiFi通信的设备包括手机1、手机3和手机4。每个手机的右侧具有选择控件87。用户可以点击手机1右侧的选择控件87,再点击分享按键88,触发手机2和手机1建立WiFi连接。相应的,手机2响应于用户的操作,和手机1建立WiFi连接。在该实现方式中,手机2可以搜索并显示周围可通信的设备并向用户显示设备列表,以便于用户选定分享蓝牙耳机的配对信息的设备,便于用户操作。
可选的,在第二种实现方式中,当蓝牙设备需要与第一电子设备配对时,第二电子设备和第一电子设备已经建立有通信连接。例如,用户需要将手机1与蓝牙耳机配对时,手机1和手机2已经通过蓝牙连接传输音频文件。
S132、第二电子设备根据蓝牙设备的蓝牙地址和能力信息生成共享信息。
具体的,第二电子设备和蓝牙设备进行蓝牙通信,存储有蓝牙设备的蓝牙地址和能力信息。第二电子设备根据蓝牙设备的蓝牙地址和能力信息生成共享信息。
其中,本实施例对共享信息的形式不做限定。例如,共享信息可以为下列中的任意一种形式:文本格式、文件格式或图像。
可选的,第二电子设备可以对蓝牙设备的蓝牙地址和能力信息进行加密,生成共享信息。本实施例对加密算法不做限定。
S133、第二电子设备通过通信连接向第一电子设备发送共享信息。相应的,第一电子设备通过通信连接接收第二电子设备发送的共享信息。
S134、第一电子设备解析共享信息,获得蓝牙设备的蓝牙地址和能力信息。
可选的,第一电子设备可以对共享信息进行解密,获得蓝牙设备的蓝牙地址和能力信息。其中,第一电子设备使用的解密算法与第二电子设备使用的加密算法匹配。
可选的,在一种实现方式中,第一电子设备接收到共享信息后,自动解析共享信息,获得蓝牙设备的蓝牙地址和能力信息。该种方式实现简单。
可选的,在另一种实现方式中,第一电子设备接收到共享信息后,需要用户对第二电子设备进行操作,从而第二电子设备响应于用户的操作,解析共享信息。例如,第一电子设备接收共享信息后存储在默认文件夹中。用户可以打开默认文件夹,点击共享信息。第二电子设备响应于用户的点击操作,解析共享信息。该种方式更为灵活,提高了第二电子设备解析共享信息的准确性和安全性。
可见,本实施例提供的蓝牙配对方法,第一电子设备从第二电子设备获取蓝牙设备的配对信息。由于第二电子设备和蓝牙耳机进行蓝牙通信,第二电子设备中存储有蓝牙设备的蓝牙地址和能力信息,不需要通过额外的方式获取。第二电子设备通过与第一电子设备之间的通信连接向第一电子设备提供配对信息。本实施例提供的蓝牙配对方法,第一电子设备从第二电子设备获得配对信息,涉及的设备数量少,实现方式简单。
示例性的,以蓝牙设备为蓝牙耳机、第一电子设备为手机1、第二电子设备为手机2为例,结合图14对本实施例提供的蓝牙配对方法的流程进行示例性说明。
如图14所示,本实施例提供的蓝牙配对方法,可以包括:
21.手机2和蓝牙耳机建立蓝牙连接。
22.手机2向蓝牙耳机发送通知信息,通知信息用于指示蓝牙耳机进入配对模式。
23.手机2根据蓝牙耳机的蓝牙地址和能力信息生成共享信息。
24.手机2通过与手机1之间的通信连接向手机1发送共享信息。
25.蓝牙耳机接收手机2发送的通知信息,根据通知信息进入配对模式。
26.手机1接收手机2发送的共享信息,解析共享信息,获取蓝牙耳机的蓝牙地址和能力信息。
27.手机1根据蓝牙耳机的蓝牙地址和能力信息,向蓝牙耳机发送配对请求,发起配对。
28.蓝牙耳机接收手机1发送的配对请求后,向手机发送配对响应。
可选的,在又一个实施例中,第三电子设备作为蓝牙设备的外接显示设备,S64中,第一电子设备可以通过扫描第三电子设备显示的可视化形式的配对信息的方式获取配对信息,S64在S62之后执行。为了方便说明,可视化形式的配对信息为二维码信息。如图15所示,S64中,第一电子设备从第三电子设备获取配对信息,可以包括:
S151、蓝牙设备根据蓝牙设备的蓝牙地址和能力信息生成二维码信息。
S152、蓝牙设备向第三电子设备发送二维码信息,相应的,第三电子设备接收蓝牙设备发送的二维码信息。
S153、第三电子设备显示二维码信息。
其中,本实施例对第三电子设备显示二维码信息的界面和界面布局不做限定。
S154、第一电子设备扫描第三电子设备显示的二维码信息。
其中,本实施例对第一电子设备运行扫描功能的过程不做限定,例如,第一电子设备可以运行具有扫描功能的APP,通过与用户之间的人机互动启动扫描功能。
S155、第一电子设备解析二维码信息,获得蓝牙设备的蓝牙地址和能力信息。
可见,本实施例提供的蓝牙配对方法,第一电子设备从第三电子设备获取蓝牙设备的配对信息。在蓝牙设备接收第二电子设备发送的通知信息后,确定需要进入配对模式。蓝牙设备可以根据蓝牙设备的蓝牙地址和能力信息生成可视化形式的配对信息,并通过第三电子设备进行显示。由于由蓝牙设备确定提供配对信息,提高了第一电子设备获得配对信息的安全性。第一电子设备不需要与第三电子设备进行通信,通过扫描或拍照等方式可以获取可视化形式的配对信息,进而获得配对信息。本实施例提供的蓝牙配对方法,提高了第一电子设备获得配对信息的安全性,而且实现方式更加灵活。
示例性的,以蓝牙设备为蓝牙耳机、第一电子设备为手机1、第二电子设备为手机2、第三电子设备为显示器3为例,结合图16对本实施例提供的蓝牙配对方法的流程进行示例性说明。
如图16所示,本实施例提供的蓝牙配对方法,可以包括:
31.手机2和蓝牙耳机建立蓝牙连接。
32.手机2向蓝牙耳机发送通知信息,通知信息用于指示蓝牙耳机进入配对模式。
33.蓝牙耳机接收手机2发送的通知信息,根据通知信息进入配对模式,并根据蓝牙耳机的蓝牙地址和能力信息生成二维码。
34.蓝牙耳机向显示器3发送二维码。
35.显示器3接收蓝牙耳机发送的二维码,并显示二维码。
36.手机1启动扫描功能,扫描显示器3显示的二维码。
37.手机1解析扫描的二维码,获取蓝牙耳机的蓝牙地址和能力信息。
38.手机1根据蓝牙耳机的蓝牙地址和能力信息,向蓝牙耳机发送配对请求,发起配对。
39.蓝牙耳机接收手机1发送的配对请求后,向手机发送配对响应。
可选的,在又一个实施例中,蓝牙设备自身可以具有显示屏,S64中,第一电子设备可以通过扫描蓝牙设备显示的可视化形式的配对信息的方式获取配对信息,S64在S62之后执行。为了方便说明,可视化形式的配对信息为二维码信息。如图17所示,S64中,第一电子设备从蓝牙设备获取配对信息,可以包括:
S171、蓝牙设备根据蓝牙设备的蓝牙地址和能力信息生成二维码信息。
S172、蓝牙设备显示二维码信息。
其中,本实施例对蓝牙设备显示二维码信息的界面和界面布局不做限定。
S173、第一电子设备扫描蓝牙设备显示的二维码信息。
其中,本实施例对第一电子设备运行扫描功能的过程不做限定,例如,第一电子设备可以运行具有扫描功能的APP,通过与用户之间的人机互动启动扫描功能。
S174、第一电子设备解析二维码信息,获得蓝牙设备的蓝牙地址和能力信息。
可见,本实施例提供的蓝牙配对方法,第一电子设备从蓝牙设备获取蓝牙设备的配对信息。在蓝牙设备接收第二电子设备发送的通知信息后,确定需要进入配对模式。蓝牙设备可以根据蓝牙设备的蓝牙地址和能力信息生成可视化形式的配对信息,并显示。由于由蓝牙设备确定提供配对信息,提高了第一电子设备获得配对信息的安全性。第一电子设备不需要与蓝牙设备进行通信,通过扫描或拍照等方式可以获取可视化形式的配对信息,进而获得配对信息。本实施例提供的蓝牙配对方法,提高了第一电子设备获得配对信息的安全性,而且实现方式更加灵活。
可以理解的是,第一电子设备、第二电子设备、蓝牙设备和第三电子设备为了实现上述功能,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对第一电子设备、第二电子设备、蓝牙设备和第三电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个模块中。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。需要说明的是,本申请实施例中模块的名称是示意性的,实际实现时对模块的名称不做限定。
示例性的,图18为本申请实施例提供的设备的一种结构示意图,设备可以为本申请实施例中的第一电子设备、第二电子设备、蓝牙设备和第三电子设备。如图18所示,设备可以包括:接收模块1801、处理模块1802和发送模块1803。
可选的,在一种实现方式中,图18所示的设备为第二电子设备,用于执行上述方法实施例中第二电子设备的操作,技术原理和技术效果相似。其中,所述第二电子设备与所述蓝牙设备已配对,所述第二电子设备包括:
处理模块1802,用于和所述蓝牙设备建立蓝牙连接;
发送模块1803,用于向所述蓝牙设备发送通知信息,所述通知信息用于指示所述蓝牙设备进入配对模式。
可选的,所述处理模块1802还用于:接收用户的第一操作;
所述发送模块1803,还用于响应于所述第一操作,向所述蓝牙设备发送所述通知信息。
可选的,还包括接收模块1801;
所述发送模块1803,用于向所述蓝牙设备发送L2CAP_ECHO_REQ消息,所述L2CAP_ECHO_REQ消息包括所述通知信息;
所述接收模块1801,用于接收所述蓝牙设备发送的应L2CAP_ECHO_RSP消息。
可选的,所述处理模块1802还用于:
根据配对信息生成二维码信息,所述配对信息包括所述蓝牙设备的蓝牙地址;
显示所述二维码信息。
可选的,所述处理模块1802还用于:在根据配对信息生成二维码信息之前,接收用户的第二操作。
可选的,所述处理模块1802还用于:和第一电子设备建立通信连接,所述第一电子设备和所述蓝牙设备未配对;
所述发送模块1803,还用于通过所述通信连接向所述蓝牙设备发送配对信息,所述配对信息包括所述蓝牙设备的蓝牙地址。
可选的,所述处理模块1802还用于:在和所述第一电子设备建立通信连接之前,接收用户的第三操作。
可选的,所述通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂窝通信连接。
可选的,所述处理模块1802,还用于根据所述配对信息生成共享信息;
所述发送模块1803,用于通过所述通信连接向所述蓝牙设备发送所述共享信息。
可选的,所述配对信息还包括所述蓝牙设备的能力信息。
可选的,在一种实现方式中,图18所示的设备为蓝牙设备,用于执行上述方法实施例中蓝牙设备的操作,技术原理和技术效果相似。其中,所述蓝牙设备与第一电子设备未配对,所述蓝牙设备与第二电子设备已配对,所述蓝牙设备包括:
处理模块1802,用于和所述第二电子设备建立蓝牙连接;
接收模块1801,用于接收所述第二电子设备发送的通知信息,所述通知信息用于指示所述蓝牙设备进入配对模式;
所述处理模块1802,还用于根据所述通知信息进入配对模式;
所述接收模块1801,还用于接收所述第一电子设备发送的配对请求。
可选的,还包括发送模块1803;
所述接收模块1801,用于接收所述第二电子设备发送的L2CAP_ECHO_REQ消息,所述L2CAP_ECHO_REQ消息包括所述通知信息;
所述发送模块1803,用于向所述第二电子设备发送L2CAP_ECHO_RSP消息。
可选的,还包括发送模块1803;
所述处理模块1802,还用于在根据所述通知信息进入配对模式之后,根据配对信息生成二维码信息,所述配对信息包括所述蓝牙设备的蓝牙地址;
所述发送模块1803,用于向第三电子设备发送所述二维码信息。
可选的,所述处理模块1802还用于:
在根据所述通知信息进入配对模式之后,根据配对信息生成二维码信息,所述配对信息包括所述蓝牙设备的蓝牙地址;
显示所述二维码信息。
可选的,所述配对信息还包括所述蓝牙设备的能力信息。
可选的,在一种实现方式中,图18所示的设备为第一电子设备,用于执行上述方法实施例中第一电子设备的操作,技术原理和技术效果相似。其中,所述第一电子设备与蓝 牙设备未配对,所述蓝牙设备与第二电子设备已配对,所述第一电子设备包括:
处理模块1802,用于从所述第二电子设备或所述蓝牙设备或第三电子设备获取配对信息,所述配对信息包括所述蓝牙设备的蓝牙地址;所述第三电子设备和所述蓝牙设备通信;
发送模块1803,用于根据所述蓝牙设备的蓝牙地址向所述蓝牙设备发送配对请求。
可选的,所述配对信息还包括所述蓝牙设备的能力信息。
可选的,所述处理模块1802具体用于:
扫描所述第二电子设备显示的二维码信息,所述二维码信息为所述第二电子设备根据所述配对信息生成的;
解析所述二维码信息,获得所述配对信息。
可选的,所述处理模块1802用于:
和所述第二电子设备建立通信连接;
通过所述通信连接从所述第二电子设备获取所述配对信息。
可选的,还包括接收模块1801;
所述接收模块1801,用于接收所述第二电子设备发送的共享信息;所述共享信息为所述第二电子设备根据所述配对信息生成的;
所述处理模块1802,用于解析所述共享信息,获得所述配对信息。
可选的,所述通信连接包括下列中的任意一项:蓝牙连接、WiFi连接或蜂窝通信连接。
可选的,所述处理模块1802用于:
扫描所述蓝牙设备或所述第三电子设备显示的二维码信息,所述二维码信息为所述蓝牙设备根据所述配对信息生成的;
解析所述二维码信息,获得所述配对信息。
可选的,在一种实现方式中,图18所示的设备为第三电子设备,用于执行上述方法实施例中第三电子设备的操作,技术原理和技术效果相似。其中,第三电子设备与蓝牙设备通信,第三电子设备包括:
接收模块1801,用于接收蓝牙设备发送的二维码信息,二维码信息为蓝牙设备根据配对信息生成的,配对信息包括蓝牙设备的蓝牙地址;
处理模块1802,用于显示二维码信息。
可选的,配对信息还包括蓝牙设备的能力信息。
请参考图19,其示出了本申请实施例提供的设备的一种结构,设备可以为第一电子设备、第二电子设备、第三电子设备或蓝牙设备。该设备包括:处理器1901、接收器1902、发射器1903、存储器1904和总线1905。处理器1901包括一个或者多个处理核心,处理器1901通过运行软件程序以及模块,从而执行各种功能的应用以及信息处理。接收器1902和发射器1903可以实现为一个通信组件,该通信组件可以是一块基带芯片。存储器1904通过总线1905和处理器1901相连。存储器1904可用于存储至少一个程序指令,处理器1901用于执行至少一个程序指令,以实现上述实施例的技术方案。其实现原理和技术效果与上述方法相关实施例类似,此处不再赘述。
当设备开机后,处理器可以读取存储器中的软件程序,解释并执行软件程序的指令, 处理软件程序的数据。当需要通过天线发送数据时,处理器对待发送的数据进行基带处理后,输出基带信号至控制电路中的控制电路,控制电路将基带信号进行射频处理后将射频信号通过天线以电磁波的形式向外发送。当有数据发送到设备时,控制电路通过天线接收到射频信号,将射频信号转换为基带信号,并将基带信号输出至处理器,处理器将基带信号转换为数据并对该数据进行处理。
本领域技术人员可以理解,为了便于说明,图19仅示出了一个存储器和处理器。在实际的设备中,可以存在多个处理器和存储器。存储器也可以称为存储介质或者存储设备等,本申请实施例对此不做限制。
作为一种可选的实现方式,处理器可以包括基带处理器和中央处理器,基带处理器主要用于对通信数据进行处理,中央处理器主要用于执行软件程序,处理软件程序的数据。本领域技术人员可以理解,基带处理器和中央处理器可以集成在一个处理器中,也可以是各自独立的处理器,通过总线等技术互联。本领域技术人员可以理解,设备可以包括多个基带处理器以适应不同的网络制式,设备可以包括多个中央处理器以增强其处理能力,设备的各个部件可以通过各种总线连接。该基带处理器也可以表述为基带处理电路或者基带处理芯片。该中央处理器也可以表述为中央处理电路或者中央处理芯片。对通信协议以及通信数据进行处理的功能可以内置在处理器中,也可以以软件程序的形式存储在存储器中,由处理器执行软件程序以实现基带处理功能。该存储器可以集成在处理器中,也可以独立在处理器之外。该存储器包括高速缓存Cache,可以存放频繁访问的数据/指令。
在本申请实施例中,处理器可以是通用处理器、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
在本申请实施例中,存储器可以是非易失性存储器,比如硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SS)等,还可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM)。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,不限于此。
本申请实施例中的存储器还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。本申请各实施例提供的方法中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、网络设备、用户设备或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机可以存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性 介质(例如,软盘、硬盘、磁带)、光介质(例如,数字视频光盘(digital video disc,DWD)、或者半导体介质(例如,SSD)等。
可选的,图20为本申请实施例提供的设备的又一种结构示意图,设备可以为蓝牙设备,例如,蓝牙耳机。该蓝牙耳机可以包括至少一个处理器101、至少一个存储器102、无线通信模块103、音频模块104、电源模块105以及输入/输出接口106等。该处理器可以包括一个或多个接口,用于与蓝牙耳机的其他部件相连。该蓝牙耳机通过耳机盒进行收纳。下面结合图20对蓝牙耳机的各个部件进行具体的介绍。
其中,存储器102可以用于存储程序代码,如用于蓝牙耳机与多个电子设备之间进行物理连接,以及与电子设备之间的业务规范连接,处理电子设备的音频业务(例如音乐播放、接/打电话等),以及用于蓝牙耳机进行充电,蓝牙耳机与其他电子设备进行无线配对连接的程序代码等。存储器102还可以用于存储其他信息,例如电子设备的优先级。
处理器101可以用于执行上述应用程序代码,调用相关模块以实现本申请实施例中蓝牙耳机的功能。例如,实现蓝牙耳机与多个电子设备之间进行物理连接,业务规范连接,音频播放,接/打电话等功能。
处理器101可以包括一个或多个处理单元,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器101中。处理器101具体可以是集成的控制芯片,也可以由包括各种有源和/或无源部件的电路组成,且该电路被配置为执行本申请实施例描述的属于处理器101的功能。
无线通信模块103可以用于支持通过无线通信技术实现蓝牙耳机与其他电子设备或耳机盒之间的数据交换,无线通信技术例如为BT,WLAN(如Wi-Fi),Zigbee,FM,NFC,IR,或通用2.4G/5G无线通信技术等。
在一些实施例中,该无线通信模块103可以为蓝牙芯片。蓝牙耳机可以通过该蓝牙芯片,与其他电子设备的蓝牙芯片之间进行配对并建立无线连接,以通过该无线连接实现蓝牙耳机和其他电子设备之间的无线通信和业务处理。通常,蓝牙芯片可以支持基础速率(basic rate,BR)/增强速率(enhanced data rate,EDR)蓝牙和BLE,例如可以收/发寻呼(page)信息,收/发BLE广播消息等。
另外,无线通信模块103还可以包括天线,无线通信模块103经由天线接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器101。无线通信模块103还可以从处理器101接收待发送的信号,对其进行调频,放大,经天线转为电磁波辐射出去。
音频模块104可以用于管理音频数据,实现蓝牙耳机输入和输出音频流。例如,音频模块104可以从无线通信模块103获取音频流,或者向无线通信模块103传递音频流,实现通过蓝牙耳机接打电话、播放音乐、启动/关闭与耳机连接的电子设备的语音助手、接收/发送用户的语音数据等功能。音频模块104可以包括用于输出音频流的扬声器(或称听筒、受话器)组件,麦克风(或称话筒,传声器),与麦克风相配合的麦克收音电路等。扬声器可以用于将音频电信号转换成声音信号并播放。麦克风可以用于将声音信号转换为音频电信号。
电源模块105可以用于提供蓝牙耳机的***电源,为蓝牙耳机各模块供电;支持蓝牙 耳机接收充电输入等。电源模块105可以包括电源管理单元(power management unit,PMU)和电池。其中,电源管理单元可以接收外部的充电输入;将充电路输入的电信号变压后提供给电池充电,还可以将电池提供的电信号变压后提供给音频模块104、无线通信模块103等其他模块;以及防止电池过充、过放、短路或过流等。在一些实施例中,电源模块105还可以包括无线充电线圈,用于对蓝牙耳机进行无线充电。另外,电源管理单元还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。
多个输入/输出接口106,可以用于提供蓝牙耳机与耳机盒之间进行充电或通信的有线连接。在一些实施例中,该输入/输出接口可以为USB接口。在另一些实施例中,输入/输出接口106可以为耳机电连接器,当蓝牙耳机放置于耳机盒中时,蓝牙耳机可以通过耳机电连接器与耳机盒中的电连接器建立电连接,从而为蓝牙耳机中的电池充电。在另一些实施例中,在该电连接建立后,蓝牙耳机还可以与耳机盒进行数据通信,例如可以接收来自耳机盒的配对指令。
另外,蓝牙耳机还可以包括传感器107。例如,该传感器107可以是距离传感器或接近光传感器,可以用于确定蓝牙耳机是否被用户佩戴。示例性的,蓝牙耳机可以利用距离传感器来检测蓝牙耳机附近是否有物体,从而确定蓝牙耳机是否被用户佩戴。在确定蓝牙耳机被佩戴时,蓝牙耳机可以打开扬声器。
再例如,该传感器107还可以包括骨传导传感器,结合成骨传导耳机。利用该骨传导传感器,蓝牙耳机可以获取人体声部振动骨块的振动信号,解析出语音信号,实现语音功能,从而接收用户的语音指令。蓝牙耳机还可以根据骨传导耳机获取的用户语音信号进行语音鉴权,以在支付交易等业务场景中对用户身份进行认证等。
再例如,该传感器107还可以包括:触摸传感器,用于检测用户的触摸操作;指纹传感器,用于检测用户指纹,识别用户身份等;环境光传感器,可以根据感知的环境光的亮度,自适应调节一些参数(如音量大小);以及其他可能的传感器。
在一些实施例中,触摸传感器可以检测用户的单击、双击、多次点击、长按、重压等触摸操作,还可以进行用户指纹识别,以在支付交易等业务场景中对用户身份进行鉴权。
可以理解的是,本申请实施例示意的结构并不构成对蓝牙耳机的具体限定。其可以具有比图20示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。例如,在蓝牙耳机的外表面还可以包括按键108、指示灯(可以指示电量、呼入/呼出、配对模式等状态)、显示屏(可以提示用户相关信息)、防尘网(可以配合听筒使用)等部件。其中,该按键108可以是物理按键或触摸按键(与触摸传感器配合使用)等,用于触发开机、关机、暂停、播放、录音、开始配对、重置等操作。
在一些实施例中,蓝牙耳机通常收纳于耳机盒内。耳机盒内部可以具有一个或多个磁体,以将耳机本体吸引到耳机盒内的腔体中。该耳机盒可以包括电池和多个输入/输出接口。在一些实施例中,该输入/输出接口可以为盒电连接器。当耳机盒中的一对盒电连接器,分别与耳机本体中的两个耳机电连接器建立电连接后,耳机盒可以通过自身的电池为耳机本体中的电池充电。
在另一些实施例中,该耳机盒上可以设置有至少一个触摸控件,可以用于触发蓝牙耳机进行配对复位或对蓝牙耳机进行充电等功能。耳机盒还可以设置有一个或多个电量指示灯,以向用户提示耳机盒中电池的电量大小,以及耳机盒中每个耳机本体中电池的电量大 小。
本申请实施例提供一种计算机程序产品,当所述计算机程序产品在设备运行时,使得所述设备执行上述实施例中的技术方案,其实现原理和技术效果与上述相关实施例类似,此处不再赘述。所述设备可以为第一电子设备、第二电子设备、第三电子设备或蓝牙设备。
本申请实施例提供一种计算机可读存储介质,其上存储有程序指令,所述程序指令被设备执行时,使得所述设备执行上述实施例的技术方案。其实现原理和技术效果与上述相关实施例类似,此处不再赘述。所述设备可以为第一电子设备、第二电子设备、第三电子设备或蓝牙设备。
综上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。
Claims (36)
- 一种蓝牙配对方法,其特征在于,应用于通信***,所述通信***包括第一电子设备、第二电子设备和蓝牙设备,所述第二电子设备和所述蓝牙设备已配对,所述第一电子设备和所述蓝牙设备未配对,所述方法包括:所述第二电子设备和所述蓝牙设备建立蓝牙连接;所述第二电子设备向所述蓝牙设备发送通知信息,所述通知信息用于指示所述蓝牙设备进入配对模式;所述蓝牙设备根据所述通知信息进入配对模式;所述第一电子设备从所述第二电子设备或所述蓝牙设备或第三电子设备获取配对信息,所述配对信息包括所述蓝牙设备的蓝牙地址;所述第一电子设备根据所述蓝牙设备的蓝牙地址向所述蓝牙设备发送配对请求。
- 根据权利要求1所述的方法,其特征在于,所述第二电子设备向所述蓝牙设备发送通知信息,包括:所述第二电子设备接收用户的第一操作;所述第二电子设备响应于所述第一操作,向所述蓝牙设备发送通知信息。
- 根据权利要求1或2所述的方法,其特征在于,所述第二电子设备向所述蓝牙设备发送通知信息,包括:所述第二电子设备向所述蓝牙设备发送逻辑链路控制和适配协议回声请求L2CAP_ECHO_REQ消息,所述L2CAP_ECHO_REQ消息包括所述通知信息;所述蓝牙设备向所述第二电子设备向发送逻辑链路控制和适配协议回声响应L2CAP_ECHO_RSP消息。
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第一电子设备从所述第二电子设备获取配对信息,包括:所述第二电子设备根据所述配对信息生成二维码信息,并显示所述二维码信息;所述第一电子设备扫描所述二维码信息,并解析所述二维码信息获得所述配对信息。
- 根据权利要求4所述的方法,其特征在于,所述第二电子设备根据所述配对信息生成二维码信息之前,还包括:所述第二电子设备接收用户的第二操作。
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第一电子设备从所述第二电子设备获取配对信息,包括:所述第二电子设备和所述第一电子设备建立通信连接;所述第二电子设备通过所述通信连接向所述蓝牙设备发送所述配对信息;所述第一电子设备接收所述配对信息。
- 根据权利要求6所述的方法,其特征在于,所述第二电子设备和所述第一电子设备建立通信连接之前,还包括:接收用户的第三操作。
- 根据权利要求6所述的方法,其特征在于,所述通信连接包括下列中的任意一项:蓝牙连接、无线保真WiFi连接或蜂窝通信连接。
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第一电子设备从所述蓝 牙设备获取配对信息,包括:所述蓝牙设备根据所述通知信息进入配对模式后,根据所述配对信息生成二维码信息,并显示所述二维码信息;所述第一电子设备扫描所述二维码信息,并解析所述二维码信息获得所述配对信息。
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第三电子设备和所述蓝牙设备通信,所述第一电子设备从所述第三电子设备获取配对信息,包括:所述蓝牙设备根据所述通知信息进入配对模式后,根据所述配对信息生成二维码信息;所述蓝牙设备向所述第三电子设备发送所述二维码信息;所述第三电子设备接收所述二维码信息后,显示所述二维码信息;所述第一电子设备扫描所述二维码信息,并解析所述二维码信息获得所述配对信息。
- 根据权利要求1-10中任一项所述的方法,其特征在于,所述配对信息还包括所述蓝牙设备的能力信息。
- 一种蓝牙配对方法,其特征在于,应用于第二电子设备,所述第二电子设备与所述蓝牙设备已配对,所述方法包括:和所述蓝牙设备建立蓝牙连接;向所述蓝牙设备发送通知信息,所述通知信息用于指示所述蓝牙设备进入配对模式。
- 根据权利要求12所述的方法,其特征在于,所述向所述蓝牙设备发送通知信息,包括:接收用户的第一操作;响应于所述第一操作,向所述蓝牙设备发送所述通知信息。
- 根据权利要求12或13所述的方法,其特征在于,所述向所述蓝牙设备发送通知信息,包括:向所述蓝牙设备发送逻辑链路控制和适配协议回声请求L2CAP_ECHO_REQ消息,所述L2CAP_ECHO_REQ消息包括所述通知信息;接收所述蓝牙设备发送的逻辑链路控制和适配协议回声响应L2CAP_ECHO_RSP消息。
- 根据权利要求12-14中任一项所述的方法,其特征在于,还包括:根据配对信息生成二维码信息,所述配对信息包括所述蓝牙设备的蓝牙地址;显示所述二维码信息。
- 根据权利要求15所述的方法,其特征在于,所述根据配对信息生成二维码信息之前,还包括:接收用户的第二操作。
- 根据权利要求12-14中任一项所述的方法,其特征在于,还包括:和第一电子设备建立通信连接,所述第一电子设备和所述蓝牙设备未配对;通过所述通信连接向所述蓝牙设备发送配对信息,所述配对信息包括所述蓝牙设备的蓝牙地址。
- 根据权利要求17所述的方法,其特征在于,所述和所述第一电子设备建立通信连接之前,还包括:接收用户的第三操作。
- 根据权利要求17所述的方法,其特征在于,所述通信连接包括下列中的任意一项: 蓝牙连接、无线保真WiFi连接或蜂窝通信连接。
- 根据权利要求17所述的方法,其特征在于,所述通过所述通信连接向所述蓝牙设备发送配对信息,包括:根据所述配对信息生成共享信息;通过所述通信连接向所述蓝牙设备发送所述共享信息。
- 根据权利要求15-20中任一项所述的方法,其特征在于,所述配对信息还包括所述蓝牙设备的能力信息。
- 一种蓝牙配对方法,其特征在于,应用于蓝牙设备,所述蓝牙设备与第一电子设备未配对,所述蓝牙设备与第二电子设备已配对,所述方法包括:和所述第二电子设备建立蓝牙连接;接收所述第二电子设备发送的通知信息,所述通知信息用于指示所述蓝牙设备进入配对模式;根据所述通知信息进入配对模式;接收所述第一电子设备发送的配对请求。
- 根据权利要求22所述的方法,其特征在于,所述接收所述第二电子设备发送的通知信息,包括:接收所述第二电子设备发送的逻辑链路控制和适配协议回声请求L2CAP_ECHO_REQ消息,所述L2CAP_ECHO_REQ消息包括所述通知信息;向所述第二电子设备发送逻辑链路控制和适配协议回声响应L2CAP_ECHO_RSP消息。
- 根据权利要求22或23所述的方法,其特征在于,所述根据所述通知信息进入配对模式之后,还包括:根据配对信息生成二维码信息,所述配对信息包括所述蓝牙设备的蓝牙地址;向第三电子设备发送所述二维码信息。
- 根据权利要求22或23所述的方法,其特征在于,所述根据所述通知信息进入配对模式之后,还包括:根据配对信息生成二维码信息,所述配对信息包括所述蓝牙设备的蓝牙地址;显示所述二维码信息。
- 根据权利要求24或25所述的方法,其特征在于,所述配对信息还包括所述蓝牙设备的能力信息。
- 一种蓝牙配对方法,其特征在于,应用于第一电子设备,所述第一电子设备与蓝牙设备未配对,所述蓝牙设备与第二电子设备已配对,所述方法包括:从所述第二电子设备或所述蓝牙设备或第三电子设备获取配对信息,所述配对信息包括所述蓝牙设备的蓝牙地址;所述第三电子设备和所述蓝牙设备通信;根据所述蓝牙设备的蓝牙地址向所述蓝牙设备发送配对请求。
- 根据权利要求27所述的方法,其特征在于,所述配对信息还包括所述蓝牙设备的能力信息。
- 根据权利要求27或28所述的方法,其特征在于,从所述第二电子设备获取配对信息,包括:扫描所述第二电子设备显示的二维码信息,所述二维码信息为所述第二电子设备根据 所述配对信息生成的;解析所述二维码信息,获得所述配对信息。
- 根据权利要求27或28所述的方法,其特征在于,从所述第二电子设备获取配对信息,包括:和所述第二电子设备建立通信连接;通过所述通信连接从所述第二电子设备获取所述配对信息。
- 根据权利要求30所述的方法,其特征在于,所述通过所述通信连接从所述第二电子设备获取所述配对信息,包括:接收所述第二电子设备发送的共享信息;所述共享信息为所述第二电子设备根据所述配对信息生成的;解析所述共享信息,获得所述配对信息。
- 根据权利要求30所述的方法,其特征在于,所述通信连接包括下列中的任意一项:蓝牙连接、无线保真WiFi连接或蜂窝通信连接。
- 根据权利要求27或28所述的方法,其特征在于,从所述蓝牙设备或第三电子设备获取配对信息,包括:扫描所述蓝牙设备或所述第三电子设备显示的二维码信息,所述二维码信息为所述蓝牙设备根据所述配对信息生成的;解析所述二维码信息,获得所述配对信息。
- 一种电子设备,其特征在于,所述电子设备包括处理器,所述处理器用于与存储器耦合,读取存储器中的指令并根据所述指令使得所述电子设备执行如权利要求12-21中任一项所述的方法,或者,执行如权利要求27-33中任一项所述的方法。
- 一种蓝牙设备,其特征在于,所述蓝牙设备包括处理器,所述处理器用于与存储器耦合,并读取存储器中的指令并根据所述指令使得所述蓝牙设备执行如权利要求22-26中任一项所述的方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,当所述计算机指令在设备上运行时,使得所述设备执行如权利要求12-21中任一项所述的方法,或执行如权利要求22-26中任一项所述的方法,或执行如权利要求27-33中任一项所述的方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111285181.3A CN116074793A (zh) | 2021-11-01 | 2021-11-01 | 蓝牙配对方法、设备、***和存储介质 |
CN202111285181.3 | 2021-11-01 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023071993A1 true WO2023071993A1 (zh) | 2023-05-04 |
Family
ID=86160375
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/127076 WO2023071993A1 (zh) | 2021-11-01 | 2022-10-24 | 蓝牙配对方法、设备、***和存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116074793A (zh) |
WO (1) | WO2023071993A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116700084B (zh) * | 2023-06-14 | 2024-02-06 | 佛山市顺德区凯祥电器有限公司 | 一种基于蓝牙小程序控制的取暖桌的控制方法 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105554908A (zh) * | 2015-12-31 | 2016-05-04 | 福建联迪商用设备有限公司 | 实现扫码蓝牙自动连接方法、主设备、从设备和*** |
CN105578398A (zh) * | 2016-01-27 | 2016-05-11 | 努比亚技术有限公司 | 终端及蓝牙连接方法 |
US9480096B1 (en) * | 2015-08-25 | 2016-10-25 | Motorola Solutions, Inc. | Method, device, and system for fast wireless accessory devices pairing |
CN107172718A (zh) * | 2017-03-30 | 2017-09-15 | 联想(北京)有限公司 | 一种信息处理方法及电子设备 |
CN111050307A (zh) * | 2019-11-27 | 2020-04-21 | 深圳星康医疗科技有限公司 | 一种基于二维条码实现蓝牙连接的方法、***和计算机可读存储介质 |
CN112486105A (zh) * | 2019-09-12 | 2021-03-12 | 深圳市云海物联科技有限公司 | 一种设备的控制方法及装置 |
-
2021
- 2021-11-01 CN CN202111285181.3A patent/CN116074793A/zh active Pending
-
2022
- 2022-10-24 WO PCT/CN2022/127076 patent/WO2023071993A1/zh unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9480096B1 (en) * | 2015-08-25 | 2016-10-25 | Motorola Solutions, Inc. | Method, device, and system for fast wireless accessory devices pairing |
CN105554908A (zh) * | 2015-12-31 | 2016-05-04 | 福建联迪商用设备有限公司 | 实现扫码蓝牙自动连接方法、主设备、从设备和*** |
CN105578398A (zh) * | 2016-01-27 | 2016-05-11 | 努比亚技术有限公司 | 终端及蓝牙连接方法 |
CN107172718A (zh) * | 2017-03-30 | 2017-09-15 | 联想(北京)有限公司 | 一种信息处理方法及电子设备 |
CN112486105A (zh) * | 2019-09-12 | 2021-03-12 | 深圳市云海物联科技有限公司 | 一种设备的控制方法及装置 |
CN111050307A (zh) * | 2019-11-27 | 2020-04-21 | 深圳星康医疗科技有限公司 | 一种基于二维条码实现蓝牙连接的方法、***和计算机可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN116074793A (zh) | 2023-05-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3893109B1 (en) | Method and device for connecting bluetooth devices | |
US20220256626A1 (en) | Device Control Method and Terminal | |
WO2021114952A1 (zh) | 数据处理方法、终端设备、蓝牙设备及存储介质 | |
WO2019090726A1 (zh) | 选择蓝牙设备的方法、终端和*** | |
WO2021180083A1 (zh) | 蓝牙通信***和无线通信*** | |
CN113360108B (zh) | 一种投屏连接控制方法及电子设备 | |
WO2016090826A1 (zh) | 配置方法及装置 | |
CN104378801A (zh) | 接入无线网络的方法及装置 | |
CN112868244A (zh) | 一种点对多点的数据传输方法及设备 | |
WO2022143071A1 (zh) | 连接建立方法及电子设备 | |
CN105163366A (zh) | 无线网络连接方法和装置 | |
WO2023273639A1 (zh) | 设备连接方法及装置、计算机可读介质和电子设备 | |
JP2018501746A (ja) | 接続確立方法、装置、プログラム、及び記録媒体 | |
US10827455B1 (en) | Method and apparatus for sending a notification to a short-range wireless communication audio output device | |
KR102335903B1 (ko) | 전자 장치들 간에 통신 방법 및 장치 | |
CN114499587B (zh) | 音频同步的通信方法、***、无线耳机、终端及存储介质 | |
CN111010693A (zh) | 一种提供无线保真WiFi网络接入服务的方法及电子设备 | |
WO2023071993A1 (zh) | 蓝牙配对方法、设备、***和存储介质 | |
CN113038627B (zh) | 一种文件分享方法、移动设备、计算机存储介质 | |
WO2022052760A1 (zh) | 一种组合音箱的配置方法、音箱和电子设备 | |
CN113365274A (zh) | 一种网络接入方法和电子设备 | |
WO2022160967A1 (zh) | 通信方法、移动设备、电子设备和计算机可读存储介质 | |
CN105430642A (zh) | 文件传输方法及装置 | |
CN117751593A (zh) | 基于上下文的无线协议连接 | |
CN105704208B (zh) | 服务启动方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22885870 Country of ref document: EP Kind code of ref document: A1 |