Bluetooth filter generation method, Bluetooth broadcast scanning method and electronic equipment
By generating a Bluetooth filter based on the first common mask based on the beacon ID, the problem of excessive resource occupancy in the prior art is solved, and more efficient Bluetooth broadcast recognition and power consumption are achieved.
Patent Information
- Application Number
- CN202311386686.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-24
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, in order to accurately identify target Bluetooth broadcasts, electronic devices need to set up multiple Bluetooth filters, resulting in excessive resource consumption.
By obtaining the beacon IDs of the multiple beacons, determining their first common mask, and generating a Bluetooth filter based on any one of the beacon IDs and the first common masks, reducing the number of set filters.
It effectively reduces the number of Bluetooth filters set in electronic devices, reduces power consumption, and improves the recognition efficiency of target Bluetooth broadcasts.
Smart Images

Figure CN119893627A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a method for generating a Bluetooth filter, a method for scanning a Bluetooth broadcast, and an electronic device. Background Art
[0002] As Bluetooth technology continues to mature, many public places (such as shopping malls, restaurants, etc.) now have Bluetooth beacons (Beacon). Bluetooth beacons will continuously send Bluetooth broadcasts to the surrounding environment. When an electronic device scans a Bluetooth broadcast, it will wake up the corresponding application software to provide users with services such as precision marketing. When an electronic device subscribes to multiple Bluetooth beacons, the electronic device needs to scan multiple Bluetooth broadcasts corresponding to the multiple Bluetooth beacons. Therefore, in order to accurately identify the target Bluetooth broadcast, the electronic device will set a Bluetooth filter for each subscribed Bluetooth beacon, resulting in excessive Bluetooth filter resources. Summary of the invention
[0003] The present application provides a method for generating a Bluetooth filter, a method for scanning a Bluetooth broadcast, and an electronic device, which solves the problem in the prior art of occupying too many Bluetooth filter resources in order to accurately identify a target Bluetooth broadcast.
[0004] In order to achieve the above objectives, this application adopts the following technical solutions:
[0005] In a first aspect, an embodiment of the present application provides a method for generating a Bluetooth filter, which is applied to an electronic device, the electronic device including multiple applications, and the multiple applications subscribing to multiple beacons. The method includes: obtaining a beacon ID of each beacon to obtain multiple beacon IDs; determining a first common mask of the multiple beacon IDs; and generating a Bluetooth filter according to any one of the multiple beacon IDs and the first common mask.
[0006] Through the method provided in this embodiment, the Bluetooth filter generated by the electronic device can match multiple beacon IDs, thereby effectively reducing the number of Bluetooth filters set in the electronic device.
[0007] In some embodiments, determining a first common mask of multiple beacon IDs includes: converting the multiple beacon IDs into binary strings respectively; and performing a bitwise AND operation on the binary strings of the multiple beacon IDs to obtain the first common mask.
[0008] In some embodiments, the effective number of bits of the first common mask is less than or equal to the length of the binary string of the multiple beacon IDs; wherein the effective number of bits of the first common mask is the number of bits with a value of 1 in the binary string of the first common mask.
[0009] In some embodiments, the beacon ID includes a namespace identifier Name Space ID and an instance identifier Instance ID; or, the beacon ID includes a proximity universal unique identifier Proximity UUID, a major value Major, and a minor value Minor.
[0010] In a second aspect, an embodiment of the present application provides a scanning method for Bluetooth broadcasts, which is applied to electronic devices. The method includes: receiving a Bluetooth broadcast, which carries a beacon ID; using a Bluetooth filter to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast, and the Bluetooth filter is generated according to the method shown in the first aspect above.
[0011] Through the method provided in this embodiment, after receiving a Bluetooth broadcast, the electronic device will use the Bluetooth filter generated by the method shown in the first aspect above to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast. Since the Bluetooth filter can match multiple beacon IDs, the number of Bluetooth filters set in the electronic device can be effectively reduced.
[0012] In some embodiments, a Bluetooth filter is used to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast, including: converting the beacon ID carried by the Bluetooth broadcast and the beacon ID in the Bluetooth filter into binary strings respectively; performing a bitwise AND operation on the binary string of the beacon ID carried by the Bluetooth broadcast and the binary string of the beacon ID in the Bluetooth filter to obtain a second common mask, which is a binary string; if the number of valid bits in the second common mask is greater than or equal to the number of valid bits in the first common mask, it is determined that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter, and the Bluetooth broadcast is retained; wherein the number of valid bits in the second common mask is the number of bits with a value of 1 in the binary string of the second common mask.
[0013] Through the method provided in this embodiment, only when the number of valid bits in the second common mask is greater than or equal to the number of valid bits in the first common mask, it is determined that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter. Therefore, it is possible to effectively shield the interference of irrelevant beacons and prevent the application from being woken up by mistake, thereby reducing the power consumption of electronic devices.
[0014] In some embodiments, after determining that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter and retaining the Bluetooth broadcast, the method further includes: sending the Bluetooth broadcast to a corresponding application according to the beacon ID carried by the Bluetooth broadcast.
[0015] In some embodiments, after sending the Bluetooth broadcast to the corresponding application according to the beacon ID carried by the Bluetooth broadcast, the method also includes: obtaining business information carried by the Bluetooth broadcast; and displaying the business information to achieve precise marketing services for users.
[0016] In some embodiments, the method also includes: if the number of valid bits in the second common mask is less than the number of valid bits in the first common mask, determining that the beacon ID carried by the Bluetooth broadcast does not match the Bluetooth filter, and discarding the Bluetooth broadcast, thereby reducing the storage space occupied inside the electronic device.
[0017] In a third aspect, an embodiment of the present application provides a device for generating a Bluetooth filter, which is applied to an electronic device, wherein the electronic device includes multiple applications, and the multiple applications subscribe to multiple beacons. The generating device includes: an acquisition module: used to obtain the beacon ID of each beacon to obtain multiple beacon IDs; a determination module: used to determine a first common mask of multiple beacon IDs; a generation module: used to generate a Bluetooth filter based on any one beacon ID among the multiple beacon IDs and the first common mask.
[0018] In a fourth aspect, an embodiment of the present application provides a scanning device for Bluetooth broadcast, which is applied to an electronic device. The scanning device includes: a receiving module: used to receive Bluetooth broadcast, and the Bluetooth broadcast carries the beacon ID of the beacon; a scanning module: used to use a Bluetooth filter to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast, and the Bluetooth filter is generated according to the method in the first aspect mentioned above.
[0019] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; one or more memories; and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to execute the method shown in the first aspect above or the method shown in the second aspect above.
[0020] In a sixth aspect, an embodiment of the present application provides a chip, comprising a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method shown in the first aspect or the method shown in the second aspect is implemented.
[0021] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method shown in the first aspect or the method shown in the second aspect.
[0022] In an eighth aspect, an embodiment of the present application provides a computer program product, in which a computer program is stored. When the computer program is executed by an electronic device, the electronic device can execute the method shown in the first aspect or the method shown in the second aspect.
[0023] It can be understood that the beneficial effects of the third to eighth aspects mentioned above can be found in the relevant descriptions of the first and second aspects mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of the structure of the Bluetooth broadcast provided in the embodiment of the present application;
[0025] Figure 2 A schematic diagram of a beacon communication system provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0027] Figure 4 A software structure block diagram of an electronic device provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of a scenario of a beacon precision marketing service provided in an embodiment of the present application;
[0029] Figure 6 A schematic diagram of an interface of an electronic device provided in an embodiment of the present application;
[0030] Figure 7 A schematic diagram of a scenario in which a beacon unlocks a car door according to an embodiment of the present application;
[0031] Figure 8 A schematic diagram of an electronic device subscribing to a beacon provided in an embodiment of the present application;
[0032] Fig. 9 A schematic diagram of a process for generating a Bluetooth filter by an electronic device provided in an embodiment of the present application;
[0033] Fig.10 A schematic diagram of a process of an electronic device calling back a Bluetooth broadcast provided in an embodiment of the present application;
[0034] Fig.11 A schematic diagram of an electronic device scanning a Bluetooth broadcast provided in an embodiment of the present application;
[0035] Fig.12 A schematic diagram of a Bluetooth broadcast of an electronic device scanning a beacon B provided in an embodiment of the present application;
[0036] Fig.13 is a schematic diagram of the structure of a device for generating a Bluetooth filter provided in an embodiment of the present application;
[0037] Fig.14 It is a structural schematic diagram of a scanning device for Bluetooth broadcasting provided in an embodiment of the present application;
[0038] Fig.15It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The technical solution provided in the embodiments of the present application is described below with reference to the accompanying drawings.
[0040] It should be understood that in the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0041] In this embodiment, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0042] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method part of the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0043] A Bluetooth beacon is a physical device based on Bluetooth low energy (BLE) technology, which can also be called a beacon or a beacon device. With the continuous maturity and development of Bluetooth technology, beacons have been widely used in indoor positioning, geo-fencing, precision marketing, and touchless car keys. For example, by setting up beacons in public places such as shopping malls, restaurants, scenic spots, and underground parking lots, beacons can provide users with a series of precision marketing services such as product introductions, food introductions, scenic spot introductions, and parking space searches, thereby improving user experience.
[0044] Beacons establish communication connections with other electronic devices by sending Bluetooth broadcasts. Currently, the broadcast protocols used by beacons mainly include EddyStone, AltBeacon and iBeacon.
[0045] iBeacon is a "new low-power, low-cost signal transmitter that can be detected by nearby handheld electronic devices" and a set of protocols that can be used for indoor positioning systems.
[0046] Eddystone is a protocol standard based on Bluetooth low energy.
[0047] AltBeacon is a protocol standard released by the remote authentication dial inuser service network (radius network).
[0048] like Figure 1 As shown, the Bluetooth broadcast sent by the beacon usually includes: Access Address, BLE Advertising PDU (BLE Broadcast Protocol Data Unit) and CRC (Cyclic Redundancy Check), among which, BLE Advertising PDU includes: Header, ADV Address, Flags and ADV Data. Among them, Access Address occupies 4 bytes, Header occupies 2 bytes, ADV Address occupies 6 bytes, Flags occupies 3 bytes, and CRC occupies 3 bytes. In addition, the number of bytes occupied by the broadcast data varies depending on the broadcast communication protocol.
[0049] In the iBeacon protocol, see Figure 1 As shown in the figure, BLE Advertising PDU includes: Length, Type, Company ID, Beacon Type, Proximity UUID, Major, Minor, Power, etc. Among them, Length occupies 1 Byte, Type occupies 1 Byte, Company ID occupies 2 Bytes, Beacon Type occupies 2 Bytes, Proximity UUID occupies 16 Bytes, Major occupies 2 Bytes, Minor occupies 2 Bytes, Power occupies 1 Byte.
[0050] Among them, Major is used to distinguish a group of associated beacons; Minor is used to identify beacons. It is understandable that electronic devices need to identify the universal unique identifier UUID when scanning Bluetooth broadcasts. Usually, the UUIDs of products from the same company are consistent.
[0051] It should be noted that in the iBeacon protocol, the distance of the beacon can be expressed as Proximity, where Proximity is an enumeration value. Enumeration is a fixed type, and an enumeration corresponds to several defined values, which are called enumeration values. For example, the enumeration of week is defined, and it has seven values, from Monday to Sunday, and each of these seven is called an enumeration value.
[0052] In addition, in the iBeacon protocol, Company ID and Beacon Type are both fixed values. For example, the fixed value of Company A's Company ID is 4C00, and the fixed value of Beacon Type is 0215; the fixed value of Company B's Company ID is 027D, and the fixed value of Beacon Type is 0215.
[0053] In the AltBeacon protocol, see Figure 1 As shown in the figure, BLE Advertising PDU includes: Length, Type, MfgID (factory identification), Beacon Code (beacon code), Beacon ID (beacon identification), Ref RSSI (reference signal strength) and Mfg RSVD (factory reserved). Among them, Length occupies 1 Byte, Type occupies 1 Byte, Mfg ID occupies 2 Bytes, BeaconCode occupies 2 Bytes, Beacon ID occupies 20 Bytes, Ref RSSI occupies 1 Byte, and Mfg RSVD occupies 1 Byte.
[0054] In the Eddystone protocol, see Figure 1 As shown in the figure, BLE Advertising PDU includes: Services (security services), Length, Type, UUID (universally unique identifier) and EDDYSTONE FRAME (Eddystone protocol framework). Among them, Length, Type and UUID occupy 4 bytes in total, Services occupy 4 bytes, and EDDYSTONE FRAME occupies 20 bytes.
[0055] like Figure 1 As shown, EDDYSTONE FRAME includes: UID (unique beacon identifier), EID (encrypted temporary identifier), URL (broadcast URL), and TLM (broadcast own data).
[0056] See also Figure 1As shown, UID includes: Type, Power, Names Space ID (namespace identifier), Instance ID (instance identifier) and RFU (reserved). Among them, Type occupies 1 Byte, Power occupies 1 Byte, Names Space ID occupies 10 Bytes, Instance ID occupies 6 Bytes, and RFU occupies 1 Byte.
[0057] EID includes: Type, Power, Ephemeral Identifiery (encrypted temporary identifier data) and NotUsed (identifier prohibited from use). Among them, Type occupies 1 Byte, Power occupies 1 Byte, and Ephemeral Identifiery occupies 8 Bytes.
[0058] URL includes: Type, Power, Prefix (webpage prefix) and Encoded URL (website URL). Among them, Type occupies 1 Byte, Power occupies 1 Byte, Prefix occupies 1 Byte, and Encoded URL occupies 17 Bytes.
[0059] TLM includes: Type, Version, Battery, Temperature, PDU Count, Time, and Not Used. Type occupies 1 Byte, Version occupies 1 Byte, Battery occupies 2 Bytes, Temperature occupies 2 Bytes, PDU Count occupies 4 Bytes, and Time occupies 4 Bytes.
[0060] The beacon identification (ID) is a unique identifier for each beacon. The composition of the beacon ID is usually different in different beacon broadcast protocols. The details are as follows.
[0061] In the AltBeacon protocol, see Figure 1 As shown, the beacon ID includes a Beacon ID part.
[0062] In the Eddystone protocol, see Figure 1 As shown, the beacon ID includes the Name Space ID and the Instance ID.
[0063] In the iBeacon protocol, see Figure 1 As shown, the beacon ID includes Proximity UUID, Major, and Minor.
[0064] Figure 2 Schematic diagram of a beacon communication system provided in an embodiment of the present application. Figure 2 As shown, the communication system includes a beacon and an electronic device, the beacon provides a beacon service, the electronic device subscribes to the service provided by the beacon, and sets a Bluetooth filter according to the beacon ID of the beacon. During operation, the beacon continuously sends Bluetooth broadcasts to the surrounding area, and the Bluetooth broadcasts carry the beacon ID. At the same time, electronic devices with Bluetooth function turned on will also continuously scan and filter Bluetooth broadcasts according to the Bluetooth filter to obtain the target Bluetooth broadcast carrying the beacon ID. After the electronic device scans the target Bluetooth broadcast, it will wake up the application software corresponding to the target Bluetooth broadcast to provide accurate services to users.
[0065] For example, when an electronic device scans a Bluetooth broadcast sent by a beacon in a shopping mall, it will wake up the shopping software corresponding to the Bluetooth broadcast and provide users with services about product introductions; or, when an electronic device scans a Bluetooth broadcast sent by a beacon in a scenic area, it will wake up the entertainment software corresponding to the Bluetooth broadcast and provide users with services about scenic spot introductions.
[0066] It should be noted that, in addition to proprietary beacons that can send Bluetooth broadcasts, mainstream electronic devices on the market, such as electric bicycles, new energy vehicles, mobile phones, and tablet computers, can also send Bluetooth broadcasts. In other words, a beacon can be an independently set electronic device, or a module or device integrated in other electronic devices, and the embodiments of the present application do not limit this.
[0067] In addition, in the embodiments of the present application, the electronic device may be a mobile phone, a tablet computer (Pad), a wearable device (such as a smart watch), a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA) and other terminal devices, and the embodiments of the present application are not limited to this.
[0068] The electronic device involved in the embodiments of the present application is exemplarily introduced below.
[0069] Figure 3 Schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. Figure 3As shown, the electronic device may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an earphone interface 370D, a sensor module 380, a button 390, a motor 391, an indicator 392, a camera 393, a display screen 394, and a subscriber identification module (SIM) card interface 395, etc. The sensor module 380 may include a pressure sensor 380A, a gyroscope sensor 380B, an air pressure sensor 380C, a magnetic sensor 380D, an acceleration sensor 380E, a distance sensor 380F, a proximity light sensor 380G, a fingerprint sensor 380H, a temperature sensor 30J, a touch sensor 380K, an ambient light sensor 380L, a bone conduction sensor 380M, etc.
[0070] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0071] The processor 310 may include one or more processing units, for example: the processor 310 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 memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the electronic device. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0072] The processor 310 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 310 is a cache memory. The memory may store instructions or data that the processor 310 has just used or cyclically used. If the processor 310 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 310, and thus improves the efficiency of the system.
[0073] In some embodiments, the processor 310 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0074] The charging management module 340 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 340 can receive charging input from a wired charger through the USB interface 320. In some wireless charging embodiments, the charging management module 340 can receive wireless charging input through a wireless charging coil of the electronic device. While the charging management module 340 is charging the battery 342, it can also power the electronic device through the power management module 341.
[0075] The power management module 341 is used to connect the battery 342, the charging management module 340 and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340, and supplies power to the processor 310, the internal memory 321, the external memory, the display screen 394, the camera 393, and the wireless communication module 360. The power management module 341 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc.
[0076] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, modem processor and baseband processor.
[0077] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0078] The mobile communication module 350 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 350 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
[0079] In some embodiments, at least some functional modules of the mobile communication module 350 may be disposed in the processor 310. In some embodiments, at least some functional modules of the mobile communication module 350 and at least some modules of the processor 310 may be disposed in the same device.
[0080] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate 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. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio playback device (not limited to a speaker 370A, a receiver 370B, etc.), or displays an image or video through a display screen 394. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 310 and be set in the same device as the mobile communication module 350 or other functional modules.
[0081] The wireless communication module 360 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to electronic devices. The wireless communication module 360 can be one or more devices integrating at least one communication processing module. The wireless communication module 360 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 310. The wireless communication module 360 can also receive the signal to be sent from the processor 310, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0082] In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 350, and the antenna 2 is coupled to the wireless communication module 360, so that the electronic device can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).
[0083] The electronic device implements the display function through a GPU, a display screen 394, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 310 may include one or more GPUs that execute program instructions to generate or change display information.
[0084] The camera 393 is used to capture still images or videos. In some embodiments, the electronic device may include 1 or N cameras 393, where N is a positive integer greater than 1.
[0085] The display screen 394 is used to display images, videos, etc., such as various types of device management interfaces in the embodiments of the present application. The display screen 394 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 394, where N is a positive integer greater than 1.
[0086] The external memory interface 320 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 310 through the external memory interface 320 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0087] The internal memory 321 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 310 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 321. The internal memory 321 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area may store data created during the use of the electronic device (such as audio data, a phone book, etc.).
[0088] In addition, the internal memory 321 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0089] The electronic device can implement audio functions through the audio module 370, the speaker 370A, the receiver 370B, the microphone 370C, the headphone interface 370D, and the application processor.
[0090] The audio module 370 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 370 can also be used to encode and decode audio signals. In some embodiments, the audio module 370 can be arranged in the processor 310, or some functional modules of the audio module 370 can be arranged in the processor 310.
[0091] The speaker 370A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device can listen to music or listen to hands-free calls through the speaker 370A. For example, the speaker can play the comparison analysis results provided in the embodiment of the present application.
[0092] The receiver 370B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device receives a call or voice message, the voice can be received by placing the receiver 370B close to the human ear.
[0093] Microphone 370C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by putting his mouth close to the microphone 370C to input the sound signal into the microphone 370C. The electronic device can be provided with at least one microphone 370C. In other embodiments, the electronic device can be provided with two microphones 370C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device can also be provided with three, four or more microphones 370C to realize the collection of sound signals, noise reduction, identification of sound sources, and realization of directional recording function, etc.
[0094] In some embodiments, the electronic device may receive an ultrasonic signal sent by another electronic device through the microphone 370C, and identify the frequency and reception strength of the ultrasonic signal through the processor 310 .
[0095] The earphone interface 370D is used to connect a wired earphone and can be a USB interface 320 or a 2.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0096] The key 390 includes a power key, a volume key, etc. The key 390 can be a mechanical key or a touch key. The electronic device can receive key input and generate key signal input related to user settings and function control of the electronic device.
[0097] Motor 391 can generate vibration prompts. Motor 391 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. Motor 391 can also correspond to different vibration feedback effects for touch operations acting on different areas of the display screen 394.
[0098] Indicator 392 may be an indicator light, which may be used to indicate the charging status of the electronic device, changes in power level, messages, missed calls, notifications, etc.
[0099] The SIM card interface 395 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device by inserting the SIM card interface 395 or removing the SIM card from the SIM card interface 395. The electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 395 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 395 at the same time. The types of the multiple cards can be the same or different.
[0100] The following is an exemplary introduction to the software architecture of the electronic device involved in this application.
[0101] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. Among them, the layered architecture divides the software into several layers, each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces. Taking the system as an example, the software structure of the electronic device is illustrated.
[0102] Figure 4 is a software structure block diagram of the electronic device provided in the embodiment of the present application. Figure 4 As shown, in In the system, the software architecture of the electronic device includes four layers, namely, the application layer, the service layer, the application framework layer and the hardware layer from top to bottom.
[0103] The application layer may include a series of application packages. For example, Figure 4 As shown, the application layer may include application packages corresponding to applications such as wallet, video, gallery, navigation, Bluetooth, music, etc., which are not limited in this embodiment of the present application.
[0104] In the application layer, some applications (also called apps) can subscribe to beacons by integrating near-field data communication (nearby software development kit, Nearby SDK). Among them, NearbySDK is a development kit provided to developers by the near-field communication service Nearby Service, and its NearbySDK provides an interface to support developers to subscribe to beacons through Nearby Service.
[0105] It should be noted that subscribing to a beacon can be understood as the application agreeing to establish a communication connection with the beacon to receive data sent by the beacon.
[0106] The service layer may include multiple functional modules, such as a subscription module, a Bluetooth scanning task module, and a filter merging module.
[0107] Among them, the subscription module is used to receive and record the subscription relationship between the application and the beacon. For example, the subscription module can receive and record the subscription relationship from application A subscribing to beacon A, or receive and record the subscription relationship from application A subscribing to beacon A, beacon B and beacon C, or receive and record the subscription relationship of application A subscribing to beacon A, application B subscribing to beacon B and application C subscribing to beacon C, and the embodiment of the present application does not limit this. The Bluetooth scanning task module is used to receive the broadcast signal called back by the hardware (such as a Bluetooth chip) and the subscription relationship issued by the subscription module, send the beacon ID corresponding to the multiple beacons in the subscription relationship as a parameter to the filter merging module, and set the Bluetooth filter on the Bluetooth chip so that the Bluetooth chip starts the scanning task. The filter merging module is used to generate a Bluetooth filter based on the received multiple beacon IDs, and return the Bluetooth filter to the Bluetooth scanning task module.
[0108] The application framework layer, i.e., the operating system (OS) framework, provides an application programming interface (API) and a programming framework for the applications in the application layer, such as providing a Bluetooth call interface for Bluetooth. The application framework layer includes some predefined functions.
[0109] For example, Figure 4As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, and the like. Among them, the window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether the screen has a status bar, or participate in the execution of operations such as locking the screen and capturing the screen. The content provider is used to store and obtain data and make the data accessible to the application. The stored data may include video data, image data, audio data, and the like, and may also include call record data for dialing and receiving, user browsing history and bookmarks, and other data, which will not be repeated here. The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and the like. The view system can be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a marketing notification icon may include a view for displaying text and a view for displaying pictures.
[0110] The hardware layer may include hardware modules such as Bluetooth chips and Wi-Fi chips. Among them, the Bluetooth chip can perform specific scanning tasks according to the Bluetooth filter. The Wi-Fi chip can be connected to the microcontroller through the serial port to receive or output data.
[0111] The following describes the process of a beacon providing a beacon service to an electronic device in combination with the architecture of the beacon communication system and the hardware and software architecture of the electronic device.
[0112] It is understandable that, when an application installed on an electronic device subscribes to a certain beacon, when a user carries the electronic device into the broadcast range of the beacon, the electronic device will wake up the application to provide accurate services to the user.
[0113] Next, the application scenarios of beacons providing users with precision marketing services and unlocking car doors are introduced as examples. It should be understood that the embodiments of the present application are not limited to the above application scenarios, and may also include business processes implemented by other Bluetooth functions, such as indoor positioning, etc., which are not limited in the embodiments of the present application.
[0114] Figure 5 Schematic diagram of a beacon precision marketing service scenario provided by an embodiment of the present application. Figure 5As shown, when application A (such as a wallet) installed on an electronic device subscribes to beacon X (such as a beacon at a gas station), when a user carries the electronic device into a gas station and is within the broadcast range of beacon X, the Bluetooth chip can scan the Bluetooth broadcast continuously sent by beacon X, and match the beacon ID of beacon X carried by the Bluetooth broadcast with the set filter. If the match is successful, the Bluetooth chip will call back the matching result and the Bluetooth broadcast to the service layer, so that the service layer wakes up application A according to the recorded subscription relationship, so that the electronic device can display marketing information about the gas station to the user. In the above process, the user does not need to manually operate application A on the electronic device, that is, to provide users with accurate marketing services. For details, please refer to Figure 6 shown.
[0115] Figure 7 is a schematic diagram of a scenario in which a beacon unlocks a car door provided in an embodiment of the present application. Figure 7 As shown, when application B (such as a vehicle management application) installed on an electronic device subscribes to beacon Y (such as a beacon of a vehicle), when a user carries the electronic device into the broadcast range of the vehicle, the Bluetooth chip can scan the Bluetooth broadcast continuously sent by the car, and match the beacon ID corresponding to beacon Y carried by the Bluetooth broadcast with the set filter. If the match is successful, the Bluetooth chip will call back the matching result and the Bluetooth broadcast to the service layer, so that the service layer wakes up application B according to the recorded subscription relationship, thereby enabling application B to establish a Bluetooth link with beacon Y and provide the user with the service of unlocking the car door.
[0116] It is understandable that an electronic device usually needs to scan multiple Bluetooth broadcasts corresponding to multiple beacons. Therefore, in order to accurately identify the target Bluetooth broadcast, a Bluetooth filter set in the electronic device is used to identify the scanned Bluetooth broadcast.
[0117] Taking the iBeacon protocol as an example, the mapping relationship between the interface parameters and the protocol in the Bluetooth filter is as follows:
[0118] Manufacturer Id corresponds to Company ID.
[0119] Manufacturer Data corresponds to Beacon Type + Beacon ID (UUID + Major + Minor).
[0120] Manufacturer Data Mask manufacturer Data Mask (optional) corresponds to the mask of manufacturer Data.
[0121] Typically, Bluetooth filters are constructed in two ways:
[0122] The first one:
[0123] Set by beacon ID: The manufacturer Data field is set to Beacon Type and beacon ID, and the mask is not set or all values in the mask are set to 1.
[0124] In the first case: the electronic device identifies the scanned Bluetooth broadcast, and when it is determined that the beacon ID carried in the Bluetooth broadcast matches each field in manufacturerData, it can be considered that the beacon ID matches the Bluetooth filter, that is, the Bluetooth broadcast is determined to be a target Bluetooth broadcast.
[0125] Second type:
[0126] According to the protocol header setting: the manufacturer data field is set to Beacon Type only, and the mask value is 0xFFFF.
[0127] In the second case: the electronic device identifies the scanned Bluetooth broadcast, and when it is determined that the beacon ID carried in the Bluetooth broadcast matches the Beacon Type, it can be considered that the beacon ID matches the Bluetooth filter, that is, the Bluetooth broadcast is determined to be a target Bluetooth broadcast.
[0128] Therefore, when an electronic device scans a Bluetooth broadcast by a beacon ID, it can only scan the Bluetooth broadcast corresponding to the specified beacon. If the application software wants to scan multiple Bluetooth broadcasts corresponding to multiple different beacons, it needs to set a Bluetooth filter for each beacon ID on the electronic device, which will occupy too many filter resources. However, the number of filters of an electronic device is usually 32. When all of them are occupied, other application software will not be able to use Bluetooth to communicate with other electronic devices; if the electronic device uses the protocol header scanning, under the same broadcast protocol, the electronic device will wake up the application processor when it scans any Bluetooth broadcast, which will cause the power consumption of the electronic device to be too high.
[0129] To this end, an embodiment of the present application provides a method for generating a Bluetooth filter and a method for scanning a Bluetooth broadcast, which can effectively reduce the number of filters set in an electronic device and prevent the application processor from being awakened by irrelevant Bluetooth broadcasts, thereby reducing the power consumption of the electronic device.
[0130] The following describes the generation of Bluetooth filters and the scanning process of Bluetooth broadcasts in the case of the iBeacon protocol, in combination with the architecture of the beacon communication system and the hardware and software architecture of the electronic device.
[0131] (I) Beacon subscription process
[0132] In an embodiment of the present application, the subscription module can receive and record the subscription relationship between multiple applications and beacons, and send the subscription relationship to the Bluetooth scanning task module.
[0133] It is understandable that each beacon corresponds to a unique beacon ID, so multiple applications can complete beacon subscription by subscribing to the beacon ID through their corresponding multiple application packages, so that the application recognizes the establishment of a communication connection with the beacon to receive the data sent by the beacon.
[0134] The beacon subscription process is described below in conjunction with beacon A, beacon B, and beacon C. Taking the beacon ID including UUID, Major, and Minor as an example, the beacon IDs of beacon A, beacon B, and beacon C are specifically shown in Table 1 below.
[0135] Table 1
[0136]
[0137] See also Figure 8 As shown, when the application packages corresponding to application A, application B, and application C respectively subscribe to the beacon ID of different beacons A, beacon ID of beacon B, and beacon ID of beacon C through the Nearby SDK, the subscription module will receive and record the subscription relationship of application A subscribing to beacon A, application B subscribing to beacon B, and application C subscribing to beacon C, and send the beacon ID of the beacon subscribed by the above applications to the Bluetooth scanning task module. Exemplarily, the subscription relationship is specifically shown in Table 2 below. The application ID in Table 2 can be the unique ID of the application.
[0138] Table 2
[0139] App ID Application package name Beacon ID ID(A) com.application.a FA85B431D702C96E406957FCE2B318ADC954FDE2 ID(B) com.application.b A4D91EB70F58C623D17E439FA68B05C2E6A7F01B ID(C) com.application.c F3B071CD682E9A450FD3BA74129CE85637AC86E0
[0140] (II) The process of generating Bluetooth filters
[0141] In an embodiment of the present application, the Bluetooth scanning task module passes the multiple beacon IDs received from the subscription module as parameters to the filter merging module, so that the filter merging module generates a Bluetooth filter based on the multiple beacon IDs.
[0142] The following takes beacon A subscribed by application A, beacon B subscribed by application B, and beacon C subscribed by application C as examples to explain the process of generating Bluetooth filters in detail:
[0143] like Figure 8As shown, when the Bluetooth scanning task module receives the beacon ID of beacon A, the beacon ID of beacon B and the beacon ID of beacon C sent by the subscription module, the Bluetooth scanning task module will pass the beacon IDs corresponding to beacon A, beacon B and beacon C as parameters to the filter merging module, so that the filter merging module generates Bluetooth filters for beacon A, beacon B and beacon C based on the beacon IDs corresponding to beacon A, beacon B and beacon C.
[0144] like Fig. 9 As shown, the specific steps of the filter merging module to generate Bluetooth filters are as follows:
[0145] S901: Acquire the beacon ID of each beacon to obtain multiple beacon IDs.
[0146] In this embodiment, the filter merging module receives the beacon ID of beacon A, the beacon ID of beacon B, and the beacon ID of beacon C sent by the subscription module.
[0147] S902: Determine a first common mask for multiple beacon IDs.
[0148] In the embodiment of the present application, the filter merging module will first convert the beacon ID of beacon A, the beacon ID of beacon B, and the beacon ID of beacon C into binary strings respectively.
[0149] Exemplarily, the binary character strings converted from the beacon ID of beacon A, the beacon ID of beacon B, and the beacon ID of beacon C are specifically shown in Table 3 below.
[0150] Table 3
[0151]
[0152] It should be noted that the lengths of beacon ID-A, beacon ID-B and beacon ID-C are all 20 bytes, so the character string obtained after conversion is a 160-bit binary character string.
[0153] Next, the filter merging module performs a "bitwise AND" operation on the binary strings of the above three beacon IDs to obtain a 160-bit binary string, namely the first common mask. The "bitwise AND" operation is to AND the corresponding binary bits of the two numbers involved in the operation. Only when the corresponding two binary bits are both 1, the result bit is 1.
[0154] It can be understood that the first common mask obtained after the “bitwise AND” operation is a binary string, as shown in Table 4 below.
[0155] Table 4
[0156]
[0157] In the embodiment of the present application, the number of bits with a value of 1 in the first common mask is the effective number of bits of the first common mask (ie, the number of bits with three binary bits all being 1).
[0158] It can be seen from Table 4 above that the effective number of bits of the first common mask is 26 bits.
[0159] In this embodiment, the effective number of bits of the first common mask of the Bluetooth filter is 26 bits. For any random beacon ID, the probability of matching the Bluetooth filter is 1 / 2. 26 Therefore, the Bluetooth filter generation method and scanning method provided in the embodiments of the present application can effectively shield the interference of irrelevant beacons and prevent applications from being woken up by mistake, thereby reducing the power consumption of electronic devices.
[0160] It can be understood that, based on the first common mask of the binary string, the first common mask of the hexadecimal string can be obtained, as shown in Table 5 below.
[0161] Table 5
[0162] name Hexadecimal string First common mask A08210010081A09020400214BC0020000048004
[0163] S903: Generate a Bluetooth filter according to any one beacon ID among the multiple beacon IDs and the first common mask.
[0164] In an embodiment of the present application, the filter merging module can generate a Bluetooth filter based on any one of beacon IDs among beacon ID-A, beacon ID-B and beacon ID-C and the first common mask, which is not limited in this embodiment of the present application.
[0165] Exemplarily, the filter merging module may generate a Bluetooth filter according to the beacon ID-A and the first common mask, that is, generate a Bluetooth filter according to FA85B431D702C96E406957FCE2B318ADC954FDE2 and A08210010081A09020400214BC0020000048004.
[0166] As can be seen from the foregoing, Company A's Company ID is a fixed value of 4C00, and Beacon Type is a fixed value of 0215. In the embodiment of the present application, the Bluetooth filter generated by the filter merging module may also include: masks of Company ID and Beacon Type, such as mask FFFF corresponding to Company A's Company ID 4C00 and mask FFFF corresponding to Beacon Type 0215.
[0167] The Bluetooth filter finally generated by the filter merging module is shown in Table 6 below.
[0168] Table 6
[0169]
[0170] like Figure 8 As shown, after the filter merging module generates the above Bluetooth filter, it returns the Bluetooth filter to the Bluetooth scanning module, so that the Bluetooth scanning module sends the received Bluetooth filter to the Bluetooth chip, thereby enabling the Bluetooth chip to start a scanning task according to the Bluetooth filter.
[0171] (III) Beacon discovery callback process
[0172] In an embodiment of the present application, when the electronic device scans the Bluetooth broadcast sent by the beacon, it will parse the beacon ID carried by the Bluetooth broadcast and match it with the set Bluetooth filter.
[0173] Next, combine Fig.10 As shown, the matching process of the beacon ID carried by the Bluetooth broadcast and the Bluetooth filter by the electronic device is described in detail:
[0174] S1001: Scanning the Bluetooth broadcast sent by the beacon based on the Bluetooth filter.
[0175] It is understandable that beacon A, beacon B and beacon C will continue to send Bluetooth broadcasts. Based on this, for example Fig.11 As shown, assuming that the user enters the Bluetooth broadcast range of beacon B, the Bluetooth chip will scan the Bluetooth broadcast corresponding to beacon B.
[0176] In the embodiment of the present application, the Bluetooth broadcast of the beacon B scanned by the Bluetooth chip can be found in Fig.12 ,like Fig.12 As shown, 0X4C is the Company ID, 0X0215 is the Beacon Type, and A4D91EB70F58C623D17E439FA68B05C2E6A7F01B is the beacon ID, that is, beacon B.
[0177] It should be noted that, in this embodiment, for ease of reading, the fixed value 4C00 of Company ID can be abbreviated to 4C. Fig.12 The 0X in is a hexadecimal identifier.
[0178] S1002: Analyze the Bluetooth broadcast and obtain the beacon ID.
[0179] For example, the Bluetooth chip parses the Bluetooth broadcast of beacon B and obtains beacon ID-B: A4D91EB70F58C623D17E439FA68B05C2E6A7F01B.
[0180] S1003: Convert the parsed beacon ID and the beacon ID in the Bluetooth filter into binary strings respectively.
[0181] For example, the beacon ID-B parsed by the Bluetooth chip and the beacon ID-A in the Bluetooth filter are converted into binary strings respectively. Take the beacon ID-A and beacon ID-B as shown in Table 7 as an example, and the converted binary strings are specifically shown in Table 8 below.
[0182] Table 7
[0183] Beacon ID Name UUID Major Minor Beacon ID-A FA85B431D702C96E406957FCE2B318AD C954 FDE2 Beacon ID-B A4D91EB70F58C623D17E439FA68B05C2 E6A7 F01B
[0184] Table 8
[0185]
[0186] S1004: Perform a “bitwise AND” operation on the binary string of the beacon ID obtained by parsing and the binary string of the beacon ID in the Bluetooth filter to obtain a second common mask.
[0187] For example, after the Bluetooth chip performs a “bitwise AND” operation on the binary strings of beacon ID-A and beacon ID-B in Table 8 above, a second common mask as shown in Table 9 below is obtained.
[0188] Table 9
[0189]
[0190] As can be seen from Table 9, the effective number of bits of the second common mask is 80. In the embodiment of the present application, the number of bits with a value of 1 in the second common mask is the effective number of bits of the second common mask (ie, the number of bits with both 2 binary bits being 1).
[0191] S1005: Determine whether the number of significant digits of the first common mask is a subset of the number of significant digits of the second common mask.
[0192] It should be noted that the specific process of determining whether the number of valid digits of the first common mask is a subset of the number of valid digits of the second common mask is as follows:
[0193] The Bluetooth chip will compare the effective number of bits of the first common mask with the effective number of bits of the second common mask. If the effective number of bits in the second common mask is greater than or equal to the effective number of bits in the first common mask, it will determine that the effective number of bits in the first common mask is a subset of the effective number of bits in the second common mask, that is, the beacon ID matches the Bluetooth filter.
[0194] For example, the Bluetooth chip compares the effective number of bits of the first common mask in Table 9 above with the effective number of bits of the second common mask. Since the effective number of bits of the second common mask is 80 bits and the effective number of bits of the first common mask is 26 bits, the effective number of bits of the third mask is greater than the effective number of bits of the second common mask. The effective number of bits of the first common mask of the Bluetooth chip is a subset of the effective number of bits of the second common mask, and it is determined that beacon ID-B matches the Bluetooth filter.
[0195] In another embodiment, when the Bluetooth chip determines that the effective number of bits of the first common mask is not a subset of the effective number of bits of the second common mask, that is, the effective number of bits in the second common mask is less than the effective number of bits in the first common mask, the Bluetooth chip discards the scanned Bluetooth broadcast.
[0196] S1006: When it is determined that the number of valid digits of the first common mask is a subset of the number of valid digits of the second common mask, calling back the Bluetooth broadcast corresponding to the beacon ID obtained by parsing.
[0197] For example Fig.11 As shown, when the Bluetooth chip determines that beacon ID-B matches the Bluetooth filter, the Bluetooth chip will call back the Bluetooth broadcast corresponding to beacon ID-B to the Bluetooth scanning task module. The Bluetooth scanning task module will parse the beacon ID-B based on the Bluetooth broadcast and report the parsed beacon ID-B to the subscription module.
[0198] S1007: According to the beacon ID obtained by parsing, the Bluetooth broadcast corresponding to the beacon ID is sent to the corresponding application.
[0199] In the embodiments of the present application, Fig.11 As shown, when the subscription module receives beacon ID-B, it will determine the application B corresponding to beacon ID-B according to the subscription relationship in the above-mentioned subscription beacon embodiment, and send the Bluetooth broadcast corresponding to beacon ID-B to application B, so that application B can obtain the business information in the Bluetooth broadcast of beacon B and display the business information through the electronic device.
[0200] It is understandable that the business information is the precision marketing service provided by the beacon. For example, see Figure 6 As shown, the business information is the marketing service provided by Gas Station A using wallet discount payment.
[0201] The Bluetooth filter generation method and scanning method provided in the embodiment of the present application, on the one hand, can dynamically calculate the common mask of multiple beacon IDs, namely the first common mask, and generate a Bluetooth filter by combining any one of the multiple beacon IDs and the first common mask, so that the same Bluetooth filter can match multiple beacon IDs, thereby effectively reducing the number of Bluetooth filters set in the electronic device; on the other hand, in the embodiment of the present application, the effective number of bits of the second common mask is 26 bits, so the probability that any beacon ID can match the Bluetooth filter provided by this embodiment is 1 / 2 26 Therefore, the Bluetooth filter generation method and scanning method provided in the embodiments of the present application can effectively shield the interference of irrelevant beacons and prevent the application from being woken up by mistake, thereby reducing the power consumption of the electronic device.
[0202] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean 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 the present application.
[0203] Based on the same concept, as an implementation of the above method, an embodiment of the present application provides a device for generating a Bluetooth filter. The device embodiment corresponds to the above method embodiment. For ease of reading, the device embodiment will no longer repeat the details of the above method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the above method embodiment.
[0204] Fig.13 13 is a schematic diagram of a device for generating a Bluetooth filter provided by an embodiment of the present application. The device includes an acquisition module 1301, a determination module 1302 and a generation module 1303.
[0205] The acquisition module 1301 is used to acquire the beacon ID of each beacon to obtain multiple beacon IDs.
[0206] The determination module 1302 is configured to determine a first common mask of multiple beacon IDs.
[0207] The generating module 1303 is configured to generate a Bluetooth filter according to any one of the multiple beacon IDs and a first common mask.
[0208] Optionally, the determination module 1302 is used to determine a first common mask of multiple beacon IDs, specifically including: converting the multiple beacon IDs into binary strings respectively; performing a bitwise AND operation on the binary strings of the multiple beacon IDs to obtain the first common mask.
[0209] Optionally, the effective number of bits of the first common mask is less than or equal to the length of the binary string of the multiple beacon IDs; wherein, the effective number of bits of the first common mask is the number of bits with a value of 1 in the binary string of the first common mask.
[0210] Optionally, the beacon ID includes a Bluetooth beacon identifier Beacon ID; or, the beacon ID includes a namespace identifier Name Space ID and an instance identifier Instance ID; or, the beacon ID includes a proximity universal unique identifier Proximity UUID, a major value Major, and a minor value Minor.
[0211] Based on the same concept, as an implementation of the above method, an embodiment of the present application also provides a Bluetooth broadcast scanning device. The device embodiment corresponds to the aforementioned method embodiment. For ease of reading, the present device embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to and implement all the contents of the aforementioned method embodiment.
[0212] Fig.14 1401 is a schematic diagram of a scanning device for Bluetooth broadcasting provided by an embodiment of the present application. The device includes a receiving module 1401 and a scanning module 1402.
[0213] The receiving module 1401 is used to receive the Bluetooth broadcast, which carries the beacon ID of the beacon.
[0214] The scanning module 1402 is used to use a Bluetooth filter to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast. The Bluetooth filter is generated according to the method shown in the above embodiment.
[0215] Optionally, the scanning module 1402 is used to use a Bluetooth filter to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast, specifically including: converting the beacon ID carried by the Bluetooth broadcast and the beacon ID in the Bluetooth filter into binary strings respectively; performing a bitwise AND operation on the binary string of the beacon ID carried by the Bluetooth broadcast and the binary string of the beacon ID in the Bluetooth filter to obtain a second common mask, which is a binary string; if the number of valid bits in the second common mask is greater than or equal to the number of valid bits in the first common mask, it is determined that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter, and the Bluetooth broadcast is retained; wherein, the number of valid bits in the second common mask is the number of bits with a value of 1 in the binary string of the second common mask.
[0216] Optionally, the scanning module 1402 is used to, after determining that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter and retaining the Bluetooth broadcast, further include: sending the Bluetooth broadcast to a corresponding application according to the beacon ID carried by the Bluetooth broadcast.
[0217] Optionally, the scanning module 1402 is used to, after sending the Bluetooth broadcast to the corresponding application according to the beacon ID carried by the Bluetooth broadcast, further include: obtaining the business information carried by the Bluetooth broadcast; and displaying the business information.
[0218] Optionally, the scanning module 1402 is further configured to determine that the beacon ID carried by the Bluetooth broadcast does not match the Bluetooth filter and discard the Bluetooth broadcast if the number of valid bits in the second common mask is less than the number of valid bits in the first common mask.
[0219] An embodiment of the present application also provides an electronic device, comprising one or more processors; one or more memories and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to perform the methods shown in the above embodiments.
[0220] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method shown in the above embodiments is implemented.
[0221] An embodiment of the present application further provides a computer program product, in which a computer program is stored. When the computer program is executed by an electronic device, the electronic device can execute the methods shown in the above embodiments.
[0222] The present application also provides a chip, see Fig.15 As shown, the chip includes a processor and a memory, in which a computer program is stored. When the computer program is executed by the processor, the methods shown in the above embodiments are implemented.
[0223] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0224] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (doubledatarate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synchlink DRAM, SLDRAM), and direct rambus RAM (DR RAM).
[0225] In the embodiments provided in the present application, the division of each framework or module is only a logical function division. There may be other division methods in actual implementation. For example, multiple frameworks or modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0226] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0227] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0228] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0229] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for generating a Bluetooth filter, characterized in that: Applied to an electronic device, the electronic device includes a plurality of applications, the plurality of applications subscribe to a plurality of beacons, the method includes: Obtaining a beacon ID of each of the beacons to obtain a plurality of beacon IDs; determining a first common mask for the plurality of beacon IDs; A Bluetooth filter is generated according to any one beacon ID of the plurality of beacon IDs and the first common mask.
2. The method according to claim 1, characterized in that The determining a first common mask of the plurality of beacon IDs comprises: Convert the multiple beacon IDs into binary strings respectively; Perform a bitwise AND operation on the binary character strings of the multiple beacon IDs to obtain the first common mask.
3. The method according to claim 2, characterized in that The number of valid bits of the first common mask is less than or equal to the length of the binary string of the multiple beacon IDs; The effective number of digits of the first common mask is the number of digits with a value of 1 in the binary string of the first common mask.
4. The method according to any one of claims 1 to 3, characterized in that: The beacon ID includes a namespace identifier Name Space ID and an instance identifier Instance ID; or, The beacon ID includes a proximity universal unique identifier (UUID), a major value (Major), and a minor value (Minor).
5. A scanning method for Bluetooth broadcast, characterized in that: Applied to electronic equipment, the method comprises: Receive a Bluetooth broadcast, where the Bluetooth broadcast carries a beacon ID; The Bluetooth broadcast is filtered using a Bluetooth filter according to a beacon ID carried by the Bluetooth broadcast, wherein the Bluetooth filter is generated according to the method described in any one of claims 1 to 4.
6. The method according to claim 5, characterized in that The using a Bluetooth filter to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast includes: Convert the beacon ID carried by the Bluetooth broadcast and the beacon ID in the Bluetooth filter into binary strings respectively; Performing a bitwise AND operation on the binary string of the beacon ID carried by the Bluetooth broadcast and the binary string of the beacon ID in the Bluetooth filter to obtain a second common mask, where the second common mask is a binary string; If the number of valid bits in the second common mask is greater than or equal to the number of valid bits in the first common mask, determining that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter, and retaining the Bluetooth broadcast; The number of valid bits in the second common mask is the number of bits with a value of 1 in the binary string of the second common mask.
7. The method according to claim 6, characterized in that After determining that the beacon ID carried by the Bluetooth broadcast matches the Bluetooth filter and retaining the Bluetooth broadcast, the method further includes: The Bluetooth broadcast is sent to a corresponding application according to the beacon ID carried by the Bluetooth broadcast.
8. The method according to claim 7, characterized in that After sending the Bluetooth broadcast to the corresponding application according to the beacon ID carried by the Bluetooth broadcast, the method further includes: Obtaining the service information carried by the Bluetooth broadcast; The business information is displayed.
9. The method according to any one of claims 6 to 8, characterized in that: The method further comprises: If the number of valid bits in the second common mask is less than the number of valid bits in the first common mask, it is determined that the beacon ID carried by the Bluetooth broadcast does not match the Bluetooth filter, and the Bluetooth broadcast is discarded.
10. A device for generating a Bluetooth filter, characterized in that: Applied to an electronic device, the electronic device includes a plurality of applications, the plurality of applications subscribe to a plurality of beacons, the generating device includes: Acquisition module: used to acquire the beacon ID of each beacon to obtain multiple beacon IDs; A determination module: configured to determine a first common mask of the plurality of beacon IDs; A generating module is used to generate a Bluetooth filter according to any one beacon ID among the multiple beacon IDs and the first common mask.
11. A scanning device for Bluetooth broadcast, characterized in that: Applied to electronic equipment, the scanning device comprises: Receiving module: used for receiving Bluetooth broadcast, wherein the Bluetooth broadcast carries the beacon ID of the beacon; Scanning module: used to use a Bluetooth filter to filter the Bluetooth broadcast according to the beacon ID carried by the Bluetooth broadcast, and the Bluetooth filter is generated according to the method described in any one of claims 1-4.
12. An electronic device, characterized in that: The electronic device comprises: one or more processors; one or more memories; and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions, which, when executed by the electronic device, enable the electronic device to perform the method as described in any one of claims 1-4 or claims 5-9.
13. A chip, characterized in that: The chip comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method according to any one of claims 1 to 4 or any one of claims 5 to 9 is implemented.
14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 or any one of claims 5 to 9 is implemented.