Bluetooth connection method and electronic equipment
By configuring filtering rules in the Bluetooth chip and combining them with the functions of different interfaces, the high power consumption problem during Bluetooth connection was solved, and a lower power consumption Bluetooth connection method was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-11-12
- Publication Date
- 2026-05-12
AI Technical Summary
Some electronic devices consume high power when scanning Bluetooth broadcast messages from other electronic devices and establishing Bluetooth connections, especially due to imperfect Bluetooth communication functions in the operating system.
By configuring filtering rules in the Bluetooth chip, Bluetooth broadcast messages can be scanned and processed using a Bluetooth interface that supports filtering rules. Once the filtering rules are met, a connection can be established with the target device through a Bluetooth interface that supports connection establishment, thereby reducing the processing of invalid messages.
It reduces the power consumption of electronic devices when scanning and establishing Bluetooth connections, thus improving the energy efficiency of the devices.
Smart Images

Figure CN122028149A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic technology, and more particularly to a Bluetooth connection method and an electronic device. Background Technology
[0002] In smart interconnected scenarios, various electronic devices within the near-field communication range, such as personal computers (PCs), mobile phones, tablets, large screens, and Internet of Things (IoT) devices, can achieve mutual sensing and discovery between electronic devices through Bluetooth communication (e.g., Bluetooth Low Energy (BLE) communication). However, the Bluetooth communication functionality of some electronic devices' operating systems is not perfect, and power consumption remains relatively high when scanning Bluetooth broadcast messages from other electronic devices and establishing Bluetooth connections. Summary of the Invention
[0003] This application provides a Bluetooth connection method and an electronic device for reducing the power consumption of the electronic device.
[0004] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0005] In a first aspect, a Bluetooth connection method is provided, comprising: a first electronic device controlling a Bluetooth chip to scan Bluetooth broadcast messages via a first Bluetooth interface; if the Bluetooth chip detects that data in a preset field in a first Bluetooth broadcast message of a second electronic device satisfies the filtering rules of the preset field, the Bluetooth chip sends a first Bluetooth broadcast message to an upper-layer application via the first Bluetooth interface; the first electronic device controlling the Bluetooth chip to establish a Bluetooth connection with the second electronic device via a second Bluetooth interface; wherein the first Bluetooth interface does not support establishing a Bluetooth connection, while the second Bluetooth interface does support establishing a Bluetooth connection; the first Bluetooth interface supports configuring filtering rules for the Bluetooth chip, while the second Bluetooth interface does not support configuring filtering rules for the Bluetooth chip; the filtering rules are used to instruct the Bluetooth chip to report Bluetooth broadcast messages whose data in the preset field is within the valid data range.
[0006] The Bluetooth connection method provided in this application has two advantages. Firstly, during the scanning of Bluetooth broadcast messages, because the second Bluetooth interface does not support configuring filtering rules for the Bluetooth chip, if the second Bluetooth interface is used to control the Bluetooth chip to scan for Bluetooth broadcast messages, the Bluetooth chip will report all scanned Bluetooth broadcast messages, and the first electronic device will parse and process all Bluetooth broadcast messages, resulting in high power consumption for the first electronic device. However, the first Bluetooth interface supports configuring filtering rules for the Bluetooth chip. Based on the filtering rules, the Bluetooth chip reports first Bluetooth broadcast messages whose data falls within the valid data range of a preset domain. Other Bluetooth broadcast messages whose data does not meet the filtering rules are filtered out by the Bluetooth chip and will not be reported for further processing, thus reducing the power consumption of the first electronic device. Secondly, during the establishment of a Bluetooth connection with the second electronic device, because the first Bluetooth interface does not support establishing a Bluetooth connection, while the second Bluetooth interface does, after scanning a first Bluetooth broadcast message that meets the filtering rules through the first Bluetooth interface, the second Bluetooth interface controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device. In summary, the Bluetooth connection method can reduce the power consumption of an electronic device when scanning Bluetooth broadcast messages from other electronic devices and establishing a Bluetooth connection.
[0007] In one possible implementation, the first electronic device configures enabling information for filtering rules of various preset domains to the Bluetooth chip via the first Bluetooth interface. The enabling information is used to indicate whether the filtering rules of the corresponding preset domains are effective. When the filtering rules of multiple preset domains are effective, as long as any preset domain in the first Bluetooth broadcast message received by the first electronic device meets the filtering rules of that preset domain, the Bluetooth chip will send the first Bluetooth broadcast message to the upper-layer application via the first Bluetooth interface.
[0008] In one possible implementation, the first electronic device controls a Bluetooth chip to establish a Bluetooth connection with the second electronic device via a second Bluetooth interface. This includes: the first electronic device controlling the Bluetooth chip to scan for Bluetooth broadcast messages via the second Bluetooth interface; if the identification information of the electronic device in the second Bluetooth broadcast message is the same as the identification information of the electronic device in the first Bluetooth broadcast message, it indicates that a Bluetooth broadcast message satisfying the filtering rules has also been scanned through the second Bluetooth interface, which does not support filtering. Furthermore, the second Bluetooth interface has already created an object of the second electronic device in its memory space, allowing for further establishment of a Bluetooth connection with the second electronic device based on this object. Then, the first electronic device controls the Bluetooth chip to stop scanning via the second Bluetooth interface to reduce power consumption; and also controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device via the second Bluetooth interface.
[0009] In one possible implementation, controlling the Bluetooth chip to establish a Bluetooth connection with the second electronic device via a second Bluetooth interface includes: the first electronic device obtaining Bluetooth connection-related information of the second electronic device from a first Bluetooth broadcast message; creating an object of the second electronic device via the second Bluetooth interface based on the Bluetooth connection-related information of the second electronic device; and controlling the Bluetooth chip to establish a Bluetooth connection with the second electronic device via the second Bluetooth interface. This implementation can directly utilize the Bluetooth connection-related information of the second electronic device parsed from the first Bluetooth broadcast message to create an object of the second electronic device, eliminating the need to rescan for Bluetooth broadcast messages via the second Bluetooth interface and further establish a Bluetooth connection with the second electronic device, thereby further reducing the power consumption of the first electronic device.
[0010] In one possible implementation, the preset domain includes a manufacturer-specific data domain; the data in the preset domain of the first Bluetooth broadcast message satisfies the filtering rules of the preset domain, including: the valid data range of the manufacturer-specific data domain is the value M, and the data in the manufacturer-specific data domain of the first Bluetooth broadcast message is also the value M; or, the valid data range of the manufacturer-specific data domain is the numerical interval [M1, M2], and the data in the manufacturer-specific data domain of the first Bluetooth broadcast message is the value M, M∈[M1, M2]. Since the manufacturer-specific data domain is defined by the manufacturer, the filtering of Bluetooth broadcast messages is more flexible. Filtering by the manufacturer-specific data domain can filter out broadcast messages that do not meet the requirements of the manufacturer-specific data domain, and only select broadcast messages that meet the requirements of the manufacturer-specific data domain.
[0011] In one possible implementation, the preset domain includes a service data specific domain; the data in the preset domain of the first Bluetooth broadcast message satisfies the filtering rules of the preset domain, including: the valid data range of the service data specific domain is the value M, and the data of the service data specific domain in the first Bluetooth broadcast message is also the value M; or, the valid data range of the service data specific domain is the value interval [M1, M2], and the data of the service data specific domain in the first Bluetooth broadcast message is the value M, M∈[M1, M2]. Since the service data specific domain is defined by the manufacturer, the filtering of Bluetooth broadcast messages is more flexible. Therefore, filtering by the service data specific domain can filter out broadcast messages that do not meet the requirements of the service data specific domain, and only select broadcast messages that meet the requirements of the service data specific domain.
[0012] In one possible implementation, the preset field includes a media access control (MAC) address field; the data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: the valid data range of the MAC address field is 6 bytes, and the 6-byte value of the MAC address field in the first Bluetooth broadcast message is the same as the 6-byte value of the valid data range of the MAC address field. Since the MAC addresses of each electronic device are different, filtering by the MAC address field can achieve filtering for specific electronic devices.
[0013] In one possible implementation, the preset field includes a device name field; the data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: the valid data range of the device name field includes at least one string, and the string of the device name field in the first Bluetooth broadcast message is the same as one string in the valid data range of the device name field. Since the data of the device name field of electronic devices of the same model (e.g., mobile phones) is the same, filtering by device name field can achieve filtering of electronic devices of the same model.
[0014] In one possible implementation, the preset domain includes a service identifier domain; the data in the preset domain of the first Bluetooth broadcast message satisfies the filtering rules of the preset domain, including: the valid data range of the service identifier domain is the value N, and the data of the service identifier domain in the first Bluetooth broadcast message is also the value N; or, the valid data range of the service identifier domain is the value interval [N1, N2], and the data of the service identifier domain in the first Bluetooth broadcast message is the value N, N∈[N1, N2]. Since different types of electronic devices (e.g., mobile phones, tablets) can use the same service identifier (e.g., communicate through the same chat software), the service identifier domain can be used to filter electronic devices performing the same service.
[0015] In one possible implementation, the preset field includes a manufacturer identifier field; the data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: the valid data range of the manufacturer identifier field is the value N, and the data of the manufacturer identifier field in the first Bluetooth broadcast message is also the value N; or, the valid data range of the manufacturer identifier field is the value interval [N1, N2], and the data of the manufacturer identifier field in the first Bluetooth broadcast message is the value N, N∈[N1, N2]. Since electronic devices of the same manufacturer but different types (e.g., mobile phones, tablets) all use the same manufacturer identifier, electronic devices from the same manufacturer can be filtered through the manufacturer identifier field.
[0016] In a second aspect, an electronic device is provided, including a processor and a memory, wherein instructions are stored in the memory, and when the processor executes the instructions, the electronic device performs the method as described in the first aspect and any embodiment thereof.
[0017] Thirdly, a computer-readable storage medium is provided, including instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in the first aspect and any embodiment thereof.
[0018] Fourthly, a computer program product containing instructions is provided, which, when executed on the aforementioned electronic device, cause the electronic device to perform the method as described in the first aspect and any embodiment thereof.
[0019] Fifthly, embodiments of this application provide a chip system applied to an electronic device. This chip system includes one or more processors that, when executing computer instructions, cause the electronic device to perform the method described in the first aspect or any possible implementation thereof, or to perform the method described in the second aspect or any possible implementation thereof. The chip system may be a system-on-chip (SoC). The processor may include a modem processor (also known as a modem or baseband chip).
[0020] The technical effects of the second to fifth aspects refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. Attached Figure Description
[0021] Figure 1 A schematic diagram of a communication system with a trust loop provided in an embodiment of this application;
[0022] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0023] Figure 3 A schematic diagram of a software architecture in an electronic device provided in an embodiment of this application;
[0024] Figure 4 A schematic diagram illustrating an object for which a second electronic device cannot be obtained, as provided in an embodiment of this application;
[0025] Figure 5 A flowchart illustrating a Bluetooth connection method provided in an embodiment of this application;
[0026] Figure 6 A flowchart illustrating another Bluetooth connection method provided in an embodiment of this application;
[0027] Figure 7 A flowchart illustrating yet another Bluetooth connection method provided in an embodiment of this application;
[0028] Figure 8This is a schematic diagram of the display interface of a first electronic device provided in an embodiment of this application. Detailed Implementation
[0029] First, some concepts involved in this application will be described.
[0030] The terms "first" and "second" used in the embodiments of this application are only used to distinguish features of the same type and should not be construed as indicating relative importance, quantity, order, etc.
[0031] The terms "exemplary" or "for example" used in the embodiments of this application are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0032] Bluetooth broadcast messages (e.g., BLE broadcast messages) are periodically sent by electronic devices. These broadcast messages can include general broadcast messages, directional broadcast messages, non-connectable broadcast messages, and discoverable broadcast messages. General broadcast is the most widely used broadcast method. Electronic devices sending general broadcast messages can be scanned by other electronic devices and establish Bluetooth connections. Directional broadcast messages include the address of the broadcaster and the address of the responder. Upon receiving a directional broadcast message, the responder can immediately send a connection request to the broadcaster to quickly establish a Bluetooth connection. Non-connectable broadcast messages are used when an electronic device only wants to broadcast data without wanting to scan for or establish Bluetooth connections with other electronic devices. Discoverable broadcast messages allow other electronic devices to scan for and discover the electronic device, but cannot establish Bluetooth connections. The Bluetooth broadcast messages discussed in this application refer to Bluetooth broadcast messages that enable two electronic devices to establish a Bluetooth connection, such as general broadcast messages and directional broadcast messages.
[0033] like Figure 1As shown, in a smart interconnected scenario, a trust ring is a communication system comprising multiple authenticated electronic devices, such as personal computers (PCs) 101, mobile phones 102, tablets 103, large screens 104, and Internet of Things (IoT) devices (e.g., headphones) 105. When these electronic devices are within the near-field communication (NFC) range, they can automatically sense, discover, and network with each other, enabling multiple electronic devices across systems to interconnect with mutual trust at low power consumption. This allows for resource and service sharing among the electronic devices, such as sharing cameras and multi-screen collaboration. Compared to internet communication, NFC, being a point-to-point direct communication, is more conducive to ensuring information security. Furthermore, the transmission rate is not affected by network factors, allowing for higher bandwidth transmission. Authentication in the trust ring typically requires multiple electronic devices to log in to the same account, and these devices communicate directly point-to-point via NFC, such as Bluetooth communication (e.g., BLE communication). The trust ring could be a device like MagicRing.
[0034] This application embodiment uses a first electronic device and a second electronic device for near-field communication as an example. The first electronic device and the second electronic device can communicate via Bluetooth (e.g., BLE communication) and establish a Bluetooth connection (e.g., BLE connection). The first electronic device and the second electronic device can log in with the same account. The first electronic device and the second electronic device logged in with the same account can join the same trust ring through identity authentication. Thus, near-field communication can be performed within the trust ring to ensure device security.
[0035] The first and second electronic devices involved in the embodiments of this application can be handheld devices, vehicle-mounted devices, etc., such as mobile phones, tablets, laptops, PDAs, mobile internet devices (MIDs), virtual reality (VR) devices, augmented reality (AR) devices, wireless devices in industrial control, wireless devices in self-driving, wireless devices in remote medical surgery, wireless devices in smart grids, wireless devices in transportation safety, wireless devices in smart cities, wireless devices in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, and personal computers. The embodiments of this application do not limit the scope to computers (PCs), computing devices or other processing devices connected to a wireless modem, in-vehicle devices, wearable devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMNs). The first and second electronic devices described above can also be wearable devices, such as smartwatches or smart glasses, and devices focused on a specific type of application function that can be used in conjunction with other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign detection. The first and second electronic devices described above can also be terminal devices in Internet of Things (IoT) systems.
[0036] In this embodiment of the application, the first electronic device is PC 101, and the second electronic device is an electronic device capable of sending BLE broadcasts, such as mobile phone 102, tablet 103, large screen 104, IoT device 105.
[0037] like Figure 2As shown, this application embodiment provides an electronic device (which may be a first electronic device or a second electronic device), which may include: a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, a sensor module 280, a button 290, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc.
[0038] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0039] Processor 210 may include one or more processing units, such as: field-programmable gate array (FPGA), application-specific integrated circuit (ASIC), system-on-chip (SoC), central processor (CPU), network processor (NP), microcontroller unit (MCU), programmable logic device (PLD), application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0040] The external storage interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 210 through the external storage interface 220 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0041] Internal memory 221 can be used to store computer executable program code, which includes instructions. Processor 210 executes various functional applications and data processing of the electronic device by running the computer instructions stored in internal memory 221, such as executing the Bluetooth connection method of this application embodiment. Internal memory 221 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, phonebook, etc.). Furthermore, internal memory 221 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0042] The memory involved in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0043] The SIM card interface 295 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 295 to achieve contact and separation with the electronic device. The electronic device can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, and other SIM cards.
[0044] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor, and baseband processor. Mobile communication module 250 can perform 2G / 3G / 4G / 5G mobile communication. Wireless communication module 260 can perform Bluetooth (BT), wireless local area network (WLAN), global navigation satellite system (GNSS), near field communication (NFC), infrared (IR), and frequency modulation (FM) technologies.
[0045] The processor 210 of the electronic device can run software such as an operating system, for example, Windows. Operating system, Android Operating systems, etc. For example... Figure 3 As shown, running on a PC Taking the operating system as an example, it includes the application layer, application interface layer, service layer, kernel layer, driver layer, and hardware adaptation layer.
[0046] The application layer includes system applications, third-party applications, PC management applications, and other applications. System applications include clock, telephone, and SMS applications. Third-party applications include video applications, chat applications, and map applications. Upper-layer applications in the application layer (such as PC management applications) can execute the Bluetooth connection method involved in the embodiments of this application.
[0047] The application interface layer includes the system Bluetooth interface (e.g. Built into the operating system The system Bluetooth interface and the distributed context fabric (DCF) interface are both used to control the Bluetooth chip to implement Bluetooth communication (e.g., BLE communication). The difference is that the DCF interface does not support establishing Bluetooth connections (e.g., BLE connections), while the system Bluetooth interface does. The DCF interface supports configuring filtering rules for the Bluetooth chip, while the system Bluetooth interface does not. After the Bluetooth chip scans for Bluetooth broadcast messages (e.g., BLE broadcast messages) that meet the filtering rules, it can send the Bluetooth broadcast message to the kernel-level Bluetooth protocol stack. The Bluetooth protocol stack parses the Bluetooth broadcast message according to the Bluetooth protocol to obtain valid data and sends the valid data in the Bluetooth broadcast message to the upper-layer application (e.g., PC Manager) through the DCF interface. For details on the filtering rules, please refer to S101; they will not be repeated here.
[0048] The system's Bluetooth interfaces include a Universal Windows Platform (UWP) interface and a Win32 interface. The UWP interface includes the UWP Advertise interface, the UWP Devices interface, the UWP Generic Attribute Profile (GATT) interface, and the Win-Socket API, among others. The UWP Advertise interface can perform Bluetooth scanning, while the UWP Devices interface can obtain Bluetooth objects. The Win32 interface includes Bluetooth APIs and Bluetooth Low Energy APIs.
[0049] The service layer includes the BthServ component, BthProps component, WshBth component, and DCF service. The BthServ component is responsible for caching and forwarding query data. The BthProps component is used for implementing the Bluetooth user interface and for implementing application access to the Bluetooth API in user mode. The WshBth component is used to perform socket operations. In this embodiment, the DCF service is used to configure filtering rules for the Bluetooth chip.
[0050] The kernel layer includes the Bluetooth protocol stack. The Bluetooth protocol stack is used to encapsulate and parse data packets according to the Bluetooth protocol; for example, the data packet can be a Bluetooth broadcast message (such as a BLE broadcast message).
[0051] The driver layer includes the system Bluetooth driver and the DCF driver. Both the system Bluetooth driver and the DCF driver can be used to control the Bluetooth chip for communication. The difference is that the system Bluetooth driver is used to be called by the system Bluetooth interface, while the DCF driver is used to be called by the DCF interface.
[0052] The hardware adaptation layer, also known as the hardware abstraction layer (HAL), is used to abstract hardware. The HAL hides the hardware interface details of a specific platform, providing the operating system with a virtual hardware platform. It is hardware-independent; for example, it abstracts a Bluetooth chip.
[0053] The system Bluetooth interface supports controlling the Bluetooth chip to establish Bluetooth connections (e.g., BLE connections) with other electronic devices, but it does not support configuring filtering rules for the Bluetooth chip. Therefore, it cannot control the Bluetooth chip to filter Bluetooth broadcast messages (e.g., BLE broadcast messages). Within the near-field communication range, there are many Bluetooth-enabled electronic devices nearby. If the system Bluetooth interface is used to control the Bluetooth chip to scan for Bluetooth broadcast messages, the Bluetooth chip will report all Bluetooth broadcast messages from surrounding electronic devices to the kernel-level Bluetooth protocol stack. The kernel layer then needs to parse and process these Bluetooth broadcast messages, resulting in high power consumption for the electronic devices.
[0054] The DCF interface supports controlling the Bluetooth chip to filter Bluetooth broadcast messages, but it does not support controlling the Bluetooth chip to establish Bluetooth connections with other electronic devices. If the DCF interface is used to configure filtering rules for the Bluetooth chip, when the Bluetooth chip scans for Bluetooth broadcast messages, it only needs to report the filtered Bluetooth broadcast messages to the upper-layer application. The upper-layer application only needs to parse and process the filtered Bluetooth broadcast messages, resulting in lower power consumption.
[0055] However, after the first electronic device obtains the Bluetooth broadcast message from the second electronic device through the DCF interface, it cannot directly establish a Bluetooth connection (e.g., BLE connection) with the second electronic device through the system Bluetooth interface based on the Bluetooth broadcast message. This is because the system Bluetooth interface does not create an object of the second electronic device, such as a Bluetooth Low Energy device (BluetoothLEDevice) object, in the system Bluetooth interface's memory space based on the Bluetooth broadcast message. For example, ... Figure 4 As shown, if an upper-layer application (such as PC Manager) obtains a Bluetooth broadcast message through the DCF interface, and this message includes the media access control (MAC) address of the second electronic device, it then calls the FromBluetoothAddressAsync method of the BluetoothLEDevice class in the system Bluetooth interface with the MAC address as the input parameter, hoping to obtain an object of the second electronic device and establish a Bluetooth connection with it based on that object. However, since the object of the second electronic device has not yet been created in the memory space of the system Bluetooth interface, the FromBluetoothAddressAsync method will return NULL, meaning it cannot obtain the object of the second electronic device. Therefore, the upper-layer application (such as PC Manager) cannot further establish a Bluetooth connection with the second electronic device through the system Bluetooth interface.
[0056] To address this, this application provides a Bluetooth connection method that combines a system Bluetooth interface and a DCF interface. The DCF interface is used to configure filtering rules for the Bluetooth chip, and the DCF interface controls the Bluetooth chip to scan for Bluetooth broadcast messages. If a Bluetooth broadcast message sent by a second electronic device satisfies the filtering rules, the Bluetooth chip reports the broadcast message. Then, a first electronic device controls the Bluetooth chip to scan for Bluetooth broadcast messages through the system Bluetooth interface, thereby creating an object (BluetoothLEDevice object) of the second electronic device in the memory space of the system Bluetooth interface and establishing a Bluetooth connection with the second electronic device. Alternatively, the first electronic device uses the Bluetooth broadcast messages scanned by the DCF interface to construct the data required by the system Bluetooth interface, such as parameters related to the object (BluetoothLEDevice object) of the second electronic device, thereby establishing a Bluetooth connection with the second electronic device.
[0057] This Bluetooth connection method is applicable to scenarios where a first electronic device scans Bluetooth broadcast messages, senses and discovers Bluetooth broadcast messages sent by a second electronic device within its near-field communication range, and then establishes a Bluetooth connection with the second electronic device. For example, in a smart interconnection scenario, the first electronic device can form a trust loop with the second electronic device in this way. Figure 5 As shown, the method includes:
[0058] S101. The upper-layer application of the first electronic device (e.g., PC Manager) configures the filtering rules of the preset field in the Bluetooth broadcast message to the Bluetooth chip through the first Bluetooth interface and starts scanning.
[0059] The first Bluetooth interface can be the DCF interface mentioned above. Upper-layer applications (such as PC Manager) can call the enable scanning method in the DCF interface to configure filtering rules for the Bluetooth chip and enable scanning.
[0060] The preset fields in a Bluetooth broadcast message (e.g., a BLE broadcast message) may include at least one of the following fields: manufacturer data specific field, service data specific field, MAC address field, device name field, service identifier field, and manufacturer identifier field. The specific contents of these fields are described in step S103 and will not be repeated here.
[0061] When there are multiple preset domains, the upper-layer application (e.g., PC Manager) can configure filtering rules for each preset domain to the Bluetooth chip. Furthermore, the upper-layer application (e.g., PC Manager) can configure enabling information for the filtering rules of each preset domain to the Bluetooth chip. This enabling information indicates whether the filtering rules for the corresponding preset domain are effective. For example, an enabling information of 1 indicates that the filtering rules for the corresponding preset domain are effective, while an enabling information of 0 indicates that the filtering rules for the corresponding preset domain are ineffective. Thus, the upper-layer application (e.g., PC Manager) can configure the Bluetooth chip to have filtering rules for more than one preset domain effective. When multiple preset domain filtering rules are effective, as long as any preset domain in the first Bluetooth broadcast message received by the first electronic device meets the filtering rules of that preset domain, the Bluetooth chip will send the first Bluetooth broadcast message to the upper-layer application (e.g., PC Manager) through the first Bluetooth interface. For example, the upper-layer application (e.g., PC Manager) can configure the Bluetooth chip to have filtering rules for both manufacturer data-specific domains and service data-specific domains effective. If the manufacturer-specific data field in the first Bluetooth broadcast message meets the filtering rules of the manufacturer-specific data field, the Bluetooth chip will send the first Bluetooth broadcast message to the upper-layer application (e.g., PC Manager) through the first Bluetooth interface; or, if the service-specific data field in the first Bluetooth broadcast message meets the filtering rules of the service-specific data field, the Bluetooth chip will also send the first Bluetooth broadcast message to the upper-layer application (e.g., PC Manager) through the first Bluetooth interface.
[0062] The filtering rules for preset fields in Bluetooth broadcast messages are used to instruct the Bluetooth chip to report Bluetooth broadcast messages whose data in the preset fields is within the valid data range. When the Bluetooth chip of an electronic device scans a Bluetooth broadcast message (such as a BLE broadcast message), and the data in the preset fields of the Bluetooth broadcast message meets the filtering rules of the preset fields, the Bluetooth chip reports the Bluetooth broadcast message to the upper-layer application (such as a PC manager).
[0063] The valid data range of the preset field in the Bluetooth broadcast message can be a specific value (e.g., 11), a value range (e.g., [10, 20]), or at least one string (e.g., "AB", "CD").
[0064] If the valid data range of the preset field is a specific value, then the data in the preset field in the Bluetooth broadcast message is within the valid data range of the preset field, meaning the data in the preset field in the Bluetooth broadcast message is equal to that specific value. For example, if the data in the preset field in the Bluetooth broadcast message is 11, and the specific value of the valid data range of the preset field is 11, then these two 11s are equal.
[0065] If the valid data range of the preset field is a numerical interval, then the data of the preset field in the Bluetooth broadcast message is within the valid data range of the preset field, meaning the data of the preset field in the Bluetooth broadcast message is within that numerical interval. For example, if the data of the preset field in the Bluetooth broadcast message is 11, and the valid data range of the preset field is [10, 20], then 11 is within the numerical interval [10, 20].
[0066] If the valid data range of the preset field is at least one string, then the data of the preset field in the Bluetooth broadcast message is within the valid data range of the preset field, meaning that the data of the preset field in the Bluetooth broadcast message is the same as one of the strings in at least one string. For example, if the data of the preset field in the Bluetooth broadcast message is "AB", and at least one string in the valid data range of the preset field is "AB" or "CD", then the two "AB" are the same.
[0067] S102, The upper-layer application of the first electronic device (e.g., PC Manager) controls the Bluetooth chip to scan for Bluetooth broadcast messages from other electronic devices through the first Bluetooth interface.
[0068] Upper-layer applications (such as PC Manager) can call the "Start Scan" method in the DCF interface to control the Bluetooth chip to scan for Bluetooth broadcast messages from other electronic devices. Other electronic devices refer to those within the near-field communication range of the first electronic device, and these other electronic devices support Bluetooth communication (e.g., BLE communication). These other electronic devices include the second electronic device.
[0069] S103. If the Bluetooth chip of the first electronic device detects that the data of the preset field in the first Bluetooth broadcast message of the second electronic device meets the filtering rules of the preset field, the Bluetooth chip sends the first Bluetooth broadcast message to the upper layer application (e.g., PC Manager) through the first Bluetooth interface.
[0070] When the Bluetooth chip of the first electronic device scans Bluetooth broadcast messages (e.g., BLE broadcast messages) from other electronic devices, if the data in a preset field of the first Bluetooth broadcast message from the second electronic device meets the filtering rules (e.g., the data in the preset field of the first Bluetooth broadcast message is within the valid data range of the preset field), the Bluetooth chip will send the first Bluetooth broadcast message to the upper-layer application (e.g., PC Manager) through the first Bluetooth interface. The first Bluetooth broadcast message does not need to be parsed by the Bluetooth protocol stack at the kernel layer. Other Bluetooth broadcast messages whose data in the preset field does not meet the filtering rules are filtered out by the Bluetooth chip and do not need to be sent to the upper-layer application (e.g., PC Manager) for further processing. Compared with the prior art, this can reduce the power consumption of the first electronic device.
[0071] In Bluetooth broadcast messages, the length and format of the Manufacturer Data Specific Field (MDS-Specific Field) and Service Data Specific Field (SDS-Specific Field) are both defined by the manufacturer. The format of the MDS-Specific Field and SDS-Specific Field is in bytes. Electronic devices manufactured by the same company, such as mobile phones, tablets, and PCs, can mutually parse the data in the MDS-Specific Field and SDS-Specific Field of each other's Bluetooth broadcast messages. Furthermore, because the MDS-Specific Field and SDS-Specific Field are manufacturer-defined, filtering Bluetooth broadcast messages is more flexible. Filtering by MDS-Specific Field can remove broadcast messages that do not meet the requirements, only selecting those that do. Similarly, filtering by Service Data Specific Field can remove broadcast messages that do not meet the requirements, only selecting those that do.
[0072] The valid data range of the manufacturer data specific field can be a specific value M. If the data of the manufacturer data specific field in the first Bluetooth broadcast message is also a value M, and the two values M are the same, then the data of the manufacturer data specific field in the first Bluetooth broadcast message is within the valid data range of the manufacturer data specific field, that is, the data of the preset field in the first Bluetooth broadcast message meets the filtering rules of the preset field.
[0073] The effective data range of the manufacturer data specific field can also be a numerical interval [M1, M2]. If the data of the manufacturer data specific field in the first Bluetooth broadcast message is a numerical value M, M∈[M1, M2], then the data of the manufacturer data specific field in the first Bluetooth broadcast message is within the effective data range of the manufacturer data specific field, that is, the data of the preset field in the first Bluetooth broadcast message satisfies the filtering rules of the preset field.
[0074] The valid data range of a specific field of service data can be a specific value M. If the data of the specific field of service data in the first Bluetooth broadcast message is also a value M, and the two values M are the same, then the data of the specific field of service data in the first Bluetooth broadcast message is within the valid data range of the specific field of service data, that is, the data of the preset field in the first Bluetooth broadcast message satisfies the filtering rules of the preset field.
[0075] The effective data range of a specific service data field can also be a numerical interval [M1, M2]. If the data of the specific service data field in the first Bluetooth broadcast message is a numerical value M, M∈[M1, M2], then the data of the specific service data field in the first Bluetooth broadcast message is within the effective data range of the specific service data field, that is, the data of the preset field in the first Bluetooth broadcast message satisfies the filtering rules of the preset field.
[0076] In Bluetooth broadcast messages, the MAC address field is used to uniquely identify the physical address of an electronic device. The MAC address format consists of 6 bytes, typically represented as 12 hexadecimal numbers in the format XX-XX-XX-XX-XX-XX, where X represents any hexadecimal number ranging from 0-9 and AF. For example, a MAC address could be AF-39-2B-4C-D2-37. Since each electronic device has a unique MAC address, filtering by MAC address field can be used to target specific electronic devices.
[0077] The valid data range of the MAC address field can be 6 bytes. If the 6-byte value of the MAC address field in the first Bluetooth broadcast message is the same as the 6-byte value of the valid data range of the MAC address field, then the data of the MAC address field in the first Bluetooth broadcast message is within the valid data range of the MAC address field, meaning the data of the preset field in the first Bluetooth broadcast message meets the filtering rules of the preset field. For example, assuming the valid data range of the MAC address field is AF-39-2B-4C-D2-37, if the 6-byte value of the MAC address field in the first Bluetooth broadcast message is also AF-39-2B-4C-D2-37, then the data of the MAC address field in the first Bluetooth broadcast message is within the valid data range of the MAC address field.
[0078] In Bluetooth broadcast messages, the DeviceName field can be the full name or abbreviation of the device, and is in string format. Since the DeviceName field data is identical for electronic devices of the same model (e.g., mobile phones), filtering by DeviceName field can be used to filter devices of the same model.
[0079] The valid data range of the device name field includes at least one string. If the string in the device name field of the first Bluetooth broadcast message is the same as a string in the valid data range of the device name field, then the data in the device name field of the first Bluetooth broadcast message is within the valid data range of the device name field. For example, if the data in the device name field of the first Bluetooth broadcast message is "AB", and at least one string in the valid data range of the device name field is "AB" or "CD", and the two strings "AB" are the same, then the data in the device name field of the first Bluetooth broadcast message is within the valid data range of the device name field.
[0080] In Bluetooth broadcast messages, the service identifier field is used to uniquely identify a service, and its format is a numerical value in bytes. Since different types of electronic devices (such as mobile phones and tablets) can use the same service identifier (e.g., to communicate through the same chat software), the service identifier field can be used to filter electronic devices providing the same service.
[0081] The valid data range of the service identifier field can be a specific value N. If the data of the service identifier field in the first Bluetooth broadcast message is also the value N, the two values N are the same; or, the valid data range of the service identifier field is the value interval [N1, N2], and the data of the service identifier field in the first Bluetooth broadcast message is the value N, N∈[N1, N2], then the data of the service identifier field in the first Bluetooth broadcast message is within the valid data range of the service identifier field, that is, the data of the preset field in the first Bluetooth broadcast message satisfies the filtering rules of the preset field.
[0082] The Manufacturer Identifier is assigned to each manufacturer by the Bluetooth Special Interest Group (SIG). Broadcasts sent by electronic devices manufactured by each manufacturer include the Manufacturer Identifier in the Manufacturer Identifier field. Since different types of electronic devices from the same manufacturer (such as mobile phones and tablets) use the same Manufacturer Identifier, the Manufacturer Identifier field can be used to filter electronic devices from the same manufacturer.
[0083] The valid data range of the manufacturer identifier field can be a specific value N. If the data of the manufacturer identifier field in the first Bluetooth broadcast message is also the value N, then the two values N are the same; or, the valid data range of the manufacturer identifier field is the numerical interval [N1, N2], and the data of the manufacturer identifier field in the first Bluetooth broadcast message is the value N, where N∈[N1, N2]. Then the data of the manufacturer identifier field in the first Bluetooth broadcast message is within the valid data range of the manufacturer identifier field, that is, the data of the preset field in the first Bluetooth broadcast message satisfies the filtering rules of the preset field.
[0084] Upper-layer applications (such as PC Manager) will cache the first Bluetooth broadcast message. They can also parse the first Bluetooth broadcast message to obtain the identification information of the second electronic device included within it, and cache this identification information. For example, the identification information of the second electronic device could be its MAC address, device identifier, etc.
[0085] S104. The upper-layer application of the first electronic device (e.g., PC Manager) controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface.
[0086] The second Bluetooth interface can be the system Bluetooth interface described above. As mentioned earlier, the first electronic device cannot directly establish a Bluetooth connection (e.g., BLE connection) with the second electronic device through the system Bluetooth interface based on the Bluetooth broadcast message obtained from the DCF interface. This is because the system Bluetooth interface does not create an object of the second electronic device in its memory space based on the Bluetooth broadcast message. Therefore, this application provides at least two implementation methods to achieve the creation of an object of the second electronic device in the memory space of the system Bluetooth interface, and to control the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface.
[0087] In one possible implementation, such as Figure 6 As shown, S104 includes S1041-S1043:
[0088] S1041, The upper-layer application of the first electronic device (e.g., PC Manager) controls the Bluetooth chip to scan Bluetooth broadcast messages through the second Bluetooth interface.
[0089] The upper-layer application of the first electronic device (e.g., PC Manager) controls the Bluetooth chip to scan for Bluetooth broadcast messages through the scanning method in the UWP Advertise interface of the second Bluetooth interface (e.g., the system Bluetooth interface).
[0090] S1042. The Bluetooth chip of the first electronic device sends a second Bluetooth broadcast message to the Bluetooth protocol stack. The Bluetooth protocol stack parses the second Bluetooth broadcast message to obtain the Bluetooth connection information of the second electronic device, and sends the Bluetooth connection information of the second electronic device to the upper layer application (e.g., PC Manager).
[0091] Because the second Bluetooth interface does not support configuring filtering rules for the Bluetooth chip, the Bluetooth chip reports each Bluetooth broadcast message it scans to the Bluetooth protocol stack in the kernel layer. The Bluetooth protocol stack processes the Bluetooth broadcast message to obtain Bluetooth connection-related information of the electronic device (e.g., the second electronic device) that sent the Bluetooth broadcast message. This Bluetooth connection-related information refers to the information required to establish a Bluetooth connection with the electronic device (e.g., the second electronic device) that sent the Bluetooth broadcast message. For example, this includes the identification information of the second electronic device. Other Bluetooth connection-related information is shown in Table 1.
[0092] S1043. If the identification information of the electronic device in the second Bluetooth broadcast message is the same as the identification information of the electronic device in the first Bluetooth broadcast message, then the upper-layer application of the first electronic device (e.g., PC Manager) controls the Bluetooth chip to stop scanning through the second Bluetooth interface, and controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface.
[0093] The identification information of the electronic device in the second Bluetooth broadcast message is the same as that in the first Bluetooth broadcast message. For example, both are the identification information of the second electronic device. This indicates that the second Bluetooth interface, which does not support filtering, also scanned Bluetooth broadcast messages that meet the filtering rules. Furthermore, the second Bluetooth interface has already created an object of the second electronic device in the memory space of the second Bluetooth interface, and a Bluetooth connection can be further established with the second electronic device based on the object of the second electronic device.
[0094] The upper-layer application (e.g., PC Manager) of the first electronic device controls the Bluetooth chip to stop scanning via the stop scanning method of the UWP Advertise interface of the second Bluetooth interface (e.g., the system Bluetooth interface), thereby reducing the power consumption of the first electronic device. The upper-layer application (e.g., PC Manager) controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device via the FromBluetoothAddressAsync method of the BluetoothLEDevice class of the second Bluetooth interface (e.g., the system Bluetooth interface).
[0095] In another possible implementation, such as Figure 7 As shown, S104 includes S1044-S1045:
[0096] S1044. The upper-layer application of the first electronic device (e.g., PC Manager) obtains Bluetooth connection-related information of the second electronic device from the first Bluetooth broadcast message.
[0097] Information regarding Bluetooth connectivity for the second electronic device is described in S1042 and will not be repeated here.
[0098] S1045. The upper-layer application of the first electronic device (e.g., PC Manager) creates an object of the second electronic device through the second Bluetooth interface based on the Bluetooth connection information of the second electronic device, and controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface.
[0099] Upper-layer applications (such as PC Manager) use the Bluetooth connection information of the second electronic device as input parameters to call the method for creating an electronic device object in the second Bluetooth interface, thereby creating an object of the second electronic device in the memory space of the second Bluetooth interface. Taking the BluetoothLEDevice object as an example, the content and meaning of the Bluetooth connection information are shown in Table 1.
[0100] Upper-layer applications (such as PC Manager) control the Bluetooth chip to establish a Bluetooth connection with the second electronic device through methods such as FromBluetoothAddressAsync of the BluetoothLEDevice class of the second Bluetooth interface (such as the system Bluetooth interface). Since an object of the second electronic device has already been created in the memory space of the first electronic device through the second Bluetooth interface, the upper-layer application (such as PC Manager) can obtain the object of the second electronic device through methods such as FromBluetoothAddressAsync, and further establish a Bluetooth connection with the second electronic device through methods such as FromBluetoothAddressAsync.
[0101] Table 1
[0102]
[0103]
[0104] Figure 7 The embodiments shown are relative to Figure 6 The implementation shown can directly utilize the Bluetooth connection information of the second electronic device after parsing the first Bluetooth broadcast message to create an object of the second electronic device and further establish a Bluetooth connection with the second electronic device. It is not necessary to rescan for Bluetooth broadcast messages through the second Bluetooth interface, which can further reduce the power consumption of the first electronic device.
[0105] like Figure 8 As shown, after the first electronic device (e.g., PC 101) and the second electronic device (e.g., mobile phone 102) establish a Bluetooth connection, the interface of the upper-layer application (e.g., PC Manager) of the first electronic device (e.g., PC 101) can display that the first electronic device (e.g., PC 101) and the second electronic device (e.g., mobile phone 102) have established a Bluetooth connection. For example, the first electronic device (e.g., PC 101) and the second electronic device (e.g., mobile phone 102) join a trust ring.
[0106] The Bluetooth connection method and electronic device provided in this application have several advantages. Firstly, during the scanning of Bluetooth broadcast messages, because the second Bluetooth interface does not support configuring filtering rules for the Bluetooth chip, if the second Bluetooth interface is used to control the Bluetooth chip to scan for Bluetooth broadcast messages, the Bluetooth chip will report all scanned Bluetooth broadcast messages, and the first electronic device will parse and process all Bluetooth broadcast messages, resulting in high power consumption for the first electronic device. However, the first Bluetooth interface supports configuring filtering rules for the Bluetooth chip. Based on the filtering rules, the Bluetooth chip reports first Bluetooth broadcast messages whose data falls within the valid data range of a preset domain. Other Bluetooth broadcast messages whose data does not meet the filtering rules are filtered out by the Bluetooth chip and not reported for further processing, thus reducing the power consumption of the first electronic device. Secondly, during the establishment of a Bluetooth connection with the second electronic device, because the first Bluetooth interface does not support establishing a Bluetooth connection, while the second Bluetooth interface does, after scanning a first Bluetooth broadcast message that meets the filtering rules through the first Bluetooth interface, the second Bluetooth interface controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device. In summary, the Bluetooth connection method can reduce the power consumption of an electronic device when scanning Bluetooth broadcast messages from other electronic devices and establishing a Bluetooth connection.
[0107] This application also provides a computer-readable storage medium including instructions that, when executed on the electronic device, cause the electronic device to perform the steps described in the method embodiments, such as executing... Figures 5-7 The method shown.
[0108] This application also provides a computer program product including instructions, which, when executed on the aforementioned electronic device, cause the electronic device to perform the various steps in the method embodiments described above, such as executing... Figures 5-7 The method shown.
[0109] The technical effects of computer-readable storage media and computer program products are described in the preceding method embodiments.
[0110] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0111] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0112] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0113] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.
[0114] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located on one device or distributed across multiple devices. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0115] In addition, the functional modules in the various embodiments of this application can be integrated into one device, or each module can exist physically separately, or two or more modules can be integrated into one device.
[0116] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A Bluetooth connection method, characterized in that, include: The first electronic device controls the Bluetooth chip to scan Bluetooth broadcast messages through the first Bluetooth interface; If the Bluetooth chip detects that the data in the preset field of the first Bluetooth broadcast message of the second electronic device satisfies the filtering rules of the preset field, then the Bluetooth chip sends the first Bluetooth broadcast message to the upper layer application through the first Bluetooth interface; The first electronic device controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface; Specifically, the first Bluetooth interface does not support establishing a Bluetooth connection, while the second Bluetooth interface does; the first Bluetooth interface supports configuring the filtering rules to the Bluetooth chip, while the second Bluetooth interface does not support configuring the filtering rules to the Bluetooth chip; the filtering rules are used to instruct the Bluetooth chip to report Bluetooth broadcast messages whose data in the preset domain is within the valid data range.
2. The method according to claim 1, characterized in that, Also includes: The first electronic device configures the enabling information of filtering rules for each preset domain to the Bluetooth chip through the first Bluetooth interface. The enabling information is used to indicate whether the filtering rules for the corresponding preset domain are effective.
3. The method according to claim 1 or 2, characterized in that, The first electronic device controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface, including: The first electronic device controls the Bluetooth chip to scan Bluetooth broadcast messages via the second Bluetooth interface; If the identification information of the electronic device in the second Bluetooth broadcast message is the same as the identification information of the electronic device in the first Bluetooth broadcast message, then the first electronic device controls the Bluetooth chip to stop scanning through the second Bluetooth interface; and controls the Bluetooth chip to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface.
4. The method according to claim 1 or 2, characterized in that, The step of controlling the Bluetooth chip to establish a Bluetooth connection with the second electronic device via the second Bluetooth interface includes: The first electronic device obtains the Bluetooth connection information of the second electronic device from the first Bluetooth broadcast message; Based on the Bluetooth connection information of the second electronic device, an object of the second electronic device is created through the second Bluetooth interface, and the Bluetooth chip is controlled to establish a Bluetooth connection with the second electronic device through the second Bluetooth interface.
5. The method according to any one of claims 1-4, characterized in that, The preset domain includes a manufacturer data-specific domain; The data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: The valid data range of the manufacturer data specific field is the value M, and the data of the manufacturer data specific field in the first Bluetooth broadcast message is also the value M. or, The effective data range of the manufacturer data specific field is the numerical interval [M1, M2], and the data of the manufacturer data specific field in the first Bluetooth broadcast message is the numerical value M, M∈[M1, M2].
6. The method according to any one of claims 1-5, characterized in that, The preset domain includes a service data specific domain; The data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: The effective data range of the service data specific field is the value M, and the data of the service data specific field in the first Bluetooth broadcast message is also the value M. or, The effective data range of the service data specific field is the numerical interval [M1, M2], and the data of the service data specific field in the first Bluetooth broadcast message is the numerical value M, M∈[M1, M2].
7. The method according to any one of claims 1-6, characterized in that, The preset field includes the Media Access Control (MAC) address field; The data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: The effective data range of the MAC address field is 6 bytes, and the 6-byte value of the MAC address field in the first Bluetooth broadcast message is the same as the 6-byte value of the effective data range of the MAC address field.
8. The method according to any one of claims 1-7, characterized in that, The preset field includes the device name field; The data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: The valid data range of the device name field includes at least one string, and the string of the device name field in the first Bluetooth broadcast message is the same as one string in the valid data range of the device name field.
9. The method according to any one of claims 1-8, characterized in that, The preset field includes a service identifier field; the data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: The valid data range of the service identifier field is the value N, and the data of the service identifier field in the first Bluetooth broadcast message is also the value N.
10. The method according to any one of claims 1-9, characterized in that, The preset field includes a manufacturer identifier field; the data in the preset field of the first Bluetooth broadcast message satisfies the filtering rules of the preset field, including: The valid data range of the manufacturer identifier field is the value N, and the data of the manufacturer identifier field in the first Bluetooth broadcast message is also the value N.
11. An electronic device, characterized in that, The device includes a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, the electronic device performs the method as described in any one of claims 1-10.
12. A computer-readable storage medium, characterized in that, Includes instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-10.