WiFi signal scanning method, device, terminal and storage medium
By separately scanning two different types of channels in the WiFi available channels and setting a preset time between scans, the existing WiFi signal scanning problems are solved, and a more efficient scanning process is achieved.
Patent Information
- Application Number
- CN202110192236.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-19
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-02-19
AI Technical Summary
The existing WiFi signal scanning method is inefficient and prolonged, especially in scenarios where multiple signal information is required.
By scanning two types of channels with different numbers of WiFi available channels, the first scan result and the second scan result are obtained. The number of second types of channels is smaller than the number of first types of channels, and a preset time is set between the two types of scans to restore the device state.
Compared with the method of repeatedly scanning the full channel, the time spent on scanning is shortened, the impact on the original WiFi signal is reduced, and the scanning efficiency is improved.
Smart Images

Figure CN114980041B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Internet of Things technology, and in particular to a WiFi signal scanning method, device, terminal and storage medium. Background Art
[0002] With the continuous development of Internet of Things (IoT) technology, more and more electronic devices can interact with each other wirelessly.
[0003] In the related art, WiFi (Wireless Fidelity) signals can be used to support communication between electronic devices. When a first device obtains information broadcast by surrounding devices based on WiFi signals, affected by the WiFi wireless protocol scanning strategy, the existing WiFi scanning method takes a long time to obtain scanning results and has low efficiency. Summary of the invention
[0004] The embodiments of the present application provide a WiFi signal scanning method, device, terminal and storage medium. The technical solution is as follows:
[0005] According to one aspect of the present application, a WiFi signal scanning method is provided, the method comprising:
[0006] Scan a first type of channel in available WiFi channels to obtain a first scanning result, where the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device;
[0007] Scan a second type of channel in the WiFi available channels to obtain a second scanning result, where the second scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device;
[0008] The number of the second-category channels is smaller than the number of the first-category channels, and the interval between scanning the first-category channels and scanning the second-category channels is a first preset interval.
[0009] According to another aspect of the present application, a WiFi signal scanning method is provided, the method comprising:
[0010] Scan the Wi-Fi signal according to the preset period;
[0011] The preset period includes: performing M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of the second-category channels is less than the number of the first-category channels, the interval between each round of scanning is the same or different, and M and N are positive integers.
[0012] According to another aspect of the present application, a WiFi signal scanning device is provided, the device comprising:
[0013] A first scanning module, configured to scan a first type of channel in available WiFi channels to obtain a first scanning result, wherein the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device;
[0014] A second scanning module, configured to scan a second type of channel in the available WiFi channels to obtain a second scanning result, wherein the second scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device;
[0015] The number of the second-category channels is smaller than the number of the first-category channels, and the interval between scanning the first-category channels and scanning the second-category channels is a first preset interval.
[0016] According to another aspect of the present application, a WiFi signal scanning device is provided, the device comprising:
[0017] The third scanning module is used to scan the Wi-Fi signal according to a preset period;
[0018] The preset period includes: performing M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of the second-category channels is less than the number of the first-category channels, the interval between each round of scanning is the same or different, and M and N are positive integers.
[0019] According to another aspect of the present application, a terminal is provided, the terminal comprising a processor and a WiFi transceiver;
[0020] The processor is used to instruct the WiFi transceiver to scan a first type of channel in the WiFi available channels to obtain a first scanning result, wherein the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device;
[0021] The processor is used to instruct the WiFi transceiver to scan the second type of channels in the WiFi available channels to obtain a second scanning result, wherein the second scanning result includes part or all of the information of some or all of the scanned broadcast data packets and the signal strength of the corresponding broadcasting device; wherein the number of the second type of channels is less than the number of the first type of channels, and the interval duration between scanning the first type of channels and scanning the second type of channels is a first preset duration.
[0022] According to another aspect of the present application, a terminal is provided, the terminal comprising a processor and a WiFi transceiver;
[0023] The processor is used to instruct the WiFi transceiver to scan WiFi signals according to a preset period;
[0024] The preset period includes: performing M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of the second-category channels is less than the number of the first-category channels, the interval between each round of scanning is the same or different, and M and N are positive integers.
[0025] According to another aspect of the present application, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the WiFi signal scanning method provided in various aspects of the present application.
[0026] According to one aspect of the present application, a computer program product is provided, the computer program product including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the WiFi signal scanning method provided in various optional implementations of any of the above aspects.
[0027] The WiFi signal scanning method provided in the embodiment of the present application obtains a first scanning result and a second scanning result by scanning two categories of channels with different numbers respectively when scanning available WiFi channels. Since the number of the second category of channels is less than the number of the first category of channels, in a scenario in which multiple scanning results are obtained, the scanning time is shortened relative to the method of repeatedly scanning all channels, and the time interval between scanning the first category of channels and scanning the second category of channels is a first preset time interval, which enables the device to recover to the originally working WiFi channel in a certain time between the two categories of scans, thereby reducing the impact of scanning other channels on the originally used WiFi channel. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly introduce the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0030] Figure 2 is a flowchart of a WiFi signal scanning method provided by an exemplary embodiment of the present application;
[0031] Figure 3 is a flow chart of a WiFi signal scanning method shown in the present application;
[0032] Figure 4 is a flow chart of a WiFi signal scanning method provided by another exemplary embodiment of the present application;
[0033] Figure 5 is a flow chart of a WiFi signal scanning method provided by another exemplary embodiment of the present application;
[0034] Figure 6 This is a flow chart of a WiFi signal scanning method provided by an embodiment of the present application;
[0035] Figure 7 It is a structural block diagram of a WiFi signal scanning device provided by an exemplary embodiment of the present application;
[0036] Figure 8 is a structural block diagram of another WiFi signal scanning device provided by an exemplary embodiment of the present application;
[0037] Fig. 9 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0039] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0040] In the description of the present application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of the present application, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" means two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0041] In the related art, when the first device measures the distance between the surrounding second device and itself, an instruction for full channel scanning can be issued to the WiFi transceiver in the first device. Among them, different models of WiFi transceivers have different full channel scanning strategies. The purpose of this full channel scan is to perform a traversal scan of the WiFi available channels. For example, if the total number of WiFi available channels is 18, the purpose of the full channel scan is to perform a round of traversal of the above 18 WiFi available channels, so as to obtain the signal information of the wireless signal in each WiFi available channel. Therefore, in a scenario where the signal information of multiple wireless signals is required, the first device has a high delay in obtaining the multiple signal information and consumes a large amount of power. For example, in a scenario where the first device needs to calculate the distance between it and the second device based on multiple signal information, the process of the first device obtaining multiple signal information has a high delay and consumes a large amount of energy.
[0042] Schematically, in a possible full channel scanning scenario, the total number of available WiFi channels is 18 and the scanning period is 40 milliseconds. Before starting to execute the process, the first device resides in channel 6. Schematically, the 18 available WiFi channels can be channel 1, channel 2, channel 3, channel 4, channel 5, channel 6, channel 7, channel 8, channel 9, channel 10, channel 11, channel 12, channel 13, channel 149, channel 153, channel 157, channel 161, and channel 165.
[0043] During the first round of scanning of the full channel scan, the WiFi transceiver switches the currently listening channel from channel 6 to channel 1 and continues to listen for 40 milliseconds. Subsequently, the WiFi transceiver switches the currently listening channel back to channel 6 and continues to listen for 60 milliseconds.
[0044] In each scanning process after the first scanning process of the full channel scanning, the WiFi transceiver switches the currently listening channel from channel 6 to the channel to be scanned and continues to listen for 40 milliseconds. Subsequently, the WiFi transceiver switches the currently listening channel back to channel 6 and continues to listen for 60 milliseconds. Then the next scanning process is carried out until the WiFi transceiver completes the scanning of 18 channels and generates a scanning result containing 18 channels. At this point, the WiFi transceiver completes a round of full channel scanning.
[0045] It should be noted that in order to reduce the impact of the first device on the normal reception of WiFi data during full channel scanning, a process of switching back and forth between the original resident channel and the channel to be scanned is usually designed during the full channel scanning process. The solution provided in this application can reduce the power consumption and delay of obtaining multiple signal information scenarios, which is specifically described as follows.
[0046] For the understanding of this application, before introducing the specific scheme, the meanings and application scenarios of several terms are first introduced.
[0047] WiFi available channels: used to indicate channels that WiFi signals can use. In one possible way, the specific channel number of the WiFi available channel is related to the designated agency that uses the WiFi signal. The designated agency can be an administrative agency such as a country, province or city, or an industry agency such as a communications association or a communications standards agency. The designated agency can specify different WiFi available channels corresponding to different regions.
[0048] Illustratively, in a possible planning method of WiFi available channels, there are 18 WiFi available channels.
[0049] The first type of channels: are some or all of the available WiFi channels. In one possible manner, the first type of channels are some of the available WiFi channels. In another possible manner, the first type of channels are all of the available WiFi channels.
[0050] Taking 18 available WiFi channels as an example, when the first-category channels are part of the available WiFi channels, the number of the first-category channels is less than or equal to 17. When the first-category channels are all the available WiFi channels, the first-category channels are all 18 available WiFi channels.
[0051] The second type of channels are some of the available WiFi channels. In one possible manner, the number of the second type of channels is less than the number of the first type of channels. In the embodiment of the present application, since the number of the second type of channels is less than the number of the first type of channels, in a scenario where the duration of scanning a WiFi available channel is fixed, the total duration of scanning the second type of channels is shorter than the total duration of scanning the first type of channels.
[0052] First scanning result: The first scanning result includes at least two parts: one is the information of the broadcast data packet, and the other is the signal strength of the broadcast device corresponding to the broadcast data packet.
[0053] It should be noted that the signal strength of the broadcast device can be used to indicate the signal strength of the broadcast data packet received by the first device. The present application can calculate the distance to the target device by obtaining the signal strength of the broadcast data packet corresponding to the target device received by the first device.
[0054] Optionally, scanning the first category channel may obtain several broadcast data packets, and the corresponding broadcast data packets in the first scanning result may be all of the above-mentioned several broadcast data packets, or may be part of the above-mentioned several broadcast data packets. If scanning the first category channel obtains 5 broadcast data packets, the corresponding broadcast data packets in the first scanning result may be the above-mentioned 5 data packets, or may be part of the 5 broadcast data packets. It should be noted that the broadcast data packets obtained by scanning the first category channel may include multiple types of information. The information of the broadcast data packets in the first scanning result may be all of the information in the broadcast data packets obtained by scanning the first category channel, or may be part of the information in the broadcast data packets obtained by scanning the first category channel.
[0055] Optionally, scanning the first category of channels can also obtain the signal strength of the broadcasting device corresponding to several broadcasting data packets. It should be noted that the signal strength of the broadcasting device in the first scanning result corresponds to the broadcasting data packet in the first scanning result. For example, scanning the WiFi available channels obtains 5 broadcasting data packets, namely data packet 1, data packet 2, data packet 3, data packet 4 and data packet 5. The corresponding broadcasting data packets in the first scanning result are data packet 1, data packet 2 and data packet 5. In this scenario, the signal strength of the broadcasting device in the first scanning result is the signal strength of the broadcasting device sending data packet 1, the signal strength of the broadcasting device sending data packet 2 and the signal strength of the broadcasting device sending data packet 5.
[0056] Second scanning result: The type of information included in the second scanning result is similar to the type of information included in the first scanning result. Please refer to the above introduction and will not be repeated here.
[0057] Signal strength: can be represented by RSSI (Received Signal Strength Indication).
[0058] Please refer to Figure 1 , Figure 1 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment includes a first device 110 and a second device 120.
[0059] The first device 110 is an electronic device with a wireless signal transceiving function, which may be a smart phone, a tablet computer, a wearable device or a personal computer, etc., and the wireless signal transceiving function may be implemented by a signal transceiving component. When the first device 110 turns on the wireless signal transceiving function, the signal transceiving component can receive wireless signals sent by other devices within the signal receiving range, and can send wireless signals to other devices within the signal sending range. Among them, the signal transceiving component can be built into the first device 110, or it can be externally connected to the first device 110, which is not limited in this embodiment.
[0060] In some embodiments, when the signal transceiver component is a WiFi component, the wireless signal received and sent by the signal transceiver component is a WiFi signal.
[0061] The second device 120 is an electronic device with a wireless signal transceiving function, which may be an IoT device, such as a wireless speaker 121, a smart TV 122, a smart door lock 123, a smart lamp 124, or a smart watch 125, etc., and the wireless signal transceiving function may be implemented by a signal transceiving component. When the second device 120 turns on the wireless signal transceiving function, the signal transceiving component may receive wireless signals sent by other devices within the signal receiving range, and may send wireless signals to other devices within the signal sending range.
[0062] In a possible scenario, when the signal transceiving functions of the first device 110 and the second device 120 are both turned on, the second device 120 sends a wireless signal through the signal transceiving component, and the first device 110 receives the wireless signal through the signal transceiving component. In the embodiment of the present application, the period of sending the wireless signal by the second device 120 and the channel used are not changed. The first device 110 will perform a round of first-category channel scanning to obtain a first scanning result, and then scan the second-category channel to obtain a second scanning result, thereby quickly obtaining the signal strength of multiple wireless signals.
[0063] The embodiment of the present application is described by taking the application of the wireless signal scanning method in the first device 110 as an example.
[0064] Please refer to Figure 2, which is a flowchart of a WiFi signal scanning method provided by an exemplary embodiment of the present application. The WiFi signal scanning method can be applied in the first device shown above. Figure 2 In the WiFi signal scanning method, the WiFi signal scanning method includes:
[0065] Step 210 , scan a first type of channel in the WiFi available channels to obtain a first scanning result, where the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device.
[0066] In one possible manner, the first device may be a mobile terminal with a display screen. When the screen of the mobile terminal is turned on, the processor in the first device issues an instruction to the WiFi transceiver, instructing the WiFi transceiver to perform a first-category channel scan on the WiFi available channels to obtain a first scanning result. Among them, the first scanning result includes part or all of the information of some or all of the scanned broadcast data packets and the signal strength of the corresponding broadcasting device. Schematically, the broadcast data packet may include the name and matching identifier of the WiFi hotspot that sent the broadcast data packet. Among them, the name of the WiFi hotspot may be an SSID (Service Set Identifier), and the matching identifier may be an identifier of the broadcasting device. In a feasible implementation, since a broadcasting device, such as a second device, configures the channel used for the broadcast in a broadcast data packet, the broadcast data packet may also include information about the broadcast channel.
[0067] In another possible manner, the first device starts to perform a first-category channel scan on the WiFi available channels when it is in a preset scenario. Optionally, the preset scenario may be a home scenario, an office scenario, or a permanent location scenario, etc. A machine learning model may be stored in the first device, and the model is used to identify whether the first device is in a preset scenario. Schematically, the input parameters of the machine learning model may include one or more parameters of time, location, and wireless signal strength. That is, in response to the first device being in a preset scenario, the first device starts to perform a first-category channel scan on the WiFi available channels.
[0068] Step 220, scanning the second category channels in the WiFi available channels to obtain a second scanning result, the second scanning result including part or all of the information of the scanned part or all of the broadcast data packets and the signal strength of the corresponding broadcasting device. The number of the second category channels is less than the number of the first category channels, and the interval between scanning the first category channels and scanning the second category channels is a first preset duration.
[0069] It can be understood that the first preset duration can be a value, such as a fixed value, or can be one of a group of values, or can be one of a range of values.
[0070] In one possible manner, the first device will first perform step 210 and then perform step 220. The actual execution process can be found in Figure 2 Flowchart shown. In this execution mode, the interval between the first device completing the scan of the first category of channels in the WiFi available channels and the first device starting to scan the second category of channels in the WiFi available channels is the first preset duration. It should be noted that the first preset duration can be a predetermined duration. If the first device scans a round of the first category of channels and then scans a round of the second category of channels, the first preset duration is the fixed interval duration between the two. Of course, the interval duration between the two rounds of scanning the second category of channels can also be the first preset duration. For example, the first preset duration can be a time length of 5 seconds, 6 seconds, 8 seconds or 10 seconds. The interval duration between any two rounds of scanning can be any one of the above, and the interval duration between each two rounds of scanning can be the same or different.
[0071] In another possible way, see Figure 3 , Figure 3 This is a flow chart of a WiFi signal scanning method shown in this application. Figure 3 In the embodiment, the first device will first execute step 220 and then execute step 210. The condition for the first device to trigger the execution of step 220 can refer to the triggering condition of the above step 210, and the source is not repeated. In this implementation mode, the interval between the first device completing the scanning of the first type of channels in the WiFi available channels and the first device starting to scan the second type of channels in the WiFi available channels can still be the first preset duration.
[0072] In summary, the WiFi signal scanning method provided in this embodiment obtains a first scanning result and a second scanning result by scanning two categories of channels with different numbers respectively when scanning available WiFi channels. Since the number of the second category of channels is less than the number of the first category of channels, in a scenario in which multiple scanning results are obtained, the scanning time is shortened relative to the method of repeatedly scanning all channels, and the time interval between scanning the first category of channels and scanning the second category of channels is a first preset time interval, which enables the device to recover to the originally working WiFi channel in a certain time between the two categories of scans, thereby reducing the impact of scanning other channels on the originally used WiFi channel.
[0073] Based on the solution disclosed in the previous embodiment, the first device can also achieve the efficiency of WiFi signal scanning by controlling other parameters in the scanning process. Please refer to the following embodiment.
[0074] See also Figure 4 , which is a flowchart of a WiFi signal scanning method provided by another exemplary embodiment of the present application. The WiFi signal scanning method can be applied to the first device shown above. Since the present application can scan the first channel first and then the second channel, or scan the second channel first and then the first channel. For the convenience of introduction, Figure 4 In the example of scanning the first channel and then the second channel, the WiFi signal scanning method includes:
[0075] Step 410: Scan a first type of channel in available WiFi channels to obtain a first scanning result.
[0076] In this example, the execution process of step 410 is the same as the execution process of step 210, which will not be repeated here.
[0077] In one possible manner, the broadcast data packet in the first scanning result is sent by a broadcast device. The broadcast device broadcasts the broadcast data packet to the surrounding space according to a preset broadcast protocol. Since the WiFi channel where the broadcast data packet is located is one of the WiFi available channels, the first device does not know which available channel the broadcast data packet specifically uses when scanning the WiFi available channels. In addition, in some specified scenarios, the first device needs to obtain multiple broadcast data packets to obtain the distance between the first device and the broadcast device.
[0078] Optionally, the broadcasting device only needs to have the ability to send broadcast data packets. Since there are a large number of WiFi devices in daily life, some of them are broadcasting devices that the first device pays attention to and hopes to obtain their broadcast data packets, while the other devices are broadcasting devices whose broadcast data packets the first device does not pay attention to. In this scenario, the device that the first device pays attention to and hopes to obtain its broadcast data packets is the target device, and the broadcasting device whose broadcast data packets the first device does not pay attention to is the non-target device.
[0079] In one possible manner, the broadcast device only includes the target device. In this scenario, the broadcast data packet can be data with a subsequent use purpose for the first device, and can be used to subsequently calculate the distance between the first device and the target device, or to display the signal strength of the target device.
[0080] In another possible manner, the broadcasting device includes both the target device and the non-target device. In this scenario, the first device may only obtain the broadcasting data packet corresponding to the target device, and use the broadcasting data packet to calculate the distance to the target device, and display the signal strength of the target device and other operations.
[0081] In another possible manner, the broadcasting device includes only non-target devices. In this scenario, the first device does not obtain the broadcast data packet of the target device it needs. Therefore, the first device will continue to scan the WiFi channel until the broadcast data of the target device is obtained, and then use the broadcast data packet to calculate the distance between the first device and the target device, and display the signal strength of the target device.
[0082] It should be noted that in daily life, no matter the user is at home or in the office, the WiFi devices around the first device include both devices that can be controlled by the first device and devices that cannot be controlled by the first device. One purpose of the present application is to know the distance between the device that can be controlled by the first device and the first device. Therefore, in this sub-scheme, the first device can only obtain the target device in the broadcasting device. Among them, the target device is a broadcasting device that meets the first preset condition.
[0083] Optionally, the first preset condition may include two conditions.
[0084] Illustratively, the first condition is that the matching identifier carried in the broadcast data packet matches the preset template. In this scenario, the first device locally stores a preset template, which can be a whitelist storing several identifiers, or a calculation model of a matching rule. When the first device obtains the matching identifier carried in the broadcast data packet, if the preset template is a whitelist, the matching identifier is matched with the identifier in the whitelist. When the match is hit, the first device determines that the matching identifier matches the preset template, and the matching identifier in this case can be understood as a preset matching identifier. If the preset template is a calculation model, the matching identifier carried in the broadcast data packet is used as an input variable, and the value of the output variable is used to determine whether the broadcast device meets the first preset condition. In a possible scenario, the calculation model can output a logical value of 1 or 0. Among them, the logical value 1 indicates that the broadcast device meets the first preset condition, and the logical value 0 indicates that the broadcast device does not meet the first preset condition.
[0085] Illustratively, the second condition is that the broadcasting device provides its own control authority. For the first device, the broadcasting device may be a device that has been pre-bound or pre-provided with control authority, such as a smart camera, smart air conditioner, smart door lock, or smart TV. When the first device recognizes the above device again, it can be determined that the broadcasting device is the target device. In another possible manner, the broadcasting device may be a device that establishes a connection with the first device for the first time. When the control authority provided by the broadcasting device to the first device is authenticated by the first device, that is, when the first device verifies that the control authority is the authority for controlling the broadcasting device, the first device will be identified as the target device.
[0086] It should be noted that, after executing step 410 in this example, the first device can set a first timer to count the time, and the timeout duration of the first timer is set to a first preset duration.
[0087] Step 420: Set a first timer, where the timeout duration of the first timer is a first preset duration.
[0088] Optionally, the timing of setting the first timer may be the moment when the first type of channel is scanned. The timing of setting the first timer may also be the moment when the first scanning result is obtained. Of course, it may also be other moments, such as performing a certain delay or adjustment based on the above moments.
[0089] It should be noted that the processor in the first device can receive information fed back by the WiFi transceiver when the WiFi transceiver completes scanning of the first type of channel. Therefore, the processor in the first device can set the first timer at this moment.
[0090] In another scenario of setting the first timer, the processor in the first device may also set the first timer when receiving the first scanning result provided by the WiFi transceiver.
[0091] Step 430: In response to the first timer timing out, scan the second type of channels in the WiFi available channels to obtain a second scanning result.
[0092] In the present application, when the first timer times out, the first device can scan the second type of channel to obtain a second scanning result.
[0093] In the present application, the second type of channel may include the following three components.
[0094] In the first case, the second type of channels only includes designated channels. It should be noted that the designated channel is a channel with a pre-designated channel number. In one possible manner, the designer may determine the designated channel according to the location of use of the first device using this solution. Optionally, the location of use of the first device may be determined by the geographic location and / or operator identification fed back by the first device. Different locations of use may correspond to different designated channels.
[0095] Optionally, the designated channel may be a non-overlapping channel. That is, if the designated channel is a group of channels greater than 1 channel, the designated channel is a group of non-overlapping channels. In one possible manner, the non-overlapping channel may be at least one of the following three groups of non-overlapping channels. The first group of non-overlapping channels includes channel 1, channel 6, and channel 11. The second group of non-overlapping channels includes channel 2, channel 7, and channel 12. The third group of non-overlapping channels includes channel 3, channel 8, and channel 13. It should be noted that due to the mutual interference between non-overlapping channels of different groups, in a possible implementation, the designated channel may only select the above-mentioned group of non-overlapping channels. In one possible implementation, the designated channel is a channel commonly used by the device, for example, by statistically obtaining channels commonly used by devices on the market to send WiFi broadcast signals, such as channel 1, channel 6, and channel 11.
[0096] In the second case, the second type of channel includes both a designated channel and a broadcast channel. In this scenario, in addition to the designated channel, the second type also includes a broadcast channel, which includes the channel where the broadcast data packet broadcast by the target device is located, or the broadcast channel includes the channel indicated by the channel information of the channel in the broadcast data packet broadcast by the target device. In this scenario, the processor in the first device can know the channel where the broadcast data packet received by the WiFi transceiver is located, that is, the WiFi transceiver informs the processor in the first device on which channel it received the broadcast data packet. In another scenario, the WiFi transceiver does not inform itself on which channel the broadcast data packet is received, but the broadcast data packet carries channel information, which indicates which channel the broadcast data packet is transmitted through.
[0097] In the third case, the second category of channels includes only broadcast channels. In this scenario, the second category of channels includes only broadcast channels.
[0098] It should be noted that in some scenarios, the first device may be unable to determine the broadcast channel due to the underlying design logic limitations of the WiFi transceiver used, or because the broadcast data packet does not carry channel information. In this scenario, the first device can only scan the designated channel as a second-category channel.
[0099] Optionally, the cycle of the WiFi signal scanning method shown in the present application includes one round of scanning the first category channel and n rounds of scanning the second category channel, where n is a positive integer. It should be noted that in order to improve the scanning efficiency, n can be set to a smaller value while effectively reducing the packet loss rate. For example, in the simulation design stage, when n is 1, the packet loss rate is about 50%, when n is 2, the packet loss rate is about 25%, and when n is 3, the packet loss rate is about 10%. In order to balance the efficiency and energy consumption of scanning the WiFi transceiver to transmit broadcast data packets, the value of n can be set to 3 in advance. That is, in this scenario, the first device can scan 1 round of the first category channel and scan 3 rounds of the second category channel in one cycle of WiFi signal scanning. Taking this scenario as an example, the sequence of the above 4 rounds of scanning within one cycle of the present application is introduced.
[0100] The first scanning sequence is: (1) scanning the first type of channels; (2) scanning the second type of channels in the first round; (3) scanning the second type of channels in the second round; (4) scanning the second type of channels in the third round.
[0101] The second scanning sequence is as follows: (1) the first round scans the second type of channels; (2) scans the first type of channels; (3) the second round scans the second type of channels; (4) the third round scans the second type of channels.
[0102] The second scanning sequence is as follows: (1) the first round scans the second type of channels; (2) the second round scans the second type of channels; (3) scans the first type of channels; (4) the third round scans the second type of channels.
[0103] The second scanning sequence is as follows: (1) the first round scans the second type of channels; (2) the second round scans the second type of channels; (3) the third round scans the second type of channels; (4) scans the first type of channels.
[0104] It should be noted that there is a time interval (interval duration) between any two rounds of scanning, and the time interval may be a preset first preset duration. In one possible manner, the time interval between any two rounds of scanning is equal, for example, the preset first preset duration is 5 seconds, and the time interval between any two rounds of scanning is set to 5 seconds.
[0105] In another possible manner, the time intervals between each two rounds of scanning are preset values and may not be equal. For example, there are three time intervals for scanning, and the first device may preset the first time interval to be 4.5 seconds, the second time interval to be 4 seconds, and the third time interval to be 5 seconds.
[0106] In another possible manner, the first preset duration may indicate one of the durations in a preset value range. For example, the preset value range of the first preset duration is a first preset interval [4 seconds, 5 seconds]. After performing a round of WiFi channel scanning, the first device randomly determines a duration interval from the preset value range [4 seconds, 5 seconds] as the interval duration between any two rounds of scanning.
[0107] It should be noted that the above three methods for setting the first preset duration are only exemplary and do not limit other methods for presetting the first preset duration in the present application. In another possible implementation of the present application, the interval between any two rounds of scanning can be adjusted from the first preset duration to the second preset duration, wherein the first preset duration is shorter than the second preset duration.
[0108] In the present application, the first device can determine that the device sending the broadcast data packet is the target device when scanning the first type of channel, and can also determine that the device sending the broadcast data packet is the target device when scanning the second type of channel. Optionally, the first device can match the preset template in response to the matching identifier written in the broadcast data packet, and when the matching identifier and the preset template match, the first device confirms that the device sending the broadcast data packet is the target device. When the first device confirms that the device sending the broadcast data packet is the target device, the first device adjusts the interval between the two rounds of scanning from the first preset duration to the second preset duration, and the second preset duration is less than the first preset duration.
[0109] Illustratively, if the first preset duration is a fixed value of 5 seconds, the second preset duration is a duration shorter than the fixed value. For example, in this scenario, the second preset duration may be 2 seconds.
[0110] Illustratively, if the first preset duration is any one of a fixed set of values, such as 4.5 seconds, 4 seconds, and 5 seconds, the second preset duration may also be any one of a corresponding set of values, and the second preset duration is smaller than the corresponding first preset duration. For example, in this scenario, the second preset duration is 1.5 seconds, 1 second, and 2 seconds.
[0111] Illustratively, if the first preset duration is a value from a preset interval, for example, a value taken from the first preset interval [4 seconds, 5 seconds], then the second preset duration can be a value taken from the second preset interval [1 second, 2 seconds].
[0112] In one possible manner, the use of the second preset duration has an effective duration. When the first device changes the first preset duration to the second preset duration, the effective duration of using the second preset duration is the first time period. It should be noted that the effective time period is not limited by the number of rounds and cycles of scanning the WiFi valid channels. For example, within the first time period, no matter how many cycles of WiFi valid channels the first device executes, the interval between any two rounds of scanning is set to the second preset duration.
[0113] It should be noted that when the system of the first device is always in the first time period, the interval duration between each round of channel scanning may be the same. And / or, when the system of the first device is always not in the first time period, the interval duration between each round of channel scanning may also be the same. In this setting, the complexity of the time interval setting can be reduced and the robustness of the system can be improved. It is understandable that when the system of the first device is always in the first time period, the interval duration between each round of channel scanning may also be different. Similarly, when the system of the first device is always not in the first time period, the interval duration between each round of channel scanning may also be different.
[0114] On this basis, the present application provides two methods for restoring the second preset duration to the first preset duration.
[0115] In the first recovery method, in response to the system time not being in the first time period, the first device recovers the second preset time length to the first preset time length. If the effective time length of the second preset time length is 30 seconds, the meaning of the system time not being in the first time period is that 30 seconds have passed since the system time was adjusted from the first preset time length to the second preset time length, and at this time, the first device recovers the second preset time length to the first preset time length.
[0116] In the second recovery method, in response to the system time being in the first time period and the matching identifier in the current round of scanning results not matching the preset template, the second preset duration is restored to the first preset duration. Taking the effective duration of the second preset duration as 30 seconds as an example, when the system time is still within 30 seconds after the first preset duration is adjusted to the second preset duration, the matching identifier in the scanning results of the first device in the current round is different from the preset template, and the second preset duration is restored to the first preset duration.
[0117] Step 440: Calculate the distance to the target device based on part or all of the information in the first scanning result and / or the second scanning result.
[0118] In a possible implementation, the first device superimposes all information in the first scanning result and the second scanning result to calculate the distance between the first device and the target device.
[0119] In another possible implementation, if the data quality of the first scan result is high and the distance to the target device can be calculated independently, the first device only uses the data in the first scan result. Similarly, if the data quality of the second scan result is high and the distance to the target device can be calculated independently, the first device only uses the data in the second scan result.
[0120] A method for calculating the distance to a target device based on the scanning result is now introduced.
[0121] Indicatively, the first device may use the signal strength of the broadcast data packet received from the target device as the original signal strength, which is represented by RSSI. The larger the RSSI, the smaller the loss of the wireless signal during the propagation process. Conversely, the smaller the RSSI, the greater the loss of the wireless signal during the propagation process. The original signal strength may be a collection of signal strengths provided by the first scan result and the second scan result. For example, the first scan result is the result obtained by the first device scanning a round of the first type of channel, which may specifically include the signal strength R1 of the broadcast data packet transmitted by the received target device A. If the second scan result is the result obtained by the first device scanning a round of the second type of channel, it may specifically include the channel strength R2 of the broadcast data packet transmitted by the received target device A; similarly, if there are other scan results obtained by other rounds of scanning, they include R3 and R4. In this scenario, the data of the original signal strength includes four data, namely R1, R2, R3 and R4.
[0122] On this basis, the first device corrects the above-mentioned original signal strength through a correction function to obtain a corrected signal strength. The corrected signal strength is used to correct the impact of differences in the first device and / or the target device on the signal strength measurement. Since the measurement result of the signal strength will be affected by the receiving device (i.e., the first device) and the transmitting device (i.e., the target device) (i.e., at the same device spacing, different receiving devices have different signal strength measurement results for wireless signals sent to the same target device; at the same device spacing, the same receiving device has different signal strength measurement results for wireless signals sent by different transmitting devices), in order to improve the accuracy of the signal measurement result, the first device needs to correct the original signal strength.
[0123] The signal strength correction process can be understood as the standardization of the measurement process, that is, the measurement process of the wireless signal sent by the first device to the target device at the actual device distance is converted into the measurement process of the wireless signal sent by the standard receiving device to the standard sending device at the actual device distance. It should be noted that if the first device and the target device are both standard devices, the first device does not need to perform signal strength correction.
[0124] In a possible implementation, a correction function for performing signal strength correction is provided in the first device. During the signal strength correction process, the first device uses the measured original signal strength as a function input, and determines the function output of the correction function as the corrected signal strength. Different receiving devices and / or transmitting devices correspond to different correction functions, and the correction function can be pre-set at the first device, or obtained and stored by the first device from a server.
[0125] Since the receiving device has a greater impact on the signal strength measurement, in a possible implementation, the correction function is used to correct the impact of the receiving device on the signal strength measurement, or the correction function is used to correct the impact of the receiving device and the transmitting device on the signal strength measurement (that is, at least the impact of the receiving device on the signal strength measurement needs to be corrected).
[0126] Optionally, when the target device sends a wireless signal at a specific frequency, the first device performs signal strength correction on multiple original signal strengths obtained through continuous measurements.
[0127] On this basis, the first device determines the device distance between the first device and the target device based on the corrected signal strength. Further, the first device determines the device distance based on the corrected signal strength, wherein the device distance can be a specific distance (such as 30cm, 50cm, etc.) or a range indication (such as a range of 30cm to 50cm, or within a range of 30cm or outside a range of 30cm).
[0128] In one possible implementation, when it is necessary to obtain a specific device spacing, the first device inputs the corrected signal strength as a parameter into a distance calculation formula to obtain the device spacing. Since the distance calculation formula includes a square operation, the speed of calculating the device spacing using the distance calculation formula is slow. In another possible implementation, when only the approximate range of the device spacing is required, the first device obtains a standard comparison table of standard device spacing and standard signal strength, and then searches for the device spacing from the comparison table based on the corrected signal strength, wherein the standard signal strength is obtained by measuring the wireless signal sent by the first standard device (standard receiving device) to the second standard device (standard transmitting device) at different standard device spacings. Compared with calculating the device spacing using the distance calculation formula, determining the device spacing by looking up the comparison table is faster (because no square operation is required).
[0129] In an illustrative example, a standard comparison table of standard device spacing and standard signal strength is shown in Table 1.
[0130] Table 1
[0131] Standard equipment spacing (cm) Standard signal strength (dbm) 10 -20 20 -25 30 -30 60 -40 100 -50
[0132] For example, when the corrected signal strength is -27dbm, the first device determines that the device distance between it and the second device is in the range of 20cm to 30cm, or determines that the device distance is within the range of 30cm; when the corrected signal strength is -35dbm, the first device determines that the device distance between it and the second device is in the range of 30cm to 60cm, or determines that the device distance is outside the range of 30cm.
[0133] In another possible way of using the scanning results, the first device may also simply display the measured signal strength of the target device, which is not limited in this embodiment of the present application.
[0134] In summary, the embodiment of the present application can obtain a first scanning result by scanning the first type of channels and obtain a second scanning result by scanning the second type of channels when scanning WiFi signals. The number of the second type of channels is less than the number of the first type of channels. Since the second type of channels includes designated channels and / or broadcast channels containing broadcast data packets sent by the target device, the present application can reduce the number of channels to be scanned while obtaining the same scanning result, thereby reducing scanning delay and energy consumption and improving scanning efficiency.
[0135] The WiFi signal scanning method provided in this embodiment can also shorten the interval between any two rounds from a first preset duration to a second preset duration when a target device is identified in the scanning results of the previous round, thereby speeding up the acquisition of the scanning results, further improving the scanning efficiency, and reducing the scanning delay.
[0136] The WiFi signal scanning method provided in this embodiment can also set an effective duration for the second preset duration after shortening the first preset duration to the second preset duration, thereby avoiding the device from being in a high-frequency scanning state continuously and reducing the energy consumption of the device during long-term operation.
[0137] The WiFi signal scanning method provided in this embodiment can also set the designated channel as a non-overlapping channel. Since WiFi devices usually send and receive signals through non-overlapping channels, this design can reduce the scanning delay while successfully acquiring the broadcast data packet broadcast by the target device.
[0138] Based on the method shown in the above embodiment, the embodiment of the present application also provides a WiFi signal scanning method, which can obtain multiple groups of scanning results through multiple rounds of WiFi signal scanning. Please refer to the following embodiment.
[0139] See also Figure 5 , which is a flow chart of a WiFi signal scanning method provided by another exemplary embodiment of the present application. The WiFi signal scanning method can be applied in the first device shown above, and the WiFi signal scanning method includes:
[0140] Step 500, the first device scans according to a preset period, the preset period includes M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of second-category channels is less than the number of first-category channels, the interval between each round of scanning is the same or different, and M and N are positive integers.
[0141] In this example, the first device will scan according to a preset period. It should be noted that the preset period includes two types of scans. The first type of scan is a first type of channel scan, and the second type of scan is a second type of channel scan. The number of first type channels is greater than the number of second type channels.
[0142] Since in the related art, in order to obtain multiple groups of scanning results, the full channel scan is usually repeated in each cycle, therefore, the energy consumption and time spent in order to obtain multiple scanning results in the related art are both relatively high. In the present application, the number of the second category channels is less than the number of the first category channels. If M is less than or equal to N, this example can obtain multiple scanning results in a shorter time.
[0143] In another possible manner, M may be greater than N. When M is greater than N, the first device can more comprehensively cover various channels during the scanning process, thereby reducing the occurrence of scenarios where the first device is difficult to detect when new broadcasting devices appear in some uncommon WiFi channels.
[0144] In the present application, the first device may scan the first category channel first or the second category channel first. Optionally, the first device may scan M rounds of the first category channel first and then scan N rounds of the second category channel. Optionally, the first device may scan N rounds of the second category channel first and then scan M rounds of the first category channel. Optionally, the first device may also scan M rounds of the first category channel and N rounds of the second category channel alternately. It should be noted that the above execution methods are all schematic descriptions, and the present application does not limit the execution order between M rounds of first category channel scanning and N rounds of second category channel scanning in a preset period.
[0145] Optionally, the interval between each round may take the time when the previous round completes the first-category channel scanning as the starting time, or may take the time when the previous round obtains the scanning result as the starting time.
[0146] In summary, compared with the method of performing multiple rounds of full-channel scanning in order to obtain multiple scanning results in the related art, the embodiment of the present application can obtain the same scanning results in a shorter time and with lower energy consumption by scanning a smaller number of second channels, thereby improving the scanning efficiency of the WiFi channel.
[0147] based on Figure 5In the embodiment shown, the present application also provides a WiFi signal scanning method, which can effectively reduce the scanning delay and energy through multiple rounds of scanning. For details, see Figure 6 .
[0148] Figure 6 : is a flowchart of a WiFi signal scanning method provided in an embodiment of the present application. The WiFi signal scanning method can be applied to the first device shown above. Taking M less than or equal to N and M being 1 as an example, the WiFi signal scanning method includes:
[0149] Step 611: The first device first performs a round of first-category channel scanning.
[0150] In one possible manner, the first type of channels includes all WiFi available channels. In another possible manner, the first type of channels includes part of the WiFi available channels.
[0151] Step 612: The first device performs N rounds of second-type channel scanning again.
[0152] In one possible embodiment, the second type of channel includes a designated channel and / or a broadcast channel; wherein the designated channel is a predetermined available channel, and reference may be made to the description of the designated channel in the previous embodiment; the broadcast channel includes the channel where the broadcast data packet broadcast by the target device is scanned or the channel indicated by the channel information carried in the broadcast data packet broadcast by the target device.
[0153] In a possible implementation, the first device may perform one round of first-category channel scanning before performing N rounds of second-category channel scanning. The first device may also perform N rounds of second-category channel scanning before performing one round of first-category channel scanning. Alternatively, the first device may also perform one round of first-category channel scanning between any two rounds of N rounds of second-category channel scanning, which is not limited in the present application. In a feasible implementation, N is 3, and the related technical effects refer to the previous description, which will not be elaborated here.
[0154] In a possible implementation manner, after completing M rounds of scanning the first channel and N rounds of scanning the second channel, M rounds of scanning the first channel and N rounds of scanning the second channel are performed again.
[0155] In the present application, the first device may perform another preset cycle of scanning after completing a preset cycle of scanning, and repeat this process. It is understandable that there may be an interval between the last round of channel scanning in the previous preset cycle and the first round of channel scanning in this preset cycle. In one possible manner, an interrupt condition of a terminal preset cycle is set in the first device. Indicatively, the interrupt condition may be that the distance to the target device has been successfully measured, or that the first device is no longer in a preset home scene or office scene, or that the first device is in an off-screen state. The embodiments of the present application do not limit the interrupt condition.
[0156] Optionally, in the present application, the scanning result of the current round of channel scanning will be obtained after each round of scanning. The scanning result includes the information of part or all of the broadcast data packets scanned in the current round and the signal strength of the corresponding broadcast device. The broadcast data packets are sent by the corresponding broadcast device. It should be noted that the information in the broadcast data packets in the scanning result can be all the information in the broadcast data packets or part of the information in the broadcast data packets.
[0157] Optionally, after each round of channel scanning, the first device obtains the distance information of the target device according to part or all of the information of the previous scanning results. The method for the first device to obtain the distance information between the first device and the target device according to the channel in the scanning result can be found in Figure 4 This has been discussed in the previous section and will not be repeated here.
[0158] It can be understood that each time the distance information is calculated, part of the scanning results from previous scanning results can be used for calculation, or all of the scanning results from previous scanning results can be used for calculation. It can be partial information of the scanning results, such as RSSI value, or all of the information, which can be determined according to the algorithm for calculating the distance.
[0159] Optionally, the broadcast device includes a target device and / or a non-target device, wherein if the broadcast data packet includes a preset matching identifier, the corresponding broadcast device is the target device, and the preset matching identifier is used to indicate that the broadcast device meets the first preset condition.
[0160] It can be understood that the preset matching identifier can be an identifier that can match the preset list, such as the white list mentioned in the previous implementation, or other situations. The specific example is similar to the description of the first preset condition in the previous implementation, and will not be repeated here.
[0161] If a broadcast data packet broadcast by the target device is scanned in the jth round of channel scanning, the first device can shorten the interval between each round of channel scanning. For example, if the original interval between each round of channel scanning is 5 seconds, the shortened interval can be 2 seconds.
[0162] It can be understood that the jth round of channel scanning can be a first type of channel scanning, such as a full channel scanning, or it can be a second round of channel scanning, such as a designated channel scanning and / or a broadcast channel scanning. The starting time of the interval duration can refer to the description in the previous implementation manner and will not be repeated here.
[0163] If the first time period has passed after the jth round of channel scanning, the interval between each round of channel scanning is restored or increased. The first time period may be the effective time of the interval shortened by the first device, for example, the first time period is 30 seconds. The first device may restore the interval to the original 5 seconds or increase the time after 30 seconds, and the increased time may be longer or shorter than the original 5 seconds, which is not limited in the embodiments of the present application.
[0164] It is understandable that the time to start calculating the first period can also be flexibly set, such as starting from the time when the data packet information sent by the target device is confirmed in the current round of scanning results; in addition to restoring or increasing the interval length after the first period, the interval length can also be restored or increased if the target device is scanned in any round of scanning during the first period, as described in the previous embodiment. In addition, in a feasible manner, if the target device is still scanned in a round of channel scanning during the first period, the preset time will not be recalculated.
[0165] In summary, the WiFi signal scanning method provided in this embodiment can complete the WiFi signal scanning according to the preset period by performing M rounds of first-category channel scanning and N rounds of second-category channel scanning. Since the number of channels of the second-category channels is less than the number of channels of the first-category channels and M is less than or equal to N. Therefore, the embodiment of the present application can reduce the energy consumption and duration of repeatedly performing multiple rounds of full channel scanning in the related art through multiple rounds of channel scanning, thereby improving the efficiency of obtaining multiple scanning results.
[0166] It should be noted that the technical solutions and technical features provided in the above embodiments can be referenced and supplemented with each other if there is no conflict.
[0167] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0168] Please refer to Figure 7 , which shows a structural block diagram of a WiFi signal scanning device provided by an exemplary embodiment of the present application. The WiFi signal scanning device can be implemented as all or part of the first device through software, hardware, or a combination of both. The device includes:
[0169] A first scanning module 710 is used to scan a first type of channel in the available WiFi channels to obtain a first scanning result, where the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device;
[0170] The second scanning module 720 is used to scan the second type of channels in the WiFi available channels to obtain a second scanning result, wherein the second scanning result includes part or all of the information of some or all of the scanned broadcast data packets and the signal strength of the corresponding broadcasting device; wherein the number of the second type of channels is less than the number of the first type of channels, and the interval between scanning the first type of channels and scanning the second type of channels is a first preset duration.
[0171] In an optional embodiment, the broadcast data packet involved in the apparatus is sent by the corresponding broadcast device, and the broadcast device includes: a target device and / or a non-target device, and the target device is a broadcast device that meets a first preset condition.
[0172] In an optional embodiment, the first preset condition involved in the device includes: the matching identifier carried in the broadcast data packet matches the preset template, and the matching identifier is the identifier of the broadcast device that sends the broadcast data packet; or, the first preset condition includes: the broadcast device provides its own control authority.
[0173] In an optional embodiment, the second type of channels involved in the device include designated channels and / or broadcast channels; wherein, the designated channel is a channel with a pre-designated channel number, and the broadcast channel includes the channel where the broadcast data packet broadcast by the target device is scanned or the channel indicated by the channel information carried in the broadcast data packet broadcast by the target device.
[0174] In an optional embodiment, the first preset duration involved in the device is timed by a first timer, and the time for setting the first timer includes any one of the time when the first type of channel is scanned, the time when the first scanning result is obtained, and the time when the broadcast data packet sent by the target device is identified; the second scanning module 720 is used to scan the second type of channel in the WiFi available channels in response to the first timer timing out.
[0175] In an optional embodiment, the apparatus further includes a distance calculation module, configured to calculate the distance to the target device based on part or all of the information in the first scanning result and / or the second scanning result.
[0176] In an optional embodiment, a cycle of the WiFi signal scanning method involved in the device includes one round of scanning the first type of channels and n rounds of scanning the second type of channels, where n is a positive integer.
[0177] In an optional embodiment, the device comprises a device confirmation module and a duration adjustment module, wherein the device confirmation module is used to confirm that the device sending the broadcast data packet is the target device in response to a matching identifier carried in the broadcast data packet matching a preset template, and the matching identifier is the identifier of the broadcast device sending the broadcast data packet; and the duration adjustment module is used to adjust the first preset duration to a second preset duration in response to the device sending the broadcast data packet being the target device, and the second preset duration is smaller than the first preset duration.
[0178] In an optional embodiment, the effective duration of the second preset duration involved in the device is the first time period, and the device further includes a duration recovery module, which is used to restore the second preset duration to the first preset duration in response to the system moment not being in the first time period. Alternatively, the duration recovery module is used to restore the second preset duration to the first preset duration in response to the system moment being in the first time period and the matching identifier in the current round of scanning results not matching the preset template.
[0179] In an optional embodiment, the apparatus involves that when the system time is in the first time period, the interval between each round of channel scanning is the same; and / or when the system time is outside the first time period, the interval between each round of channel scanning is the same
[0180] In an optional embodiment, the designated channels involved in the device are non-overlapping channels, and the non-overlapping channels include at least one of the following groups of channels: channel 1, channel 6 and channel 11; channel 2, channel 7 and channel 12; channel 3, channel 8 and channel 13.
[0181] In an optional embodiment, the first category of channels involved in the device includes all channels in the WiFi available channels.
[0182] Please refer to Figure 8 , which shows a structural block diagram of another WiFi signal scanning device provided by an exemplary embodiment of the present application. The WiFi signal scanning device can be implemented as all or part of the first device through software, hardware, or a combination of both. The device includes:
[0183] The third scanning module 800 is used to scan the wifi signal according to a preset period; wherein the preset period includes: M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of the second-category channels is less than the number of the first-category channels, the interval between each round of scanning is the same or different, and M and N are positive integers.
[0184] In an optional embodiment, the third scanning module 800 is used to first perform a round of first-category channel scanning; and then perform N rounds of second-category channel scanning in sequence, where M=1, and M is less than or equal to N.
[0185] In an optional embodiment, the third scanning module 800 is used to perform M rounds of first-category channel scanning and N rounds of second-category channel scanning again after completing M rounds of first-category channel scanning and N rounds of second-category channel scanning.
[0186] In an optional embodiment, the device also includes a result acquisition module, which is used to obtain the scanning results of this round of channel scanning after completing a round of channel scanning, and the scanning results include: part or all of the information of part or all of the broadcast data packets scanned in this round and the signal strength of the corresponding broadcasting device, and the broadcast data packets are sent by the corresponding broadcasting device.
[0187] In an optional embodiment, the broadcasting device involved in the apparatus includes a target device and / or a non-target device, wherein if the broadcasting data packet includes a preset matching identifier, the corresponding broadcasting device is the target device, and the preset matching identifier is used to indicate that the broadcasting device satisfies a first preset condition.
[0188] In an optional embodiment, the apparatus further includes a distance acquisition module, which is used to obtain the distance information of the target device according to part or all of the information of part or all of the scanning results in previous scanning results after each round of channel scanning.
[0189] In an optional embodiment, the apparatus further includes a first adjustment module, configured to shorten the interval between each round of channel scanning if a broadcast data packet broadcast by the target device is scanned in the jth round of channel scanning, where j is a positive integer.
[0190] In an optional embodiment, the device further includes a second adjustment module, configured to restore or increase the interval time between each round of channel scanning if a first time period has passed after the j-th round of channel scanning.
[0191] In an optional embodiment, the first category of channels involved in the device includes all available channels.
[0192] In an optional embodiment, the second type of channels involved in the device include designated channels and / or broadcast channels; wherein the designated channel is a predetermined available channel; the broadcast channel includes the channel where the broadcast data packet broadcast by the target device is scanned or the channel indicated by the channel information carried in the broadcast data packet broadcast by the target device.
[0193] In an optional embodiment, the designated channels involved in the device are non-overlapping channels, and the non-overlapping channels include at least one of the following groups of channels: channel 1, channel 6 and channel 11; channel 2, channel 7 and channel 12; channel 3, channel 8 and channel 13.
[0194] It should be noted that, in order to avoid redundancy, the relevant technical features in the above-mentioned device can be explained with reference to the description of the technical features in the method, and the relevant technical features can be combined with each other if there is no conflict.
[0195] Please refer to Fig. 9 , which shows a block diagram of a computer device provided by an exemplary embodiment of the present application. The computer device 900 may be a smart phone, a tablet computer, a wearable device, etc. The computer device 900 in the present application may include one or more of the following components: a processor 910, a memory 920, and a WiFi receiver 930.
[0196] The processor 910 may include one or more processing cores. The processor 910 uses various interfaces and lines to connect the various parts of the entire computer device 900, and executes various functions and processes data of the computer device 900 by running or executing instructions, programs, code sets or instruction sets stored in the memory 920, and calling data stored in the memory 920. Optionally, the processor 910 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 910 can integrate one or more combinations of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processor (NPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the touch display screen 930; the NPU is used to implement artificial intelligence (AI) functions; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 910, but may be implemented by a separate chip.
[0197] The memory 920 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 920 includes a non-transitory computer-readable storage medium. The memory 920 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 920 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.; the data storage area may store data (such as audio data, a phone book), etc., created according to the use of the computer device 900.
[0198] The WiFi receiver 930 is a component for receiving and transmitting wireless signals, and is composed of a receiver and a transmitter. The WiFi receiver 930 may be a Bluetooth communication component, a WiFi communication component, or a UWB communication component, etc., which is not limited in this embodiment.
[0199] In addition, those skilled in the art can understand that the structure of the computer device 900 shown in the above drawings does not constitute a limitation on the computer device, and the computer device may include more or fewer components than shown in the drawings, or combine certain components, or arrange the components differently. For example, the computer device 900 also includes components such as a display screen, a sensor, an audio circuit, and a power supply, which will not be described in detail here.
[0200] An embodiment of the present application further provides a computer-readable medium storing at least one instruction, wherein the at least one instruction is loaded and executed by the processor to implement the WiFi signal scanning method described in the above embodiments.
[0201] It should be noted that: when the WiFi signal scanning device provided in the above embodiment executes the WiFi signal scanning method, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the WiFi signal scanning device provided in the above embodiment and the WiFi signal scanning method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0202] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0203] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0204] The above description is only an illustrative embodiment that can be implemented in the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A WiFi signal scanning method, characterized in that: The method comprises: Scan a first type of channel in available WiFi channels to obtain a first scanning result, where the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device; Scan the second category of channels in the available WiFi channels to obtain a second scanning result, wherein the second scanning result includes part or all of the information of the scanned part or all of the broadcast data packets and the signal strength of the corresponding broadcasting device; wherein the number of the second category of channels is less than the number of the first category of channels, the cycle of the WiFi signal scanning method includes one round of scanning the first category of channels and n rounds of scanning the second category of channels, n is a positive integer, the time interval between any two rounds of scanning in the cycle is a first preset duration, the broadcast data packet is sent by the corresponding broadcasting device, the broadcasting device includes: a target device and / or a non-target device, and the target device is a broadcasting device that meets the first preset condition; In response to a match between a matching identifier carried in the broadcast data packet and a preset template, confirming that a device sending the broadcast data packet is the target device, wherein the matching identifier is an identifier of the broadcast device sending the broadcast data packet; In response to the device sending the broadcast data packet being the target device, adjusting the first preset duration to a second preset duration, the second preset duration being less than the first preset duration, and the effective duration of the second preset duration being the first time period; In response to the system not being in the first time period, restoring the second preset duration to the first preset duration; or, In response to the system being in the first time period and the matching identifier in the current round of scanning results not matching the preset template, the second preset duration is restored to the first preset duration.
2. The method according to claim 1, characterized in that The first preset condition includes: the matching identifier carried in the broadcast data packet matches a preset template, and the matching identifier is the identifier of the broadcast device that sends the broadcast data packet; or, the first preset condition includes: the broadcast device provides its own control authority.
3. The method according to claim 1, characterized in that: The second type of channels include designated channels and / or broadcast channels; The designated channel is a channel with a pre-designated channel number, and the broadcast channel includes the channel where the broadcast data packet broadcast by the target device is scanned or the channel indicated by the channel information carried in the broadcast data packet broadcast by the target device.
4. The method according to claim 1, characterized in that: The first preset duration is measured by a first timer, and the time of setting the first timer includes any one of the time when the first type of channel is scanned and the time when the first scanning result is obtained; The scanning of the second type of channels in the WiFi available channels includes: In response to the first timer timing out, scanning the second-category channels among the WiFi available channels.
5. The method according to claim 1, characterized in that The method further comprises: The distance to the target device is calculated according to part or all of the information in the first scanning result and / or the second scanning result.
6. The method according to claim 1, characterized in that When the system is in the first time period, the interval between each round of channel scanning is the same; and / or when the system is outside the first time period, the interval between each round of channel scanning is the same.
7. The method according to claim 3, characterized in that The designated channels are non-overlapping channels, and the non-overlapping channels include at least one group of the following channels; Channel 1, Channel 6 and Channel 11; Channel 2, Channel 7 and Channel 12; Channel 3, Channel 8 and Channel 13.
8. The method according to any one of claims 1 to 7, characterized in that: The first category of channels includes all channels in the WiFi available channels.
9. A WiFi signal scanning method, characterized in that: The method comprises: Scan WiFi signals according to the preset period; Wherein, the preset cycle includes: performing M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of second-category channels is less than the number of first-category channels, the interval duration between each round of scanning is the same or different, M and N are positive integers, and after completing a round of channel scanning, a scanning result of this round of channel scanning is obtained, and the scanning result includes: part or all of the information of part or all of the broadcast data packets scanned in this round and the signal strength of the corresponding broadcasting device, the broadcast data packet is sent by the corresponding broadcasting device, and the broadcasting device includes a target device and / or a non-target device, wherein, if the broadcast data packet includes a preset matching identifier, the corresponding broadcasting device is the target device, and the preset matching identifier is used to indicate that the broadcasting device meets the first preset condition; If a broadcast data packet broadcast by the target device is scanned in the jth round of channel scanning, the interval between each round of channel scanning is shortened, where j is a positive integer; If the first time period has passed after the j-th round of channel scanning, the interval time between each round of channel scanning is restored or increased.
10. The method according to claim 9, characterized in that The performing M rounds of first-category channel scanning and N rounds of second-category channel scanning includes: First, perform a round of first-category channel scanning; Then perform N rounds of second-category channel scanning in sequence.
11. The method according to claim 9, characterized in that The wifi signal scanning is performed according to a preset period, including: After completing M rounds of scanning the first channel and N rounds of scanning the second channel, M rounds of scanning the first channel and N rounds of scanning the second channel are performed again.
12. The method according to claim 9, characterized in that The method further comprises: after each round of channel scanning is completed, obtaining the distance information of the target device according to part or all of the information of part or all of the scanning results in previous scanning results.
13. The method according to any one of claims 9 to 12, characterized in that: The first category of channels includes all available channels.
14. The method according to any one of claims 9 to 12, characterized in that: The second category of channels includes designated channels and / or broadcast channels; wherein the designated channels are predetermined available channels; the broadcast channels include the channel where the broadcast data packet broadcast by the target device is scanned, or the channel indicated by the channel information carried in the broadcast data packet broadcast by the target device.
15. The method according to claim 14, characterized in that The designated channels are non-overlapping channels, and the non-overlapping channels include at least one of the following groups of channels; Channel 1, Channel 6 and Channel 11; Channel 2, Channel 7 and Channel 12; Channel 3, Channel 8 and Channel 13.
16. A WiFi signal scanning device, characterized in that: The device comprises: A first scanning module, configured to scan a first type of channel in available WiFi channels to obtain a first scanning result, wherein the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device; A second scanning module is used to scan the second type of channels in the available WiFi channels to obtain a second scanning result, wherein the second scanning result includes part or all of the information of the scanned part or all of the broadcast data packets and the signal strength of the corresponding broadcasting device; wherein the number of the second type of channels is less than the number of the first type of channels, the cycle of the WiFi signal scanning method includes one round of scanning the first type of channels and n rounds of scanning the second type of channels, n is a positive integer, the time interval between any two rounds of scanning in the cycle is a first preset duration, the broadcast data packet is sent by the corresponding broadcasting device, and the broadcasting device includes: a target device and / or a non-target device, and the target device is a broadcasting device that meets the first preset condition; A device confirmation module, configured to confirm that the device sending the broadcast data packet is the target device in response to a match between a matching identifier carried in the broadcast data packet and a preset template, wherein the matching identifier is an identifier of the broadcast device sending the broadcast data packet; a duration adjustment module, configured to adjust the first preset duration to a second preset duration in response to the device sending the broadcast data packet being the target device, wherein the second preset duration is less than the first preset duration, and the effective duration of the second preset duration is the first time period; A duration recovery module is used to restore the second preset duration to the first preset duration in response to the system moment not being in the first time period; or, in response to the system moment being in the first time period and the matching identifier in the current round of scanning results not matching the preset template, restore the second preset duration to the first preset duration.
17. A WiFi signal scanning device, characterized in that: The device comprises: The third scanning module is used to scan the Wi-Fi signal according to a preset period; The preset cycle includes: performing M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of second-category channels is less than the number of first-category channels, the interval duration between each round of scanning is the same or different, and M and N are positive integers; after performing a round of channel scanning, a scanning result of this round of channel scanning is obtained, and the scanning result includes: part or all of the information of part or all of the broadcast data packets scanned in this round and the signal strength of the corresponding broadcasting device, the broadcast data packet is sent by the corresponding broadcasting device, and the broadcasting device includes a target device and / or a non-target device, wherein if the broadcast data packet includes a preset matching identifier, the corresponding broadcasting device is the target device, and the preset matching identifier is used to indicate that the broadcasting device meets the first preset condition; A first adjustment module, configured to shorten the interval between each round of channel scanning if a broadcast data packet broadcast by the target device is scanned in the jth round of channel scanning, where j is a positive integer; The second adjustment module is used to restore or increase the interval time between each round of channel scanning if a first time period has passed after the j-th round of channel scanning.
18. A terminal, characterized in that: The terminal includes a processor and a WiFi transceiver; The processor is used to instruct the WiFi transceiver to scan a first type of channel in the WiFi available channels to obtain a first scanning result, wherein the first scanning result includes part or all of the information of part or all of the scanned broadcast data packets and the signal strength of the corresponding broadcast device; The processor is used to instruct the WiFi transceiver to scan the second type of channels in the WiFi available channels to obtain a second scanning result, wherein the second scanning result includes part or all of the information of the scanned part or all of the broadcast data packets and the signal strength of the corresponding broadcasting device; wherein the number of the second type of channels is less than the number of the first type of channels, the cycle of the WiFi signal scanning method includes one round of scanning the first type of channels and n rounds of scanning the second type of channels, n is a positive integer, the time interval between any two rounds of scanning in the cycle is a first preset duration, the broadcast data packet is sent by the corresponding broadcasting device, and the broadcasting device includes: a target device and / or a non-target device, and the target device is a broadcasting device that meets the first preset condition; The processor is used for confirming that the device sending the broadcast data packet is the target device in response to the matching identifier carried in the broadcast data packet matching with the preset template, and the matching identifier is the identifier of the broadcast device sending the broadcast data packet; The processor is configured to, in response to the device sending the broadcast data packet being the target device, adjust the first preset duration to a second preset duration, the second preset duration being less than the first preset duration, and the effective duration of the second preset duration being a first period; The processor is used to restore the second preset duration to the first preset duration in response to the system moment being not in the first time period; or, in response to the system moment being in the first time period and the matching identifier in the current round of scanning results not matching the preset template, restore the second preset duration to the first preset duration.
19. A terminal, characterized in that: The terminal includes a processor and a WiFi transceiver; The processor is used to instruct the WiFi transceiver to scan WiFi signals according to a preset period; Wherein, the preset cycle includes: performing M rounds of first-category channel scanning and N rounds of second-category channel scanning, the number of second-category channels is less than the number of first-category channels, the interval duration between each round of scanning is the same or different, M and N are positive integers, and after completing a round of channel scanning, a scanning result of this round of channel scanning is obtained, and the scanning result includes: part or all of the information of part or all of the broadcast data packets scanned in this round and the signal strength of the corresponding broadcasting device, the broadcast data packet is sent by the corresponding broadcasting device, and the broadcasting device includes a target device and / or a non-target device, wherein, if the broadcast data packet includes a preset matching identifier, the corresponding broadcasting device is the target device, and the preset matching identifier is used to indicate that the broadcasting device meets the first preset condition; The processor is used for shortening the interval between each round of channel scanning if a broadcast data packet broadcast by the target device is scanned in the jth round of channel scanning, where j is a positive integer; The processor is configured to restore or increase the interval time between each round of channel scanning if a first time period has passed after the j-th round of channel scanning.
20. A computer-readable storage medium, wherein program instructions are stored in the storage medium, characterized in that: When the program instructions are executed by the processor, the WiFi signal scanning method as described in any one of claims 1 to 15 is implemented.
21. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the WiFi signal scanning method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Channel scanning method and device, storage medium and electronic device
CN110234152A