Bluetooth connection method and electronic device

By generating a broadcast message and deleting the pairing information when the device unpairs Bluetooth, the issue of Bluetooth connection failure when the device reconnects is resolved, and stable reconnection of the device is achieved.

CN120434831BActive Publication Date: 2026-07-07HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-10-23
Publication Date
2026-07-07

Smart Images

  • Figure CN120434831B_ABST
    Figure CN120434831B_ABST
Patent Text Reader

Abstract

The application provides a Bluetooth connection method and an electronic device, and applies to the technical field of communication. The method is applied to a system including a first electronic device and a second electronic device, and the first electronic device and the second electronic device have a Bluetooth pairing relationship. The method comprises the following steps: in response to the first electronic device and the second electronic device canceling the Bluetooth pairing, the first electronic device deletes pairing information of the second electronic device, and generates first broadcast information; the first electronic device sends the first broadcast information to the second electronic device; in the case that the first broadcast information is received, the second electronic device deletes the pairing information of the first electronic device; subsequently, the first electronic device sends a Bluetooth connection request to the second electronic device; in the case that the Bluetooth connection request is received, the first electronic device and the second electronic device establish a Bluetooth connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a Bluetooth connection method and electronic device. Background Technology

[0002] With the widespread use of electronic devices, the use of Bluetooth is also increasing. Bluetooth is a wireless technology that supports short-range communication (generally within 10 meters) between devices, enabling wireless information exchange between numerous devices, including mobile phones, PDAs, wireless headsets, laptops, and related peripherals. Bluetooth effectively simplifies communication between mobile devices and between devices and the Internet, making data transmission faster and more efficient, thus paving the way for wireless communication. Furthermore, as a short-range wireless connectivity technology, Bluetooth enables convenient, flexible, secure, low-cost, and low-power data and voice communication between devices, making it one of the mainstream technologies for wireless personal area network (PAN) communication.

[0003] In related technologies, after two devices have completed Bluetooth pairing, if the user unpairs the Bluetooth pairing on one device, a Bluetooth connection failure may occur when the two devices try to re-establish a Bluetooth connection. Therefore, a new Bluetooth connection solution is urgently needed to solve this problem. Summary of the Invention

[0004] This application provides a Bluetooth connection method and an electronic device to solve the problem that when two devices have completed Bluetooth pairing, and one device unpairs the Bluetooth pairing, the Bluetooth connection may fail when the two electronic devices re-establish a Bluetooth connection.

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

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

[0007] A first electronic device sends a first broadcast message to a second electronic device. Upon receiving the first broadcast message, the second electronic device deletes the pairing information from the first electronic device. Then, after sending the first broadcast message, the first electronic device sends a Bluetooth connection request to the second electronic device. 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, since the first electronic device deletes the pairing information of the second electronic device when unpairing Bluetooth, generates a first broadcast message, and sends the first broadcast message to the second electronic device, instructing the second electronic device to unpair its Bluetooth pairing with the first electronic device, the second electronic device, upon receiving the first broadcast message, deletes the pairing information of the first electronic device. In this case, since the second electronic device has deleted the pairing information of the first electronic device, the first electronic device sends a Bluetooth connection request to the second electronic device. Upon receiving the Bluetooth connection request, the first electronic device and the second electronic device successfully establish a Bluetooth connection.

[0009] In one 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 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 being used to instruct the second electronic device to release the Bluetooth pairing relationship with the first electronic device.

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

[0011] In one possible implementation of the first aspect, in response to the first electronic device and the second electronic device unpairing their 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 their Bluetooth pairing, the first electronic device deletes the pairing information of the second electronic device, determines that the previous pairing state 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 first broadcast information.

[0012] In other words, the first electronic device determines that it has unpaired the Bluetooth pairing with the second electronic device based on the fact that the previous pairing status between the first electronic device and the second electronic device was a paired status and the current pairing status is an unpaired status, thereby generating the first broadcast information.

[0013] In one possible implementation of the first aspect, generating second broadcast information in response to the first electronic device displaying a pairing pop-up window includes: in response to the first electronic device displaying a pairing pop-up window, determining that the previous pairing state between the first electronic device and the second electronic device was an unpaired state and the current pairing state is a pairing state, and generating second broadcast information.

[0014] In other words, the first electronic device determines to display a pairing pop-up window based on the fact that the previous pairing status between the first electronic device and the second electronic device was unpaired and the current pairing status is pairing, thereby generating the second broadcast information.

[0015] In one possible implementation of the first aspect, the first electronic device and the third electronic device have not established a Bluetooth pairing relationship. The method further includes: the first electronic device sending a Bluetooth pairing request to the third electronic device, generating a third broadcast message, and sending the third broadcast message to the third electronic device; the third broadcast message is used to instruct the third electronic device to cancel the Bluetooth pairing relationship with the first electronic device.

[0016] Optionally, the first electronic device determines that it and the third electronic device have not established a Bluetooth pairing relationship based on the fact that their previous pairing state was unpaired and their current pairing state is also unpaired. Therefore, when the first electronic device and the third electronic device establish a Bluetooth pairing for the first time, 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 its Bluetooth pairing relationship with the first electronic device.

[0017] Therefore, 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. Thus, even if the third electronic device receives the third broadcast message, it 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 message to the third electronic device, it sends a Bluetooth connection request. Upon receiving the Bluetooth connection request, the first electronic device and the third electronic device establish a Bluetooth connection.

[0018] In this implementation, compared to existing technologies, when the first electronic device and the third electronic device establish Bluetooth pairing, the first electronic device also generates and sends third broadcast information to the third electronic device. This further ensures the successful establishment of a Bluetooth connection between the first and third electronic devices.

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

[0020] Alternatively, the broadcast data packet may include partial bytes of the MAC address of the first electronic device and partial bytes of the MAC address of the second electronic device. This ensures the security of transmitting the first broadcast information.

[0021] In another possible implementation of the first aspect, the broadcast data packet also includes a local timestamp to mark the first broadcast information sent.

