Wi-Fi scanning method and electronic equipment

By handling multiple Wi-Fi scan requests in electronic devices in accordance with the first-in-first-out principle or delayed response, the business conflicts caused by multiple Wi-Fi scan request conflicts are resolved, and the business accuracy and user experience of fence applications are improved.

CN120475326APending Publication Date: 2025-08-12HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410162502.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-02
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

In electronic devices, multiple Wi-Fi scanning requests conflict with each other, resulting in problems in which services provided by multiple fence applications conflict and influence each other.

Method used

When an electronic device generates multiple Wi-Fi scanning requests at the same time, it responds to the requests in sequence according to the first-in-first-out principle, or delays responding to the requests after a certain time difference is met, and the requests are added to the queue to be scanned through the driver layer, and Wi-Fi information is scanned through the Wi-Fi chip in sequence, generating matching results and then associated with the fence application.

Benefits of technology

It solves the problem of conflicting multiple Wi-Fi scan requests, improves the accuracy of fence applications to provide users with business and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120475326A_ABST
    Figure CN120475326A_ABST
Patent Text Reader

Abstract

A Wi-Fi scanning method and an electronic device, relating to the technical field of terminals, the method comprising: an electronic device generating a first Wi-Fi scanning request at a first time point, and generating a second Wi-Fi scanning request at a second time point; wherein the time difference between the first time point and the second time point is smaller than or equal to the first duration, the first Wi-Fi scanning request comprises an identifier of a first frequency band, and the second Wi-Fi scanning request comprises an identifier of a second frequency band; in response to the first Wi-Fi scanning request, the electronic equipment scans Wi-Fi information on the first frequency band; in the embodiment of the invention, after the electronic equipment scans the Wi-Fi information on the first frequency band, the electronic equipment scans the Wi-Fi information on the second frequency band in response to the second Wi-Fi scanning request, so that the problem that services provided by a plurality of fence applications conflict and influence each other due to mutual conflict of a plurality of Wi-Fi scanning requests can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and more particularly to a Wi-Fi scanning method and electronic device. Background Art

[0002] Wi-Fi (wireless fidelity) fence technology is widely used in various service scenarios, such as taking the subway, high-speed rail, and airplanes, and receiving and sending express packages. Specifically, when a user's electronic device enters a Wi-Fi fence, that is, is within the geographical area covered by a Wi-Fi fence, the electronic device can trigger the corresponding fence mechanism and automatically provide the user with corresponding services (such as automatically ejecting a bus card (or access card, etc.) and a package arrival reminder).

[0003] However, when an electronic device provides multiple services to a user at the same time, there may be problems of conflicts and mutual influence among the multiple services. Summary of the Invention

[0004] The present application provides a Wi-Fi scanning method and electronic device for solving the problem that multiple Wi-Fi scanning requests conflict with each other, causing services provided by multiple fence applications to conflict with each other and affect each other.

[0005] To achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, a Wi-Fi scanning method is provided, the method comprising: an electronic device generating a first Wi-Fi scanning request at a first time point, and generating a second Wi-Fi scanning request at a second time point, wherein the time difference between the first time point and the second time point is less than or equal to a first duration, the first Wi-Fi scanning request includes an identifier of a first frequency band, and the second Wi-Fi scanning request includes an identifier of a second frequency band.

[0007] In response to the first Wi-Fi scan request, the electronic device scans for Wi-Fi information on a first frequency band; after the electronic device completes scanning the Wi-Fi information on the first frequency band, in response to the second Wi-Fi scan request, the electronic device scans for Wi-Fi information on a second frequency band. The Wi-Fi information includes a basic service set identifier (BSSID) and a wireless received signal strength (RSSI) of the Wi-Fi network.

[0008] Based on the first aspect, when the electronic device "simultaneously" generates the first Wi-Fi scan request and the second Wi-Fi scan request, the electronic device first responds to the first Wi-Fi scan request and scans the Wi-Fi information on the first frequency band; after the electronic device completes scanning the Wi-Fi information on the first frequency band, the electronic device responds to the second Wi-Fi scan request and scans the Wi-Fi information on the second frequency band, thereby resolving the problem of conflicts and mutual impact of services provided by multiple fence applications caused by conflicts between multiple Wi-Fi scan requests.

[0009] In one design, an electronic device is installed with a first fence application and a second fence application. The first fence application corresponds to a first Wi-Fi fence, and the second fence application corresponds to a second Wi-Fi fence. The method further includes: the electronic device generating a first matching result based on the scanned Wi-Fi information on the first frequency band, and associating the first fence application with the first matching result. The first matching result is used to indicate whether the electronic device has entered or exited the first Wi-Fi fence.

[0010] The electronic device generates a second matching result based on the scanned Wi-Fi information on the second frequency band, and associates the second fence application with the second matching result, wherein the second matching result is used to indicate that the electronic device has entered / exited the second Wi-Fi fence.

[0011] In this design method, after the electronic device generates the first matching result and the second matching result, the electronic device associates the first fence application with the first matching result, and then associates the second fence application with the second matching result, thereby improving the accuracy of the fence application in providing corresponding services to users, thereby improving the user experience.

[0012] In one design, the first time point and the second time point are within the same time period. Based on this, if the first time point is earlier than the second time point, the electronic device responds to the first Wi-Fi scan request and scans for Wi-Fi information on the first frequency band.

[0013] In one design, after the electronic device generates the first Wi-Fi scan request and the second Wi-Fi scan request, the method further includes: the electronic device adding the first Wi-Fi scan request and the second Wi-Fi scan request to a pending scan queue. In the pending scan queue, the first Wi-Fi scan request precedes the second Wi-Fi scan request. The electronic device then responds to the first Wi-Fi scan request and the second Wi-Fi scan request in sequence according to a first-in, first-out principle.

[0014] In this way, by adding the first Wi-Fi scan request and the second Wi-Fi scan request to the queue to be scanned, the first Wi-Fi scan request and the second Wi-Fi scan request are responded to in sequence according to the first-in-first-out principle, thereby solving the problem of multiple Wi-Fi scan requests conflicting with each other and causing the services provided by multiple fence applications to conflict with and affect each other.

[0015] In one design, a first Wi-Fi scan request is the first element in a queue to be scanned, and the first Wi-Fi scan request includes a first timestamp. Before responding to the first Wi-Fi scan request, the method further includes: the electronic device obtaining a target scan timestamp and a target scan duration included in a previous Wi-Fi scan request; if the first time difference is less than the target scan duration, the electronic device delaying responding to the first Wi-Fi scan request. The first time difference is the time difference between the first scan timestamp and the target scan timestamp.

[0016] In this way, after the first Wi-Fi scan request and the second Wi-Fi scan request are added to the queue to be scanned, the first element in the queue to be scanned is selected to determine whether it is necessary to delay the response to the Wi-Fi scan request corresponding to the first element, thereby resolving the phenomenon of multiple Wi-Fi scan requests conflicting with each other, causing the problem of multiple fence applications providing services conflicting with and affecting each other.

[0017] In one design, in response to a first Wi-Fi scan request, an electronic device scans for Wi-Fi information on a first frequency band, including: the electronic device determines a first delay duration based on a difference between a target scan duration and a first time difference; when the duration of the delayed response reaches the first delay duration, the electronic device scans for Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request.

[0018] In one design, in response to a first Wi-Fi scan request, the electronic device scans Wi-Fi information on a first frequency band, including: in response to the first Wi-Fi scan request, if a time difference between the first scan timestamp and the target scan timestamp is greater than or equal to a target scan duration, the electronic device scans Wi-Fi information on the first frequency band.

[0019] In one design, the method further includes: after the electronic device starts scanning Wi-Fi information on the first frequency band, the electronic device removes the first Wi-Fi scan request from the queue to be scanned, and updates the second Wi-Fi scan request as the first element of the queue to be scanned.

[0020] In one design, a queue to be scanned is set at a driver layer of an electronic device; the electronic device adds a first Wi-Fi scan request and a second Wi-Fi scan request to the queue to be scanned, including: the electronic device adds the first Wi-Fi scan request and the second Wi-Fi scan request to the queue to be scanned through the driver layer.

[0021] In one design, an electronic device includes a Wi-Fi chip; in response to a first Wi-Fi scan request, the electronic device scans for Wi-Fi information on a first frequency band, including: the electronic device sending the first Wi-Fi scan request to the Wi-Fi chip via a driver layer. In response to the first Wi-Fi scan request, the electronic device scans for Wi-Fi information on the first frequency band via the Wi-Fi chip.

[0022] In a second aspect, an electronic device is provided, which has the function of implementing any one of the functions described in the first aspect. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0023] In a third aspect, an electronic device is provided, comprising: a memory and one or more processors; computer program code is stored in the memory, and the computer program code includes computer instructions; when the computer instructions are executed by the processor, the electronic device executes the above-mentioned first aspect or any one of the methods in the first aspect.

[0024] In a fourth aspect, a chip system is provided, which includes: at least one processor and an interface, the interface being used to receive instructions and transmit them to at least one processor; at least one processor executes the instructions so that the electronic device executes any one of the methods described in the first aspect above.

