Wireless scanning method and apparatus, electronic device, and storage medium

CN116456428BActive Publication Date: 2026-09-04GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310509294.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-06
Publication Date
2026-09-04
Estimated Expiration
2043-05-06

AI Technical Summary

Technical Problem

但是,相关的无线网络扫描方式,灵活性还有待提高

Benefits of technology

[0008] This application provides a wireless scanning method, apparatus, electronic device, and storage medium. When the electronic device is in a disconnected network state, it first scans for wireless networks using a first scanning method on a first channel. If network usage demand is detected during this first scanning process, it then scans for wireless networks using a second scanning method on a second channel, where the number of channels in the second channel is greater than the number of channels in the first channel. This method improves the flexibility of wireless network scanning by first scanning the first channel using the first scanning method when the electronic device is in a disconnected network state, and then switching to the second scanning method on the second channel when network usage demand is detected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116456428B_ABST
    Figure CN116456428B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a wireless scanning method and device, electronic equipment and storage medium. The method comprises: when the network connection state of the electronic equipment is a non-connected state, scanning a wireless network through a first scanning mode, the first scanning mode being a mode of scanning a wireless network on a first channel; in the process of scanning the wireless network through the first scanning mode, if network use demand is detected, scanning the wireless network through a second scanning mode, wherein the second scanning mode is a mode of scanning a wireless network on a second channel, and the number of channels of the second channel is greater than the number of channels of the first channel. Through the above mode, when the network connection state of the electronic equipment is a non-connected state, the wireless network is first scanned on the first channel through the first scanning mode, and when network use demand is monitored, the wireless network is scanned on the second channel through the second scanning mode, thereby improving the flexibility of wireless network scanning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of terminal technology, specifically relating to a wireless scanning method, device, electronic device, and storage medium. Background Technology

[0002] Electronic devices (workstations STA) use Wireless Fidelity (Wi-Fi) technology to establish a connection with a wireless access point (AP) to access a wireless network. For example, if an electronic device has a built-in Wi-Fi module, it first needs to scan for available wireless networks nearby in order to access the network. However, the flexibility of the relevant wireless network scanning methods still needs improvement. Summary of the Invention

[0003] In view of the above problems, this application proposes a wireless scanning method, apparatus, electronic device, and storage medium to improve the above problems.

[0004] In a first aspect, embodiments of this application provide a wireless scanning method applied to an electronic device. The method includes: when the network connection state of the electronic device is disconnected, scanning a wireless network using a first scanning method, wherein the first scanning method is a wireless network scanning method performed on a first channel; during the process of scanning the wireless network using the first scanning method, if a network usage requirement is detected, scanning the wireless network using a second scanning method, wherein the second scanning method is a wireless network scanning method performed on a second channel, and the number of channels in the second channel is greater than the number of channels in the first channel.

[0005] Secondly, embodiments of this application provide a wireless scanning device operating on an electronic device. The device includes: a first scanning unit, configured to scan a wireless network using a first scanning method when the network connection status of the electronic device is non-connected, wherein the first scanning method is a wireless network scanning method performed on a first channel; and a second scanning unit, configured to scan a wireless network using a second scanning method if a network usage requirement is detected during the scanning of the wireless network using the first scanning method, wherein the second scanning method is a wireless network scanning method performed on a second channel, and the number of channels in the second channel is greater than the number of channels in the first channel.

[0006] Thirdly, embodiments of this application provide an electronic device, including one or more processors and a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the methods described above.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, wherein the above-described method is executed when the program code is run.

[0008] This application provides a wireless scanning method, apparatus, electronic device, and storage medium. When the electronic device is in a disconnected network state, it first scans for wireless networks using a first scanning method on a first channel. If network usage demand is detected during this first scanning process, it then scans for wireless networks using a second scanning method on a second channel, where the number of channels in the second channel is greater than the number of channels in the first channel. This method improves the flexibility of wireless network scanning by first scanning the first channel using the first scanning method when the electronic device is in a disconnected network state, and then switching to the second scanning method on the second channel when network usage demand is detected. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This illustration shows an application scenario diagram of a wireless scanning method proposed in an embodiment of this application;

[0011] Figure 2 A flowchart of a wireless scanning method according to an embodiment of this application is shown;

[0012] Figure 3 This illustration shows a schematic diagram of the scanning process for scanning WiFi networks using the PNO scanning method in one embodiment of this application;

[0013] Figure 4 This illustration shows a schematic diagram of a scanning process for scanning a WiFi network using a periodic scanning method, according to one embodiment of this application.

[0014] Figure 5 A flowchart of a wireless scanning method according to another embodiment of this application is shown;

[0015] Figure 6 A flowchart of a wireless scanning method according to another embodiment of this application is shown;

[0016] Figure 7 A schematic diagram showing the scanned wireless network is shown in yet another embodiment of this application;

[0017] Figure 8 This paper shows a structural block diagram of a wireless scanning device according to an embodiment of the present application;

[0018] Figure 9 A structural block diagram of an electronic device for performing a wireless scanning method according to an embodiment of this application is shown;

[0019] Figure 10 A storage unit for storing or carrying program code implementing the wireless scanning method according to an embodiment of the present application is shown. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0021] With the development and widespread adoption of wireless networks, electronic devices accessing the internet via wireless networks has become an indispensable method for users due to its lack of operator tariff restrictions. For example, when a user turns on the Wi-Fi switch of their electronic device, the device continuously scans for nearby Wi-Fi networks and then provides the user with a list of the found networks, allowing the user to choose a suitable network to connect to.

