Bluetooth connection method and electronic equipment

By deleting the pairing information and sending broadcast information when the Bluetooth pairing is unblocked, the problem of failure of the device to connect again is solved, and a stable Bluetooth connection process is achieved.

CN120434831AActive Publication Date: 2025-08-05HONOR DEVICE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411487731.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-08-05
Estimated Expiration
2044-10-23

AI Technical Summary

Technical Problem

After both devices have completed Bluetooth pairing and one of them is unpaired, the Bluetooth connection failure may occur when the two devices establish a Bluetooth connection again.

Method used

When the first device unpairs Bluetooth, it deletes the pairing information of the second device and generates broadcast information, instructs the second device to cancel the pairing relationship, and then sends a Bluetooth connection request; the second device also deletes the pairing information after receiving the broadcast information, and successfully establishes a Bluetooth connection.

Benefits of technology

Ensures the success of the device when it is connected again after unpaired, avoids frequent pairing pop-ups and connection failures, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120434831A_ABST
    Figure CN120434831A_ABST
Patent Text Reader

Abstract

The invention provides a Bluetooth connection method and electronic equipment, and is applied to the technical field of communication, the method is applied to a system comprising first electronic equipment and second electronic equipment, and the first electronic equipment and the second electronic equipment establish a Bluetooth pairing relationship. The method comprises the following steps: in response to release of Bluetooth pairing between first electronic equipment and second electronic equipment, the first electronic equipment deletes pairing information of the second electronic equipment and generates first broadcast information; the first electronic equipment sends first broadcast information to the second electronic equipment, and the second electronic equipment deletes pairing information of the first electronic equipment under the condition that the second electronic equipment receives the first broadcast information; subsequently, the first electronic equipment sends a Bluetooth connection request to the second electronic equipment, and the first electronic equipment establishes Bluetooth connection with the second electronic equipment under the condition that the second electronic equipment receives the Bluetooth connection request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technologies, and in particular, to a Bluetooth connection method and an electronic device. Background Art

[0002] With the wide use of electronic devices, the use of Bluetooth is also increasing day by day. Bluetooth is a radio technology that supports short-distance communication between devices (generally within 10 m), and can perform wireless information exchange between many devices including mobile phones, PDAs, wireless headsets, laptop computers, related peripherals, etc. By using Bluetooth, the communication between mobile communication devices can be effectively simplified, and the communication between devices and the Internet can also be successfully simplified, thus making data transmission faster and more efficient, and broadening the path for wireless communication. In addition, as a short-range wireless connection technology, Bluetooth can achieve convenient, flexible, safe, low-cost, and low-power data communication and voice communication between devices. Therefore, it is one of the mainstream technologies for wireless personal area network (PAN) communication.

[0003] In the related art, after two devices complete Bluetooth pairing, when the user unpairs Bluetooth on one of the devices, when the two devices establish a Bluetooth connection again, a problem of failed Bluetooth connection may occur. Therefore, there is an urgent need for a new Bluetooth connection solution to solve the above problems. Summary of the Invention

[0004] The embodiments of the present application provide a Bluetooth connection method and an electronic device, which are used to solve the problem that when two devices complete Bluetooth pairing and then one of the devices unpairs Bluetooth, a problem of failed Bluetooth connection may occur when the two electronic devices establish a Bluetooth connection again.

[0005] To achieve the above object, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a Bluetooth connection method is provided, which is applied to a first electronic device that has established a Bluetooth pairing relationship with a second electronic device. The method includes: in response to the first electronic device and the second electronic device unpairing Bluetooth, the first electronic device deletes the pairing information of the second electronic device and generates first broadcast information; the first broadcast information is used to instruct the second electronic device to unpair the Bluetooth pairing relationship with the first electronic device.

[0007] A first electronic device sends a first broadcast message to a second electronic device, wherein upon receiving the first broadcast message, the second electronic device deletes the pairing information of the first electronic device. Then, after the first electronic device sends the first broadcast message to the second electronic device, the first electronic device sends a Bluetooth connection request to the second electronic device; wherein upon receiving the Bluetooth connection request, the first electronic device establishes a Bluetooth connection with the second electronic device.

[0008] Based on the first aspect, when the first electronic device cancels Bluetooth pairing, it deletes the pairing information of the second electronic device, generates a first broadcast message, and sends the first broadcast message to the second electronic device. The first broadcast message is used to instruct the second electronic device to cancel the Bluetooth pairing relationship with the first electronic device. Therefore, upon receiving the first broadcast message, the second electronic device deletes the pairing information of the first electronic device. In this case, since the second electronic device has already deleted the pairing information of the first electronic device, the first electronic device sends a Bluetooth connection request to the second electronic device. When the second electronic device receives the Bluetooth connection request, the first electronic device and the second electronic device successfully establish a Bluetooth connection.

[0009] In a possible implementation of the first aspect, the method further includes: when the second electronic device does not receive the first broadcast message, after the first electronic device sends a Bluetooth connection request to the second electronic device, receiving a Bluetooth pairing request sent by the second electronic device; wherein the second electronic device stores the pairing information of the first electronic device, and after receiving the Bluetooth connection request, the second electronic device sends a Bluetooth pairing request to the first electronic device; the first electronic device displays a pairing pop-up window; in response to the display of the pairing pop-up window by the first electronic device, a second broadcast message is generated, and the second broadcast message is sent to the second electronic device, wherein the second broadcast message is used to instruct the second electronic device to cancel the Bluetooth pairing relationship with the first electronic device.

[0010] In this implementation, when the first electronic device displays a pairing pop-up window, the first electronic device generates a second broadcast message and sends the second broadcast message to the second electronic device. After receiving the second broadcast message, the second electronic device deletes the pairing information of the first electronic device, and subsequently, the first electronic device and the second electronic device can successfully establish a Bluetooth connection.

[0011] In a possible implementation of the first aspect, in response to the first electronic device and the second electronic device unpaired via Bluetooth, the first electronic device deletes the pairing information of the second electronic device and generates a first broadcast message, including: in response to the first electronic device and the second electronic device unpaired via Bluetooth, the first electronic device deletes the pairing information of the second electronic device, determines that the last pairing state between the first electronic device and the second electronic device is the paired state, and the current pairing state is the unpaired state, and generates a first broadcast message.

[0012] That is to say, based on the last pairing state between the first electronic device and the second electronic device being the paired state and the current pairing state being the unpaired state, the first electronic device determines that the Bluetooth pairing with the second electronic device is released, thereby generating a first broadcast message.

[0013] In a possible implementation of the first aspect, in response to the first electronic device displaying a pairing pop-up window, a second broadcast message is generated, including: in response to the first electronic device displaying a pairing pop-up window, it is determined that the last pairing state between the first electronic device and the second electronic device is the unpaired state, and the current pairing state is the pairing state, and a second broadcast message is generated.

[0014] That is to say, based on the last pairing state between the first electronic device and the second electronic device being the unpaired state and the current pairing state being the pairing state, the first electronic device determines that the first electronic device displays a pairing pop-up window, thereby generating a second broadcast message.

[0015] In a possible implementation of the first aspect, there is no established Bluetooth pairing relationship between the first electronic device and the third electronic device. The method further includes: the first electronic device sends a Bluetooth pairing request to the third electronic device, generates a third broadcast message, and sends the third broadcast message to the third electronic device; the third broadcast message is used to instruct the third electronic device to release the Bluetooth pairing relationship with the first electronic device.

[0016] Optionally, based on the last pairing state between the first electronic device and the third electronic device being the unpaired state and the current pairing state being the unpaired state, the first electronic device determines that there is no established Bluetooth pairing relationship between the first electronic device and the third electronic device. Then, when the first electronic device and the third electronic device first establish a Bluetooth pairing, the first electronic device sends a Bluetooth pairing request to the third electronic device and generates a third broadcast message to instruct the third electronic device to release the Bluetooth pairing relationship with the first electronic device.

[0017] In this case, since the first electronic device and the third electronic device have not established a Bluetooth pairing relationship, the third electronic device does not store the pairing information of the first electronic device. Therefore, even if the third electronic device receives the third broadcast information, the third electronic device does not need to delete the pairing information of the first electronic device. Based on this, after the first electronic device sends the third broadcast information to the third electronic device, the first electronic device sends a Bluetooth connection request to the third electronic device. After the third electronic device receives the Bluetooth connection request, the first electronic device and the third electronic device establish a Bluetooth connection.

[0018] Compared to the existing technology, in this implementation, when the first electronic device and the third electronic device establish Bluetooth pairing, the first electronic device also generates and sends the third broadcast information to the third electronic device, which can further ensure that the Bluetooth connection between the first electronic device and the third electronic device is successfully established.

[0019] In another possible implementation of the first aspect, the first broadcast information includes a broadcast data packet and a data packet type of the broadcast data packet, where the data packet type is used to indicate that Bluetooth pairing is to be released. The broadcast data packet includes a MAC address of the first electronic device and a MAC address of the second electronic device.

[0020] Alternatively, the broadcast data packet includes partial bytes of the MAC address of the first electronic device and partial bytes of the MAC address of the second electronic device, thereby ensuring the security of transmitting the first broadcast information.

[0021] In another possible implementation manner of the first aspect, the broadcast data packet further includes: a local timestamp, which is used to mark the first broadcast information sent this time.

[0022] In another possible implementation of the first aspect, the method further includes: when the duration for which the first electronic device sends the first broadcast information to the second electronic device exceeds a preset duration, the first electronic device stops sending the first broadcast information to the second electronic device, thereby avoiding wasting resources by continuously sending the first broadcast information.

[0023] In a second aspect, a Bluetooth connection method is provided, which is applied to a second electronic device, where the second electronic device establishes a Bluetooth pairing relationship with a first electronic device, and the method includes: the second electronic device receives a first broadcast message; wherein the first broadcast message is generated by the first electronic device in response to the first electronic device and the second electronic device canceling the Bluetooth pairing, and the first electronic device deletes the pairing information of the second electronic device, and the first broadcast message is used to instruct the second electronic device to delete the Bluetooth pairing relationship with the first electronic device.

[0024] When the second electronic device receives the first broadcast information, the second electronic device deletes the pairing information of the first electronic device; after the second electronic device receives the first broadcast information, when the second electronic device receives the Bluetooth connection request from the first electronic device, the second electronic device establishes a Bluetooth connection with the first electronic device.

[0025] Based on the second aspect, when the first electronic device cancels Bluetooth pairing, it deletes the pairing information of the second electronic device, generates a first broadcast message, and sends the first broadcast message to the second electronic device. The first broadcast message is used to instruct the second electronic device to cancel the Bluetooth pairing relationship with the first electronic device. Therefore, upon receiving the first broadcast message, the second electronic device deletes the pairing information of the first electronic device. In this case, since the second electronic device has already deleted the pairing information of the first electronic device, the first electronic device sends a Bluetooth connection request to the second electronic device. When the second electronic device receives the Bluetooth connection request, the first electronic device and the second electronic device successfully establish a Bluetooth connection.

[0026] In a possible implementation of the second aspect, when a second electronic device receives the first broadcast information, the second electronic device deletes the pairing information of the first electronic device, including: when the second electronic device receives the first broadcast information, the second electronic device determines, based on the first broadcast information, whether the second electronic device has the pairing information of the first electronic device; and if it is determined that the second electronic device has the pairing information of the first electronic device, the second electronic device deletes the pairing information of the first electronic device. In this way, the accuracy of the deletion of the pairing information of the first electronic device by the second electronic device can be ensured.