[0025] In a fifth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, which, when executed on a computer, enables the computer to execute any one of the methods described in the first aspect.

[0026] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any one of the methods described in the first aspect.

[0027] Among them, the technical effects brought about by any implementation method in the above-mentioned second to sixth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A schematic diagram of the structure of a Wi-Fi fence provided in an embodiment of the present application;

[0029] Figure 2 A schematic diagram of an interface for entering a Wi-Fi fence provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of another interface for entering a Wi-Fi fence provided in an embodiment of the present application;

[0031] Figure 4 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of a software framework of an electronic device provided in an embodiment of the present application;

[0033] Figure 6 A schematic diagram of a Wi-Fi scan provided in an embodiment of the present application;

[0034] Figure 7 A schematic diagram of a software framework of another electronic device provided in an embodiment of the present application;

[0035] Figure 8 A schematic diagram of a Wi-Fi scanning process provided in an embodiment of the present application;

[0036] Figure 9 A schematic diagram of various channels in a 2.4 GHz frequency band provided in an embodiment of the present application;

[0037] Figure 10 A schematic diagram of whether delayed scanning is required is provided in an embodiment of the present application;

[0038] Figure 11 A schematic diagram of another embodiment of the present application for determining whether delayed scanning is required;

[0039] Figure 12 A schematic diagram of another Wi-Fi scanning process provided in an embodiment of the present application;

[0040] Figure 13 A schematic diagram of another Wi-Fi scanning process provided in an embodiment of the present application;

[0041] Figure 14 A schematic structural diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] Wi-Fi fence refers to a virtual fence created by electronic devices using Wi-Fi information at a certain location, i.e. a virtual boundary enclosed by a virtual fence. For example, Figure 1As shown in FIG, a schematic diagram of a Wi-Fi fence. Optionally, when the electronic device is moving along the moving track 01, if the position of the electronic device is Figure 1 If the electronic device is located at point A, it is considered that the electronic device has entered the Wi-Fi fence. Figure 1 When the electronic device reaches point B as shown, it is considered that the electronic device has exited the Wi-Fi fence. The area indicated by the Wi-Fi fence can represent a geographical area in the real world, such as a school, company, shopping mall, subway station, scenic spot, airport, etc.

[0043] Optionally, electronic devices may store Figure 1 The related information of the Wi-Fi fence shown includes multiple sets of Wi-Fi information 1 of a certain location collected by an electronic device, each set of Wi-Fi information 1 in the multiple sets of Wi-Fi information 1 includes a basic service set identifier (BSSID) and a received signal strength indication (RSSI) of a Wi-Fi network. Optionally, each set of Wi-Fi information 1 may also include one or more of a local area network address (MAC), a service set identifier (SSID), a boot time, or a center frequency of a Wi-Fi network, without limitation.

[0044] The boot time refers to the time it takes for the wireless access point to boot up, and the frequency refers to the center frequency of the wireless access point. The wireless access point mentioned above can be any device that can emit a Wi-Fi signal, without limitation.

[0045] Optionally, while moving, the electronic device periodically collects surrounding Wi-Fi information 2. The electronic device matches the collected Wi-Fi information 2 with the multiple sets of Wi-Fi information 1. If the collected Wi-Fi information 2 matches the multiple sets of Wi-Fi information 1, the electronic device is considered to have entered the Wi-Fi fence. If the collected Wi-Fi information 2 does not match the multiple sets of Wi-Fi information 1, the electronic device is considered to have exited the Wi-Fi fence.

[0046] Optionally, the electronic device's Wi-Fi information 2 matches the multiple sets of Wi-Fi information 1, for example: at least N BSSIDs in the multiple sets of Wi-Fi information 1 are identical to the BSSIDs in the multiple sets of Wi-Fi information 1, where N is a positive integer. Alternatively, the electronic device's Wi-Fi information 2 matches the multiple sets of Wi-Fi information 1, for example: the similarity between the multiple sets of Wi-Fi information 1 and Wi-Fi information 2 is greater than a similarity threshold, etc., without limitation. The similarity is determined by the electronic device based on the RSSIs of the multiple sets of Wi-Fi information 1 and the multiple sets of Wi-Fi information 2.

[0047] As an example, when an electronic device enters Figure 1 When the Wi-Fi fence shown is in place, the electronic device can trigger the corresponding fence mechanism to provide users with corresponding services, such as automatically popping up bus cards (or access control cards), courier arrival reminders, store arrival reminders, etc.

[0048] For example, an electronic device can include multiple virtual cards, such as community access cards, smart door lock cards, and public transportation cards, without limitation. Based on this, when the electronic device enters a Wi-Fi fence, the electronic device can automatically pop up the virtual card corresponding to the Wi-Fi fence, providing the user with instant card swiping services.

[0049] Taking mobile phones as an example, Figure 1 The area indicated by the Wi-Fi fence shown can be a company. For example, Figure 2 As shown, when a phone enters (or approaches) the area indicated by the Wi-Fi fence, the phone can automatically pop up the company access card. For example, the phone will automatically display the company access card on the phone's lock screen. Then, the user can hold the phone close to the card reader corresponding to the company access card, thereby enabling the phone to communicate with the card reader corresponding to the company access card, that is, the phone can complete the card swipe to enter the door.

[0050] Optionally, the mobile phone may include an application for enabling the virtual card to communicate with the card reader, such as a card wallet application, a smart card application, etc., without limitation. Optionally, these applications have the function of emulating a non-receiving integrated circuit (IC) card. These applications may include the above-mentioned multiple virtual cards. Optionally, the above-mentioned multiple virtual cards may be stored simultaneously in the same application; or, the above-mentioned multiple virtual cards may be stored in different applications, without limitation.

[0051] As another example, electronic devices can also provide users with smart reminder services. For example, these smart reminder services can include delivery arrival reminders, store arrival reminders, warning reminders, or notification reminders, without limitation. For example, if the smart reminder service is a store arrival reminder, when the electronic device enters a certain Wi-Fi fence, the electronic device can display a storefront photo, without limitation.

[0052] Optionally, electronic devices can display storefront photos through the notification bar interface, drop-down interface, lock screen interface, main interface or negative one screen interface without restriction.

[0053] Still taking the mobile phone as an example, Figure 1 The area indicated by the Wi-Fi fence shown is a store in a shopping mall. Figure 3 As shown in (1), when the mobile phone enters (or approaches) the area indicated by the Wi-Fi fence, the mobile phone can display the storefront photo on the lock screen interface. Figure 3 As shown in (1), the mobile phone can also display information about each product sold in the store on the lock screen. For example, the mobile phone can display the product name, product price, promotional activities, etc. without restriction.

[0054] Or, as Figure 3 As shown in (2), when the mobile phone enters (or approaches) the area indicated by the Wi-Fi fence, the mobile phone can display the payment code on the lock screen interface to prompt the user to scan the code for shopping, thereby improving the user's shopping experience.

[0055] Optionally, the mobile phone may include an application for implementing the above-mentioned smart reminder service, such as a store reminder application, a courier reminder application, etc., without limitation.

[0056] The technical solutions provided by the embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0057] The Wi-Fi scanning method provided in the embodiments of the present application can be applied to electronic devices, such as mobile phones, action cameras (GoPro), digital cameras, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, vehicle-mounted devices, ultra-mobile personal computers (UMPCs), netbooks, cellular phones, personal digital assistants (PDAs), augmented reality (AR) and virtual reality (VR) devices, etc. The embodiments of the present application do not impose any special restrictions on the specific form of the electronic devices.

[0058] For example, Figure 4 A schematic structural diagram of the electronic device 100 is shown.

[0059] Among them, 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 camera 193 and a display screen 194, etc.

[0060] It should be understood that the structures illustrated in the embodiments of the present application do 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.

[0061] The processor 110 may include one or more processor units. For example, the processor 110 may include a central processing unit (CPU), an application processor (AP), a modem (modulator-demodulator), 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). Different processing units may be independent devices or integrated into one or more processors.

[0062] In some embodiments of the present application, the processor 110 may further include an audio digital signal processor (ADSP), wherein the ADSP may include an intelligent sensor hub (Sensor Hub), which is used to obtain sensor data from various sensors and determine the real-time location of the electronic device in combination with the sensor data.

[0063] It should be noted that in some scenarios, Sensor Hub can also be called (Qualcomm sensing hub, QSH). The embodiment of this application does not limit the name of Sensor Hub. As long as the above functions can be achieved, they fall within the scope of protection of the embodiment of this application.

[0064] The controller can be the nerve center and command center of electronic device 100. Based on instruction opcodes and timing signals, the controller generates operational control signals to control instruction fetching and execution. The modem can be used to handle services related to base station communications, such as phone calls, text messages, and Internet access.

[0065] 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 retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0066] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an 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 130, etc.

[0067] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present application 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 rescue connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0068] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card 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 on the external memory card.

