A method, apparatus, smart terminal, and storage medium for automatic Wi-Fi reconnection.

By dynamically adjusting the Wi-Fi scanning time interval, the problems of low reconnection efficiency and high power consumption when the Wi-Fi connection is lost are solved, and a highly efficient Wi-Fi reconnection process is achieved.

CN116017632BActive Publication Date: 2025-12-02SHENZHEN KONKA ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211536010.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-02
Publication Date
2025-12-02
Estimated Expiration
2042-12-02

AI Technical Summary

Technical Problem

In existing technologies, scanning is performed at fixed time intervals when a Wi-Fi connection is lost, resulting in low reconnection efficiency and excessive throughput and power consumption.

Method used

By acquiring Wi-Fi connection status, the scanning time interval is dynamically adjusted, and Wi-Fi networks in the environment are scanned according to preset scanning cycle rules to avoid invalid requests and achieve real-time control of the scanning time interval.

Benefits of technology

It shortens Wi-Fi reconnection time, optimizes power consumption, improves reconnection efficiency, and avoids problems caused by fixed scan intervals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116017632B_ABST
    Figure CN116017632B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, smart terminal, and storage medium for automatic Wi-Fi reconnection. The method includes: acquiring the Wi-Fi connection status; if the Wi-Fi connection status is disconnected, acquiring the Wi-Fi network configuration; if the Wi-Fi network configuration is not empty, dynamically acquiring a scanning time interval according to a preset scanning cycle rule, and scanning the Wi-Fi networks in the environment according to the scanning time interval to obtain the scanning result; and connecting to the Wi-Fi network according to the scanning result. This invention can dynamically adjust the scanning cycle according to changes in the Wi-Fi connection status, which can both shorten the Wi-Fi reconnection time and reasonably configure power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wireless communication, and specifically to a Wi-Fi automatic reconnection method, apparatus, smart terminal, and storage medium. Background Technology

[0002] Wi-Fi (Wireless Fidelity) is a technology that allows personal computers, handheld devices (such as tablets and mobile phones) to connect wirelessly. It is actually a high-frequency radio signal and is currently the most widely used wireless network transmission technology in the world, as well as a wireless networking technology. Wired technology connects computers via network cables, while Wi-Fi connects via radio waves. A common scenario is the presence of a wireless router; within the effective coverage area of ​​this router, users can connect to the internet using Wi-Fi.

[0003] Wi-Fi connections can be lost at any time due to various unpredictable reasons. If a Wi-Fi connection is lost, it needs to be restored promptly to ensure wireless communication. Currently, reconnection after a Wi-Fi disconnection typically uses a fixed time interval for scanning. If the Wi-Fi scanning interval is too long, it will take a long time to find nearby connectable Wi-Fi networks, resulting in excessively long reconnection times and low reconnection efficiency. Conversely, if Wi-Fi scans and reconnects rapidly and continuously at very short time intervals, it will cause problems with excessive throughput and power consumption.

[0004] Therefore, existing technologies still need to be improved and developed. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a Wi-Fi automatic reconnection method, device, smart terminal and storage medium to address the above-mentioned defects of the prior art. The aim is to solve the problem that the prior art often uses a fixed time interval to scan when reconnecting in the Wi-Fi disconnection state, resulting in low reconnection efficiency and excessive throughput and power consumption.

[0006] The technical solution adopted by this invention to solve the technical problem is as follows:

[0007] In a first aspect, the present invention provides a method for automatic Wi-Fi reconnection, wherein the method includes:

[0008] Get Wi-Fi connection status;

[0009] If the Wi-Fi connection status is disconnected, then obtain the Wi-Fi network configuration;

[0010] If the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to the preset scanning cycle rules, and the Wi-Fi network in the environment is scanned according to the scanning time interval to obtain the scanning result;

[0011] Connect to a Wi-Fi network based on the scan results.

[0012] In one implementation, if the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to a preset scanning period rule, and the Wi-Fi network in the environment is scanned according to the scanning time interval to obtain the scanning result, including:

[0013] If the Wi-Fi network configuration is not empty, then the number of scans is obtained; wherein, the number of scans starts counting when scanning the Wi-Fi network in the environment begins, and stops counting when a Wi-Fi network connection is established;

[0014] Substituting the number of scans into the preset scan cycle rule, the scan time interval is obtained;