[0027] In one possible implementation of the second aspect, when a second electronic device receives the first broadcast information, the second electronic device determines, based on the first broadcast information, whether the second electronic device has pairing information for the first electronic device. This includes: when the second electronic device receives the first broadcast information, if the MAC address of the first electronic device included in the first broadcast information is included in the paired device information, determining that the second electronic device has pairing information for the first electronic device. This reduces power consumption and prevents the second electronic device from accidentally deleting pairing information.

[0028] In one possible implementation of the second aspect, when a second electronic device receives the first broadcast information, the second electronic device determines, based on the first broadcast information, whether the second electronic device has pairing information for the first electronic device. This includes: when the second electronic device receives the first broadcast information, the second electronic device initiates a subthread to determine, based on the first broadcast information, whether the second electronic device has pairing information for the first electronic device. This avoids the main thread being blocked for a long time due to the initiation of the main thread.

[0029] In one possible implementation of the second aspect, upon determining that the second electronic device has pairing information for the first electronic device, the second electronic device deletes the pairing information for the first electronic device, including: upon determining that the second electronic device has pairing information for the first electronic device, obtaining a device identifier for the first electronic device using the MAC address of the first electronic device included in the first broadcast information; and inputting the device identifier of the first electronic device into a release process to delete the pairing information for the first electronic device. This avoids exceptions in the main process that could cause release failure.

[0030] In one possible implementation of the second aspect, when a second electronic device receives the first broadcast information, the second electronic device determines, based on the first broadcast information, whether the second electronic device has pairing information for the first electronic device. This includes: when the second electronic device receives the first broadcast information, after determining that the MAC address of the second electronic device included in the first broadcast information is the same as the local MAC address, determining, based on the first broadcast information, whether the second electronic device has pairing information for the first electronic device. In this way, power consumption can be reduced and accidental deletion of pairing information can be avoided.

[0031] In a third aspect, an electronic device is provided, wherein the electronic device has the function of implementing the first aspect or any one of the first aspects, and the electronic device has the function of implementing the second aspect or any one of the second aspects. The functions may be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0032] In a fourth aspect, an electronic device is provided, comprising: a memory and one or more processors; a display screen for displaying images; computer program code is stored in the memory, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the electronic device executes the method described in the first aspect or any one of the first aspects; or, the electronic device executes the method described in the second aspect or any one of the second aspects.

[0033] In a fifth aspect, a Bluetooth connection system is provided, comprising a first electronic device for executing the above-mentioned first aspect or any one of the methods in the first aspect, and a second electronic device for executing the above-mentioned second aspect or any one of the methods in the second aspect.

[0034] In a sixth aspect, a chip system is provided and applied to an electronic device. The chip system includes at least one processor and an interface. The interface is configured to receive instructions and transmit them to the at least one processor. The at least one processor runs the instructions to cause the electronic device to execute the method described in any one of the above first aspects; or execute the method described in the above second aspect or any one of the second aspects.

[0035] In a seventh aspect, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium. When the instructions are run on a computer, the computer can execute the method described in any one of the above first aspects; or execute the method described in the above second aspect or any one of the second aspects.

[0036] In an eighth aspect, a computer program product containing instructions is provided. When the computer program product is run on a computer, the computer can execute the method described in any one of the above first aspects; or execute the method described in the above second aspect or any one of the second aspects.

[0037] Wherein, the technical effects brought by any implementation manner in the third aspect to the eighth aspect can refer to the technical effects brought by different implementation manners in the first aspect and the second aspect, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of a Bluetooth pairing interface provided by an embodiment of the present application Figure 1 ;

[0039] Figure 2 A schematic diagram of a Bluetooth pairing interface provided by an embodiment of the present application Figure 2 ;

[0040] Figure 3 A schematic diagram of a Bluetooth pairing interface provided by an embodiment of the present application Figure 3 ;

[0041] Figure 4 A schematic flow diagram of a Bluetooth pairing provided by an embodiment of the present application;

[0042] Figure 5 A schematic diagram of a Bluetooth connection interface provided by an embodiment of the present application Figure 1 ;

[0043] Figure 6 A schematic diagram of a trust ring provided by an embodiment of the present application;

[0044] Figure 7 A schematic diagram of an un-pairing interface provided by an embodiment of the present application;

[0045] Figure 8A schematic diagram of a Bluetooth connection interface provided in an embodiment of the present application Figure 2 ;

[0046] Figure 9 A schematic diagram of the hardware structure of a mobile phone provided in an embodiment of the present application;

[0047] Figure 10 A schematic diagram of a Bluetooth connection process provided in an embodiment of the present application Figure 1 ;

[0048] Figure 11 A schematic diagram of a pairing state provided in an embodiment of the present application;

[0049] Figure 12 A schematic diagram of a process for sending broadcast information provided in an embodiment of the present application Figure 1 ;

[0050] Figure 13 A schematic diagram of a process for sending broadcast information provided in an embodiment of the present application Figure 2 ;

[0051] Figure 14 A schematic diagram of a process for sending broadcast information provided in an embodiment of the present application Figure 3 ;

[0052] Figure 15 A schematic diagram of a process for unpairing a laptop computer from a mobile phone using Bluetooth technology provided in an embodiment of the present application;

[0053] Figure 16 A schematic diagram of a software framework for a mobile phone and a laptop computer provided in an embodiment of the present application;

[0054] Figure 17 A schematic diagram of a Bluetooth connection process provided in an embodiment of the present application Figure 2 ;

[0055] Figure 18 A schematic structural diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following describes the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be a limitation of the present application. As used in the specification and appended claims of the present application, the singular forms "a", "the", "above-mentioned", "this" and "such" are also intended to include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one" and "one or more" mean one or more than two (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships: for example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0057] The reference to "one embodiment" or "some embodiments" etc. described in this specification means that a specific feature, structure or characteristic described in combination with that embodiment is included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprise", "include", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise stated. "First" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features.

[0058] In the embodiments of the present application, words such as "exemplarily" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplarily" or "for example" in the embodiments of the present application should not be construed as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.

[0059] For the convenience of understanding, the terms used in the embodiments of the present application are introduced below. It should be understood that the terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be a limitation of the present application.

[0060] 1. Electronic device.

[0061] In the embodiments of the present application, the electronic device supports the Bluetooth function and can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, as well as a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device, and / or a smart city device, etc. The embodiments of the present application do not specifically limit the form of the electronic device.

[0062] Optionally, the electronic device can also be a Bluetooth headset, a bracelet, a watch, a body fat scale, a Bluetooth blood pressure monitor, a wearable device (such as Bluetooth glasses, VR glasses, etc.), a vehicle-mounted device, a Bluetooth speaker, a smart home device, and / or a smart city device, an Internet of Things device, a projector, a sensor, etc. It can also be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a PDA, etc.

[0063] 2. Bluetooth type.

[0064] The Bluetooth type refers to the Bluetooth protocol type supported by the Bluetooth device. In the Bluetooth 4.0 standard, the Bluetooth protocol can be divided into the classic Bluetooth (BT) protocol and the Bluetooth low energy (BLE) protocol. BT can also be described as basic rate (BR), enhanced data rate (EDR), etc. BLE can also be described as Bluetooth smart, low power consumption, etc. Exemplarily, in the Bluetooth 4.0 standard, the performance comparison between BT and BLE can be seen in Table 1 below.

[0065] Table 1

[0066] Bluetooth protocol type BT BLE Distance Approximately 100 meters Greater than 100 meters Data rate 1 - 3 Mbps 1 Mbps Latency 100 ms 6 ms Voice function Yes No Power consumption 1W 0.01~0.05W Network topology Star Star Peak current consumption Less than 30 mA Less than 15 mA

[0067] For devices that support the Bluetooth 4.0 standard, the devices can be further divided into BT single-mode, BLE single-mode, and BT and BLE dual-mode. As the name implies, BT single-mode means supporting BT but not BLE, BLE single-mode means supporting BLE but not BT, and BT and BLE dual-mode means supporting both BT and BLE. Usually, electronic devices such as mobile phones support BT and BLE dual-mode, while some Bluetooth devices support BLE single-mode to save power, such as sensors; or some Bluetooth devices with limited transmission distance support BT single-mode, such as wearable devices, Bluetooth speakers, etc.

[0068] With the development of Bluetooth technology, the Bluetooth 5.0 standard with a longer transmission distance and faster data rate has emerged. Compared with the Bluetooth 4.0 standard, the performance of the Bluetooth 5.0 standard has been improved, but the basic Bluetooth protocol can still be divided into the BT protocol and the BLE protocol.

[0069] In the embodiments of this application, the Bluetooth types of Bluetooth devices can be divided into BT type and BLE type. For Bluetooth devices of different Bluetooth types, the electronic device calls different Bluetooth connection interfaces. For example, for a Bluetooth device of BT type, the electronic device calls the BR connection interface to establish a Bluetooth connection with the Bluetooth device; for a Bluetooth device of BLE type, the electronic device calls the BLE connection interface to establish a Bluetooth connection with the Bluetooth device.

[0070] 3. Bluetooth pairing.

[0071] Bluetooth pairing is an information registration method for connecting Bluetooth devices or electronic devices. By registering device information between devices, the connection between devices can be achieved. Among them, the device information can include but is not limited to device identification, Bluetooth type, device type, power information, media access control (MAC) address, internet protocol (IP) address, etc. The device identification is used to uniquely identify the device, which can be automatically generated by the device or generated as a string in response to user input. The Bluetooth type can be BT type or BLE type. The device type can be a watch, a bracelet, a Bluetooth headset, etc. The power information is used to indicate the remaining power of the electronic device or the Bluetooth device.

[0072] Exemplarily, taking the electronic devices as a mobile phone and a laptop as an example, assuming the mobile phone is the master pairing party and the laptop is the slave pairing party, for the Bluetooth application on the mobile phone, the Bluetooth pairing method between the mobile phone and the laptop can be any one of the following:

[0073] (1) Proximity discovery pairing.

[0074] Proximity discovery pairing means that the distance between the mobile phone and the laptop is short enough for the mobile phone to scan the laptop within its scanning range, so as to pair and establish a Bluetooth connection between the mobile phone and the laptop. Exemplarily, the user interface involved in this pairing method can be seen in Figure 1 from (1) to Figure 1 the user interface shown in (5) of Figure 1 After the mobile phone approaches the laptop, the mobile phone can display the user interface shown in (1) of Figure 1 This user interface displays an "Add Device" control 102. Detecting a click operation on this control 102, in response to this click operation, a scanning radar in the user interface shown in (2) of Figure 1 can be displayed, and Bluetooth devices in the environment where the mobile phone is located are searched. For example, in response to the approach operation of the mobile phone, the laptop is searched, and the user interface shown in (2) of Figure 1 also displays available devices 103. The available devices 103 include device information of the laptop searched after the mobile phone approaches, such as device identification and remaining current, etc. Detecting a click operation on the available device 103, in response to this click operation, a user interface shown in (3) of Figure 1 can be displayed. This user interface can be used to obtain Bluetooth message synchronization service permissions and displays a skip control and an agree control. Detecting a click operation on the agree control, in response to this click operation, a user interface shown in (4) of Figure 1 can be displayed, and a pairing request is sent to the laptop. This user interface indicates that the mobile phone is pairing with the laptop. Receiving a pairing confirmation response from the laptop, a user interface shown in (5) of

[0075] (2) Manual addition pairing.

