CN118301581A - Bluetooth device management method and electronic device - Google Patents

Bluetooth device management method and electronic device Download PDF

Info

Publication number
CN118301581A
CN118301581A CN202410725797.5A CN202410725797A CN118301581A CN 118301581 A CN118301581 A CN 118301581A CN 202410725797 A CN202410725797 A CN 202410725797A CN 118301581 A CN118301581 A CN 118301581A
Authority
CN
China
Prior art keywords
bluetooth
equipment
queue
historical
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410725797.5A
Other languages
Chinese (zh)
Inventor
李超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Publication of CN118301581A publication Critical patent/CN118301581A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the application provides a Bluetooth device management method and electronic equipment. The electronic device manages the Bluetooth device through the device queue and the historical device queue, the device identification in the device queue is unique, and the device identification in the historical device queue is repeatable. The electronic device adds the first bluetooth device to the device queue and the historical device queue in response to scanning for the first bluetooth device and the first bluetooth device not being in the device queue. And if the queue length of the added historical equipment queue exceeds the threshold value, deleting the first Bluetooth equipment in the added historical equipment queue. If the Bluetooth device still exists in the deleted historical device queue, the Bluetooth device is not deleted in the added device queue, so that when the electronic device scans the Bluetooth device, the success rate of connecting to the Bluetooth device can be improved; if the Bluetooth device does not exist in the deleted historical device queue, deleting the Bluetooth device in the added device queue to release space.

Description