[0015] The scan results are obtained by scanning the Wi-Fi network in the environment according to the stated scan time interval.

[0016] In one implementation, substituting the number of scans into the preset scan cycle rule to obtain the scan time interval includes:

[0017] When the number of scans is less than or equal to a preset scan number threshold, the preset first time interval is used as the scan time interval;

[0018] In one implementation, substituting the number of scans into the preset scan cycle rule to obtain the scan time interval includes:

[0019] When the number of scans is greater than the scan number threshold, the second time interval is used as the scan time interval; wherein, the second time interval is the smaller value between twice the scan time interval obtained in the previous scan and the preset third time interval.

[0020] In one implementation, connecting to the Wi-Fi network based on the scan results includes:

[0021] If the scan result indicates that no saved Wi-Fi network has been detected, the steps of obtaining the scan time interval and scanning the Wi-Fi network in the environment according to the scan time interval are repeated to obtain the scan result.

[0022] If the scan result indicates that a saved Wi-Fi network has been detected, a Wi-Fi network connection is established according to the saved Wi-Fi network configuration, and the step of obtaining the Wi-Fi connection status is re-executed.

[0023] In one implementation, the method further includes:

[0024] If the Wi-Fi network configuration is empty, no Wi-Fi networks in the environment will be scanned.

[0025] In one implementation, the method further includes:

[0026] If the Wi-Fi connection status is "connected", then the number of scans is reset to zero.

[0027] Secondly, embodiments of the present invention also provide a Wi-Fi automatic reconnection device, wherein the device includes:

[0028] The connection status acquisition module is used to acquire the Wi-Fi connection status;

[0029] The network configuration acquisition module is used to acquire the Wi-Fi network configuration if the Wi-Fi connection status is disconnected.

[0030] The scanning module is used to dynamically obtain the scanning time interval according to the preset scanning cycle rule if the Wi-Fi network configuration is not empty, and scan the Wi-Fi network in the environment according to the scanning time interval to obtain the scanning result;

[0031] A reconnection module is used to connect to a Wi-Fi network based on the scan results.

[0032] Thirdly, embodiments of the present invention also provide a smart terminal, wherein the smart terminal includes a memory, a processor, and a Wi-Fi automatic reconnection program stored in the memory and executable on the processor, wherein when the processor executes the Wi-Fi automatic reconnection program, it implements the steps of the Wi-Fi automatic reconnection method as described in any of the above.

[0033] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a Wi-Fi automatic reconnection program, and when the Wi-Fi automatic reconnection program is executed by a processor, it implements the steps of the Wi-Fi automatic reconnection method as described in any of the above claims.

[0034] Beneficial Effects: Compared with existing technologies, this invention provides a method, apparatus, smart terminal, and storage medium for automatic Wi-Fi reconnection. First, the Wi-Fi connection status is acquired, and it is determined whether the Wi-Fi connection is disconnected. If the Wi-Fi connection is disconnected, the Wi-Fi network configuration is acquired. By acquiring the Wi-Fi connection status in real time, the disconnection can be detected promptly, initiating the reconnection process. Then, if the Wi-Fi network configuration is not empty, a scanning time interval is dynamically acquired according to a preset scanning cycle rule. The Wi-Fi networks in the environment are scanned according to this scanning time interval to obtain the scanning results. The Wi-Fi network configuration is used to determine whether a reconnectable Wi-Fi network exists in the scanned environment, avoiding the generation of invalid requests. Dynamic configuration of the scanning time interval enables real-time adjustment of the scanning time interval, avoiding the low reconnection efficiency and excessive throughput and power consumption problems caused by fixed scanning time intervals. Finally, the Wi-Fi network is connected based on the scanning results. This invention can dynamically adjust the scanning cycle according to changes in the Wi-Fi connection status, which can shorten the Wi-Fi reconnection time and reasonably configure power consumption. Attached Figure Description

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

[0036] Figure 1 This is a schematic diagram of the Wi-Fi automatic reconnection method provided in an embodiment of the present invention.

[0037] Figure 2 This is an example diagram of the Wi-Fi reconnection process provided in an embodiment of the present invention.

[0038] Figure 3 This is a schematic diagram of the Wi-Fi scanning cycle provided in an embodiment of the present invention.

[0039] Figure 4 This is a schematic diagram of the Wi-Fi automatic reconnection device provided in the embodiments of the present invention.