[0076] Manual addition pairing means pairing based on the type of Bluetooth device selected by the user. Exemplarily, the user interface involved in this pairing method can be seen in Figure 2 from (1) to Figure 2 the user interface shown in (4) of Figure 2 Exemplarily, the mobile phone displays the user interface shown in (1) of Figure 2 This user interface displays an "Add Device" control 104. Detecting a click operation on this control 104, in response to this click operation, a scanning radar in the user interface shown in (2) of Figure 2The user interface shown in (3) of FIG. The user interface can provide various types of Bluetooth devices, as well as different product models under the same type of Bluetooth device, such as laptops of different product models. Assume that the product model of laptop 1 is product model 1. Detect a click operation on the product signal 1 for the laptop. In response to this click operation, the user interface as shown in Figure 2 of (4) can be displayed. This user interface displays configuration prompt information and a start pairing control. Detect a click operation on the start pairing control. In response to this click operation, scan the environment where the mobile phone is located to check if there is a laptop of this product model based on the product model 1 of the laptop. If a laptop of this product model is scanned, the user interface as shown in Figure 1 of (2) can be displayed. This user interface displays available device 103, and the available device 103 includes the device information of the scanned laptop of this product model, such as the device information of laptop 1. Detect a click operation on laptop 1. In response to this click operation, refer to Figure 1 from (3) of FIG. to Figure 1 of (5) shown in FIG. The pairing between the mobile phone and laptop 1 is completed. For relevant descriptions, reference can be made to the above embodiments and will not be elaborated here.

[0077] (3) Pairing by scanning a code.

[0078] Pairing by scanning a code means that the mobile phone scans the QR code of the Bluetooth device to perform Bluetooth pairing with the Bluetooth device. Exemplarily, the user interface involved in this pairing method can be referred to the user interface shown in Figure 3 from (1) of FIG. to Figure 3 of (4) shown in FIG. Exemplarily, the mobile phone displays the user interface as shown in Figure 3 of (1). This user interface displays an "Add Device" control 106. Detect a click operation on this control 106. In response to this click operation, the scanning radar in the user interface as shown in Figure 3 of (2) can be displayed. This user interface also displays a manual addition control and a scan and add control 107. Detect a click operation on the scan and add control 107. In response to this click operation, the user interface as shown in Figure 3 of (3) can be displayed. This user interface includes a code scanning frame 108 for scanning the QR code displayed by the Bluetooth device, such as the QR code displayed on the laptop. In response to scanning the QR code displayed on the laptop, obtain the device information of the laptop based on this QR code, and display the device information of the laptop in the available device bar 109 in the user interface as shown in Figure 3 of (4). Detect a click operation on the laptop. In response to this click operation, refer to Figure 1 from (3) of FIG. to Figure 1As shown in (5) of the user interface, the pairing between the mobile phone and the laptop is completed. For relevant descriptions, reference can be made to the above embodiments, which will not be elaborated here.

[0079] The following Figure 4 exemplarily illustrates the process of Bluetooth pairing between a mobile phone and a laptop. Optionally, the protocol used for pairing and communication between the mobile phone and the laptop is the Bluetooth Secure Manager Protocol (SMP). During the pairing process of the mobile phone and the laptop, keys can be negotiated, generated, and stored based on SMP. The keys are used to encrypt the data sent on the link and decrypt the received data during the Bluetooth communication between the mobile phone and the laptop, thereby improving the security of data transmission.

[0080] Among them, SMP defines a set of simple and reliable authentication and key distribution processes (which can also be called pairing processes). SMP allows Bluetooth devices to encrypt the link and exchange data using the negotiated keys. The electronic device and the Bluetooth device can store their respective keys. When the two devices are connected again, the pairing process can be skipped and the previously stored keys can be directly used to encrypt the link. This process of storing keys can also be called bonding.

[0081] Please refer to Figure 4 As shown, the specific steps for the first Bluetooth pairing between the mobile phone and the laptop are as follows:

[0082] S101: The laptop broadcasts Bluetooth information. Correspondingly, the mobile phone scans for Bluetooth devices.

[0083] Exemplarily, the laptop can broadcast Bluetooth information after enabling the Bluetooth function. Among them, the Bluetooth information includes the device information of the laptop.

[0084] Exemplarily, the mobile phone can scan for Bluetooth devices after enabling the Bluetooth function, that is, the mobile phone receives the Bluetooth information broadcast by other Bluetooth devices after enabling the Bluetooth function.

[0085] S102: The mobile phone sends a Bluetooth pairing request to the laptop.

[0086] Exemplarily, after the mobile phone receives the Bluetooth information broadcast by the laptop, the mobile phone can be in the Bluetooth function interface (such as the user interface shown in (2) above Figure 1 of the (2) shown, Figure 2 of the (3) shown, Figure 3Display the device information of the laptop on the user interface shown in (4). After the mobile phone receives the click operation on the device information of the laptop, it sends a Bluetooth pairing request to the laptop. This Bluetooth pairing request is used to instruct the laptop to pair with the mobile phone so that Bluetooth communication can be carried out between the mobile phone and the laptop.

[0087] S103: The mobile phone and the laptop negotiate keys to generate keys.

[0088] Among them, the keys are used for the mobile phone and the laptop to encrypt the data they transmit and decrypt the data they receive.

[0089] S104: The mobile phone and the laptop save the keys to complete the Bluetooth pairing.

[0090] The above S101 to S104 introduce the process of the mobile phone and the laptop performing the first Bluetooth pairing. After the mobile phone and the laptop are successfully paired for the first time, the mobile phone and the laptop can store the generated keys. When the mobile phone and the laptop perform a Bluetooth connection, they do not need to pair again and can directly connect according to the keys they store.

[0091] Exemplarily, the mobile phone detects a click operation on the "Bluetooth" icon (which can be the Bluetooth icon in the control center or the Bluetooth icon in the settings application). In response to this click operation, the mobile phone can display a user interface as shown in Figure 5 (1) of this document. This user interface may include multiple options, such as Bluetooth, personal hotspot, mobile network, more connections, display and brightness, storage, etc. Among them, the status of Bluetooth is turned on. Detecting a click operation on Bluetooth, in response to this click operation, a user interface as shown in Figure 5 (2) of this document can be displayed. This user interface includes a list of paired devices and a list of available devices. The list of paired devices indicates the Bluetooth devices that have a pairing relationship with the mobile phone, and the list of available devices indicates the Bluetooth devices scanned by the mobile phone that do not have a pairing relationship with the mobile phone or have had a pairing relationship and then been deleted.

[0092] Exemplarily, for the Bluetooth devices included in the list of paired devices, the mobile phone can directly establish a Bluetooth connection with the paired Bluetooth devices. For example, as shown in Figure 5As shown in (2) of FIG., assume that the list of paired devices includes Computer 1 and Computer 2. When a click operation on Computer 1 is detected, in response to this click operation, the mobile phone sends a Bluetooth connection request to Computer 1 (such as the aforementioned laptop computer), and this Bluetooth connection request carries the key generated during the pairing process. Computer 1 receives the Bluetooth connection request (carrying the key) from the mobile phone and sends a connection confirmation response to the mobile phone. Correspondingly, the mobile phone receives the connection confirmation response from Computer 1, indicating that the connection between the mobile phone and Computer 1 is successful. And after the connection between the mobile phone and Computer 1 is successful, the mobile phone can display a user interface as shown in Figure 5 (3) of FIG., and this user interface shows that Computer 1 is connected (that is, the connection between Computer 1 and the mobile phone is successful).

[0093] It should be noted that the above is to establish a Bluetooth connection with Computer 1 after the mobile phone receives the user's operation, but the embodiment of the present application is not limited to this way of Bluetooth connection. Optionally, the mobile phone can also automatically establish a Bluetooth connection when it is close to a paired Bluetooth device. For example, after the mobile phone and Computer 1 establish a pairing relationship, as long as both the mobile phone and Computer 1 have the Bluetooth function enabled and the distance is less than a certain threshold, a Bluetooth connection can be automatically established.

[0094] Exemplarily, for the Bluetooth devices included in the list of available devices, the mobile phone can establish a Bluetooth pairing relationship with this Bluetooth device. For example, as Figure 5 shown in (2) of FIG., assume that the list of available devices includes Computer a and Computer b. When a click operation on Computer a is detected, in response to this click operation, a pairing request is sent to Computer a. Receiving a pairing confirmation response from Computer a indicates that the pairing between the mobile phone and Computer a is completed. And after the pairing between the mobile phone and Computer a is completed, as Figure 5 shown in (4) of FIG., Computer a is added to the list of paired devices, and Computer a is deleted from the list of available devices. Optionally, after the pairing between the mobile phone and Computer a is completed, the mobile phone and Computer a can directly establish a Bluetooth connection (that is, the connection is successful). Or, after the pairing between the mobile phone and Computer a is completed, Computer a is included in the list of paired devices of the mobile phone. In response to the user's click operation on Computer a, the mobile phone and Computer a establish a Bluetooth connection.

[0095] 4. Trust Ring.

[0096] A trust ring refers to a technology in which electronic devices such as mobile phones, tablets, and laptop computers that have logged in to the same system account can discover each other and automatically form a network connection to establish multi-device collaborative work. Exemplarily, when electronic devices such as mobile phones, tablets, and laptop computers that have logged in to the same system account turn on WALN and Bluetooth and enter the settings application to enable relevant services (such as intelligent interconnection services), these electronic devices can confirm to join the same trust ring.

[0097] AsFigure 6 As shown in the figure, it is a schematic diagram of a trust ring provided by an embodiment of the present application. The trust ring includes multiple devices, and these multiple devices can implement shared / collaborative services, such as application continuation, call sharing, notification sharing, keyboard and mouse sharing, camera sharing, and network sharing. For example, a user can use a document editing application on one device to edit a document, and then continue editing the document by continuing the document editing application on another device; another example is that when a call comes in on a mobile phone, other devices within the trust ring can resonate, so that the user can answer the call on other devices; another example is that the keyboard and mouse can also be shared, and the mouse and keyboard connected to one device can be used to control multiple devices.

[0098] It should be noted that the Bluetooth connection method provided by the embodiment of the present application can be applied to the above-mentioned trust ring, and a Bluetooth pairing relationship is established in advance between any two devices in the trust ring. Of course, the scenarios applicable to the method of the embodiment of the present application are not limited to this, and other scenarios (such as scenarios for establishing Bluetooth connections) also fall within the protection scope of the embodiment of the present application.

[0099] In addition, in the above-mentioned trust ring, when two devices perform a shared task, these two devices need to turn on the Wi-Fi function. In other scenarios, when the two devices do not turn on the Wi-Fi function, it does not affect the execution of the following solutions of the embodiment of the present application.

[0100] In the embodiment of the present application, the trust ring may include the above-mentioned mobile phone and laptop computer, and a Bluetooth pairing relationship is established in advance between the mobile phone and the laptop computer. In some embodiments, after a Bluetooth pairing relationship is established in advance between the mobile phone and the laptop computer, due to some reasons, the mobile phone unilaterally cancels the pairing relationship with the laptop computer, while the laptop computer does not cancel the pairing relationship with the mobile phone. That is to say, the mobile phone deletes the pairing information of the laptop computer, while the laptop computer does not delete the pairing information of the mobile phone. In this way, when the two devices perform a Bluetooth connection again later, the Bluetooth connection will fail. Because the laptop computer still stores the pairing information of the mobile phone, when the laptop computer receives a Bluetooth connection request from the mobile phone, the laptop computer will actively initiate a Bluetooth pairing request to the mobile phone. However, since the mobile phone has deleted the pairing information of the laptop computer, the Bluetooth pairing between the mobile phone and the laptop computer will fail, further causing the problem that the mobile phone frequently displays a pairing pop-up window, resulting in the user being unable to use the Bluetooth function normally. Exemplarily, in response to the user's cancellation operation, the mobile phone cancels the Bluetooth pairing relationship with the laptop computer. For example, after the mobile phone and the laptop computer establish a Bluetooth pairing relationship, the mobile phone can display as Figure 7The user interface shown in (1) includes a list of paired devices, and the list of paired devices includes option 1, which displays the device name of the laptop (such as Computer 1), indicating that the mobile phone and the laptop are paired. In response to the user clicking on option 1, the mobile phone may display the following Figure 7 The user interface shown in (2) includes multiple options, such as the device name of the laptop (such as Computer 1), cancel pairing, call, media audio, etc., which are not limited. In response to the user clicking the cancel pairing operation, the mobile phone cancels the Bluetooth pairing relationship with the laptop.

[0101] Alternatively, the mobile phone may be disconnected from the laptop computer's Bluetooth pairing due to some abnormal reason. Exemplary abnormal reasons include one or more of the following: restoring the phone's settings to factory settings, resetting the phone's system, or a Bluetooth malfunction in the phone.

[0102] In response to the mobile phone releasing the Bluetooth pairing relationship with the laptop, such as Figure 8 As shown in (1), the paired device list of the mobile phone does not include the device ID of the laptop, while the available device list includes the device ID of the laptop (such as Computer 1). However, the laptop has not released the Bluetooth pairing relationship with the mobile phone, and the device list of the laptop includes the device ID of the mobile phone (such as Mobile Phone 1) and displays the prompt message "Paired". On this basis, Figure 8 The user interface shown in (2) is a trust ring interface displayed on a laptop computer. In response to a user clicking on a device ball 201 (e.g., "Mobile Phone 1") and a trust ring service 202 (e.g., "Screen Sharing"), the laptop computer sends a Bluetooth pairing request to the mobile phone to request the mobile phone to establish a Bluetooth pairing with the laptop computer and establish a Bluetooth connection. After the Bluetooth connection is successful, the mobile phone can join the trust ring corresponding to the laptop computer and start a sharing service (e.g., screen sharing service).

[0103] It should be noted that, in actual implementation, when a mobile phone joins the trust ring corresponding to a laptop computer, there is no need to establish Bluetooth pairing between the mobile phone and the laptop computer. A Bluetooth connection can be directly established through the Bluetooth application to realize the above-mentioned shared service. In the embodiment of the present application, the reason why the laptop computer sends a Bluetooth pairing request to the mobile phone is because the mobile phone and the laptop computer have previously established a Bluetooth pairing request, and the mobile phone has deleted the pairing information of the laptop computer, while the laptop computer has not deleted the pairing information of the mobile phone. Therefore, the laptop computer will send Bluetooth pairing information to the mobile phone. Correspondingly, if the laptop computer joins the trust ring corresponding to the mobile phone, then the mobile phone can send a Bluetooth connection request to the laptop computer. Since the laptop computer still saves the pairing information of the mobile phone, the laptop computer believes that it needs to establish Bluetooth pairing before establishing a Bluetooth connection. Therefore, the laptop computer will send a Bluetooth pairing request to the mobile phone. In other words, whether the mobile phone initiates a Bluetooth connection request or the laptop computer initiates a Bluetooth connection request, since the laptop computer still saves the pairing information of the mobile phone, the laptop computer will send a Bluetooth pairing request to the mobile phone.

[0104] For example, after the mobile phone receives the Bluetooth pairing request from the laptop, Figure 8 The user interface shown in (3) of FIG. 1 shows a dialog box 203, which is used to prompt the laptop to request Bluetooth pairing. The dialog box 203 includes a cancel control and a pairing control. The mobile phone detects a click operation of the user on the pairing control, and in response to the click operation, the mobile phone displays Figure 8 The user interface shown in (4) includes a dialog box 204, and the dialog box 204 is used to prompt that the pairing fails.

[0105] Based on this, an embodiment of the present application provides a Bluetooth connection method, which is applied to a system including a first electronic device and a second electronic device; the first electronic device and the second electronic device have established a Bluetooth pairing relationship; when a trigger condition is met, the first electronic device sends a broadcast message to the second electronic device; wherein the trigger condition is used to indicate that the first electronic device has released the Bluetooth pairing relationship with the second electronic device, and the broadcast message is used to instruct the second electronic device to release the Bluetooth pairing relationship with the first electronic device. In this way, by notifying the second electronic device to release the Bluetooth pairing relationship with the first electronic device through the broadcast message, the problem of Bluetooth connection failure when the first electronic device and the second electronic device re-establish a Bluetooth connection can be avoided.

[0106] Optionally, the operating systems of the first electronic device and the second electronic device may be the same or different. For example, the operating system of the first electronic device may be Android TM system, the operating system of the second electronic device may be Windows TMThe system; alternatively, the operating systems of the first electronic device and the second electronic device are both Windows TM Systems, etc. are not limited. In the following embodiments, the first electronic device is a mobile phone, and the operating system of the mobile phone is Android TM System, the second electronic device is a laptop computer, and the operating system of the laptop computer is Windows TM System is taken as an example for illustration.

[0107] Exemplarily, refer to Figure 9 , which is a schematic diagram of the hardware structure of a mobile phone provided by an embodiment of the present application. As Figure 9 shown, the mobile phone 100 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, a speaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a positioning module 181, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a user identification card (such as a SIM card) interface 195, etc. It can be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone 100. In other embodiments, the mobile phone 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0108] The processor 110 may include one or more processing units. For example: the processor 110 may include an AP, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a Modem, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices, or integrated in one or more processors.