[0022] The WiFi network access process can include four steps: scanning, authentication, association, and access. Scanning is divided into active scanning and passive scanning. This application embodiment uses active scanning as an example for explanation. Active scanning is actively searching for networks instead of waiting for the wireless network to declare its existence. That is, the electronic device (workstation STA) actively sends a Probe Request frame on each channel to request a response from a specific wireless network. The workstation using active scanning will scan the channels listed in the channel table in the following procedure: (1) Jump to a certain channel and wait for an indication of an incoming frame or until the Probe Delay timer expires. If a frame is received on this channel, it proves that a user is using the channel, so it can be probed. The Probe Delay timer can be used to prevent an idle channel from stopping the whole process, because the workstation will not wait for the frame to arrive indefinitely. (2) Obtain the right to use the medium using the basic DCF access procedure, and then send a Probe Request frame. (3) Wait for at least the shortest channel time (MinChannelTime). If the medium is not busy, it means no network exists, and you can jump to the next channel. If the medium is very busy during the MinChannelTime period, continue waiting for a period of time until the longest channel time (MaxChannelTime) times out, and then process any probe response frames. The probe response frame may include, but is not limited to, wireless network information such as Service Set Identifier (SSID), Basic Service Set Identifier (BSSID), encryption and authentication methods.

[0023] When electronic devices search for WiFi hotspots, the process can sometimes take a long time because there are multiple access points (APs) in the area. When an electronic device sends a Probe Request frame, multiple APs respond with Probe Response frames through a congestion window. This contention process is limited by the longest channel time (MaxChannelTime). When a wireless network receives a Probe Request to search for its Extended Service Set (ESS), it sends a Probe Response frame. To find all nearby wireless networks, the Probe Request frame can use the broadcast SSID (Service Set Identifier). In this way, all 802.11 wireless networks in the area will respond with a Probe Response.

[0024] Furthermore, after the electronic device (workstation STA) actively scans and obtains information about surrounding WiFi hotspots, it initiates an authentication request to the WiFi access point (AP device) based on this information. For example, a mobile phone scans for surrounding WiFi hotspots and displays the SSID of the scanned hotspots on its screen. If a user needs to join a wireless network, they can click on the corresponding SSID on the screen. The phone responds to the user's click by displaying a password input window. After the user enters the password and other information in the password input window, they click the connect button. The phone responds to the user's action on the connect button by sending an authentication request frame to the WiFi access point based on the password and other information entered by the user.

[0025] After receiving an authentication request from an electronic device (STA), the WiFi access point performs authentication based on the information carried in the authentication request, obtains the authentication result, and returns the authentication result to the electronic device (STA).

[0026] After receiving the authentication result from the WiFi access point, if the authentication is successful, the electronic device (workstation STA) sends an association request to the WiFi access point. In response to the association request, the WiFi access point sends an association response to the electronic device (workstation STA) to notify it that the association is successful. At this point, the electronic device (workstation STA) has connected to the wireless network provided by the WiFi access point.

[0027] The inventors discovered in their research on related wireless scanning methods that electronic devices employ different scanning methods depending on whether the screen is on or off. Specifically, when the screen is on, a periodic scanning method is used; when the screen is off, a PNO (Preferred Network Offloading) scanning method is used. In these methods, when the electronic device is not connected to the network, a single scanning method is consistently used, resulting in a need for improved flexibility in wireless network scanning.

[0028] Therefore, the inventors have proposed the wireless scanning method, apparatus, electronic device, and storage medium of this application. When the network connection status of the electronic device is disconnected, it first scans for wireless networks using a first scanning method, which involves scanning for wireless networks on a first channel. During the scanning process using the first scanning method, if network usage demand is detected, it then scans for wireless networks using a second scanning method, where the second scanning method involves scanning for wireless networks on a second channel, and the number of channels in the second channel is greater than the number of channels in the first channel. Through this method, when the network connection status of the electronic device is disconnected, it first scans for wireless networks on the first channel using the first scanning method, and when network usage demand is detected, it switches to scanning for wireless networks on the second channel using the second scanning method, thus improving the flexibility of wireless network scanning.

[0029] The following describes the application environment of the wireless scanning method provided in this invention:

[0030] Please see Figure 1 The network coverage area of ​​electronic device 100 includes multiple wireless access points, such as Figure 1 The device 100 has a first wireless access point 101, a second wireless access point 102, and a third wireless access point 103. Each wireless access point requires a channel to connect to the electronic device 100. That is, each wireless access point is located on a channel, but different wireless access points can be located on different channels or on the same channel.

[0031] When electronic device 100 enters the coverage area of ​​the network, it begins to scan the wireless access points within the coverage area. Specifically, the system of electronic device 100 sends a scan request. After receiving the scan command, the WiFi chip or other underlying network module of electronic device 100 scans according to the preset channel scanning order, such as first scanning the commonly used channels 1, 7, and 13, and then scanning other unused channels.

[0032] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0033] Please see Figure 2 This application provides a wireless scanning method applied to an electronic device, the method comprising:

[0034] Step S110: When the network connection status of the electronic device is not connected, the wireless network is scanned by a first scanning method, which is a wireless network scanning method on a first channel.

[0035] In this embodiment, the network connection status of an electronic device refers to its wireless network connection status. The network connection status of an electronic device can include a connected state and a disconnected state. A connected state indicates that the electronic device is connected to a wireless network; a disconnected state indicates that the electronic device is not connected to a wireless network. The electronic device can be a device with WiFi capability, such as a mobile phone, tablet, laptop, streaming media player, smart wearable device, e-reader, or other device capable of WiFi connection.