[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. This avoids continuously sending the first broadcast information, thus preventing resource waste.

[0023] Secondly, a Bluetooth connection method is provided, applied to a second electronic device, wherein the second electronic device and a first electronic device have established a Bluetooth pairing relationship. The method includes: the second electronic device receiving first broadcast information; wherein the first broadcast information is generated by the first electronic device in response to the first electronic device unpairing the Bluetooth pairing with the second electronic device and deleting the pairing information of the second electronic device, and the first broadcast information is used to instruct the second electronic device to delete the Bluetooth pairing relationship with the first electronic device.

[0024] Upon receiving the first broadcast information, the second electronic device deletes the pairing information of the first electronic device; after receiving the first broadcast information, and upon receiving a 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, since the first electronic device deletes the pairing information of the second electronic device when unpairing Bluetooth, generates a first broadcast message, and sends the first broadcast message to the second electronic device, instructing the second electronic device to unpair its Bluetooth pairing with the first electronic device, the second electronic device, upon receiving the first broadcast message, deletes the pairing information of the first electronic device. In this case, since the second electronic device has deleted the pairing information of the first electronic device, the first electronic device sends a Bluetooth connection request to the second electronic device. Upon receiving the Bluetooth connection request, the first electronic device and the second electronic device successfully establish a Bluetooth connection.

[0026] In one possible implementation of the second aspect, 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 with the first electronic device based on the first broadcast information; if it is determined that the second electronic device has pairing information with the first electronic device, the second electronic device deletes the pairing information of the first electronic device. This ensures the accuracy of the second electronic device deleting the pairing information of the first electronic device.

[0027] In one possible implementation of the second aspect, when the second electronic device receives the first broadcast information, the second electronic device determines whether it has pairing information with the first electronic device based on the first broadcast information. This includes: if the paired device information contains the MAC address of the first electronic device included in the first broadcast information, then the second electronic device determines that it has pairing information with 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 the second electronic device receives the first broadcast information, the second electronic device determines whether it has pairing information with the first electronic device based on the first broadcast information. This includes: when the second electronic device receives the first broadcast information, the second electronic device starts a sub-thread to determine whether it has pairing information with the first electronic device based on the first broadcast information. This avoids the main thread being blocked for a long time due to starting the main thread.

[0029] In one possible implementation of the second aspect, if it is determined that the second electronic device has pairing information with the first electronic device, the second electronic device deletes the pairing information of the first electronic device. This includes: if it is determined that the second electronic device has pairing information with the first electronic device, obtaining the device identifier 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 identifier of the first electronic device into the de-pairing process and deletes the pairing information of the first electronic device. This avoids exceptions in the main process that could lead to de-pairing failure.

[0030] In one possible implementation of the second aspect, when the second electronic device receives the first broadcast information, the second electronic device determines whether it has pairing information with the first electronic device based on the first broadcast information. 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 whether the second electronic device has pairing information with the first electronic device based on the first broadcast information. This reduces power consumption and avoids accidental deletion of pairing information.

[0031] Thirdly, an electronic device is provided, which has the functions of implementing the first aspect or any one of the first aspects described above, and the electronic device also has the functions of implementing the second aspect or any one of the second aspects described above. These functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions.

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

[0033] Fifthly, a Bluetooth connectivity system is provided, comprising a first electronic device for performing the method described in the first aspect or any one of the first aspects, and a second electronic device for performing the method described in the second aspect or any one of the second aspects.

[0034] A sixth aspect provides a chip system for use in an electronic device, the chip system comprising: at least one processor and an interface for receiving instructions and transmitting them to the at least one processor; the at least one processor executes instructions to cause the electronic device to perform the method described in any one of the first aspects; or to perform the method described in the second aspect or any one of the second aspects.

[0035] In a seventh aspect, a computer-readable storage medium is provided, which stores instructions that, when executed on a computer, cause the computer to perform the method described in any one of the first aspects; or to perform the method described in the second aspect or any one of the second aspects.

[0036] Eighthly, a computer program product comprising instructions is provided, which, when run on a computer, enables the computer to perform the method described in any one of the first aspects; or to perform the method described in the second aspect or any one of the second aspects.

[0037] The technical effects of any of the implementation methods in aspects three through eight can be referenced from the technical effects of different implementation methods in aspects one and two, and will not be elaborated here. Attached Figure Description

[0038] Figure 1 A schematic diagram of a Bluetooth pairing interface provided in this application embodiment. Figure 1 ;

[0039] Figure 2 A schematic diagram of a Bluetooth pairing interface provided in this application embodiment. Figure 2 ;

[0040] Figure 3 A schematic diagram of a Bluetooth pairing interface provided in this application embodiment. Figure 3 ;

[0041] Figure 4 A schematic diagram of a Bluetooth pairing process provided in an embodiment of this application;

[0042] Figure 5 A schematic diagram of a Bluetooth connection provided in an embodiment of this application. Figure 1 ;

[0043] Figure 6 A schematic diagram of a trust loop provided in an embodiment of this application;

[0044] Figure 7 A schematic diagram of an interface for canceling pairing provided in an embodiment of this application;

[0045] Figure 8A schematic diagram of a Bluetooth connection provided in an embodiment of this application. Figure 2 ;

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

[0047] Figure 10 A schematic diagram of a Bluetooth connection provided in this application embodiment. Figure 1 ;

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

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

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

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

[0052] Figure 15 A schematic diagram illustrating the process of unpairing a laptop computer from a mobile phone, provided as an embodiment of this application;

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

[0054] Figure 17 A schematic diagram of a Bluetooth connection provided in this application embodiment. Figure 2 ;

[0055] Figure 18 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0056] The technical solutions of the embodiments of this application are described below with reference to the accompanying drawings. In the description of the embodiments of this application, the terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be a limitation of this application. As used in the specification and appended claims of this application, the singular expressions "a," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, "at least one" and "one or more" refer to one or more (including two). The term "and / or" is used to describe the relationship between related objects, indicating that three relationships can exist: for example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0057] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. The term "connection" includes direct connections and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.

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

[0059] For ease of understanding, the terminology used in the embodiments of this application is described below. It should be understood that the terminology used in the following embodiments of this application is for the purpose of describing specific embodiments only, and is not intended to be a limitation of this application.

[0060] 1. Electronic equipment.

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

[0062] Alternatively, the electronic device may also be a Bluetooth headset, wristband, watch, body fat scale, Bluetooth blood pressure monitor, wearable device (such as Bluetooth glasses, VR glasses, etc.), in-vehicle device, Bluetooth speaker, smart home device and / or smart city device, Internet of Things device, projector, sensor, etc., or it may be a mobile phone, tablet, laptop, PDA, etc.

[0063] 2. Bluetooth type.

[0064] Bluetooth type refers to the type of Bluetooth protocol supported by a Bluetooth device. In the Bluetooth 4.0 standard, the Bluetooth protocol can be divided into Classic Bluetooth (BT) and Bluetooth Low Energy (BLE). BT can also be described as Basic Rate (BR), Enhanced Data Rate (EDR), etc., while BLE can be described as Bluetooth Smart, Low Energy, etc. For example, a performance comparison of BT and BLE in the Bluetooth 4.0 standard 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-3Mbps 1Mbps Delay 100ms 6ms Voice function have none Power consumption 1W 0.01~0.05W Network topology Star Star Peak current consumption Less than 30mA Less than 15mA

[0067] For devices supporting the Bluetooth 4.0 standard, they can be further categorized into BT single-mode, BLE single-mode, and BT and BLE dual-mode. As the names suggest, BT single-mode means it supports Bluetooth but not BLE, BLE single-mode means it supports BLE but not BT, and BT and BLE dual-mode means it supports both BT and BLE. Typically, mobile phones and other electronic devices support BT and BLE dual-mode, while some Bluetooth devices, such as sensors, support BLE single-mode for power saving; or some Bluetooth devices, such as wearable devices and Bluetooth speakers, support BT single-mode due to limited transmission distance.

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

[0069] In this embodiment, the Bluetooth type of the Bluetooth device 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 BT type Bluetooth device, the electronic device calls the BR connection interface to establish a Bluetooth connection with the Bluetooth device; for a BLE type Bluetooth device, 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 a registration method for connecting Bluetooth devices or electronic devices. Connectivity is achieved by registering device information between devices. This device information may include, but is not limited to, device identifier, Bluetooth type, device type, battery level, Media Access Control (MAC) address, and Internet Protocol (IP) address. The device identifier uniquely identifies the device and can be automatically generated or generated in response to user input. The Bluetooth type can be either BT or BLE. The device type can be a watch, wristband, Bluetooth headset, etc. Battery level information indicates the remaining battery power of the electronic device or Bluetooth device.

[0072] For example, taking a mobile phone and a laptop as electronic devices, assuming the mobile phone is the primary pairing device and the laptop is the secondary pairing device, the Bluetooth pairing method between the mobile phone and the laptop can be any of the following for the Bluetooth application on the mobile phone:

[0073] (1) Proximity reveals pairings.

[0074] Proximity discovery pairing refers to a short distance between the phone and the laptop, allowing the phone to scan for the laptop within its scanning range and pair to establish a Bluetooth connection. An example of the user interface involved in this pairing method can be found here. Figure 1 (1) to Figure 1 The user interface shown in (5) is displayed. When the phone is brought close to the laptop, the phone can display... Figure 1 The user interface shown in (1) displays an "Add Device" control 102. Upon detecting a click on the control 102, in response to the click, the following can be displayed: Figure 1 The scanning radar in the user interface shown in (2) searches for Bluetooth devices in the environment where the phone is located. For example, in response to the phone's proximity operation, it searches for laptops. Figure 1 The user interface shown in (2) also displays available devices 103, including device information of the laptop found when the phone is near, such as device identification and remaining battery power. Upon detecting a click on available devices 103, in response to the click, the following can be displayed: Figure 1 The user interface shown in (3) is used to obtain Bluetooth message synchronization service permissions and displays a skip control and an agree control. Upon detecting a click on the agree control, in response to the click, the following can be displayed: Figure 1 The user interface shown in (4) sends a pairing request to the laptop, indicating that the phone is pairing with the laptop. Upon receiving a pairing confirmation response from the laptop, it can display as shown in (4). Figure 1 The user interface shown in (5) indicates that the mobile phone and the laptop have been paired and connected successfully, so that the mobile phone and the laptop can exchange information wirelessly.

[0075] (2) Add pairs manually.