[0040] Figure 5 This is a block diagram illustrating the internal structure of a smart terminal provided in an embodiment of the present invention. Detailed Implementation

[0041] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0042] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0043] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0044] Current technologies typically use fixed time intervals for scanning to reconnect to Wi-Fi after a disconnection. If the Wi-Fi scanning interval is too long, it takes a considerable amount of time to discover nearby connectable Wi-Fi networks, resulting in excessively long reconnection times and low efficiency. Conversely, if Wi-Fi scans and reconnects rapidly and continuously at very short intervals, it can lead to excessive throughput and power consumption.

[0045] To address the problems of existing technologies, this embodiment provides a method for automatic Wi-Fi reconnection. First, the Wi-Fi connection status is acquired. Real-time acquisition of the Wi-Fi connection status allows for timely detection of Wi-Fi connection drops, initiating the reconnection process. Next, the Wi-Fi network configuration is acquired. If the Wi-Fi network configuration is not empty, the scanning time interval is acquired, and the environment's Wi-Fi networks are scanned according to this time interval. The scan results are obtained, and the presence of a reconnectable Wi-Fi network in the scanned environment is determined based on the Wi-Fi network configuration, avoiding the generation of invalid requests. Dynamic configuration of the scanning time interval enables real-time adjustment, avoiding the low reconnection efficiency, excessive throughput, and high power consumption problems caused by fixed scanning time intervals. Finally, the Wi-Fi network is connected based on the scan results. This embodiment can dynamically adjust the scanning cycle according to changes in the Wi-Fi connection status, shortening the Wi-Fi reconnection time and rationally configuring power consumption.

[0046] Exemplary methods

[0047] This embodiment provides a method for automatic Wi-Fi reconnection. For example... Figure 1 As shown, the method includes the following steps:

[0048] Step S100: Obtain Wi-Fi connection status;

[0049] Specifically, Wi-Fi networks are convenient and easy-to-use wireless networks. Multiple users can connect to a router or via hotspot technology. They offer not only fast transmission speeds but also high reliability, with a maximum bandwidth of 11Mbps. In situations with interference or weak signals, the bandwidth automatically adjusts, effectively ensuring network reliability and stability. The main advantage of Wi-Fi is that it doesn't require cabling, eliminating limitations imposed by wiring conditions. Users can easily use and access available networks, and establishing Wi-Fi connections at home or in the workplace is quite common. Furthermore, sharing data in multi-user environments via Wi-Fi without any indirect costs makes it ubiquitous in work and life. However, when devices connect to surrounding Wi-Fi networks, unexpected network drops often occur. There are various reasons for Wi-Fi connection drops, including: strong signal interference sources near the router, insufficient Wi-Fi transmission power from the router, excessive distance between the device and the router, obstructions in between, weak Wi-Fi signals, and hardware malfunctions. When a Wi-Fi connection drops, it's necessary to reconnect promptly to ensure wireless communication quality. To confirm whether a Wi-Fi connection has been lost, in addition to directly sending heartbeat packets and receiving responses to detect the network connection status, you can also monitor changes in the network status programmatically, such as by relying on the Reachability class to detect the network status and obtain the Wi-Fi connection status.

[0050] For example, when using heartbeats to check if a Wi-Fi connection is broken, if no response is received after three consecutive heartbeats, the Wi-Fi connection status is considered broken. When relying on the Reachability class to detect network status, first call the Reachability class's reachabilityForLocalWiFi or reachabilityForInternetConnection method to obtain a Reachability object, then call the Reachability object's currentReachabilityStatus method to get the network connection status. If the network connection status returns NotReachable, the Wi-Fi connection status is considered broken.

[0051] Step S200: If the Wi-Fi connection status is disconnected, obtain the Wi-Fi network configuration;

[0052] Specifically, public places are ubiquitous with Wi-Fi networks. Whether it's cafes, libraries, train stations, or airports, numerous Wi-Fi signals can be detected in these locations. Among these are Wi-Fi networks that users have previously connected to or whose Wi-Fi connection names and passwords have been configured (i.e., saved Wi-Fi network configurations), as well as unprotected Wi-Fi networks. These unprotected networks could be used by hackers to infiltrate user systems and steal information. Therefore, to ensure system security, when a Wi-Fi connection is disconnected, the system should automatically reconnect to a saved Wi-Fi network configuration.