[0109] In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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 (e.g., SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0110] The charging management module 130 is configured to receive a charging input from a charger. The charger may be a wireless charger or a wired charger. The power management module 131 is used to connect the battery 132, the charging management module 130, and the processor 110. The power management module 131 receives inputs from the battery 132 and / or the charging management module 130 to supply power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, the wireless communication module 153, etc.

[0111] The wireless communication function of the mobile phone 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 251, the wireless communication module 153, the AP, and the Modem, etc. The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.

[0112] The mobile communication module 151 can provide solutions for cellular communication (such as 2G / 3G / 4G / 5G) and satellite communication applied to the mobile phone 100. The mobile communication module 251 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 151 can receive electromagnetic waves by the antenna 1, filter and amplify the received electromagnetic waves, and then transmit them to the baseband processor for demodulation. The mobile communication module 151 can also amplify the signal modulated by the baseband processor and convert it into electromagnetic waves through the antenna 1 for radiation.

[0113] The wireless communication module 153 can provide solutions for wireless communications applied to the mobile phone 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth, global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. The wireless communication module 153 can be one or more devices integrating at least one communication processing module. The wireless communication module 153 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 153 can also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.

[0114] The AP can output sound signals through audio devices (not limited to the speaker 170A, receiver 170B, etc.), or can display images or videos through the display screen 194.

[0115] The mobile phone 100 implements display functions through the GPU, the display screen 194, the AP, etc., such as displaying application interfaces of various applications such as Bluetooth.

[0116] The internal memory 121 can be used to store computer-executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the mobile phone 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area.

[0117] The mobile phone 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone jack 170D, and the application processor, etc. For example, music playback, recording, etc.

[0118] The SIM card interface 195 is used to connect a SIM card. The SIM card interface 195 can be a SIM card slot. The mobile phone 100 can include 1-N SIM card interfaces 295. A SIM card can be connected to and disconnected from the mobile phone 100 by inserting or removing it from the SIM card interface 195. The mobile phone 100 can support one or more SIM card interfaces. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The mobile phone 100 communicates with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the mobile phone 100 uses an eSIM, or embedded SIM card. The eSIM card can be embedded in the mobile phone 100 and cannot be separated from the mobile phone 100.

[0119] It should be noted that the hardware structure of the above-mentioned laptop computer may include Figure 9 Some or all of the components shown may also include Figure 9 More or fewer components may be shown, or some components may be combined or separated, or the components may be arranged differently. For an example of the hardware structure of a laptop computer, please refer to Figure 9 The description of the hardware structure of the mobile phone 100 is not repeated here.

[0120] The following is a detailed description of the technical solution provided by the embodiment of the present application in conjunction with the accompanying drawings. It should be understood that in the embodiment of the present application, the mobile phone and the laptop have a Bluetooth pairing relationship established in advance. For example, the mobile phone and the laptop can be paired with each other through the above Figures 1 to 3 For example, a mobile phone and a laptop can establish a Bluetooth pairing relationship by using any of the pairing methods shown above. Figure 4 The pairing process shown establishes a Bluetooth pairing relationship. The specific implementation method can refer to the above related description and will not be repeated here.

[0121] For example, Figure 10 As shown, the method may include the following steps:

[0122] S301: When a trigger condition is met, the mobile phone sends a broadcast message to the laptop computer.

[0123] The broadcast information is used to instruct the laptop to release the Bluetooth pairing relationship with the mobile phone.

[0124] In some embodiments, the triggering conditions include: condition 1, the mobile phone cancels the Bluetooth pairing relationship with the laptop; or condition 2, the mobile phone displays a pairing pop-up window.

[0125] For condition 1, exemplarily, in response to the mobile phone and the laptop computer disconnecting the Bluetooth pairing, the mobile phone deletes the pairing information of the laptop computer and generates broadcast information 1 (which can be understood as the first broadcast information). In this scenario, the mobile phone sends broadcast information 1 to the laptop computer, and correspondingly, the laptop computer receives the broadcast information 1 from the mobile phone. This broadcast information 1 can be the same as the above-mentioned broadcast information, and is used to instruct the laptop computer to disconnect the Bluetooth pairing relationship with the mobile phone.

[0126] Exemplarily, the mobile phone can respond to the user's disconnection operation to disconnect the Bluetooth pairing with the laptop computer and delete the pairing information of the laptop computer. The relevant process can refer to the above Figure 7 shown relevant description, which will not be elaborated here. Or, optionally, the mobile phone disconnects the Bluetooth pairing with the laptop computer due to some abnormal reasons. The relevant description of the abnormal reasons can refer to the above embodiments, which will not be elaborated here.

[0127] For condition 2, exemplarily, when the laptop computer does not receive the broadcast information 1, the mobile phone sends a Bluetooth connection request to the laptop computer. Since the laptop computer stores the pairing information of the mobile phone, the laptop computer will send a Bluetooth pairing request to the mobile phone. After the mobile phone receives the pairing request from the laptop computer, the mobile phone displays a pairing pop-up window (such as the dialog box 203 shown in (3) of Figure 8 ), and generates broadcast information 2 (which can be understood as the second broadcast information). In this scenario, the mobile phone sends broadcast information 2 to the laptop computer, and correspondingly, the laptop computer receives the broadcast information 2 from the mobile phone. This broadcast information 2 is the same as the above-mentioned broadcast information, and is used to instruct the laptop computer to disconnect the Bluetooth pairing relationship with the mobile phone. That is to say, in the above solution, the mobile phone can generate broadcast information 1 and send broadcast information 1 to the laptop computer when condition 1 is met. In this way, without the user's awareness, it is possible to avoid the pairing pop-up window and pairing failure when the mobile phone and the laptop computer establish a Bluetooth connection again later, thus avoiding the problem of Bluetooth connection failure.

