Bluetooth connection method and electronic device
By automatically deleting the pairing relationship and generating an identification code when the Bluetooth connection fails, automatic pairing and reconnection between Bluetooth devices is realized, solving the problem of Bluetooth connection failure in the existing technology and improving the user experience.
Patent Information
- Application Number
- CN202110212796.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-25
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2041-02-25
AI Technical Summary
Existing Bluetooth connection technology is prone to failure during the connection process, resulting in users needing to manually delete the pairing relationship, affecting the user experience.
By automatically deleting the pairing relationship when the Bluetooth connection fails and generating an identification code for re-establishing the pairing relationship, data packets are sent to the peer device to achieve automatic pairing and reconnection.
It realizes Bluetooth back-connection without user perception, improving the stability and efficiency of user experience and Bluetooth connection.
Smart Images

Figure CN114980045B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of terminal technology, and in particular to a Bluetooth connection method and electronic device. Background Art
[0002] With the development of smart terminal technology, Bluetooth connection technology is widely used in data transmission and communication processes of electronic devices. Limited by the communication distance of Bluetooth connection, if the distance between two electronic devices connected via Bluetooth exceeds the maximum communication distance, the Bluetooth connection will be automatically disconnected. Afterwards, if the two electronic devices keep Bluetooth turned on, they can automatically reconnect when the communication distance is less than or equal to the maximum communication distance, that is, re-establish the Bluetooth connection.
[0003] However, due to the diversity of electronic devices and the complexity of the Bluetooth protocol, the reconnection process fails. At this time, the user needs to manually delete the Bluetooth pairing relationship of the electronic device before the Bluetooth connection can be established again, resulting in a poor user experience. Summary of the invention
[0004] The Bluetooth connection method and electronic device provided in the embodiments of the present application can automatically pair during the Bluetooth backconnection process, provide users with imperceptible Bluetooth backconnection, and improve the user experience.
[0005] In order to achieve the above purpose, the embodiment of the present application adopts the following technical solution:
[0006] In a first aspect, an embodiment of the present application provides a Bluetooth connection method, which is applied to a first device. The method may include: determining that the Bluetooth connection fails, and deleting a first pairing relationship. Sending a data packet to a second device, the data packet carrying a first identifier and a first identification code; the first identifier is used to indicate that the second device uses the first identification code to establish a second pairing relationship with the first device. Disconnecting the abnormal connection with the second device. Receive a pairing request sent by the second device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code. Re-establishing a Bluetooth connection with the second device based on the pairing request.
[0007] In some embodiments, the first identifier includes, for example, a special control word, which is used to indicate that the previous Bluetooth connection failed and that Bluetooth pairing needs to be re-performed. Optionally, the length and value of the first identifier are preset in the first device and the second device. The first identification code and the second identification code include, for example, a personal identification (PIN) code. The first device uses the first identifier to instruct the second device to use the PIN code as a security verification code for pairing confirmation, thereby directly using the PIN code to complete the pairing process without the user confirming again.
[0008] In some embodiments, after the first device determines that the Bluetooth connection establishment fails, it generates a PIN code using a PIN code generation algorithm. For example, the first device generates a random number using a tool in the Bluetooth protocol stack and uses the random number as the PIN code.
[0009] In this way, after determining that the Bluetooth connection is abnormal, the first device can automatically delete the Bluetooth pairing relationship and generate an identification code for re-establishing the Bluetooth pairing relationship. After that, a re-pairing instruction carrying the identification code is sent to the second device, thereby automatically establishing a Bluetooth pairing relationship and Bluetooth connection without the user's awareness, thereby improving the user experience.
[0010] In a possible implementation, before sending the data packet to the second device, the method further includes: establishing a second connection using the first connection established during the Bluetooth connection failure process; the first connection is a physical connection corresponding to the first pairing relationship, and the second connection is used to transmit the data packet.
[0011] In some embodiments, after the first device determines the special control word and the PIN code, due to the failure to establish the current Bluetooth connection, the logical connection between the first device and the second device is abnormal and data cannot be directly transmitted. Therefore, the first device sends a connection establishment request to the second device to establish a logical connection (i.e., the second connection) for transmitting the special control word and the PIN code. Optionally, the logical connection is an encrypted logical connection based on the Bluetooth physical connection (i.e., the first connection) between the first device and the second device.
[0012] Exemplarily, the first device uses the physical connection between the first device and the second device to send a connection establishment request to the second device and receive a connection establishment response sent by the second device, thereby establishing an encrypted logical connection between the first device and the second device. Afterwards, the first device uses the encrypted logical connection to send a re-pairing instruction to the second device, and the re-pairing instruction carries a special control word and a PIN code, which is used to instruct the second device to re-pair with the first device using the PIN code.
[0013] In a possible implementation, after disconnecting the abnormal connection with the second device, the method further includes: disconnecting the first connection and the second connection.
[0014] In some embodiments, the Bluetooth connection between the first device and the second device is abnormally established, and the first device and the second device need to delete the established abnormal connection. For example, if there is a defect in the Bluetooth software, such as an error in the connection process interaction logic processing during the Bluetooth connection process, the abnormal connection is disconnected. Furthermore, the physical connection between the first device and the second device can also be disconnected, as well as the logical connection used to transmit the special control word and the PIN code.
[0015] In a possible implementation, before sending the data packet to the second device, the method further includes: obtaining a preset first identifier and generating a first identification code. The first identifier and the first identification code are combined to generate the data packet.
[0016] In a possible implementation manner, the data packet includes a first field and a second field, the first field is used to indicate a first identifier, and the second field is used to indicate a first identification code.
[0017] In some embodiments, a special control word and a PIN code are transmitted between the first device and the second device using a data packet. After the first device obtains a preset special control word and generates a PIN code, the special control word and the PIN code are grouped to generate a data packet. For example, assuming that the length of the data packet is 8 bytes, the first 2 bytes are used to carry the special control word, and the last 6 bytes are used to carry the PIN code. For example, assuming that the values of the two bytes corresponding to the special control word are 0x03 and 0x09, respectively. Subsequently, after receiving the data packet sent by the first device and parsing the data packet, the second device reads the values of the first two bytes, compares the read special control word with the preset special control word, and thus determines that the current data packet is used to indicate abnormal re-pairing. Afterwards, the second device can obtain the PIN code carried in the data packet and start the re-pairing process. It is understandable that there may be other data packet designs for indicating the transmission of special control words and PIN codes. For example, using data packets of other byte lengths to carry special control words and PIN codes.
[0018] In a possible implementation, re-establishing a Bluetooth connection with the second device based on the pairing request includes: identifying a second identification code carried in the pairing request, determining that the second identification code is the same as the first identification code, and then determining to establish a second pairing relationship with the second device. Based on the second pairing relationship, re-establishing a Bluetooth connection with the second device.
[0019] In some embodiments, if the first device determines that the second identification code is the same as the first identification code sent to the second device, the second device is confirmed to be a trusted device and a pairing relationship is established.
[0020] In a possible implementation, determining that the Bluetooth connection fails includes: determining that the Bluetooth connection duration exceeds a preset duration and / or the number of Bluetooth reconnections exceeds a preset threshold, and then determining that the Bluetooth connection fails.
[0021] In some embodiments, after the first device determines that the Bluetooth connection establishment between the first device and the second device fails, it can send a Bluetooth connection failure response to the second device. Correspondingly, after receiving the Bluetooth connection failure response, the second device resends a Bluetooth connection establishment request to the first device, and after receiving the Bluetooth connection establishment request, the first device attempts to establish a Bluetooth connection with the second device again. Repeat the above steps until the first device determines that the number of reconnections exceeds a preset threshold or the reconnection duration exceeds a preset duration, then determines that the Bluetooth connection has failed, and deletes the pairing relationship, thereby avoiding Bluetooth connection failures caused by abnormal reasons such as poor signals, and improving Bluetooth reconnection efficiency.
[0022] In a second aspect, an embodiment of the present application provides a Bluetooth connection method, which is applied to a second device. The method may include: receiving a data packet sent by a first device, the data packet carrying a first identifier and a first identification code; the first identifier is used to indicate that the second device uses the first identification code to establish a second pairing relationship with the first device. Delete the first pairing relationship. Disconnect the abnormal connection with the first device. Send a pairing request to the first device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code. Receive a pairing response sent by the first device, and re-establish a Bluetooth connection with the first device.
[0023] In a possible implementation, before receiving the data packet sent by the first device, the method also includes: establishing a second connection using the first connection established during the Bluetooth connection failure process; the first connection is a physical connection corresponding to the first pairing relationship, and the second connection is used to transmit the data packet.
[0024] In a possible implementation manner, after disconnecting the abnormal connection with the first device, the method further includes: disconnecting the first connection and the second connection.
[0025] In a possible implementation manner, the data packet includes a first field and a second field, the first field is used to indicate a first identifier, and the second field is used to indicate a first identification code.
[0026] In addition, the technical effects of the Bluetooth connection method of the second aspect can refer to the technical effects of the Bluetooth connection method of the first aspect, which will not be repeated here.
[0027] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory; the memory is coupled to the processor, the memory is used to store a computer program code, the computer program code includes computer instructions, and when the processor reads the computer instructions from the memory, the electronic device performs the following operations: Determine that the Bluetooth connection fails and delete the first pairing relationship. Send a data packet to a second device, the data packet carries a first identifier and a first identification code; the first identifier is used to indicate that the second device uses the first identification code to establish a second pairing relationship with the electronic device. Disconnect the abnormal connection with the second device. Receive a pairing request sent by the second device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code. Re-establish a Bluetooth connection with the second device based on the pairing request.
[0028] In one possible implementation, when the processor reads computer instructions from the memory, it also causes the electronic device to perform the following operations: establish a second connection using the first connection established during the Bluetooth connection failure process; the first connection is a physical connection corresponding to the first pairing relationship, and the second connection is used to transmit data packets.
[0029] In a possible implementation, when the processor reads the computer instruction from the memory, it also causes the electronic device to perform the following operation: disconnecting the first connection and the second connection.
[0030] In a possible implementation, when the processor reads the computer instruction from the memory, the electronic device is also caused to perform the following operations: obtaining a preset first identifier and generating a first identification code. Packaging the first identifier and the first identification code to generate a data packet.
[0031] In a possible implementation manner, the data packet includes a first field and a second field, the first field is used to indicate a first identifier, and the second field is used to indicate a first identification code.
[0032] In a possible implementation, re-establishing a Bluetooth connection with the second device based on the pairing request includes: identifying a second identification code carried in the pairing request, determining that the second identification code is the same as the first identification code, and then determining to establish a second pairing relationship with the second device. Based on the second pairing relationship, re-establishing a Bluetooth connection with the second device.
[0033] In a possible implementation, determining that the Bluetooth connection fails includes: determining that the Bluetooth connection duration exceeds a preset duration and / or the number of Bluetooth reconnections exceeds a preset threshold, and then determining that the Bluetooth connection fails.
[0034] In addition, the technical effects of the electronic device described in the third aspect can refer to the technical effects of the Bluetooth connection method described in the first aspect, and will not be repeated here.
[0035] In a fourth aspect, an embodiment of the present application provides an electronic device, which includes: a processor and a memory, wherein the memory is coupled to the processor, the memory is used to store a computer program code, and the computer program code includes computer instructions. When the processor reads the computer instructions from the memory, the electronic device performs the following operations: receiving a data packet sent by a first device, the data packet carries a first identifier and a first identification code; the first identifier is used to instruct the electronic device to establish a second pairing relationship with the first device using the first identification code. Delete the first pairing relationship. Disconnect the abnormal connection with the first device. Send a pairing request to the first device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code. Receive a pairing response sent by the first device, and re-establish a Bluetooth connection with the first device.
[0036] In one possible implementation, when the processor reads the computer instructions from the memory, it also causes the electronic device to perform the following operations: establish a second connection using the first connection established during the Bluetooth connection failure process; the first connection is a physical connection corresponding to the first pairing relationship, and the second connection is used to transmit the data packet.
[0037] In a possible implementation manner, when the processor reads the computer instruction from the memory, it also causes the electronic device to perform the following operation: disconnecting the first connection and the second connection.
[0038] In a possible implementation manner, the data packet includes a first field and a second field, the first field is used to indicate the first identifier, and the second field is used to indicate the first identification code.
[0039] In addition, the technical effects of the electronic device described in the fourth aspect can refer to the technical effects of the Bluetooth connection method described in the second aspect, and will not be repeated here.
[0040] In a fifth aspect, an embodiment of the present application provides an electronic device, which has the function of implementing the Bluetooth connection method as described in the first aspect and any possible implementation thereof; or, the electronic device has the function of implementing the Bluetooth connection method as described in the second aspect and any possible implementation thereof. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0041] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes a Bluetooth connection method as described in the first aspect and any possible implementation thereof; or, the electronic device executes a Bluetooth connection method as described in the second aspect and any possible implementation thereof.
[0042] In the seventh aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, it enables the electronic device to execute the Bluetooth connection method as described in the first aspect and any possible implementation thereof; or, it enables the electronic device to execute the Bluetooth connection method as described in the second aspect and any possible implementation thereof.
[0043] In an eighth aspect, an embodiment of the present application provides a circuit system, the circuit system including a processing circuit, the processing circuit being configured to execute the Bluetooth connection method as described in the above-mentioned first aspect and any possible implementation thereof; or, being configured to execute the Bluetooth connection method as described in the above-mentioned second aspect and any possible implementation thereof.
[0044] In the ninth aspect, an embodiment of the present application provides a chip system, comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to at least one processor, and when the at least one processor executes the instructions, the at least one processor executes the Bluetooth connection method as described in the above-mentioned first aspect and any possible implementation thereof; or, the at least one processor executes the Bluetooth connection method as described in the above-mentioned second aspect and any possible implementation thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic diagram of a communication system provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of a software structure block diagram of an electronic device provided in an embodiment of the present application;
[0048] Figure 4 Interface diagram provided for the embodiment of the present application Figure 1 ;
[0049] Figure 5 A schematic diagram of a Bluetooth connection scenario provided in an embodiment of the present application;
[0050] Figure 6 Interface diagram provided for the embodiment of the present application Figure 2 ;
[0051] Figure 7 A schematic diagram of a Bluetooth connection method flow in the prior art provided in an embodiment of the present application;
[0052] Figure 8 A schematic diagram of a Bluetooth connection method flow chart provided in an embodiment of the present application;
[0053] Fig. 9 A schematic diagram of a data packet structure provided in an embodiment of the present application;
[0054] Fig.10 A schematic diagram of the structure of a Bluetooth connection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The Bluetooth connection method and electronic device provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0056] The terms "including" and "having" and any variations thereof mentioned in the description of the embodiments of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0057] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0058] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more. The "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0059] Figure 1 A schematic diagram of a communication system for applying a Bluetooth connection method provided in an embodiment of the present application. Figure 1 As shown, the communication system includes a first electronic device 100 and a second electronic device 200 .
[0060] Exemplarily, the first electronic device 100 or the second electronic device 200 can be a mobile phone, a tablet computer, a laptop computer, a wireless headset, a smart watch, a smart bracelet, smart glasses, an ultra-mobile personal computer (UMPC), a personal digital assistant (PDA), a desktop, a laptop, a handheld computer, a vehicle terminal, an artificial intelligence (artificial intelligence) device, etc. The specific forms of the first electronic device 100 and the second electronic device 200 in the embodiment of the present application are not limited in any way.
[0061] The first electronic device 100 can establish a wireless connection with the second electronic device 200 through wireless communication technology. The wireless communication technology may include Bluetooth (BT) (such as traditional Bluetooth or low-power BLE Bluetooth), wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Zigbee, frequency modulation (FM), near field communication (NFC), infrared (IR), or general 2.4G / 5G frequency band wireless communication technology, etc.
[0062] The embodiment of the present application is explained by taking Bluetooth as an example of wireless communication technology, and the first electronic device 100 establishes a Bluetooth connection with the second electronic device 200 through a pairing process and a connection process. Among them, the pairing process is an authentication process between the first electronic device 100 and the second electronic device 200, and a successful pairing means that the first electronic device 100 and the second electronic device 200 are allowed to establish a Bluetooth connection with each other. The connection process is used to establish a physical channel between the first electronic device 100 and the second electronic device. During the Bluetooth connection process, the first electronic device 100 and the second electronic device 200 may be accidentally disconnected, or the distance between the two may exceed the maximum communication distance and be disconnected. In the case of the above-mentioned Bluetooth connection disconnection, the first electronic device 100 and the second electronic device 200 can re-establish the Bluetooth connection through the reconnection mechanism.
[0063] Optionally, the first electronic device 100 and the second electronic device 200 in the embodiment of the present application may be implemented by different devices. Figure 2 This is achieved by using electronic devices in the system.
[0064] Figure 2The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195.
[0065] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. For example, if the electronic device is a Bluetooth headset, the electronic device does not include a display screen 194, a camera 193, a motor 191, or a SIM card interface 195.
[0066] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0067] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0068] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0069] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0070] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
[0071] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0072] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge an electronic device, and can also be used to transfer data between an electronic device and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0073] It is understandable that the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0074] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 charges the battery 142, it can also power the electronic device through the power management module 141.
[0075] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.
[0076] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0077] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0078] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0079] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to electronic devices. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0080] In some embodiments, the electronic device communicates with other electronic devices through the wireless communication module 160. For example, the electronic device establishes a Bluetooth connection with other electronic devices through the wireless communication module 160 to play music, make calls, and other functions using other electronic devices.
[0081] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).
[0082] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0083] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0084] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0085] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0086] The electronic device can implement audio functions through the audio module 170 and the application processor, etc. For example, music playing, recording, etc. The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110. The audio module 170 includes, for example, a speaker, a receiver, a microphone, and a headphone interface.
[0087] The sensor module 180 may include, for example, a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
[0088] A touch sensor is also called a "touch control device". The touch sensor can be arranged on the display screen 194. The touch sensor and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor is used to detect a touch operation acting on or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. A visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device, which is different from the position of the display screen 194.
[0089] In some embodiments, the electronic device uses a touch sensor to detect a user's touch operation on the display screen 194 to determine whether it is necessary to turn on Bluetooth, and / or reconnect Bluetooth, and / or delete the Bluetooth pairing relationship, etc.
[0090] The bone conduction sensor can obtain vibration signals. In some embodiments, the bone conduction sensor can obtain vibration signals of the vibrating bones of the vocal part of the human body. The bone conduction sensor can also contact the human pulse to receive blood pressure pulse signals. In some embodiments, the bone conduction sensor can also be set in the earphones and combined into bone conduction earphones. The audio module 170 can parse out the voice signal based on the vibration signal of the vibrating bones of the vocal part obtained by the bone conduction sensor to realize the voice function. The application processor can parse the heart rate information based on the blood pressure pulse signal obtained by the bone conduction sensor to realize the heart rate detection function.
[0091] The key 190 includes a power key, a volume key, etc. The key 190 can be a mechanical key or a touch key. The electronic device can receive key input and generate key signal input related to user settings and function control of the electronic device.
[0092] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects.
[0093] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0094] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device by inserting the SIM card interface 195 or removing the SIM card interface 195. The electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[0095] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.
[0096] Figure 3 It is a software structure block diagram of the electronic device according to an embodiment of the present application.
[0097] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime system library, and the kernel layer.
[0098] The application layer can include a series of application packages.
[0099] like Figure 3As shown, the application package may include applications such as Bluetooth, navigation, map, camera, gallery, calendar, call, WLAN, music, video, short message, etc.
[0100] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0101] like Figure 3 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0102] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0103] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0104] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0105] The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including answering, hanging up, etc.).
[0106] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0107] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0108] In some embodiments, the electronic device uses a notification manager to display a Bluetooth connection failure notification message to notify the user of the current Bluetooth connection failure exception.
[0109] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0110] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0111] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0112] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0113] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0114] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0115] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0116] A 2D graphics engine is a drawing engine for 2D drawings.
[0117] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0118] In the following embodiments, a mobile phone is used as the first electronic device 100 and a Bluetooth headset is used as the second electronic device 200 for illustration.
[0119] In some embodiments, a Bluetooth connection can be established between a mobile phone and a Bluetooth headset to achieve wireless communication. The process of establishing a Bluetooth connection includes a pairing process and a connection process. Figure 4In the interface 401 shown in (a), the mobile phone detects that the user clicks on the on / off control 41, turns on the Bluetooth function of the mobile phone, and searches for nearby devices that can be used to establish a Bluetooth connection, such as searching for a Bluetooth headset. The mobile phone detects that the user clicks on the control 42 and displays the following Figure 4 Interface 402 shown in (b) is used to prompt the user to determine whether to allow the mobile phone to pair with the Bluetooth headset. If it is detected that the user clicks on control 43, it is determined that the user allows the mobile phone to establish a connection with the Bluetooth headset, and the authentication process is completed. After that, the pairing process is started, and the mobile phone sends a pairing request to the Bluetooth headset. If the pairing is successful, the connection process can be automatically executed to establish a Bluetooth connection. During the connection process, the mobile phone displays Figure 4 In the interface 403 shown in (c), a prompt 44 is displayed on the interface 403 to prompt the user that the current mobile phone is establishing a Bluetooth connection with the Bluetooth headset.
[0120] In some scenarios, such as Figure 5 As shown, it is assumed to be the range shown in area 51. If the distance between the mobile phone 100 and the Bluetooth headset 200 is less than or equal to the maximum communication distance, the Bluetooth connection can be maintained; if the distance between the mobile phone 100 and the Bluetooth headset 200 is greater than the maximum communication distance, the Bluetooth connection is automatically disconnected. Figure 5 As shown, the mobile phone 100 maintains its position unchanged, and the Bluetooth headset 200 moves from position 1 to position 2 along the direction indicated by arrow 52. If the communication distance between the mobile phone 100 and the Bluetooth headset 200 exceeds the maximum communication distance, the Bluetooth connection between the mobile phone 100 and the Bluetooth headset 200 is disconnected, and the Bluetooth connection state automatically changes from the connected state to the disconnected state.
[0121] Further, such as Figure 5 As shown, if the Bluetooth headset 200 moves from position 2 to any position within the range shown in area 51, such as position 1, automatic Bluetooth reconnection can be achieved, that is, the Bluetooth headset 200 re-establishes the Bluetooth connection with the mobile phone 100. For example, Figure 4 In the scenario shown, the mobile phone and the Bluetooth headset have been paired and connected. Therefore, during the Bluetooth back-connection process, if the mobile phone 100 detects that the user has opened the Bluetooth setting interface, the mobile phone displays interface 403 and directly establishes a connection with the Bluetooth headset 200 without having to repeat the steps as shown above. Figure 4 The pairing process shown in (b).
[0122] However, in the process of establishing a Bluetooth connection between a Bluetooth headset and a mobile phone, a variety of reasons may cause the Bluetooth connection to fail. For example, there are defects in the Bluetooth software. For example, during the Bluetooth connection process, the connection process interaction logic processing error results in the failure to establish the Bluetooth connection, and the Bluetooth connection process cannot be completed. At this time, the mobile phone and the Bluetooth headset need to delete the Bluetooth pairing relationship and re-pair. For another example, the Bluetooth connection fails due to hardware failures such as Bluetooth chip hardware failure, wireless signal interference, the peer device is not in a scanning state, and the peer device does not monitor the logical channel. The Bluetooth connection can be re-established by replacing the Bluetooth hardware. For another example, if the Bluetooth connection fails due to poor quality of the Bluetooth logical channel, the Bluetooth connection can be established after repeating the Bluetooth connection process multiple times.
[0123] Among them, due to compatibility issues caused by the diversity of Bluetooth devices and the complexity of related Bluetooth protocols, the Bluetooth protocol software has defects, resulting in Bluetooth connection failure. Furthermore, the cause of Bluetooth pairing failure during the pairing process can generally be determined through experiments, but it is difficult to troubleshoot the cause of Bluetooth connection failure during the connection process, resulting in Bluetooth connection failures caused by Bluetooth software protocol anomalies during the connection process during the user use phase. For example, assuming that there is a hidden defect code in the Bluetooth protocol software, during the Bluetooth connection establishment process, when the Bluetooth protocol software executes the hidden defect code, a software failure will be triggered. The software failure makes it impossible for the Bluetooth protocol software to automatically jump out of the abnormal branch, so that it cannot continue to complete the remaining protocol process, and ultimately leads to the failure of Bluetooth device pairing or connection.
[0124] For example, a mobile phone sends a connection establishment request to a Bluetooth headset to start the Bluetooth connection establishment process. If the Bluetooth connection is successfully established, the Bluetooth headset sends a Bluetooth connection establishment response to the mobile phone. After the mobile phone receives the Bluetooth connection establishment response, it determines that the Bluetooth connection is successfully established. If the mobile phone does not receive the Bluetooth connection establishment request within the preset time, it is determined that the Bluetooth connection establishment has failed, and the connection establishment request is sent again. Assuming that the failure to establish the Bluetooth connection is caused by a software failure, since the Bluetooth software cannot automatically jump out of the abnormal branch of the defective code, the Bluetooth connection cannot be successfully established by sending the Bluetooth connection request again. After the number of connection establishment requests sent exceeds the preset number, the mobile phone prompts the user that the current Bluetooth connection establishment has failed, and the user confirms the reason for the failure. In the current scenario, if the user needs to establish a Bluetooth connection between the mobile phone and the Bluetooth headset, he can only choose to delete the pairing relationship between the mobile phone and the Bluetooth headset, restart the Bluetooth connection establishment process, and make the mobile phone and the Bluetooth headset re-paired and connected.
[0125] For example, Figure 6 In the interface 601 shown in (a), after the Bluetooth connection fails to be established or the reconnection fails, the mobile phone detects that the user clicks the control 61 and displays the following Figure 6Interface 602 is shown in (b). On interface 602, after the mobile phone detects that the user clicks on control 62, it deletes the pairing relationship with the Bluetooth headset. Figure 4 Use the method shown to pair and connect with the Bluetooth headset again.
[0126] Or, if Figure 7 The method for establishing a Bluetooth connection described in the patent application number 200710153596.9 (the patent name is a method for adaptively matching different Bluetooth devices) is to determine the cause of the failure after the Bluetooth connection establishment or reconnection failure of the mobile phone. If the connection establishment failure is caused by the link keyword, the link keyword between the mobile phone and the Bluetooth headset is deleted (such as Figure 7 However, after deleting the link keyword, the pairing relationship is also deleted, and the mobile phone needs to prompt the user to confirm during the Bluetooth backlink process (such as Figure 7 In step 206-step 215). Moreover, if the Bluetooth connection failure is caused by a Bluetooth protocol software defect, deleting the link keyword still cannot solve the Bluetooth connection abnormality, and the user can only confirm to delete the pairing relationship between the mobile phone and the Bluetooth headset and re-pair and connect. Among them, the link keyword includes, for example, information generated during the pairing process recorded after the first successful matching.
[0127] It can be seen that in the above Bluetooth connection failure reconnection scenario, it is necessary to delete the pairing relationship between the mobile phone and the Bluetooth headset, and then re-establish the pairing connection. This process requires user participation, the operation is complicated, and it takes a long time, which affects the user experience.
[0128] Based on this, the present application provides a Bluetooth connection method, which can complete the reconnection process without the user's perception by interacting with a first signal when a Bluetooth connection abnormality occurs, thereby improving the reconnection efficiency and enhancing the user experience.
[0129] For example, Figure 8 A schematic diagram of a Bluetooth connection method flow chart provided in an embodiment of the present application. Figure 8 , the method includes S801-S810.
[0130] S801. The Bluetooth headset sends a connection establishment request to the mobile phone.
[0131] In some embodiments, the Bluetooth headset sends a Bluetooth connection establishment request to the mobile phone in response to the user's operation. Alternatively, the communication distance between the Bluetooth headset and the mobile phone is greater than the Bluetooth communication distance threshold, and after the established Bluetooth connection is automatically disconnected, the Bluetooth headset moves again to a position where the distance between the Bluetooth headset and the mobile phone is less than or equal to the Bluetooth communication distance threshold, and then automatically sends a Bluetooth connection establishment request to the mobile phone (i.e., starts the Bluetooth reconnection process). Correspondingly, the mobile phone receives the connection establishment request sent by the Bluetooth headset.
[0132] S802: The mobile phone determines that the Bluetooth connection fails and deletes the pairing relationship.
[0133] In some embodiments, the Bluetooth connection process includes a pairing process and a connection process. After receiving the connection establishment request, if the mobile phone requests to establish a Bluetooth connection for the first time, the pairing process is started to establish a pairing relationship between the mobile phone Bluetooth and the Bluetooth headset Bluetooth. If it is a Bluetooth back connection process, the pairing relationship between the mobile phone Bluetooth and the Bluetooth headset Bluetooth has been established.
[0134] After that, based on the pairing relationship, the mobile phone executes the connection process. During the connection process, if a connection abnormality occurs (such as a Bluetooth software failure), the Bluetooth connection fails. After the mobile phone determines that the Bluetooth connection fails, it automatically deletes the established Bluetooth pairing relationship with the Bluetooth headset, so that it can re-pair the Bluetooth connection without being restricted by the existing pairing relationship.
[0135] In some embodiments, after the mobile phone determines that the Bluetooth connection establishment between the mobile phone and the Bluetooth headset fails, a Bluetooth connection failure response can be sent to the Bluetooth headset. Correspondingly, after receiving the Bluetooth connection failure response, the Bluetooth headset resends a Bluetooth connection establishment request to the mobile phone, and after receiving the Bluetooth connection establishment request, the mobile phone attempts to establish a Bluetooth connection with the Bluetooth headset again. Repeat the above steps until the mobile phone determines that the number of reconnections exceeds a preset threshold or the reconnection duration exceeds a preset duration, then the Bluetooth connection is determined to have failed, and the pairing relationship is deleted, thereby avoiding Bluetooth connection failures caused by abnormal reasons such as poor signals and improving Bluetooth reconnection efficiency.
[0136] It should be noted that if during the Bluetooth connection process, if the Bluetooth of the mobile phone and the Bluetooth headset Bluetooth pairing process is abnormal, resulting in Bluetooth connection failure, the mobile phone also needs to delete the pairing relationship. In other words, after determining that the Bluetooth connection between the mobile phone and the Bluetooth headset fails to be established, the mobile phone executes step S802 to delete the pairing relationship.
[0137] S803. The mobile phone generates a special control word and a PIN code.
[0138] In some embodiments, the length and value of a special control word are preset in the mobile phone and the Bluetooth headset. The special control word is used to indicate that the previous Bluetooth connection failed and Bluetooth pairing needs to be re-performed. The special control word is used to instruct the Bluetooth headset to use a personal identification (PIN) code as a security verification code for pairing confirmation, so that the pairing process can be completed directly using the PIN code without the user confirming again. It can be understood that the special control word, as an indicator, can also be described as other names, such as an indicator, a control indicator, an indicator bit, a control character, etc.
[0139] In some embodiments, after the mobile phone determines that the Bluetooth connection has failed to be established, a PIN code generation algorithm is used to generate a PIN code. For example, the mobile phone generates a random number using a tool in the Bluetooth protocol stack, and uses the random number as the PIN code. The PIN code generation algorithm can refer to the PIN code generation algorithm in the prior art, and this embodiment of the application will not be described in detail.
[0140] In some embodiments, the mobile phone and the Bluetooth headset use data packets to transmit special control words and PIN codes. After the mobile phone obtains the preset special control word and generates the PIN code, the special control word and the PIN code are combined to generate a data packet. Fig. 9 As shown in FIG. 1 , the data packet contains two fields, one field is used to carry the special control word, and the other field is used to carry the PIN code. For example, assuming that the length of the data packet is 8 bytes, the first 2 bytes (such as Fig. 9 Bytes 0 and 1 are used to carry special control words, and the last 6 bytes (such as Fig. 9 Bytes 2 to 7 shown in the figure are used to carry the PIN code. Assuming that the values of the two bytes corresponding to the special control word are 0x03 and 0x09 respectively, subsequently, after receiving the data packet sent by the mobile phone and parsing the data packet, the Bluetooth headset reads the values of the first two bytes, compares the read special control word with the preset special control word, and thus determines that the current data packet is used to indicate abnormal re-pairing. After that, the Bluetooth headset can obtain the PIN code carried in the data packet and start the re-pairing process. It is understandable that there can be other data packet designs for indicating the transmission of special control words and PIN codes. For example, data packets of other byte lengths are used to carry special control words and PIN codes.
[0141] S804. The mobile phone sends a special control word and a PIN code to the Bluetooth headset.
[0142] In some embodiments, after the mobile phone determines the special control word and PIN code, the logical connection between the mobile phone and the Bluetooth headset is abnormal due to the failure of the current Bluetooth connection establishment, and data cannot be directly transmitted. Therefore, the mobile phone sends a connection establishment request to the Bluetooth headset to establish a logical connection for transmitting the special control word and PIN code. Optionally, the logical connection is an encrypted logical connection based on the Bluetooth physical connection between the mobile phone and the Bluetooth headset.
[0143] Exemplarily, the mobile phone uses the physical connection between the mobile phone and the Bluetooth headset to send a connection establishment request to the Bluetooth headset and receive a connection establishment response sent by the Bluetooth headset, thereby establishing an encrypted logical connection between the mobile phone and the Bluetooth headset. Afterwards, the mobile phone uses the encrypted logical connection to send a special control word and a PIN code to the Bluetooth headset. For example, the mobile phone sends a re-pairing instruction to the Bluetooth headset, and the re-pairing instruction carries a special control word and a PIN code, which is used to instruct the Bluetooth headset and the mobile phone to re-pair with Bluetooth using the PIN code.
[0144] For example, the mobile phone sends a data packet packaged in the above step S803 to the Bluetooth headset. For another example, the mobile phone sends a data message to the Bluetooth headset, and the special control word and PIN code are directly carried in the data message. For another example, the mobile phone uses an encrypted logical link to send a special control word and a PIN code to the Bluetooth headset respectively. In this way, after receiving the special control word and PIN code sent by the mobile phone, the Bluetooth headset can determine that a new Bluetooth pairing relationship needs to be re-established, and automatically delete the original Bluetooth pairing relationship.
[0145] It should be noted that, as mentioned above, Bluetooth connection failure generally occurs during the connection process. Before the Bluetooth connection between the mobile phone and the Bluetooth headset fails to be established, the mobile phone Bluetooth and the Bluetooth headset Bluetooth have established a pairing relationship. Therefore, the logical connection for the mobile phone to send the special control word and PIN code to the Bluetooth headset is a trusted logical connection established based on the pairing relationship, which ensures the security of the transmission of the special control word and PIN code.
[0146] S805. The Bluetooth headset sends a receiving response to the mobile phone.
[0147] In some embodiments, after receiving the special control word and PIN code, the Bluetooth headset determines that the special control word and PIN code can be parsed, and then sends a receiving response to the mobile phone. The receiving response is used to indicate normal reception. If the reception is abnormal, the Bluetooth headset does not send a receiving response to the mobile phone, or sends a receiving abnormal response to the mobile phone. Correspondingly, the mobile phone receives the receiving response sent by the Bluetooth headset, and according to the receiving response, the mobile phone can determine that the Bluetooth headset has correctly received the special control word and PIN code.
[0148] S806. The Bluetooth headset deletes the pairing relationship.
[0149] The pairing relationship includes, for example, a pairing relationship between a Bluetooth headset and a mobile phone.
[0150] In some embodiments, after the Bluetooth headset obtains the special control word, if it determines that Bluetooth pairing needs to be re-performed, the existing pairing relationship between the headset and the mobile phone Bluetooth is deleted, so that the Bluetooth pairing connection can be re-performed subsequently without being restricted by the existing pairing relationship.
[0151] In this way, when the Bluetooth connection between the mobile phone and the Bluetooth headset is abnormal, the Bluetooth pairing relationship can be automatically deleted without the user's manual intervention, thus achieving user-imperceptible deletion of the pairing relationship, improving Bluetooth reconnection efficiency, and enhancing user experience.
[0152] It should be noted that the embodiment of the present application does not limit the execution order of the above steps S805 and S806. For example, after the Bluetooth headset sends a receive response to the mobile phone, it deletes the pairing relationship. For another example, after receiving the special control word and the PIN code, the Bluetooth headset sends a receive response to the mobile phone and deletes the pairing relationship at the same time. For another example, after deleting the pairing relationship, the Bluetooth headset sends a receive response to the mobile phone.
[0153] S807. The Bluetooth headset and the mobile phone disconnect the established abnormal connection.
[0154] In some embodiments, in the above step S802, the Bluetooth headset and the mobile phone have an abnormal Bluetooth connection. At this time, the Bluetooth headset and the mobile phone need to delete the abnormal connection that has been established. For example, if there is a defect in the Bluetooth software, such as an error in the connection process interaction logic processing during the Bluetooth connection process, the abnormal connection is disconnected. Furthermore, the physical connection between the Bluetooth headset and the mobile phone can also be disconnected, as well as the logical connection established in the above step S804 for transmitting the special control word and the PIN code.
[0155] S808. The Bluetooth headset sends a pairing request to the mobile phone.
[0156] In some embodiments, the pairing request carries a PIN code, and the pairing request is used to instruct the mobile phone to re-pair with the Bluetooth headset based on the PIN code. Optionally, in the above step S807, if the Bluetooth headset and the mobile phone have been physically disconnected, a physical connection is re-established between the Bluetooth headset and the mobile phone to transmit the pairing request.
[0157] S809: The mobile phone sends a pairing response to the Bluetooth headset.
[0158] In some embodiments, after receiving the pairing request, the mobile phone obtains the PIN code and compares it with the PIN code sent to the Bluetooth headset in step S804. If they are the same, the pairing is confirmed to be successful. Afterwards, the mobile phone sends a pairing response to the Bluetooth headset to notify the Bluetooth headset that the current Bluetooth pairing is successful.
[0159] Re-establish the Bluetooth connection between the S810, Bluetooth headset and mobile phone.
[0160] In some implementations, after receiving the pairing response, the Bluetooth headset determines that the Bluetooth pairing process has been completed, and then executes the Bluetooth connection process to re-establish the Bluetooth connection with the mobile phone.
[0161] It should be noted that in the embodiment of the present application, a Bluetooth headset is used as an initiating device and a mobile phone is used as a responding device. Correspondingly, the Bluetooth headset can also be used as a responding device and the mobile phone can also be used as an initiating device. Then, the Bluetooth headset as a responding device can execute the corresponding steps executed by the mobile phone, and the mobile phone as an initiating device can execute the corresponding steps executed by the Bluetooth headset. This embodiment of the present application will not be repeated.
[0162] In addition, the Bluetooth connection method provided in the embodiment of the present application is also applicable to the scenario of establishing a Bluetooth connection for the first time. That is, during the process of establishing a Bluetooth connection between a Bluetooth headset and a mobile phone for the first time, due to hidden defects in the Bluetooth protocol software, the connection is abnormal, and the Bluetooth connection method provided in the embodiment of the present application can also be used to perform Bluetooth reconnection.
[0163] In this way, after the Bluetooth connection fails, the mobile phone or Bluetooth headset can automatically generate a PIN code for pairing and delete the established Bluetooth pairing relationship after determining that the Bluetooth connection fails, thereby completing the Bluetooth pairing and connection without the user's awareness, thereby improving the user experience. Compared with the prior art, which can only solve the problem of Bluetooth connection failure caused by abnormal Bluetooth link keywords, the embodiment of the present application can not only solve the problem of Bluetooth connection failure caused by abnormal Bluetooth link keywords, but also solve other Bluetooth connection anomalies caused by Bluetooth software defects.
[0164] Furthermore, the Bluetooth connection method provided in the embodiment of the present application does not need to predetermine the cause of the abnormality when a Bluetooth connection abnormality occurs, but can directly and automatically delete the pairing relationship and automatically perform Bluetooth pairing and connection.
[0165] The above describes in detail the Bluetooth connection method provided by the embodiment of the present application. Fig.10 The Bluetooth connection device provided in the embodiment of the present application is described in detail.
[0166] Fig.10 This is a schematic diagram of the structure of the Bluetooth connection device provided in the embodiment of the present application. Fig.10 As shown, the Bluetooth connection device 1000 includes: a processing module 1001 and a transceiver module 1002 .
[0167] In one possible design, the Bluetooth connection device 1000 can be used to implement the functions of the first electronic device involved in the above method embodiment. The Bluetooth connection device 1000 can be the first electronic device itself, or a functional unit or chip in the first electronic device, or a device used in conjunction with the first electronic device.
[0168] Optionally, the processing module 1001 is used to support the Bluetooth connection device 1000 to execute Figure 8 Steps S802 and S803 in ; and / or other processes for the technology described herein.
[0169] Optionally, the transceiver module 1002 is used to support the Bluetooth connection device 1000 to execute Figure 8 Step S801, step S804, step S805, step S807, step S808, step S809 and step S810 in; and / or other processes for the technology described herein.
[0170] In another possible design, the Bluetooth connection device 1000 can also be used to implement the functions of the second electronic device involved in the above method embodiment. The Bluetooth connection device 1000 can be the second electronic device itself, or a functional unit or chip in the second electronic device, or a device used in conjunction with the second electronic device.
[0171] Optionally, the processing module 1001 is used to support the Bluetooth connection device 1000 to execute Figure 8 Step S806 in; and / or other processes for the techniques described herein.
[0172] Optionally, the transceiver module 1002 is used to support the Bluetooth connection device 1000 to execute Figure 8 Step S801, step S804, step S805, step S807, step S808, step S809 and step S810 in; and / or other processes for the technology described herein.
[0173] Optionally, the processing module 1001 may be a processor or a controller. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the embodiments of the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0174] Optional, Fig.10The transceiver module in the Bluetooth connection device 1000 shown may include a receiving module and a sending module, which may be implemented by a transceiver or a transceiver-related circuit component, and may be a transceiver or a transceiver module. Among them, the receiving module is used to receive signals sent by other communication devices, and the sending module is used to send signals to other communication devices. The operations and / or functions of each unit in the Bluetooth connection device 1000 are respectively to implement the corresponding processes of the Bluetooth connection method described in the above method embodiment, and for the sake of brevity, they are not repeated here.
[0175] Optional, Fig.10 The Bluetooth connection device 1000 shown may also include a storage unit ( Fig.10 (not shown), the storage unit stores a program or instruction. When the processing module 1001 and the transceiver module 1002 execute the program or instruction, Fig.10 The Bluetooth connection device 1000 shown can execute the Bluetooth connection method described in the above method embodiment.
[0176] Fig.10 The technical effects of the Bluetooth connection device 1000 shown can refer to the technical effects of the Bluetooth connection method described in the above method embodiment, which will not be repeated here.
[0177] An embodiment of the present application also provides a chip system, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the chip system implements the method in any of the above method embodiments.
[0178] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0179] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately arranged with the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be arranged on different chips respectively. The embodiments of the present application do not specifically limit the type of memory and the arrangement of the memory and the processor.
[0180] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0181] It should be understood that each step in the above method embodiment can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0182] An embodiment of the present application also provides a storage medium for storing instructions used by the above-mentioned communication device.
[0183] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a server, the server executes the above-mentioned related method steps to implement the Bluetooth connection method in the above-mentioned embodiment.
[0184] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the Bluetooth connection method in the above-mentioned embodiment.
[0185] In addition, the embodiment of the present application also provides a device, which may be a component or a module, and may include one or more processors and a memory connected to each other; wherein the memory is used to store computer programs, and the one or more computer programs include instructions. When the instructions are executed by one or more processors, the device executes the Bluetooth connection method in the above-mentioned method embodiments.
[0186] Among them, the device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0187] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).
[0188] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0189] In the several embodiments provided in the present application, it should be understood that the disclosed method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of modules or units, which can be electrical, mechanical or other forms.
[0190] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0191] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0192] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0193] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A Bluetooth connection method, characterized in that: Applied to a first device, the method includes: Determine that the Bluetooth connection fails and delete the first pairing relationship; Establishing a second connection by using the first connection established during the Bluetooth connection failure process, wherein the first connection is a physical connection corresponding to the first pairing relationship; Sending a data packet to the second device through the second connection, the data packet carrying a first identifier and a first identification code; the first identifier is used to instruct the second device to establish a second pairing relationship with the first device using the first identification code; disconnecting the abnormal connection with the second device; receiving a pairing request sent by the second device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code; Re-establish a Bluetooth connection with the second device based on the pairing request.
2. The method according to claim 1, characterized in that After disconnecting the abnormal connection with the second device, the method further includes: The first connection and the second connection are disconnected.
3. The method according to claim 1 or 2, characterized in that: Before sending the data packet to the second device, the method further includes: Obtaining the preset first identifier and generating the first identification code; The data packet is generated by packaging the first identifier and the first identification code.
4. The method according to claim 1 or 2, characterized in that: The data packet includes a first field and a second field, the first field is used to indicate the first identifier, and the second field is used to indicate the first identification code.
5. The method according to claim 1 or 2, characterized in that: The re-establishing a Bluetooth connection with the second device based on the pairing request includes: identifying the second identification code carried in the pairing request; Determining that the second identification code is the same as the first identification code, then determining to establish the second pairing relationship with the second device; Based on the second pairing relationship, a Bluetooth connection is re-established with the second device.
6. The method according to claim 1 or 2, characterized in that: The determining that the Bluetooth connection fails includes: If it is determined that the Bluetooth connection duration exceeds a preset duration and / or the number of Bluetooth reconnections exceeds a preset threshold, it is determined that the Bluetooth connection fails.
7. A Bluetooth connection method, characterized in that: Applied to the second device, the method includes: Establishing a second connection by using the first connection established during the Bluetooth connection failure process, wherein the first connection is a physical connection corresponding to the first pairing relationship; receiving a data packet sent by the first device through the second connection, the data packet carrying a first identifier and a first identification code; the first identifier is used to instruct the second device to establish a second pairing relationship with the first device using the first identification code; Deleting the first pairing relationship; disconnecting the abnormal connection with the first device; Sending a pairing request to the first device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code; Receive a pairing response sent by the first device, and re-establish a Bluetooth connection with the first device.
8. The method according to claim 7, characterized in that After disconnecting the abnormal connection with the first device, the method further includes: The first connection and the second connection are disconnected.
9. The method according to claim 7 or 8, characterized in that: The data packet includes a first field and a second field, the first field is used to indicate the first identifier, and the second field is used to indicate the first identification code.
10. An electronic device, characterized in that: include: A processor and a memory, the memory being coupled to the processor, the memory being used to store computer program codes, the computer program codes comprising computer instructions, and when the processor reads the computer instructions from the memory, the electronic device performs the following operations: Determine that the Bluetooth connection fails and delete the first pairing relationship; Establishing a second connection by using the first connection established during the Bluetooth connection failure process, wherein the first connection is a physical connection corresponding to the first pairing relationship; Sending a data packet to the second device through the second connection, the data packet carrying a first identifier and a first identification code; the first identifier is used to instruct the second device to establish a second pairing relationship with the electronic device using the first identification code; disconnecting the abnormal connection with the second device; receiving a pairing request sent by the second device; the pairing request carries a second identification code, and the second identification code is the same as the first identification code; Re-establish a Bluetooth connection with the second device based on the pairing request.
11. The electronic device according to claim 10, characterized in that: When the processor reads the computer instructions from the memory, the electronic device also performs the following operations: The first connection and the second connection are disconnected.
12. The electronic device according to claim 10 or 11, characterized in that: When the processor reads the computer instructions from the memory, the electronic device also performs the following operations: Obtaining the preset first identifier and generating the first identification code; The data packet is generated by packaging the first identifier and the first identification code.
13. The electronic device according to claim 10 or 11, characterized in that: The data packet includes a first field and a second field, the first field is used to indicate the first identifier, and the second field is used to indicate the first identification code.
14. The electronic device according to claim 10 or 11, characterized in that: The re-establishing a Bluetooth connection with the second device based on the pairing request includes: identifying the second identification code carried in the pairing request; Determining that the second identification code is the same as the first identification code, then determining to establish the second pairing relationship with the second device; Based on the second pairing relationship, a Bluetooth connection is re-established with the second device.
15. The electronic device according to claim 10 or 11, characterized in that: The determining that the Bluetooth connection fails includes: If it is determined that the Bluetooth connection duration exceeds a preset duration and / or the number of Bluetooth reconnections exceeds a preset threshold, it is determined that the Bluetooth connection fails.
16. An electronic device, characterized in that: include: A processor and a memory, the memory being coupled to the processor, the memory being used to store computer program codes, the computer program codes comprising computer instructions, and when the processor reads the computer instructions from the memory, the electronic device performs the following operations: Establishing a second connection by using the first connection established during the Bluetooth connection failure process, wherein the first connection is a physical connection corresponding to the first pairing relationship; receiving a data packet sent by the first device through the second connection, the data packet carrying a first identifier and a first identification code; the first identifier is used to instruct the electronic device to establish a second pairing relationship with the first device using the first identification code; Deleting the first pairing relationship; disconnecting the abnormal connection with the first device; Sending a pairing request to the first device; The pairing request carries a second identification code, and the second identification code is the same as the first identification code; Receive a pairing response sent by the first device, and re-establish a Bluetooth connection with the first device.
17. The electronic device according to claim 16, characterized in that: When the processor reads the computer instructions from the memory, the electronic device also performs the following operations: The first connection and the second connection are disconnected.
18. The electronic device according to claim 16 or 17, characterized in that: The data packet includes a first field and a second field, the first field is used to indicate the first identifier, and the second field is used to indicate the first identification code.
19. A computer-readable storage medium, characterized in that: The method comprises a program or an instruction. When the program or the instruction is executed, the method according to any one of claims 1 to 6 is implemented, or the method according to any one of claims 7 to 9 is implemented.
Citation Information
Patent Citations
Self-adapted match method between different Bluetooth devices
CN101127538B
Mobile terminal, Bluetooth Key and connection method, storage medium and system
CN107635290A