Close-range scanning method and related device
Patent Information
- Application Number
- CN202480034813.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-25
- Filing Date
- 2024-05-22
- Publication Date
- 2025-12-30
AI Technical Summary
In short-range communication technology, electronic devices need to frequently scan surrounding Bluetooth messages, resulting in a large number of invalid wake-ups from the main processor and increasing device power consumption.
By introducing a second processor, packet filtering is realized, only matching service messages are sent to the main processor, avoiding messages from irrelevant devices to wake up the main processor, and supporting more service processing at the software level.
It effectively reduces equipment power consumption, improves the service processing capacity of electronic devices, and reduces invalid wake-up and power consumption.
Smart Images

Figure CN121241622A_ABST
Abstract
Description
Close range scanning method and related device
[0001] This application claims priority to the Chinese patent application with application number 202310605017.9 filed with the State Intellectual Property Office of China on May 25, 2023, and priority to the Chinese patent application with the invention name “Close-range scanning method and related device”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of electronic technology, and in particular to a close-range scanning method and related devices. Background Art
[0003] With the continuous development of short-range communication (NFC) technology, NFC technology (such as Bluetooth) on electronic devices is becoming more and more widely used in users' lives. NFC technology on electronic devices can be applied to various scenarios such as smart homes, offices, cars, and payments, bringing convenience to users.
[0004] Taking Bluetooth as an example, a Bluetooth device can continuously broadcast Bluetooth signals so that it can be discovered by other devices; a user's electronic device can scan Bluetooth messages sent by surrounding Bluetooth devices, and the main processor of the electronic device implements related services based on the scanned Bluetooth messages.
[0005] However, in actual applications, there may be a large number of irrelevant Bluetooth devices around the electronic device, and the electronic device will scan a large number of Bluetooth messages, which will cause a large number of invalid wake-ups of the main processor of the electronic device and high power consumption of the device.
[0006] Summary of the Invention
[0007] The present application provides a close-range scanning method and related apparatus, which can prevent the main processor from being invalidly woken up and effectively reduce the power consumption of the device.
[0008] In the first aspect, the present application provides a short-range scanning method, which is applied to a first electronic device, the first electronic device including a first short-range communication module, a main processor and a second processor; the method includes: the main processor sends a first instruction to the second processor; the first instruction is used to instruct the second processor to filter messages based on a first filtering condition, the first filtering condition is used to filter messages from devices of a first service, and the devices of the first service include a first device; the first short-range communication module scans a first message sent by the first device; the first short-range communication module sends the first message to the second processor; the second processor determines that the first message matches the first filtering condition in the second processor, and the second processor sends the first message to the main processor.
[0009] In the implementation of the application embodiment, the short-range communication module sends the scanned messages to the low-power second processor, which filters the messages of the first business and only sends the filtered messages of the first business to the main processor; the message filtering implemented by the second processor does not need to wake up the main processor. In this way, it is possible to avoid messages from irrelevant devices waking up the main processor, effectively reducing the power consumption of the device. In addition, compared to setting a filter in the short-range communication module to implement message filtering, the second processor implements message filtering at the software level, and the number of services it can support is far greater than that of the short-range communication module, thereby improving the business processing capabilities of the electronic device.
[0010] In one implementation, the method further includes: the first short-range communication module scanning a second message sent by a second device; the first short-range communication module sending the second message to a second processor; the second processor determining that the second message does not match a first filtering condition in the second processor, and the second processor not sending the first message to the main processor. In the embodiment of the application, messages determined by the second processor to not match the filtering condition of the first service will not be sent to the main processor. In this way, messages from unrelated devices can be prevented from waking up the main processor, effectively reducing device power consumption.
[0011] In one implementation, the method further includes: based on the first instruction, the second processor sends a second instruction to the first short-range communication module, and the second instruction is used to instruct the first short-range communication module to send the scanned message to the second processor. According to the traditional implementation scheme, the short-range communication module will send the scanned message directly to the main processor; in the embodiment of the application, the second processor instructs the short-range communication module to switch the callback path of the message to the second processor. In this way, the second processor can filter the message and only send the message that matches the filtering conditions to the main processor, thereby preventing the main processor from being woken up by messages from irrelevant devices and effectively reducing the power consumption of the device.
[0012] In one implementation, the method further includes: based on the first instruction, the second processor sends a second instruction to the first short-range communication module, the second instruction is used to instruct the first short-range communication module to send the scanned message of the first type of service to the second processor; the first service belongs to the first type of service. According to the traditional implementation scheme, the short-range communication module will send the scanned message of the first type of service directly to the main processor. The first type of service includes multiple services, and the first electronic device only subscribes to some services (such as the first service). In the implementation embodiment of the application, the main processor sends the filtering conditions corresponding to the subscribed service to the second processor, and the second processor instructs the short-range communication module to switch the callback path of the first type of service to the second processor. In this way, the second processor can filter the messages of the first type of service and only send the messages of the devices of the first service that match the filtering conditions to the main processor, so as to avoid the messages of the devices of the unsubscribed services in the first type of service waking up the main processor, thereby effectively reducing the power consumption of the device.
[0013] In one implementation, before the first short-range communication module sends the first message to the second processor, it also includes: the main processor sends a second filtering condition to the first short-range communication module, and the second filtering condition is used to filter messages from devices of the first type of service; the first short-range communication module sends the first message to the second processor, including: when the first short-range communication module determines that the first message meets the second filtering condition, it sends the first message to the second processor. In the implementation embodiment of the application, the short-range communication module preliminarily filters out messages of the first type of service from the scanned messages and sends them to the second processor. In this way, messages of other types of services are avoided from being sent to the second processor, thereby reducing the power consumption of the second processor.
[0014] In one implementation, before the second processor sends the first message to the main processor, the main processor further includes: the main processor sending a callback condition to the second processor, the callback condition being used to instruct the second processor to send the first message to the main processor if the first message meets the callback condition. In the embodiment of the application, the second processor controls the frequency at which messages from the same device are called back to the main processor through the callback condition. This can reduce the frequency of waking up the main processor, prevent the main processor from repeatedly processing the same message, and achieve the purpose of controlling power consumption.
[0015] In one implementation, the callback condition of the first message includes any one of the following: the first message is received for the first time; the first message is not received for the first time, and the time interval between the time of receiving the first message this time and the time of receiving the first message most recently sent to the main processor is greater than the first time threshold.
[0016] In one implementation, the first message includes a device identifier of the first device, and the method further includes: a main processor obtaining, from a server, a first message attachment associated with the first device based on the device identifier of the first device; and a first application in the main processor executing a first preset function based on the message content in the first message attachment. This embodiment of the application does not specifically limit the first preset function corresponding to the first service; for example, it may include outputting push information based on the message content.
[0017] In one implementation, the first message includes a device identifier of the first device, and the method further includes: the main processor executing a second preset function based on the device identifier of the first device. This embodiment of the application does not specifically limit the second preset function, for example, sending a command to the vehicle through the vehicle app to control the vehicle door to open.
[0018] In one implementation, after the second processor sends the first message to the main processor, the method further includes: upon the second processor detecting that no message from the first device is received again within a first preset time period after receiving the message from the first device, the second processor sending a loss event for the first device to the main processor. In this embodiment, the loss event can be detected by the timer function of the second processor without requiring the AP to remain active. Compared to the main processor, the second processor consumes less power when detecting a loss event.
[0019] In one implementation, the first short-range communication module is a Bluetooth chip, the first service is the first beacon scanning service of the first application, and the first device is a registered beacon device for the first beacon scanning service. In actual applications, there may be beacon devices with unsubscribed beacon scanning services around the first electronic device, and a large number of beacon messages sent by them that are irrelevant to this device will be scanned. The second processor filters the beacon messages scanned by the Bluetooth chip, and only calls back the filtered beacon messages of the devices that have subscribed to the service to the main processor for further processing, and discards other irrelevant beacon messages. In this way, irrelevant beacon messages can be avoided from waking up the main processor, effectively reducing the power consumption of the device, and the number of beacon scanning services that can be supported is much larger than that of the Bluetooth chip, thereby improving the service processing capability of the electronic device.
[0020] In one implementation, the method also includes: the main processor sends a first request message to the server, the first request message carries the beacon parameters of the first beacon scanning service, and the first request message is used to detect the legitimacy of the beacon parameters; when the beacon parameters are legal, the main processor receives a first response message sent by the server; the first response message carries the first filtering condition.
[0021] In one implementation, the second filtering condition includes the type of beacon device carried in the message.
[0022] In one implementation, the device identification of the first device includes a first beacon ID, the cloud server stores one or more message attachments associated with the first beacon ID, and the main processor obtains the first message attachment associated with the first device from the server based on the device identification of the first device, including: the main processor sends a second request message to the server, the second request message includes the first beacon ID, and the second request message is used to query the message attachment associated with the first beacon ID; the main processor receives the first message attachment sent by the server, and the first message attachment is any one of the one or more message attachments.
[0023] In one implementation, the first filtering condition indicates the value of one or more of the following filtering fields of the first beacon scanning service: namespace, message type, beacon ID prefix and message content; the first message matches the first filtering condition, including: the first message carries the first filtering field, and the first filter field carried by the first message matches the first filter field indicated by the first filtering condition, and the first filter field is any filter field indicated by the first filtering condition.
[0024] In one implementation, the device identification of the first device includes a first beacon ID, and the first application stores a correspondence between the first beacon ID and a second preset function; the main processor executes the second preset function based on the device identification of the first device, including: the first application in the main processor executes the second preset function corresponding to the first beacon ID according to the correspondence.
[0025] In one implementation, the first filtering condition indicates a first beacon ID of the first device; and the first message matches the first filtering condition, including: the beacon ID carried by the first message is the first beacon ID.
[0026] In a second aspect, the present application provides an electronic device comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are configured to store computer program code, the computer program code comprising computer instructions. When the one or more processors execute the computer instructions, the electronic device performs the close-range scanning method of any possible implementation of any of the above aspects.
[0027] In a third aspect, an embodiment of the present application provides a computer storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the close-range scanning method in any possible implementation of any of the above aspects.
[0028] In a fourth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the close-range scanning method in any possible implementation of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] 1A and 1B are schematic diagrams of the architecture of a communication system provided in an embodiment of the present application;
[0030] Figures 2A to 2E are schematic diagrams of a scenario provided by an embodiment of the present application;
[0031] 3A to 3E are schematic diagrams of a scenario provided by an embodiment of the present application;
[0032] FIG4A is a diagram of a device architecture provided in an embodiment of the present application;
[0033] FIG4B is a diagram of a Bluetooth protocol architecture provided in an embodiment of the present application;
[0034] 4C to 4E are diagrams of device architectures provided in embodiments of the present application;
[0035] FIG5 is a diagram of a device architecture provided in an embodiment of the present application;
[0036] FIG6 is a schematic diagram of a flow chart of a close-range scanning method provided in an embodiment of the present application;
[0037] FIG7 is a schematic diagram of a flow chart of a close-range scanning method provided in an embodiment of the present application;
[0038] FIG8 is a flowchart of a callback control provided by an embodiment of the present application;
[0039] FIG9 is a schematic diagram of a device structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following is a clear and detailed description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. 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 the text is only a description of the association relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0041] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0042] The term "user interface (UI)" in the following embodiments of this application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0043] The following introduces the communication system 10 involved in the short-range scanning method provided in the embodiment of the present application.
[0044] Figures 1A and 1B exemplarily illustrate two schematic diagrams of communication systems 10 provided in embodiments of the present application. The structures shown in this embodiment do not constitute a specific limitation on the communication system 10. In other embodiments of the present application, the communication system 10 may include more or fewer devices than shown.
[0045] As shown in FIG1A , the communication system 10 includes an electronic device 100 , at least one beacon device 200 near the electronic device 100 , and a server 300 for querying the beacon device 200 for a message attachment corresponding to the beacon device 200 .
[0046] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device (smart bracelet), an in-vehicle device, a smart home device (smart TV, smart screen, large-screen device, etc.), and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device 100.
[0047] The beacon device 200 is a device that uses short-range communication technology 1 and can be regarded as an external device for a specific application (such as APP1) on the electronic device 100. Its working principle includes: continuously broadcasting its own unique identity (identity, ID) (this ID can also be called a beacon ID) to the surrounding area through short-range communication technology 1, and the APP1 of the nearby electronic device 100 can scan and parse the ID of the beacon device 200, and finally implement information push or execute the preset function corresponding to the above ID based on the ID of the beacon device 200. The beacon device itself does not have the function of collecting data, does not need to be connected to any host device, and will not steal the identity information of the user of the electronic device 100. The business of scanning the beacon device involved in the embodiment of the present application can be called a beacon scanning business, and the beacon scanning business can include the cloud scanning business and local scanning business of the beacon. The subsequent embodiments will introduce the beacon scanning business in detail.
[0048] In some embodiments, the beacon device 200 can be deployed at a fixed location (such as a shopping mall, a gas station, a user's home, a shared bicycle parking spot, etc.), and the electronic device 100 can scan the beacon device 200 when it is close to the fixed location. In some embodiments, the beacon device 200 can be deployed on a specific device (such as a vehicle, a router, a smart home device, etc.), and the electronic device 100 can scan the beacon device 200 when it is close to the specific device. The specific device can be movable or immovable. The beacon device 200 can be independently deployed or integrated with the specific device. The short-range communication technology 1 can be WiFi communication technology, Bluetooth communication (such as classic Bluetooth (Basic Rate / Enhanced Date Rate, BR / EDR) or Bluetooth Low Energy (Bluetooth Low Energy, BLE)) technology, ultra-wideband (UWB) communication technology, near field communication (NFC) technology or ZigBee communication technology, etc., and the embodiments of the present application do not specifically limit this. In actual applications, the type of beacon equipment, deployment method and short-range communication technology used can be determined based on application needs and application scenarios1.
[0049] The following embodiments are illustrative examples using the example of BLE communication technology 1 as the short-range communication technology. In this example, the beacon device 200 can also be referred to as a Bluetooth beacon. The Bluetooth beacon is a hardware device based on the BLE broadcast protocol and is compatible with the iBeacon protocol or the Eddystone protocol. After the user purchases the beacon device, the hardware parameters of the beacon device (such as beacon type, broadcast interval, power consumption level, etc.) can be configured through the APP1 provided by the manufacturer.
[0050] The server 300 may be a single server, a server cluster consisting of multiple servers, or a cloud computing center. The server 300 may also be referred to as a cloud server 300. The beacon database of the server 300 is used to store message attachments corresponding to the beacon ID of each beacon device 200. In some embodiments, the electronic device 100 and the server 300 may be indirectly connected via at least one device in a communication network, the communication network including a wide area network and / or a local area network; the electronic device 100 may query the cloud server 300 for the message attachment corresponding to the beacon ID of the beacon device 200.
[0051] The communication system 10 shown in Figure 1A is used to implement a beacon cloud scanning service. In some embodiments, the beacon cloud scanning service includes two phases, namely phase one and phase two.
[0052] Phase 1: Registering a beacon device for the cloud scanning service and initiating a beacon scanning task. Specifically, the developer of App 1 registers the beacon device 200 for Cloud Scan Service 1 with the cloud server 300, configures a message attachment corresponding to the beacon ID of the beacon device 200, and includes the message published by Cloud Scan Service 1. App 1 on electronic device 100 subscribes to Cloud Scan Service 1 and initiates the beacon scanning task for Cloud Scan Service 1.
[0053] Phase 2: Scan and parse the beacon ID of beacon device 200, and execute preset function 1 based on the message attachment 1 corresponding to the beacon ID. Specifically, beacon device 200 continuously broadcasts its unique beacon ID to the surrounding area via BLE; nearby electronic devices 100 scan and parse this beacon ID; electronic devices 100 query server 300 for the message attachment 1 corresponding to this beacon ID; and app 1 executes preset function 1 based on the message content of this message attachment 1. Executing preset function 1 may include one or more of the following: controlling other devices to perform preset operations; outputting push information 1; invoking other apps to perform preset operations, etc.
[0054] The following is an example of the application scenario of the beacon cloud scanning service.
[0055] Scenario 1: Information push scenario, APP1 can output push information 1 according to the message content of the message attachment 1. After the introduction of Bluetooth beacons (such as beacon devices 200) in places such as shopping malls, gas stations, and museums, they can be deployed in various product areas / exhibit areas. When a user carries an electronic device 100 (such as a mobile phone 100) and approaches the beacon device 200 in a shopping mall or gas station, the mobile phone 100 will receive and display product discount information of nearby products. When a user carries a mobile phone 100 and approaches the beacon device 200 in a museum, the mobile phone 100 will receive and output a detailed introduction to nearby exhibits (such as voice explanation).
[0056] In an embodiment of the present application, the push information 1 (such as the above-mentioned discount information and detailed introduction) can be presented in one or more information types such as cards, text, pictures, videos, animations, etc. In one implementation, the push information 1 is presented in the form of rich media content. The push information 1 can be displayed in one or more display areas of the current display interface of the mobile phone 100, the negative first screen, the notification bar, the status bar, and the user interface of the APP1. The embodiment of the present application does not specifically limit the display area and presentation form of the push information 1.
[0057] For example, FIG. 2A to FIG. 2E show relevant schematic diagrams of information push scenarios at gas stations.
[0058] As shown in Figure 2A, the gas station is deployed with a beacon device 200. The beacon ID of the beacon device 200 corresponds to message attachment 1. The message content of message attachment 1 indicates the preferential information of the application payment of the wallet APP (i.e., Huawei Pay) for refueling at the gas station; after the user drives close to the gas station, the user's mobile phone 100 can scan the beacon ID broadcast by the beacon device 200; after the mobile phone 100 obtains the corresponding message attachment 1 from the server 300 according to the beacon ID, the preferential information of the application payment of the wallet APP for refueling at the gas station is displayed according to the message content of message attachment 1.
[0059] For example, as shown in FIG2B , the mobile phone 100 can display the above-mentioned discount information on the current display interface of the mobile phone 100. For example, the current display interface of the mobile phone 100 is a main interface 11 for displaying installed applications (applications, APPs); the mobile phone 100 has a wallet APP installed, and the main interface 11 can display the application icon 101 of the wallet APP. The mobile phone 100 displays a card 102 based on the message content of message attachment 1. The card 102 indicates the above-mentioned discount information. The card 102 includes the application icon and name 102A of the wallet APP, discount information 102B, and a discount payment control 102C. The discount information 102B indicates that a 10% discount can be enjoyed by using the wallet APP for Huawei payment. The discount payment control 102C is used to jump to the wallet APP's code scanning interface, QR code interface, homepage, or payment interface for gas stations. The interface of the wallet APP after the jump is used to implement Huawei payment for gas stations. The embodiment of the present application does not specifically limit the interface after the jump. The code scanning interface is an interface for making payments by scanning the gas station's payment QR code; the QR code interface is an interface for displaying the wallet APP's payment QR code; the homepage is used to display various function controls of the wallet APP, such as controls for calling up the code scanning interface or the QR code interface; the above-mentioned payment interface is the interface displayed after the mobile phone 100 scans the gas station's payment QR code through the code scanning interface, or the interface displayed on the mobile phone 100 after the gas station scanning device scans the wallet APP's payment QR code.
[0060] In one implementation, as shown in Figures 2B and 2C , upon detecting that a user has clicked on a discount payment control 102C, mobile phone 100 displays a QR code interface 12 including a payment QR code 103. As shown in Figures 2C and 2D , upon detecting that a gas station's barcode scanner has scanned payment QR code 103, a payment interface 13 is displayed based on the payment amount sent by the scanner. Payment interface 13 may include: product name (i.e., the model of the gas station being refueled with); product price before discount 202; discount information 203; and actual payment amount after discount 204. It may also display selection controls for various payment methods, such as a Huawei Pay selection control 205. This selection control has two states: selected and unselected, and the user can toggle the selection control state. As shown in Figure 2D , Huawei Pay selection control 205 is currently selected, and discount information 203 displays the Huawei Pay discount information indicated in message attachment 1, namely, a 10% discount. Payment interface 13 includes a payment confirmation control 206. Upon detecting that the user has clicked on payment confirmation control 206, mobile phone 100 may display a payment completion interface for password-free payment or a password entry interface. The password entry interface is used to enter the payment password. Upon detecting that the password entered by the user on the password entry interface is correct, a payment completion interface may be displayed. Figures 2B to 2D illustrate one implementation of the user interface for implementing preferential payment provided by this application. Embodiments of this application may also implement preferential payment through Huawei Pay through other methods, which are not specifically limited here.
[0061] In some embodiments, as shown in FIG2E , the application settings interface 14 of the wallet app of the mobile phone 100 includes a switch control 207 for beacon push messages. The switch control 207 includes two states: enabled and disabled. Based on the user's input operation (e.g., a click operation), the mobile phone 100 can switch the state of the switch control 207. When the switch control 207 is in the enabled state, the wallet app scans for nearby beacon devices and pushes preferential information based on the beacon ID of the beacon device. In the embodiment of the present application, beacon push messages for the cloud scanning service can also be enabled by other means, which are not specifically limited here.
[0062] Scenario 2: Positioning service scenario. Positioning services can be applied to indoor positioning in scenarios such as exhibitions, libraries, museums, hotels, airports, campuses, and hospitals to facilitate the management of people or items. For example, beacon devices (such as beacon device 200) are deployed in various exhibition areas of a museum, and a museum APP is installed on the mobile phone 100; when a visitor passes by the beacon device 200 with the mobile phone 100, the mobile phone 100 scans and parses the beacon ID of the beacon device 200; the message attachment corresponding to the beacon ID queried by the mobile phone 100 to the cloud indicates the deployment location of the beacon device 200; the museum APP can determine the user's location in the museum based on the deployment location of the beacon device 200, and can then indicate the user's location on the map provided by the museum APP.
[0063] Not limited to the above-mentioned scenarios 1 and 2, the cloud scanning service implemented by the short-range scanning method provided in the embodiment of the present application can also be applied to many other scenarios, which are not specifically limited here.
[0064] The communication system 10 shown in Figure 1B is used to implement a local beacon scanning service. As shown in Figure 1B, the communication system 10 includes an electronic device 100 and at least one beacon device 400 near the electronic device 100. The local beacon scanning service does not rely on the beacon's cloud service. That is, there is no need to configure the message attachment corresponding to the beacon ID or query the cloud for the message attachment, providing developers with a high degree of flexibility. Beacon device 400 can refer to the relevant description of beacon device 200.
[0065] In some embodiments, the local scan service of the beacon includes two phases, namely phase three and phase four.
[0066] Phase 3: Registering a beacon device for the local scanning service and starting the beacon scanning task. Specifically, APP1 of the electronic device 100 subscribes to the local scanning service 1, registers the beacon device 400 for the local scanning service 1, and stores the correspondence 1 between the beacon ID of the registered beacon device 400 and the preset function 2.
[0067] Phase 4: Scan and parse the beacon ID of the beacon device 400, and execute the preset function 2 corresponding to the beacon ID. Specifically, the beacon device 400 broadcasts its own unique beacon ID to the surroundings via BLE; the APP1 of the nearby electronic device 100 can scan and parse the above beacon ID; the electronic device 100 executes the preset function 2 corresponding to the beacon ID according to the above correspondence 1. Executing the preset function 2 includes one or more of the following: controlling other devices to perform preset operations; outputting push information 2; calling other APPs to perform preset operations, etc. The display area and display format of the push information 2 can refer to the relevant description of the aforementioned push information 1. The embodiment of the present application does not specifically limit the preset function 2.
[0068] The following is an exemplary description of the application scenario of the local scanning service of the beacon.
[0069] Scenario 3: Smart unlocking / door opening scenario. For intelligently controlled door locks, such as home doors, car doors, and electric vehicle locks, a beacon device 400 can be deployed in or near the door lock. When a user brings an electronic device 100 (such as a mobile phone 100) near the beacon device 400, the phone 100 can automatically unlock the door lock.
[0070] For example, FIG3A to FIG3E show relevant schematic diagrams of the scenario of intelligent door unlocking.
[0071] As shown in Figure 3A, a beacon device 400 is deployed on a vehicle door. A user approaches the vehicle with their mobile phone 100. As shown in Figure 3B, after mobile phone 100 scans the beacon message broadcast by beacon device 400 and obtains the beacon ID, the vehicle app displays a prompt box 301 based on the beacon ID. Prompt box 301 includes prompt information 301A, a confirmation control 301B, and a cancel control 301C. Prompt information 301A prompts the user whether to unlock the door. Confirmation control 301B confirms unlocking the door, and cancel control 301C cancels unlocking the door. Upon detecting a user input operation (e.g., a click) on confirmation control 301B, mobile phone 100 sends instruction 1 to the onboard device of vehicle 1. Based on instruction 1, the onboard device controls the unlocking of the door. In some embodiments, after the door is successfully unlocked, the onboard device sends a confirmation message to mobile phone 100, indicating that the door has been unlocked. As shown in Figure 3C, mobile phone 100 displays prompt information 302 based on the confirmation message, notifying the user that the door has been unlocked.
[0072] In some embodiments, without user confirmation of unlocking, mobile phone 100 can directly send instruction 1 to the vehicle's onboard device based on the beacon ID to control the unlocking of the vehicle door and display prompt message 302 after the door is unlocked. The display area and display format of prompt box 301 and prompt message 302 can be referred to the relevant description of push message 1 above and will not be repeated here.
[0073] In some embodiments, upon detecting a user input operation (e.g., a click) on the prompt information 302, the mobile phone 100 may display the user interface 15 of the vehicle APP shown in FIG3D . The user interface 15 includes a control 303 for controlling the door unlocking. After the door is unlocked, the display content on the control 303 may indicate that the door is unlocked. It is understandable that, according to the traditional method, if the user wants to control the door unlocking through the mobile phone, they need to first start the vehicle APP, find the control 303 in the vehicle APP, and then control the door unlocking through the control 303. However, with the close-range scanning method provided in the embodiment of the present application, when approaching the vehicle, the mobile phone 100 can automatically trigger the door unlocking based on the scanned beacon ID, which is convenient for the user to operate.
[0074] In some embodiments, as shown in FIG3E , the application settings interface 16 of the vehicle app of the mobile phone 100 includes a switch control 304 for smart unlocking. The switch control 304 includes two states: enabled and disabled. Based on user input (e.g., a click), the mobile phone 100 can switch the state of the switch control 304. Only when the switch control 304 is enabled does the vehicle app provide the smart unlocking function through beacon scanning. In the embodiments of the present application, this function can also be enabled through other methods, which are not specifically limited here.
[0075] Scenario 4: Attendance clocking scenario. A beacon device 400 is deployed in the clocking device. When an employee passes by the beacon device 400 with their mobile phone 100, the clocking application on the mobile phone 100 can automatically clock in based on the beacon ID of the beacon device 400 scanned.
[0076] Not limited to the above-mentioned scenarios 3 and 4, the local scanning service implemented by the close-range scanning method provided in the embodiment of the present application can also be applied to many other scenarios, which are not specifically limited here.
[0077] In some embodiments, as shown in the device architecture of Figure 4A, the software system of the electronic device 100 includes APP1 and a short-range communication service (Nearby), the protocol stack includes a Bluetooth protocol stack, and the hardware includes a short-range communication module (such as a Bluetooth chip) using short-range communication technology 1. The server 300 can be a cloud server for the Nearby service. Exemplarily, in the communication system shown in Figures 1A and 1B, the short-range communication technology 1 is a low-power Bluetooth communication technology. For a beacon scanning service, the APP1 of the electronic device 100 can register the beacon scanning task corresponding to the service with Nearby; Nearby can send the beacon scanning task to the Bluetooth chip through the Bluetooth protocol stack to drive the Bluetooth chip to scan the surrounding beacon devices. After the Bluetooth chip scans the beacon message broadcast by the beacon device, it calls back the relevant data of the beacon message to the Bluetooth protocol stack, and the Bluetooth protocol stack reports it to APP1 through Nearby.
[0078] As shown in FIG4B , the protocol framework of the Bluetooth protocol may include, but is not limited to, a Bluetooth service (BT service), a Host protocol stack, a Host Controller Interface (HCI), and a controller.
[0079] Among them, the Bluetooth service Service defines the message format and application rules of each application. In order to achieve interoperability between different devices on different platforms, the Bluetooth protocol has formulated specifications for various possible and generally meaningful application scenarios. The Host protocol stack defines core protocols, including but not limited to Bluetooth basic service protocols, logical link control and adaptation protocols, etc. HCI provides a standardized interface for communication between the host protocol stack and the controller. The hardware corresponding to HCI is the physical bus used to connect the main processor and the Bluetooth chip. In other examples, HCI may not be included. The controller defines the underlying hardware part, including wireless radio frequency (RF), baseband (BB) and link management (LM), which can realize the filtering and transmission of data bit streams, and mainly defines the conditions that need to be met for the Bluetooth transceiver to work normally in this frequency band. Optionally, the host protocol stack Host includes Bluetooth services.
[0080] In some embodiments, as shown in FIG4C , some or all modules (e.g., APP1, Nearby) of the software system of the electronic device 100, as well as the host protocol stack Host and Bluetooth services in the Bluetooth protocol framework, run on the main processor; the controller runs in the Bluetooth chip. Therefore, after the Bluetooth chip scans the beacon message, when the controller reports the beacon message to the host protocol stack in the main processor, if the main processor is in a dormant state, it is necessary to wake up the main processor. The main processor is an application processor (AP) or a central processing unit (CPU). The subsequent embodiments take the AP as an example for illustrative purposes.
[0081] The device architecture of the electronic device 100 shown in FIG4C has the following problems: 1. In actual applications, there may be a large number of Bluetooth devices around the electronic device 100; the electronic device 100 scans a large number of beacon messages broadcast by irrelevant Bluetooth beacons, resulting in a large number of invalid wake-ups of the main processor and high device power consumption. In addition, in the cloud scanning service of the beacon, after scanning the beacon ID of the beacon device, Nearby needs to query the message attachments in the cloud, resulting in a large number of Nearby cloud interface requests. 2. The same beacon device will broadcast continuously. Since the beacon broadcast interval (for example, two hundred milliseconds) is usually short, if the electronic device 100 is near a beacon device for a long time, the Bluetooth chip will frequently call back the same beacon message to the main processor, causing the main processor to continue to be awakened by the beacon message after processing the beacon message.
[0082] In some embodiments, for beacon scanning services, when APP1 registers a beacon scanning task with Nearby, it also indicates the filtering conditions of the beacon device corresponding to the task; when Nearby issues a beacon scanning task to the Bluetooth chip, it also issues the corresponding filtering conditions; referring to Figure 4D, the Bluetooth chip sets a filter corresponding to the task based on the filtering conditions corresponding to the beacon scanning task issued by Nearby, and the filter is used to filter out the messages that meet the filtering conditions in the scanned Bluetooth messages. Usually, one Bluetooth scanning task (such as a beacon scanning task) corresponds to one filter. In this embodiment, the device architecture of the electronic device 100 shown in Figure 4D also has the following problems: due to the hardware limitations of the Bluetooth chip, the number of filters that can be set by the Bluetooth chip (for example, 32) is limited, and it cannot support a large number of beacon scanning services for each application.
[0083] An electronic device 100 is also provided in an embodiment of the present application. Referring to FIG4E , the electronic device 100 further includes a microprocessor, which is a processor having lower power consumption than the main processor, and the microprocessor can integrate some functions of the main processor. The microprocessor can be a microcontroller unit (MCU), an intelligent sensor hub, or other processors. The subsequent embodiments are illustrative using the Sensorhub as an example. The embodiments of the present application do not specifically limit the physical bus connecting the main processor and the microprocessor, and the physical bus connecting the microprocessor and the Bluetooth chip, such as a bus for implementing I2C (Inter-Integrated Circuit) or a serial peripheral interface (Serial Peripheral Interface, SPI).
[0084] The Sensorhub is a hardware and software solution based on a low-power MCU and a lightweight real-time operating system (RTOS). Its primary function is to connect and process data from various sensor devices. The Sensorhub operates with low power consumption and can remain operational for extended periods of time.
[0085] As shown in Figure 4E, in an embodiment of the present application, the Sensorhub is also used to connect and process data from the Bluetooth chip. The Sensorhub includes a filtering module and / or a callback module. The AP is also used to send filtering conditions corresponding to the beacon scanning task to the Sensorhub, and the filtering conditions can be used to filter out messages sent by beacon devices that have registered for the beacon scanning service; the filtering module of the Sensorhub is used to set beacon filters based on the above filtering conditions to filter the messages scanned by the Bluetooth chip; the Sensorhub calls back the filtered beacon messages to the main processor for further processing and discards beacon messages from other irrelevant beacon devices. The Sensorhub implements message filtering at the software level, and the number of filters / services it can support is much greater than that of the Bluetooth chip. In addition, the callback module can control the callback frequency of the beacon messages of the same beacon device to the AP based on the callback conditions issued by APP1. In this way, the consumption of filter resources on the hardware can be saved, the processing capability of the electronic device 100 for beacon scanning services can be improved, the number of wake-up times of the main processor can be reduced, the power consumption of the electronic device 100 can be reduced, low-power and high-efficiency beacon management can be achieved, and the problems described in Figures 4C and 4D can be effectively solved.
[0086] The device architecture shown in FIG4E is not limited to beacon scanning services (i.e., not limited to scanning beacon devices), and is also applicable to other Bluetooth scanning services that require scanning target Bluetooth devices. By setting the filtering conditions corresponding to the target Bluetooth device in the Sensorhub, the messages of the target Bluetooth device can be filtered out from the Bluetooth messages of the scanned surrounding Bluetooth devices. In actual applications, corresponding filtering conditions can be set according to business requirements and the characteristics of the target Bluetooth device. The embodiment of the present application does not specifically limit the above-mentioned Bluetooth scanning service and the corresponding filtering conditions.
[0087] It should be noted that when the aforementioned short-range communication technology 1 is other short-range communication technologies such as WiFi, NFC, UWB, ZigBee, and the aforementioned short-range communication module is a communication module (such as a WiFi chip, a UWB chip) that adopts the above-mentioned other short-range communication technologies, the problems described in Figures 4C and 4D also exist. Similarly, the short-range scanning method provided in the embodiment of the present application can also be adaptively applied to electronic devices 100 that adopt other short-range communication technologies. For example, taking WiFi as an example, the Sensorhub can filter the messages reported by the WiFi chip according to the filtering conditions of the WiFi scanning task issued by the AP, filter out the messages sent by the target WIFi device, and send them to the AP for further processing; the Sensorhub can control the callback frequency of the beacon message of the same WiFi device to the AP based on the callback conditions issued by APP1.
[0088] The device architecture of the electronic device 100 involved in the embodiment of the present application is introduced in detail below.
[0089] As shown in Figure 5, the device architecture of the electronic device 100 may include the software system and hardware of the electronic device, wherein the hardware includes a Bluetooth chip and a microprocessor (eg, MCU, Sensorhub). Some or all modules of the software system of the electronic device run on the main processor.
[0090] The electronic device 100 may be powered by iOS, Android, Microsoft, or other software systems, and the software systems are not specifically limited herein. The software system of the electronic device 100 may employ a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The following uses the layered architecture of the Android system as an example to illustrate the software structure of the electronic device.
[0091] FIG5 shows a software structure block diagram of the software system of the electronic device 100 according to an embodiment of the present application.
[0092] The layered architecture divides software into several layers, each with clear roles and divisions of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer (Application), the Huawei Mobile Services core (HMS core), the application framework layer (Application Framework), the hardware abstraction layer (HAL), and the kernel layer (Kernel).
[0093] The application layer can include a series of application packages. As shown in Figure 5, these packages can include a wallet app, a vehicle app, and a museum app. They can also include other applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, and short messaging. Users can install the required applications based on their actual needs; the application packages mentioned above are not specifically limited here.
[0094] HMS core is a mobile service framework based on Huawei devices and the Android platform, open to application developers and providing various service capabilities. For example, HMS core provides end users with basic services such as Huawei accounts and payments. After logging in with a Huawei account, users can access all Huawei services such as the Huawei AppGallery, Cloud Space, and Sports & Health. At the same time, HMS core provides developers' applications with services such as message push, Huawei account quick login, in-app payment, and positioning, helping developers' applications bring a better user experience to Huawei end users.
[0095] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0096] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
[0097] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0098] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0099] The kernel layer is the layer between hardware and software. It provides low-level drivers for various hardware components, such as Bluetooth drivers, Wi-Fi drivers, display drivers, audio drivers, and sensor drivers (such as touch sensor drivers). It is also responsible for file management, process management, network protocol stacks, system security, and memory management.
[0100] The HAL layer is the interface layer between the kernel and the hardware circuit. Its purpose is to abstract the hardware and provide a virtual hardware platform and services for the operating system; it converts upper-layer calls into direct access and control of the hardware. The specific activity is to establish hardware-related drivers.
[0101] In an embodiment of the present application, the HMS core includes Nearby, which provides the implementation of core business logic such as subscription to beacon scanning services, registration of beacon scanning tasks, Bluetooth scanning task management, and message management, and provides an interface for APP access at the application layer. The Nearby cloud service provides the ability to manage beacon parameters and message content; developers can configure and publish messages through the Nearby cloud service, and use the Nearby Message API interface on the terminal device (such as electronic device 100) to scan beacon devices and obtain published messages. After the developer application (such as APP1) calls the above interface on the terminal device to subscribe to beacon messages, Nearby will continue to scan beacon messages in the background; when a beacon message is scanned, a callback will be sent to notify the above developer application.
[0102] In some embodiments, the functional modules in HMS core can also be integrated into the application framework layer.
[0103] The application framework layer includes Bluetooth services and Multiprotocol Label Switching (MLPS) technology, encapsulating the interfaces of microprocessors (such as MCUs or sensor hubs). MLPS is a packet forwarding technology that replaces IP forwarding with label switching. MPLS, located between the link layer and the network layer in the TCP / IP protocol stack, provides connectivity services to the IP layer while simultaneously receiving services from the link layer.
[0104] The microprocessor encapsulates logic such as beacon message filtering and callback control, interacting with the Bluetooth chip to implement beacon scanning management capabilities. The microprocessor can be a low-power processor such as an MCU or Sensorhub. The microprocessor includes a filtering module and / or a callback module. For details, please refer to the relevant description of Figure 4E.
[0105] The following, in conjunction with the device architecture shown in FIG5 , describes in detail the close-range scanning method provided in the embodiments of the present application for the two aforementioned beacon scanning services.
[0106] Exemplarily, for the beacon cloud scanning service 1, FIG6 shows a flow chart of a short-range scanning method, which includes but is not limited to steps S401 to S417.
[0107] Phase 1: Register the beacon device for the cloud scanning service and start the beacon scanning task.
[0108] S401. The application developer registers the beacon device 200 of the cloud scanning service 1 to the cloud server 300 of Nearby, and configures the message attachment 1 corresponding to the beacon ID of the beacon device 200. The message content in the message attachment 1 includes the message published by the cloud scanning service 1.
[0109] In some embodiments, application developers must first register a developer account on the beacon management system (e.g., Huawei Developer Alliance) provided by Nearby's cloud server 300 and create a project. The system will automatically assign a namespace to each project. Application developers must also configure the namespace ID and message type for the project corresponding to cloud scanning service 1. Application developers must then register beacon device 200 with the project corresponding to cloud scanning service 1 created on cloud server 300, configure the hardware parameters of beacon device 200, configure message attachment 1, and associate the beacon ID of beacon device 200 with message attachment 1. Multiple message attachments can be associated with a single beacon ID.
[0110] The above message types are defined by developers based on actual business needs. For example, the message type of cloud scanning service 1 is HMS message; hardware parameters may include the beacon ID of the beacon device 200, the beacon device type (Beacon type), the Namespace of the project to which it belongs, the broadcast interval, the power consumption level and the reference transmission power, etc.; the beacon device type may include the iBeacon type and the Eddystone type; the message attachment 1 includes the ID of the message attachment, the Namespace of the project to which it belongs, the message type (Type) and the message content published by the cloud scanning service 1. The registration, management and configuration of the beacon device 200 can be completed in a variety of ways, such as through a web dashboard, an application installed on the electronic device 100 or a command line; the embodiment of the present application does not specifically limit the implementation of step S401.
[0111] In an embodiment of the present application, after the electronic device 100 installs APP1, it can automatically subscribe to the cloud scanning service 1 of APP1 and start the beacon scanning task of the cloud scanning service 1. In some embodiments, after the electronic device 100 installs APP1, in response to the user's input operation, the APP1 of the electronic device 100 subscribes to all cloud scanning services of APP1. For example, APP1 is a wallet APP, and the cloud scanning service 1 is the preferential push service of the gas station described in Figures 3A to 3E; with reference to the relevant description of Figure 3E, the above-mentioned input operation can be an operation of the switch control 207 acting on the beacon message push, which is used to subscribe to all beacon scanning services of APP1. In some embodiments, after the electronic device 100 installs APP1, APP1 provides a variety of cloud scanning services (such as cloud scanning service 1); in response to the user's input operation on the cloud scanning service 1, the APP1 of the electronic device 100 subscribes to the cloud scanning service 1.
[0112] In the embodiment of the present application, after APP1 of the electronic device 100 is started, APP1 calls the Bluetooth chip to start the beacon scanning task 1 of the cloud scanning service 1.
[0113] S402. APP1 of electronic device 100 sends instruction 1 to Nearby. Instruction 1 is used to instruct to register beacon scanning task 1 of cloud scanning service 1. Instruction 1 includes beacon parameter 1. Beacon parameter 1 includes one or more of the following data of cloud scanning service 1: Namespace, message type, beacon ID prefix.
[0114] In some embodiments, after the electronic device 100 installs APP1, APP1 pre-stores the beacon parameter 1 of the cloud scanning service 1, or APP1 can obtain the beacon parameter 1 of the cloud scanning service 1 from the cloud server 300.
[0115] In some embodiments, the beacon device continuously sends beacon broadcast messages at a set broadcast interval, and the beacon scanning task 1 is used to scan the beacon broadcast messages of the registered beacon devices of the cloud scanning service 1, and the beacon broadcast messages include the beacon ID.
[0116] The beacon ID is used to uniquely identify the beacon device; the beacon device supports both iBeacon and Eddystone protocols, wherein the beacon ID generation rules of the beacon device are as follows: (1) The beacon ID of an iBeacon type beacon device includes a proximity universally unique identifier (Proximity UUID), a number (Major), and a label (Minor). (2) The beacon ID of an Eddystone type beacon device includes a NameSpace ID and an Instance ID. In the embodiment of the present application, the fields that make up the beacon ID in the two protocols can also be defined by the application developer or the end user. The beacon ID prefix can be used to filter registered beacon devices that belong to the same beacon scanning service. The beacon ID prefix can be obtained from the beacon ID according to preset rules; for example, the beacon ID prefix of an iBeacon type beacon device can be the UUID in the beacon ID, and the beacon ID prefix of an Eddystone type beacon device can be the NameSpace ID in the beacon ID. The beacon ID prefix can also be defined by the application developer or the end user based on the beacon ID.
[0117] For example, the beacon ID of an iBeacon type beacon device is 14a01af0232a45189c0e899aabbccddeeff03e82711, where the UUID in the beacon ID is "14a01af0-232a-4518-9c0e-899a-abbccddeeff0", the Major value is "(short)0x3e8", the Minor value is "(short)0x2711", and the beacon ID prefix of the beacon ID is "14a01af0-232a-4518-9c0e-899a-abbccddeeff0".
[0118] For example, the beacon ID of an Eddystone-type beacon device is “5dc33487f02e477d40580117c5986919”, wherein the Namespace ID in the beacon ID is “5dc33487f02e477d4058”, the Instance ID is “0117c5986919”, and the beacon ID prefix of the beacon ID is “5dc33487f02e477d40”.
[0119] S403 . Nearby of the electronic device 100 sends a request message 1 to the cloud server 300 . The request message 1 is used to detect the legitimacy of the beacon parameter 1 .
[0120] In some embodiments, a cloud scanning service corresponds to a beacon parameter. In one implementation, based on the request message 1, the cloud server 300 can query whether there is a cloud scanning service corresponding to a beacon parameter that is the same as the beacon parameter 1; if so, the beacon parameter 1 is valid.
[0121] It can be understood that if the electronic device 100 communicates with the cloud server 300 through the communication module 1 (such as a mobile communication module, a WiFi chip or a Bluetooth chip), Nearby sends a request message 1 to the cloud server 300 by calling the above communication module 1.
[0122] S404. When beacon parameter 1 is legal, the cloud server 300 sends a response message 2 to the Nearby of the electronic device 100. The response message 2 is used to indicate that the beacon parameter 1 is legal. The response message 2 carries the filter condition 1 and callback condition 1 of the beacon scanning task 1; the filter condition 1 is used to filter out messages from beacon devices registered with the cloud scanning service 1; the above callback conditions are used to control the callback frequency of messages from the same beacon device to the AP.
[0123] Filter condition 1 indicates the value of one or more of the following filter fields: Namespace, message type, beacon ID prefix, and message content. Filter condition 1 includes: the scanned Bluetooth message carries the filter field indicated by filter condition 1 and has the same value as the filter field indicated by filter condition 1.
[0124] In some embodiments, referring to FIG5 , Nearby includes a subscription module and a Bluetooth scanning task management module, and APP1 calls Nearby to start a beacon scanning task, including: (1) when APP1 of the electronic device 100 is started, APP1 calls the subscription module of Nearby to subscribe to the cloud scanning service 1, including sending the beacon parameter 1 of the cloud scanning service 1 to the subscription module; the subscription module detects the legitimacy of the beacon parameter 1 to the cloud server 300; if it is legal, the subscription module calls the Bluetooth task management module to register the beacon scanning task 1 of the cloud scanning service 1.
[0125] Steps S403 and S404 are optional. In some embodiments, the validity of beacon parameter 1 does not need to be checked.
[0126] S405. Nearby calls the Bluetooth chip to start beacon scanning task 1.
[0127] In some embodiments, referring to FIG5 , step S405 includes: (3) the Bluetooth task management module of Nearby calls the Framework interface of the Bluetooth service to start beacon scanning task 1; (4) the Bluetooth service sends the beacon scanning task 1 to the Bluetooth chip through the Bluetooth driver of the HAL layer; the Bluetooth chip continues to perform Bluetooth scanning based on the beacon scanning task 1.
[0128] S406 , Nearby sends instruction 3 to Sensorhub. Instruction 3 is used to instruct Sensorhub to filter and call back beacon scanning task 1. Instruction 3 carries callback condition 1 and filter condition 1.
[0129] In some embodiments, referring to FIG5 , step S406 includes: (3) the Bluetooth task management module calls the MLPS interface to send callback condition 1 and filter condition 1 to the MLPS; (4) the MLPS transparently transmits callback condition 1 and filter condition 1 to the Sensorhub. The Sensorhub sets a beacon filter corresponding to beacon scanning task 1 based on filter condition 1. The beacon filter is used to filter out beacon messages from registered beacon devices of cloud scanning service 1, i.e., beacon messages that meet the aforementioned filter condition 1.
[0130] S407: Based on instruction 3, the Sensorhub sends instruction 4 to the Bluetooth chip. Instruction 4 is used to instruct the Bluetooth chip to switch the scan callback channel to the Sensorhub.
[0131] In some embodiments, instruction 4 is used to instruct the Bluetooth chip to switch the scan callback channel of the beacon scanning service to the Sensorhub. The Sensorhub is only used to implement message filtering for the beacon scanning service; message filtering for other Bluetooth scanning services is implemented by the Bluetooth chip, and the Bluetooth chip directly calls back other Bluetooth scanning services after scanning and filtering to the AP. In some embodiments, instruction 4 is used to instruct the Bluetooth chip to switch the callback channel of all messages after scanning and filtering to the Sensorhub. The Sensorhub is not only used to implement message filtering for the beacon scanning service, but also for implementing message filtering for other Bluetooth scanning services, that is, it is provided with filters corresponding to other Bluetooth scanning services.
[0132] In some embodiments, referring to FIG5 , step S407 includes: (5) Sensorhub instructs the Bluetooth chip to switch the scan callback channel to Sensorhub. At this point, beacon scanning task 1 is successfully started. The Bluetooth chip will continue to scan for beacon broadcasts in the background of the device, and Sensorhub will continue to filter and process the Bluetooth messages reported by the Bluetooth chip.
[0133] It can be understood that the electronic device 100 can start beacon scanning tasks corresponding to multiple beacon scanning services; accordingly, the Sensorhub sets the corresponding beacon filter based on the filtering condition of each beacon scanning task, and sets the callback condition corresponding to the beacon scanning task based on the callback condition of each beacon scanning task. In some embodiments, the callback conditions corresponding to different beacon scanning tasks may be different. In some embodiments, all beacon scanning tasks of APP / APP1 share a callback condition, and only one callback condition needs to be sent to the Sensorhub. For example, when Nearby first registers the beacon scanning task of APP1, callback condition 1 is sent to Sensorhub, and subsequent beacon scanning tasks registered for APP1 do not need to send callback conditions again. In some embodiments, APP1 or the electronic device 100 pre-stores a common callback condition 1, and the cloud server 300 does not need to send callback condition 1 to the electronic device 100 in step S404.
[0134] Phase 2: Scan and parse the beacon ID of the beacon device 200, and execute the preset function 1 according to the message attachment 1 corresponding to the beacon ID.
[0135] S408: The Bluetooth chip scans and receives Bluetooth message 1.
[0136] S409: The Bluetooth chip matches Bluetooth message 1 with universal filter 1; if the match is successful, the next step is executed.
[0137] S410: The Bluetooth chip reports Bluetooth message 1 to the Sensorhub.
[0138] In some embodiments, referring to FIG5 , after switching the scan callback channel of the beacon scan task, (6) the Bluetooth chip reports the scanned beacon message / beacon broadcast message to the Sensorhub.
[0139] In some embodiments, when Nearby calls the Bluetooth chip to initiate beacon scan registration task 1 in step 405, it also sends filtering condition 4 to the Bluetooth chip. Based on this condition, the Bluetooth chip sets a universal filter 1, which is used to filter out beacon messages / beacon broadcast messages from self-beacon devices. The Bluetooth chip uses universal filter 1 to perform preliminary filtering on the scanned Bluetooth messages and reports the filtered Bluetooth messages to the Sensorhub. By setting universal filter 1 in the Bluetooth chip, irrelevant Bluetooth messages can be initially filtered out, and only the beacon messages / beacon broadcast messages required for the beacon scan service are reported to the Sensorhub, reducing the power consumption of the Sensorhub. In addition, a universal filter consumes less hardware resources of the Bluetooth chip.
[0140] In one implementation, the general filter 1 is used to filter out beacon messages, and the beacon broadcast message carries a beacon device type (Beacon type); the filtering condition 4 indicated by the general filter 1 includes: the scanned Bluetooth message includes the beacon device type.
[0141] In one implementation, the general filter 1 is used to filter out beacon broadcast messages, and the destination MAC address of the broadcast message is usually a preset address (for example, the preset address is all 1 / F); the filtering condition 4 indicated by the general filter 1 includes: the scanned Bluetooth message includes a beacon device type, and the destination MAC address is a preset address.
[0142] In some embodiments, instruction 4 is used to instruct the Bluetooth chip to switch the scan callback channel of the beacon scan service to the Sensorhub. For other messages that do not meet the general filter 1, the Bluetooth chip can call back to the AP according to the existing solution.
[0143] It should be noted that when the short-range scanning method provided in the embodiment of the present application is applied to other short-range communication services, a general filter corresponding to the service can also be set in the short-range communication module, and the general filter is used to filter short-range communication messages from related devices of the service.
[0144] In some embodiments, instruction 4 is used to instruct the Bluetooth chip to switch the scan callback channel of all services to the Sensorhub. There is no need to execute S409. The Bluetooth chip directly calls back the scanned Bluetooth message to the Sensorhub.
[0145] S411. Sensorhub matches Bluetooth message 1 with the beacon filters corresponding to each beacon scanning task; if it successfully matches at least one beacon filter, the next step is executed.
[0146] In some embodiments, instruction 4 is used to instruct the Bluetooth chip to switch the scan callback channel of the beacon scanning service to the Sensorhub. In step S411, if the Bluetooth message 1 does not match the beacon filter, the message is discarded.
[0147] Filter condition 1 of beacon scan task 1 indicates the value of one or more of the following filter fields: Namespace, message type, beacon ID prefix, and message content. Taking beacon filter 1 corresponding to beacon scan task 1 as an example, Bluetooth message 1 is matched with beacon filter 1 to determine whether Bluetooth message 1 meets filter condition 1. If so, the match is successful. Specifically, Sensorhub can parse Bluetooth 1 and extract the filter fields in Bluetooth message 1 according to the format of the beacon broadcast message. If Bluetooth message 1 includes all the filter fields indicated by filter condition 1, and each filter field matches the filter field indicated by filter condition 1, then Bluetooth message 1 successfully matches the beacon filter.
[0148] The first filter field is any filter field indicated by filter condition 1, and when the first filter field is Namespace, one of the message type and beacon ID prefix, the first filter field carried by the message matches the first filter field indicated by filter condition 1, including: the first filter field carried by the message has the same value as the first filter field indicated by filter condition 1. When the first filter field is message content, the first filter field carried by the message matches the first filter field indicated by filter condition 1, including: the message content carried by the message includes the message content indicated by filter condition 1. Exemplarily, the message content indicated by filter condition 1 is one or more keywords, such as "discount", and when the message content carried by the message includes the above one or more keywords, the message content carried by the message matches the message content indicated by filter condition 1.
[0149] In some embodiments, the filter field indicated by filter condition 1 includes only the beacon ID prefix, i.e., the beacon ID prefix based on the iBeacon protocol (e.g., UUID) or the beacon ID prefix based on the Eddystone protocol (e.g., Namespace ID). If the beacon ID prefix in Bluetooth message 1 is the same as the beacon ID prefix indicated by filter condition 1, then Bluetooth message 1 successfully matches beacon filter 1.
[0150] In some embodiments, in step S406, Nearby also sends the filter condition 3 corresponding to the beacon scanning task 1 to the Sensorhub. The filter condition 3 is used to indicate the filter condition 3 that the scenario characteristics of the scenario in which the electronic device is located in the cloud scanning service 1 need to meet. The Sensorhub also sets a scenario filter based on the filter condition 3; or sets the beacon filter 1 based on the filter condition 1 and the filter condition 3. The beacon filter 1 integrates the functions of the above-mentioned scenario filter. Specifically, the above-mentioned scenario characteristics may include the characteristics of the electronic device 100 (for example, the distance, direction, speed, distance change trend, etc. relative to the beacon device), and may also include environmental characteristics (for example, weather, temperature, location, etc.). It can be understood that only when the scenario characteristics of the scenario in which the electronic device 100 is located meet the filter condition 3, the electronic device 100 provides the user with the relevant functions of the cloud scanning service 1, and the Sensorhub reports the Bluetooth message 1 to the AP.
[0151] Exemplarily, filtering condition 3 includes: the distance relative to the beacon device gradually decreases, and the above distance is less than the preset distance. A beacon device 200 is set next to the product 1 in the mall. When the user gradually approaches the beacon device 200 and is closer to the beacon device 200, the APP1 of the electronic device 100 pushes the product information corresponding to the beacon device 200. Specifically, the Bluetooth chip of the electronic device 100 scans the beacon broadcast message of the beacon device 200, and detects the distance between the beacon device 200 and the distance change trend based on the received beacon broadcast message; when the Sensorhub determines that the above distance and distance change trend meet filtering condition 3, it determines that the beacon broadcast message matches the scenario filter of the beacon scanning task 1.
[0152] Exemplarily, filtering condition 3 includes: the weather is rainy. Before the AP goes to sleep, APP1 also sends the weather of the day to Sensorhub. A beacon device 200 is set next to the shared umbrella device. When the user is close to the beacon device 200 and the weather is rainy, APP1 of the electronic device 100 pushes the preferential information of the shared umbrella. Specifically, the Bluetooth chip of the electronic device 100 scans the beacon broadcast message of the beacon device 200, and detects the distance between the beacon device 200 and the beacon device 200 based on the received beacon broadcast message; when the Sensorhub determines that the above distance and the weather of the day meet filtering condition 3, it determines that the beacon broadcast message matches the scenario filter of the beacon scanning task 1.
[0153] S412 , the Sensorhub determines whether Bluetooth message 1 meets callback condition 1; if so, the next step is executed; otherwise, the message is discarded.
[0154] The callback control of step S412 will be described in detail in subsequent embodiments and will not be elaborated here.
[0155] S413: After the AP wakes up, the Sensorhub reports Bluetooth message 1 to the Nearby in the AP.
[0156] The embodiment of the present application does not specifically limit the execution order of steps S411 and S412, and S412 may be executed first and then S411.
[0157] Step S412 is optional. In some embodiments, there is no need to issue callback condition 1 in step S406, nor to execute S412. In step S411, the Sensorhub uses the beacon filter to match the Bluetooth message. If the match is successful, it executes S413 and calls the message back to the AP; otherwise, it discards the message.
[0158] Step S411 is optional. In some embodiments, there is no need to issue filter condition 1 in step S406, nor to execute step S411. After receiving the Bluetooth message reported by the Bluetooth chip, step S412 is executed directly. In step S412, the Sensorhub matches Bluetooth message 1 with callback condition 1. If the match is successful, the message is called back to the AP; otherwise, the message is discarded.
[0159] In some embodiments, in step S413 , the Sensorhub actively wakes up the AP and reports Bluetooth message 1 , or buffers Bluetooth message 1 and waits for the AP to be woken up by other means before the Sensorhub reports Bluetooth message 1 to the AP.
[0160] In some embodiments, referring to FIG5 , step S413 includes: (7) After the AP wakes up, the Sensorhub calls back the Bluetooth message 1 to the MLPS. (8) The MLPS further calls back the Bluetooth message 1 to the Bluetooth scanning task management module of the Nearby.
[0161] S414 , Nearby sends a request message 2 to the cloud server 300 , where the request message 2 includes the beacon ID 1 in the Bluetooth message 1 .
[0162] S415. The cloud server 300 sends message attachment 1 corresponding to beacon ID 1 to Nearby.
[0163] In the embodiment of the present application, after receiving Bluetooth message 1 (e.g., a beacon broadcast message from beacon device 200), Nearby parses the beacon ID 1 in the message and calls the REST API provided by the Nearby cloud service to query the cloud server 300 for the message attachment corresponding to beacon ID 1. Cloud server 300 queries the beacon database for the message attachment corresponding to beacon ID 1 and replies all the retrieved message attachments to the subscriber, i.e., Nearby of electronic device 100, at one time.
[0164] In some embodiments, referring to FIG. 5 , step S414 includes: (9) after the AP wakes up, the Nearby message management module requests the Nearby cloud server to query the message attachment 1 corresponding to the beacon ID 1; step S415 includes: (10) the Nearby cloud server feeds back the message attachment 1 to the Nearby message management module.
[0165] S416. Nearby sends the message content in message attachment 1 to APP1.
[0166] In some embodiments, referring to FIG5 , step S416 includes: (11) After the AP wakes up, the notification module of Nearby sends the message content in message attachment 1 to APP1. It is understood that Nearby can identify which beacon scanning service the Bluetooth message is for based on the filter field carried in the Bluetooth message 1, and then report the message content of the message attachment corresponding to the Bluetooth message 1 to the APP corresponding to the beacon scanning service, such as APP1 corresponding to beacon scanning service 1.
[0167] S417 , APP1 executes preset function 1 according to the message content in message attachment 1 .
[0168] The embodiments of the present application do not specifically limit the preset function 1. In some embodiments, in the aforementioned information push scenario, the preset function 1 includes: APP1 can output push information 1 according to the message content in the message attachment 1. Exemplarily, referring to the relevant descriptions of Figures 3A to 3D, Bluetooth message 1 is a beacon broadcast message of the beacon device 200 of the gas station. The message content in the message attachment 1 corresponding to the beacon ID of the beacon device indicates the preferential information for refueling. The wallet APP pushes the preferential information for refueling to the user according to the above message content, for example, displaying the card 102 shown in Figure 3A, and the card 102 displays the preferential information for refueling.
[0169] In some embodiments, in a positioning scenario, the message content in the message attachment 1 indicates the location of the beacon device 200; the preset function 1 includes: APP1 determines the location of the electronic device 100 based on the location of the beacon device 200 in the message attachment 1, and displays the location of the electronic device 100 on a map. Specifically, based on the signal parameters of the received Bluetooth message 1 (such as the received signal strength and the signal arrival angle), the distance and direction of the electronic device 100 relative to the beacon device 200 can be determined; and then based on the above distance and direction, as well as the location of the beacon device 200 in the message content, the location of the electronic device 100 is determined.
[0170] Exemplarily, for the local scanning service of beacons, FIG7 shows a flow chart of a short-range scanning method, which includes but is not limited to steps S501 to S513.
[0171] Phase 3: Register the beacon device for local scanning service and start the beacon scanning task
[0172] S501 : APP1 of the electronic device 100 pre-stores the correspondence between the beacon ID2 of the registered beacon device 400 of the local scanning service 1 and the preset function 2 .
[0173] The application developer of APP1 has set a preset function 2 (such as door unlocking) of the local scanning service 1 for APP1. In some embodiments, after the electronic device 100 installs and starts APP1, APP1 can automatically subscribe to the local scanning service 1, that is, provide the preset function 2 of the local scanning service 1. In some embodiments, after the electronic device 100 installs and starts APP1, it subscribes to the local scanning service 1 after receiving an input operation for turning on the preset function 2. Exemplarily, with reference to the relevant descriptions of Figures 3A to 3E, the vehicle APP is provided with a switch control 304 for beacon smart unlocking. When an input operation for switching the control switch control 304 to the on state is detected, APP1 subscribes to the local scanning service 1 corresponding to the function and provides the function of unlocking the door.
[0174] APP1 registers beacon device 400 for local scanning service 1, including storing a correspondence 1 between beacon ID 2 of the registered beacon device 400 and preset function 2. APP1 of electronic device 100 can register one or more beacon devices for at least one local scanning service. The preset functions corresponding to different beacon devices can be the same or different. Preset function 2 corresponding to beacon ID 2 can be set by the user or preset by APP1 or electronic device 100, and is not specifically limited here.
[0175] In some embodiments, APP1 registers the beacon device 400 of the local scanning service 1, including: the user brings the electronic device 100 close to the beacon device 400 of interest, and the electronic device 100 and the beacon device 400 are paired and connected via Bluetooth; after successfully establishing the Bluetooth connection, APP1 registers the beacon device 400 as the beacon device of the local scanning service 1, and stores the correspondence 1 between the beacon ID 2 of the beacon device 400 and the preset function 2.
[0176] In some embodiments, APP1 registers the beacon device 400 for the local scanning service 1, including: the beacon device 400 is deployed on an electronic device 500 (e.g., a vehicle), and the electronic device 500 stores the beacon ID 2 of the beacon device 400; after the electronic device 100 and the electronic device 500 establish a connection, the electronic device 500 sends the beacon ID 2 of the beacon device 400 to the electronic device 100; APP1 registers the beacon device 400 as a beacon device for the local scanning service 1, and stores a correspondence 1 between the beacon ID 2 of the beacon device 400 and the preset function 2. The connection method between the electronic device 500 and the electronic device 100 is not specifically limited herein. For example, APP1 is a vehicle APP, and the vehicle APP of the electronic device 100 provides the function of adding a vehicle; a beacon device 400 is deployed on the vehicle 1, and the preset function 2 corresponding to the beacon ID of the beacon device 400 is door unlocking; based on the user's input operation of adding vehicle 1, the vehicle APP adds vehicle 1; after adding vehicle 1, the vehicle APP of the electronic device 100 obtains the beacon ID2 of the beacon device 400 from the vehicle 1, and stores the correspondence 1 between the beacon ID2 and the preset function 2.
[0177] In some embodiments, APP1 registers the beacon device 400 of the local scanning service 1, including: the application server of APP1 pre-stores the beacon ID2 of the registered beacon device (for example, the beacon device 400); after the electronic device 100 installs APP1, the application server of APP1 automatically sends the correspondence 1 between the beacon ID2 of the registered beacon device 400 and the preset function 2 to the electronic device 100.
[0178] The embodiment of the present application does not specifically limit the implementation method of APP1 of the electronic device 100 subscribing to the local scanning service and registering the beacon device 400.
[0179] S502 : APP1 of electronic device 100 sends instruction 5 to Nearby. Instruction 5 is used to instruct to register beacon scanning task 2 corresponding to local scanning service 1 . Instruction 5 includes beacon ID 2 of beacon device 400 registered with local scanning service 1 .
[0180] S503. Nearby calls the Bluetooth chip to start beacon scanning task 2.
[0181] S504. Nearby sends instruction 6 to Sensorhub. Instruction 6 is used to instruct Sensorhub to filter and call back beacon scanning task 2. Instruction 6 carries callback condition 2 and filter condition 2. Filter condition 2 indicates the value of the beacon ID. Filter condition 2 is used to filter the Bluetooth messages reported by the Bluetooth chip. Callback condition 2 is used to control the callback frequency of the same beacon device.
[0182] S505 : Based on instruction 6 , the Sensorhub sends instruction 7 to the Bluetooth chip. Instruction 7 is used to instruct the Bluetooth chip to switch the scan callback channel to the Sensorhub.
[0183] At this point, beacon scanning task 2 is successfully started. The Bluetooth chip will continue to perform beacon broadcast scanning in the background of the device, and the Sensorhub will continue to filter and call back the Bluetooth messages reported by the Bluetooth chip.
[0184] For the specific implementation of steps S502 to S505, please refer to the relevant descriptions of steps S402, S405, and S406 respectively, and will not be repeated here.
[0185] Phase 4: Scan and analyze the beacon ID2 of the beacon device 400, and execute the preset function 2 corresponding to the beacon ID2.
[0186] S506: The Bluetooth chip scans and receives Bluetooth message 2.
[0187] S507 , the Bluetooth chip matches the Bluetooth message 2 with the universal filter 1 ; if the match is successful, executing S508 .
[0188] S508: The Bluetooth chip reports Bluetooth message 2 to the Sensorhub.
[0189] S509 , the Sensorhub matches Bluetooth message 2 with the beacon filters corresponding to each beacon scanning task; if a match is found with at least one beacon filter, the next step is executed.
[0190] In the embodiment of the present application, if the beacon ID in Bluetooth message 2 is the same as the beacon ID indicated by the beacon filter, then Bluetooth message 2 and the beacon filter are matched successfully.
[0191] S510 , the Sensorhub determines whether Bluetooth message 2 meets callback condition 2; if so, the next step is executed; otherwise, the message is discarded.
[0192] S511. After the AP wakes up, the Sensorhub reports Bluetooth message 2 to the Nearby in the AP.
[0193] For the specific implementation of steps S506 to S511, please refer to the relevant descriptions of steps S408, S405, and S406 respectively, and will not be repeated here.
[0194] S512 . Nearby sends beacon ID 2 in Bluetooth message 2 to APP1 .
[0195] S513 , APP1 executes the preset function 2 corresponding to the beacon ID2 .
[0196] For example, App 1 is a vehicle app, and Preset Function 2 includes unlocking the vehicle doors. Referring to the smart unlocking scenario described in Figures 3A to 3E , a beacon device 400 is deployed on the door of vehicle 1. When the vehicle app of electronic device 100 scans and parses beacon ID 2 of beacon device 400, it sends a command to the onboard device of vehicle 1, instructing onboard device 1 to unlock the vehicle doors.
[0197] In an embodiment of the present application, the related functions of scanning filtering and / or message callback of the beacon device are delegated to the low-power Sensorhub. Without waking up the AP, the scanned messages are filtered in the Sensorhub according to the unified scanning filter field to filter out the beacon broadcast messages of the beacon devices that have registered for the subscribed beacon scanning service, thereby shielding the AP wake-up caused by irrelevant beacon broadcasts of non-beacon devices and unregistered beacon devices, effectively reducing the power consumption of the electronic device 100; in addition, in the cloud scanning service, the number of requests to the Nearby cloud interface can also be reduced.
[0198] Because beacon devices continuously broadcast Bluetooth signals, electronic devices within their broadcast range will continuously scan for these signals and, in turn, call back upper-layer services, frequently waking up the AP. This embodiment controls the frequency of broadcast messages from the same beacon device in the Sensorhub, reducing the frequency of AP wake-ups and thus controlling power consumption.
[0199] In some embodiments, callback condition 1 in step S412 and callback condition 2 in step S510 are the same, and callback condition 1 includes: Bluetooth message 1 is discovered for the first time; or, Bluetooth message 1 is not discovered for the first time, but the time difference between time 1 and time 2 of the last callback of Bluetooth message 1 to the AP is less than time threshold 1.
[0200] The Sensorhub caches time 1 and time 2. In some embodiments, time 1 is the time when the Bluetooth chip currently receives Bluetooth message 1, and time 2 is also the time when the Bluetooth chip currently receives Bluetooth message 1. In some embodiments, time 1 is the time when the Sensorhub currently obtains Bluetooth message 1 reported by the Bluetooth chip, and time 2 is also the time when the Sensorhub obtains Bluetooth message 1 reported by the Bluetooth chip. In some embodiments, time 1 is the current moment, and time 2 is also the time when the Sensorhub most recently called back Bluetooth message 1 to the AP.
[0201] For example, as shown in FIG8 , the callback control logic of the beacon broadcast message is exemplified below by taking the callback condition 1, the beacon device 200 and the close-range scanning process of the cloud scanning service 1 as an example.
[0202] Beacon device 200 is a beacon device 200 that has been registered with cloud scanning service 1. The beacon broadcast message sent by beacon device 200 can match the aforementioned general filter or the beacon filter corresponding to cloud scanning service 1. Beacon device 200 continuously sends beacon broadcast message 1 (i.e., the aforementioned Bluetooth message 1) according to broadcast interval 1; after the Bluetooth chip of electronic device 100 starts the beacon scanning task, if the electronic device 100 is near beacon device 200 (i.e., within the coverage range of the Bluetooth broadcast of beacon device 200), the Bluetooth chip can continuously scan for beacon broadcast message 1 and continuously report beacon broadcast message 1 to Sensorhub.
[0203] In some embodiments, as shown in FIG8 , the electronic device 100 first discovers the beacon broadcast message 1 of the beacon device 200 , and the aforementioned step S410 is specifically step S410A, step S412 is specifically step S412A, and step S413 is specifically step S413A.
[0204] S410A and the Bluetooth chip report the first discovered beacon broadcast message 1 to the Sensorhub.
[0205] S412A, Sensorhub determines that beacon broadcast message 1 is discovered for the first time, and this beacon broadcast message 1 meets callback condition 1, and executes the next step (for example, calling back the discovered beacon broadcast message 1 to the AP).
[0206] In some embodiments, the Sensorhub caches the beacon ID of the Bluetooth message called back to the AP; if the beacon ID of the cached message is the same as the beacon ID of the beacon broadcast message 1, it is determined that it is not the first time that the beacon broadcast message 1 is discovered; otherwise, it is determined that the beacon broadcast message 1 is discovered for the first time.
[0207] In some embodiments, the Sensorhub caches the beacon ID and MAC address of the Bluetooth message called back to the AP; if the beacon ID and MAC address of the cached message are the same as the beacon ID and MAC address in the beacon broadcast message 1, it is determined that it is not the first time that the beacon broadcast message 1 is discovered; otherwise, it is determined that the beacon broadcast message 1 is discovered for the first time.
[0208] In some embodiments, the Sensorhub caches a Bluetooth message that is called back to the AP; if the cached message and the beacon broadcast message 1 have the same message content, it is determined that it is not the first time that the beacon broadcast message 1 is discovered; otherwise, it is determined that the beacon broadcast message 1 is discovered for the first time.
[0209] In some embodiments, the beacon broadcast message 1 that the Sensorhub calls back to the AP is a Bluetooth message that matches one or more filters among the aforementioned general filter, beacon filter, and scenario filter.
[0210] S413A, Sensorhub reports the first discovered beacon broadcast message 1 to the Nearby in the AP.
[0211] In some embodiments, as shown in FIG8 , the electronic device 100 discovers the beacon broadcast message 1 of the beacon device 200 for the i-th time, and the aforementioned step S410 is specifically step S410B, and step S412 is specifically step S412B.
[0212] S410B, the Bluetooth chip reports the beacon broadcast message 1 discovered for the i-th time to the Sensorhub.
[0213] S412B: Sensorhub determines that this is not the first time beacon broadcast message 1 is discovered, and the time interval between time 1 and time 2 of the last callback of beacon broadcast message 1 to the AP is less than time threshold 1. This beacon broadcast message 1 does not meet callback condition 1, and the message is discarded.
[0214] In some embodiments, as shown in FIG8 , the electronic device 100 discovers the beacon broadcast message 1 of the beacon device 200 for the (i+1)th time, and the aforementioned step S410 is specifically step S410C, step S412 is specifically step S412C, and step S413 is specifically step S413C.
[0215] S410C and the Bluetooth chip report the beacon broadcast message 1 discovered for the i+1th time to the Sensorhub.
[0216] S412C: Sensorhub determines that this is not the first time beacon broadcast message 1 is discovered, and the time interval between time 1 and time 2 of the last callback of beacon broadcast message 1 to the AP is greater than time threshold 1. This beacon broadcast message 1 meets callback condition 1, and the next step is executed.
[0217] S413C, Sensorhub reports the beacon broadcast message 1 discovered for the (i+1)th time to the Nearby in the AP.
[0218] In the embodiment of the present application, by detecting "the first discovered Bluetooth message" and "controlling the callback interval of the Bluetooth message" in the Sensorhub, the continuous Bluetooth callback caused by the continuous broadcast of the same beacon device can be greatly reduced, the number of AP wake-up times can be significantly reduced, and the power consumption of the device can be reduced.
[0219] In some embodiments, beacon loss logic is also added; after discovering the beacon broadcast message 1 of the beacon device 200, if the beacon broadcast message 1 is not found again within the preset time length 1, the Sensorhub can promptly report the beacon loss event of the beacon device 200 to the AP. Based on the beacon loss event of the beacon device 200, the APP can execute the preset function 3. The embodiment of the present application does not specifically limit the preset function 3. For example, APP1 is a vehicle APP, and the beacon device 200 is used to trigger the unlocking of the car door. After the vehicle APP receives the beacon loss event of the beacon device 200 reported by the Sensorhub, if it detects that the car door is not locked, it outputs a prompt message to prompt the user to lock the car door in time.
[0220] As shown in FIG8 , in the short-range scanning method provided by the embodiment of the present application, after the beacon broadcast message 1 is first discovered in step S410A, the beacon callback control process further includes steps S601 to S604 .
[0221] S601: When the Sensorhub determines that the time since the last beacon broadcast message 1 was discovered is greater than the preset time 1, S602 is executed.
[0222] S602 : Sensorhub reports the beacon loss event of the beacon device 200 to Nearby in the AP.
[0223] The beacon loss event of the beacon device 200 reported by the Sensorhub to Nearby carries the beacon ID of the beacon device 200 .
[0224] S603. Nearby notifies APP1 of the beacon loss event.
[0225] S604. APP1 executes preset function 3 based on the beacon loss event.
[0226] To implement the "beacon loss logic", it is necessary to set a timer with a preset duration of 1. Implementing this timer in the AP requires the AP to remain active and cannot go into sleep mode. However, in the embodiment of the present application, the timer is implemented in the Sensorhub. The AP does not need to remain active and can enter sleep mode. The power consumption of the Sensorhub to implement this timer is lower.
[0227] Based on the above embodiments, the present application provides a short-range scanning method, which is applied to a first electronic device, the first electronic device including a first short-range communication module, a main processor, and a second processor. The method includes steps S701 to S705.
[0228] S701: The main processor sends a first instruction to the second processor.
[0229] S702: A first instruction is used to instruct a second processor to filter messages based on a first filtering condition, where the first filtering condition is used to filter messages from devices of a first service, where the devices of the first service include a first device.
[0230] S703: The first short-range communication module scans a first message sent by the first device.
[0231] S704: The first short-range communication module sends a first message to the second processor.
[0232] S705: The second processor determines that the first message matches the first filtering condition in the second processor, and the second processor sends the first message to the main processor.
[0233] In an embodiment of the present application, the first electronic device may include the aforementioned electronic device 100; the first short-range communication module may include the aforementioned chip; and the second processor may include the aforementioned microprocessor. In some embodiments, the first service may include the aforementioned beacon cloud scanning service 1; the first instruction may include the aforementioned instruction 3; the first device may include the aforementioned beacon device 200; the first filtering condition may include the aforementioned filtering condition 1; and the first message may include the aforementioned Bluetooth message 1. In some embodiments, the first service may include the aforementioned beacon local scanning service 1; the first instruction may include the aforementioned instruction 6; the first device may include the aforementioned beacon device 400; the first filtering condition may include the aforementioned filtering condition 2; and the first message may include the aforementioned Bluetooth message 2.
[0234] In some embodiments, the method further includes: the first short-range communication module scanning a second message sent by a second device; the first short-range communication module sending the second message to a second processor; the second processor determining that the second message does not match a first filtering condition in the second processor, and the second processor not sending the first message to the main processor. Exemplarily, the second device is a beacon device providing a beacon scanning service to which the electronic device 100 has not subscribed. Exemplarily, the second device is a Bluetooth device not providing a beacon scanning service.
[0235] In some embodiments, the method further includes: based on the first instruction, the second processor sends a second instruction to the first short-range communication module, where the second instruction is used to instruct the first short-range communication module to send the scanned message to the second processor.
[0236] In some embodiments, the method further includes: based on the first instruction, the second processor sends a second instruction to the first short-range communication module, the second instruction is used to instruct the first short-range communication module to send the scanned message of the first type of service to the second processor; the first service belongs to the first type of service.
[0237] In embodiments of the present application, the first type of service may include the aforementioned beacon scanning service. In some embodiments, the first service may include the aforementioned cloud-based beacon scanning service 1; the second instruction may include the aforementioned instruction 4. In some embodiments, the first service may include the aforementioned local beacon scanning service 1; the second instruction may include the aforementioned instruction 7.
[0238] In some embodiments, before the first short-range communication module sends the first message to the second processor, the process further includes: the main processor sending a second filtering condition to the first short-range communication module, where the second filtering condition is used to filter messages from devices with the first type of service; and the first short-range communication module sending the first message to the second processor includes: if the first short-range communication module determines that the first message meets the second filtering condition, sending the first message to the second processor. In this embodiment of the present application, the second filtering condition may include the aforementioned filtering condition 4.
[0239] In some embodiments, before the second processor sends the first message to the main processor, the main processor further includes: sending a callback condition to the second processor, the callback condition being used to instruct the second processor to send the first message to the main processor if the first message meets the callback condition. In this embodiment of the present application, the callback condition may include callback condition 1 or callback condition 2.
[0240] In some embodiments, the callback condition for the first message includes any of the following: receiving the first message for the first time; receiving the first message for a non-first time; and a time interval between the time of receiving the first message and the time of receiving the most recent first message sent to the main processor is greater than a first time threshold. In this embodiment of the present application, the first time threshold may include the aforementioned time threshold 1.
[0241] In some embodiments, the first message includes a device identifier of the first device, and the method further includes: a main processor obtaining a first message attachment associated with the first device from a server based on the device identifier of the first device; and a first application in the main processor executing a first preset function based on the message content in the first message attachment. In this embodiment of the present application, the device identifier of the first device may include a beacon ID of the first device, the first service may include the aforementioned beacon cloud scanning service 1; the first message attachment may include the aforementioned message attachment 1; and the first preset function may include the aforementioned preset function 1.
[0242] In some embodiments, the first message includes a device identification of the first device, and the method further includes: the main processor executing a second preset function based on the device identification of the first device. In this embodiment of the present application, the device identification of the first device may include a beacon ID of the first device, the first service may include the aforementioned local beacon scanning service 1; and the second preset function may include the aforementioned preset function 2.
[0243] In some embodiments, after the second processor sends the first message to the main processor, the method further includes: the second processor detecting that no message from the first device is received again within a first preset time period after receiving the message from the first device, and the second processor sending a loss event for the first device to the main processor. In this embodiment of the present application, the first preset time period may include the aforementioned preset time period 1.
[0244] In some embodiments, the first short-range communication module is a Bluetooth chip, the first service is a first beacon scanning service of a first application, and the first device is a registered beacon device for the first beacon scanning service. In this embodiment of the present application, the first application may include the aforementioned APP1, and the first beacon scanning service may include the aforementioned cloud scanning service 1 or local scanning service 1.
[0245] In some embodiments, the method also includes: the main processor sends a first request message to the server, the first request message carries the beacon parameters of the first beacon scanning service, and the first request message is used to detect the legality of the beacon parameters; when the beacon parameters are legal, the main processor receives a first response message sent by the server; the first response message carries the first filtering condition.
[0246] In some embodiments, the second filtering condition includes the beacon device type carried by the message.
[0247] In some embodiments, the device identification of the first device includes a first beacon ID, the cloud server stores one or more message attachments associated with the first beacon ID, and the main processor obtains the first message attachment associated with the first device from the server based on the device identification of the first device, including: the main processor sends a second request message to the server, the second request message includes the first beacon ID, and the second request message is used to query the message attachment associated with the first beacon ID; the main processor receives the first message attachment sent by the server, and the first message attachment is any one of the one or more message attachments.
[0248] In an embodiment of the present application, the first service may include the aforementioned cloud scanning service 1; the first request message may include the aforementioned request message 1, the first response message may include the aforementioned response message 2; the second request message may include the aforementioned request message 2; the first beacon ID may include the beacon ID1 of the aforementioned beacon device 200.
[0249] In some embodiments, the first filtering condition indicates the value of one or more of the following filtering fields of the first beacon scanning service: namespace, message type, beacon ID prefix and message content; the first message matches the first filtering condition, including: the first message carries the first filtering field, and the first filter field carried by the first message matches the first filter field indicated by the first filtering condition, and the first filter field is any filter field indicated by the first filtering condition.
[0250] In some embodiments, the device identification of the first device includes a first beacon ID, and the first application stores a correspondence between the first beacon ID and the second preset function; the main processor executes the second preset function based on the device identification of the first device, including: the first application in the main processor executes the second preset function corresponding to the first beacon ID according to the correspondence.
[0251] In some embodiments, the first filtering condition indicates a first beacon ID of the first device; and the first message matches the first filtering condition, including: the beacon ID carried by the first message is the first beacon ID.
[0252] In the embodiment of the present application, the first service may include the aforementioned local scanning service 1; the first beacon ID may include the beacon ID 2 of the aforementioned beacon device 400, the second preset function may include the aforementioned preset function 2, and the first filtering condition may include the aforementioned filtering condition 2.
[0253] The structure of the electronic device 100 involved in the embodiment of the present application is exemplarily described below.
[0254] 9 shows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0255] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0256] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0257] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0258] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0259] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0260] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the electronic device 100.
[0261] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.
[0262] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0263] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.
[0264] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0265] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0266] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.
[0267] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0268] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.
[0269] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0270] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0271] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0272] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0273] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted 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 being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0274] The wireless communication module 160 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 the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0275] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies 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. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0276] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0277] Display screen 194 is used to display images, videos, and the like. Display screen 194 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 (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
[0278] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0279] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise and brightness. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.
[0280] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0281] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0282] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0283] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0284] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0285] Random access memory may include 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, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.
[0286] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage cell potential level; universal flash storage (UFS) and embedded multi media card (eMMC) can be divided into UFS and eMMC according to the storage specification.
[0287] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0288] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .
[0289] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory.
[0290] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0291] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.
[0292] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.
[0293] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.
[0294] Microphone 170C, also known as a "microphone" or "speaker," is used to convert sound signals into electrical signals. When making a call or sending a voice message, a user can speak by approaching microphone 170C with their mouth to input the sound signal into microphone 170C.
[0295] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0296] The pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
[0297] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can also be used for image stabilization.
[0298] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
[0299] The magnetic sensor 180D includes a Hall sensor, and the electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case.
[0300] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
[0301] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance by infrared or laser.
[0302] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode.
[0303] The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed brightness of the ambient light.
[0304] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0305] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy.
[0306] The touch sensor 180K is also called a "touch-sensitive device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a location different from that of the display screen 194.
[0307] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone mass in a human vocal part.
[0308] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0309] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts and can also be used for touch vibration feedback.
[0310] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.
[0311] The SIM card interface 195 is used to connect a SIM card.
[0312] The various implementation modes of this application can be combined arbitrarily to achieve different technical effects.
[0313] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0314] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0315] In short, the above description is only an embodiment of the technical solution of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of the present invention should be included in the scope of protection of the present invention.
Claims
1. A short-range scanning method is applied to a first electronic device, the first electronic device comprising a first short-range communication module, a main processor and a second processor; the method comprises: The main processor sends a first instruction to the second processor; The first instruction is used to instruct the second processor to filter messages based on a first filtering condition, where the first filtering condition is used to filter messages from a device of a first service, where the device of the first service includes a first device; The first short-range communication module scans a first message sent by the first device; The first short-range communication module sends the first message to the second processor; The second processor determines that the first message matches the first filtering condition in the second processor, and the second processor sends the first message to the main processor.
2. The method according to claim 1, characterized in that: The method further comprises: The first short-range communication module scans a second message sent by a second device; The first short-range communication module sends the second message to the second processor; The second processor determines that the second message does not match the first filtering condition in the second processor, and the second processor does not send the first message to the main processor.
3. The method according to claim 1, characterized in that The method further comprises: Based on the first instruction, the second processor sends a second instruction to the first short-distance communication module, where the second instruction is used to instruct the first short-distance communication module to send the scanned message to the second processor.
4. The method according to claim 1, characterized in that: The method further comprises: Based on the first instruction, the second processor sends a second instruction to the first short-range communication module, where the second instruction is used to instruct the first short-range communication module to send a scanned message of a first type of service to the second processor; the first service belongs to the first type of service.
5. The method according to claim 1 or 4, characterized in that: Before the first short-range communication module sends the first message to the second processor, the method further includes: The main processor sends a second filtering condition to the first short-range communication module, where the second filtering condition is used to filter messages from devices of the first type of service; The first short-range communication module sending the first message to the second processor includes: When the first short-range communication module determines that the first message satisfies the second filtering condition, the first message is sent to the second processor.
6. The method according to claim 1, characterized in that Before the second processor sends the first message to the main processor, the method further includes: The main processor sends a callback condition to the second processor, where the callback condition is used to instruct the second processor to send the first message to the main processor when the first message meets the callback condition.
7. The method according to claim 6, characterized in that The callback condition of the first message includes any one of the following: receiving the first message for the first time; not receiving the first message for the first time, and the time interval between the time of receiving the first message this time and the time of receiving the first message last sent to the main processor is greater than a first time threshold.
8. The method according to claim 1, characterized in that The first message includes a device identifier of the first device, and the method further includes: The main processor obtains a first message attachment associated with the first device from a server based on a device identification of the first device; The first application in the main processor executes a first preset function according to the message content in the first message attachment.
9. The method according to claim 1, characterized in that: The first message includes a device identifier of the first device, and the method further includes: The main processor executes a second preset function based on the device identification of the first device.
10. The method according to claim 1, characterized in that After the second processor sends the first message to the main processor, the method further includes: The second processor detects that no message from the first device is received again within a first preset time period after receiving the message from the first device, and the second processor sends a loss event of the first device to the main processor.
11. The method according to any one of claims 1 to 10, characterized in that: The first short-range communication module is a Bluetooth chip, the first service is a first beacon scanning service of a first application, and the first device is a registered beacon device of the first beacon scanning service.
12. The method according to claim 11, characterized in that The method further comprises: The main processor sends a first request message to the server, where the first request message carries beacon parameters of the first beacon scanning service, and the first request message is used to detect the legitimacy of the beacon parameters; When the beacon parameters are legal, the main processor receives a first response message sent by the server; the first response message carries the first filtering condition.
13. The method according to claim 11, characterized in that The second filtering condition includes the type of beacon device carried by the message.
14. The method according to claim 11, characterized in that The device identification of the first device includes a first beacon ID, the cloud server stores one or more message attachments associated with the first beacon ID, and the main processor obtains a first message attachment associated with the first device from the server based on the device identification of the first device, including: The main processor sends a second request message to the server, where the second request message includes the first beacon ID, and the second request message is used to query a message attachment associated with the first beacon ID; The main processor receives a first message attachment sent by the server, where the first message attachment is any one of the one or more message attachments.
15. The method according to claim 14, characterized in that The first filtering condition indicates the value of one or more of the following filtering fields of the first beacon scanning service: namespace, message type, beacon ID prefix and message content; The first message matches the first filtering condition, including: the first message carries a first filtering field, and the first filtering field carried by the first message matches the first filtering field indicated by the first filtering condition, and the first filtering field is any filtering field indicated by the first filtering condition.
16. The method according to claim 11, characterized in that The device identification of the first device includes a first beacon ID, and the first application stores a correspondence between the first beacon ID and a second preset function; The main processor executes a second preset function based on the device identification of the first device, including: The first application in the main processor executes the second preset function corresponding to the first beacon ID according to the corresponding relationship.
17. The method according to claim 16, characterized in that The first filtering condition indicates the first beacon ID of the first device; The first message matches the first filtering condition, including: a beacon ID carried by the first message is the first beacon ID.
18. A terminal device, characterized in that: The method comprises a memory and a processor, wherein the memory and the processor are electrically coupled, the memory is used to store program instructions, and the processor is configured to call all or part of the program instructions stored in the memory to execute the method according to any one of claims 1 to 17.
19. A computer storage medium, characterized in that: The method comprises computer instructions, which, when executed on a terminal device, cause the terminal device to execute the method according to any one of claims 1 to 17.