[0128] However, if the mobile phone generates broadcast information 1 and sends broadcast information 1 to the laptop computer when the above condition 1 is met. And due to the long distance between the mobile phone and the laptop computer or communication restrictions, the above problem cannot be solved at this time. Then, the mobile phone can generate broadcast information 2 and send broadcast information 2 to the laptop computer when the above condition 2 is met. In this way, it can be further ensured that when the mobile phone and the laptop computer establish a Bluetooth connection again later, the pairing pop-up window and pairing failure are avoided, thus avoiding the problem of Bluetooth connection failure.

[0129] It should be noted that in the embodiments of the present application, the above Condition 1 and Condition 2 are in a parallel relationship. When the mobile phone determines that the mobile phone meets any of the above conditions, it generates broadcast information and sends the broadcast information to the laptop. In the embodiments of the present application, the order of determining whether the mobile phone meets the above Condition 1 and Condition 2 is not limited. Exemplarily, the mobile phone may first determine whether the mobile phone meets Condition 1. If it meets Condition 1, the mobile phone generates broadcast information 1 and sends the broadcast information 1 to the laptop. If the mobile phone does not meet Condition 1, the mobile phone determines whether the mobile phone meets Condition 2. If it meets Condition 2, the mobile phone generates broadcast information 2 and sends the broadcast information 2 to the laptop. If the mobile phone does not meet Condition 1 and Condition 2, the mobile phone ends the execution of this solution, that is, the mobile phone does not generate broadcast information.

[0130] Correspondingly, the mobile phone may optionally determine whether the mobile phone meets Condition 2. If it meets Condition 2, the mobile phone generates broadcast information 2 and sends the broadcast information 2 to the laptop. If the mobile phone does not meet Condition 2, the mobile phone determines whether the mobile phone meets Condition 1. If it meets Condition 1, the mobile phone generates broadcast information 1 and sends the broadcast information 1 to the laptop. If the mobile phone does not meet Condition 1 and Condition 2, the mobile phone ends the execution of this solution, that is, the mobile phone does not generate broadcast information.

[0131] In some embodiments, the mobile phone can determine whether the trigger condition is met based on the previous pairing state and the current pairing state between the mobile phone and the laptop. Exemplarily, as Figure 11 shown, the pairing states include the paired state, the pairing state, and the unpaired state. Among them, the paired state means that the primary pairing party has established a Bluetooth pairing with the secondary pairing party, and this state is established after successful pairing. The pairing state means that the primary pairing party is in the process of establishing a Bluetooth pairing with the secondary pairing party. This state indicates that the pairing has not been fully established, and the primary pairing party is trying to connect to the secondary pairing party, waiting for the response and confirmation of the secondary pairing party. Only when the pairing is successful, the pairing state will change to the paired state. Briefly, the paired state is a stable state established after successful pairing, while the pairing state is a temporary state during the pairing process.

[0132] Optionally, the paired state can be represented as: BOND_BONDED; the pairing state can be represented as BOND_BONDING; the unpaired state can be represented as: BOND_NONE, etc., without limitation.

[0133] In the embodiments of the present application, the primary pairing party can be the mobile phone, and the secondary pairing party can be the laptop; correspondingly, the primary pairing party can be the laptop, and the secondary pairing party can be the mobile phone, without limitation.

[0134] As an example, if the previous pairing state is the paired state and the current pairing state is the unpaired state, it means that the mobile phone meets the above condition 1. Then the mobile phone generates broadcast message 1 and sends broadcast message 1 to the laptop. Exemplarily, as Figure 12 shown, the process of the mobile phone sending broadcast message 1 to the laptop is as follows:

[0135] S1. The mobile phone obtains the previous pairing state and the current pairing state of the mobile phone and the laptop.

[0136] Exemplarily, the mobile phone can obtain a first flag value and a second flag value. The first flag value can be, for example, PREVIOUS_BOND_STATE, which is used to indicate the previous pairing state. The second flag value can be, for example, BOND_STATE, which is used to indicate the current pairing state, etc., without limitation.

[0137] S2. The mobile phone determines whether the previous pairing state of the mobile phone and the laptop is the paired state.

[0138] Exemplarily, if the previous pairing state of the mobile phone and the laptop is the paired state, the mobile phone can continue to execute the following steps, such as executing S3. If the previous pairing state of the mobile phone and the laptop is not the paired state, the mobile phone can continue to determine whether the mobile phone meets condition 2. If the mobile phone meets condition 2, the mobile phone generates broadcast message 2 and sends broadcast message 2 to the laptop. If the mobile phone does not meet condition 2, the mobile phone ends the execution of this solution, that is, does not generate broadcast messages. For an example of whether the mobile phone meets condition 2, reference can be made to the relevant description of the following embodiments, which will not be elaborated here.

[0139] Exemplarily, the mobile phone determines whether PREVIOUS_BOND_STATE is equal to BOND_BONDED. If PREVIOUS_BOND_STATE is equal to BOND_BONDED, the mobile phone can continue to execute the following steps, such as executing S3.

[0140] S3. The mobile phone determines whether the current pairing state of the mobile phone and the laptop is the unpaired state.

[0141] Exemplarily. If the current pairing state of the mobile phone and the laptop is the unpaired state, the mobile phone can continue to execute the following steps, such as executing S4. If the current pairing state of the mobile phone and the laptop is not the unpaired state, the mobile phone can continue to determine whether the mobile phone meets condition 2. If the mobile phone meets condition 2, the mobile phone generates broadcast message 2 and sends broadcast message 2 to the laptop. If the mobile phone does not meet condition 2, the mobile phone ends the execution of this solution, that is, does not generate broadcast messages. For an example of whether the mobile phone meets condition 2, reference can be made to the relevant description of the following embodiments, which will not be elaborated here.

[0142] For example, the mobile phone may determine whether BOND_STATE is equal to BOND_NONE. If BOND_STATE is equal to BOND_NONE, the mobile phone may continue to execute the following steps, such as executing S4.

[0143] S4. The mobile phone generates broadcast information 1 and sends the broadcast information 1 to the laptop computer.

[0144] That is, in the above embodiment, when PREVIOUS_BOND_STATE=BOND_BONDED and BOND_STATE=BOND_NONE, the mobile phone determines that the mobile phone meets condition 1, that is, the mobile phone cancels the Bluetooth pairing relationship with the laptop computer, and the mobile phone can generate broadcast information 1 and send broadcast information 1 to the laptop computer.

[0145] As another example, if the last pairing state is unpaired and the current pairing state is pairing, it means that the mobile phone meets the above condition 2, then the mobile phone generates broadcast information 2 and sends broadcast information 2 to the laptop. Figure 13 As shown, in this scenario, the process of the mobile phone sending broadcast information 2 to the laptop is as follows:

[0146] S11. The mobile phone obtains the last pairing status and the current pairing status between the mobile phone and the laptop computer.

[0147] Exemplarily, the mobile phone may obtain a first tag value and a second tag value, where the first tag value may be, for example, PREVIOUS_BOND_STATE, for indicating the previous pairing state, and the second tag value may be, for example, BOND_STATE, for indicating the current pairing state, etc., without limitation.

[0148] S12. The mobile phone determines whether the last pairing state between the mobile phone and the laptop computer was an unpaired state.

[0149] For example, if the last pairing state between the mobile phone and the laptop was unpaired, the mobile phone may continue to execute the following steps, such as executing S13. If the last pairing state between the mobile phone and the laptop was not unpaired, the mobile phone may continue to determine whether the mobile phone meets condition 1. If the mobile phone meets condition 1, the mobile phone generates broadcast message 1 and sends broadcast message 1 to the laptop. If the mobile phone does not meet condition 1, the mobile phone terminates execution of this solution, i.e., no broadcast message is generated. For an example of whether the mobile phone meets condition 1, please refer to the relevant description of the above embodiment and will not be repeated here.

[0150] Exemplarily, the mobile phone determines whether PREVIOUS_BOND_STATE is equal to BOND_NONE. If PREVIOUS_BOND_STATE is equal to BOND_NONE, the mobile phone may continue to execute the following steps, such as executing S3.

[0151] S13. The mobile phone determines whether the current pairing status between the mobile phone and the laptop is in the pairing state.

[0152] For example, if the current pairing status between the mobile phone and the laptop is in the "pairing in progress" state, the mobile phone may proceed to the following steps, such as executing S4. If the current pairing status between the mobile phone and the laptop is not in the "pairing in progress" state, the mobile phone may proceed to determine whether the mobile phone meets condition 1. If the mobile phone meets condition 1, the mobile phone generates broadcast message 1 and sends broadcast message 1 to the laptop. If the mobile phone does not meet condition 1, the mobile phone terminates execution of this solution, i.e., no broadcast message is generated. For an example of whether the mobile phone meets condition 1, please refer to the relevant description of the above embodiment and will not be repeated here.

[0153] Exemplarily, the mobile phone determines whether BOND_STATE is equal to BOND_BONDING. If BOND_STATE is equal to BOND_BONDING, the mobile phone may continue to execute the following steps, such as executing S14.

[0154] S14. The mobile phone generates broadcast information 2 and sends the broadcast information 2 to the laptop computer.

[0155] That is, in the above embodiment, when PREVIOUS_BOND_STATE=BOND_NONE and BOND_STATE=BOND_BONDING, the mobile phone determines that the mobile phone meets condition 2, that is, the mobile phone is in a scene where the pairing pop-up window is displayed, and the mobile phone can generate broadcast information 2 and send broadcast information 2 to the laptop.

[0156] In some embodiments, the broadcast information includes a broadcast data packet and a data packet type of the broadcast data packet, where the data packet type is used to indicate that Bluetooth pairing is being released; the broadcast data packet includes the MAC address of the mobile phone and the MAC address of the laptop. Alternatively, the broadcast data packet includes: partial bytes of the MAC address of the mobile phone and partial bytes of the MAC address of the laptop. For example, the last two bytes of the MAC address of the mobile phone and the last two bytes of the MAC address of the laptop. Alternatively, the broadcast data packet includes: the MAC address of the mobile phone and the MAC address of the laptop, partial bytes of the MAC address of the mobile phone, and partial bytes of the MAC address of the laptop.

[0157] Optionally, the broadcast data packet also includes: a local timestamp.

[0158] Take the broadcast data packet including: partial bytes of the MAC address of the mobile phone, partial bytes of the MAC address of the laptop, and the local timestamp as an example, for example, Figure 14 As shown in the figure, the process of the mobile phone generating a broadcast message and sending the broadcast message to the laptop is as follows:

[0159] S21. The mobile phone obtains the MAC address of the mobile phone and the MAC address of the laptop.

[0160] S22. The mobile phone intercepts part of the bytes of the MAC address of the mobile phone and part of the bytes of the MAC address of the laptop.

[0161] For example, the mobile phone can intercept the last two bytes of the MAC address of the mobile phone and the MAC address of the laptop; or, the mobile phone can intercept the last three bytes of the MAC address of the mobile phone and the MAC address of the laptop, etc., without limitation.

[0162] In this step, the reason for intercepting some bytes of the MAC address of the mobile phone and the MAC address of the laptop is to ensure the security of the broadcast information during transmission.

[0163] Exemplarily, some bytes of the MAC address of a mobile phone can be used to indicate the MAC address of the mobile phone, and some bytes of the MAC address of a laptop can be used to indicate the MAC address of the laptop.

[0164] S23. The mobile phone obtains a local timestamp.

[0165] The local timestamp is a digital value representing a point in time, usually in milliseconds. The timestamp is used to record the exact time when an event occurred. In the embodiment of the present application, the local timestamp can be used to mark the broadcast information sent this time to facilitate information statistics.

[0166] S24. The mobile phone generates broadcast information according to the partial bytes of the mobile phone's MAC address, the partial bytes of the laptop's MAC address, and the local timestamp.