[0053] For example, when the Wi-Fi connection is disconnected, the system configuration information is checked first to confirm whether there are any saved Wi-Fi network configurations. If a network configuration with the Wi-Fi network name "Coffee01" is detected in the system configuration information, it means that a saved Wi-Fi network configuration exists. If no saved Wi-Fi network name is detected, then no saved Wi-Fi network configuration exists, which means that the user has not saved any trusted Wi-Fi networks.

[0054] Step S300: If the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to the preset scanning cycle rule, and the Wi-Fi network in the environment is scanned according to the scanning time interval to obtain the scanning result;

[0055] Specifically, if the Wi-Fi network configuration is not empty, meaning a saved Wi-Fi network configuration exists, it indicates that the user has already configured a trusted Wi-Fi network. If the trusted Wi-Fi network exists in the environment, a direct reconnection is possible. Each process of exploring whether a trusted Wi-Fi network exists in the environment is called a scan. Scans are performed according to a preset period, i.e., a scan time interval. This yields the scan results, which can be either no saved Wi-Fi network detected or a saved Wi-Fi network detected.

[0056] In one implementation, step S300 of this embodiment includes the following steps:

[0057] Step S301: If the Wi-Fi network configuration is not empty, then obtain the number of scans; wherein, the number of scans starts counting when scanning the Wi-Fi network in the environment begins, and stops counting when a Wi-Fi network connection is established;

[0058] Step S302: Substitute the number of scans into the preset scan cycle rule to obtain the scan time interval;

[0059] Specifically, such as Figure 2 As shown, if the Wi-Fi network configuration is not empty, meaning a saved Wi-Fi network configuration exists, scanning for Wi-Fi networks in the environment can begin to rebuild the Wi-Fi network. Currently, for devices with a saved Wi-Fi network that are disconnected, a fixed time interval is often used for scanning. An excessively long Wi-Fi scanning interval can lead to a longer time to discover nearby connectable Wi-Fi networks, resulting in excessively long Wi-Fi reconnection times. Continuous and rapid Wi-Fi scanning can cause throughput and power consumption issues. In this embodiment, the scanning time interval is preset in the scanning cycle rule and can be dynamically adjusted according to reconnection characteristics. That is, the scanning time interval is obtained based on the number of scans, and the number of scans increases as the scanning progresses. The scan count starts from 1, and increases by 1 for each completed scan until a Wi-Fi network connection is established.

[0060] For example, when a Wi-Fi network connection is detected to be disconnected, and a saved Wi-Fi network configuration is confirmed, the first scan of the network environment for Wi-Fi networks will begin, with the scan count initially being 1. After the first scan is completed, the scan count is incremented by 1. The scan time interval is then calculated based on the obtained scan count of 2. If 5 scans have already been performed, and the current scan count is 5, this scan count of 5 is substituted into a preset scan cycle rule to obtain the scan time interval.

[0061] In one implementation, step S302 of this embodiment includes the following steps:

[0062] Step S3021: When the number of scans is less than or equal to a preset scan number threshold, the preset first time interval is used as the scan time interval;

[0063] Step S3022: When the number of scans is greater than the scan number threshold, the second time interval is used as the scan time interval; wherein, the second time interval is the smaller value between twice the scan time interval obtained in the previous scan and the preset third time interval.

[0064] Specifically, in this embodiment, as Figure 3As shown, in this embodiment, the preset third time interval is 120 seconds, the default value of the scan count threshold is 5 times, and the default value of the first time interval is 3 seconds. When the scan count is less than or equal to 5, the scan time interval is 3 seconds. When the scan count is greater than 5, the scan time interval is the smaller value between twice the scan time interval obtained in the previous scan and 120 seconds. The preset scan cycle rule in this embodiment, that is, the correspondence between the scan time interval and the scan count, can be summarized by the formula:

[0065]

[0066] Among them, t n t is the scan time interval to be set when the number of scans is n-th scan. n-1 This is the scan interval set at the time of the last scan, where n is the number of scans. When the device's Wi-Fi connection is disconnected, the value of n is reset to 0. n The maximum value is the preset third time interval of 120 seconds, that is, when 2t n-1 If the scan interval exceeds 120 seconds, the scan interval will be set to 120 seconds. This ensures that after entering the disconnected state, only the first five scans will be performed continuously and rapidly. After the five scans, the scan interval for the Wi-Fi network will gradually increase, but will not exceed the preset third time interval of 120 seconds.