[0069] The internal memory 121 can be used to store one or more computer programs, which include instructions. The processor 110 can execute the above instructions stored in the internal memory 121, so that the electronic device 100 performs the methods provided in some embodiments of the present application, as well as various functional applications and data processing. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system; the program storage area may also store one or more applications (such as a gallery, contacts, etc.). The data storage area may store data created during the use of the electronic device 100 (such as photos, contacts, etc.). In addition, the internal memory 121 may include a high-speed random access memory; it may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, universal flash storage (UFS), etc. In other embodiments, the processor 110 executes the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor 110, so that the electronic device 100 performs the methods provided in the embodiments of the present application, as well as various functional applications and data processing.

[0070] The charging management module 140 is used to receive charging input from a charger interface, where the charger can be a wireless charger or a wired charger.

[0071] 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 can receive input from the battery 142 and / or the charging management module 140 to provide power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160.

[0072] The power management module 141 may be used to monitor performance parameters such as battery capacity, battery cycle count, battery charge voltage, battery discharge voltage, and battery health status (eg, leakage, impedance), etc.

[0073] The wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor. In some embodiments, antenna 1 and mobile communication module 150 of the electronic device 100 are coupled, and antenna 2 and wireless communication module are coupled, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.

[0074] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0075] 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 one or more filters, switches, power amplifiers, low noise amplifiers (LAN), 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 functions of the mobile communication module 150 can be placed in the processor 110. In some embodiments, at least some of the functions of the mobile communication module 150 can be set in the same device as at least some modules of the processor 110.

[0076] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as 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 integrating one or more communication modules. The wireless communication module 160 interfaces with electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal, and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate its frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0077] The sensor module 180 may include a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc., without limitation.

[0078] Of course, the electronic device 100 provided in the embodiment of the present application may also include one or more devices such as a positioning module 181, a button 190, a motor 191, an indicator 192 and a SIM card interface [1~N] 195, without limitation.

[0079] The methods in the following embodiments can all be implemented in the electronic device 100 having the above hardware structure. In order to make the technical solution of the present application clearer and easier to understand, the following embodiments describe the technical solution provided by the embodiments of the present application in detail in combination with the software structure of the electronic device 100.

[0080] Figure 5 This is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0081] The software structure of the electronic device can adopt a layered architecture, event-driven architecture, micro-kernel architecture, microservice architecture or cloud architecture. The embodiment of the present application takes the layered architecture as an example to illustrate the software structure of the electronic device.

[0082] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software structure of the electronic device is divided from top to bottom into: application layer (application, APP) (abbreviated as application layer), application framework layer (framework, FWK) (abbreviated as framework layer), hardware abstraction layer (hardware abstraction layer, HAL) and driver layer. For ease of understanding, in the embodiments of this application, Figure 5 Some components of the electronic device 100 are also shown, such as a Wi-Fi chip.

[0083] Optionally, in an embodiment of the present application, the application layer, application framework layer, and hardware abstraction layer can be deployed on the application processor side (i.e., AP) of the electronic device. The driver layer can be deployed on the smart sensor hub side (i.e., SensorHub) of the electronic device.

[0084] The application layer may include a series of application packages (Android application package, APK).

[0085] In some embodiments, the application layer may include multiple applications (APPs), which may include common applications and fence applications. Common applications may include applications such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, and video. Fence applications may be used to execute operations corresponding to the fence mechanism after the electronic device triggers the fence mechanism. Optionally, fence applications may include smart card applications, store reminder applications, etc., without limitation.

[0086] The framework layer provides the application programming interface (API) and programming framework for the application layer. The framework layer includes some predefined functions.

[0087] For example, Figure 5 As shown, the framework layer can include a geofence management service. Fence applications can connect to and disconnect from the geofence management service through a software development kit (SDK). Once the geofence management service is enabled, it can interact with the hardware abstraction layer during operation to implement operations such as adding, deleting, and querying Wi-Fi fence-related information.

[0088] For example, Figure 5 As shown, the hardware abstraction layer includes the Wi-Fi fence HAL. The Wi-Fi fence HAL can communicate with the driver layer through the Qualcomm messaging interface (QMI) to implement operations such as adding, deleting, and querying related information of the Wi-Fi fence.

[0089] For example, after an electronic device completes data exchange with a geofence application for the first time, the geofence application in the electronic device's application layer can collect multiple sets of Wi-Fi information at the current location and construct a corresponding Wi-Fi fence based on this multiple sets of Wi-Fi information. Subsequently, the geofence management service in the electronic device's framework layer can call a preset interface to send Wi-Fi fence-related information to the hardware abstraction layer. After receiving the Wi-Fi fence-related information, the hardware abstraction layer adds the Wi-Fi fence-related information to the driver layer through QMI.

[0090] Optionally, the electronic device may include multiple fence applications, each fence application corresponding to a Wi-Fi fence. Figure 5As shown, the fence application includes a smart card application and a store reminder application. On this basis, the smart card application corresponds to a Wi-Fi fence (such as the first Wi-Fi fence), and the store reminder application corresponds to a Wi-Fi fence (such as the second Wi-Fi fence). For example, after the electronic device completes data interaction using the smart card application for the first time, the smart card application in the application layer of the electronic device can collect multiple groups of Wi-Fi information a at the current location, and build a corresponding first Wi-Fi fence based on the multiple groups of Wi-Fi information a. Afterwards, the geo-fence management service in the framework layer of the electronic device can call a preset interface to interact with the hardware abstraction layer, and add the relevant information of the first Wi-Fi fence to the driver layer through the hardware abstraction layer. It can be understood that the relevant information of the first Wi-Fi fence includes the above-mentioned multiple groups of Wi-Fi information a.

[0091] Accordingly, after the electronic device completes data exchange with the store reminder application for the first time, the store reminder application in the electronic device's application layer can collect multiple sets of Wi-Fi information b at the current location and construct a corresponding second Wi-Fi fence based on the multiple sets of Wi-Fi information b. Subsequently, the geofence management service in the electronic device's framework layer can call a preset interface to interact with the hardware abstraction layer, and through the hardware abstraction layer, add the relevant information about the second Wi-Fi fence to the driver layer. It is understood that the relevant information about the second Wi-Fi fence includes the multiple sets of Wi-Fi information b mentioned above.

[0092] Optionally, the preset interface may be a hardware abstraction layer interface definition language (HIDL); or, the preset interface may be an Android interface definition language (AIDL), etc., without limitation.

[0093] In some embodiments, the hardware abstraction layer is further used to send Wi-Fi fence related control commands (such as delete commands, query commands, pause commands, resume commands, etc.) issued by the fence application to the driver layer.

[0094] The delete command instructs the driver layer to delete the relevant information about the Wi-Fi fence. The query command instructs the driver layer to query whether there is relevant information about the Wi-Fi fence. The pause command instructs the driver layer to pause collecting Wi-Fi information about the current location of the electronic device. The resume command instructs the driver layer to resume collecting Wi-Fi information about the current location of the electronic device.

[0095] For example, Figure 5As shown, the driver layer includes a fence matching module and a Wi-Fi driver module. The fence matching module is used to receive and store relevant information about Wi-Fi fences issued by the fence application. For example, in an embodiment of the present application, the fence matching module is used to receive and store relevant information about a first Wi-Fi fence and a second Wi-Fi fence issued by the fence application. The Wi-Fi driver module is used to drive the Wi-Fi chip to scan for Wi-Fi information around the electronic device.

[0096] Optionally, after the fence matching module of the driver layer receives and saves the relevant information of the Wi-Fi fence, the fence matching module of the driver layer periodically generates a Wi-Fi scan request and sends the Wi-Fi scan request to the Wi-Fi chip of the electronic device through the Wi-Fi driver module of the driver layer. In response to the Wi-Fi scan request, the Wi-Fi chip of the electronic device scans the Wi-Fi information around the electronic device and sends the scanned Wi-Fi information to the fence matching module through the Wi-Fi driver module of the driver layer. The fence matching module performs fence matching based on the saved relevant information of the Wi-Fi fence and the above-mentioned Wi-Fi information, and generates a matching result.

[0097] Optionally, after the fence matching module of the driver layer receives and stores the relevant information of the first Wi-Fi fence, the fence matching module of the driver layer periodically generates a Wi-Fi scan request 1 and sends the Wi-Fi scan request 1 to the Wi-Fi chip of the electronic device via the Wi-Fi driver module of the driver layer. The Wi-Fi chip of the electronic device then responds to the scan request 1 and scans for Wi-Fi information around the electronic device.

[0098] Optionally, after the fence matching module of the driver layer receives and stores the relevant information of the second Wi-Fi fence, the fence matching module of the driver layer periodically generates Wi-Fi scan request 2 and sends Wi-Fi scan request 2 to the Wi-Fi chip of the electronic device via the Wi-Fi driver module of the driver layer. The Wi-Fi chip of the electronic device then responds to scan request 2 and scans for Wi-Fi information around the electronic device.

[0099] In some embodiments, after the fence matching module of the driver layer receives and stores the information related to the first Wi-Fi fence and the second Wi-Fi fence, because the fence matching module of the driver layer periodically generates Wi-Fi scan request 1 and Wi-Fi scan request 2, the fence matching module of the driver layer periodically sends Wi-Fi scan request 1 and Wi-Fi scan request 2 to the Wi-Fi chip.