[0167] Exemplarily, the mobile phone encapsulates the MAC address of the mobile phone and the MAC address of the laptop, partial bytes of the MAC address of the mobile phone and the MAC address of the laptop, a local timestamp, etc. to obtain a broadcast data packet, and marks the data packet type of the broadcast data packet, thereby generating broadcast information.

[0168] In S23 and S24, the mobile phone adds a local timestamp to the broadcast data packet and marks the message type of the broadcast data packet, so as to mark and identify the scenario of sending the broadcast information to the laptop computer this time.

[0169] S25. The mobile phone sends a broadcast message to the laptop computer.

[0170] For example, a mobile phone can set a broadcast period for broadcast information to send broadcast information to a laptop computer. That is, the mobile phone sends broadcast information to the laptop computer at a certain period. The period can be set according to actual needs, and the specific value of the period is not limited in this embodiment of the application. For example, the broadcast period can be set to 5 seconds.

[0171] In some embodiments, the mobile phone can set a timer, and when the timer expires, the mobile phone stops sending broadcast information to the laptop. For example, if the timer is set to 5 minutes, when the timer exceeds 5 minutes, the mobile phone stops sending broadcast information to the laptop.

[0172] In other embodiments, the mobile phone may stop sending broadcast information to the laptop computer under abnormal circumstances, such as network abnormality, mobile phone shutdown, mobile phone factory reset, mobile phone Bluetooth device failure, etc.

[0173] In some other embodiments, the mobile phone may stop sending broadcast information to the laptop upon receiving a confirmation response from the laptop, wherein the confirmation response is used to instruct the laptop to release the Bluetooth pairing relationship with the mobile phone.

[0174] Of course, in the embodiment of the present application, other methods can also be used to trigger the mobile phone to stop sending broadcast information to the laptop computer, which will not be listed here. For example, the mobile phone can also stop sending broadcast information to the laptop computer when a Bluetooth connection is established with the laptop computer.

[0175] S302: The laptop computer cancels the Bluetooth pairing relationship with the mobile phone according to the broadcast information.

[0176] For example, the laptop computer canceling the Bluetooth pairing relationship with the mobile phone can be understood as the laptop computer deleting the pairing information of the mobile phone, wherein the pairing information includes the device information of the mobile phone and the key generated by the mobile phone and the laptop computer during the last pairing.

[0177] S303: After the mobile phone sends the broadcast information to the laptop, the mobile phone sends a Bluetooth connection request to the laptop. Correspondingly, the laptop receives the Bluetooth connection request from the mobile phone.

[0178] Exemplarily, after the mobile phone sends the broadcast information to the laptop, the laptop deletes the pairing information of the mobile phone. Optionally, when the mobile phone requests the laptop to join the trust ring corresponding to the mobile phone, the mobile phone sends a Bluetooth connection request to the laptop.

[0179] S304: When the laptop computer receives the Bluetooth connection request, the mobile phone establishes a Bluetooth connection with the laptop computer.

[0180] For example, since the laptop has deleted the pairing information of the mobile phone, the mobile phone and the laptop successfully establish a Bluetooth connection, that is, the mobile phone and the laptop join the same trust ring.

[0181] In some embodiments, when a mobile phone and a laptop computer (which may be understood as a third electronic device) have not established a Bluetooth pairing, the mobile phone sends a Bluetooth connection request to the laptop computer. In response, the laptop computer receives the Bluetooth connection request. In this embodiment, since the mobile phone and the laptop computer have not established a Bluetooth pairing, the mobile phone does not save the laptop computer's pairing information, and the laptop computer also does not save the mobile phone's pairing information. Therefore, the mobile phone and the laptop computer successfully establish a Bluetooth connection.

[0182] In some embodiments, a mobile phone and a laptop computer (herein understood as a third electronic device) have established a Bluetooth pairing relationship. Based on this, when a trigger condition is met, the mobile phone generates a broadcast message (understood as a third broadcast message) and sends the broadcast message to the laptop computer. The specific implementation process is similar to that of the above embodiment and can be referred to above, so it will not be repeated here.

[0183] After receiving the broadcast information, if the laptop does not have the mobile phone's pairing information saved, the laptop does not need to delete the mobile phone's pairing information. In this case, the mobile phone sends a Bluetooth connection request to the laptop. After the laptop receives the Bluetooth connection request, the mobile phone and the laptop successfully establish a Bluetooth connection because the laptop does not have the mobile phone's pairing information saved.

[0184] For example, Figure 15 As shown in FIG, the process of canceling the Bluetooth pairing relationship between the laptop and the mobile phone may include the following steps:

[0185] S30: The laptop computer verifies whether the MAC address of the laptop computer in the broadcast information is the same as the local MAC address.

[0186] Optionally, after receiving the broadcast information from the mobile phone, the laptop computer verifies whether the MAC address of the laptop computer included in the broadcast information is the same as the local MAC address. If the MAC address of the laptop computer included in the broadcast information is the same as the local MAC address, the laptop computer continues to perform the following steps (such as S31). If the MAC address of the laptop computer included in the broadcast information is different from the local MAC address, the laptop computer ignores the broadcast information from the mobile phone.

[0187] In this way, through the pre-executed verification process, if the laptop's MAC address included in the broadcast information is different from the local MAC address, the broadcast information from the mobile phone can be ignored and the current process can be terminated, thereby reducing power consumption. In addition, based on the broadcast information received from the mobile phone, the laptop can also determine whether to process the broadcast information to cancel the Bluetooth pairing relationship with the mobile phone, preventing the laptop from mistakenly canceling the Bluetooth pairing relationship with the mobile phone.

[0188] In some embodiments, after receiving a broadcast message from a mobile phone, the laptop computer queries whether a Bluetooth pairing relationship exists with the mobile phone. For example, after receiving a broadcast message from a mobile phone, the laptop computer verifies whether the laptop computer's MAC address included in the broadcast message is the same as the local MAC address. If the laptop computer's MAC address included in the broadcast message is the same as the local MAC address, the laptop computer queries whether a Bluetooth pairing relationship exists with the mobile phone.

[0189] For example, if the laptop computer has a Bluetooth pairing relationship with the mobile phone, the laptop computer cancels the Bluetooth pairing relationship with the mobile phone; if the laptop computer does not have a Bluetooth pairing relationship with the mobile phone, the laptop computer ignores the broadcast information from the mobile phone.

[0190] S31. The laptop computer starts the child thread.

[0191] Among them, this sub-thread is used for the laptop to query whether there is a Bluetooth pairing relationship with the mobile phone.

[0192] In this embodiment, the laptop computer starts a sub-thread to query whether there is a Bluetooth pairing relationship with the mobile phone, thereby avoiding the problem of the main thread being blocked for a long time due to time-consuming operations.

[0193] S32. The laptop computer obtains paired device information of the laptop computer.

[0194] The device information of the paired device includes the MAC address.

[0195] S33. The laptop computer queries the paired device information to see whether the MAC address of the mobile phone exists.

[0196] Exemplarily, the laptop computer obtains the MAC address of the mobile phone from the broadcast information, and then queries whether the MAC address of the mobile phone exists in the paired device information to query whether there is a Bluetooth pairing relationship with the mobile phone.

[0197] S34. The laptop computer obtains the device identification and the unpairing token of the mobile phone, and releases the Bluetooth pairing relationship with the mobile phone.

[0198] In some embodiments, if a Bluetooth pairing relationship exists with a mobile phone, that is, the mobile phone's MAC address is included in the paired device information, the laptop computer cancels the Bluetooth pairing relationship with the mobile phone. Exemplarily, the laptop computer obtains the mobile phone's device identifier (e.g., device ID) and a pairing removal token; the laptop computer uses the pairing removal token to initiate a pairing removal process (e.g., an exe process) and, using the mobile phone's device identifier, cancels the Bluetooth pairing relationship with the mobile phone. For example, the mobile phone's device identifier is entered into the pairing removal process to cancel the Bluetooth pairing relationship with the mobile phone.

[0199] S35. The laptop computer determines whether the laptop computer is successfully unpaired.

[0200] For example, the laptop obtains the MAC address of the mobile phone from the broadcast information, and queries whether the MAC address of the mobile phone exists in the device information that the laptop has paired with. If the paired device information does not include the MAC address of the mobile phone, it is determined that the laptop has released the Bluetooth pairing relationship with the mobile phone. If the paired device information includes the MAC address of the mobile phone, it is determined that the laptop has not released the Bluetooth pairing relationship with the mobile phone. At this time, the laptop can release the Bluetooth pairing relationship with the mobile phone again, such as re-executing the laptop. Figure 15 The process shown in the figure continues until the Bluetooth pairing relationship with the mobile phone is canceled.

[0201] It should be noted that after the laptop computer cancels the Bluetooth pairing relationship with the mobile phone, Figure 6 In the scenario shown, that is, in the trust ring scenario (or hyperterminal scenario), the mobile phone and the laptop can directly establish a Bluetooth connection without Bluetooth connection failure or the display of a pairing pop-up window.

[0202] In addition, it should be noted that in the embodiment of the present application, in steps S30 to S35, each step can be combined, or a step can be divided into multiple steps, and the embodiment of the present application does not limit this. In addition, steps S30 to S35 can be optional steps, that is, not every step must be performed, and they are described here uniformly and will not be repeated below.

[0203] In some embodiments, the laptop computer may terminate the current process after canceling the Bluetooth pairing relationship with the mobile phone. For example, the laptop computer may set a timer to terminate the current process when the timer expires; or the laptop computer may terminate the current process when it does not receive a Bluetooth connection request from the mobile phone, etc., without limitation.

[0204] The above embodiments systematically introduce the technical solutions of the embodiments of the present application. The following describes in detail the interaction processes involved in the embodiments of the present application in combination with the software framework of a mobile phone and a laptop computer.

[0205] The software systems of mobile phones and laptop computers can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, or a cloud architecture. The embodiment of the present application uses a layered architecture software system fence to exemplarily illustrate the software structure of mobile phones and laptop computers.

[0206] Figure 16 Software structure block diagram of the mobile phone and laptop provided in the embodiment of the present application. The layered architecture can divide the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software framework layer of the mobile phone includes the application layer (application layer), the framework layer (framework layer), the kernel layer (kernel layer) and the hardware layer (hardware), etc., without limitation. Optionally, the software framework layer of the mobile phone may also include system libraries (libraries), also known as dynamic libraries, shared libraries, etc.; hardware abstraction layer (hardward abstraction layer), etc., without limitation, Figure 16 Not shown.

[0207] The application layer can include a series of application packages. For example, Figure 16 The application layer shown may include Bluetooth applications (also known as settings applications, or options in device applications that include Bluetooth functionality). The Bluetooth application is used to enable / disable the Bluetooth function, to cancel Bluetooth pairing relationships with paired devices, and to establish Bluetooth pairing relationships (and Bluetooth connections, etc.) with surrounding devices.

[0208] The framework layer provides application programming interface (API) and programming framework for application programs. Figure 16 As shown, the framework layer may include an activity manager service, a basic connection module (nearby), a Bluetooth protocol stack, and other non-limiting components. The activity manager service can be used to monitor Bluetooth application status changes, such as monitoring Bluetooth application release / establishment of Bluetooth pairing relationships. The basic connection module is used to generate broadcast information to announce that the mobile phone has released the Bluetooth pairing relationship. The Bluetooth protocol stack is used to transmit the broadcast information to the underlying layer (e.g., the kernel layer).