[0067] For example, when a Wi-Fi network connection is detected to be disconnected, the initial scan count is 0. The first scan will then begin, with a scan count of 1 and a scan interval of 3 seconds. For the second to fifth scans, the scan count will be 2-5, and the corresponding scan interval will still be 3 seconds. For the sixth scan, since the previous scan interval was 3 seconds, the scan interval for the sixth scan will be 2 × 3 = 6 seconds. For the seventh scan, the scan interval will be 6 seconds, so the scan interval for the seventh scan will be 12 seconds, and so on, until the second scan... n-1 If the scan time exceeds 120 seconds, set the scan interval to 120 seconds.

[0068] Step S303: Scan the Wi-Fi network in the environment according to the scanning time interval to obtain the scanning result.

[0069] Specifically, after obtaining the scanning time interval, the system scans the Wi-Fi networks in the environment according to the scanning time interval as a scanning cycle to find Wi-Fi networks that can be reconnected. When a saved Wi-Fi network exists in the environment, the scan result is "saved Wi-Fi network found"; when no saved Wi-Fi network exists in the environment, the scan result is "saved Wi-Fi network not found".

[0070] Step S400: Connect to the Wi-Fi network based on the scan results.

[0071] In one implementation, step S400 of this embodiment includes the following steps:

[0072] Step S401: If the scan result is that no saved Wi-Fi network is found, then the step of obtaining the scan time interval and scanning the Wi-Fi network in the environment according to the scan time interval is executed again to obtain the scan result.

[0073] Step S402: If the scan result indicates that a saved Wi-Fi network has been detected, then establish a Wi-Fi network connection according to the saved Wi-Fi network configuration, and re-execute the step of obtaining the Wi-Fi connection status.

[0074] Specifically, if the scan result indicates that no saved Wi-Fi network was found, it means that there is no Wi-Fi network in the environment that can be reconnected to. In this case, the scan interval needs to be re-acquired, and a new scan needs to be performed until a successful reconnection is achieved. If the scan result indicates that a saved Wi-Fi network was found, it means that a Wi-Fi reconnection request can be initiated. At this time, a Wi-Fi network connection is established based on the saved Wi-Fi network configuration. After the Wi-Fi network connection is successfully established, it is necessary to start monitoring whether the Wi-Fi network connection is disconnected to ensure that the reconnection process can be restarted in a timely manner if communication is interrupted again.

[0075] For example, if the system configuration information contains a Wi-Fi network configuration named Coffee01, but a scan of the environment does not find a Wi-Fi network named Coffee01, the scan result is "no saved Wi-Fi network found." In this case, a new scan is needed, incrementing the scan count by 1 and obtaining a new scan time interval. If a network named Coffee01 is found, a Wi-Fi connection will be requested to be established based on the saved Wi-Fi network configuration. This connection establishment may succeed or fail. If it fails, the step of obtaining the Wi-Fi connection status is repeated. That is, if the connection establishment fails, the Wi-Fi connection status is determined to be disconnected, and the network scan will restart with a scan count of 1 and a scan time interval of 3 seconds. If the connection establishment is successful, the Wi-Fi connection status is connected. In this case, it is only necessary to continue obtaining information on whether the Wi-Fi connection status is disconnected.

[0076] In one implementation, the method described in this embodiment further includes the following steps:

[0077] Step S500: If the Wi-Fi network configuration is empty, then do not scan for Wi-Fi networks in the environment.

[0078] Specifically, if the Wi-Fi network configuration is empty, meaning there is no saved Wi-Fi network configuration, it indicates that the user has not configured a trusted Wi-Fi network. Therefore, even if there are several Wi-Fi networks in the environment, no scan will be performed to ensure privacy and security.

[0079] In one implementation, the method described in this embodiment further includes the following steps:

[0080] Step S600: If the Wi-Fi connection status is connected, then reset the number of scans to zero.

[0081] Specifically, when a Wi-Fi connection is detected as connected, it is only necessary to continuously monitor whether the Wi-Fi network is disconnected, without continuing to scan for Wi-Fi networks in the environment. The presence of a Wi-Fi connection indicates that the previous scan is complete. A new scan only begins when the Wi-Fi connection status changes to disconnected. In this new scan, the scan count is reset. Therefore, in this embodiment, the scan count is reset to zero when the Wi-Fi connection status is connected.