[0100] When the Wi-Fi chip of an electronic device receives Wi-Fi scan request 1 and Wi-Fi scan request 2 "simultaneously", there will be a phenomenon of concurrent scanning causing Wi-Fi scan request conflicts, which in turn causes the services provided by multiple fence applications to conflict with each other and affect each other.

[0101] The term "simultaneously" can be understood as meaning that the Wi-Fi chip of the electronic device receives Wi-Fi scan request 1 and Wi-Fi scan request 2 at the same time. Alternatively, "simultaneously" can be understood as meaning that the Wi-Fi chip of the electronic device receives Wi-Fi scan request 1 and Wi-Fi scan request 2 at the same time period, etc., without limitation. The term "same time period" refers to a relatively short period of time, such as a period of 0.1s to 0.5s.

[0102] For example, Figure 6 As shown, in the related art, when the Wi-Fi chip of an electronic device "simultaneously" receives Wi-Fi scan request 1 and Wi-Fi scan request 2, one of the Wi-Fi scan requests takes effect, while the other is blocked. In other words, the Wi-Fi chip of the electronic device responds to one of the Wi-Fi scan requests but not the other. In other words, the Wi-Fi chip of the electronic device cannot respond to multiple Wi-Fi scan requests simultaneously, resulting in Wi-Fi scan request conflicts. This, in turn, causes the services provided by multiple fence applications to conflict with and affect each other.

[0103] In addition, the electronic device's Wi-Fi chip responds to one of the Wi-Fi scan requests, scans for Wi-Fi information, and sends the scanned Wi-Fi information to the fence matching module via the Wi-Fi driver module of the driver layer. After receiving the Wi-Fi information, the fence matching module generates a matching result. In some embodiments, the fence matching module broadcasts the matching result to all fence applications in the application layer, causing some fence applications to receive "unexpected" matching results.

[0104] For example, the smart card application just received a matching result of an electronic device entering a fence at the previous moment. Since the fence matching module broadcasts the matching result, the smart card application may receive a matching result of an electronic device exiting the fence at the next moment, thereby affecting the accuracy of the corresponding service provided by the fence application.

[0105] To solve the above technical problems, the present application provides another software block diagram of an electronic device. For example, Figure 7As shown, the driver layer includes a smart card fence module, a scene fence module, a Wi-Fi scan manager, and a Wi-Fi driver module. Among them, the smart card fence module is used to receive and save the relevant information of the first Wi-Fi fence sent by the smart card application. The scene fence module is used to receive and save the relevant information of the second Wi-Fi fence sent by the store reminder application. It can be understood that the smart card application can send the relevant information of the first Wi-Fi fence to the smart card fence module of the driver layer through the framework layer and the hardware abstraction layer. The store reminder application can send the relevant information of the second Wi-Fi fence to the scene fence module of the driver layer through the framework layer and the hardware abstraction layer. The specific transmission process can refer to the above embodiment and will not be repeated here.

[0106] The Wi-Fi Scan Manager is used to receive Wi-Fi Scan Request 1 from the Smart Card Fence Module and Wi-Fi Scan Request 2 from the Scene Fence Module. After the driver layer's Wi-Fi Scan Manager receives Wi-Fi Scan Request 1 and Wi-Fi Scan Request 2, it sends the Wi-Fi Scan Requests to the Wi-Fi chip in sequence through the Wi-Fi driver module. For example, the driver layer's Wi-Fi Scan Manager receives Wi-Fi Scan Request 1 first and then Wi-Fi Scan Request 2. Therefore, the driver layer's Wi-Fi Scan Manager sends Wi-Fi Scan Request 1 to the Wi-Fi chip first, followed by Wi-Fi Scan Request 2.

[0107] Optionally, the Wi-Fi chip of the electronic device responds to Wi-Fi scan request 1 and starts scanning Wi-Fi information around the electronic device. After the last Wi-Fi scan request is completed, the Wi-Fi chip of the electronic device responds to Wi-Fi scan request 2 and starts scanning Wi-Fi information around the electronic device.

[0108] In this way, the Wi-Fi scan manager in the driver layer of the electronic device can send Wi-Fi scan requests to the Wi-Fi chip in a sequential order. The Wi-Fi chip of the electronic device can respond to one Wi-Fi scan request first, and then respond to the next Wi-Fi scan request after the previous Wi-Fi scan request is completed. This can avoid Wi-Fi scan request conflicts and solve the problem of conflicting and interfering services provided by multiple fence applications.

[0109] In some embodiments, the Wi-Fi scan request 1 sent by the smart card fence module of the driver layer to the Wi-Fi scan manager carries the identifier of the smart card application (such as the application name, application ID, etc.). After receiving the Wi-Fi scan request 1, the Wi-Fi scan manager of the driver layer records the identifier of the smart card application. Correspondingly, the Wi-Fi scan request 2 sent by the scene fence module of the driver layer to the Wi-Fi scan manager carries the identifier of the store reminder application (such as the application name, application ID, etc.). After receiving the Wi-Fi scan request 2, the Wi-Fi scan manager of the driver layer records the identifier of the store reminder application.

[0110] After the Wi-Fi chip of the electronic device receives the Wi-Fi scan request 1, Figure 7 As shown, the Wi-Fi chip of the electronic device responds to the Wi-Fi scan request 1 and starts to scan the Wi-Fi information around the electronic device to obtain Wi-Fi information 1. Then, the Wi-Fi chip of the electronic device sends the Wi-Fi information 1 to the Wi-Fi scan manager through the Wi-Fi driver module of the driver layer. Since the Wi-Fi scan manager of the driver layer records the identifier of the smart card application corresponding to the Wi-Fi scan request 1, the Wi-Fi scan manager of the driver layer will send the Wi-Fi information 1 to the smart card fence module. After the smart card fence module of the driver layer receives the Wi-Fi information 1, it performs fence matching based on the saved relevant information of the first Wi-Fi fence and the Wi-Fi information 1, generates a matching result 1, and reports the matching result 1 to the smart card application of the application layer, so that the smart card application of the application layer executes the relevant business corresponding to the matching result 1. After the Wi-Fi chip of the electronic device receives the Wi-Fi scan request 2, as shown Figure 7 As shown, the Wi-Fi chip of the electronic device responds to the Wi-Fi scan request 2 and starts to scan the Wi-Fi information around the electronic device to obtain Wi-Fi information 2. Then, the Wi-Fi chip of the electronic device sends the Wi-Fi information 2 to the Wi-Fi scan manager through the Wi-Fi driver module of the driver layer. Since the Wi-Fi scan manager of the driver layer records the identifier of the store arrival reminder application corresponding to the Wi-Fi scan request 2, the Wi-Fi scan manager of the driver layer will send the Wi-Fi information 2 to the scene fence module. After receiving the Wi-Fi information 2, the scene fence module of the driver layer performs fence matching based on the saved relevant information of the first Wi-Fi fence and the Wi-Fi information 2, generates a matching result 2, and reports the matching result 2 to the store arrival reminder application of the application layer, so that the store arrival reminder application of the application layer executes the relevant business corresponding to the matching result 2.

[0111] It is understood that the Smart Card Fence module of the driver layer can report matching result 1 to the Smart Card application of the application layer through the hardware abstraction layer and the framework layer. Correspondingly, the scene fence module of the driver layer can report matching result 2 to the store reminder application of the application layer through the hardware abstraction layer and the framework layer.

[0112] In some embodiments, the Smart Card Fence Module and Scene Fence Module of the driver layer include a fence matching algorithm (Algorithm) that is used to implement the fence matching scheme in the embodiments of the present application. For example, the Smart Card Fence Module of the driver layer uses the fence matching algorithm to generate matching result 1 based on the relevant information of the first Wi-Fi fence and Wi-Fi information 1. The scene fence module of the driver layer uses the fence matching algorithm to generate matching result 2 based on the relevant information of the second Wi-Fi fence and Wi-Fi information 2.

[0113] In the above embodiment, the electronic device's Wi-Fi chip can distribute the scan results to the fence matching module corresponding to the fence application through the Wi-Fi scan manager. For example, the electronic device's Wi-Fi chip can distribute Wi-Fi information 1 to the Smart Card fence module corresponding to the Smart Card application through the Wi-Fi scan manager, and distribute Wi-Fi information 2 to the scene fence module corresponding to the store arrival reminder application through the Wi-Fi scan manager. In this way, the fence matching module corresponding to the fence application can distribute the generated matching results to the corresponding fence application. For example, the Smart Card fence module distributes matching result 1 to the Smart Card application, and the scene fence module distributes matching result 2 to the store arrival reminder application. This can improve the accuracy of the fence application in providing corresponding services to users, thereby improving the user experience.