[0076] Manual pairing refers to pairing based on the Bluetooth device type selected by the user. For example, the user interface for this pairing method can be found here. Figure 2 (1) to Figure 2 The user interface shown in (4) is an example. For instance, the phone displays as shown in [example]. Figure 2 The user interface shown in (1) displays an "Add Device" control 104. Upon detecting a click on the control 104, in response to the click, the following can be displayed: Figure 2 The scanning radar in the user interface shown in (2) also displays a manual add control 105 and a barcode add control. Upon detecting a click on the manual add control 105, in response to the click, the following can be displayed: Figure 2The user interface shown in (3) provides various types of Bluetooth devices, as well as different product models of the same type of Bluetooth device, such as different product models of laptops. Assuming the product model of laptop 1 is product model 1, upon detecting a click operation on product signal 1 for the laptop, in response to the click operation, the following can be displayed: Figure 2 The user interface shown in (4) displays configuration prompts and a start pairing control. Upon detecting a click on the start pairing control, in response, the system scans the environment where the phone is located for a laptop of that model, based on the laptop's product model 1. If a laptop of that model is detected, the following can be displayed: Figure 1 The user interface shown in (2) displays available devices 103, including device information for the scanned laptop of the product model, such as the device information for laptop 1. A click operation is detected on laptop 1, and in response to the click operation, reference... Figure 1 (3) to Figure 1 The user interface shown in (5) completes the pairing of the mobile phone and laptop 1. Related descriptions can be found in the above embodiments and will not be repeated here.

[0077] (3) Scan the code to pair.

[0078] QR code pairing refers to a mobile phone scanning a QR code on a Bluetooth device to pair with it. For example, the user interface involved in this pairing method can be found in [reference needed]. Figure 3 (1) to Figure 3 The user interface shown in (4) is an example. For instance, the phone displays as shown in [example]. Figure 3 The user interface shown in (1) displays an "Add Device" control 106. Upon detecting a click on the control 106, in response to the click, the following can be displayed: Figure 3 The scanning radar in the user interface shown in (2) also displays a manual add control and a scan add control 107. Upon detecting a click on the scan add control 107, in response to the click, the following can be displayed: Figure 3 The user interface shown in (3) includes a scanning box 108 for scanning QR codes displayed on Bluetooth devices, such as those displayed on a laptop. In response to scanning a QR code displayed on a laptop, device information of the laptop is obtained based on that QR code, and... Figure 3 The available devices section 109 in the user interface shown in (4) displays the laptop's device information. A click operation on the laptop is detected, and in response to the click operation, reference... Figure 1 (3) to Figure 1The user interface shown in (5) completes the pairing of the mobile phone and the laptop. Related descriptions can be found in the above embodiments and will not be repeated here.

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

[0080] SMP defines a simple and reliable authentication and key distribution process (also known as a pairing process). SMP allows Bluetooth devices to encrypt the link and exchange data using the negotiated key. Electronic devices and Bluetooth devices can store their respective keys. When the two devices reconnect, they can skip the pairing process and directly use the previously stored key to encrypt the link. This key storage process can also be called bonding.

[0081] Please see Figure 4 As shown, the specific steps for the initial Bluetooth pairing of a mobile phone and a laptop are as follows:

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

[0083] For example, a laptop can broadcast Bluetooth information after Bluetooth is enabled. This Bluetooth information includes the laptop's device information.

[0084] For example, after enabling Bluetooth, a mobile phone can scan for Bluetooth devices, that is, after enabling Bluetooth, the mobile phone can receive Bluetooth information broadcast by other Bluetooth devices.

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

[0086] For example, after receiving Bluetooth information broadcast by a laptop, the phone can access the Bluetooth function interface (such as the one mentioned above). Figure 1 The user interface shown in (2) Figure 2 The user interface shown in (3) Figure 3The user interface shown in (4) displays the laptop's device information. After receiving the user's click on the laptop's device information, the mobile phone sends a Bluetooth pairing request to the laptop. This Bluetooth pairing request instructs the laptop to pair with the mobile phone via Bluetooth so that Bluetooth communication can occur between the two devices.

[0087] S103: The mobile phone and the laptop computer negotiate a key and generate a key.

[0088] The key is used by mobile phones and laptops to encrypt the data they transmit and decrypt the data they receive.

[0089] S104: The phone and laptop save the key and complete Bluetooth pairing.

[0090] The above S101 to S104 describe the process of initial Bluetooth pairing between a mobile phone and a laptop. After the initial successful pairing, the mobile phone and laptop can store the generated key. When the mobile phone and laptop connect via Bluetooth, they do not need to pair again and can connect directly based on the stored key.

[0091] For example, the phone detects a click on the "Bluetooth" icon (which could be the Bluetooth icon in the Control Center or the Bluetooth icon in the Settings app), and in response to the click, the phone can display something like this. Figure 5 The user interface shown in (1) may include multiple options, such as Bluetooth, personal hotspot, mobile network, more connections, display and brightness, storage, etc., wherein Bluetooth is enabled. Upon detecting a click on Bluetooth, in response to the click, the following can be displayed: Figure 5 The user interface shown in (2) includes a list of paired devices and a list of available devices. The list of paired devices indicates Bluetooth devices that have been paired with the phone, and the list of available devices indicates Bluetooth devices that the phone has scanned that have not been paired with the phone or have been paired and then deleted.

[0092] For example, for Bluetooth devices included in the paired device list, the mobile phone can directly establish a Bluetooth connection with the paired Bluetooth device. For instance, such as... Figure 5As shown in (2), assuming the paired device list includes computer 1 and computer 2, a click operation targeting computer 1 is detected. In response to this click operation, the mobile phone sends a Bluetooth connection request to computer 1 (such as the laptop mentioned above). This Bluetooth connection request carries the key generated during the pairing process. Computer 1 receives the Bluetooth connection request from the mobile phone (carrying the key) and sends a connection confirmation response to the mobile phone. Accordingly, the mobile phone receives the connection confirmation response from computer 1, indicating that the mobile phone and computer 1 have successfully connected. Furthermore, after the mobile phone and computer 1 have successfully connected, the mobile phone can display as shown in the image below. Figure 5 The user interface shown in (3) indicates that computer 1 is connected (i.e., computer 1 is successfully connected to the mobile phone).

[0093] It should be noted that the above-described method involves the mobile phone receiving the user's operation and establishing a Bluetooth connection with computer 1. However, the method of Bluetooth connection in this application embodiment is not limited to this. 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 have established a pairing relationship, as long as both the mobile phone and computer 1 have Bluetooth enabled and the distance is less than a certain threshold, a Bluetooth connection can be automatically established.

[0094] For example, a mobile phone can establish a Bluetooth pairing relationship with a Bluetooth device included in the list of available devices. For instance, such as... Figure 5 As shown in (2), assuming the list of available devices includes computer a and computer b, a click operation targeting computer a is detected. In response to this click operation, a pairing request is sent to computer a. A pairing confirmation response is received from computer a, indicating that the phone and computer a have been paired. Furthermore, after the phone and computer a have been paired, as... Figure 5 As shown in (4), add computer a to the list of paired devices and remove computer a from the list of available devices. Optionally, after the mobile phone and computer a are paired, the mobile phone and computer a can directly establish a Bluetooth connection (i.e., the connection is successful). Alternatively, after the mobile phone and computer a are paired, computer a is included in the mobile phone's list of paired devices, and in response to the user's click operation on computer a, the mobile phone and computer a establish a Bluetooth connection.

[0095] 4. Trust loop.

[0096] A trust ring refers to a technology that allows mobile phones, tablets, laptops, and other electronic devices logged into the same system account to discover each other, automatically form a network, and establish multi-device collaborative work. For example, when mobile phones, tablets, laptops, and other electronic devices logged into the same system account have WLAN and Bluetooth enabled, and relevant services (such as smart connectivity services) enabled in the settings application, these electronic devices can be confirmed to have joined the same trust ring.

[0097] like Figure 6 The diagram shown is a schematic representation of a trust ring provided in an embodiment of this application. The trust ring includes multiple devices that can provide 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 edit a document using a document editing application on one device and then continue editing on another device; similarly, when a mobile phone receives an incoming call, other devices within the trust ring can resonate, allowing the user to answer the call on other devices; furthermore, keyboards and mice can be shared, allowing the user to control multiple devices using a mouse and keyboard connected to one device.

[0098] It should be noted that the Bluetooth connection method provided in this application embodiment can be applied to the aforementioned trust ring, and any two devices in the trust ring have a pre-established Bluetooth pairing relationship. Of course, the application scenarios of the method in this application embodiment are not limited to this; other scenarios (such as establishing a Bluetooth connection) also fall within the protection scope of this application embodiment.

[0099] Furthermore, within the aforementioned trust loop, both devices need to have their Wi-Fi enabled when performing shared tasks. In other scenarios, however, the absence of Wi-Fi on either device does not affect the execution of the solutions described in this application's embodiments.