[0036] The first scanning method is PNO (preferred network offloading) scanning. PNO scanning is a method of scanning specific wireless networks through PNO firmware, and its advantage is low power consumption. For example, the scanning process for scanning WiFi networks using PNO scanning can be as follows: Figure 3 As shown, in Figure 3 In the process, the WiFi system module in the framework layer first initiates a WiFi network scan request and sends the scan request to the WiFi HAL layer interface in the hardware abstraction layer. Then, the WiFi HAL layer interface in the hardware abstraction layer sends the scan request to the WiFi PNO driver in the kernel layer. The WiFi PNO driver in the kernel layer then sends the scan request to the PNO firmware. After receiving the scan request, the PNO firmware responds to the scan request and begins to perform a WiFi network scan.

[0037] In this embodiment of the application, wireless network may refer to WiFi network, ZigBee network, WiMax network, etc., and is not specifically limited here.

[0038] The first channel can be a channel used for wireless network scanning in a specific setting, or a channel where the wireless network is located that has been saved. Here, "channel" refers to the channel on which the wireless network is located; in this embodiment, the channel can be a WiFi channel. Electronic devices may operate on different WiFi frequency bands, and therefore, different WiFi channels are available on different WiFi frequency bands.

[0039] It is known that the most common WiFi operating frequency bands are currently 2.4GHz and 5GHz. Therefore, this application embodiment uses 2.4GHz and 5GHz as examples. Of course, the WiFi operating frequency bands mentioned in this application embodiment are not limited to the commonly used 2.4GHz and 5GHz. For example, the WiFi operating frequency band in this application embodiment can also be 6GHz in sixth-generation WiFi (WiFi 6).

[0040] Each WiFi operating frequency band has available WiFi channels. Taking China as an example, there are 14 available WiFi channels on the 2.4 GHz band, namely channels 1 to 14. The available WiFi channels on the 5 GHz band include channels 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, and 165.

[0041] In this embodiment, as one approach, the electronic device can operate simultaneously on both the 2.4GHz and 5GHz frequency bands. For example, if the electronic device scans for WiFi access points via its built-in WiFi module, and if the WiFi module supports Dual Band Dual Concurrent (DBDC), the electronic device can operate on both frequency bands simultaneously. The DBDC-enabled electronic device integrates two complete pathways, including two complete baseband processors and two radio frequency front-ends.

[0042] Dual-band concurrent AP devices can simultaneously emit 2.4GHz and 5GHz network signals, providing two WiFi networks: one on the 2.4GHz band and the other on the 5GHz band.

[0043] For STA devices that support DBDC, the STA device can simultaneously connect to both a 2.4GHz WiFi network and a 5GHz WiFi network. These two WiFi networks can be provided by the same AP device or by two separate AP devices. For example, a DBDC-enabled mobile phone can simultaneously connect to both the 2.4GHz and 5GHz WiFi networks of wireless router A, or it can connect separately to the 2.4GHz WiFi network of wireless router A and the 5GHz WiFi network of wireless router B.

[0044] Alternatively, electronic devices can operate on only one frequency band at a time, meaning they can only operate on either the 2.4GHz or 5GHz band simultaneously. For example, a dual-band wireless router A operates on both the 2.4GHz and 5GHz bands, providing WiFi networks on both bands. Since the WiFi module of an electronic device can only operate on one band, the device can only connect to either the 2.4GHz or 5GHz WiFi network, and cannot connect to both bands simultaneously.

[0045] That is, when the WiFi module of an electronic device can operate in two frequency bands, the first channel can be a partial channel among all the channels corresponding to the two frequency bands; when the WiFi module of an electronic device can only operate in one frequency band, the first channel can be a partial channel among all the channels corresponding to the one frequency band.

[0046] In this embodiment of the application, when the network connection status of the electronic device is detected to be disconnected, it can be detected whether the WiFi function of the electronic device is turned on. If the WiFi function of the electronic device is turned on, a wireless network scan is started on the first channel using the first scanning method.

[0047] Specifically, the WiFi function of an electronic device can be controlled to be enabled or disabled via a WiFi control component installed within the device. This WiFi control component can be a pre-configured component used to control whether the electronic device's WiFi function is enabled.

[0048] Step S120: During the process of scanning the wireless network using the first scanning method, if a network usage requirement is detected, the wireless network is scanned using the second scanning method. The second scanning method is a method of scanning the wireless network on a second channel, and the number of channels in the second channel is greater than the number of channels in the first channel.

[0049] In the embodiments of this application, the process of scanning a wireless network using the first scanning method can refer to the process of continuing to scan for a wireless network using the first scanning method after a wireless network has been detected, or it can refer to the process of not detecting a wireless network using the first scanning method. No specific limitation is made here.

[0050] Network usage requests can be triggered by applications running on or about to run on electronic devices. When an application needs to send or receive data, it can be determined that a network usage request has been generated. The running application can be at least one of the following: a foreground application, a background application, or a specific application; no specific limitation is made here.

[0051] In cases where network usage demand is triggered by an application about to run on an electronic device, it is possible to predict whether an application is about to launch at the current time based on the user's historical usage data. If an application is predicted to run, it can be determined that a network usage demand has been generated.

[0052] The second scanning method is periodic scanning, which refers to a method of scanning wireless networks using a WiFi chip. For example, the scanning process for WiFi networks using periodic scanning can be as follows: Figure 4 As shown, in Figure 4 In the process, the WiFi system module in the application layer or framework layer first initiates a WiFi network scan request and sends the scan request to the WiFi HAL layer interface in the hardware abstraction layer. Then, the WiFi HAL layer interface in the hardware abstraction layer sends the scan request to the WiFi driver in the kernel layer. Finally, the WiFi driver in the kernel layer sends the scan request to the WiFi chip. After receiving the scan request, the WiFi chip responds to the scan request and begins to perform a WiFi network scan.

[0053] pass Figure 3 and Figure 4 The main differences between the wireless scanning methods shown are:

[0054] (1) The two scan targets are different. The periodic scan method can be initiated by the Wi-Fi system module of the framework layer or by a third-party application, such as Meituan or Baidu Maps; while the PNO scan method is mainly initiated by the Wi-Fi system module of the framework layer.

[0055] (2) The chips that perform the scan are different: the periodic scan method is performed by the Wi-Fi chip, while the PNO scan method is performed by the PNOfirmware.

[0056] When an electronic device is in screen-on mode, it first scans for wireless networks using the PNO scanning method. Then, if a network usage demand is detected, it switches to the periodic scanning method to scan for wireless networks, which can reduce the power consumption of the electronic device.

[0057] The second channel refers to the pre-set channel used for wireless network scanning via the WiFi chip. The second channel can be any of the channels corresponding to the electronic device's operating frequency band, or it can be a subset of all channels corresponding to the electronic device's operating frequency band. The number of channels in the second channel is greater than the number of channels in the first channel.

[0058] In the case where the second channel is a partial channel, the second channel can be determined based on the wireless environment parameters of each channel in the current scenario. These wireless environment parameters can be one or more of the following: WiFi connection-related wireless data, such as the number of wireless networks within the channel, the data transmission volume within the channel, and the channel's signal-to-noise ratio. The data transmission volume can be the amount of data transmitted within a preset time period, such as the amount of communication data within one second.

[0059] Of course, other wireless environmental parameters may also include, such as the channel's EVM (Error Vector Magnitude) value and the channel's congestion index. The methods for obtaining these various wireless environmental parameters can refer to existing methods and are not limited here.

[0060] When determining the second channel based on the wireless environment parameters of each channel, all channels corresponding to the operating frequency band of the electronic device can be sorted according to the wireless environment parameters of the channel, and then the channel ranked at a specified position can be used as the second channel. The specified position can be determined based on the number of channels in the first channel.

[0061] In the embodiments of this application, when determining the second channel based on the wireless environment parameters of each channel, the second channel can be determined based on one or more wireless environment parameters.

[0062] As one approach, when determining the second channel based on a wireless environment parameter of the channel, all channels corresponding to the operating frequency band of the electronic device can be directly sorted according to the magnitude of the wireless environment parameter, and the channel in the specified position can be used as the second channel. In this case, the wireless environment parameter can be one of the following: the number of wireless networks within the channel, the amount of data transmitted within the channel, the signal-to-noise ratio of the channel, the EVM (Error Vector Magnitude) value of the channel, or the congestion index of the channel.

[0063] For example, if the second channel is determined based on the congestion index of the channel, all channels corresponding to the operating frequency band of the electronic device can be arranged in ascending order based on the congestion index of each channel, and then the channel arranged at the specified position can be used as the second channel.

[0064] As another approach, when determining the second channel based on multiple wireless environment parameters of a channel, the multiple wireless environment parameters corresponding to each channel can be weighted and summed to obtain an evaluation value for each channel. Then, based on the evaluation value of each channel, all channels corresponding to the operating frequency band of the electronic device can be sorted, and the channel ranked at a specified position can be designated as the second channel. In this case, the wireless environment parameters can be at least two of the following: the number of wireless networks within the channel, the data transmission volume within the channel, the channel's signal-to-noise ratio, the channel's EVM (Error Vector Magnitude) value, and the channel's congestion index. Before weighting and summing the multiple wireless environment parameters corresponding to each channel, a weight is pre-assigned for each wireless environment network parameter. Therefore, when weighting and summing the multiple wireless environment parameters corresponding to each channel, the weighted summation can be performed based on the weight of each wireless environment network parameter. The weight corresponding to each wireless environment parameter can be set by relevant personnel based on experience, and no specific limitations are imposed here.

[0065] For example, when determining the second channel based on the channel congestion index and the channel signal-to-noise ratio (SNR), corresponding weights can be pre-set for the channel congestion index and the channel SNR. For instance, the weight of the channel congestion index can be set to 0.4, and the weight of the channel SNR can be set to 0.6. Then, after obtaining the congestion index and the channel SNR for each channel, the congestion index of each channel is multiplied by 0.4 to obtain the first value, and the SNR of each channel is multiplied by 0.6 to obtain the second value. The first and second values ​​are then added together to obtain the evaluation value for each channel. After obtaining the evaluation value for each channel, all channels corresponding to the operating frequency band of the electronic device can be sorted according to the evaluation value of each channel, and the channel ranked at the specified position is selected as the second channel.

[0066] Optionally, in this embodiment, each channel has a different scanning duration, and the second channel can be determined based on the scanning duration of each channel. The scanning duration can be a pre-set duration sufficient to scan all wireless networks within the channel, or it can be a duration determined based on the wireless environment parameters of the channel; no specific limitation is made here.

[0067] When determining the second channel based on the scan duration of each channel, the same method as described above can be used to sort all channels corresponding to the operating frequency band of the electronic device based on the length of the scan duration, and the channel arranged in the specified position can be used as the second channel.

[0068] During the scanning of wireless networks using the first scanning method, the system continuously monitors for network usage requests. If a request is detected, the system switches to the second scanning method to continue scanning. Specifically, when the network usage request originates from a designated application, the system will only switch to the second scanning method upon detecting such a request. This designated application can be a pre-defined application that requires a large amount of network traffic, such as a game application.

[0069] Optionally, in this embodiment, when a wireless network is scanned using the second scanning method, if multiple wireless networks are detected, the signal strength of each wireless network is obtained, and a connection is established with the wireless network having the strongest signal strength. When connecting with the wireless network having the strongest signal strength, the following situations may occur:

[0070] In the first scenario, the electronic device is already connected to a wireless network scanned using the first scanning method. In this case, it is necessary to determine the signal strength of the connected wireless network and the wireless network with the strongest signal strength scanned using the second scanning method. If the signal strength of the wireless network with the strongest signal strength is greater than or equal to the signal strength of the wireless network that the electronic device is already connected to, then no wireless network switching will be performed. Conversely, if the signal strength of the wireless network with the strongest signal strength is less than the signal strength of the wireless network that the electronic device is already connected to, then a network switching will be performed.

[0071] In the second scenario, if the electronic device has not yet connected to the wireless network scanned using the first scanning method, the electronic device can directly connect to the wireless network with the strongest signal strength scanned using the second scanning method.

[0072] The wireless scanning method provided in this application first scans the wireless network on the first channel using a first scanning method when the network connection status of the electronic device is not connected. When network usage needs are detected, it switches to scanning the wireless network on the second channel using a second scanning method, thereby improving the flexibility of wireless network scanning.

[0073] Please see Figure 5 This application provides a wireless scanning method applied to an electronic device, the method comprising:

[0074] Step S210: When the electronic device is in a screen-on or screen-off state, obtain the network connection status of the electronic device.

[0075] In this embodiment, "electronic device just entering screen-on state" can refer to the electronic device just switching from screen-off state to screen-on state, or it can refer to the electronic device just starting up and entering screen-on state; no specific limitation is made here. Similarly, "electronic device just entering screen-off state" can refer to the electronic device just switching from screen-on state to screen-off state.

[0076] When the network connection status of the electronic device is detected as soon as the screen is on or off, the system will start detecting the network connection status of the electronic device.

[0077] Step S220: If the network connection status is disconnected, scan the wireless network using the first scanning method.

[0078] Step S230: During the process of scanning the wireless network using the first scanning method, if a network usage requirement is detected, the wireless network is scanned using the second scanning method. The second scanning method is a method of scanning the wireless network on a second channel, and the number of channels in the second channel is greater than the number of channels in the first channel.

[0079] In this embodiment of the application, when a network usage demand is detected and a wireless network scan is performed on the second channel using the second scanning method, the number of the second channels may be different depending on whether the electronic device is in a screen-on or screen-off state.

[0080] Specifically, the number of second channels when the electronic device's screen is on can be less than the number when the screen is off. This allows the electronic device to scan for and connect to wireless networks more quickly when the screen is on.

[0081] Of course, the number of second channels when the electronic device is in screen-on mode can be greater than the number when the screen is off mode. This allows the electronic device to scan for wireless networks with stronger signals on more channels when the screen is on.

[0082] Furthermore, when the network connection status of the electronic device is not connected, a wireless network scan is first performed on the first channel. Only when network usage demand is detected does a wireless network scan begin on the second channel. Since the second channel has more channels than the first channel, wireless network scanning on more channels can be avoided if there is no network usage demand, thereby reducing the power consumption of the electronic device.

[0083] This application provides a wireless scanning method. When an electronic device is in a screen-on or screen-off state, its network connection status is obtained. If the network connection status is not connected, a first scanning method is used to scan for wireless networks. During the second scanning method, if network usage demand is detected, the second scanning method is used to scan for wireless networks. This method improves the flexibility of wireless network scanning by first scanning a first channel using the first scanning method when the electronic device is not connected, and then switching to the second scanning method on a second channel when network usage demand is detected.

[0084] Please see Figure 6 This application provides a wireless scanning method applied to an electronic device, the method comprising:

[0085] Step S310: When the network connection status of the electronic device is not connected, detect whether there is a saved wireless network.

[0086] In this embodiment, the saved wireless network can be a wireless network that the electronic device has previously connected to or a wireless network that the electronic device has previously scanned. As one approach, if the saved wireless network is a wireless network that the electronic device has previously scanned, then the saved wireless network can be a wireless network among the wireless networks that the electronic device has previously scanned with a signal strength greater than a preset signal strength.

[0087] As another approach, if the saved wireless networks are those previously scanned by the electronic device, then these saved wireless networks can be those with signal strength greater than a preset signal strength that the electronic device scanned when it was in a specified location. The specified location can be a location where the electronic device frequently scans for wireless networks.

[0088] Optionally, similarly, if the saved wireless network is one that the electronic device has previously connected to, then the saved wireless network can be one that the electronic device previously connected to when it was in the specified location. Here, "previously" can refer to a preset historical time period.

[0089] In this embodiment, saved wireless networks can be stored in a preset storage area. When the network connection status of an electronic device is detected to be disconnected, the preset storage area can be queried to see if any wireless networks previously connected to or scanned by the electronic device are stored. The preset storage area can store multiple saved wireless networks corresponding to different electronic devices.

[0090] Step S320: If a saved wireless network exists, scan for the wireless network using the first scanning method.

[0091] In this embodiment of the application, when it is determined through the above method that a saved wireless network exists, a wireless network scan is started using the first scanning method.

[0092] In one approach, a wireless network scan is performed on a first channel using a first scanning method, where the first channel has been stored to indicate the channel the network is on.

[0093] When scanning for wireless networks using the first scanning method, the wireless network is scanned on the first channel at a preset scanning period. The preset scanning period is a pre-set period for scanning wireless networks on the first channel using the PNO scanning method. For example, the minimum time interval (min) of the preset scanning period is 20 seconds, and the maximum time interval (max) is 20 seconds * 3 = 60 seconds. That is, the preset scanning period can be set to 20 seconds, 20 seconds, 20 seconds, 60 seconds, 60 seconds, ..., 60 seconds. The first three scans are spaced 20 seconds apart, and from the fourth scan onwards, wireless network scans are performed at 60-second intervals. The scanned channels are limited to those of already saved networks.