[0114] Furthermore, as can be seen from the above embodiments, the Wi-Fi fence matching capability is deployed in the Sensor Hub, meaning that the Sensor Hub performs the Wi-Fi fence matching function. Because the Sensor Hub is a low-power processor, it can perform Wi-Fi fence matching without waking up the AP, providing all-weather Wi-Fi fence matching capabilities while also reducing power consumption.

[0115] It should be noted that in the embodiment of the present application, the functions provided by the Wi-Fi scan manager can also be deployed in the Wi-Fi driver module, and the Wi-Fi driver module implements the above functions. The specific implementation process can refer to the above embodiment and will not be repeated here.

[0116] The above embodiments describe the technical solutions provided by the embodiments of the present application in conjunction with the hardware structure and software framework of the electronic device. Below, in conjunction with the accompanying drawings, the specific process of the Wi-Fi scanning method provided by the embodiments of the present application is described in detail. It is understood that the various steps shown in the embodiments of the present application are merely some examples of the present application and do not constitute a limitation of the present application. Of course, the Wi-Fi scanning method provided by the embodiments of the present application may also include more or fewer steps than those shown in the figure, without limitation.

[0117] For example, the Wi-Fi scanning method provided in the embodiments of the present application can be executed by electronic devices such as mobile phones, tablet computers, and smart bracelets, or by chips, chip systems, or processors capable of implementing the method, or by logic modules or software capable of implementing all or part of the functions of the electronic device, without limitation. The following embodiments describe in detail the Wi-Fi scanning method provided in the embodiments of the present application using electronic devices as the execution subject.

[0118] Figure 8 A flow chart of a Wi-Fi scanning method provided in an embodiment of the present application. For example, Figure 8 As shown, the method may include the following steps.

[0119] Step 201: The electronic device generates a first Wi-Fi scan request at a first time point and generates a second Wi-Fi scan request at a second time point, wherein the time difference between the first time point and the second time point is less than or equal to a first duration, the first Wi-Fi scan request includes an identifier of a first frequency band, and the second Wi-Fi scan request includes an identifier of a second frequency band.

[0120] Optionally, the first fence application can be the aforementioned smart card application, and the second fence application can be a store arrival reminder application. Alternatively, the first fence application can be a store arrival reminder application, and the second fence application can be a smart card application, etc., without limitation.

[0121] The fact that the time difference between the first time point and the second time point is less than or equal to the first duration can be understood as: the electronic device "simultaneously" generates the first Wi-Fi scan request and the second Wi-Fi scan request. For example, when the electronic device generates the first Wi-Fi scan request and the second Wi-Fi scan request at the same time, the first duration can be zero. When the electronic device generates the first Wi-Fi scan request and the second Wi-Fi scan request in the same time period, the first duration can be less than a threshold, which can be, for example, 0.1s-0.5s, etc., without limitation.

[0122] In some embodiments, the Wi-Fi scan request carries scan information, which may include an identifier of the fence application, an identifier of the scan frequency band, etc. Of course, the scan information may also include other information, such as the scan type, scan duration, scan timestamp, and scan period, without limitation.

[0123] The identifier of the fence application may be, for example, an application name or an application ID, etc., without limitation.

[0124] The identification of the scanned frequency band may include the identification of the 2.4G frequency band and the identification of the 5G frequency band. Figure 9 As shown in the figure, the frequency of the 2.4G band is 2.412GHz~2.484GHz, and the bandwidth is 80MHz. Figure 9 As shown, the 2.4G frequency band includes 14 overlapping channels, each with a channel bandwidth of 22MHz. For example, the 14 channels included in the 2.4G frequency band can be {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}. In some embodiments, the 5G frequency band corresponds to a frequency of 5.150GHz to 5.825GHz and a bandwidth of 750MHz. The 5G frequency band includes 201 channels, but only 13 of them are frequently used. These 13 channels can be, for example, {36, 38, 40, 44, 46, 48, 149, 151, 153, 157, 159, 161, 165}.

[0125] Scan types include active scanning and passive scanning. Among them, active scanning is that the Wi-Fi chip of the electronic device periodically sends a probe request frame to the access point device (AP) to obtain a list of APs. Since the time for active scanning to obtain the list of APs is relatively short, active scanning can reduce the scanning time, thereby reducing the power consumption of Wi-Fi scanning. Passive scanning is that the Wi-Fi chip of the electronic device passively receives the beacon frame sent by the AP and obtains the list of APs by parsing the beacon frame.

[0126] The scan duration refers to the time it takes for an electronic device to scan for Wi-Fi information. The scan timestamp refers to the time when a Wi-Fi scan is initiated to the Wi-Fi chip. In the embodiments of the present application, the scan timestamp can be understood as the time when the Wi-Fi chip of the electronic device receives the Wi-Fi scan request.

[0127] Based on the above, in the embodiments of the present application, the first frequency band and the second frequency band may be the same or different. For example, the first frequency band and the second frequency band may both be 2.4 GHz bands. Alternatively, the first frequency band and the second frequency band may both be 5 GHz bands. Alternatively, the first frequency band may be 2.4 GHz band and the second frequency band may be 5 GHz band. Alternatively, the first frequency band may be 5 GHz band and the second frequency band may be 2.4 GHz band, etc., without limitation.

[0128] Step 202: In response to the first Wi-Fi scan request, the electronic device scans for Wi-Fi information on the first frequency band; after the electronic device completes scanning the Wi-Fi information on the first frequency band, in response to the second Wi-Fi scan request, the electronic device scans for Wi-Fi information on the second frequency band.

[0129] Taking the first frequency band as the 2.4G frequency band as an example, illustratively, the electronic device scanning the Wi-Fi information on the first frequency band means: the electronic device sequentially scans the Wi-Fi information of multiple channels on the 2.4G frequency band. For example, the 2.4G frequency band includes the 14 channels shown above, and the electronic device can sequentially scan the Wi-Fi information of the 14 channels on the 2.4G frequency band. Taking the second frequency band as the 5G frequency band as an example, illustratively, the electronic device scanning the Wi-Fi information on the second frequency band means: the electronic device sequentially scans the Wi-Fi information of multiple channels on the 5G frequency band. For example, the 5G frequency band includes the 13 channels shown above, and the electronic device can sequentially scan the Wi-Fi information of the 13 channels on the 5G frequency band.

[0130] Based on the above embodiment, for example, after the electronic device completes scanning the Wi-Fi information on the first frequency band, it can be understood that the electronic device sequentially scans the Wi-Fi information on 14 channels on the 2.4 GHz frequency band. For example, the electronic device first scans the Wi-Fi information on channel 1 on the 2.4 GHz frequency band, then scans the Wi-Fi information on channel 2 on the 2.4 GHz frequency band, then scans the Wi-Fi information on channel 3 on the 2.4 GHz frequency band, and so on, until the Wi-Fi information on channel 14 on the 2.4 GHz frequency band is scanned.

[0131] To summarize, with the solution of the present application, when an electronic device "simultaneously" generates a first Wi-Fi scan request and a second Wi-Fi scan request, the electronic device responds to the first Wi-Fi scan request and scans the Wi-Fi information on the first frequency band; after the electronic device completes scanning the Wi-Fi information on the first frequency band, the electronic device responds to the second Wi-Fi scan request and scans the Wi-Fi information on the second frequency band, thereby avoiding conflicts among multiple Wi-Fi scan requests and solving the problem of conflicts and mutual influence among services provided by multiple fence applications.

[0132] It should be noted that, in the embodiment of the present application, multiple fence applications including a first fence application and a second fence application are used as an example for illustration. Of course, multiple fence applications may also include other fence applications, such as a third fence application, etc. The specific implementation process can refer to the above embodiment and will not be repeated here.

[0133] In some embodiments, when an electronic device generates a first Wi-Fi scan request and a second Wi-Fi scan request within the same time period, if the first time point is earlier than the second time point, the electronic device responds to the first Wi-Fi scan request to scan for Wi-Fi information on the first frequency band. After the electronic device completes scanning for Wi-Fi information on the first frequency band, the electronic device responds to the second Wi-Fi scan request to scan for Wi-Fi information on the second frequency band.

[0134] Optionally, if the second time point is earlier than the first time point, the electronic device scans for Wi-Fi information on the second frequency band in response to the second Wi-Fi scan request. After the electronic device completes scanning for Wi-Fi on the second frequency band, the electronic device scans for Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request.

[0135] Optionally, if the first time point and the second time point are the same, the electronic device first responds to either the first Wi-Fi scan request or the second Wi-Fi scan request. For example, the electronic device first responds to the first Wi-Fi scan request to scan for Wi-Fi information on the first frequency band. After the electronic device completes scanning the Wi-Fi information on the first frequency band, it then responds to the second Wi-Fi scan request to scan for Wi-Fi information on the second frequency band. Of course, in this embodiment, the electronic device may also first respond to the second Wi-Fi scan request and then respond to the first Wi-Fi scan request, without limitation.

[0136] In other embodiments, the electronic device may add the generated multiple Wi-Fi scan requests to a queue to be scanned, and then select multiple Wi-Fi scan requests from the queue to be scanned in sequence according to the first-in-first-out principle, and respond to them in sequence.