[0209] The kernel layer is the layer between hardware and software. It drives the hardware included in the hardware layer, implementing certain functions through a combination of software and hardware. For example, the kernel layer includes a Bluetooth driver, which drives the Bluetooth device included in the hardware layer and sends broadcast information to other peripheral devices.

[0210] In some embodiments, as Figure 16 As shown, the software framework layer of the laptop computer includes the application layer, the framework layer, the driver layer (device drivers) and the hardware layer. For example, the application layer may include a hyperterminal application (or trust ring application) for networking with devices logged in with the same account to achieve shared services.

[0211] The framework layer may include the Bluetooth protocol stack and the Windows Universal Platform (also known as the Windows system, such as the Windows universal platform). The Bluetooth protocol stack is used to receive broadcast information transmitted by the underlying layer (such as the driver layer). The Windows Universal Platform is used to cancel Bluetooth pairing relationships with other devices based on the broadcast information.

[0212] The driver layer is the layer between hardware and software. It drives the hardware included in the hardware layer, implementing certain functions through a combination of software and hardware. For example, the driver layer includes a Bluetooth driver, which drives the Bluetooth device in the hardware layer and receives broadcast information from other peripheral devices.

[0213] In the following embodiments, the process of canceling the Bluetooth pairing relationship between a mobile phone and a laptop is introduced in combination with the above-mentioned trust ring scenario (or super terminal scenario). For example, a mobile phone and a laptop have established a Bluetooth pairing relationship. When the mobile phone cancels the pairing information of the laptop, the mobile phone generates a broadcast message when the trigger condition is met and sends the broadcast message to the laptop. For example, Figure 16 As shown, the process may include the following steps: Step ①, the Bluetooth application of the mobile phone calls back the activity manager service (AMS) to delete the pairing information, and the pairing deletion information is used to indicate that the mobile phone has released the Bluetooth pairing relationship with the laptop. Step ②, the activity management service of the mobile phone broadcasts the pairing deletion information to the basic connection module. Step ③, when the trigger condition is met, the basic connection module of the mobile phone generates a broadcast message to instruct the laptop to release the Bluetooth pairing relationship with the mobile phone. Step ④, the basic connection module of the mobile phone transmits the broadcast message to the Bluetooth protocol stack. Step ⑤, the Bluetooth protocol stack of the mobile phone transmits the broadcast message to the Bluetooth driver. Step ⑥, the Bluetooth driver of the mobile phone schedules the Bluetooth device to send the broadcast message.

[0214] Step 7: The laptop's Bluetooth driver schedules the Bluetooth device to receive the broadcast information. Step 8: The laptop's Bluetooth driver reports the broadcast information to the Bluetooth protocol stack. Step 9: The laptop's Bluetooth protocol stack reports the broadcast information to the HyperTerminal application. Step 10: The laptop's HyperTerminal application obtains paired device information, pairing tokens, device methods (or device instances), and other information from the Windows Universal Platform. Step 10-1: The laptop's HyperTerminal application cancels the Bluetooth pairing relationship with the phone.

[0215] The following examples describe the above method in detail. Figure 17 As shown, the method includes the following steps:

[0216] A1: The phone's activity management service registers a listener with the Bluetooth application to monitor Bluetooth status changes.

[0217] For example, the activity management service of the mobile phone registers a monitor with the Bluetooth application, which can be used to monitor the status of the Bluetooth application releasing / establishing a Bluetooth pairing relationship, etc.

[0218] A2: In response to the mobile phone unpairing the Bluetooth pairing with the laptop, the mobile phone's Bluetooth application calls back the activity management service to delete the pairing information.

[0219] After the mobile phone's Bluetooth application terminates the Bluetooth pairing relationship with the laptop, it can call back to the activity management service to delete the pairing information. For example, in response to a user's unpairing operation, the mobile phone's Bluetooth application calls back to the activity management service to delete the pairing information. Alternatively, after the mobile phone's Bluetooth application terminates the Bluetooth pairing relationship with the laptop due to some abnormal reason, it calls back to the activity management service to delete the pairing information. The pairing deletion information indicates that the mobile phone has terminated the Bluetooth pairing relationship with the laptop.

[0220] It should be noted that for examples of the above-mentioned abnormal causes, reference can be made to the relevant descriptions in the above-mentioned embodiments, which will not be repeated here.

[0221] A3: The mobile phone's activity management service broadcasts the deletion pairing information to the basic connection module.

[0222] Exemplarily, the activity management service of the mobile phone calls a preset interface (such as band statechanged) provided by the operating system to broadcast the pairing deletion information to the basic connection module.

[0223] A4: The basic connection module of the mobile phone determines that the trigger condition is met when it determines that the last pairing state is connected and the current pairing state is disconnected; or when the last pairing state is disconnected and the current pairing state is connecting.

[0224] That is, when the basic connection module of the mobile phone receives the delete pairing information, it will determine whether the trigger condition is met. The trigger conditions include: if the previous pairing status is the connected state and the current pairing status is the unconnected state; or, if the previous pairing status is the unconnected state and the current pairing status is the connecting state. That is, the basic connection module of the mobile phone determines that the previous pairing status is the connected state and the current pairing status is the unconnected state; or, the previous pairing status is the unconnected state and the current pairing status is the connecting state, and determines that the trigger condition is met.

[0225] Among them, when the basic connection module of the mobile phone determines that the trigger condition is met, it continues to execute the following steps (such as executing A5); when the basic connection module of the mobile phone determines that the trigger condition is not met, it stops executing this solution, that is, ends the process.

[0226] A5: The basic connection module of the mobile phone encapsulates a broadcast data packet according to partial bytes of the MAC address of the laptop and the local MAC address, as well as the local timestamp, and marks the data packet type of the broadcast data packet to generate broadcast information.

[0227] A6: The basic connection module of the mobile phone transmits the broadcast information to the Bluetooth protocol stack.

[0228] Exemplarily, the basic connection module of the mobile phone can set a broadcast period and transmit the broadcast information to the Bluetooth protocol stack according to the broadcast period. For example, the broadcast period can be set to 5s or other periods, and the basic connection module of the mobile phone can transmit the broadcast information to the Bluetooth protocol stack every 5 seconds.

[0229] A7: The Bluetooth protocol stack of the mobile phone transmits the broadcast information to the Bluetooth driver.

[0230] A8: The Bluetooth driver of the mobile phone schedules the Bluetooth device to send the broadcast information.

[0231] A9: The Bluetooth device of the laptop receives the broadcast information from the mobile phone.

[0232] A10: The Bluetooth hardware of the laptop reports the broadcast information to the Bluetooth driver.

[0233] A11: The Bluetooth driver of the laptop reports the broadcast information to the Bluetooth protocol stack.

[0234] A12: The Bluetooth protocol stack of the laptop callbacks the broadcast information to the hyperterminal application.

[0235] Exemplarily, the hyperterminal application registers a callback with the Bluetooth protocol stack for receiving broadcast information. Correspondingly, after the Bluetooth protocol stack of the laptop receives the broadcast information, it callbacks the broadcast information to the hyperterminal application.

[0236] A13: The super terminal application of the laptop obtains the MAC address of the laptop from the broadcast information and verifies the MAC address of the laptop with the local MAC address.

[0237] For the relevant content included in the broadcast information, reference can be made to the relevant descriptions in the above embodiments, which will not be elaborated here.

[0238] Exemplarily, if the MAC address of the laptop is the same as the local MAC address, the super terminal application of the laptop continues to execute the following steps (such as executing A14); if the MAC address of the laptop is different from the local MAC address, the super terminal application of the laptop ends the process of this solution.

[0239] A14: The super terminal application of the laptop starts a child thread.

[0240] The child thread is used to query whether there is a Bluetooth pairing relationship between the laptop and the mobile phone, so as to avoid the main thread being blocked for a long time due to a long-time-consuming operation.

[0241] A15: The super terminal application of the laptop sends a request to the Windows Universal Platform to request to obtain the information of the paired devices.

[0242] For the relevant description of the information of the paired devices, reference can be made to the above embodiments, which will not be elaborated here.

[0243] A16: The Windows Universal Platform of the laptop returns the information of the paired devices to the super terminal application.

[0244] A17: The super terminal application of the laptop obtains the MAC address of the mobile phone from the broadcast information. If the information of the paired devices includes the MAC address of the mobile phone, the device identifier of the mobile phone is obtained through the MAC address of the mobile phone.

[0245] Exemplarily, after the super terminal application of the laptop obtains the MAC address of the mobile phone from the broadcast information, it queries whether the information of the paired devices includes the MAC address of the mobile phone. If the information of the paired devices includes the MAC address of the mobile phone, the device identifier of the mobile phone (such as device id) is obtained through the MAC address of the mobile phone, and the following steps (such as executing A18) are continued. If the information of the paired devices does not include the MAC address of the mobile phone, the super terminal application of the laptop ends the process of this solution.

[0246] A18: The super terminal application of the laptop obtains the unpairing token from the Windows Universal Platform.

[0247] The unpairing token is used to start the unpairing process (such as an exe process) to release the Bluetooth pairing relationship with the mobile phone. For example, when a device starts a process, it needs to request a token from the operating system to start the process. In the Windows operating system, a token usually refers to a security access token, which is used to represent the identity and access rights of a user or process, and is used to implement access control and rights management, and determine the access rights of a user or process to system resources.

[0248] Exemplarily, the pairing removal process may be, for example, a WinrtBleUnpair.exe process. In this solution, by starting the WinrtBleUnpair.exe process to remove the Bluetooth pairing relationship with the mobile phone, an exception may be called in the main process, resulting in a failure in removing the pairing relationship.

[0249] A19: The Windows Universal Platform on the laptop assigns an unpairing token to the HyperTerminal application.

[0250] A20: The laptop's HyperTerminal application uses the unpairing token to start the unpairing process and inputs the phone's device ID into the unpairing process.

[0251] A21: The laptop's HyperTerminal application initiates a request to the Windows Universal Platform using the phone's device ID to obtain a device ID instance (or device instance), and calls a preset interface to cancel the Bluetooth pairing relationship with the phone.

[0252] In one example, the laptop's hyperterminal application can call the first interface provided by the Windows Universal Platform to cancel the Bluetooth pairing relationship with the mobile phone. The first interface can be used to cancel the BR pairing relationship with the mobile phone, but cannot cancel the BLE pairing relationship with the mobile phone. If the Bluetooth pairing relationship between the mobile phone and the laptop is a BLE pairing relationship, the laptop's hyperterminal application calls the first interface provided by the Windows Universal Platform and cannot cancel the Bluetooth pairing relationship with the mobile phone, resulting in the continued pairing pop-up window and pairing failure when the mobile phone and the laptop establish a BLE connection.

[0253] For example, the first interface may be a BluetoothRemoveDevice(MacAddress) interface. Of course, the first interface may also be other interface names, as long as the functions of the first interface described above can be realized, they are all within the scope of protection of the embodiments of the present application.

[0254] In another example, the laptop's HyperTerminal application can call the second interface provided by the Windows Universal Platform to cancel the Bluetooth pairing relationship with the mobile phone. The second interface can be used to cancel the BR pairing relationship with the mobile phone, as well as cancel the BLE pairing relationship with the mobile phone. For example, the laptop's HyperTerminal application can call the second interface provided by the Windows Universal Platform to cancel the BR pairing relationship with the mobile phone, or cancel the BLE pairing relationship with the mobile phone based on the mobile phone's device identifier (i.e., device ID).

[0255] Exemplarily, the second interface may be, for example, the device.Pairing().UnpairAsync() interface. Of course, the second interface may also be other interface names, as long as the functions of the second interface described above can be implemented, they all fall within the scope of protection of the embodiments of the present application.