[0094] Specifically, for the first scanning method, the electronic device actively sends probe signals sequentially on its supported channels to detect surrounding wireless networks. The probe signals sent by the electronic device are called Probe Request frames, and it obtains network signals by receiving Probe Response frames. Probe Request frames can be divided into two categories: those without a specified Service Set Identifier (SSID) and those with a specified SSID. If the probe request frame does not specify a SSID, it means that the probe request wants to obtain signals from all available wireless networks in the vicinity, and all wireless access points that receive this broadcast probe request frame will respond to the electronic device. If the probe request frame specifies a SSID, it means that the electronic device only wants to find wireless networks with that specific SSID and does not need other wireless networks besides those specified. After receiving a probe request frame, a wireless access point will only respond to the electronic device if it finds that the SSID in the probe request frame is the same as its own SSID.

[0095] In this embodiment, a wireless network scan is performed on the first channel using the first scanning method only when a saved wireless network is detected in the electronic device and the device's network connection status is disconnected. The wireless networks scanned using the first scanning method can be presented in a list format. For example, the wireless networks scanned using the first scanning method can be as follows: Figure 7As shown, in Figure 7 The interface can display the name of each scanned wireless network, as well as its signal strength or other information; no specific limitations are made here.

[0096] Before scanning for wireless networks on the first channel using the first scanning method, it can be determined whether the electronic device is in the wireless network settings interface. If the electronic device is in the wireless network settings interface, then the first scanning method can be used to scan for wireless networks on the first channel at a fixed interval. The fixed interval can be set to 10 seconds.

[0097] If the electronic device is not in the wireless network settings interface, it can perform a wireless network scan on the first channel using the first scan method and the second scan cycle.

[0098] If the electronic device is not in the wireless network settings interface and the network connection status of the electronic device is connected, then wireless network scanning on the first channel will not be performed through the first scanning method.

[0099] Optionally, when scanning for a wireless network on the first channel using the first scanning method and a preset scanning period, the preset scanning period can be set differently depending on whether the electronic device is in a screen-on state or a screen-off state.

[0100] When the electronic device is in screen-on mode, the corresponding preset scanning cycle can be set to a smaller value, allowing the electronic device to scan for wireless networks on the first channel more quickly, thereby further saving the power consumption of the electronic device.

[0101] When an electronic device is in a screen-off state, the corresponding preset scan cycle can be set to a larger value to balance the power consumption when the electronic device is in a screen-off state and when the electronic device is in a screen-on state.

[0102] Step S330: During the process of scanning the wireless network using the first scanning method, if a network usage demand is detected, the network traffic corresponding to the network usage demand is obtained.

[0103] In this embodiment, network traffic refers to the set of all packets with the same five-tuple (source IP address, destination IP address, transport layer protocol, source port, and port number) passing through a specific observation point in the network within a specific time interval. In other words, network traffic refers to the amount of traffic required or requested for network usage within a preset time period.

[0104] As one approach, during the scanning of the wireless network using the first scanning method, if a network usage demand is detected, the network traffic corresponding to that demand is acquired. This network usage demand can be generated by multiple applications, so the network traffic to be acquired can include the total traffic required by these applications within a preset time period. Furthermore, when acquiring the network traffic corresponding to the network usage demand, a network traffic monitoring interface can be pre-set for each application, allowing the acquisition of the traffic volume required by each application within the preset time period through its respective monitoring interface.

[0105] Step S340: If the network traffic exceeds the traffic threshold, scan the wireless network using the second scanning method.

[0106] In this embodiment, the traffic threshold is a pre-set threshold value for the amount of traffic required to trigger a wireless network scan using the second scanning method. For example, the traffic threshold can be set to 200KB / s. After obtaining the network traffic corresponding to the network usage demand, the network traffic is compared with the traffic threshold. If the network traffic is greater than the traffic threshold, the system switches to the second scanning method for wireless network scanning.

[0107] The traffic threshold can be adjusted according to actual needs. One approach is to vary the traffic threshold based on the number of applications running on the electronic device. The more applications running on the device, the higher the traffic threshold can be set; conversely, the fewer applications running, the lower the traffic threshold can be set.

[0108] As another approach, the data usage threshold can also be adjusted based on the priority of the applications running on the electronic device. The higher the priority of the application, the larger the corresponding data usage threshold can be set; conversely, the lower the priority of the application, the smaller the corresponding data usage threshold can be set. The application priority can be set based on the application type. For example, game applications have a higher priority than audio / video playback applications; audio / video playback applications have a higher priority than chat applications; chat applications can have a higher priority than system applications, etc., without further specific limitations.

[0109] Optionally, the data usage threshold can be adjusted based on the remaining battery level of the electronic device. The more battery power the device has remaining, the lower the data usage threshold can be set; conversely, the less battery power the device has remaining, the higher the data usage threshold can be set.

[0110] In this embodiment, the traffic threshold corresponding to the electronic device being in a screen-on state and the traffic threshold corresponding to the electronic device being in a screen-off state can be different. As one approach, if the network traffic exceeds a first traffic threshold when the electronic device is in a screen-on state, the wireless network is scanned using the second scanning method.

[0111] The first traffic threshold is a pre-set threshold value for the amount of traffic that triggers wireless network scanning via the second scanning method when the electronic device is in a screen-on state. For example, the first traffic threshold can be set to 400KB / s.

[0112] As another approach, if the network traffic exceeds a second traffic threshold when the electronic device is in a screen-off state, the wireless network is scanned using the second scanning method, wherein the first traffic threshold is greater than the second traffic threshold.