[0137] Exemplarily, the electronic device adds the first Wi-Fi scan request and the second Wi-Fi scan request to a queue to be scanned, and then responds to the first Wi-Fi scan request and the second Wi-Fi scan request in sequence according to a first-in-first-out principle.

[0138] Optionally, if the first Wi-Fi scan request is added to the queue to be scanned first and the second Wi-Fi scan request is added to the queue to be scanned later, the first Wi-Fi scan request is located before the second Wi-Fi scan request in the queue to be scanned. If the second Wi-Fi scan request is added to the queue to be scanned first and the first Wi-Fi scan request is added to the queue to be scanned later, the second Wi-Fi scan request is located before the first Wi-Fi scan request in the queue to be scanned.

[0139] In this embodiment, the electronic device manages multiple Wi-Fi scan requests by adding them to a queue to be scanned. It then responds to all Wi-Fi scan requests sequentially, following a first-in, first-out principle. This prevents conflicts between multiple Wi-Fi scan requests and resolves the issue of conflicting and interfering services provided by multiple fence applications.

[0140] In some embodiments, after the electronic device adds multiple Wi-Fi scan requests to a queue to be scanned, the electronic device selects the first element in the queue to be scanned (i.e., the first Wi-Fi scan request). The electronic device then determines whether the first Wi-Fi scan request in the queue to be scanned requires a delayed response based on the scan timestamp and scan duration included in the previous Wi-Fi scan request, as well as the scan timestamp included in the first Wi-Fi scan request. If the first Wi-Fi scan request in the queue to be scanned requires a delayed response, the electronic device determines the duration of the delayed response.

[0141] For example, with respect to the first and second Wi-Fi scan requests described above, assuming the first Wi-Fi scan request is the first element in the queue to be scanned, the first Wi-Fi scan request illustratively includes a first scan timestamp. Before responding to the first Wi-Fi scan request, the method further includes: the electronic device obtaining a target scan timestamp and a target scan duration included in the previous Wi-Fi scan request. Based on the target scan timestamp and the target scan duration, as well as the first scan timestamp, the electronic device determines whether to delay responding to the first Wi-Fi scan request.

[0142] It should be noted that the scan duration is related to the scan type. For example, when the scan type is active scan, the scan duration corresponding to the active scan is duration 1 (for example, 0.5s). When the scan type is passive scan, the scan duration corresponding to the passive scan is duration 2 (for example, 1.2s). On this basis, the above Wi-Fi scan request may include the scan type but not the scan duration, and the corresponding scan duration is obtained based on the scan type.

[0143] That is, the electronic device may determine whether to delay responding to the first Wi-Fi scan request based on the target timestamp and scan type included in the previous Wi-Fi scan request and the first scan timestamp included in the first Wi-Fi scan request.

[0144] Optionally, if the time difference between the first scan timestamp and the target scan timestamp is less than the target scan duration, the electronic device delays responding to the first Wi-Fi scan request. If the time difference between the first scan timestamp and the target scan timestamp is greater than or equal to the target scan duration, there is no need to delay responding to the first Wi-Fi scan request. Exemplarily, if the time difference between the first scan timestamp and the target scan timestamp is greater than or equal to the target scan duration, after generating the first Wi-Fi scan request, the electronic device may respond to the first Wi-Fi scan request and scan for Wi-Fi information on the first frequency band.

[0145] Taking the previous Wi-Fi scan request corresponding to the active scan type (scanning duration is 0.5s) as an example, for example, Figure 10 As shown in (1), the target scan timestamp corresponding to the last Wi-Fi scan request is T0. Here, the target scan timestamp T0 can be understood as the scan initiation time corresponding to the last Wi-Fi scan request. Since the scan type corresponding to the last Wi-Fi scan request is active scan, the scan duration is 0.5s. On this basis, when the first scan timestamp corresponding to the first Wi-Fi scan request is T0+t1, and t1<0.5s (for example, 0.2s), the time difference between the first scan timestamp and the target scan timestamp is T0+t1-T0=t1<0.5s, indicating that the scan corresponding to the last Wi-Fi scan request has not yet ended, so it is necessary to delay the response to the first Wi-Fi scan request.

[0146] Or, as Figure 10 As shown in (2), when the first scan timestamp corresponding to the first Wi-Fi scan request is T0+t2, and t2>0.5s (for example, 0.6s), the time difference between the first scan timestamp and the target scan timestamp is T0+t2-T0=t2>0.5s, indicating that the scan corresponding to the previous Wi-Fi scan request has ended, and therefore there is no need to delay responding to the first Wi-Fi scan request.

[0147] For example, the target scan timestamp corresponding to the previous Wi-Fi scan request is 10:00:00.000, and the first scan timestamp corresponding to the first Wi-Fi scan request is 10:00:00.200. Therefore, the time difference between the first scan timestamp and the target scan timestamp is 0.2s, which is less than the target scan duration of 0.5s. Therefore, it is necessary to delay the response to the first Wi-Fi scan request. Alternatively, the target scan timestamp corresponding to the previous Wi-Fi scan request is 10:00:00.000, and the first scan timestamp corresponding to the first Wi-Fi scan request is 10:00:00.600. Therefore, the time difference between the first scan timestamp and the target scan timestamp is 0.6s, which is greater than the target scan duration of 0.5s. Therefore, it is not necessary to delay the response to the first Wi-Fi scan request.

[0148] Taking the previous Wi-Fi scan request corresponding to the passive scan type (scanning duration is 1.2s) as an example, for example, Figure 11 As shown in (1), the target scan timestamp corresponding to the last Wi-Fi scan request is T1. Here, the target scan timestamp T1 can be understood as the scan initiation time corresponding to the last Wi-Fi scan request. Since the scan type corresponding to the last Wi-Fi scan request is active scan, the scan duration is 1.2s. On this basis, when the first scan timestamp corresponding to the first Wi-Fi scan request is T1+t3, and t3<1.2s (for example, 0.8s), the time difference between the first scan timestamp and the target scan timestamp is T1+t3-T1=t3<1.2s, indicating that the scan corresponding to the last Wi-Fi scan request has not yet ended, so it is necessary to delay the response to the first Wi-Fi scan request.

[0149] Or, as Figure 11 As shown in (2), when the first scan timestamp corresponding to the first Wi-Fi scan request is T1+t4, and t4>1.2s (for example, 1.4s), the time difference between the first scan timestamp and the target scan timestamp is T0+t4-T0=t4>1.2s, indicating that the scan corresponding to the previous Wi-Fi scan request has ended, and therefore there is no need to delay responding to the first Wi-Fi scan request.

[0150] For example, the target scan timestamp corresponding to the previous Wi-Fi scan request is 10:00:00.000, and the first scan timestamp corresponding to the first Wi-Fi scan request is 10:00:00.800. Therefore, the time difference between the first scan timestamp and the target scan timestamp is 0.8s, which is less than the target scan duration of 1.2s. Therefore, it is necessary to delay the response to the first Wi-Fi scan request. Alternatively, the target scan timestamp corresponding to the previous Wi-Fi scan request is 10:00:00.000, and the first scan timestamp corresponding to the first Wi-Fi scan request is 10:00:01.400. Therefore, the time difference between the first scan timestamp and the target scan timestamp is 1.4s, which is greater than the target scan duration of 1.2s. Therefore, it is not necessary to delay the response to the first Wi-Fi scan request.

[0151] In some embodiments, when the electronic device determines that a delayed response to the first Wi-Fi scan request is required, the electronic device may further determine a first delay duration. When the delayed response duration reaches the first delay duration, the Wi-Fi chip of the electronic device responds to the first Wi-Fi scan request and scans for Wi-Fi information on the first frequency band. The first delay duration is the duration that the Wi-Fi chip of the electronic device delays responding to the first Wi-Fi scan request.

[0152] For example, Figure 10 As shown in (1), when the scan type corresponding to the last Wi-Fi scan request is active scan, the first delay duration may be, for example, 0.5s-t1. It is understood that t1 is the time difference between the first scan timestamp and the target scan timestamp.

[0153] Another example is Figure 11 As shown in (1), when the scan type corresponding to the last Wi-Fi scan request is passive scan, the first delay duration may be, for example, 1.2s-t3. It is understood that t3 is the time difference between the first scan timestamp and the target scan timestamp.

[0154] Optionally, when the electronic device determines that the first Wi-Fi scan request requires a delayed response, the electronic device starts a timer. When the timer reaches a first delay time, the electronic device responds to the first Wi-Fi scan request and scans Wi-Fi information on the first frequency band.

[0155] In summary, by performing delayed management on the scan queue, that is, before the Wi-Fi information corresponding to the previous Wi-Fi scan request has been scanned, the response to the current Wi-Fi scan request can be delayed, thereby avoiding the phenomenon of multiple Wi-Fi scan request conflicts and further solving the problem of conflicting and mutual impact of services provided by multiple fence applications.

[0156] The following examples are combined Figure 7 The software block diagram shown in FIG. 1 illustrates the interaction between various modules to provide a detailed description of the specific implementation process of the Wi-Fi scan request provided in the embodiment of the present application. Figure 12 As shown, the interaction between the modules may include the following steps.