[0256] A22: The HyperTerminal application on the laptop initiates a request to the Windows Universal Platform to request information about the paired device.

[0257] A23: The Windows Universal Platform on the laptop returns the paired device information to the HyperTerminal application.

[0258] A24: The laptop's HyperTerminal application obtains the phone's MAC address from the broadcast information. If the paired device information does not include the phone's MAC address, the unpairing is determined to be successful.

[0259] Exemplarily, the laptop's HyperTerminal application retrieves the phone's MAC address from the broadcast information and queries the paired device information to see if the phone's MAC address is included. If the paired device information does not include the phone's MAC address, the unpairing is determined to be successful. If the paired device information does include the phone's MAC address, the unpairing is determined to have failed. The laptop can then repeatedly unpair the Bluetooth pairing with the phone until the unpairing is successful. For example, the laptop can re-execute steps A9-A24 to unpair the Bluetooth pairing with the phone.

[0260] In summary, the solution of the embodiment of the present application can be used to send a broadcast message to the laptop to instruct the laptop to delete the Bluetooth pairing relationship with the mobile phone. Subsequently, the laptop can delete the Bluetooth pairing relationship with the mobile phone based on the broadcast message. When the mobile phone and the laptop re-establish a Bluetooth connection, the problem of the pairing pop-up window appearing, the pairing failure, and the possible Bluetooth connection failure can be solved.

[0261] It should be noted that the content recorded in each embodiment of the present application can explain the technical solutions in other embodiments of the embodiments of the present application. The technical features recorded in each embodiment can also be applied in other embodiments and combined with the technical features in other embodiments to form a new solution. The present application only exemplarily lists several embodiments for illustration and does not represent that the present application is limited thereto.

[0262] An embodiment of the present application provides an electronic device, which can be the above-mentioned mobile phone and laptop computer. The electronic device may include: a memory and one or more processors; computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device is caused to execute each function or step performed in the above-mentioned mobile phone and laptop computer. The structure of the electronic device can refer to the structure of the mobile phone 100 shown above. Figure 9 as shown in the mobile phone 100.

[0263] An embodiment of the present application further provides a Bluetooth connection system, including a first electronic device and a second electronic device. The first electronic device can be used to execute each function or step performed by the above-mentioned mobile phone, and the second electronic device can be used to execute each function or step performed by the above-mentioned laptop computer. The structures of the first electronic device and the second electronic device can refer to the structure of the mobile phone 100 shown above. Figure 9 as shown in the mobile phone 100.

[0264] An embodiment of the present application further provides a chip system, as Figure 18 shown, the chip system 1800 includes at least one processor 1801 and at least one interface circuit 1802. The processor 1801 and the interface circuit 1802 can be interconnected by a line. For example, the interface circuit 1802 can be used to receive signals from other devices (such as the memory of an electronic device). For another example, the interface circuit 1802 can be used to send signals to other devices (such as the processor 1801). Exemplarily, the interface circuit 1802 can read the instructions stored in the memory and send the instructions to the processor 1801. When the instructions are executed by the processor 1701, the electronic device can be caused to execute each step in the above-mentioned embodiments. Of course, the chip system can also include other discrete devices, and the embodiments of the present application do not make specific limitations thereto.

[0265] An embodiment of the present application further provides a computer storage medium, in which computer instructions are stored. When the computer instructions run on an electronic device, the electronic device is caused to execute each function or step in the above-mentioned method embodiments.

[0266] An embodiment of the present application further provides a computer program product. When the computer program product runs on a computer, the computer is caused to execute each function or step in the above-mentioned method embodiments.

[0267] In addition, an embodiment of the present application further provides a device, which may specifically be a chip, a component or a module. The device may include a processor and a memory connected to each other. The memory is used to store computer-executable instructions. When the device runs, the processor may execute the computer-executable instructions stored in the memory, so that the chip executes each function or step in the above method embodiment.

[0268] The chip system, computer-readable storage medium, computer program product or device provided in this embodiment are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, which will not be elaborated here.

[0269] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0270] In the several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the module or unit is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces. The indirect coupling or communication connection of the device or unit may be in an electrical, mechanical or other form.

[0271] The unit described as a separated component may or may not be physically separated. The component displayed as a unit may be a physical unit or multiple physical units, that is, it may be located in one place, or may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0272] In addition, each functional unit in each embodiment of the present application can be integrated in a processing unit, or each unit exists physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0273] 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 readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, 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. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods of the embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0274] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and not to limit them. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A Bluetooth connection method, characterized in that: Applied to a first electronic device, where the first electronic device has established a Bluetooth pairing relationship with a second electronic device, the method includes: In response to the first electronic device and the second electronic device canceling the Bluetooth pairing, the first electronic device deletes the pairing information of the second electronic device and generates a first broadcast message, where the first broadcast message is used to instruct the second electronic device to cancel the Bluetooth pairing relationship with the first electronic device; The first electronic device sends the first broadcast information to the second electronic device, wherein the second electronic device deletes the pairing information of the first electronic device when receiving the first broadcast information; After the first electronic device sends the first broadcast information to the second electronic device, the first electronic device sends a Bluetooth connection request to the second electronic device; wherein, when the second electronic device receives the Bluetooth connection request, the first electronic device establishes a Bluetooth connection with the second electronic device.

2. The method according to claim 1, characterized in that The method further comprises: In the case that the second electronic device does not receive the first broadcast message, After the first electronic device sends a Bluetooth connection request to the second electronic device, the second electronic device receives a Bluetooth pairing request sent by the second electronic device, wherein the second electronic device stores pairing information of the first electronic device, and after receiving the Bluetooth connection request, the second electronic device sends the Bluetooth pairing request to the first electronic device; The first electronic device displays a pairing pop-up window; In response to the first electronic device displaying the pairing pop-up window, a second broadcast message is generated and sent to the second electronic device; the second broadcast message is used to instruct the second electronic device to cancel the Bluetooth pairing relationship with the first electronic device.

3. The method according to claim 1, characterized in that In response to the first electronic device and the second electronic device canceling the Bluetooth pairing, the first electronic device deletes the pairing information of the second electronic device and generates first broadcast information, including: In response to the first electronic device and the second electronic device unpairing the Bluetooth pairing, the first electronic device deletes the pairing information of the second electronic device, determines that the last pairing status of the first electronic device and the second electronic device was a paired state and the current pairing state is an unpaired state, and generates the first broadcast information.

4. The method according to claim 2, characterized in that The generating of second broadcast information in response to the first electronic device displaying the pairing pop-up window includes: In response to the first electronic device displaying the pairing pop-up window, it is determined that the last pairing state of the first electronic device and the second electronic device was an unpaired state and the current pairing state is a pairing state, and the second broadcast information is generated.

5. The method according to any one of claims 1 to 4, characterized in that The first electronic device and the third electronic device have not established a Bluetooth pairing relationship, and the method further includes: The first electronic device sends a Bluetooth pairing request to the third electronic device, generates third broadcast information, and sends the third broadcast information to the third electronic device; the third broadcast information is used to instruct the third electronic device to cancel the Bluetooth pairing relationship with the first electronic device.

6. The method according to any one of claims 1 to 5, characterized in that The first broadcast information includes a broadcast data packet and a data packet type of the broadcast data packet, where the data packet type is used to indicate the release of Bluetooth pairing; The broadcast data packet includes the MAC address of the first electronic device and the MAC address of the second electronic device.

7. The method according to claim 6, characterized in that The broadcast data packet also includes: local timestamp; The local timestamp is used to mark the first broadcast information sent this time.

8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When the duration for which the first electronic device sends the first broadcast information to the second electronic device exceeds a preset duration, the first electronic device stops sending the first broadcast information to the second electronic device.

9. A Bluetooth connection method, characterized in that: Applied to a second electronic device, where the second electronic device has established a Bluetooth pairing relationship with a first electronic device, the method includes: The second electronic device receives first broadcast information; wherein the first broadcast information is generated by the first electronic device in response to the first electronic device and the second electronic device canceling Bluetooth pairing and the first electronic device deleting pairing information of the second electronic device, and the first broadcast information is used to instruct the second electronic device to cancel the Bluetooth pairing relationship with the first electronic device; When the second electronic device receives the first broadcast information, the second electronic device deletes the pairing information of the first electronic device; After the second electronic device receives the first broadcast information, in a case where the second electronic device receives the Bluetooth connection request from the first electronic device, the second electronic device establishes a Bluetooth connection with the first electronic device.

10. The method according to claim 9, characterized in that When the second electronic device receives the first broadcast information, the second electronic device deletes the pairing information of the first electronic device, including: When the second electronic device receives the first broadcast information, the second electronic device determines whether the second electronic device has pairing information of the first electronic device according to the first broadcast information; When it is determined that the second electronic device has the pairing information of the first electronic device, the second electronic device deletes the pairing information of the first electronic device.

11. The method according to claim 10, characterized in that When the second electronic device receives the first broadcast information, the second electronic device determines, according to the first broadcast information, whether the second electronic device has pairing information of the first electronic device, including: When the second electronic device receives the first broadcast information, if the paired device information contains the MAC address of the first electronic device included in the first broadcast information, it is determined that the second electronic device has pairing information of the first electronic device.

12. The method according to claim 10 or 11, characterized in that When the second electronic device receives the first broadcast information, the second electronic device determines, according to the first broadcast information, whether the second electronic device has pairing information of the first electronic device, including: When the second electronic device receives the first broadcast information, the second electronic device starts a sub-thread to determine whether the second electronic device has pairing information of the first electronic device according to the first broadcast information.

13. The method according to any one of claims 10 to 12, characterized in that The step of, when it is determined that the second electronic device has the pairing information of the first electronic device, deleting the pairing information of the first electronic device by the second electronic device, includes: If it is determined that the second electronic device has pairing information of the first electronic device, obtaining a device identification of the first electronic device through the MAC address of the first electronic device included in the first broadcast information; The second electronic device inputs the device identification of the first electronic device into the release process and deletes the pairing information of the first electronic device.

14. The method according to any one of claims 10 to 13, characterized in that When the second electronic device receives the first broadcast information, the second electronic device determines, according to the first broadcast information, whether the second electronic device has pairing information of the first electronic device, including: When the second electronic device receives the first broadcast information, after determining that the MAC address of the second electronic device included in the first broadcast information is the same as the local MAC address, it is determined whether the second electronic device has pairing information of the first electronic device based on the first broadcast information.

15. An electronic device, characterized in that: include: memory and one or more processors; The memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 8, or executes the method according to any one of claims 9 to 14.

16. A Bluetooth connection system, characterized in that: include: A first electronic device for executing the method according to any one of claims 1 to 8, and a second electronic device for executing the method according to any one of claims 9 to 14.

17. A chip system, characterized in that: Applied to electronic equipment, the chip system includes: at least one processor and an interface; The interface is used to receive instructions and transmit them to the at least one processor; the at least one processor executes the instructions so that the electronic device executes the method according to any one of claims 1-8; or, executes the method according to any one of claims 9-14.

18. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 1 to 8; or execute the method according to any one of claims 9 to 14.

Citation Information

Patent Citations

  • Automatic depairing method and system of Bluetooth of set-top box

    CN106998496A

  • Bluetooth reconnection method and related device

    CN112399390A

  • Bluetooth search method, system and related device

    CN112449328A

  • Equipment reconnection method and related device

    CN114158025A

  • Bluetooth connection method and electronic equipment

    CN114980045A