[0100] In this embodiment, the trust ring may include the aforementioned mobile phone and laptop, with the mobile phone and laptop having a pre-established Bluetooth pairing relationship. In some embodiments, after the mobile phone and laptop have established a pre-established Bluetooth pairing relationship, due to some reason, the mobile phone unilaterally unpairs itself from the laptop, while the laptop does not unpair itself from the mobile phone. That is, the mobile phone deletes the laptop's pairing information, but the laptop does not delete the mobile phone's pairing information. This will cause Bluetooth connection failure when the two devices try to connect again. Because the laptop still stores the mobile phone's pairing information, after receiving the mobile phone's Bluetooth connection request, the laptop will actively initiate a Bluetooth pairing request to the mobile phone. However, since the mobile phone has deleted the laptop's pairing information, the Bluetooth pairing between the mobile phone and the laptop will fail, further causing the mobile phone to frequently display pairing pop-ups, thus preventing the user from using the Bluetooth function normally. For example, in response to the user's unpairing operation, the mobile phone unpairs itself from the laptop's Bluetooth pairing relationship. For example, after the mobile phone and laptop have established a Bluetooth pairing relationship, the mobile phone may display as follows: Figure 7The user interface shown in (1) includes a list of paired devices, including option 1, which displays the device name of a laptop (e.g., computer 1), indicating that the phone and laptop are paired. In response to a user tapping option 1, the phone can display... Figure 7 The user interface shown in (2) includes multiple options, such as: the device name of the laptop (e.g., computer 1), unpair, call, media audio, etc., without limitation. In response to the user's click to unpair, the mobile phone unpairs from the Bluetooth pairing relationship with the laptop.

[0101] Alternatively, the phone may have disconnected from the laptop's Bluetooth pairing for some unusual reason. For example, this unusual reason could include one or more of the following: the phone has been reset to factory settings, the phone's system has been reset, or the phone's Bluetooth has malfunctioned, etc., without limitation.

[0102] In response to the phone unpairing from the laptop's Bluetooth pairing, such as Figure 8 As shown in (1), the laptop's device identifier is not included in the paired device list of the mobile phone, but the laptop's device identifier (e.g., computer 1) is included in the available device list. The laptop has not unpaired its Bluetooth pairing with the mobile phone, and the mobile phone's device identifier (e.g., mobile phone 1) is included in the laptop's device list, displaying a "Paired" message. Based on this, as... Figure 8 The user interface shown in (2) is the trust ring interface displayed by the laptop. In response to the user's click on the device ball 201 (e.g., "phone 1") and the click on the trust ring service 202 (e.g., "screen sharing"), the laptop sends a Bluetooth pairing request to the phone to request the phone to establish Bluetooth pairing and connection with the laptop. After the Bluetooth connection is successful, the phone can join the trust ring corresponding to the laptop and enable sharing services (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, there is no need for the mobile phone and laptop to establish Bluetooth pairing. They can directly establish a Bluetooth connection through the Bluetooth application to achieve the aforementioned sharing service. However, in this embodiment, the reason why the laptop sends a Bluetooth pairing request to the mobile phone is because the mobile phone and laptop have a pre-established Bluetooth pairing request, and the mobile phone has deleted the laptop's pairing information, while the laptop has not deleted the mobile phone's pairing information. Therefore, the laptop will send Bluetooth pairing information to the mobile phone. Correspondingly, if the laptop joins the trust ring corresponding to the mobile phone, the mobile phone can send a Bluetooth connection request to the laptop. Since the laptop still retains the mobile phone's pairing information, the laptop believes that Bluetooth pairing needs to be established before a Bluetooth connection can be established, and therefore the laptop will send a Bluetooth pairing request to the mobile phone. In other words, whether the mobile phone initiates the Bluetooth connection request or the laptop initiates the Bluetooth connection request, because the laptop still retains the mobile phone's pairing information, the laptop will send a Bluetooth pairing request to the mobile phone.

[0104] For example, after the mobile phone receives a Bluetooth pairing request from the laptop, such as Figure 8 The user interface shown in (3) displays a dialog box 203 that prompts the laptop to request Bluetooth pairing. The dialog box 203 includes a cancel control and a pairing control. The phone detects a user click on the pairing control and, in response, displays... Figure 8 The user interface shown in (4) includes a dialog box 204 for indicating pairing failure.

[0105] Based on this, embodiments of this application provide 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 establish 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 unpaired its Bluetooth pairing relationship with the second electronic device, and the broadcast message is used to instruct the second electronic device to unpair its Bluetooth pairing relationship with the first electronic device. Thus, by notifying the second electronic device to unpair its Bluetooth pairing relationship with the first electronic device through a 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 can be the same or different. For example, the operating system of the first electronic device can be Android. TM The operating system of the second electronic device can be Windows. TMThe system; or, both the first electronic device and the second electronic device operate on Windows. TM Systems, etc., are not limited. The following embodiments use a mobile phone as the first electronic device, and the mobile phone's operating system is Android. TM The system's second electronic device is a laptop computer, and the laptop computer's operating system is Windows. TM The system is used as an example for illustration.

[0107] For example, refer to Figure 9 This is a schematic diagram of the hardware structure of a mobile phone provided in an embodiment of this application. Figure 9 As 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, antenna 1, 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 headphone jack 170D, a sensor module 180, a positioning module 181, buttons 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 is 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 illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0108] Processor 110 may include one or more processing units, such as: an application processor (AP), a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a modem, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.

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

[0110] The charging management module 130 receives charging input from a charger, which can be a wireless charger or a wired charger. The power management module 131 connects to the battery 132, the charging management module 130, and the processor 110. The power management module 131 receives input from the battery 132 and / or the charging management module 130 to power the processor 110, internal memory 121, external memory, display screen 194, camera 193, and wireless communication module 153, etc.

[0111] The wireless communication function of mobile phone 100 can be achieved through antenna 1, antenna 2, mobile communication module 251, wireless communication module 153, AP, and modem. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0112] Mobile communication module 151 can provide solutions for cellular communication (such as 2G / 3G / 4G / 5G) and satellite communication applications on mobile phone 100. Mobile communication module 151 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. Mobile communication module 151 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to the baseband processor for demodulation. Mobile communication module 151 can also amplify the signal modulated by the baseband processor and convert it into electromagnetic waves for radiation via antenna 1.

[0113] The wireless communication module 153 can provide solutions for wireless communication applications on the mobile phone 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technology. 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 antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 153 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

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

[0115] The mobile phone 100 uses the GPU, display screen 194, and AP to achieve display functions, such as displaying the application interface of various applications like Bluetooth.

[0116] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of mobile phone 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area.