Bluetooth device management method and electronic device
Technical Field
The embodiment of the application relates to the technical field of electronic equipment, in particular to a Bluetooth equipment management method and electronic equipment.
Background
Bluetooth is a short-range wireless communication technology by which wireless information exchange between devices, such as between an electronic device and a bluetooth device, can be achieved. The precondition for wireless information exchange between the electronic device and the Bluetooth device is that Bluetooth on both the electronic device and the Bluetooth device are turned on and Bluetooth connection is established between the electronic device and the Bluetooth device. The electronic device establishes a bluetooth connection with the bluetooth device based on the bluetooth type of the queried bluetooth device, and if the bluetooth type of the bluetooth device is not queried, connection failure between the electronic device and the bluetooth device may result.
Therefore, how to improve the connection success rate between the electronic device and the bluetooth device is a technical problem to be solved.
Disclosure of Invention
The embodiment of the application provides a Bluetooth device management method and electronic equipment, which are beneficial to improving the connection success rate between the electronic equipment and the Bluetooth device.
In a first aspect, an embodiment of the present application provides a bluetooth device management method, which is applicable to an electronic device including bluetooth. The method may include: responding to the Bluetooth being started and scanning to the first Bluetooth device through the Bluetooth, and inquiring whether the device queue comprises the device identification of the first Bluetooth device; in response to the equipment queue not including the equipment identifier of the first Bluetooth equipment, saving the equipment identifier and the Bluetooth type of the first Bluetooth equipment to the equipment queue to obtain a first equipment queue, and saving the equipment identifier of the first Bluetooth equipment to the historical equipment queue to obtain a first historical equipment queue; deleting the first equipment identifier from the first historical equipment queue to obtain a second historical equipment queue in response to the number of the equipment identifiers in the first historical equipment queue being greater than or equal to a threshold value; responding to the second historical equipment queue to comprise a target equipment identifier, continuously storing the equipment identifier and the Bluetooth type of the target Bluetooth equipment in a first equipment queue, wherein the target equipment identifier is the same as the first equipment identifier in the first historical equipment queue, and the target equipment identifier is used for identifying the target Bluetooth equipment; the device queue comprises at least one device identifier which is arranged according to the sequence of the scanning time and is not repeated, the historical device queue comprises at least one device identifier which is arranged according to the sequence of the scanning time, and the queue length of the device queue is smaller than or equal to that of the historical device queue. That is, the device identification in the device queue is unique and not repeated; the device identification in the historical device queue may be repeatable.
When the number of the device identifiers in the historical device queue is greater than or equal to the threshold, deleting the first device identifier in the historical device queue, and if the deleted historical device queue further comprises the device identifier, reserving the device identifier in the device queue without deleting the device identifier, so that the connection success rate between the electronic device and the Bluetooth device can be improved when the Bluetooth device identified by the device identifier is scanned later.
In some embodiments, in response to the second historical device queue including the target device identification, and the target device identification being the same as the device identification of the first bluetooth device, the device identification and bluetooth type of the first bluetooth device are subsequently stored in the first device queue. That is, in the case where the queue length of the first historical device queue exceeds the threshold value, after the first device identifier in the first historical device queue is deleted, the same device identifier as the first device identifier in the first historical device queue also exists in the second historical device queue, and the device identifier is the device identifier of the first bluetooth device, the device identifier and the bluetooth type of the first bluetooth device are not deleted from the first device queue, so that the success rate of connecting the electronic device to the first bluetooth device can be improved.
With reference to the method provided in the first aspect, in some embodiments, the electronic device further includes a sports health application; under the condition that the first equipment queue comprises equipment identification and Bluetooth type of first Bluetooth equipment, responding to the Bluetooth equipment which is associated with the sports health application by the first Bluetooth equipment, and displaying the equipment identification of the first Bluetooth equipment on an equipment management interface of the sports health application; receiving a connection operation aiming at a first Bluetooth device at a device management interface of the sports health application, and responding to the connection operation, acquiring the Bluetooth type of the first Bluetooth device from a first device queue; and sending a pairing request to the first Bluetooth device based on the Bluetooth type of the first Bluetooth device. Sports health applications associated bluetooth devices such as hand rings, watches, body fat scales, etc. Thereby helping to increase the connection success rate between the electronic device and the bluetooth device associated with the sports health application.
In some embodiments, after the electronic device is connected to the first bluetooth device or after the device management interface of the sports health application displays the device identifier of the first bluetooth device, if a deletion operation for the first bluetooth device is received at the device management interface of the sports health application, the device identifier and the bluetooth type of the first bluetooth device are deleted from the first device queue in response to the deletion operation, so as to release the space.
In some embodiments, in response to the second historical device queue not including the target device identification, the device identification and bluetooth type of the target bluetooth device are deleted from the first device queue to free up space.
In some embodiments, the electronic device includes a bluetooth protocol stack and a bluetooth chip, the bluetooth protocol stack being configured to manage a device queue and a history device queue; the Bluetooth chip is used for scanning the Bluetooth device and acquiring the device identification and the Bluetooth type of the Bluetooth device.
In combination with the method provided in the first aspect, in some embodiments, a clicking operation for a closing identifier of bluetooth is received, and in response to the clicking operation, the bluetooth protocol stack and the bluetooth chip are controlled to be in a working state; invoking a Bluetooth chip to scan Bluetooth equipment in an environment where the electronic equipment is located; responding to the Bluetooth chip scanning to the first Bluetooth device, and calling the Bluetooth chip to acquire the first Bluetooth device, the device identifier and the Bluetooth type; invoking a Bluetooth chip to transmit a first Bluetooth device, a device identifier and a Bluetooth type to a Bluetooth protocol stack; the bluetooth protocol stack is invoked to query whether the device queue includes a first bluetooth device and a device identification and bluetooth type.
In some embodiments, the method provided in connection with the first aspect further comprises invoking a bluetooth protocol stack to store the device identification and bluetooth type of the target bluetooth device in a first device queue.
In a second aspect, an embodiment of the present application provides a bluetooth device management method, which is applicable to an electronic device including bluetooth. The method may include: responding to the Bluetooth being started and scanning to the first Bluetooth device through the Bluetooth, and inquiring whether the device queue comprises the device identification of the first Bluetooth device; responding to the equipment queue not including the equipment identifier of the first Bluetooth equipment, storing the equipment identifier and the Bluetooth type of the first Bluetooth equipment into the equipment queue to obtain the first equipment queue, and inquiring whether the historical equipment queue includes the equipment identifier of the first Bluetooth equipment; in response to the historical equipment queue comprising the equipment identifier of the first Bluetooth equipment, deleting the equipment identifier of the first Bluetooth equipment from the historical equipment queue to obtain a first historical equipment queue, and storing the equipment identifier of the first Bluetooth equipment into the first historical equipment queue to obtain a second historical equipment queue; and deleting the first equipment identifier from the second historical equipment queue to obtain a third historical equipment queue in response to the number of the equipment identifiers in the second historical equipment queue being greater than or equal to a threshold value, deleting the equipment identifier and the Bluetooth type of the first target Bluetooth equipment from the first equipment queue, wherein the equipment identifier of the first target Bluetooth equipment is identical to the first equipment identifier in the second historical equipment queue. The device identification in the device queue is unique and is not repeated; the device identification in the historical device queue is also unique and not repeated.
By implementing the Bluetooth equipment management method provided in the second aspect, repeated equipment identifiers do not exist in the historical equipment queue, so that the probability that the queue length of the historical equipment queue exceeds a threshold value can be reduced to a certain extent, and the connection success rate between the electronic equipment and the Bluetooth equipment can be improved. Even in the event that the queue length of the historical device queue exceeds a threshold, the first device identification in the historical device queue is deleted and the device identification is deleted from the device queue to free up space.
In some embodiments, in response to the historical device queue not including the device identifier of the first bluetooth device, the device identifier of the first bluetooth device is saved to the historical device queue to obtain a fourth historical device queue; and deleting the first device identifier from the fourth historical device queue to obtain a fifth historical device queue and deleting the device identifier and the Bluetooth type of the second target Bluetooth device from the first device queue to release space in response to the number of the device identifiers in the fourth historical device queue being greater than or equal to a threshold value. Wherein the device identification of the second target bluetooth device is the same as the first device identification in the fourth historical device queue.
With reference to the method provided by the second aspect, in some embodiments, the electronic device further comprises a sports health application; under the condition that the first equipment queue comprises equipment identification and Bluetooth type of first Bluetooth equipment, responding to the Bluetooth equipment which is associated with the sports health application by the first Bluetooth equipment, and displaying the equipment identification of the first Bluetooth equipment on an equipment management interface of the sports health application; receiving a connection operation aiming at a first Bluetooth device at a device management interface of the sports health application, and responding to the connection operation, acquiring the Bluetooth type of the first Bluetooth device from a first device queue; and sending a pairing request to the first Bluetooth device based on the Bluetooth type of the first Bluetooth device. Sports health applications associated bluetooth devices such as hand rings, watches, body fat scales, etc. Thereby helping to increase the connection success rate between the electronic device and the bluetooth device associated with the sports health application.
In some embodiments, the method provided in connection with the second aspect, in response to receiving a deletion operation for the first bluetooth device at the device management interface of the sports health application, deletes the device identifier and the bluetooth type of the first bluetooth device from the first device queue, and deletes the device identifier of the first bluetooth device from the second historical device queue, so as to free up space and avoid duplicate device identifiers in the historical device queue.
With reference to the method provided in the second aspect, in some embodiments, the electronic device includes a bluetooth protocol stack and a bluetooth chip, where the bluetooth protocol stack is used to manage a device queue and a history device queue; the Bluetooth chip is used for scanning the Bluetooth device and acquiring the device identification and the Bluetooth type of the Bluetooth device.
In combination with the method provided in the second aspect, in some embodiments, a clicking operation for a closing identifier of bluetooth is received, and in response to the clicking operation, the bluetooth protocol stack and the bluetooth chip are controlled to be in an operating state; invoking a Bluetooth chip to scan Bluetooth equipment in an environment where the electronic equipment is located; responding to the Bluetooth chip scanning to the first Bluetooth device, and calling the Bluetooth chip to acquire the first Bluetooth device, the device identifier and the Bluetooth type; invoking a Bluetooth chip to transmit a first Bluetooth device, a device identifier and a Bluetooth type to a Bluetooth protocol stack; the bluetooth protocol stack is invoked to query whether the device queue includes a first bluetooth device and a device identification and bluetooth type.
In some embodiments, the method provided in the second aspect is further configured to call a bluetooth protocol stack to delete the first device identifier from the second historical device queue, obtain a third historical device queue, and delete the device identifier and the bluetooth type of the first target bluetooth device from the first device queue.
In a third aspect, the present application provides an electronic device comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories being operable to store computer program code comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform a method as described in any of the first aspect and the possible implementations of the first aspect, or to perform a method as described in any of the second aspect and the possible implementations of the second aspect.
In a fourth aspect, the application provides a computer readable storage medium comprising instructions which, when run on an electronic device, cause the electronic device to perform a method as described in any one of the possible implementations of the first aspect and the first aspect, or to perform a method as described in any one of the possible implementations of the second aspect and the second aspect.
In a fifth aspect, the application provides a computer program product comprising instructions which, when run on an electronic device, cause the electronic device to perform a method as described in any one of the possible implementations of the first aspect and the first aspect, or to perform a method as described in any one of the possible implementations of the second aspect and the second aspect.
In a sixth aspect, the application provides a chip system for application to an electronic device, the chip system comprising one or more processors for invoking computer instructions to cause the electronic device to perform the method as described in the first aspect and any possible implementation of the first aspect, or to perform the method as described in the second aspect and any possible implementation of the second aspect.
It will be appreciated that the electronic device provided in the third aspect, the computer storage medium provided in the fourth aspect, the computer program product provided in the fifth aspect, and the chip system provided in the sixth aspect are all configured to perform the method provided in the first aspect or the second aspect of the present application. Therefore, the advantages achieved by the method can be referred to as the advantages of the corresponding method, and will not be described herein.
Drawings
FIGS. 1-3 are exemplary diagrams of user interfaces of several pairing manners involved in sports health applications;
FIG. 4 is an exemplary diagram of several user interfaces involved in a Bluetooth application;
Fig. 5A is a schematic flow chart of the mobile phone first connecting to the bracelet 2 through the sports health application;
Fig. 5B is a schematic flow chart of the mobile phone not first connecting to the bracelet 2 through the sports health application;
FIG. 6 is a software architecture diagram of an electronic device provided by an embodiment of the present application;
fig. 7 is a flowchart of a bluetooth device management method according to an embodiment of the present application;
fig. 8 is a flowchart of another bluetooth device management method according to an embodiment of the present application;
fig. 9 is a hardware configuration diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms "first," "second," "third," and the like in embodiments of the present application are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the terms "comprising," "including," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a series of steps or elements may be included, or alternatively, steps or elements not listed or, alternatively, other steps or elements inherent to such process, method, article, or apparatus may be included. The terms "one embodiment" or "some embodiments" and the like mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in various places are not necessarily all referring to the same embodiment, but mean "one or more, but not all, of the embodiments" unless expressly specified otherwise.
Furthermore, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, and c may represent: a, b, or c, or a and b, or a and c, or b and c, or a, b and c, wherein a, b and c can be single or multiple.
The terminology used in the following embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
1. Electronic device and Bluetooth device
In the embodiment of the application, the electronic device supports bluetooth function, which may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a Personal Digital Assistant (PDA), an augmented reality (augmented reality, AR) device, a Virtual Reality (VR) device, an artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) device, a wearable device, a vehicle-mounted device, an intelligent home device, and/or a smart city device. In the embodiment of the application, the electronic equipment takes a mobile phone as an example.
In the embodiment of the application, the Bluetooth device also supports the Bluetooth function, and can establish Bluetooth connection with the electronic device so as to exchange or transmit wireless information with the electronic device. Bluetooth equipment can be equipment such as bluetooth headset, bracelet, wrist-watch, body fat scale, bluetooth sphygmomanometer, wearable equipment (e.g. bluetooth glasses, VR glasses etc.), vehicle-mounted equipment, bluetooth audio amplifier, intelligent home equipment and/or smart city equipment, thing networking equipment, projecting apparatus, sensor, can also be electronic equipment such as cell-phone, panel computer, PDA. The bluetooth device and the electronic device may be the same type, for example, mobile phones, or may be different, for example, the electronic device is a mobile phone, and the bluetooth device is a watch or a bracelet.
Bluetooth devices associated with different applications on an electronic device vary. For example, a bluetooth application may be associated with various types of bluetooth devices, an audio application may be associated with a bluetooth speaker, a bluetooth headset, and a projector, and an athletic health application may be associated with a wristband, a watch, a jump rope, a spinning, a blood glucose meter, a rowing machine, a blood pressure meter, a treadmill, and a body fat scale.
2. Bluetooth type
The bluetooth type refers to a bluetooth protocol type supported by a bluetooth device. In the bluetooth 4.0 standard, bluetooth protocols can be classified into classical bluetooth (Classic Bluetooth, BT) protocols and bluetooth low energy (Bluetooth Low Energy, BLE) protocols. BT may also be described as Basic Rate (BR), increased data Rate (ENHANCED DATA RATE, EDR), etc., BLE may also be described as Smart Bluetooth (Bluetooth Smart), low power, etc. For example, in the bluetooth 4.0 standard, a comparison of BT and BLE performance can be seen in table 1 below.
TABLE 1
For a device supporting the bluetooth 4.0 standard, the device may be further divided into BT single mode, BLE single mode, BT and BLE dual mode. As the name suggests, BT single mode representation supports BT and not BLE, BLE single mode representation supports BLE and not BT, BT and BLE dual mode representation supports BT and BLE. Typically, electronic devices such as cell phones support both BT and BLE, while some bluetooth devices support BLE single mode for power saving, e.g., sensors; or some bluetooth devices have limited transmission distances to support BT single modes, such as wearable devices, bluetooth speakers, etc. It should be noted that some bluetooth devices may also support dual BT and BLE modes, but support one mode under one operating system. For example, if the operating system of the watch is an Android system, the watch may support BT single mode; if the watch's operating system is an IOS system, the watch may support BLE single mode.
With the development of bluetooth technology, the bluetooth 5.0 standard, which is longer in transmission distance and faster in data rate, has been developed. The bluetooth 5.0 standard has improved performance compared with the bluetooth 4.0 standard, but the basic bluetooth protocol can be divided into a BT protocol and a BLE protocol.
In the embodiment of the application, the Bluetooth types of the Bluetooth equipment can be divided into a BT type and a BLE type, and for the Bluetooth equipment with different Bluetooth types, the electronic equipment calls different Bluetooth connection interfaces. For example, for a BT type bluetooth device, the electronic device invokes the BR connection interface to establish a bluetooth connection with the bluetooth device; for BLE type Bluetooth devices, the electronic device invokes a BLE connection interface to establish a Bluetooth connection with the Bluetooth device.
3. Bluetooth pairing
Bluetooth pairing is an information registration method for connecting bluetooth devices or electronic devices. The connection between the devices is achieved by registering device information between the devices. The device information may include, but is not limited to, device identification, bluetooth type, device type, power information, media access Control (MEDIA ACCESS Control, MAC) address, internet protocol (Internet Protocol, IP) address, etc. The device identifier is used to uniquely identify the device, and may be generated automatically by the device or in response to a character string entered by the user. The bluetooth type may be a BT type or a BLE type. The device type may be a wristwatch, a bracelet, a bluetooth headset, etc. The power information is used for indicating the remaining power of the electronic device or the Bluetooth device.
For example, the electronic device takes a mobile phone as an example, the bluetooth device takes a watch 1 as an example, and assuming that the mobile phone is taken as a master pairing party and the watch 1 is taken as a slave pairing party, for sports health application on the mobile phone, the bluetooth pairing mode between the mobile phone and the watch 1 can be any of the following modes:
(1) Near discovery pairing refers to a short distance between the handset and the watch 1 so that the handset can scan to the watch 1 within its scan range, pairing to establish a bluetooth connection between the handset and the watch 1. For example, the user interfaces related to this pairing method can be referred to the user interfaces shown in fig. 1 (1) to fig. 1 (6). The user interface shown in fig. 1 (1) is a main interface or theme interface on the mobile phone, and the user interface displays a bluetooth icon 103, which indicates that the bluetooth application on the mobile phone is turned on, that is, the bluetooth application is in an operating state. The user interface also displays an icon 101 of the sports health application and a sports health card 102, detects a click operation on the icon 101 or a click operation on the sports health card 102, and in response to the click operation, jumps from the user interface shown in fig. 1 (1) to the user interface of the sports health application, which may include a "health" control, a "sports" control, a "device" control, and a "my" control. A click operation for the "device" control is detected, in response to which a user interface as shown in (2) of fig. 1 may be displayed, in which an "add device" control 104 is displayed, a click operation for the control is detected, in response to which a scanning radar in the user interface as shown in (3) of fig. 1 may be displayed, and a bluetooth device in the environment in which the mobile phone is located may be searched. In response to searching for the wristwatch 1, the user interface shown in fig. 1 (3) also displays an available device column 105, the available device column 105 including device information of the wristwatch 1, such as a device identification and a remaining power, etc. A click operation for the wristwatch 1 is detected, and in response to the click operation, a user interface as shown in fig. 1 (4) may be displayed, which may be used to acquire bluetooth message synchronization service authority, with a skip control and an agreeing control displayed. A click operation for the consent control is detected, in response to which a user interface indicating that the mobile phone is being paired with the wristwatch 1 may be displayed as shown in fig. 1 (5), and a pairing request is sent to the wristwatch 1. Upon receiving the pairing confirm response from the wristwatch 1, a user interface may be displayed as shown in fig. 1 (6), which indicates that the pairing of the mobile phone with the wristwatch 1 is completed and that the connection is successful, so that the mobile phone and the wristwatch 1 can exchange wireless information.
The user interface shown in fig. 1 (1) displays a bluetooth icon 103, and is generated in response to a received click operation for a bluetooth close flag. The Bluetooth closing identifier can be a Bluetooth closing identifier in a control center interface, or can be a Bluetooth closing identifier in a setting interface.
(2) Manually adding pairing refers to pairing based on the type of bluetooth device selected by the user. For example, the user interfaces related to this pairing method can be referred to the user interfaces shown in fig. 2 (1) to fig. 2 (4). After entering the user interface of the sports health application, a click operation for the "device" control is detected, in response to which a user interface as shown in (1) of fig. 1 may be displayed, the user interface displaying an "add device" control 104, in response to which a click operation for the control is detected, a scanning radar in the user interface as shown in (2) of fig. 2 may be displayed, the user interface further displaying a manual add control 106 and a swipe code add control. A click operation for the manual addition control 106 is detected, and in response to the click operation, a user interface as shown in (3) of fig. 2 may be displayed, which may provide various types of bluetooth devices, as well as different product models under the same type of bluetooth device, such as watches or bracelets of different product models, and the like. Assuming that the product model of the wristwatch 1 is product model 1, a click operation for the product model 1 under the wristwatch is detected, and in response to the click operation, a user interface as shown in (4) of fig. 2, which displays configuration prompt information and a start pairing control, may be displayed. And detecting clicking operation aiming at starting pairing control, and responding to the clicking operation, and scanning whether the watch with the product model exists in the environment where the mobile phone is located based on the product model 1 of the watch. In the case where the wristwatch of the product model is scanned, a user interface as shown in fig. 1 (3) may be displayed, the user interface displaying an available device column 105, the available device column 105 including scanned device information of the wristwatch of the product model, for example, device information of the wristwatch 1. A click operation for the wristwatch 1 is detected, and in response to the click operation, a user interface as shown in fig. 1 (4) may be displayed, which may be used to acquire bluetooth message synchronization service authority, with a skip control and an agreeing control displayed. A click operation for the consent control is detected, in response to which a user interface indicating that the mobile phone is being paired with the wristwatch 1 may be displayed as shown in fig. 1 (5), and a pairing request is sent to the wristwatch 1. Upon receiving the pairing confirm response from the wristwatch 1, a user interface may be displayed as shown in fig. 1 (6), which indicates that the pairing of the mobile phone with the wristwatch 1 is completed and that the connection is successful, so that the mobile phone and the wristwatch 1 can exchange wireless information.
(3) The code scanning pairing means that the mobile phone performs Bluetooth pairing with the watch 1 through the two-dimension code scanning the watch 1. For example, the user interfaces related to this pairing method can be referred to the user interfaces shown in fig. 3 (1) to 3 (3). After entering the user interface of the sports health application, a click operation for the "device" control is detected, in response to which a user interface as shown in fig. 1 (1) may be displayed, the user interface displaying an "add device" control 104, in response to which a click operation for the control is detected, a scanning radar in the user interface as shown in fig. 3 (1) may be displayed, and in response to which a manual add control and a sweep code add control 107 are also displayed. A click operation for the scan code addition control 107 is detected, and in response to the click operation, a user interface as shown in (2) of fig. 3 may be displayed, which includes a scan code box 108 for scanning a two-dimensional code displayed by the bluetooth device, for example, a two-dimensional code displayed on a wristwatch. In response to sweeping to the two-dimensional code displayed on the wristwatch 1, the MAC address of the wristwatch 1 is acquired based on the two-dimensional code, the wristwatch 1 is scanned to acquire device information of the wristwatch 1, and the device information of the wristwatch 1 is displayed in the available device column 105 in the user interface shown in fig. 3 (3). A click operation for the wristwatch 1 is detected, and in response to the click operation, a user interface as shown in fig. 1 (4) may be displayed, which may be used to acquire bluetooth message synchronization service authority, with a skip control and an agreeing control displayed. A click operation for the consent control is detected, in response to which a user interface indicating that the mobile phone is being paired with the wristwatch 1 may be displayed as shown in fig. 1 (5), and a pairing request is sent to the wristwatch 1. Upon receiving the pairing confirm response from the wristwatch 1, a user interface may be displayed as shown in fig. 1 (6), which indicates that the pairing of the mobile phone with the wristwatch 1 is completed and that the connection is successful, so that the mobile phone and the wristwatch 1 can exchange wireless information.
For the bluetooth application of the electronic device, the bluetooth application may scan for bluetooth devices in an environment where the electronic device is located, and may further be paired with the scanned bluetooth devices. For example, see user interfaces shown in fig. 4 (1) to 4 (4). The user interface shown in fig. 4 (1) is a main interface or theme interface on the mobile phone, and the user interface displays a bluetooth icon 201, which indicates that the bluetooth application on the mobile phone is turned on, that is, the bluetooth application is in an operating state. The user interface also displays an icon 202 for setting an application, detects a click operation on the icon 202, and in response to the click operation, can jump from the user interface shown in fig. 4 (1) to the user interface for setting (as shown in fig. 4 (2)), which can include a plurality of options such as bluetooth, personal hot spot, mobile network, more connections, display and brightness, storage, etc., wherein the state of bluetooth is on. Upon detecting a click operation for bluetooth, a user interface may be displayed as shown in (3) of fig. 4, which includes a paired device list indicating bluetooth devices paired with the mobile phone and an available device list indicating scanned bluetooth devices that are not paired with the mobile phone or paired but deleted from pairing relationship with the mobile phone. Assuming that the available device list includes bluetooth device a and bluetooth device b, a click operation for bluetooth device a is detected, and in response to the click operation, a user interface as shown in (4) of fig. 4 may be displayed, the user interface including a dialog box 203 for prompting whether to pair with bluetooth device a, including a cancel control and a pair control. A click operation for the pairing control is detected, and a pairing request is sent to the Bluetooth device a in response to the click operation. And receiving a pairing confirmation response from the Bluetooth equipment a, wherein the pairing completion of the mobile phone and the Bluetooth equipment a is indicated, and the connection is successful, so that the mobile phone and the Bluetooth equipment a can exchange wireless information. And after the mobile phone is paired with the Bluetooth device a, adding the Bluetooth device a to the paired device list, and deleting the Bluetooth device a from the available device list.
In response to the bluetooth on the electronic device being turned on, the electronic device initiates a scan, after scanning for a certain bluetooth device, if device information of the bluetooth device does not exist in the device list, the device information of the bluetooth device may be saved in the device queue, and a device identifier of the bluetooth device may be saved in the history device queue. Wherein the device identification stored by the device queue is unique and the device identification stored by the history device queue is repeatable. After the number of the device identifications stored in the history device queue is greater than the threshold, if the first device identification in the history device queue, that is, the device identification stored in the history device queue earliest, is not paired with the electronic device, the device identification of the bluetooth device is deleted from the history device queue, and meanwhile, the device information of the bluetooth device is deleted from the device list.
For example, taking an exercise health application as an example, a schematic flow chart of the mobile phone first connecting to the bracelet 2 through the exercise health application may be shown in fig. 5A, and the flow chart may include the following steps:
1, a scanning operation is detected at a user interface of the sports health application.
Wherein the scanning operation may be a click operation of the "add device" control 104 for the user interface shown in fig. 1 (2); or may be a click operation of the manual add control 106 for the user interface shown in fig. 2 (2); or may be a click operation of the swipe add control 107 for the user interface shown in fig. 3 (1).
And 2, the sports health application responds to the scanning operation and sends a first scanning instruction to the Bluetooth protocol stack.
And 3, the Bluetooth protocol stack sends a second scanning instruction to the Bluetooth chip so as to drive the Bluetooth chip to scan Bluetooth equipment in the environment where the mobile phone is located.
4, The Bluetooth chip scans to the Bluetooth device 1.
And 5, the Bluetooth chip feeds back the device information of the Bluetooth device 1 to the Bluetooth protocol stack in response to scanning the Bluetooth device 1.
The device information may include, but is not limited to, one or more of device identification, bluetooth type, remaining power, etc.
And 6, updating the device queue and the historical device queue by the Bluetooth protocol stack based on the device information of the Bluetooth device 1.
The bluetooth protocol stack detects whether a device identification of the bluetooth device 1 exists in the device queue in response to the device information of the bluetooth device 1. In response to the absence of the device identification of the bluetooth device 1 in the device queue, the bluetooth protocol stack saves the device information of the bluetooth device 1 to the device queue and saves the device identification of the bluetooth device 1 to the historical device queue. Assuming that neither the device queue nor the history device queue holds any device identifications until the bluetooth device 1 is scanned, the device queue and the history device queue may be as shown in table 1.1 below, taking as an example the device identifications are held.
TABLE 1.1
Optionally, in response to the device identifier of the bluetooth device 1 existing in the device queue, the bluetooth protocol stack does not update the device queue, nor does the bluetooth protocol stack update the historical device queue simultaneously.
7, The Bluetooth chip scans the bracelet 2.
And 8, the Bluetooth chip feeds back the device information of the bracelet 2 to the Bluetooth protocol stack in response to scanning the bracelet 2.
And 9, updating the equipment queue and the historical equipment queue by the Bluetooth protocol stack based on the equipment information of the bracelet 2.
The Bluetooth protocol stack responds to the device information of the bracelet 2 to detect whether the device identification of the bracelet 2 exists in the device queue. And in response to the fact that the equipment identification of the bracelet 2 does not exist in the equipment queue, saving the equipment information of the bracelet 2 to the equipment queue, and saving the equipment identification of the bracelet 2 to the historical equipment queue. The bluetooth protocol stack may be updated to table 1.1 to obtain table 1.2 as follows.
TABLE 1.2
Table 1.2 is given as an example of the first device identifier of the queue as the earliest stored device identifier, and table 1.1 may be updated to obtain table 1.3 as follows. The embodiment of the application takes the first device identifier of the queue as the earliest saved device identifier as an example.
TABLE 1.3
Optionally, in response to the device identifier of the bracelet 2 existing in the device queue, the bluetooth protocol stack does not update the device queue, nor does it update the historical device queue simultaneously.
The bluetooth protocol stack sends a display instruction to the sports health application.
And responding to the Bluetooth protocol stack to judge that the bracelet 2 is Bluetooth equipment associated with the sports health application based on the equipment information of the bracelet 2, and sending a display instruction to the sports health application so that an equipment management interface of the sports health application can display the bracelet 2. The device management interface may be the user interface shown in fig. 1 (3), where the user interface displays an available device bar 105 for displaying scanned bluetooth devices associated with the sports health application. Since the bluetooth device 1 is not a bluetooth device associated with the sports health application, the bluetooth protocol stack will not send a display instruction to the sports health application when receiving the device information of the bluetooth device 1.
The execution sequence of step 10 and step 9 is not limited, and step 10 and step 9 may be executed simultaneously, or step 9 may be executed first and then step 10 may be executed, or step 10 may be executed first and then step 9 may be executed.
The sports health application displays the wristband 2 on the device management interface in response to the display instruction 11.
When the device management interface of the sports health application displays the bracelet 2, the device identifier of the bracelet 2 can be displayed, and other device information of the bracelet 2, such as the device form, the residual electric quantity and the like, can be displayed.
The sports health application receives 12 a connection operation for the hand ring 2.
For the connection operation of the bracelet 2, the usable device bar 105 in the user interface shown in (3) of fig. 1 may display the bracelet 2, and for the click operation of the bracelet 2; the clicking operation for the product model corresponding to the bracelet 2 in the user interface shown in fig. 2 (3) and the clicking operation for the start pairing control in the user interface shown in fig. 2 (4) may also be performed; it is also possible that the available device bar 105 in the user interface shown in fig. 3 (3) displays the bracelet 2 for a click operation of the bracelet 2.
13, The sports health application sends a bluetooth type inquiry instruction to the bluetooth protocol stack.
The sports health application transmits a bluetooth type inquiry instruction to the bluetooth protocol stack in response to the connection operation to inquire the bluetooth type of the bracelet 2. The device queue stores device information of each Bluetooth device, wherein the device information comprises a Bluetooth type, and the Bluetooth type is a BT type or a BLE type.
14, The bluetooth protocol stack inquires the bluetooth type of the bracelet 2 in response to the bluetooth type inquiry instruction.
The Bluetooth protocol stack responds to the Bluetooth type inquiry instruction to inquire the Bluetooth type of the bracelet 2 in the device queue.
15, The bluetooth protocol stack feeds back the bluetooth type of the bracelet 2 to the sports health application.
Wherein, it is assumed that the bluetooth type of the bracelet 2 is BLE type.
The sports health application sends a connection instruction based on the BLE connection interface to the bluetooth protocol stack 16.
And 17, the Bluetooth protocol stack sends a connection instruction to the Bluetooth chip, wherein the connection instruction is also based on the BLE connection interface.
The bluetooth chip sends a pairing request to the bracelet 2 based on the BLE connection interface.
And 18, the Bluetooth chip sends a connection success response to the Bluetooth protocol stack.
And the Bluetooth chip sends a connection success response to the Bluetooth protocol stack under the condition of receiving the pairing confirmation response from the bracelet 2, so that the mobile phone can exchange wireless information with the bracelet 2 through the sports health application.
19, The sports health application detects a delete operation for the bracelet 2.
The deletion operation for the bracelet 2 may be a deletion operation for the bracelet 2 when the bracelet 2 is displayed on the device management interface. Or in response to the clicking operation of the setting control corresponding to the bracelet 2 in the paired device list in the user interface shown in (3) of fig. 4, displaying the setting interface corresponding to the bracelet 2, wherein the setting interface comprises a unpaired control, and the deleting operation of the bracelet 2 can be the clicking operation of the unpaired control.
And 20, the sports health application responds to the deleting operation and sends a deleting instruction to the Bluetooth protocol stack.
The bluetooth protocol stack updates the device queue in response to the delete instruction 21.
The Bluetooth protocol stack responds to the deleting instruction to delete the device information of the bracelet 2 from the device queue, and the historical device queue is not updated. The bluetooth protocol stack may update table 1.2 to obtain table 1.4 as follows.
TABLE 1.4
A schematic flow chart of the mobile phone through the sports health application for not first connecting the bracelet 2 may be shown with reference to fig. 5B, and the flow may include the following steps:
A scanning operation is detected 31 at the user interface of the sports health application.
The sports health application sends a third scan instruction to the bluetooth protocol stack in response to the scan operation 32.
33, The bluetooth protocol stack sends a fourth scanning instruction to the bluetooth chip to drive the bluetooth chip to scan bluetooth devices in the environment where the mobile phone is located.
34, The bluetooth chip scans to bluetooth device x.
The bluetooth chip feeds back device information of the bluetooth device x to the bluetooth protocol stack in response to scanning the bluetooth device x.
The bluetooth protocol stack updates the device queue and the history device queue based on the device information of bluetooth device x 36.
The bluetooth protocol stack updates the table after the device queue and the history device queue based on the device information of the bluetooth device x, which may be shown in table 2.1.
TABLE 2.1
37, The bluetooth chip scans the bracelet 2.
The bluetooth chip feeds back device information of the bracelet 2 to the bluetooth protocol stack in response to scanning the bracelet 2.
39, The bluetooth protocol stack updates the device queue and the history device queue based on the device information of the wristband 2.
Since the bluetooth protocol stack in fig. 5A deletes the device information of the bracelet 2 from the device queue, the device information of the bracelet 2 does not exist in the device queue, so in step 39, the bluetooth protocol stack saves the device information of the bracelet 2 to the device queue and synchronously saves the device identifier of the bracelet 2 to the history device queue. The bluetooth protocol stack may update table 2.1 to obtain table 2.2 as follows.
TABLE 2.2
The bluetooth protocol stack deletes the first device identification in the history device queue in response to the history device queue being full 40.
The historical device queue is full, that is, the number of device identifications held by the historical device queue is greater than or equal to a threshold set by the handset manufacturer. The first device identifier in the history device queue is deleted, i.e. the device identifier that was first stored in the history device queue is deleted. If the Bluetooth device identified by the device identification is not paired with the mobile phone, the Bluetooth protocol stack will synchronize to delete the device information of the Bluetooth device in the device queue. The bluetooth protocol stack may update table 2.2 to obtain table 2.3 as follows.
TABLE 2.3
The bluetooth protocol stack sends a display instruction to the sports health application 41.
42, The sports health application displays the wristband 2 on the device management interface in response to the display instruction.
43, The bluetooth chip scans to bluetooth device y.
The bluetooth chip feeds back device information of the bluetooth device y to the bluetooth protocol stack in response to scanning for the bluetooth device y.
45, The Bluetooth protocol stack updates the equipment queue and the historical equipment queue based on the equipment information of the Bluetooth equipment y, the historical equipment queue is full, and the first equipment identifier in the historical equipment queue is deleted.
After deleting the bluetooth device 1, the bluetooth protocol stack obtains the device information of the bluetooth device y again, and after saving the device identifier of the bluetooth device y in the history device queue, the history device queue is full, so that the first device identifier in the history device queue needs to be deleted, and at this time, the device identifier is the device identifier of the bracelet 2. However, since the history device queue may be stored repeatedly, there may be a device identifier of the bracelet 2 in the history device queue. Since the bracelet 2 is not paired with the handset at this time, the device information of the bracelet 2 is deleted from the device queue.
The bluetooth protocol stack may update table 2.3 to obtain table 2.4 as follows.
TABLE 2.4
46, The sports health application receives a connection operation for the hand ring 2.
47, The sports health application sends a bluetooth type inquiry instruction to the bluetooth protocol stack.
48, The bluetooth protocol stack queries the bluetooth type of the bracelet 2 in response to the bluetooth type query instruction.
49, The bluetooth protocol stack feeds back to the sports health application the bluetooth type of the bracelet 2 that was not queried.
The Bluetooth protocol stack responds to the Bluetooth type inquiring instruction to inquire the Bluetooth type of the bracelet 2 in the device queue, and the Bluetooth type of the bracelet 2 which is not inquired is fed back to the sports health application because the device information of the bracelet 2 does not exist in the device queue.
50, The sports health application sends a connection instruction based on the BR connection interface to the Bluetooth protocol stack.
Since the sports health application does not inquire about the bluetooth type of the bracelet 2, the BR connection interface is used by default and a connection instruction based on the BR connection interface is transmitted to the bluetooth protocol stack.
51, The bluetooth protocol stack sends a connection instruction to the bluetooth chip, which is also based on the BR connection interface.
And 52, the Bluetooth chip sends a connection failure response to the Bluetooth protocol stack.
Because the BR connection interface is not matched with the Bluetooth type of the bracelet 2, the Bluetooth chip cannot send a pairing request to the bracelet 2 through the BR connection interface, and even if the pairing request can be sent successfully, the bracelet 2 cannot feed back a pairing confirmation response to the mobile phone or the bracelet 2 feeds back a pairing failure response to the mobile phone. Therefore, the Bluetooth chip sends a connection failure response to the Bluetooth protocol stack under the condition that the pairing confirmation response is not received. Thereby causing the handset to be unable to successfully pair with the bracelet 2 through the sports health application and the handset to fail to connect with the bracelet 2.
As can be seen from fig. 5B, when the history device queue is full and the first device identifier is deleted from the history device queue, the device information of the bluetooth device to be connected may be deleted from the device queue synchronously, thereby causing connection failure with the bluetooth device.
In view of this, the embodiment of the application provides a Bluetooth device management method and an electronic device. The method can be applied to the electronic equipment with the Bluetooth function, the electronic equipment can be also provided with sports health applications, and the electronic equipment can be a mobile phone, a tablet personal computer and the like.
By implementing the Bluetooth device management method provided by the embodiment of the application, under the condition that the first device identifier in the history device queue is required to be deleted when the history device queue is full, the connection between the electronic device and the Bluetooth device to be connected is not affected, and the connection success rate between the electronic device and the Bluetooth device is improved.
The following describes a specific process of implementing the bluetooth device management device method by the electronic device.
First, fig. 6 exemplarily shows a software architecture of the electronic device 100.
The software system of the electronic device 100 may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. In the embodiment of the application, taking an Android system with a layered architecture as an example, a software structure of the electronic device 100 is illustrated.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into five layers, from top to bottom, an application layer, an application Framework layer, an Zhuoyun lines (Android runtime) and system libraries, a hardware abstraction layer (Hardware Abstraction Layer, HAL), and a kernel layer, respectively.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include applications such as cameras, gallery, bluetooth, sports health applications, and the like. The exercise health application can provide exercise health management for the user, and can acquire exercise health data from the Bluetooth device through the associated Bluetooth device, for example, the associated Bluetooth device is a bracelet or a watch, and the exercise health application can acquire health data such as heart rate, step number and the like from the bracelet or the watch.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for the application of the application layer. The application framework layer includes a number of predefined functions. As shown in fig. 2, the application framework layer may include a window manager, a phone manager, a content provider, a notification manager, a resource manager, a bluetooth manager, and the like.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like. The telephony manager is used to provide the communication functions of the electronic device 100. Such as the management of call status (including on, hung-up, etc.). The content provider is used to provide various display contents. The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc. The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like. The Bluetooth manager is used for managing Bluetooth and calling a Bluetooth protocol stack to drive the Bluetooth chip to operate.
The system library may also be referred to as a local C/C++ library. The system library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android. The system library may include a plurality of functional modules. For example: bluetooth protocol stacks, media Libraries (Media Libraries), etc. In embodiments of the present application, the Bluetooth protocol stack may be used to manage and maintain device queues and historical device queues. Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
A Hardware Abstraction Layer (HAL) provides a standard interface that can be used to control the actions of the hardware. The HAL comprises a plurality of library modules, each implementing a set of interfaces for a particular type of hardware component, such as a bluetooth module, an audio module, etc.
The kernel layer is the basis of the android system, such as thread and low-level memory management. The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, a Bluetooth driver, an audio driver, a sensor driver and the like. In an embodiment of the present application, the bluetooth driver may drive the bluetooth chip such that the bluetooth chip scans for bluetooth devices in the environment in which the electronic device 100 is located.
In the embodiment of the present application, the user interface shown in fig. 1 (1) displays a bluetooth icon 103, which indicates that the bluetooth protocol stack and the bluetooth chip are in a working state. The electronic device receives a clicking operation aiming at the Bluetooth closing identification, and can respond to the clicking operation to control the Bluetooth protocol stack and the Bluetooth chip to be in a working state, so that the Bluetooth is started and Bluetooth devices in the surrounding environment can be scanned. For example, in response to the clicking operation, a bluetooth scanning interface in the application framework layer is invoked to control the bluetooth protocol stack and the bluetooth chip to be in an operating state so that the bluetooth chip can scan bluetooth devices in the surrounding environment.
In conjunction with the user interfaces shown in fig. 1-4 and the software architecture of the electronic device 100 shown in fig. 6, the following description will specifically describe the flow of implementing the bluetooth device management method by the electronic device 100.
Fig. 7 is a schematic flow chart of a bluetooth device management method according to an embodiment of the present application, which may include, but is not limited to, the following steps:
s701, a scanning operation is detected at a user interface of the sports health application.
Wherein the scanning operation may be a click operation of the "add device" control 104 for the user interface shown in fig. 1 (2); or may be a click operation of the manual add control 106 for the user interface shown in fig. 2 (2); or may be a click operation of the swipe add control 107 for the user interface shown in fig. 3 (1).
S702, the motion health application responds to the scanning operation and sends a scanning instruction to the Bluetooth protocol stack.
The sports health application responds to the scanning operation and sends a scanning instruction to a Bluetooth protocol stack in the system library through a Bluetooth scanning interface of the application program framework layer. The application framework layer includes a bluetooth manager that can provide a bluetooth scan interface.
S703, the Bluetooth protocol stack sends a scanning instruction to the Bluetooth chip.
The bluetooth protocol stack, in response to a scan instruction from the bluetooth scan interface, sends the scan instruction to the bluetooth chip, which may include: the Bluetooth protocol stack calls a Bluetooth module in the hardware abstraction layer to send a driving instruction to a Bluetooth driver, and the Bluetooth driver responds to the driving instruction to drive the Bluetooth chip to work so that the Bluetooth chip scans Bluetooth equipment in an environment where the electronic equipment is located.
S704, the bluetooth chip scans to the first bluetooth device.
The Bluetooth chip scans Bluetooth equipment in an environment where the electronic equipment is located, scans the Bluetooth equipment to obtain equipment information of the first Bluetooth equipment, wherein the equipment information at least comprises equipment identification and Bluetooth type, and optionally also comprises information such as residual electric quantity.
And S705, the Bluetooth chip transmits the device information of the first Bluetooth device to the Bluetooth protocol stack in response to scanning the first Bluetooth device.
The bluetooth chip may send device information of the first bluetooth device directly to the bluetooth protocol stack in response to scanning the first bluetooth device. Optionally, the bluetooth chip may send, sequentially through the bluetooth driver and the bluetooth module, device information of the first bluetooth device to the bluetooth protocol stack.
S706, the Bluetooth protocol stack updates the device queue to obtain a first device queue and updates the historical device queue to obtain a first historical device queue in response to the device queue not including the device identifier of the first Bluetooth device.
The Bluetooth protocol stack receives the equipment identification of the first Bluetooth equipment, judges whether the equipment identification of the first Bluetooth equipment exists in the equipment queue, if so, does not execute the subsequent steps, and if not, updates the equipment queue to obtain the first equipment queue, and synchronously updates the historical equipment queue to obtain the first historical equipment queue. Updating the device queue to obtain a first device queue, namely saving the device information of the first Bluetooth device into the device queue to obtain the first device queue, wherein the first device queue can comprise the device information of the first Bluetooth device, and the device information at least comprises a device identifier and a Bluetooth type. Updating the historical equipment queue to obtain a first historical equipment queue, namely saving the equipment identifier of the first Bluetooth equipment to the historical equipment queue to obtain the first historical equipment queue, wherein the first historical equipment queue can comprise the equipment identifier of the first Bluetooth equipment. Illustratively, the first device queue and the first historic device queue may be as shown in Table 3.1 below.
TABLE 3.1
And S707, the Bluetooth protocol stack responds to the fact that the first historical equipment queue is full, and deletes the first equipment identifier in the first historical equipment queue to obtain a second historical equipment queue.
The Bluetooth protocol stack detects whether the number of the device identifiers in the first historical device queue is larger than or equal to a threshold value, if not, the first device identifier in the first historical device queue is deleted (namely, the device identifier stored in the historical device queue at the earliest) if not, and a second historical device queue is obtained. Illustratively, based on the first historical device queue shown in table 3.1, deleting the second historical device queue after the first device identification may be as shown in table 3.2 below.
TABLE 3.2
And S708, the Bluetooth protocol stack responds to the second historical equipment queue comprising the target equipment identification, and continuously stores the equipment information of the target Bluetooth equipment in the first equipment queue.
The target device identifier is the same as the first device identifier in the first historical device queue, and is used for identifying the target Bluetooth device. Illustratively, based on table 3.1, the first device in the first historical device queue is identified as watch 1, and then the bluetooth protocol stack further determines whether watch 1 is still present in the second historical device queue, and if watch 1 is still present, then device information of watch 1 is continuously stored in the first device queue. Regardless of whether the wristwatch 1 is paired with the electronic device at this time, the device information of the wristwatch 1 is still stored in the first device queue, and is not deleted from the first device queue, so that when a connection operation for the wristwatch 1 is received on the sports health application, the electronic device can learn the bluetooth type of the wristwatch 1 from the first device queue in response to the connection operation, and further can establish a bluetooth connection with the wristwatch 1 based on the bluetooth type of the wristwatch 1.
If the target device identifier is the same as the device identifier of the first bluetooth device, and the second history device queue includes the target device identifier, that is, the first device identifier in the first history device queue is the device identifier of the first bluetooth device, and the second history device queue further includes the device identifier of the first bluetooth device, the device information of the first bluetooth device is continuously stored in the first device queue, and the device information of the first bluetooth device is not deleted from the first device queue because the first history device queue is full. So that the bluetooth connection between the electronic device and the first bluetooth device is not affected.
If the second historical device queue does not include the target device identification, the Bluetooth protocol stack may delete the device information of the target Bluetooth device from the first device queue.
Optionally, in S709, the bluetooth protocol stack sends a display instruction to the sports health application in response to the first bluetooth device being a bluetooth device associated with the sports health application.
If the first Bluetooth device is a Bluetooth device associated with the athletic health application, the Bluetooth protocol stack may send a display instruction to the athletic health application to display the first Bluetooth device on a device management interface of the athletic health application.
Step S709 and step S706 to step S708 may be performed simultaneously, or step S709 may be performed first and then step S706 to step S708 may be performed, or step S706 to step S708 may be performed first and then step S709 may be performed.
Optionally, S710, the sports health application displays the first bluetooth device on the device management interface in response to the display instruction.
Optionally, S711, the sports health application receives a connection operation for the first bluetooth device.
Optionally, S712, the sports health application sends a bluetooth type query instruction to the bluetooth protocol stack.
Optionally, in S713, the bluetooth protocol stack queries the bluetooth type of the first bluetooth device based on the first device queue in response to the bluetooth type query instruction.
If the target device identifier is the same as the device identifier of the first bluetooth device, and the second historical device queue includes the target device identifier, the device information of the first bluetooth device is still stored in the first device queue, so that the bluetooth protocol stack can find the bluetooth type of the first bluetooth device from the first device queue.
Optionally, S714, the bluetooth protocol stack feeds back the bluetooth type of the first bluetooth device to the sports health application.
Optionally, S715, the sports health application sends a connection instruction to the bluetooth protocol stack.
Optionally, S716, the bluetooth protocol stack sends a connection instruction to the bluetooth chip.
Optionally, S717, the bluetooth chip sends a connection success response to the bluetooth protocol stack.
The implementation process of step S710 to step S717 can be referred to in the specific description of step 11 to step 18 in fig. 5A, and will not be described here again. Optionally, after step S717, a pairing deletion procedure for the first bluetooth device may be further performed, for example, a deletion operation for the first bluetooth device is received at the device management interface of the sports health application, and in response to the deletion operation, the bluetooth protocol stack deletes the device information of the first bluetooth device from the first device queue, while the device management device interface of the sports health application does not display the first bluetooth device.
In the embodiment shown in fig. 7, when the number of device identifiers in the historical device queue is greater than or equal to the threshold, deleting the first device identifier in the historical device queue, and if the deleted historical device queue further includes the device identifier, retaining the device identifier in the device queue without deleting the device identifier, so that when the bluetooth device identified by the device identifier is scanned later, the connection success rate between the electronic device and the bluetooth device can be improved.
Fig. 8 is a schematic flow chart of another bluetooth device management method according to an embodiment of the present application, which may include, but is not limited to, the following steps:
S801, a scanning operation is detected at a user interface of the sports health application.
S802, the motion health application responds to the scanning operation and sends a scanning instruction to the Bluetooth protocol stack.
S803, the Bluetooth protocol stack sends a scanning instruction to the Bluetooth chip.
S804, the Bluetooth chip scans to the first Bluetooth device.
S805, the Bluetooth chip sends device information of the first Bluetooth device to the Bluetooth protocol stack in response to scanning the first Bluetooth device.
The implementation process of step S801 to step S805 may refer to the specific description of step S701 to step S705 in the embodiment shown in fig. 7, and will not be described herein.
And S806, the Bluetooth protocol stack updates the device queue to obtain a first device queue in response to the device queue not including the device identification of the first Bluetooth device.
The Bluetooth protocol stack receives the equipment identification of the first Bluetooth equipment, judges whether the equipment identification of the first Bluetooth equipment exists in the equipment queue, does not execute the subsequent steps if the equipment identification exists, and updates the equipment queue to obtain the first equipment queue if the equipment identification does not exist. Updating the device queue to obtain a first device queue, namely saving the device information of the first Bluetooth device into the device queue to obtain the first device queue, wherein the first device queue can comprise the device information of the first Bluetooth device, and the device information at least comprises a device identifier and a Bluetooth type.
S807, the Bluetooth protocol stack responds to the historical equipment queue including the equipment identification of the first Bluetooth equipment, and deletes the equipment identification of the first Bluetooth equipment to obtain a first historical equipment queue.
After updating the equipment queue, the Bluetooth protocol stack judges whether the equipment identifier of the first Bluetooth equipment exists in the historical equipment queue, and if so, the equipment identifier of the first Bluetooth equipment is deleted from the historical equipment queue to obtain the first historical equipment queue, so that the historical equipment queue cannot store repeated equipment identifiers. If not, the device identification of the first Bluetooth device is saved to a historical device queue.
S808, the Bluetooth protocol stack stores the device identification of the first Bluetooth device into a first historical device queue to obtain a second historical device queue.
Since the device identifier of the first bluetooth device is deleted from the history device queue in S807, step S808 saves the device identifier of the first bluetooth device to the first history device queue, resulting in a second history device queue. The second historic device queue only includes the device identification of the first bluetooth device and may not include duplicate device identifications as in table 2.2.
S809, the Bluetooth protocol stack responds to the fact that the second historical equipment queue is full, updates the second historical equipment queue to obtain a third historical equipment queue, and updates the first equipment queue to obtain a second equipment queue.
The Bluetooth protocol stack detects whether the number of the device identifiers in the second historical device queue is greater than or equal to a threshold value, if not, the second historical device queue is not processed, if so, the first device identifier in the second historical device queue (namely the device identifier stored in the historical device queue at the earliest) is deleted, a third historical device queue is obtained, and the first device queue is synchronously updated to obtain the second device queue. And updating the first equipment queue to obtain a second equipment queue, namely deleting the equipment information of the first target Bluetooth equipment from the first equipment queue, wherein the equipment identification of the first target Bluetooth equipment is the same as the first equipment identification in the second historical equipment queue. Illustratively, the first device queue and the second historical device queue may be as shown in table 4.1 below, and the second device queue and the third historical device queue may be as shown in table 4.2 below.
TABLE 4.1
TABLE 4.2
Optionally, if the historical device queue does not include the device identifier of the first bluetooth device, the bluetooth protocol stack stores the device identifier of the first bluetooth device in the historical device queue, to obtain a fourth historical device queue. If the number of the device identifications in the fourth historical device queue is greater than or equal to the threshold value, the Bluetooth protocol stack deletes the first device identification from the fourth historical device queue to obtain a fifth historical device queue, and deletes the device information of the second target Bluetooth device from the first device queue. Wherein the device identification of the second target bluetooth device is the same as the first device identification in the fourth historical device queue.
Because no repeated equipment identification exists in the historical equipment queue, the probability of full historical equipment queue can be reduced to a certain extent, and therefore the connection success rate between the electronic equipment and the Bluetooth equipment can be improved.
Optionally, at S810, the bluetooth protocol stack sends a display instruction to the sports health application in response to the first bluetooth device being a bluetooth device associated with the sports health application.
Optionally, S811, the sports health application displays the first bluetooth device on the device management interface in response to the display instruction.
Optionally, S812, the sports health application receives a connection operation for the first bluetooth device.
Optionally, S813, the sports health application sends a bluetooth type inquiry instruction to the bluetooth protocol stack.
Optionally, in S814, the bluetooth protocol stack queries the bluetooth type of the first bluetooth device based on the first device queue in response to the bluetooth type query instruction.
Optionally, S815, the bluetooth protocol stack feeds back the bluetooth type of the first bluetooth device to the sports health application.
Optionally, S816, the sports health application sends a connection instruction to the bluetooth protocol stack.
Optionally, in S817, the bluetooth protocol stack sends a connection instruction to the bluetooth chip.
Optionally, S818, the bluetooth chip sends a connection success response to the bluetooth protocol stack.
The implementation process of step S711 to step S818 can be referred to in the specific description of step 10 to step 18 in fig. 5A, and will not be described herein. Optionally, a pairing deletion procedure for the first bluetooth device may be further performed after step S818, for example, a deletion operation for the first bluetooth device is received at the device management interface of the sports health application, and in response to the deletion operation, the bluetooth protocol stack deletes the device information of the first bluetooth device from the first device queue, while the device management device interface of the sports health application does not display the first bluetooth device.
In the embodiment shown in fig. 8, there is no duplicate device identifier in the historical device queue, so that the probability that the queue length of the historical device queue exceeds the threshold value can be reduced to a certain extent, thereby helping to improve the connection success rate between the electronic device and the bluetooth device.
Fig. 9 exemplarily shows a hardware configuration diagram of the electronic device 100.
The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It should be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (IMAGE SIGNAL processor, ISP), a controller, a video codec, a digital signal processor (DIGITAL SIGNAL processor, DSP), a baseband processor, and/or a neural-Network Processor (NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-INTEGRATED CIRCUIT, I2C) interface, an integrated circuit built-in audio (inter-INTEGRATED CIRCUIT SOUND, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (SERIAL DATA LINE, SDA) and a serial clock line (derail clock line, SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc., respectively, through different I2C bus interfaces.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface to implement a function of answering a call through the bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
The MIPI interface may be used to connect the processor 110 to peripheral devices such as a display 194, a camera 193, and the like. The MIPI interfaces include camera serial interfaces (CAMERA SERIAL INTERFACE, CSI), display serial interfaces (DISPLAY SERIAL INTERFACE, DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the photographing functions of electronic device 100. The processor 110 and the display 194 communicate via a DSI interface to implement the display functionality of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, an MIPI interface, etc.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and is not meant to limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also employ different interfacing manners in the above embodiments, or a combination of multiple interfacing manners.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 to power the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution for wireless communication including 2G/3G/4G/5G, etc., applied to the electronic device 100.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (WIRELESS FIDELITY, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation SATELLITE SYSTEM, GNSS), frequency modulation (frequency modulation, FM), near field communication (NEAR FIELD communication, NFC), infrared (IR), etc., applied to the electronic device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module.
In an embodiment of the present application, bluetooth may scan for bluetooth devices in the environment described by the electronic device 100 and establish a connection with the bluetooth devices.
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a Liquid Crystal Display (LCD) CRYSTAL DISPLAY, an organic light-emitting diode (OLED), an active-matrix organic LIGHT EMITTING diode (AMOLED), a flexible light-emitting diode (FLED), miniled, microLed, micro-oLed, a quantum dot LIGHT EMITTING diode (QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like. The ISP is used to process data fed back by the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The internal memory 121 may include one or more random access memories (random access memory, RAM) and one or more non-volatile memories (NVM).
The random access memory may include static random-access memory (SRAM), dynamic random-access memory (dynamic random access memory, DRAM), synchronous dynamic random-access memory (synchronous dynamic random access memory, SDRAM), double data rate synchronous dynamic random-access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, e.g., fifth generation DDR SDRAM is commonly referred to as DDR5 SDRAM), etc. The nonvolatile memory may include a disk storage device, a flash memory (flash memory).
The FLASH memory may include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operation principle, may include single-level memory cells (SLC-LEVEL CELL, SLC), multi-level memory cells (multi-LEVEL CELL, MLC), triple-LEVEL CELL, quad-LEVEL CELL, QLC, etc. according to the potential level of the memory cells, and may include general FLASH memory (English: universal FLASH storage, UFS), embedded multimedia memory card (embeddedmultimediaCard, eMMC), etc. according to the storage specification.
The random access memory may be read directly from and written to by the processor 110, may be used to store executable programs (e.g., machine instructions) for an operating system or other on-the-fly programs, may also be used to store data for users and applications, and the like.
The nonvolatile memory may store executable programs, store data of users and applications, and the like, and may be loaded into the random access memory in advance for the processor 110 to directly read and write.
The external memory interface 120 may be used to connect external non-volatile memory to enable expansion of the memory capabilities of the electronic device 100. The external nonvolatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and video are stored in an external nonvolatile memory.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be a USB interface 130 or a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used to sense a pressure signal, and may convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip cover using the magnetic sensor 180D.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, the electronic device 100 may range using the distance sensor 180F to achieve quick focus.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to unlock the fingerprint, access the application lock, photograph the fingerprint, answer the incoming call, etc.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J.
The touch sensor 180K, also referred to as a "touch device". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type.
The bone conduction sensor 180M may acquire a vibration signal.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
By implementing the embodiment of the application, under the condition that the number of the device identifications in the historical device queue is greater than or equal to the threshold value, deleting the first device identification in the historical device queue, and if the deleted historical device queue also comprises the device identification, reserving the device identification in the device queue without deleting, thereby improving the connection success rate between the electronic device and the Bluetooth device when the Bluetooth device identified by the device identification is scanned later. Or no repeated equipment identification exists in the historical equipment queue, so that the probability that the length of the historical equipment queue exceeds a threshold value can be reduced to a certain extent, and the connection success rate between the electronic equipment and the Bluetooth equipment can be improved.
The term "User Interface (UI)" in the description and claims of the present application and in the drawings is a media interface for interaction and information exchange between an application program or an operating system and a user, which enables conversion between an internal form of information and a form acceptable to the user. The user interface of the application program is a source code written in a specific computer language such as java, extensible markup language (extensible markup language, XML) and the like, the interface source code is analyzed and rendered on the terminal equipment, and finally the interface source code is presented as content which can be identified by a user, such as a control of pictures, words, buttons and the like. Controls (controls), also known as parts (widgets), are basic elements of a user interface, typical controls being a toolbar (toolbar), menu bar (menu bar), text box (text box), button (button), scroll bar (scrollbar), picture and text. The properties and content of the controls in the interface are defined by labels or nodes, such as XML specifying the controls contained in the interface by nodes < Textview >, < ImgView >, < VideoView >, etc. One node corresponds to a control or attribute in the interface, and the node is rendered into visual content for a user after being analyzed and rendered. In addition, many applications, such as the interface of a hybrid application (hybrid application), typically include web pages. A web page, also referred to as a page, is understood to be a special control embedded in an application program interface, and is source code written in a specific computer language, such as hypertext markup language (hyper text markup language, GTML), cascading style sheets (CASCADING STYLE SHEETS, CSS), java script (JavaScript, JS), etc., and the web page source code may be loaded and displayed as user-recognizable content by a browser or web page display component similar to the browser function. The specific content contained in a web page is also defined by tags or nodes in the web page source code, such as GTML defines elements and attributes of the web page by < p >, < img >, < video >, < canvas >.
A commonly used presentation form of a user interface is a graphical user interface (graphic user interface, GUI), which refers to a graphically displayed user interface that is related to computer operations. It may be an interface element such as an icon, a window, a control, etc. displayed in a display screen of the electronic device, where the control may include a visual interface element such as an icon, a button, a menu, a tab, a text box, a dialog box, a status bar, a navigation bar, a Widget, etc.
As used in the specification of the present application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates to the contrary. It should also be understood that the term "and/or" as used in this disclosure refers to and encompasses any or all possible combinations of one or more of the listed items. As used in the above embodiments, the term "when …" may be interpreted to mean "if …" or "after …" or "in response to determination …" or "in response to detection …" depending on the context. Similarly, the phrase "at the time of determination …" or "if detected (a stated condition or event)" may be interpreted to mean "if determined …" or "in response to determination …" or "at the time of detection (a stated condition or event)" or "in response to detection (a stated condition or event)" depending on the context.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk), etc.
Those of ordinary skill in the art will appreciate that implementing all or part of the above-described method embodiments may be accomplished by a computer program to instruct related hardware, the program may be stored in a computer readable storage medium, and the program may include the above-described method embodiments when executed. And the aforementioned storage medium includes: ROM or random access memory RAM, magnetic or optical disk, etc.

Claims (18)

1. A bluetooth device management method, wherein the method is applied to an electronic device including bluetooth, the method comprising:
Responding to the Bluetooth being started and scanning to a first Bluetooth device through the Bluetooth, and inquiring whether a device queue comprises a device identifier of the first Bluetooth device;
In response to the equipment queue not including the equipment identifier of the first Bluetooth equipment, saving the equipment identifier and the Bluetooth type of the first Bluetooth equipment to the equipment queue to obtain a first equipment queue, and saving the equipment identifier of the first Bluetooth equipment to a historical equipment queue to obtain a first historical equipment queue;
Deleting a first equipment identifier from the first historical equipment queue to obtain a second historical equipment queue in response to the number of the equipment identifiers in the first historical equipment queue being greater than or equal to a threshold value;
Responding to the second historical equipment queue to comprise a target equipment identifier, continuously storing the equipment identifier and the Bluetooth type of a target Bluetooth equipment in the first equipment queue, wherein the target equipment identifier is the same as the first equipment identifier in the first historical equipment queue, and the target equipment identifier is used for identifying the target Bluetooth equipment;
The device queue comprises at least one device identifier which is arranged according to the sequence of the scanning time and is not repeated, the historical device queue comprises at least one device identifier which is arranged according to the sequence of the scanning time, and the queue length of the device queue is smaller than or equal to that of the historical device queue.
2. The method of claim 1, wherein the responding to the second historical device queue including a target device identification, the target device identification continuing to be saved in the first device queue comprises:
And responding to the second historical equipment queue to comprise a target equipment identifier, wherein the target equipment identifier is the same as the equipment identifier of the first Bluetooth equipment, and the equipment identifier and the Bluetooth type of the first Bluetooth equipment are continuously stored in the first equipment queue.
3. The method of claim 1, wherein the electronic device further comprises a sports health application;
The method further comprises the steps of:
Responding to the first Bluetooth device as the Bluetooth device associated with the sports health application, and displaying the device identification of the first Bluetooth device on a device management interface of the sports health application;
receiving a connection operation aiming at the first Bluetooth device at a device management interface of the sports health application, and responding to the connection operation, acquiring the Bluetooth type of the first Bluetooth device from the first device queue;
and sending a pairing request to the first Bluetooth device based on the Bluetooth type of the first Bluetooth device.
4. A method as claimed in claim 3, wherein the method further comprises:
and receiving a deleting operation aiming at the first Bluetooth device at a device management interface of the sports health application, and deleting the device identifier and the Bluetooth type of the first Bluetooth device from the first device queue in response to the deleting operation.
5. The method of claim 1, wherein the method further comprises:
And deleting the device identification and the Bluetooth type of the target Bluetooth device from the first device queue in response to the second historical device queue not including the target device identification.
6. The method of any of claims 1-5, wherein the electronic device comprises a bluetooth protocol stack and a bluetooth chip, the bluetooth protocol stack to manage the device queue and the historical device queue; the Bluetooth chip is used for scanning Bluetooth equipment and acquiring equipment identification and Bluetooth type of the Bluetooth equipment.
7. The method of claim 6, wherein the querying whether a device queue includes a device identification of a first bluetooth device in response to the bluetooth being turned on and scanning for the first bluetooth device via the bluetooth comprises:
Receiving clicking operation aiming at the Bluetooth closing identifier, and responding to the clicking operation to control the Bluetooth protocol stack and the Bluetooth chip to be in a working state;
Invoking the Bluetooth chip to scan Bluetooth equipment in the environment where the electronic equipment is located;
Responding to the Bluetooth chip scanning to a first Bluetooth device, and calling the Bluetooth chip to acquire the first Bluetooth device, a device identifier and a Bluetooth type;
Invoking the Bluetooth chip to transmit the first Bluetooth device, the device identifier and the Bluetooth type to the Bluetooth protocol stack;
And calling the Bluetooth protocol stack to inquire whether the equipment queue comprises the first Bluetooth equipment, the equipment identifier and the Bluetooth type.
8. The method of claim 6, wherein the continuing to store the device identification and bluetooth type of the target bluetooth device in the first device queue comprises:
and calling the Bluetooth protocol stack to continuously store the device identification and the Bluetooth type of the target Bluetooth device in the first device queue.
9. A bluetooth device management method, wherein the method is applied to an electronic device including bluetooth, the method comprising:
Responding to the Bluetooth being started and scanning to a first Bluetooth device through the Bluetooth, and inquiring whether a device queue comprises a device identifier of the first Bluetooth device;
responding to the equipment queue not including the equipment identifier of the first Bluetooth equipment, storing the equipment identifier and the Bluetooth type of the first Bluetooth equipment into the equipment queue to obtain a first equipment queue, and inquiring whether the historical equipment queue includes the equipment identifier of the first Bluetooth equipment;
Deleting the equipment identifier of the first Bluetooth equipment from the historical equipment queue to obtain a first historical equipment queue, and storing the equipment identifier of the first Bluetooth equipment to the first historical equipment queue to obtain a second historical equipment queue;
And deleting the first equipment identifier from the second historical equipment queue to obtain a third historical equipment queue and deleting the equipment identifier and the Bluetooth type of the first target Bluetooth equipment from the first equipment queue, wherein the equipment identifier of the first target Bluetooth equipment is the same as the first equipment identifier in the second historical equipment queue.
10. The method of claim 9, wherein the method further comprises:
Responding to the historical equipment queue not including the equipment identifier of the first Bluetooth equipment, and storing the equipment identifier of the first Bluetooth equipment into the historical equipment queue to obtain a fourth historical equipment queue;
And deleting a first device identifier from the fourth historical device queue to obtain a fifth historical device queue, and deleting the device identifier and the Bluetooth type of a second target Bluetooth device from the first device queue, wherein the device identifier of the second target Bluetooth device is the same as the first device identifier in the fourth historical device queue.
11. The method of claim 9, wherein the electronic device further comprises a sports health application;
The method further comprises the steps of:
Responding to the first Bluetooth device as the Bluetooth device associated with the sports health application, and displaying the device identification of the first Bluetooth device on a device management interface of the sports health application;
receiving a connection operation aiming at the first Bluetooth device at a device management interface of the sports health application, and responding to the connection operation, acquiring the Bluetooth type of the first Bluetooth device from the first device queue;
and sending a pairing request to the first Bluetooth device based on the Bluetooth type of the first Bluetooth device.
12. The method of claim 11, wherein the method further comprises:
And receiving a deleting operation aiming at the first Bluetooth device at a device management interface of the sports health application, deleting the device identifier and the Bluetooth type of the first Bluetooth device from the first device queue in response to the deleting operation, and deleting the device identifier of the first Bluetooth device from the second historical device queue.
13. The method of any of claims 9-12, wherein the electronic device comprises a bluetooth protocol stack and a bluetooth chip, the bluetooth protocol stack to manage the device queue and the historical device queue; the Bluetooth chip is used for scanning Bluetooth equipment and acquiring equipment identification and Bluetooth type of the Bluetooth equipment.
14. The method of claim 13, wherein the querying whether a device queue includes a device identification of a first bluetooth device in response to the bluetooth being turned on and scanning for the first bluetooth device via the bluetooth comprises:
Receiving clicking operation aiming at the Bluetooth closing identifier, and responding to the clicking operation to control the Bluetooth protocol stack and the Bluetooth chip to be in a working state;
Invoking the Bluetooth chip to scan Bluetooth equipment in the environment where the electronic equipment is located;
Responding to the Bluetooth chip scanning to a first Bluetooth device, and calling the Bluetooth chip to acquire the first Bluetooth device, a device identifier and a Bluetooth type;
Invoking the Bluetooth chip to transmit the first Bluetooth device, the device identifier and the Bluetooth type to the Bluetooth protocol stack;
And calling the Bluetooth protocol stack to inquire whether the equipment queue comprises the first Bluetooth equipment, the equipment identifier and the Bluetooth type.
15. The method of claim 13, wherein said deleting the first device identification from the second historical device queue to obtain a third historical device queue and deleting the device identification and bluetooth type of the first target bluetooth device from the first device queue comprises:
And calling the Bluetooth protocol stack to delete the first equipment identifier from the second historical equipment queue to obtain a third historical equipment queue, and deleting the equipment identifier and the Bluetooth type of the first target Bluetooth equipment from the first equipment queue.
16. An electronic device comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories for storing computer program code comprising computer instructions that, when executed by the one or more processors, cause the method of any of claims 1-15 to be performed.
17. A chip system for application to an electronic device, the chip system comprising one or more processors for invoking computer instructions to cause the electronic device to perform the method of any of claims 1-15.
18. A computer readable storage medium comprising instructions which, when run on an electronic device, cause the method of any one of claims 1-15 to be performed.
CN202410725797.5A 2024-06-06 Bluetooth device management method and electronic device Pending CN118301581A (en)

Publications (1)

Publication Number Publication Date
CN118301581A true CN118301581A (en) 2024-07-05

Family

ID=

Similar Documents

Publication Publication Date Title
CN109814766B (en) Application display method and electronic equipment
CN110910872A (en) Voice interaction method and device
CN116360725B (en) Display interaction system, display method and device
CN113254409A (en) File sharing method, system and related equipment
CN114124980B (en) Method, device, system, terminal and storage medium for starting application
WO2022179275A1 (en) Terminal application control method, terminal device, and chip system
WO2022143258A1 (en) Voice interaction processing method and related apparatus
CN112740148A (en) Method for inputting information into input box and electronic equipment
CN114650330A (en) Method, electronic equipment and system for adding operation sequence
WO2022206763A1 (en) Display method, electronic device, and system
CN115022982B (en) Multi-screen cooperative non-inductive access method, electronic equipment and storage medium
CN112416984A (en) Data processing method and device
CN113380240B (en) Voice interaction method and electronic equipment
WO2022052962A1 (en) Application module startup method and electronic device
CN118301581A (en) Bluetooth device management method and electronic device
US20240201932A1 (en) Display method, electronic device, and system
CN117009023B (en) Method for displaying notification information and related device
CN114666441B (en) Method for calling capabilities of other devices, electronic device, system and storage medium
CN116795476B (en) Wallpaper deleting method and electronic equipment
CN116541188B (en) Notification display method, terminal device and storage medium
CN114006969B (en) Window starting method and electronic equipment
WO2024131823A1 (en) Installation-free application upgrading method and electronic device
CN116301510A (en) Control positioning method and electronic equipment
CN114518965A (en) Cut and pasted content processing method and device
CN117917632A (en) Display method, electronic equipment and system

Legal Events

Date Code Title Description
PB01 Publication