[0157] Step 1: The smart card application of the electronic device sends relevant information of the first Wi-Fi fence to the smart card fence module.

[0158] For example, Figure 7 As shown, the smart card application of the electronic device can send relevant information of the first Wi-Fi fence to the smart card fence module of the driver layer through the framework layer and the hardware abstraction layer.

[0159] Step 2: The store arrival reminder application of the electronic device sends relevant information of the second Wi-Fi fence to the scene fence module.

[0160] For example, Figure 7 As shown, the store arrival reminder application of the electronic device can send relevant information of the second Wi-Fi fence to the scene fence module of the driver layer through the framework layer and the hardware abstraction layer.

[0161] The order of step 1 and step 2 is not limited and is subject to actual settings. For example, step 1 may be performed before step 2. Alternatively, step 1 may be performed after step 2. Alternatively, step 1 and step 2 may be performed simultaneously.

[0162] Step 3: The smart card fence module of the electronic device sends a Wi-Fi scan request 1 to the Wi-Fi scan manager.

[0163] Exemplarily, after receiving relevant information of the first Wi-Fi fence, the smart card fence module of the electronic device generates a Wi-Fi scan request 1 at a first time point and sends the Wi-Fi scan request 1 to the Wi-Fi scan manager.

[0164] Step 4: The scene fence module of the electronic device sends a Wi-Fi scan request 2 to the Wi-Fi scan manager.

[0165] Exemplarily, after receiving the relevant information of the second Wi-Fi fence, the scene fence module of the electronic device generates a Wi-Fi scan request 2 at a second time point and sends the Wi-Fi scan request 2 to the Wi-Fi scan manager.

[0166] The order of steps 3 and 4 is not limited and is subject to actual circumstances. For example, when the first time point is earlier than the second time point, step 3 is performed before step 4. Alternatively, when the second time point is earlier than the first time point, step 4 is performed before step 3. Alternatively, when the first time point is equal to the second time point, steps 3 and 4 are performed simultaneously without limitation.

[0167] Step 5: The Wi-Fi scan manager of the electronic device adds Wi-Fi scan request 1 and Wi-Fi scan request 2 to a queue to be scanned.

[0168] Step 6: The Wi-Fi scan manager of the electronic device selects the first element in the queue to be scanned and determines whether it is necessary to delay sending the Wi-Fi scan request corresponding to the first element to the Wi-Fi chip.

[0169] It can be understood that the Wi-Fi scan manager of the electronic device sends a Wi-Fi scan request to the Wi-Fi chip through the Wi-Fi driver module. The Wi-Fi chip of the electronic device responds to the Wi-Fi scan request and starts scanning the Wi-Fi information around the electronic device. On this basis, if the Wi-Fi scan manager of the electronic device determines that it is necessary to delay sending the Wi-Fi scan request corresponding to the first element to the Wi-Fi chip, then the Wi-Fi chip of the electronic device will delay responding to the Wi-Fi scan request. Therefore, the above step 6 can also be understood as described in the above embodiment: the electronic device determines whether it is necessary to delay responding to the Wi-Fi scan request.

[0170] Step 7: If the Wi-Fi scan manager of the electronic device needs to delay sending the Wi-Fi scan request corresponding to the first element to the Wi-Fi chip, the Wi-Fi scan manager of the electronic device determines the delay duration.

[0171] For the illustration of steps 6 and 7, please refer to the specific description in the above embodiment, which will not be repeated here.

[0172] Step 8: The Wi-Fi scan manager of the electronic device sends a Wi-Fi scan request 1 to the Wi-Fi chip.

[0173] Step 9: In response to the Wi-Fi scan request 1 , the Wi-Fi chip of the electronic device scans the Wi-Fi information on the first frequency band to obtain Wi-Fi information 1 .

[0174] For an example illustration of step 9, please refer to the specific description in the above embodiment, which will not be repeated here.

[0175] Step 10: The Wi-Fi chip of the electronic device sends Wi-Fi information 1 to the Wi-Fi scan manager.

[0176] Step 11: After the Wi-Fi scan manager of the electronic device receives the Wi-Fi information 1, the Wi-Fi scan manager of the electronic device sends a Wi-Fi scan request 2 to the Wi-Fi chip.

[0177] It should be noted that after the Wi-Fi scan manager of the electronic device receives Wi-Fi information 1, it indicates that the Wi-Fi chip of the electronic device has completed scanning the Wi-Fi information on the first frequency band. Based on this, the Wi-Fi scan manager of the electronic device can send a Wi-Fi scan request 2 to the Wi-Fi chip.

[0178] Step 12: In response to the Wi-Fi scan request 2, the Wi-Fi chip of the electronic device scans the Wi-Fi information on the second frequency band to obtain Wi-Fi information 2.

[0179] For an example illustration of step 12, please refer to the specific description in the above embodiment, which will not be repeated here.

[0180] Step 13: The Wi-Fi chip of the electronic device sends Wi-Fi information 2 to the Wi-Fi scan manager.

[0181] Step 14: The Wi-Fi scanning manager of the electronic device sends Wi-Fi information 1 to the smart card fence module.

[0182] Step 15: The Wi-Fi scan manager of the electronic device sends Wi-Fi information 2 to the scene fence module.

[0183] For example, after the electronic device's Wi-Fi scan manager receives Wi-Fi information 1 and Wi-Fi information 2, the electronic device's Wi-Fi scan manager sends Wi-Fi information 1 to the smart card fence module based on the smart card application's identifier. The electronic device's Wi-Fi scan manager sends Wi-Fi information 2 to the scene fence module based on the store reminder application's identifier.

[0184] Step 16: The smart card fence module of the electronic device generates a matching result 1 based on the Wi-Fi information 1 and the relevant information of the first Wi-Fi fence.

[0185] Step 17: The scene fence module of the electronic device generates matching result 2 based on Wi-Fi information 2 and related information of the second Wi-Fi fence.

[0186] For the illustration of steps 16 and 17, please refer to the specific description in the above embodiment, which will not be repeated here.

[0187] Step 18: The smart card fence module of the electronic device reports the matching result 1 to the smart card application.

[0188] Exemplarily, the smart card fence module of the electronic device reports matching result 1 to the smart card application according to the identifier of the smart card application.

[0189] For example, Figure 7 As shown, the smart card fence module of the electronic device reports matching result 1 to the smart card application of the application layer through the hardware abstraction layer and the framework layer. After receiving the matching result 1, the smart card application of the electronic device executes the relevant business corresponding to the matching result 1.

[0190] Step 19: The scene fence module of the electronic device reports the matching result 2 to the store reminder application.

[0191] Exemplarily, the scene fence module of the electronic device reports the matching result 2 to the store arrival reminder application based on the identifier of the store arrival reminder application.

[0192] For example, Figure 7 As shown, the store reminder application of the electronic device reports matching result 2 to the store reminder application of the application layer through the hardware abstraction layer and the framework layer. After receiving the matching result 2, the store reminder application of the electronic device executes the relevant business corresponding to the matching result 2.

[0193] In summary, by adopting the solution of the embodiments of the present application, when an electronic device "simultaneously" generates multiple Wi-Fi scan requests, conflicts among the multiple Wi-Fi scan requests can be avoided, thereby resolving the problem of conflicting and mutually influencing services provided by multiple fence applications. Furthermore, by adopting the solution of the embodiments of the present application, the electronic device can assign matching results to the corresponding fence application based on the fence application identifier included in the previous Wi-Fi scan request, thereby improving the accuracy of the fence application in providing corresponding services to the user, thereby improving the user experience.

[0194] The following examples are in conjunction with the appended Figure 13 , the specific implementation process of the Wi-Fi scanning method provided in the embodiment of the present application is illustrated by way of example. Figure 13 As shown, the method may include the following steps.

[0195] Step 301: The electronic device “simultaneously” generates a first Wi-Fi scan request and a second Wi-Fi scan request.

[0196] For an example of step 301 , reference may be made to step 201 in the above embodiment, which will not be repeated here.

[0197] Step 302: The electronic device adds the first Wi-Fi scan request and the second Wi-Fi scan request to a queue to be scanned.

[0198] Step 303: The first Wi-Fi scan request is the first element in the queue to be scanned, and the electronic device determines whether to delay responding to the first Wi-Fi scan request.

[0199] Illustratively, in combination with the above embodiment, the electronic device may determine whether to delay responding to the first Wi-Fi scan request and determine the first delay duration according to the scan type of the last Wi-Fi scan request.

[0200] Optionally, when the scan type of the last Wi-Fi scan request is active scan, the electronic device determines whether it is necessary to delay responding to the first Wi-Fi scan request and determines the first delay duration based on the scan duration corresponding to the active scan (for example, 0.5s).

[0201] Optionally, when the scan type of the last Wi-Fi scan request is passive scanning, the electronic device determines whether it is necessary to delay responding to the first Wi-Fi scan request and determines the first delay duration based on the scan duration corresponding to the passive scan (for example, 1.2s).