[0113] The second traffic threshold is a pre-set threshold value for the amount of traffic that triggers wireless network scanning via the second scanning method when the electronic device is in a screen-off state. For example, the second traffic threshold can be set to 250KB / s.

[0114] Specifically, since electronic devices consume more power when the screen is on than when the screen is off, when determining whether to switch to scanning for wireless networks on more channels, the first traffic threshold corresponding to the screen being on can be set to be larger than the second traffic threshold corresponding to the screen being off. This allows the electronic device to perform wireless network scanning using the low-power PNO scanning method for a longer period of time when the screen is on, thereby reducing the power consumption of the electronic device.

[0115] Optionally, the wireless network is scanned using the second scanning method at a first scanning period. The first scanning period is a binary exponential backoff period.

[0116] Specifically, a wireless network scan is performed on the second channel using the second scanning method and the first scanning cycle. The second channel includes all channels.

[0117] The binary exponential backoff period refers to the scanning period set based on the binary exponential backoff algorithm. The principle of the binary exponential backoff algorithm is that the scanning period is doubled with each scan, meaning the time interval between the next scan is twice the time interval of the previous scan. For example, assuming the first preset period is 15s, the second preset period is 120s, and the minimum period of the binary exponential backoff algorithm is 15s and the maximum period is 120s, then after detecting that network traffic exceeds the traffic threshold, the first scan period is the 15s set under unstable conditions, the second scan period increases to 30s, the third scan period increases to 60s, the fourth scan period increases to 120s, and so on. The scanning period continues at a 120s interval until the network connection status of the electronic device is detected.

[0118] In this embodiment of the application, for example, the minimum time interval of the first scanning period is 15s, the maximum time interval is 120s, and the second scanning period can be set as interval*(2^n){15s, 15s, 15s, 15s, 15s, 15s, 15s, 30s, 60s, 120s, 120s, 120s, ...}, that is, the first 8 scans are performed on all channels at a time interval of 15s, and then in the 9th scan, the wireless network is scanned on all channels according to the binary exponential backoff period until it backs off to 120s, and then the wireless network is scanned on all channels at a time interval of 120s.

[0119] Similarly, when scanning for wireless networks on all channels using the second scanning method, the scanning period can be determined based on whether the electronic device is in the wireless network settings interface. Specifically, if the electronic device is in the wireless network settings interface, the second scanning method can be used to scan for wireless networks on all channels at a fixed period; if the electronic device is not in the wireless network settings interface, the second scanning method can be used to scan for wireless networks on all channels with a binary exponential backoff period.

[0120] When the electronic device is not in the wireless network settings interface and the network connection status of the electronic device is connected, it will not perform wireless network scanning on all channels through the second scanning method.

[0121] Optionally, when scanning for a wireless network on the second channel using the second scanning method and the first scanning cycle, the second scanning cycle can be set differently depending on whether the electronic device is in a screen-on state or a screen-off state.

[0122] When an electronic device's screen is on, the corresponding second scan cycle can be set to a shorter value, allowing the device to perform a faster full-channel wireless network scan, thus conserving power. Simultaneously, when the screen is on, the device first scans the first channel using PNO scanning. Upon detecting network usage demand, it switches to second scanning on the second channel. Since the second channel has more channels than the first channel, this avoids scanning more channels for wireless networks when the screen is on for reasons unrelated to network usage, thereby reducing the device's power consumption.

[0123] When the electronic device is in screen-off mode, the corresponding second scan cycle can be set to a larger value. When the electronic device is in screen-off mode, it first scans for wireless networks on the first channel using PNO scanning. Upon detecting network usage demand, it switches to scanning for wireless networks on the second channel using the second scanning method. This improves the sensitivity of wireless networks in screen-off mode and enhances the user experience of wireless network switching.

[0124] This application provides a wireless scanning method. When the network connection status of an electronic device is not connected, it detects whether a saved wireless network exists. If a saved wireless network exists, it scans for the wireless network using a first scanning method. During the scanning process using the first scanning method, if network usage demand is detected, the network traffic corresponding to the network usage demand is obtained. If the network traffic exceeds a traffic threshold, it scans for the wireless network using a second scanning method. This method improves the flexibility of wireless network scanning by first scanning for wireless networks on a first channel using the first scanning method when the network connection status of the electronic device is not connected, and then switching to the second scanning method on a second channel when network usage demand is detected.

[0125] Please see Figure 8 This application provides a wireless scanning device 400, which operates in an electronic device. The device 400 includes:

[0126] The first scanning unit 410 is used to scan the wireless network using a first scanning method when the network connection status of the electronic device is not connected. The first scanning method is to perform wireless network scanning on a first channel.

[0127] In one approach, the first scanning unit 410 is specifically used to obtain the network connection status of the electronic device when the electronic device is in a screen-on state or a screen-off state; if the network connection status is a disconnected state, it scans for wireless networks using the first scanning method.

[0128] Alternatively, the first scanning unit 410 is specifically used to detect whether there is a saved wireless network when the network connection status of the electronic device is not connected; if there is a saved wireless network, the first scanning method is used to scan for the wireless network.

[0129] The second scanning unit 420 is used to scan the wireless network using a second scanning method if a network usage requirement is detected during the scanning of the wireless network using the first scanning method. The second scanning method is a method of scanning the wireless network on a second channel, and the number of channels in the second channel is greater than the number of channels in the first channel.

[0130] The first channel is the channel where the saved wireless network is located; the second channel is all channels.

[0131] In one approach, the second scanning unit 420 is specifically used to, during the process of scanning the wireless network using the first scanning method, if a network usage demand is detected, obtain the network traffic corresponding to the network usage demand; if the network traffic exceeds a traffic threshold, scan the wireless network using the second scanning method.