[0082] For example, during the second scan, a Wi-Fi connection is successfully established with the network named Coffee01, and the Wi-Fi connection status is detected as connected. At this point, the scan count of 2 is reset to zero, and the scan count will resume counting at the start of the next scan.

[0083] Exemplary device

[0084] like Figure 4 As shown in the illustration, this embodiment also provides a Wi-Fi automatic reconnection device, the device comprising:

[0085] Connection status acquisition module 10 is used to acquire Wi-Fi connection status;

[0086] The network configuration acquisition module 20 is used to acquire the Wi-Fi network configuration if the Wi-Fi connection status is disconnected.

[0087] The first scanning module 30 is used to dynamically obtain a scanning time interval according to a preset scanning cycle rule if the Wi-Fi network configuration is not empty, and scan the Wi-Fi network in the environment according to the scanning time interval to obtain the scanning result;

[0088] The reconnection module 40 is used to connect to the Wi-Fi network based on the scan results.

[0089] In one implementation, the scanning module 30 includes:

[0090] The scan count acquisition unit is used to acquire the scan count if the Wi-Fi network configuration is not empty; wherein the scan count starts counting when scanning the Wi-Fi network in the environment begins, and stops counting when a Wi-Fi network connection is established;

[0091] A scan time interval acquisition unit is used to substitute the number of scans into the preset scan cycle rule to obtain the scan time interval;

[0092] The scan result acquisition unit is used to scan the Wi-Fi network in the environment according to the scan time interval and obtain the scan result.

[0093] In one implementation, the scanning time interval acquisition unit of this embodiment includes:

[0094] The first scan time interval acquisition subunit is used to use the preset first time interval as the scan time interval when the number of scans is less than or equal to a preset scan number threshold.

[0095] The second scan time interval acquisition subunit is used to use the second time interval as the scan time interval when the number of scans is greater than the scan number threshold; wherein, the second time interval is the smaller value between twice the scan time interval obtained in the previous scan and a preset third time interval.

[0096] In one implementation, the reconnection module 40 of this embodiment includes:

[0097] The first reconnection unit is used to re-execute the steps of obtaining the scanning time interval and scanning the Wi-Fi network in the environment according to the scanning time interval to obtain the scanning result if the scanning result is that no saved Wi-Fi network is scanned.

[0098] The second reconnection unit is used to establish a Wi-Fi network connection according to the configuration of the saved Wi-Fi network if the scan result is that a saved Wi-Fi network has been scanned, and to re-execute the step of obtaining the Wi-Fi connection status.

[0099] In one implementation, the Wi-Fi automatic reconnection device described in this embodiment further includes:

[0100] The second scanning unit is configured not to scan for Wi-Fi networks in the environment if the Wi-Fi network configuration is empty.

[0101] In one implementation, the Wi-Fi automatic reconnection device described in this embodiment further includes:

[0102] The scan count reset unit is used to reset the scan count to zero if the Wi-Fi connection status is connected.

[0103] Based on the above embodiments, the present invention also provides a smart terminal, the principle block diagram of which can be as follows: Figure 5 As shown, the smart terminal includes a processor, memory, network interface, display screen, and temperature sensor connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a Wi-Fi automatic reconnection method. The display screen can be an LCD screen or an e-ink screen. The temperature sensor is pre-installed inside the smart terminal to detect the operating temperature of internal devices.

[0104] Those skilled in the art will understand that Figure 5 The block diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the smart terminal to which the present invention is applied. A specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0105] In one embodiment, a smart terminal is provided, the smart terminal including a memory, a processor, and a Wi-Fi automatic reconnection program stored in the memory and executable on the processor. When the processor executes the Wi-Fi automatic reconnection program, it implements the following operation instructions:

[0106] Get Wi-Fi connection status;

[0107] If the Wi-Fi connection status is disconnected, then obtain the Wi-Fi network configuration;

[0108] If the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to the preset scanning cycle rules, and the Wi-Fi network in the environment is scanned according to the scanning time interval to obtain the scanning result;

[0109] Connect to a Wi-Fi network based on the scan results.