[0117] The mobile phone 100 can achieve audio functions such as music playback and recording through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[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 may include 1-N SIM card interfaces 295. The SIM card can be inserted into or removed from the SIM card interface 295 to achieve contact and separation with the mobile phone 100. 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, etc. 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 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external storage cards. The mobile phone 100 communicates with the network through the SIM card to realize functions such as voice calls and data communication. In some embodiments, the mobile phone 100 uses an eSIM, i.e., an 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 aforementioned laptop may include... Figure 9 The parts or all of the components shown may also include those that are more than [the specified components]. Figure 9 This illustrates the presence or absence of more or fewer components, the combination of certain components, the separation of certain components, or different component arrangements. For examples illustrating the hardware structure of a laptop, please refer to [reference needed]. Figure 9 The hardware structure of the mobile phone 100 shown is described in detail here.

[0120] The technical solutions provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings. It should be understood that in the embodiments of this application, the mobile phone and the laptop computer have a pre-established Bluetooth pairing relationship. For example, the mobile phone and the laptop computer can be paired via the above... Figures 1 to 3 Establish a Bluetooth pairing relationship using any of the pairing methods shown. For example, a mobile phone and a laptop can be paired using the methods described above. Figure 4 The pairing process shown establishes a Bluetooth pairing relationship. The specific implementation method can be found in the above description, and will not be repeated here.

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

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

[0123] The broadcast message is used to instruct the laptop to unpair its Bluetooth pairing with the phone.

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

[0125] For condition 1, for example, in response to the mobile phone and laptop unpairing their Bluetooth pairing, the mobile phone deletes the laptop's pairing information and generates broadcast message 1 (which can be understood as the first broadcast message). In this scenario, the mobile phone sends broadcast message 1 to the laptop, and correspondingly, the laptop receives broadcast message 1 from the mobile phone. This broadcast message 1 can be the same as the broadcast message mentioned above, both used to instruct the laptop to unpair its Bluetooth pairing with the mobile phone.

[0126] For example, in response to a user's deselection operation, the mobile phone can unpair the Bluetooth pairing with the laptop and delete the pairing information from the laptop; the relevant process can be referred to the above. Figure 7 The relevant descriptions shown are not repeated here. Alternatively, the mobile phone may unpair its Bluetooth pairing with the laptop for some abnormal reasons. For a description of the abnormal reasons, please refer to the above embodiments, which will not be repeated here.

[0127] For condition 2, for example, if the laptop does not receive broadcast information 1, the mobile phone sends a Bluetooth connection request to the laptop. Since the laptop stores the mobile phone's pairing information, it sends a Bluetooth pairing request to the mobile phone. After receiving the pairing request from the laptop, the mobile phone displays a pairing pop-up window (e.g., showing...). Figure 8 The dialog box 203 shown in (3) 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, and the laptop receives broadcast information 2 from the mobile phone. This broadcast information 2 is the same as the broadcast information mentioned above, both used to instruct the laptop to unpair the Bluetooth pairing relationship with the mobile phone. That is to say, in the above scheme, the mobile phone can generate broadcast information 1 and send broadcast information 1 to the laptop when condition 1 is met. In this way, the pairing pop-up and pairing failure can be avoided when the mobile phone and the laptop re-establish a Bluetooth connection without the user's awareness, thus preventing the Bluetooth connection from failing.

[0128] However, if the phone generates broadcast message 1 and sends it to the laptop when condition 1 is met, but the problem cannot be resolved at that time due to the distance between the phone and the laptop or communication limitations, then the phone can generate broadcast message 2 and send it to the laptop when condition 2 is met. This further ensures that when the phone and laptop re-establish a Bluetooth connection, pairing pop-ups and pairing failures are avoided, preventing Bluetooth connection failures.

[0129] It should be noted that in this embodiment, conditions 1 and 2 are parallel. When the mobile phone determines that it meets either of the above conditions, it generates a broadcast message and sends the broadcast message to the laptop. In this embodiment, the order in which the mobile phone determines whether it meets conditions 1 and 2 is not limited. For example, the mobile phone may first determine whether it meets condition 1. If it meets condition 1, the mobile phone generates broadcast message 1 and sends it to the laptop. If it does not meet condition 1, the mobile phone determines whether it meets condition 2. If it meets condition 2, the mobile phone generates broadcast message 2 and sends it to the laptop. If the mobile phone does not meet both conditions 1 and 2, the mobile phone ends the execution of this scheme, that is, the mobile phone does not generate a broadcast message.

[0130] Accordingly, the mobile phone can optionally determine whether it meets condition 2. If it does, the mobile phone generates broadcast message 2 and sends it to the laptop. If it does not meet condition 2, the mobile phone determines whether it meets condition 1. If it does, the mobile phone generates broadcast message 1 and sends it to the laptop. If it does not meet either condition 1 or condition 2, the mobile phone terminates the execution of this scheme, i.e., the mobile phone does not generate broadcast message.

[0131] In some embodiments, the mobile phone can determine whether the triggering condition is met by considering the phone's previous pairing status with the laptop and the current pairing status. For example, such as... Figure 11 As shown, pairing states include paired, pairing in progress, and not paired. The paired state indicates that the primary pairing device has successfully established a Bluetooth pairing with the secondary pairing device; this state is established after successful pairing. The pairing in progress state indicates that the primary pairing device is in the process of establishing a Bluetooth pairing with the secondary pairing device. This state means that the pairing is not yet fully established, and the primary pairing device is attempting to connect to the secondary pairing device, awaiting the secondary pairing device's response and confirmation. Only after successful pairing will the pairing state change to paired. In short, the paired state is a stable state established after successful pairing, while the pairing in progress state is a temporary state during the pairing process.

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

[0133] In the embodiments of this application, the primary and secondary partners can be mobile phones, and the secondary partners can be laptops; correspondingly, the primary and secondary partners can be laptops, and the secondary partners can be mobile phones, without limitation.

[0134] As an example, if the previous pairing status was "paired" and the current pairing status is "unpaired," it means the phone meets condition 1 above. Therefore, the phone generates broadcast message 1 and sends broadcast message 1 to the laptop. For example, such as... Figure 12 As 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 status and the current pairing status between the mobile phone and the laptop.

[0136] For example, the mobile phone can obtain a first tag value and a second tag value. The first tag value can be, for example, PREVIOUS_BOND_STATE, to indicate the previous pairing status, and the second tag value can be, for example, BOND_STATE, to indicate the current pairing status, etc., without limitation.

[0137] S2. The mobile phone determines whether the last pairing status between the mobile phone and the laptop was a paired status.

[0138] For example, if the previous pairing state between the mobile phone and the laptop was "paired," the mobile phone can continue to execute the following steps, such as S3; if the previous pairing state between the mobile phone and the laptop was not "paired," the mobile phone can continue to determine whether it meets condition 2. If the mobile phone meets condition 2, it generates broadcast information 2 and sends broadcast information 2 to the laptop. If the mobile phone does not meet condition 2, it ends the execution of this scheme, that is, it does not generate broadcast information. For an example of whether the mobile phone meets condition 2, please refer to the relevant description in the following embodiments, which will not be repeated here.

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

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

[0141] For example, if the current pairing status of the mobile phone and the laptop is unpaired, the mobile phone can continue to execute the following steps, such as executing S4; if the current pairing status of the mobile phone and the laptop is not unpaired, 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 information 2 and sends broadcast information 2 to the laptop. If the mobile phone does not meet condition 2, the mobile phone ends the execution of this scheme, that is, it does not generate broadcast information. For an example of whether the mobile phone meets condition 2, please refer to the relevant description of the following embodiments, which will not be repeated here.

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

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

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

[0145] As another example, if the previous pairing status was unpaired and the current pairing status is pairing, it means the phone meets condition 2 above. Therefore, the phone generates broadcast message 2 and sends it to the laptop. For example, such as... Figure 13 As shown, in this scenario, the process of the mobile phone sending broadcast message 2 to the laptop is as follows:

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

[0147] For example, the mobile phone can obtain a first tag value and a second tag value. The first tag value can be, for example, PREVIOUS_BOND_STATE, to indicate the previous pairing status, and the second tag value can be, for example, BOND_STATE, to indicate the current pairing status, etc., without limitation.

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

[0149] For example, if the previous pairing state between the mobile phone and the laptop was unpaired, the mobile phone can continue to execute the following steps, such as S13; if the previous pairing state between the mobile phone and the laptop was not unpaired, the mobile phone can continue to determine whether the mobile phone meets condition 1. If the mobile phone meets condition 1, the mobile phone generates broadcast information 1 and sends broadcast information 1 to the laptop. If the mobile phone does not meet condition 1, the mobile phone ends the execution of this scheme, that is, it does not generate broadcast information. For an example of whether the mobile phone meets condition 1, please refer to the relevant description in the above embodiments, which will not be repeated here.

[0150] For example, the phone determines whether PREVIOUS_BOND_STATE is equal to BOND_NONE. If PREVIOUS_BOND_STATE is equal to BOND_NONE, the phone can continue to execute the following steps, such as executing S3.

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

[0152] For example, if the current pairing status of the mobile phone and the laptop is "pairing in progress," the mobile phone can continue to execute the following steps, such as S4; if the current pairing status of the mobile phone and the laptop is not "pairing in progress," the mobile phone can 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 ends the execution of this scheme, that is, it does not generate broadcast message. For an example of whether the mobile phone meets condition 1, please refer to the relevant description in the above embodiments, which will not be repeated here.

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

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

[0155] In other words, in the above embodiment, when PREVIOUS_BOND_STATE = BOND_NONE and BOND_STATE = BOND_BONDING, the mobile phone determines that it meets condition 2, that is, the mobile phone is in the scenario of displaying the pairing pop-up window. The mobile phone can generate broadcast information 2 and send broadcast information 2 to the laptop computer.

[0156] In some embodiments, the broadcast information includes a broadcast data packet and a data packet type for the broadcast data packet, the data packet type being used to indicate unpairing Bluetooth pairing; 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, 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, broadcast packets may also include a local timestamp.

[0158] Taking a broadcast data packet that includes: partial bytes of the mobile phone's MAC address, partial bytes of the laptop's MAC address, and a local timestamp as an example, such as... Figure 14 As shown, the process of a mobile phone generating a broadcast message and sending it to a 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 extracts partial bytes of the MAC address of the mobile phone and partial bytes of the MAC address of the laptop computer.

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

[0162] The reason for intercepting a portion of the MAC address of the mobile phone and the laptop in this step is to ensure the security of broadcast information during transmission.

[0163] For example, a portion of the MAC address of a mobile phone can be used to indicate the MAC address of the mobile phone, and a portion of the MAC address of a laptop computer can be used to indicate the MAC address of the laptop computer.

[0164] S23. Obtain the local timestamp on the mobile phone.

[0165] A local timestamp is a numerical value representing a specific point in time, typically measured in milliseconds. Timestamps are used to record the precise time an event occurred. In this embodiment, the local timestamp can be used to mark the broadcast information sent, facilitating information statistics.

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

[0167] For example, 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, local timestamps, etc., to obtain broadcast data packets, and marks the data packet type of the broadcast data packets, 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 to mark and identify the scenario in which the broadcast information is sent to the laptop.

[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 broadcasting information to send broadcast information to a laptop computer. That is, the mobile phone sends broadcast information to the laptop computer at certain intervals. The period can be set according to actual needs, and this embodiment does not limit the specific value of the period. 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, with a timer duration of 5 minutes, the mobile phone stops sending broadcast information to the laptop when the timer duration exceeds 5 minutes.

[0172] In other embodiments, the mobile phone can stop sending broadcast messages to the laptop under abnormal circumstances. For example, it can stop sending broadcast messages to the laptop under abnormal circumstances such as network failure, phone shutdown, phone factory reset, or Bluetooth device failure.

[0173] In some other embodiments, the mobile phone can stop sending broadcast messages to the laptop upon receiving an acknowledgment response from the laptop. The acknowledgment response is used to instruct the laptop to unpair its Bluetooth pairing with the mobile phone.

[0174] Of course, in this embodiment, there are other ways to trigger the mobile phone to stop sending broadcast information to the laptop, which will not be listed here. For example, the mobile phone can also stop sending broadcast information to the laptop while a Bluetooth connection has been established.

[0175] S302: The laptop computer disconnects from the mobile phone via Bluetooth based on the broadcast information.

[0176] For example, unpairing a laptop from a mobile phone via Bluetooth can be understood as the laptop deleting the pairing information from the phone. This pairing information includes the phone's device information and the key negotiated between the phone and laptop during the last pairing.

[0177] S303: After the mobile phone sends a broadcast message 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] For example, after the mobile phone sends a broadcast message to the laptop, the laptop deletes the mobile phone's pairing information. Optionally, if the mobile phone requests the laptop to join its corresponding trust ring, the mobile phone sends a Bluetooth connection request to the laptop.

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

[0180] For example, since the laptop has deleted the phone's pairing information, the phone and laptop successfully establish a Bluetooth connection, meaning the phone and laptop join the same trust loop.

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

[0182] In some embodiments, the mobile phone and the laptop (which can be understood as a third electronic device) establish a Bluetooth pairing relationship. Based on this, when a trigger condition is met, the mobile phone generates broadcast information (which can be understood as third-party broadcast information) and sends the broadcast information to the laptop. The specific implementation process is similar to the embodiments described above, and will not be repeated here.

[0183] Upon receiving the aforementioned broadcast message, if the laptop has not saved the phone's pairing information, it does not need to delete it. In this case, the phone sends a Bluetooth connection request to the laptop. Upon receiving the request, the laptop successfully establishes a Bluetooth connection with the phone because it has not saved the phone's pairing information.

[0184] For example, such as Figure 15 As shown, unpairing a laptop from a mobile phone via Bluetooth can 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 a broadcast message from a mobile phone, the laptop verifies whether the MAC address of the laptop included in the broadcast message is the same as the local MAC address. If the MAC address of the laptop included in the broadcast message is the same as the local MAC address, the laptop continues to perform the following steps (e.g., S31). If the MAC address of the laptop included in the broadcast message is different from the local MAC address, the laptop ignores the broadcast message from the mobile phone.

[0187] Thus, through a pre-executed verification process, if the laptop's MAC address included in the broadcast message differs from the local MAC address, the broadcast message from the phone can be ignored, and the process can be terminated, thereby reducing power consumption. Furthermore, the laptop can also determine whether to process the broadcast message received from the phone to unpair the Bluetooth pairing, preventing the laptop from mistakenly deactivating the Bluetooth pairing.

[0188] In some embodiments, after receiving a broadcast message from a mobile phone, the laptop checks whether a Bluetooth pairing relationship exists between the laptop and the mobile phone. For example, after receiving the broadcast message from the mobile phone, the laptop verifies whether the MAC address of the laptop included in the broadcast message is the same as its local MAC address. If the MAC address of the laptop included in the broadcast message is the same as the local MAC address, the laptop checks whether a Bluetooth pairing relationship exists between the laptop and the mobile phone.

[0189] For example, if the laptop is paired with the phone via Bluetooth, the laptop will unpair the pairing; if the laptop is not paired with the phone via Bluetooth, the laptop will ignore broadcast messages from the phone.

[0190] S31, Laptop computer starts a sub-thread.

[0191] This sub-thread is used by the laptop to check if a Bluetooth pairing relationship exists with the mobile phone.

[0192] In this embodiment, the laptop starts a sub-thread to check 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 the operation time.

[0193] S32. The laptop obtains information about the paired devices on the laptop.

[0194] The device information for paired devices includes their MAC addresses.

[0195] S33. The laptop checks if the phone's MAC address exists in the paired device information.

[0196] For example, the laptop obtains the phone's MAC address from the broadcast information, and then checks the paired device information to see if the phone's MAC address exists, in order to check if there is a Bluetooth pairing relationship between the phone and the device.

[0197] S34. The laptop obtains the device identifier and unpairing token of the mobile phone and unpairs the Bluetooth pairing relationship with the mobile phone.

[0198] In some embodiments, if a Bluetooth pairing relationship exists with a mobile phone, i.e., the MAC address of the mobile phone is present in the paired device information, the laptop will unpair the Bluetooth pairing relationship with the mobile phone. For example, the laptop obtains the mobile phone's device identifier (e.g., device ID) and unpairing token; the laptop uses the unpairing token to initiate a pairing unpairing process (e.g., an executable process), and uses the mobile phone's device identifier to unpair the Bluetooth pairing relationship with the mobile phone. For instance, the mobile phone's device identifier can be entered into the pairing unpairing process to unpair the Bluetooth pairing relationship with the mobile phone.

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

[0200] For example, the laptop obtains the phone's MAC address from the broadcast information and checks if the phone's MAC address exists in the laptop's paired device information. If the paired device information does not include the phone's MAC address, it is determined that the laptop has unpaired the Bluetooth pairing with the phone. If the paired device information includes the phone's MAC address, it is determined that the laptop has not unpaired the Bluetooth pairing with the phone. In this case, the laptop can re-unpair the Bluetooth pairing with the phone, for example, by re-executing the Bluetooth pairing process. Figure 15 The process shown continues until the Bluetooth pairing with the phone is terminated.

[0201] It should be noted that after the laptop is unpaired from the phone via Bluetooth, the above... Figure 6 In the scenario shown, namely the trust loop scenario (or super terminal scenario), the mobile phone and the laptop can directly establish a Bluetooth connection without Bluetooth connection failure or pairing pop-up window issues.

[0202] Furthermore, it should be noted that in the embodiments of this application, steps S30 to S35 can be combined, or one step can be divided into multiple steps; this embodiment of the application does not limit this. Additionally, steps S30 to S35 can be optional, meaning not every step is mandatory. This will be explained uniformly here and will not be repeated below.

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

[0204] The above embodiments have systematically introduced the technical solutions of the embodiments of this application. The following describes in detail the interaction process involved in the embodiments of this application, in conjunction with the software framework of mobile phones and laptops.

[0205] The software systems of mobile phones and laptops can adopt layered architecture, event-driven architecture, microkernel architecture, or cloud architecture. This application uses a layered architecture software system framework as an example to illustrate the software structure of mobile phones and laptops.

[0206] Figure 16 This is a software structure block diagram of a mobile phone and a laptop computer provided in an embodiment of this application. A layered architecture can divide the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the mobile phone's software framework layer includes an application layer, a framework layer, a kernel layer, and a hardware layer, etc., without limitation. Optionally, the mobile phone's software framework layer may also include system libraries (also known as dynamic libraries, shared libraries, etc.); a hardware abstraction layer, etc., without limitation. Figure 16 It is not shown in the text.

[0207] The application layer can include a series of application packages. For example, Figure 16 The application layer shown may include a Bluetooth application (or settings application, device application with options for Bluetooth functionality). The Bluetooth application is used to turn Bluetooth on / off, to unpair Bluetooth connections with paired devices, and to establish Bluetooth pairing relationships (and Bluetooth connections, etc.) with peripheral devices.

[0208] The framework layer provides the application programming interface (API) and programming framework for the application. For example... Figure 16 As shown, the framework layer may include an activity manager service, a basic connectivity module (nearby), a Bluetooth protocol stack, etc., without limitation. The activity manager service can be used to monitor state changes of Bluetooth applications, such as detecting when a Bluetooth application unpairs or establishes a Bluetooth pairing relationship. The basic connectivity module is used to generate broadcast messages to announce that the phone has unpaired its Bluetooth pairing relationship. The Bluetooth protocol stack is used to transmit broadcast messages to the underlying layer (such as the kernel layer).

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

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

[0211] The framework layer can include the Bluetooth protocol stack and the Windows Universal Platform (or Windows system). The Bluetooth protocol stack is used to receive broadcast information transmitted from lower layers (such as the driver layer). The Windows Universal Platform is used to unpair 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 to achieve certain functions through a combination of software and hardware. For example, the driver layer includes a Bluetooth driver, which drives Bluetooth devices in the hardware layer to receive broadcast information sent by other peripheral devices.

[0213] The following embodiments, in conjunction with the aforementioned trust loop scenario (or super terminal scenario), describe the process of unpairing a mobile phone and a laptop computer via Bluetooth. For example, if the mobile phone and laptop computer have established a Bluetooth pairing relationship, and the mobile phone unpairs the laptop computer, the mobile phone generates broadcast information and sends it to the laptop computer when a trigger condition is met. For example, as shown... Figure 16 As shown, the process may include the following steps: Step ①: The phone's Bluetooth application calls back the deletion pairing information to the Activity Manager Service (AMS). This deletion pairing information indicates that the phone has unpaired its Bluetooth pairing with the laptop. Step ②: The phone's Activity Manager Service broadcasts the deletion pairing information to the basic connectivity module. Step ③: When the trigger condition is met, the phone's basic connectivity module generates a broadcast message to instruct the laptop to unpair its Bluetooth pairing with the phone. Step ④: The phone's basic connectivity module transmits the broadcast message to the Bluetooth protocol stack. Step ⑤: The phone's Bluetooth protocol stack transmits the broadcast message to the Bluetooth driver. Step ⑥: The phone's Bluetooth driver schedules the Bluetooth device to send the broadcast message.

[0214] Step 7: The laptop's Bluetooth driver schedules the Bluetooth device to receive 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 token, device method (or device instance), etc., from the Windows Universal Platform. Step 10-1: The laptop's HyperTerminal application unpairs the Bluetooth device from the mobile phone.

[0215] The following embodiments describe the method in detail. For example, as shown... 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 changes in Bluetooth status.

[0217] For example, the phone's activity management service registers a listener with the Bluetooth application, which can be used to monitor the Bluetooth application's status such as unpairing / establishing Bluetooth pairing relationships.

[0218] A2: In response to the phone unpairing from the laptop via Bluetooth, the phone's Bluetooth application sends a callback to the activity management service to delete the pairing information.

[0219] The phone's Bluetooth application can send a callback to the activity management service to delete the pairing information after unpairing the Bluetooth pairing with the laptop. For example, the phone's Bluetooth application might respond to the user's unpairing action by sending a callback to the activity management service to delete the pairing information; or, due to some abnormal reason, the phone's Bluetooth application might delete the Bluetooth pairing with the laptop and then send a callback to the activity management service to delete the pairing information. Deleting the pairing information serves to indicate that the phone has unpaired the Bluetooth pairing with the laptop.

[0220] It should be noted that the examples of the above-mentioned abnormal causes can be found in the relevant descriptions in the above embodiments, and will not be repeated here.

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

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

[0223] A4: The phone's basic connection module determines that the triggering condition is met when the previous pairing state was connected and the current pairing state is disconnected; or when the previous pairing state was disconnected and the current pairing state is connected.

[0224] In other words, when the phone's basic connectivity module receives pairing deletion information, it determines whether the triggering conditions are met. These triggering conditions include: if the previous pairing state was connected and the current pairing state is disconnected; or, if the previous pairing state was disconnected and the current pairing state is connected. In other words, the phone's basic connectivity module determines that the triggering conditions are met if either the previous pairing state was connected and the current pairing state is disconnected, or the previous pairing state was disconnected and the current pairing state is connected.

[0225] When the basic connection module of the mobile phone determines that the triggering conditions are met, it continues to execute the following steps (such as executing A5); when the basic connection module of the mobile phone determines that the triggering conditions are not met, it stops executing this scheme, that is, the process ends.

[0226] A5: The mobile phone's basic connection module encapsulates broadcast data packets based on the laptop's MAC address, partial bytes of the local MAC address, and the local timestamp, and marks the data packet type of the broadcast data packets to generate broadcast information.

[0227] A6: The phone's basic connectivity module transmits broadcast information to the Bluetooth protocol stack.

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

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

[0230] A8: The phone's Bluetooth driver schedules Bluetooth devices to send broadcast information.

[0231] A9: The laptop's Bluetooth device received a broadcast message from the mobile phone.

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

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

[0234] A12: The laptop's Bluetooth protocol stack will send broadcast information back to the HyperTerminal application.

[0235] For example, the HyperTerminal application registers a callback with the Bluetooth protocol stack to receive broadcast information. Correspondingly, after receiving the broadcast information, the laptop's Bluetooth protocol stack sends the broadcast information back to the HyperTerminal application.

[0236] A13: The laptop's HyperTerminal application obtains the laptop's MAC address from the broadcast information and verifies the laptop's MAC address against the local MAC address.

[0237] For the relevant content included in the broadcast information, please refer to the relevant description in the above embodiments, which will not be repeated here.

[0238] For example, if the laptop's MAC address is the same as the local MAC address, the laptop's HyperTerminal application continues to execute the following steps (such as executing A14); if the laptop's MAC address is different from the local MAC address, the laptop's HyperTerminal application ends the process of this scheme.

[0239] A14: Start a sub-thread for the HyperTerminal application on your laptop.

[0240] This sub-thread is used to check if the laptop has a Bluetooth pairing relationship with the phone. This avoids the main thread being blocked for a long time due to time-consuming operations.

[0241] A15: The laptop's HyperTerminal application sends a request to the Windows Universal Platform to obtain information about paired devices.

[0242] The description of the paired device information can be found in the above embodiments, and will not be repeated here.

[0243] A16: The Windows Universal Platform on laptops returns paired device information to the HyperTerminal application.

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

[0245] For example, after obtaining the phone's MAC address from the broadcast information, the laptop's HyperTerminal application queries whether the paired device information includes the phone's MAC address. If the paired device information includes the phone's MAC address, it obtains the phone's device identifier (e.g., device ID) through the phone's MAC address and continues with the following steps (e.g., executing A18). If the paired device information does not include the phone's MAC address, the laptop's HyperTerminal application terminates the process for this solution.

[0246] A18: The HyperTerminal application on the laptop obtains an unpairing token from the Windows Universal Platform.

[0247] The unpairing token is used to initiate a unpairing process (such as an .exe process) to detach the Bluetooth pairing with the phone. For example, when a device starts a process, it needs to request a token from the operating system to launch that process. In Windows operating systems, a token typically refers to a security access token, used to represent the identity and access permissions of a user or process, implementing access control and permission management, and determining the user's or process's access permissions to system resources.

[0248] For example, the pairing unpairing process could be the WinrtBleUnpair.exe process. In this approach, launching the WinrtBleUnpair.exe process to unpair the Bluetooth pairing with the phone avoids errors in the main process that could cause the unpairing process to fail.

[0249] A19: The Windows Universal Platform for laptops assigns unpairing tokens to the HyperTerminal application.

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

[0251] A21: The HyperTerminal application on the laptop initiates a request to the Windows Universal Platform through the device identifier of the mobile phone to request the device identifier instance (or device instance) and calls the preset interface to unpair the Bluetooth pairing relationship with the mobile phone.

[0252] In one example, the laptop's HyperTerminal application can call the first interface provided by the Windows Universal Platform to unpair the Bluetooth pairing with the phone. This first interface can be used to unpair the BR pairing with the phone, but not the BLE pairing. If the phone and laptop are paired via Bluetooth BLE, the HyperTerminal application cannot unpair the Bluetooth pairing by calling the first interface provided by the Windows Universal Platform. This results in the pairing pop-up and pairing failure issues that still occur when the phone and laptop try to establish a BLE connection later.

[0253] For example, the first interface can be a BluetoothRemoveDevice (MacAddress) interface. Of course, the first interface can also be other interface names, as long as it can achieve the functions of the first interface described above, it falls within the protection scope of the embodiments of this application.

[0254] In another example, the laptop's HyperTerminal application can call the second interface provided by the Windows Universal Platform to unpair the Bluetooth pairing with the mobile phone. This second interface can be used to unpair both the Bluetooth BR pairing and the Bluetooth BLE pairing with the mobile phone. For instance, the laptop's HyperTerminal application can call the second interface provided by the Windows Universal Platform to unpair the Bluetooth BR pairing or the Bluetooth BLE pairing with the mobile phone based on the phone's device ID.

[0255] For example, the second interface can be the device.Pairing().UnpairAsync() interface. Of course, the second interface can also be other interface names, as long as it can achieve the function of the second interface described above, it falls within the protection scope of the embodiments of this application.

[0256] A22: The laptop's HyperTerminal application sends a request to the Windows Universal Platform to request information about paired devices.

[0257] A23: The Windows Universal Platform on the laptop returns 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, then the unpairing is confirmed to be successful.

[0259] For example, the laptop's HyperTerminal application obtains the phone's MAC address from the broadcast information and checks if the paired device information includes the phone's MAC address. If the paired device information does not include the phone's MAC address, then the unpairing is successful. If the paired device information includes the phone's MAC address, then the unpairing has failed. The laptop can then re-unpair the Bluetooth pairing with the phone until it succeeds. For example, the laptop can re-execute steps A9-A24 to unpair the Bluetooth pairing with the phone.

[0260] In summary, the solution adopted in this application embodiment can send a broadcast message to the laptop computer to instruct it to delete the Bluetooth pairing relationship with the mobile phone. Subsequently, the laptop computer can delete the Bluetooth pairing relationship with the mobile phone according to the broadcast message. When the mobile phone and the laptop computer re-establish a Bluetooth connection, this can solve the problems of pairing pop-ups, pairing failures, and potential Bluetooth connection failures.

[0261] It should be noted that the contents described in the various embodiments of this application can explain the technical solutions in other embodiments of this application. The technical features described in each embodiment can also be applied in other embodiments and combined with the technical features in other embodiments to form new solutions. This application only provides an exemplary list of several embodiments for illustration and does not mean that this application is limited thereto.

[0262] This application provides an electronic device, which can be the aforementioned mobile phone or laptop computer. The electronic device may include: a 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 performs various functions or steps performed in the aforementioned mobile phone or laptop computer. The structure of the electronic device can be referred to the above. Figure 9 The structure of the mobile phone 100 shown.

[0263] This application also provides a Bluetooth connection system, including a first electronic device and a second electronic device. The first electronic device can be used to perform the various functions or steps performed by the aforementioned mobile phone, and the second electronic device can be used to perform the various functions or steps performed by the aforementioned laptop computer. The structures of the first electronic device and the second electronic device can be referred to the above. Figure 9 The structure of the mobile phone 100 shown.

[0264] This application also provides a chip system, such as... Figure 18 As 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 are interconnected via lines. For example, the interface circuit 1802 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 1802 can be used to send signals to other devices (e.g., the processor 1801). Exemplarily, the interface circuit 1802 can read instructions stored in memory and send those instructions to the processor 1801. When the instructions are executed by the processor 1801, the electronic device can perform the steps described in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in this application embodiment.

[0265] This application also provides a computer storage medium storing computer instructions, which, when executed on an electronic device, cause the electronic device to perform various functions or steps in the above method embodiments.

[0266] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps described in the above method embodiments.

[0267] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the apparatus is running, the processor may execute the computer execution instructions stored in the memory to cause the chip to perform the various functions or steps in the above method embodiments.

[0268] In this embodiment, the chip system, computer-readable storage medium, computer program product or device are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

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

[0270] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

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

[0272] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0273] If the integrated unit is implemented as 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 solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0274] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. A Bluetooth connection method, characterized in that, Applied to a first electronic device, wherein the first electronic device and a second electronic device have established a Bluetooth pairing relationship, the method includes: In response to the first electronic device and the second electronic device unpairing their Bluetooth pairing, the first electronic device deletes the pairing information of the second electronic device and generates a first broadcast message, which is used to instruct the second electronic device to unpair its Bluetooth pairing relationship with the first electronic device. The first electronic device sends the first broadcast information to the second electronic device, wherein, upon receiving the first broadcast information, the second electronic device deletes the pairing information of the first electronic device; 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, upon receiving the Bluetooth connection request, the first electronic device establishes a Bluetooth connection with the second electronic device. The method further includes: If the second electronic device does not receive the first broadcast information After the first electronic device sends a Bluetooth connection request to the second electronic device, it receives a Bluetooth pairing request from the second electronic device. The second electronic device stores the pairing information of the first electronic device. 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, 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 unpair the Bluetooth pairing relationship with the first electronic device.