[0132] Furthermore, the second scanning unit 420 is specifically used to scan the wireless network using the second scanning method when the network traffic exceeds a first traffic threshold while the electronic device is in a screen-on state; and to scan the wireless network using the second scanning method when the network traffic exceeds a second traffic threshold while the electronic device is in a screen-off state, wherein the first traffic threshold is greater than the second traffic threshold.

[0133] Alternatively, the second scanning unit 420 is also specifically used to scan the wireless network in a first scanning cycle using the second scanning method.

[0134] The first scanning period is a binary exponential backoff period.

[0135] It should be noted that the device embodiments in this application correspond to the aforementioned method embodiments. The specific principles in the device embodiments can be found in the content of the aforementioned method embodiments, and will not be repeated here.

[0136] The following will combine Figure 9 This application describes an electronic device.

[0137] Please see Figure 9Based on the aforementioned wireless scanning method and apparatus, this application embodiment also provides another electronic device 800 capable of executing the aforementioned wireless scanning method. The electronic device 800 includes one or more (only one shown in the figure) processors 802, a memory 804, and a network module 806 coupled together. The memory 804 stores programs capable of executing the contents of the aforementioned embodiments, and the processor 802 can execute the programs stored in the memory 804.

[0138] The processor 802 may include one or more processing cores. The processor 802 connects to various parts within the electronic device 800 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 804, and by calling data stored in the memory 804. Optionally, the processor 802 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 802 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 802 and may be implemented separately using a communication chip.

[0139] The memory 804 may include random access memory (RAM) or read-only memory (ROM). The memory 804 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 804 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 800 during use (such as phonebook data, audio and video data, chat log data, etc.).

[0140] The network module 806 is used to receive and transmit electromagnetic waves, realizing the mutual conversion between electromagnetic waves and electrical signals, thereby communicating with communication networks or other devices, such as electronic devices. The network module 806 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity modules (SIM cards), memory, etc. The network module 806 can communicate with various networks such as the Internet, corporate intranets, and wireless networks, or communicate with other devices through wireless networks. The aforementioned wireless networks may include cellular telephone networks, wireless network scanning, or metropolitan area networks. For example, the network module 806 can interact with base stations.

[0141] Please refer to Figure 10 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable storage medium 900 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0142] The computer-readable storage medium 900 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 900 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 900 has storage space for program code 910 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 910 may be compressed, for example, in a suitable form.

[0143] This application provides a wireless scanning method, apparatus, electronic device, and storage medium. When the electronic device is in a disconnected network state, it first scans for wireless networks using a first scanning method on a first channel. During this first scanning process, if network usage demand is detected, it then scans for wireless networks using a second scanning method on a second channel, where the number of channels in the second channel is greater than the number of channels in the first channel. This method improves the flexibility of wireless network scanning by first scanning the first channel using the first scanning method when the electronic device is in a disconnected network state, and then switching to the second scanning method when network usage demand is detected.

[0144] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.

Claims

1. A wireless scanning method, characterized in that, Applied to electronic devices, the method includes: When the network connection status of the electronic device is not connected, it scans the wireless network using a first scanning method, which is to perform wireless network scanning on a first channel. During the process of scanning the wireless network using the first scanning method, if a network usage demand is detected, the network traffic corresponding to the network usage demand is obtained. When the electronic device is in a screen-on state, if the network traffic exceeds a first traffic threshold, the wireless network is scanned using a second scanning method; When the electronic device is in a screen-off state, if the network traffic exceeds a second traffic threshold, the wireless network is scanned using the second scanning method. The second scanning method is a wireless network scan performed on a second channel, where the number of channels in the second channel is greater than the number of channels in the first channel, and the first traffic threshold is greater than the second traffic threshold.

2. The method according to claim 1, characterized in that, When the network connection status of the electronic device is not connected, scanning the wireless network through the first scanning method includes: When the electronic device is in a screen-on or screen-off state, obtain the network connection status of the electronic device; If the network connection status is not connected, the wireless network is scanned using the first scanning method.

3. The method according to claim 1, characterized in that, When the network connection status of the electronic device is not connected, scanning the wireless network through the first scanning method includes: When the network connection status of the electronic device is disconnected, detect whether there is a saved wireless network. If a saved wireless network exists, scan for the wireless network using the first scanning method.

4. The method according to claim 1, characterized in that, The scanning of the wireless network using the second scanning method includes: The wireless network is scanned using the second scanning method in the first scanning cycle.

5. The method according to claim 4, characterized in that, The first scan period is a binary exponential backoff period.

6. The method according to claim 1, characterized in that, The first channel is the channel where the saved wireless network is located; the second channel is all channels.

7. A wireless scanning device, characterized in that, Operating in an electronic device, the device includes: The first scanning unit is used to scan the wireless network using a first scanning method when the network connection status of the electronic device is a disconnected state. The first scanning method is to perform wireless network scanning on a first channel. The second scanning unit is configured to, during the process of scanning the wireless network using the first scanning method, if a network usage demand is detected, acquire the network traffic corresponding to the network usage demand; if the network traffic exceeds a first traffic threshold when the electronic device is in a screen-on state, scan the wireless network using a second scanning method; if the network traffic exceeds a second traffic threshold when the electronic device is in a screen-off state, scan the wireless network using the second scanning method, wherein the second scanning method is a method of scanning the wireless network on a second channel, the number of channels in the second channel is greater than the number of channels in the first channel, and the first traffic threshold is greater than the second traffic threshold.

8. An electronic device, characterized in that, It includes one or more processors; one or more programs are stored in memory and configured to be executed by the one or more processors according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code, wherein the program code, when executed by a processor, performs the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Method and device for scanning wireless fidelity network

    WO2019237356A1