[0202] Step 304: The electronic device scans Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request.

[0203] In some embodiments, if the electronic device determines that a delay in responding to the first Wi-Fi scan request is required, then when the delay duration reaches the first delay duration, the electronic device executes step 304. In other embodiments, if the electronic device determines that a delay in responding to the first Wi-Fi scan request is not required, the electronic device immediately executes step 304.

[0204] Step 305: The electronic device removes the first Wi-Fi scan request from the queue to be scanned, and updates the second Wi-Fi scan request as the first element of the queue.

[0205] It is understandable that when the electronic device updates the second Wi-Fi scan request to the first element of the queue, the electronic device may execute steps 401 to 403. For example, Figure 13 As shown, in step 401, the electronic device determines whether to delay responding to the second Wi-Fi scan request and determines a second delay duration. In step 402, the electronic device scans for Wi-Fi information on a second frequency band in response to the second Wi-Fi scan request. In step 403, the electronic device generates a second matching result based on the scanned Wi-Fi information on the second frequency band and related information about the second Wi-Fi fence, and associates the second fence application with the second matching result.

[0206] For the examples of steps 401 to 403 , reference may be made to the examples of steps 303 , 304 and 306 , which will not be described in detail here.

[0207] Step 306: The electronic device generates a first matching result based on the scanned Wi-Fi information on the first frequency band and the relevant information of the first Wi-Fi fence, and associates the first fence application with the first matching result.

[0208] Exemplarily, the electronic device associating the first fence application with the first matching result means that the electronic device triggers the first fence application to execute the corresponding service corresponding to the first matching result in response to the first matching result. Figure 7 As shown, the electronic device associating the first fence application with the first matching result means that the smart card fence module of the electronic device reports the first matching result to the first fence application.

[0209] For the illustration of other embodiments of steps 301 to 306 , reference may be made to the specific descriptions in the above embodiments, which will not be repeated here.

[0210] Furthermore, in the embodiments of the present application, the first fence application may correspond to the aforementioned smart card application, and the second fence application may correspond to the aforementioned store arrival reminder application. The first matching result may correspond to the aforementioned matching result 1, and the second matching result may correspond to the aforementioned matching result 2. The first Wi-Fi scan request may correspond to the aforementioned Wi-Fi scan request 1, and the second Wi-Fi scan request may correspond to the aforementioned Wi-Fi scan request 2, etc., without limitation.

[0211] It should be noted that the contents recorded in each embodiment of the present application can explain the technical solutions in other embodiments of the present application, and the technical features recorded in each embodiment can also be applied in other embodiments, and the technical features in other embodiments can be combined to form a new solution. This application only exemplifies several embodiments for illustration, and does not mean that this application is limited to this.

[0212] The present application provides an electronic device, which may include a memory and one or more processors; the memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device performs the various functions or steps in the above embodiments. The structure of the electronic device can refer to the above Figure 4 The structure of the electronic device 100 is shown.

[0213] The present application also provides a chip system for use in electronic devices. Figure 14 As shown, the chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 can be Figure 4 The processor 110 shown is, on this basis, the interface circuit 1102 can be, for example, an interface circuit between the processor 1101 and an external memory; or an interface circuit between the processor 1101 and an internal memory.

[0214] The processor 1101 and the interface circuit 1102 can be interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (such as the memory of the electronic device 100). For another example, the interface circuit 1102 can be used to send signals to other devices (such as the processor 1101). Exemplarily, the interface circuit 1102 can read instructions stored in the memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the electronic device can perform the various functions or steps performed by the mobile phone in the above embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiments of the present application.

[0215] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the various functions or steps executed by the electronic device in the above method embodiment.

[0216] An embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the functions or steps executed by the electronic device in the above method embodiment.

[0217] It should be noted that the terms "first" and "second" in the specification, claims and drawings of this application are used to distinguish different objects, rather than to describe a specific order. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of 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 this embodiment, unless otherwise specified, "multiple" means two or more.

[0218] Furthermore, the terms "include," "comprise," and "have," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements, but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0219] It should be understood that in this application, "at least one (item)" refers to one or more. "Multiple" refers to two or more. "At least two (items)" refers to two or three and more than three. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple. “When” and “if” both mean that corresponding measures will be taken under certain objective circumstances. They do not limit the time, nor do they require any judgment action when they are implemented, nor do they mean that there are other limitations.

[0220] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner to facilitate understanding.

[0221] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules according to the system, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

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

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

[0224] In addition, the functional units in various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0225] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0226] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A Wi-Fi scanning method, characterized in that: Applied to electronic equipment, the method includes: The electronic device generates a first Wi-Fi scan request at a first time point, and generates a second Wi-Fi scan request at a second time point; wherein a time difference between the first time point and the second time point is less than or equal to a first duration, the first Wi-Fi scan request includes an identifier of a first frequency band, and the second Wi-Fi scan request includes an identifier of a second frequency band; In response to the first Wi-Fi scan request, the electronic device scans for Wi-Fi information on the first frequency band; After the electronic device finishes scanning the Wi-Fi information on the first frequency band, in response to the second Wi-Fi scan request, the electronic device scans the Wi-Fi information on the second frequency band; The Wi-Fi information includes a basic service set identifier (BSSID) and a wireless received signal strength (RSSI) of a Wi-Fi network.

2. The method according to claim 1, characterized in that The electronic device is installed with a first fence application and a second fence application, the first fence application corresponds to a first Wi-Fi fence, and the second fence application corresponds to a second Wi-Fi fence; The method further comprises: The electronic device generates a first matching result based on the scanned Wi-Fi information on the first frequency band, and associates the first fence application with the first matching result; wherein the first matching result is used to indicate that the electronic device enters / exits the first Wi-Fi fence; The electronic device generates a second matching result based on the scanned Wi-Fi information on the second frequency band, and associates the second fence application with the second matching result; wherein the second matching result is used to instruct the electronic device to enter / exit the second Wi-Fi fence.

3. The method according to claim 1 or 2, characterized in that The first time point and the second time point are within the same time period; and in response to the first Wi-Fi scan request, the electronic device scanning Wi-Fi information on the first frequency band includes: If the first time point is earlier than the second time point, the electronic device scans Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request.

4. The method according to any one of claims 1 to 3, characterized in that After the electronic device generates the first Wi-Fi scan request and the second Wi-Fi scan request, the method further includes: The electronic device adds the first Wi-Fi scan request and the second Wi-Fi scan request to a queue to be scanned; wherein, in the queue to be scanned, the first Wi-Fi scan request is located before the second Wi-Fi scan request; The electronic device responds to the first Wi-Fi scan request and the second Wi-Fi scan request in sequence according to a first-in-first-out principle.

5. The method according to claim 4, characterized in that The first Wi-Fi scan request is the first element in the queue to be scanned, and the first Wi-Fi scan request includes a first scan timestamp. Before responding to the first Wi-Fi scan request, the method further includes: The electronic device obtains the target scanning timestamp and target scanning duration included in the last Wi-Fi scanning request; If the first time difference is less than the target scan duration, the electronic device delays responding to the first Wi-Fi scan request; wherein the first time difference is the time difference between the first scan timestamp and the target scan timestamp.

6. The method according to claim 5, characterized in that The step of scanning, by the electronic device, Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request includes: The electronic device determines a first delay duration based on a difference between the target scanning duration and the first time difference; When the duration of the delayed response reaches the first delay duration, the electronic device scans for Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request.

7. The method according to claim 5 or 6, characterized in that The step of scanning, by the electronic device, Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request includes: In response to the first Wi-Fi scan request, if the time difference between the first scan timestamp and the target scan timestamp is greater than or equal to the target scan duration, the electronic device scans for Wi-Fi information on the first frequency band.

8. The method according to any one of claims 5 to 7, characterized in that The method further comprises: After the electronic device starts scanning Wi-Fi information on the first frequency band, the electronic device removes the first Wi-Fi scan request from the queue to be scanned, and updates the second Wi-Fi scan request as the first element of the queue to be scanned.

9. The method according to any one of claims 4 to 8, characterized in that The queue to be scanned is arranged at a driving layer of the electronic device; The electronic device adding the first Wi-Fi scan request and the second Wi-Fi scan request to a queue to be scanned, including: The electronic device adds the first Wi-Fi scan request and the second Wi-Fi scan request to the queue to be scanned through the driver layer.

10. The method according to claim 9, characterized in that The electronic device includes a Wi-Fi chip; The step of scanning, by the electronic device, Wi-Fi information on the first frequency band in response to the first Wi-Fi scan request includes: The electronic device sends the first Wi-Fi scan request to the Wi-Fi chip through the driver layer; In response to the first Wi-Fi scan request, the electronic device scans for Wi-Fi information on the first frequency band through the Wi-Fi chip.

11. An electronic device, characterized in that: include: memory and one or more processors; The memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 10.

12. A chip system, characterized in that: include: at least one processor and an interface; The interface is used to receive instructions and transmit them to the at least one processor; The at least one processor executes the instructions so that the electronic device performs the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 1 to 10.

14. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.