2. The method according to claim 1, characterized in that, In response to the first electronic device and the second electronic device unpairing their Bluetooth pairing, 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 unpairing their Bluetooth pairing, the first electronic device deletes the pairing information of the second electronic device, determines that the previous pairing state 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.

3. The method according to claim 1, characterized in that, The step of generating a second broadcast message in response to the first electronic device displaying the pairing pop-up includes: In response to the first electronic device displaying the pairing pop-up window, it is determined that the previous pairing state between 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.

4. The method according to any one of claims 1-3, characterized in that, The method further includes the following: The first electronic device and the third electronic device have not established a Bluetooth pairing relationship. 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.

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

6. The method according to claim 5, 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.

7. The method according to any one of claims 1-3 or 6, characterized in that, 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.

8. A Bluetooth connection method, characterized in that, Applied to a second electronic device, which establishes a Bluetooth pairing relationship with a first electronic device, 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 unpairing the Bluetooth pairing with the second electronic device and deleting the pairing information of the second electronic device, and the first broadcast message is used to instruct the second electronic device to unpair the Bluetooth pairing relationship with the first electronic device; If 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, and if the second electronic device receives a Bluetooth connection request from the first electronic device, the second electronic device establishes a Bluetooth connection with the first electronic device. The method further includes: If the second electronic device does not receive the first broadcast information, after the second electronic device receives the Bluetooth connection request sent by the first electronic device, it sends a Bluetooth pairing request to the first electronic device; wherein, the second electronic device stores the pairing information of the first electronic device; The second electronic device receives a second broadcast message; the second broadcast message is generated by the first electronic device in response to the first electronic device displaying a pairing pop-up window; the second broadcast message is used to instruct the second electronic device to unpair the Bluetooth pairing relationship with the first electronic device.