[0110] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, operational databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual operating data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0111] In summary, this invention discloses a method, apparatus, smart terminal, and storage medium for automatic Wi-Fi reconnection. The method includes: acquiring the Wi-Fi connection status; if the Wi-Fi connection status is disconnected, acquiring the Wi-Fi network configuration; if the Wi-Fi network configuration is not empty, dynamically acquiring a scanning time interval according to a preset scanning cycle rule, and scanning the Wi-Fi networks in the environment according to the scanning time interval to obtain the scanning result; and connecting to the Wi-Fi network according to the scanning result. This invention can dynamically adjust the scanning cycle according to changes in the Wi-Fi connection status, which can both shorten the Wi-Fi reconnection time and reasonably configure power consumption.

[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for automatic Wi-Fi reconnection, characterized in that, The method includes: Get Wi-Fi connection status; If the Wi-Fi connection status is disconnected, then obtain the Wi-Fi network configuration; If the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to the preset scanning cycle rules, and the Wi-Fi network in the environment is scanned according to the scanning time interval to obtain the scanning result; Connect to the Wi-Fi network based on the scan results; If the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to a preset scanning cycle rule, including: If the Wi-Fi network configuration is not empty, then the number of scans is obtained; wherein, the number of scans starts counting when scanning the Wi-Fi network in the environment begins, and stops counting when a Wi-Fi network connection is established; Substituting the number of scans into the preset scan cycle rule, the scan time interval is obtained, including: When the number of scans is less than or equal to a preset scan number threshold, the preset first time interval is used as the scan time interval; When the number of scans exceeds the scan number threshold, the second time interval is used as the scan time interval; wherein, the second time interval is the smaller value between twice the scan time interval obtained in the previous scan and a preset third time interval; The third time interval is 120 seconds.

2. The Wi-Fi automatic reconnection method according to claim 1, characterized in that, The step of connecting to the Wi-Fi network based on the scan results includes: If the scan result indicates that no saved Wi-Fi network has been detected, the steps of obtaining the scan time interval and scanning the Wi-Fi network in the environment according to the scan time interval are repeated to obtain the scan result. If the scan result indicates that a saved Wi-Fi network has been detected, a Wi-Fi network connection is established according to the saved Wi-Fi network configuration, and the step of obtaining the Wi-Fi connection status is re-executed.

3. The Wi-Fi automatic reconnection method according to claim 1, characterized in that, The method further includes: If the Wi-Fi network configuration is empty, no Wi-Fi networks in the environment will be scanned.

4. The Wi-Fi automatic reconnection method according to claim 1, characterized in that, The method further includes: If the Wi-Fi connection status is "connected", then the number of scans is reset to zero.

5. A Wi-Fi automatic reconnection device, characterized in that, The device includes: The connection status acquisition module is used to acquire the Wi-Fi connection status; The network configuration acquisition module is used to acquire the Wi-Fi network configuration if the Wi-Fi connection status is disconnected. The scanning module is used to dynamically obtain the scanning time interval according to the preset scanning cycle rule if the Wi-Fi network configuration is not empty, and scan the Wi-Fi network in the environment according to the scanning time interval to obtain the scanning result; If the Wi-Fi network configuration is not empty, the scanning time interval is dynamically obtained according to a preset scanning cycle rule, including: If the Wi-Fi network configuration is not empty, then the number of scans is obtained; wherein, the number of scans starts counting when scanning the Wi-Fi network in the environment begins, and stops counting when a Wi-Fi network connection is established; Substituting the number of scans into the preset scan cycle rule, the scan time interval is obtained, including: When the number of scans is less than or equal to a preset scan number threshold, the preset first time interval is used as the scan time interval; When the number of scans exceeds the scan number threshold, the second time interval is used as the scan time interval; wherein, the second time interval is the smaller value between twice the scan time interval obtained in the previous scan and a preset third time interval; The third time interval is 120 seconds; A reconnection module is used to connect to a Wi-Fi network based on the scan results.

6. A smart terminal, characterized in that, The smart terminal includes a memory, a processor, and a Wi-Fi automatic reconnection program stored in the memory and executable on the processor. When the processor executes the Wi-Fi automatic reconnection program, it implements the steps of the Wi-Fi automatic reconnection method as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a Wi-Fi automatic reconnection program, which, when executed by a processor, implements the steps of the Wi-Fi automatic reconnection method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Intelligent wifi networking method and mobile terminal

    CN107360599A

  • Scanning period adjusting method and device

    CN109362120A