9. The method according to claim 8, 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 with the first electronic device based on the first broadcast information; If the second electronic device determines that the first electronic device has pairing information, the second electronic device deletes the pairing information of 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 determines whether it has pairing information with the first electronic device based on the first broadcast information, including: If the second electronic device receives the first broadcast information, and the MAC address of the first electronic device included in the first broadcast information exists in the paired device information, it is determined that the second electronic device has the pairing information of the first electronic device.

11. The method according to claim 9 or 10, characterized in that, When the second electronic device receives the first broadcast information, the second electronic device determines whether it has pairing information with the first electronic device based on the first broadcast information, 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 with the first electronic device based on the first broadcast information.

12. The method according to claim 9 or 10, characterized in that, The step of deleting the pairing information of the first electronic device from the second electronic device when it is determined that the second electronic device has pairing information with the first electronic device includes: If it is determined that the second electronic device has pairing information with the first electronic device, the device identifier of the first electronic device is obtained through the MAC address of the first electronic device included in the first broadcast information; The second electronic device inputs the device identifier of the first electronic device into the deactivation process and deletes the pairing information of the first electronic device.

13. The method according to claim 9 or 10, characterized in that, When the second electronic device receives the first broadcast information, the second electronic device determines whether it has pairing information with the first electronic device based on the first broadcast information, 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 determines whether the second electronic device has pairing information with the first electronic device based on the first broadcast information.

14. 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 performs the method as described in any one of claims 1-7; or performs the method as described in any one of claims 8-13.

15. A Bluetooth connection system, characterized in that, include: A first electronic device for performing the method as described in any one of claims 1-7, and a second electronic device for performing the method as described in any one of claims 8-13.

16. A chip system, characterized in that, The chip system, used in electronic devices, 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 to cause the electronic device to perform the method as described in any one of claims 1-7; or, to perform the method as described in any one of claims 8-13.

17. A computer storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-7; or, to perform the method as described in any one of claims 8-13.