Wireless fidelity scanning method and apparatus, and device and storage medium
By constructing matching identification information and calculating similarity, WIFI scan is performed only when the similarity reaches the threshold, the power consumption problem in electronic devices is solved and scanning efficiency and hit rate is improved.
Patent Information
- Application Number
- PCT/CN2024/115093
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-29
- Filing Date
- 2024-08-28
- Publication Date
- 2025-09-04
AI Technical Summary
In electronic devices, with the increase in wireless network functions, power consumption problems have become an urgent challenge, especially how to reduce power consumption under multiple network functions.
By constructing matching identification information, using historical network-based cell and neighboring network cell identification, the similarity between the target information and the matching identification information is calculated, and only WIFI scans are performed when the similarity reaches the preset threshold to avoid unnecessary scanning.
It effectively reduces the power consumption of WIFI scan, improves the scan hit rate, and avoids scanning failure caused by base station failure. It is suitable for a variety of terminal devices.
Smart Images

Figure CN2024115093_04092025_PF_FP_ABST
Abstract
Description
Wireless network scanning method, device, equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 29, 2024, with application number 202410231675.0 and application name “A wireless network scanning method, device, equipment and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present invention relates to the field of terminal technology, and in particular to a wireless network scanning method, device, equipment and storage medium. Background Art
[0003] Electronic devices have both wireless network (Wi-Fi) and mobile network functions. For example, wearable devices support both Wi-Fi and 4G or 5G networks. As the functions of terminal devices increase, power consumption increases accordingly. How to reduce power consumption while ensuring multiple functions in electronic devices is an unresolved problem.
[0004] Summary of the Invention
[0005] The purpose of the present invention is to provide a wireless network scanning method, device, equipment and storage medium to solve the technical problems in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a wireless network scanning method, applied to a terminal device, the method comprising:
[0007] Obtain first target information; the first target information includes: a resident cell identifier and a neighboring cell identifier, the resident cell identifier is the cell identifier of the resident cell to which the electronic device is connected, and the neighboring cell identifier is the cell identifier of a neighboring cell corresponding to the resident cell; determine whether to perform a WIFI scan based on the similarity between the first target information and the matching identifier information; wherein the matching identifier information includes: a historical resident cell identifier and a historical neighboring cell identifier; the historical resident cell identifier is the cell identifier of the resident cell to which the electronic device has been connected, and the historical neighboring cell identifier is the cell identifier of a neighboring cell corresponding to the resident cell to which the electronic device has been connected.
[0008] In the present application, WIFI scanning is performed when the similarity between the first target information and the matching identification information is greater than or equal to a preset similarity threshold, and WIFI scanning is not performed when the similarity between the first target information and the matching identification information is less than the preset similarity threshold, thereby saving power consumption caused by unnecessary WIFI scanning.
[0009] In some possible embodiments, obtaining the first target information includes: obtaining the first target information in response to detecting that the first cycle has been reached; or, obtaining the first target information in response to detecting that the screen-off duration has reached the second cycle; or, obtaining the first target information in response to detecting that the screen-on duration has reached the third cycle; or, obtaining the first target information in response to detecting that the electronic device changes from screen-off to screen-on; or, obtaining the first target information in response to detecting that the track fence function is turned off; or, obtaining the first target information in response to detecting that the electronic device is restarted; or, obtaining the first target information in response to detecting that a wake-up event has occurred in the electronic device.
[0010] In the present application, different methods for obtaining the first target information are set up, so that the wireless network scanning method of the present application can cover most scenarios with wireless network scanning requirements, making the present application more universal.
[0011] In some possible embodiments, before obtaining the first target information, the method further includes: determining that a distance between the electronic device's location and a first location is greater than a preset distance, where the first location is the location of the electronic device during a previous WIFI scan.
[0012] In this application, by comparing the positions of two WIFI scans, the power consumption of the WIFI scan when the electronic device is out of the WIFI range is avoided.
[0013] In some possible embodiments, after detecting a wake-up event on the electronic device and before obtaining the first target information, it also includes: determining that the time interval between the time when the wake-up event occurs and the first wake-up time is greater than a preset time interval, and the first wake-up time is the time when the last wake-up event occurred on the electronic device.
[0014] In the present application, by detecting the time interval between two wake-ups, the power consumption wasted by frequently performing WIFI scans in the case of frequent wake-ups is avoided.
[0015] In some possible embodiments, obtaining the first target information includes: obtaining the first target information in response to a user operation of switching the screen from off to on.
[0016] In the present application, the first target information is obtained when the screen is turned on by the user, thereby avoiding the power consumption of performing WIFI scanning when the user has no WIFI connection requirement.
[0017] In some possible embodiments, the similarity between the first target information and the matching identification information is determined according to the following method: if the matching identification information includes the on-network cell identifier in the first target information, the similarity is determined to be a first preset value; if the matching identification information does not include the on-network cell identifier in the first target information, the similarity is determined to be a second preset value; wherein the first preset value is greater than a preset similarity threshold, and the second preset value is less than the preset similarity threshold.
[0018] In the present application, when the resident cell identifier in the first target information is detected in the matching identifier information, it is determined that the similarity between the first target information and the matching identifier information is greater than a preset similarity threshold. This method is simple to calculate and easy to implement.
[0019] In some possible embodiments, the similarity between the first target information and the matching identification information is determined according to the following method: if the matching identification information includes any one of the on-network cell identification or the neighboring cell identification in the first target information, the similarity is determined to be a first preset value; if the matching identification information does not include the on-network cell identification and the neighboring cell identification in the first target information, the similarity is determined to be a second preset value; wherein the first preset value is greater than a preset similarity threshold, and the second preset value is less than the preset similarity threshold.
[0020] In the present application, if the resident cellid in the first target information is detected in the resident cellid of the matching identification information, or any one of the neighboring cellids in the first target information is detected in the neighboring cellid of the matching identification information, then it is determined that the similarity between the first target information and the matching identification information is greater than the preset similarity threshold. This method is simple to calculate and easy to implement.
[0021] In some possible embodiments, the similarity between the first target information and the matching identification information is determined according to the following method: retrieving a target entry in the matching identification information based on the resident cell identification; the matching identification information contains at least one entry, each entry includes the resident cell identification and at least one neighboring cell identification; determining the number of identical cell identifications in the first target information and the target entry; determining the total number of cell identifications in the first target information and the target entry; and using the ratio of the number of identical cell identifications to the total number as the similarity.
[0022] In the present application, the similarity can be determined by counting the number of identical cell identifiers, and the similarity determined by this method is more accurate.
[0023] In some possible embodiments, after determining whether to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, the method further includes: when determining to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, determining target Wi-Fi information corresponding to the first target information in the matching identification information; and connecting to the Wi-Fi corresponding to the target Wi-Fi information.
[0024] In the present application, when connecting to WIFI, the WIFI can be scanned in a targeted manner according to the target WIFI information, thereby further reducing the power consumption during the WIFI scanning process.
[0025] In some possible embodiments, before determining to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, the method further includes: obtaining the number of scans that have been performed for the Wi-Fi scan; and obtaining a scan duration; obtaining a current time and a time when the Wi-Fi scan was last performed; determining a first duration based on the current time and the time when the Wi-Fi scan was last performed; and determining that the first duration is not less than the scan duration.
[0026] In this application, in order to avoid frequent WIFI scanning, it is necessary to determine the time between two WIFI scans before performing a WIFI scan, and the WIFI scan will be performed only when the time meets the condition.
[0027] In some possible embodiments, after determining that the first duration is not less than the scanning duration, the method further includes: updating the number of scans.
[0028] In this application, after a successful WIFI scan, in order to ensure that the next time the process is executed, the scan count can be obtained accurately, so the scan count needs to be updated.
[0029] In some possible embodiments, obtaining the scanning duration includes: obtaining a preset scanning duration; or obtaining a scanning duration determined according to the number of scans.
[0030] The scanning duration in this application can be set to a fixed value or a function associated with the number of scans, making the WIFI scanning method provided in this application more universal.
[0031] In some possible embodiments, the method further includes: if the first target information is not acquired, performing a WIFI scan.
[0032] In the present application, WIFI scanning is also performed when the first target information is not obtained, which further ensures that the WIFI can be connected in time.
[0033] In some possible embodiments, the method further includes: when the electronic device is in a WIFI connection state, obtaining second target information; the second target information includes: a resident cell identifier and a neighboring cell identifier, the resident cell identifier is the cell identifier of the resident cell to which the electronic device is connected, and the neighboring cell identifier is the cell identifier of the neighboring cell corresponding to the resident cell; and updating the matching identification information based on the second target information.
[0034] In this application, in order to ensure the accuracy and timeliness of the matching identification information, the matching identification information will be updated according to the acquired second target information. This application updates the matching identification information when in the WIFI connection state, further reducing the consumption of mobile network resources.
[0035] In some possible embodiments, before updating the matching identification information based on the second target information, the method further includes: determining whether the on-network cell identification in the matching identification information exists with the on-network cell identification in the second target information; updating the matching identification information based on the second target information includes: if not, updating the matching identification information based on the second target information.
[0036] In the present application, duplicate entries in the matching identification information are avoided by comparing the identification information of the resident cells, thereby reducing the memory usage of the electronic device.
[0037] In some possible embodiments, the method further includes: if present, determining whether the neighboring cell identifier in the second target information is included in the neighboring cell identifier corresponding to the target row; the target row is the row in the matching identifier information that is identical to the resident cell identifier in the second target information; if not, updating the matching identifier information in the second target information, or updating the matching identifier information based on the target neighboring cell identifier; the target neighboring cell identifier is the neighboring cell identifier in the second target information that is not included in the neighboring cell identifier corresponding to the target row.
[0038] In the present application, when the resident cell identifiers are the same, by further comparing the neighboring cell identifiers, duplicate entries in the matching identifier information are further avoided, thereby reducing the memory usage of the electronic device.
[0039] In some possible embodiments, updating the matching identification information based on the target neighboring cell identifier includes: adding the target neighboring cell identifier to the neighboring cell identifier corresponding to the target row.
[0040] In the present application, by adding the target neighboring cell identifier to the neighboring cell identifier corresponding to the target row, it is no longer necessary to match the newly added entry in the identifier information, thereby reducing memory usage.
[0041] In some possible embodiments, the method further includes: if yes, determining whether the WIFI information corresponding to the resident cell identifier in the WIFI information in the matching identification information is the same as the acquired WIFI information; if different, updating the matching identification information based on the second target information.
[0042] In this application, in order to ensure the accuracy of the matching identification information, the matching identification information needs to be updated when the WIFI information is different.
[0043] In some possible embodiments, the method further includes: if the times are the same, obtaining the current time, and using the current time to update the latest valid time corresponding to the resident cell identifier stored in the matching identification information.
[0044] In this application, the matching identification information is made more timely by updating the most recent valid time.
[0045] In some possible embodiments, updating the matching identification information based on the second target information includes: constructing a target entry based on the second target information; and inserting the target entry into the matching identification information.
[0046] In the present application, the matching identification information is updated by inserting entries, making the matching identification information more comprehensive.
[0047] In some possible embodiments, the matching identification information includes at least one entry, each entry includes the most recent valid time, and the method further includes: obtaining the current time and obtaining each most recent valid time in the matching identification information; determining the time difference between each most recent valid time and the current time; and removing the entries corresponding to the most recent valid time whose time difference is greater than a preset time difference value from the matching identification information.
[0048] In this application, memory usage is reduced by removing entries that have not been used for a long time.
[0049] In some possible embodiments, if it is determined that the electronic device is in a WIFI connection state, after detecting the first target event, the method further includes: if the second target information is not obtained, updating the matching identification information based on the preset target information and the obtained WIFI information.
[0050] In the present application, when the second target information is not obtained, the matching identification information is updated by presetting the target information, so that the matching identification information is more comprehensive.
[0051] In a second aspect, an embodiment of the present application further provides a wireless network scanning device, which is applied to an electronic device, and the device includes:
[0052] A first target information acquisition module is configured to acquire first target information; the first target information includes: a station cell identifier and a neighboring cell identifier, wherein the station cell identifier is a cell identifier of a station cell to which the electronic device is connected, and the neighboring cell identifier is a cell identifier of a neighboring cell corresponding to the station cell;
[0053] A scanning module is configured to determine whether to perform a Wi-Fi scan based on a similarity between the first target information and the matching identification information; wherein the matching identification information includes: a historical on-network cell identification and a historical neighboring cell identification; the historical on-network cell identification is a cell identification of an on-network cell to which the electronic device has been connected, and the historical neighboring cell identification is a cell identification of a neighboring cell corresponding to the on-network cell to which the electronic device has been connected.
[0054] In some possible embodiments, the first target information acquisition module is specifically used to: acquire the first target information in response to detecting that the first cycle has been reached; or, acquire the first target information in response to detecting that the screen-off duration has reached the second cycle; or, acquire the first target information in response to detecting that the screen-on duration has reached the third cycle; or, acquire the first target information in response to detecting that the electronic device changes from screen-off to screen-on; or, acquire the first target information in response to detecting that the track fence function is turned off; or, acquire the first target information in response to detecting that the electronic device is restarted; or, acquire the first target information in response to detecting that a wake-up event has occurred in the electronic device.
[0055] In some possible embodiments, before the first target information acquisition module acquires the first target information, it is further used to: determine that the distance between the electronic device's location and the first location is greater than a preset distance, and the first location is the location of the electronic device during the previous WIFI scan.
[0056] In some possible embodiments, after the first target information acquisition module detects a wake-up event on the electronic device, it is also used to: determine that the time interval between the time when the wake-up event occurs and the first wake-up time is greater than a preset time interval, and the first wake-up time is the time when the last wake-up event occurred on the electronic device.
[0057] In some possible embodiments, the first target information acquisition module is specifically used to: acquire the first target information in response to a user operation switching the screen from off to on.
[0058] In some possible embodiments, the scanning module is specifically used to: if the matching identification information includes the on-network cell identifier in the first target information, determine the similarity as a first preset value; if the matching identification information does not include the on-network cell identifier in the first target information, determine the similarity as a second preset value; wherein the first preset value is greater than a preset similarity threshold, and the second preset value is less than the preset similarity threshold.
[0059] In some possible embodiments, the scanning module is specifically used to: if the matching identification information includes any one of the resident cell identification or the neighboring cell identification in the first target information, determine the similarity as a first preset value; if the matching identification information does not include the resident cell identification and the neighboring cell identification in the first target information, determine the similarity as a second preset value; wherein the first preset value is greater than a preset similarity threshold, and the second preset value is less than the preset similarity threshold.
[0060] In some possible embodiments, the scanning module is specifically used to: retrieve a target entry in the matching identification information based on the resident cell identifier; the matching identification information contains at least one entry, each entry includes the resident cell identifier and at least one neighboring cell identifier; determine the number of identical cell identifiers in the first target information and the target entry; determine the total number of cell identifiers in the first target information and the target entry; and use the ratio of the number of identical cell identifiers to the total number as the similarity.
[0061] In some possible embodiments, after determining whether to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, the scanning module is further configured to: when determining to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, determine the target Wi-Fi information corresponding to the first target information in the matching identification information; and connect to the Wi-Fi corresponding to the target Wi-Fi information.
[0062] In some possible embodiments, before determining to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, the scanning module is further used to: obtain the number of scans that have been performed for the Wi-Fi scan; and obtain the scan duration; obtain the current time and the time of the last Wi-Fi scan; determine a first duration based on the current time and the time of the last Wi-Fi scan; and determine that the first duration is not less than the scan duration.
[0063] In some possible embodiments, after the scanning module determines that the first duration is not less than the scanning duration, it is further configured to: update the number of scans.
[0064] In some possible embodiments, the scanning module is specifically used to: obtain a preset scanning duration; or obtain a scanning duration determined according to the number of scans.
[0065] In some possible embodiments, the scanning module is further configured to: perform a WIFI scan if the first target information is not acquired.
[0066] In some possible embodiments, the scanning module is further used to: obtain second target information when the electronic device is in a WIFI connection state; the second target information includes: a resident cell identifier and a neighboring cell identifier, the resident cell identifier is the cell identifier of the resident cell to which the electronic device is connected, and the neighboring cell identifier is the cell identifier of the neighboring cell corresponding to the resident cell; and update the matching identification information based on the second target information.
[0067] In some possible embodiments, before the scanning module updates the matching identification information based on the second target information, it is also used to: determine whether the resident cell identifier in the matching identification information exists with the resident cell identifier in the second target information; and update the matching identification information based on the second target information, including: if not, updating the matching identification information based on the second target information.
[0068] In some possible embodiments, the scanning module is also used to: if present, determine whether the neighboring cell identifier in the second target information is included in the neighboring cell identifier corresponding to the target row; the target row is the row in the matching identifier information that is the same as the resident cell identifier in the second target information; if not, update the matching identifier information in the second target information, or update the matching identifier information based on the target neighboring cell identifier; the target neighboring cell identifier is the neighboring cell identifier in the second target information that is not included in the neighboring cell identifier corresponding to the target row.
[0069] In some possible embodiments, the scanning module updates the matching identification information based on the target neighboring cell identifier, specifically for: if yes, determining whether the WIFI information corresponding to the resident cell identifier in the WIFI information in the matching identification information is the same as the acquired WIFI information; if different, updating the matching identification information based on the second target information.
[0070] In some possible embodiments, the scanning module is further configured to: if the time is the same, obtain the current time, and use the current time to update the latest valid time corresponding to the resident cell identifier stored in the matching identification information.
[0071] In some possible embodiments, the scanning module is specifically configured to: construct a target entry based on the second target information; and insert the target entry into the matching identification information.
[0072] In some possible embodiments, the matching identification information includes at least one entry, each entry includes the most recent valid time, and the scanning module is further used to: obtain the current time and obtain each most recent valid time in the matching identification information; determine the time difference between each most recent valid time and the current time; and remove the entries corresponding to the most recent valid time whose time difference is greater than a preset time difference value from the matching identification information.
[0073] In some possible embodiments, if it is determined that the electronic device is in a WIFI connection state, the scanning module is further used, after detecting the first target event, to update the matching identification information based on the preset target information and the acquired WIFI information if the second target information is not acquired.
[0074] In the third aspect, another embodiment of the present application also provides an electronic device, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods provided in the embodiment of the first aspect of the present application.
[0075] In a fourth aspect, another embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute any method provided in the embodiment of the first aspect of the present application.
[0076] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] FIG1 is a schematic diagram of a wireless network scanning method according to an embodiment of the present application, in which matching identification information including a resident network cell ID and a neighboring network cell ID is stored in the form of an information table;
[0078] FIG2 is a schematic diagram of a wireless network scanning method according to an embodiment of the present application, in which matching identification information including a resident network cell ID, a neighboring network cell ID, and a most recent valid time is stored in the form of an information table;
[0079] FIG3 is a schematic diagram of a wireless network scanning method according to an embodiment of the present application, in which matching identification information including a resident network cell ID, a neighboring network cell ID, and WIFI information is stored in the form of an information table;
[0080] FIG4 is a schematic diagram of a wireless network scanning method according to an embodiment of the present application, in which matching identification information including a resident network cell ID, a neighboring network cell ID, a most recent valid time, and WIFI information is stored in the form of an information table;
[0081] FIG5 is a schematic diagram of target entries of a wireless network scanning method provided by an embodiment of the present application;
[0082] FIG6 is a schematic diagram showing information after the target entry shown in FIG5 is updated according to a wireless network scanning method provided by an embodiment of the present application;
[0083] FIG7 is another schematic diagram of target entries of a wireless network scanning method provided by an embodiment of the present application;
[0084] FIG8 is a schematic diagram showing information after the target entry shown in FIG7 is updated according to a wireless network scanning method provided by an embodiment of the present application;
[0085] FIG9 is a schematic diagram of information after the information table shown in FIG8 is updated according to a wireless network scanning method provided by an embodiment of the present application;
[0086] FIG10 is another schematic diagram of target entries of a wireless network scanning method provided by an embodiment of the present application;
[0087] FIG11 is a schematic diagram of information after the information table shown in FIG2 is updated according to the target entry shown in FIG10 in a wireless network scanning method provided by an embodiment of the present application;
[0088] FIG12 is a schematic diagram of target entries constructed based on a resident network cell ID, a neighboring network cell ID, and the current time according to a wireless network scanning method provided in an embodiment of the present application;
[0089] 13 is a schematic diagram of an information table after the information table shown in FIG. 10 is updated according to the target entry shown in FIG. 12 in a wireless network scanning method according to an embodiment of the present application;
[0090] FIG14 is a schematic diagram showing information after the information table shown in FIG13 is updated according to a wireless network scanning method provided in an embodiment of the present application;
[0091] FIG15 is another schematic diagram of an information table after the information table shown in FIG13 is updated according to a wireless network scanning method provided in an embodiment of the present application;
[0092] FIG16 is a schematic diagram of target entries constructed based on a resident cell ID, a neighboring cell ID, and WIFI information in a wireless network scanning method provided in an embodiment of the present application;
[0093] FIG17 is a schematic diagram of an information table after the information table shown in FIG3 is updated according to the target entry shown in FIG16 in a wireless network scanning method provided by an embodiment of the present application;
[0094] FIG18 is a schematic diagram of an information table after the information table shown in FIG17 is updated according to a wireless network scanning method provided in an embodiment of the present application;
[0095] FIG19 is a schematic diagram of an information table stored in an electronic device of a wireless network scanning method provided by an embodiment of the present application;
[0096] FIG20 is a schematic diagram of an information table after the information table shown in FIG19 is updated according to a wireless network scanning method provided in an embodiment of the present application;
[0097] FIG21 is another schematic diagram of an information table after the information table shown in FIG19 is updated according to a wireless network scanning method provided in an embodiment of the present application;
[0098] FIG22 is a schematic diagram of target entries of a wireless network scanning method provided by an embodiment of the present application;
[0099] FIG23 is a schematic diagram of an information table after the information table shown in FIG19 is updated according to the target entry shown in FIG24 in a wireless network scanning method provided by an embodiment of the present application;
[0100] FIG24 is another schematic diagram of target entries of a wireless network scanning method provided by an embodiment of the present application;
[0101] FIG25A is a schematic diagram of an information table after the information table shown in FIG19 is updated based on the target entry shown in FIG21 according to a wireless network scanning method provided by an embodiment of the present application;
[0102] FIG25B is a schematic diagram of an information table after updating the WIFI information and the most recent valid time in the information table shown in FIG19 according to a wireless network scanning method provided in an embodiment of the present application;
[0103] FIG26 is a schematic diagram of an information table after removing entries from the information table shown in FIG25 according to a wireless network scanning method provided by an embodiment of the present application;
[0104] FIG27 is a schematic diagram of target entries generated according to preset identification information in a wireless network scanning method provided by an embodiment of the present application;
[0105] FIG28 is a schematic diagram of an information table after the information table shown in FIG19 is updated according to the target entry shown in FIG27 in a wireless network scanning method provided by an embodiment of the present application;
[0106] FIG29 is a schematic diagram of the overall flow of a wireless network scanning method provided in an embodiment of the present application;
[0107] FIG30 is a schematic diagram of a process for calculating similarity in a wireless network scanning method provided in an embodiment of the present application;
[0108] FIG31 is a flow chart of determining whether to perform a WIFI scan in a wireless network scanning method provided in an embodiment of the present application;
[0109] FIG32 is a schematic diagram of an information table of a wireless network scanning method provided in an embodiment of the present application;
[0110] FIG33 is a schematic diagram of a device for a wireless network scanning method provided in an embodiment of the present application;
[0111] FIG34 is a schematic diagram of an electronic device for a wireless network scanning method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0112] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limiting the present invention.
[0113] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0114] It should be clear that the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0115] The terms used in the embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. The singular forms "a", "an", "the" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.
[0116] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the associated objects.
[0117] Currently, many electronic devices provide WIFI and mobile network functions. The WIFI function is a way to wirelessly connect to terminal devices that can access the Internet (for example, routers, electronic devices with hotspots turned on) to achieve Internet access through the terminal devices; the mobile network function is a way for electronic devices to use wireless communication technologies such as 4G or 5G to connect to public networks to achieve Internet access.
[0118] When the WIFI function of the electronic device is turned on, the electronic device can scan WIFI to connect to the network.
[0119] In one example, the electronic device can use a periodic scanning method, for example, scanning with a period of 60s / 120s / 180s / 240s / 300 seconds when the screen is off, or scanning with a period of 10s / 10s / 10s / 30s / 30s / 30s / 60s when the screen is on. However, if the user is not within the coverage range of the Wi-Fi hotspot, the scanning hit rate will be greatly reduced, affecting performance, and also generating excessive Wi-Fi scanning power consumption.
[0120] In order to balance the hit rate of WIFI scanning connection and save power consumption, in other instances, the idea of controlling WIFI scanning by cell ID (cellid) is introduced, that is, obtaining the current resident cell ID (cellid) of the terminal device, determining whether the obtained resident cell ID is consistent with the registered cell ID, and performing WIFI scanning if they are consistent. However, this method still has the problem of untimely scanning. For example: the cell ID registered by the user is cellidA. Due to various reasons, the user cannot obtain cellidA at this time (for example, the cellidA base station is broken), but obtains cellidB. Since the user has not registered for cellidB, the WIFI scanning operation cannot be triggered based on cellidB; or, the cell ID registered by the user is cellidA, and the resident cellid obtained at this time is cellidB, but the user has not registered for cellidB before, then the WIFI scanning operation cannot be triggered based on cellidB.
[0121] To this end, embodiments of the present application provide a wireless network scanning method, apparatus, device, and storage medium, which can reduce the power consumption of WIFI scanning while improving the WIFI scanning hit rate.
[0122] The wireless network scanning method of an embodiment of the present application may include: pre-building matching identification information based on information such as the terminal device's historical resident cell identification and historical neighboring cell identification; the terminal device determining the similarity between the above identification and the matching identification information based on the real-time resident cell identification and neighboring cell identification; and determining whether to perform a Wi-Fi scan based on the similarity. In the present application, a Wi-Fi scan is performed when the similarity between the first target information and the matching identification information is greater than or equal to a preset similarity threshold; and a Wi-Fi scan is not performed when the similarity between the first target information and the matching identification information is less than the preset similarity threshold, thereby saving power consumption generated by unnecessary Wi-Fi scanning.
[0123] In the present application, the first target information is composed of the resident cell ID and the neighboring cell ID, thereby avoiding the problem of being unable to perform WIFI scanning when a single base station fails.
[0124] The wireless network scanning method provided in the present application is applicable to various terminal devices, such as but not limited to computers, laptops, smart phones, tablets, smart watches, smart bracelets, vehicle-mounted terminals and other electronic devices with wireless network scanning requirements.
[0125] For ease of understanding, a wireless network scanning method provided by an embodiment of the present application is described in detail below with reference to the accompanying drawings:
[0126] In an embodiment of the present application, in order to improve the power consumption of WIFI scanning and reduce the consumption of network resources caused by frequent WIFI scanning, matching identification information is constructed, and WIFI scanning is performed only when the similarity between the acquired first target information and the matching identification information is greater than or equal to a preset similarity threshold.
[0127] In some embodiments, the matching identification information may include: a historical resident cell identification and a historical neighboring cell identification. The historical resident cell identification is a cell identification of a resident cell that the electronic device has previously used (or connected to), and the historical neighboring cell identification is a cell identification of a neighboring cell corresponding to the resident cell that the electronic device has previously used.
[0128] In some possible implementations, the matching identification information may be stored in the electronic device in the form of an information table. For example, as shown in FIG1 , the table may include a resident cell ID column and a neighboring cell ID column, wherein the resident cell ID column stores the resident cell ID corresponding to the electronic device, and the neighboring cell ID column stores the neighboring cell ID corresponding to the resident cell ID of the electronic device.
[0129] In other embodiments, the matching identification information may further include: WIFI information and / or the most recent valid time, wherein the WIFI information may be used to implement targeted scanning, and the most recent valid time may be used to record the time when the WIFI was last used.
[0130] When the matching identification information is stored in the form of an information table, the information table may further include a WIFI information column and / or a latest valid time column for storing the latest valid time, such as shown in FIG. 2 , FIG. 3 and FIG. 4 .
[0131] It should be noted that the Wi-Fi information in the information table can be a Wi-Fi name, a binary representation of a Wi-Fi (Basic Service Set Identity Document, BSSID), or other information that can represent a Wi-Fi. Since Wi-Fi names may be repeated, and Wi-Fi BSSIDs are unique, in specific implementations, BSSIDs can be used as Wi-Fi information. It should be noted that this application does not limit the specific type of Wi-Fi information, and the selection can be based on implementation circumstances.
[0132] In order to ensure the accuracy of determining whether a Wi-Fi scan is required based on the matching identification information, the electronic device can update the matching identification information while using the Wi-Fi function. In some embodiments, in order to save network resources consumed during the matching identification information update process, the matching identification information update can be triggered in the Wi-Fi connection state.
[0133] In some possible embodiments, when the matching identification information stored in the electronic device is updated, the update may be performed periodically, in an event-triggered manner, or in a combination of the two.
[0134] When periodically updating the matching identification information, the electronic device may have a preset update period. When the electronic device determines based on the update period that an update time has arrived, the electronic device triggers an update of the matching identification information. For example, if the electronic device's update period is 10 minutes and the matching identification information was last updated at 12:10, and the time is now determined to be 12:20, then the electronic device is determined to have reached the update time.
[0135] When updating the matching identification information in an event-triggered manner, the event that triggers the updating of the matching identification information may include at least one of the following: a WIFI connection event, a screen-on event, a wake-up event, and a cell identification change event.
[0136] The WIFI connection event refers to an operation of performing a WIFI connection. It can be understood that the WIFI connection event can be triggered by an electronic device or manually triggered by a user.
[0137] A screen-on event refers to the screen turning on from off to on in an electronic device. A screen-on event can be triggered manually by the user, or it can be triggered by the electronic device when a message or notification is received. This application does not limit the triggering method of the screen-on event.
[0138] A wake-up event refers to an electronic device entering a high-power state from a low-power state.
[0139] A cell identification change event refers to a change in the resident cellid and / or neighboring cellid of the electronic device. For example, at 8:00, the resident cellid is determined to be cellidA and the neighboring cellid is cellidB. If the resident cellid changes at 8:05, for example, the resident cellid is cellidC and the neighboring cellid is cellidB, then it is determined that a cell identification change event has been received; or, at 8:00, the resident cellid is determined to be cellidA and the neighboring cellid is cellidB. If the neighboring cellid changes at 8:05, for example, the resident cellid is cellidA and the neighboring cellids are cellidB and cellidC, then it is determined that a cell identification change event has been received; or, at 8:00, the resident cellid is determined to be cellidA and the neighboring cellid is cellidB. If the neighboring cellid changes at 8:05, for example, the resident cellid is cellidC and the neighboring cellids are cellidB and cellidD, then it is determined that a cell identification change event has been received. It should be noted that, when there are multiple neighboring network cellIDs, the change in the neighboring network cellIDs may be a change in some of the neighboring network cellIDs or a change in all of the neighboring network cellIDs, and this embodiment of the present application does not limit this.
[0140] The following takes the example where the matching identification information includes the resident network cell ID and the neighboring network cell ID and is stored in an information table to exemplify the updating of the matching identification information.
[0141] When the information table is empty, that is, there is no record (entry) in the information table, if a WIFI connection event is received, the electronic device can obtain the second target information (resident network cell ID, neighboring network cell ID), generate a target entry based on the second target information, and store the target entry in the information table.
[0142] For example: the stored information table is shown in Figure 1. It is determined that a WIFI connection event is received, the resident network cellid obtained is cellidA, and the neighboring network cellids obtained are cellidB and cellidC. The generated target entry is shown in Figure 5. The target entry shown in Figure 5 is inserted into the information table shown in Figure 1, and the updated information table obtained is shown in Figure 6.
[0143] For example, if the electronic device determines that it enters a high power consumption state from a low power consumption state, the electronic device can obtain the second target information, and then compare the second target information with the information in the information table. First, the resident cellid is compared, that is, it is determined whether the resident cellid corresponding to the second target information exists in the resident cellid column in the information table. If not, it is necessary to construct a target entry.
[0144] For example, the resident cellid obtained by the electronic device is cellidB, and the neighboring cellids obtained are cellidA and cellidC. The constructed target entry is shown in FIG7 , the information table is shown in FIG6 , and the updated information table is shown in FIG8 .
[0145] Exemplarily, if the electronic device switches from screen off to screen on, the electronic device can obtain the second target information, and then compare the second target information with the information in the information table, and determine that the resident cellid corresponding to the second target information exists in the resident cellid column in the information table, then it is necessary to further compare the neighboring cellid column. First, the row in the resident cellid column that has the same resident cellid as the first target information is used as the target row. Determine whether the neighboring cellid column corresponding to the target row contains all the neighboring cellids corresponding to the first target information. If so, it means that the second target information obtained this time has been recorded in the information table, so there is no need to update the information table; if it is determined that the neighboring cellid column corresponding to the target row does not contain all the neighboring cellids corresponding to the first target information, the target neighboring cellid can be determined, and the target neighboring cellid is inserted into the neighboring cellid column corresponding to the target row.
[0146] For example: the resident network cellid obtained by the electronic device is cellidB, and the neighboring network cellids obtained are cellidA and cellidD. The information table is shown in Figure 8, then the target entry is entry 2, and the target neighboring network cellid is determined to be cellidD based on entry 2 and the second target information. Then cellidD is added to the neighboring network cellid column of entry 2, and the updated information table is shown in Figure 9.
[0147] The following takes the example where the matching identification information includes the resident network cell ID, the neighboring network cell ID, and the most recent valid time and is stored in an information table to exemplify the updating of the matching identification information.
[0148] When the information table is empty, that is, there is no record (entry) in the information table, if a WIFI connection event is received, the electronic device can obtain the second target information (resident network cell ID, neighboring network cell ID and current time), generate a target entry based on the second target information, and store the target entry in the information table.
[0149] For example: the stored information table is shown in Figure 2. It is determined that a WIFI connection event has been received, the resident network cellid obtained is cellidA, the neighboring network cellids obtained are cellidB and cellidC, and the current time is 2023 / 12 / 22. The generated target entry is shown in Figure 10. The target entry shown in Figure 10 is inserted into the information table shown in Figure 2, and the updated information table obtained is shown in Figure 11.
[0150] It should be noted that the above 2023 / 12 / 22 indicates that the event is December 22, 2023, and although the year, month, and day are used as an example in the figure of this application, this application does not limit the format of the current time obtained. In specific implementation, you can also obtain only the month and day, or you can obtain the month, day and hour, etc.
[0151] For example, if the electronic device determines that it enters a high power consumption state from a low power consumption state, the electronic device can obtain the second target information, and then compare the second target information with the information in the information table. First, the resident cellid is compared, that is, it is determined whether the resident cellid corresponding to the second target information exists in the resident cellid column in the information table. If not, it is necessary to construct a target entry.
[0152] For example, the resident cellid obtained by the electronic device is cellidB, the neighboring cellids obtained are cellidA and cellidC, and the current time is 2023 / 12 / 23. The constructed target entry is shown in FIG12 , the information table is shown in FIG11 , and the updated information table is shown in FIG13 .
[0153] Exemplarily, if the electronic device switches from screen off to screen on, the electronic device can obtain the second target information, and then compare the second target information with the information in the information table, and determine that the resident cellid corresponding to the second target information exists in the resident cellid column in the information table, then it is necessary to further compare the neighboring cellid column. First, the row in the resident cellid column that has the same resident cellid as the first target information is used as the target row. Determine whether the neighboring cellid column corresponding to the target row contains all the neighboring cellids corresponding to the first target information. If so, it means that the second target information obtained this time has been recorded in the information table, and only the most recent valid time needs to be updated; if it is determined that the neighboring cellid column corresponding to the target row does not contain all the neighboring cellids corresponding to the first target information, the target neighboring cellid can be determined, and the target neighboring cellid is inserted into the neighboring cellid column corresponding to the target row.
[0154] For example: the resident network cellid obtained by the electronic device is cellidB, and the neighboring network cellids obtained are cellidA and cellidD. The information table is shown in Figure 13, then the target entry is entry 2, and the target neighboring network cellid is determined to be cellidD based on entry 2 and the second target information. Then cellidD is added to the neighboring network cellid column of entry 2. The updated information table is shown in Figure 14.
[0155] For example: the resident cellid obtained by the electronic device is cellidB, the neighboring cellids obtained are cellidA and cellidC, the current time is 2024 / 1 / 12, and the information table is shown in Figure 13. The target entry is entry 2. At this time, it is determined that the neighboring cellid of entry 2 contains all the obtained neighboring cellids. At this time, only the most recent valid time of entry 2 needs to be updated. The updated information table is shown in Figure 15.
[0156] The following takes the example where the matching identification information includes the resident network cell ID, the neighboring network cell ID, and WIFI information and is stored in an information table to exemplify the updating of the matching identification information.
[0157] When the information table is empty, that is, there is no record (entry) in the information table, if a WIFI connection event is received, the electronic device can obtain the second target information (resident network cell ID, neighboring network cell ID and WIFI information), generate a target entry based on the second target information, and store the target entry in the information table.
[0158] For example: the stored information table is shown in Figure 3. It is determined that a WIFI connection event is received, the resident network cellid obtained is cellidA, the neighboring network cellids obtained are cellidB and cellidC, and the WIFI information is BSSID1. The generated target entry is shown in Figure 16. The target entry shown in Figure 16 is inserted into the information table shown in Figure 3, and the updated information table obtained is shown in Figure 17.
[0159] For example, if the electronic device determines that it enters a high power consumption state from a low power consumption state, the electronic device can obtain the second target information, and then compare the second target information with the information in the information table. First, the resident cellid is compared, that is, it is determined whether the resident cellid corresponding to the second target information exists in the resident cellid column in the information table. If not, it is necessary to construct a target entry.
[0160] For example, if the electronic device switches from a screen-off state to a screen-on state, the electronic device can obtain the second target information, and then compare the second target information with the information in the information table. If it is determined that the resident cellid corresponding to the second target information exists in the resident cellid column in the information table, then further comparison of the Wi-Fi information is required. If the Wi-Fi information is different, the entry needs to be reconstructed. If the Wi-Fi information is the same, the neighboring cellid needs to be compared again. The comparison method of the neighboring cellid is the same as above and will not be repeated here.
[0161] For example: the resident network cellid obtained by the electronic device is cellidA, and the neighboring network cellids obtained are cellidB and cellidD. The information table is shown in Figure 17, then the target entry is entry 1, and the target neighboring network cellid is determined to be cellidD based on entry 1 and the second target information. Then cellidD is added to the neighboring network cellid column of entry 1, and the updated information table is shown in Figure 18.
[0162] The following takes the example where the matching identification information includes the resident network cell ID, the neighboring network cell ID, the WIFI information and the most recent valid time and is stored in the information table to exemplify the updating of the matching identification information.
[0163] When the information table is empty, that is, there is no record (entry) in the information table, if a WIFI connection event is received, the electronic device can obtain the second target information (resident network cell ID, neighboring network cell ID, WIFI information and current time), generate a target entry based on the second target information, and store the target entry in the information table.
[0164] For example, if the electronic device determines that it has entered a high-power state from a low-power state, it can obtain the second target information and then compare the second target information with the information in the information table. First, the resident cellid is compared, that is, whether the resident cellid corresponding to the second target information exists in the resident cellid column of the information table. If not, a target entry needs to be constructed. If it is determined that the resident cellid corresponding to the second target information exists in the resident cellid column of the information table, then further comparison with the WiFi information is required. If the WiFi information is different, it is necessary to reconstruct the entry or replace the WiFi information in the information table with the WiFi information corresponding to the second target information and update the most recent valid time. If the WiFi information is the same, it is necessary to compare the neighboring cellid again. Determine whether the neighbor cell ID column corresponding to the target row contains all the neighbor cell IDs corresponding to the first target information. If so, the information table already contains the second target information obtained this time, and only the most recent valid time needs to be updated. If it is determined that the neighbor cell ID column corresponding to the target row does not contain all the neighbor cell IDs corresponding to the first target information, then the target neighbor cell ID can be determined and inserted into the neighbor cell ID column corresponding to the target row, or the target entry can be reconstructed. The following examples 1 to 5 provide exemplary explanations.
[0165] Example 1: The information table stored in the electronic device is shown in Figure 19. In the first target information obtained, the resident cellid is cellidA, the neighboring cellids are cellidB and cellidC, the WIFI information of the connected WIFI is BSSID3, and the most recent valid time is 2024 / 1 / 2; it can be determined that for target behavior item 3, only the most recent valid time needs to be updated this time. The updated information table is shown in Figure 20.
[0166] Example 2: The information table stored in the electronic device is shown in FIG19 . In the first target information obtained, the resident network cellid is cellidA, the neighboring network cellids are cellidB, cellidC, and cellidE, the WIFI information of the connected WIFI is BSSID3, and the most recent valid time is 2024 / 1 / 2. It is determined that the target neighboring network cellid is cellidE, and the target behavior is entry 3. The target neighboring network cellid is inserted into the neighboring network cellid column in entry 3, and the most recent valid time in entry 3 is updated with the most recent valid time in the first target information. The updated information table is shown in FIG21 .
[0167] Example 3: The information table stored in the electronic device is shown in Figure 19. In the first target information obtained, the resident network cellid is cellidA, the neighboring network cellids are cellidB, cellidC, and cellidE, the WIFI information of the connected WIFI is BSSID3, and the most recent valid time is 2024 / 1 / 2; the generated target entries are shown in Figure 22. Based on the target entries shown in Figure 22, the information table shown in Figure 19 is updated, and the updated information table is shown in Figure 23.
[0168] Example 4: The information table stored in the electronic device is shown in FIG19 . In the first target information obtained, the resident network cellid is cellidA, the neighboring network cellids are cellidB and cellidC, the WIFI information of the connected WIFI is BSSID6, and the most recent valid time is 2024 / 1 / 2. The generated target entry is shown in FIG24 . The information table shown in FIG19 is updated based on the target entry shown in FIG24 , and the updated information table is shown in FIG25A .
[0169] Example 5: The information table stored in the electronic device is shown in FIG19 . In the first target information obtained, the resident network cellid is cellidA, the neighboring network cellids are cellidB and cellidC, the WIFI information of the connected WIFI is BSSID6, and the most recent valid time is 2024 / 1 / 2; BSSID6 is used to replace BSSID3 in entry 3, and the most recent valid time is updated, and the updated information table is shown in FIG25B .
[0170] It should be noted that, in the process of obtaining the second target information, the neighboring network cell ID may not be obtained. In this case, the information table can be updated only based on the other obtained second target information.
[0171] It should be noted that the events that trigger the updating of the matching identification information in the above examples are only examples and can be replaced by other events that trigger the updating of the matching identification information, and the embodiments of the present application do not limit this.
[0172] In some possible embodiments, in order to avoid wasting memory resources due to entries in the information table that have not been used for a long time, a cleaning cycle can be set in the present application. In each cleaning cycle, the current time is obtained, and for each most recent valid time in the most recent valid time column in the information table, the time difference between the valid time and the current time is determined, and entries with a time difference greater than the preset time difference value are removed from the information table.
[0173] In this application, in order to avoid incomplete information tables caused by excessive cleaning, the preset time difference cannot be set too short. The preset time difference can be set to 1 month according to the user's usage habits.
[0174] For example: the information table is shown in Figure 25, the preset time difference is 1 month, and the current time is obtained as January 3, 2024. The latest valid time corresponding to entry 1 is determined to be January 1, 2024, and the time difference between entry 1 and the current time is determined to be less than the preset time difference; the latest valid time corresponding to entry 2 is determined to be November 20, 2023, and the time difference between entry 2 and the current time is determined to be greater than the preset time difference; the latest valid time corresponding to entry 3 is determined to be December 22, 2023, and the time difference between entry 3 and the current time is determined to be less than the preset time difference; the latest valid time corresponding to entry 4 is determined to be December 25, 2023, and the time difference between entry 4 and the current time is determined to be less than the preset time difference; the latest valid time corresponding to entry 5 is determined to be January 2, 2024, and the time difference between entry 5 and the current time is determined to be less than the preset time difference; therefore, entry 2 needs to be removed from the information table, and the information table after removal is shown in Figure 26.
[0175] In some possible embodiments, when the above-described method is used to update the information table, the resident cellid and neighboring cellid in the first target information may not be obtained due to the fact that the SIM card is not inserted, the SIM card is in arrears, or the communication is abnormal. In order to ensure the integrity of the constructed information table, when the resident cellid and the neighboring cellid are not obtained, the information table can be updated based on the preset cellid identifier as the resident cellid and the neighboring cellid.
[0176] For example: the preset cellid is identified as all-cellid, the resident cellid and neighboring cellid that are not obtained this time are determined, the obtained WIFI information is BSSID2, and the most recent valid time is 2024 / 1 / 3, so all-cellid can be used as the resident cellid and neighboring cellid; the generated target entry is shown in Figure 27, and the target entry shown in Figure 27 is used to update the information table shown in Figure 19, and the updated information table is shown in Figure 28.
[0177] In order to ensure the accuracy of the information table, after the user inserts the SIM card, the second target information can be obtained again, and then the second target information is used to replace the all-cellid in the resident network cellid column in the information table, and the second target information is used to replace the all-cellid in the neighboring network cellid column.
[0178] After introducing the information table updating method provided in the embodiment of the present application, the following is a detailed introduction to a wireless network scanning method provided in the embodiment of the present application:
[0179] Since there is no need to perform WIFI scanning when WIFI is connected, the premise of WIFI scanning is that the WIFI function in the electronic device is turned on and not connected. Therefore, the WIFI scanning methods described below are all performed when the WIFI function in the electronic device is turned on and not connected.
[0180] FIG29 is a flow chart of a wireless network scanning method according to an embodiment of the present application, wherein:
[0181] In step 2901: obtain first target information.
[0182] In the present application, before the first target information is received, it can be determined whether the timing for executing step 2901 has arrived based on the following events or moments: determining that the scanning moment has arrived based on the first cycle; or, determining that the scanning moment has arrived based on the detection that the screen-off time has reached the second cycle; or, determining that the scanning moment has arrived based on the detection that the screen-on time has reached the third cycle; or, detecting that the electronic device has switched from screen-off to screen-on; or, detecting that the track fence function has been turned off; or, detecting that the electronic device has been restarted; or, detecting that a wake-up event has occurred in the electronic device.
[0183] Among them, the screen-off duration is the duration that starts counting after the electronic device is detected to enter the screen-off state. When the screen-off duration reaches the second cycle, if the electronic device is still in the screen-off state, it is necessary to clear the accumulated duration and restart the timing, that is, in the screen-off state, the timing is cyclically executed with the second cycle as the cycle and is cleared when the accumulated duration reaches the second cycle; similarly, the screen-on duration is the duration that starts counting after the electronic device is detected to enter the screen-on state. When the screen-on duration reaches the third cycle, if the electronic device is still in the screen-on state, it is necessary to clear the accumulated duration and restart the timing, that is, in the screen-on state, the timing is cyclically executed with the third cycle as the cycle and is cleared when the accumulated duration reaches the third cycle.
[0184] In some possible embodiments, the three methods of determining whether the scanning time has been reached, namely, "determining that the scanning time has been reached according to the first cycle, determining that the scanning time has been reached when the screen is off for a second cycle; or determining that the scanning time has been reached when the screen is on for a third cycle" can be used simultaneously, that is, the electronic device cyclically executes the steps shown in Figure 29 according to the first cycle, and cyclically executes the steps shown in Figure 29 according to the second cycle in the screen-off state, and cyclically executes the steps shown in Figure 29 according to the third cycle in the screen-on state; when the three cycles are used to execute at the same time, the steps shown in Figure 29 need to be executed as long as one cycle determines that the scanning time has been reached; since the user is less likely to use the electronic device when the screen is off, the second cycle can be set to be larger than the third cycle.
[0185] It should be noted that in order to ensure the accuracy of the determined scanning time, the starting time of the first cycle, the second cycle and the third cycle can be updated after detecting that the track fence function is turned off; or detecting that the electronic device is restarted; or detecting that a wake-up event occurs in the electronic device, that is, executing the steps shown in Figure 29 according to a non-periodic event.
[0186] That is, in this application, the steps shown in Figure 29 can be cyclically executed according to the first cycle, and the steps shown in Figure 29 can be cyclically executed according to the second cycle when the screen is off, and the steps shown in Figure 29 can be cyclically executed according to the third cycle when the screen is on, depending on the state of the electronic device. It should be noted that the first cycle, the second cycle, and the third cycle can be the same or different.
[0187] In step 2902: determining whether to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information; wherein the matching identification information includes: a historical resident cell identification and a historical neighboring cell identification corresponding to the historical resident cell identification.
[0188] In some embodiments, when determining whether to perform a WIFI scan based on the similarity between the first target information and the matching identification information, specifically, when the similarity between the first target information and the matching identification information is greater than a preset similarity threshold, it can be determined to perform a WIFI scan; when the similarity between the first target information and the matching identification information is not greater than the preset similarity threshold, it can be determined not to perform a WIFI scan.
[0189] The specific value of the similarity threshold is not limited in this embodiment of the application.
[0190] The following is an exemplary description of the implementation of a method for determining the similarity between the first target information and the matching identification information.
[0191] In one embodiment, when determining the similarity between target information and matching identification information, it can be specifically determined whether the resident cell ID in the matching identification information includes the resident cell ID in the first target information. If included, the similarity between the first target information and the matching identification information is determined to be a first preset value; otherwise, the similarity between the first target information and the matching identification information is determined to be a second preset value.
[0192] The first preset value may be greater than a preset similarity threshold, and the second preset value may be less than a preset similarity threshold. That is, in this embodiment, if the resident cell ID in the first target information is detected in the resident cell ID in the matching identification information, then it is determined that the similarity between the first target information and the matching identification information is greater than the preset similarity threshold.
[0193] Optionally, when the matching identification information is stored in the form of an information table, it can be determined whether the resident cellid column in the information table contains the resident cellid in the first target information. If so, the similarity between the first target information and the matching identification information is determined to be a first preset value; otherwise, the similarity between the first target information and the matching identification information is determined to be a second preset value.
[0194] For example, if the resident cell ID in the first target information is cell ID A, and the information table shown in FIG28 includes cell ID A in the resident cell ID column of the information table, then the similarity value between the first target information and the information table can be determined to be a first preset value. Because the first preset value is greater than the preset similarity threshold, it can be determined in this step that a Wi-Fi scan is to be performed.
[0195] It should be noted that this embodiment can be applied to the situation in which the matching identification information includes the resident network cellID and the neighboring network cellID in the above description. There is no restriction on whether the matching identification information includes WIFI information and / or the most recent valid time. In other words, as long as the matching identification information includes the resident network cellID and the neighboring network cellID, the matching identification information may include the above-mentioned WIFI information and / or the most recent valid time, or may not include it.
[0196] In the second embodiment, when determining the similarity between a target information and matching identification information, it can be specifically determined whether any one of the resident network cellid and the neighboring network cellid in the first target information exists in the matching identification information. If so, the similarity between the first target information and the matching identification information is determined to be a first preset value; otherwise, the similarity between the first target information and the matching identification information is determined to be a second preset value.
[0197] The first preset value may be greater than a preset similarity threshold, and the second preset value may be less than a preset similarity threshold. That is, in this embodiment, if any one of the resident network cell ID and the neighboring network cell ID in the first target information is detected in the resident network cell ID and the neighboring network cell ID in the matching identification information, then it is determined that the similarity between the first target information and the matching identification information is greater than the preset similarity threshold.
[0198] The following three possible implementations are used to exemplify the implementation of determining whether the matching identification information contains any one of the resident network cell ID and the neighboring network cell ID in the first target information.
[0199] Implementation method 1: detecting the resident network cellid in the first target information in the resident network cellid of the matching identification information, and / or detecting any neighboring network cellid in the first target information in the neighboring network cellid of the matching identification information.
[0200] Optionally, when the matching identification information is stored in the form of an information table, it can be determined whether the resident cellid column in the information table contains the resident cellid in the first target information, and whether the neighboring cellid column in the information table contains any neighboring cellid in the first target information. If the resident cellid column contains the resident cellid in the first target information and / or the neighboring cellid column contains any neighboring cellid in the first target information, then the similarity between the first target information and the matching identification information is determined to be a first preset value; otherwise, the similarity between the first target information and the matching identification information is determined to be a second preset value.
[0201] For example, assuming the resident cell ID in the first target information is cellidE, and the neighboring cell IDs include cellidA; as shown in the information table in Figure 28, cellidA (the neighboring cell ID) in the first target information is included in the neighboring cell ID column corresponding to entry 4 in the information table. Therefore, the similarity value between the first target information and the information table can be determined to be a first preset value. Because the first preset value is greater than the preset similarity threshold, it is determined that a Wi-Fi scan is to be performed in this step.
[0202] Implementation method 2: detecting any one of the resident network cellid and the neighboring network cellid in the first target information from the resident network cellid and the neighboring network cellid in the matching identification information.
[0203] Optionally, when the matching identification information is stored in the form of an information table, it can be determined whether there is at least one cellid in the first target information (which can be the resident network cellid or any neighboring network cellid) in the resident network cellid column and the neighboring network cellid column in the information table. If so, the similarity between the first target information and the matching identification information is determined to be a first preset value; otherwise, the similarity between the first target information and the matching identification information is determined to be a second preset value.
[0204] For example: the resident network cellid in the first target information obtained is cellidE, and the neighboring network cellid includes: cellidA; the information table is shown in Figure 28, then the cellidA in the neighboring network cellid in the first target information is included in the neighboring network cellid corresponding to entry 4 in the information table, so it can be determined that the similarity value between the first target information and the information table is the first preset value, which is greater than the preset similarity threshold, and a WIFI scan is required.
[0205] It should be noted that this embodiment can be applied to the situation in which the matching identification information includes the resident network cellID and the neighboring network cellID in the above description. There is no restriction on whether the matching identification information includes WIFI information and / or the most recent valid time. In other words, as long as the matching identification information includes the resident network cellID and the neighboring network cellID, the matching identification information may include the above-mentioned WIFI information and / or the most recent valid time, or may not include it.
[0206] In a third embodiment, the method for calculating similarity may also be implemented as the steps shown in FIG30 , wherein:
[0207] In step 3001: a target entry is retrieved from the information table based on the resident cell ID in the first target information.
[0208] In the present application, the entry corresponding to the resident cellid in the first target information in the information table is used as the target entry.
[0209] For example, the resident cellid in the first target information obtained is cellidA; the information table is shown in FIG16 , and according to cellidA, a check is performed in the resident cellid column to determine that the resident cellid of the third row, i.e., entry 3, is cellidA, so entry 3 is taken as the target entry.
[0210] In step 3002: determine the number of identical cellids in the first target information and the target entry.
[0211] For example: the resident cellid in the first target information obtained is cellidA, and the neighboring network cellids include: cellidB, cellidD; the information table is shown in Figure 28, entry 3 is the target entry; the neighboring network cellids corresponding to the target entry include: cellidB, cellidC; it can be determined that the cellids that are the same in the first target information and the target entry include: cellidA, cellidB, so it can be determined that the number of the same cellids in the first target information and the target entry is 2.
[0212] In step 3003: determine the total number of cellids in the first target information and the target entries.
[0213] In this application, the total number of cellids in the first target information and target entries can be the total number of resident network cellids and neighboring network cellids, or the total number of neighboring network cellids in the first target information and target entries. This application does not limit this.
[0214] For example: the resident cellid in the first target information obtained is cellidA, and the neighboring network cellids include: cellidB, cellidD; the information table is shown in Figure 28, entry 3 is the target entry; the neighboring network cellids corresponding to the target entry include: cellidB, cellidC; it can be determined that the total number of cellids in the first target information and the target entry is 6.
[0215] For example: the resident cellid in the first target information obtained is cellidA, and the neighboring network cellids include: cellidB, cellidD; the information table is shown in Figure 28, entry 3 is the target entry; the neighboring network cellids corresponding to the target entry include: cellidB, cellidC; it can be determined that the total number of neighboring network cellids in the first target information and the target entry is 4.
[0216] In step 3004: the ratio of the number of identical cell IDs to the total number is used as the similarity.
[0217] For example, the resident cell ID in the first target information is cellidA, and the neighboring cell IDs include cellidB and cellidD. As shown in the information table in Figure 28, entry 3 is the target entry. The neighboring cell IDs corresponding to the target entry include cellidB and cellidC. The number of identical cell IDs in the first target information and the target entry is 2. The total number of cell IDs in the first target information and the target entry is 6, so the similarity value can be determined to be 2 / 6 = 0.33.
[0218] For example, the resident cell ID in the first target information obtained is cellidA, and the neighboring cell IDs include cellidB and cellidD. As shown in the information table in Figure 28, entry 3 is the target entry. The neighboring cell IDs corresponding to the target entry include cellidB and cellidC. The number of identical cell IDs in the first target information and the target entry is 2. The total number of neighboring cell IDs in the first target information and the target entry is determined to be 4, so the similarity value can be determined to be 2 / 4 = 0.5.
[0219] In this application, the preset similarity threshold can be set by technical personnel based on experience, and this application does not limit the specific value of the preset similarity threshold.
[0220] It should be noted that the three methods for determining the similarity between the first target information and the matching identification information given above in this application are only three embodiments, and do not limit the specific implementation method for determining the similarity between the first target information and the matching identification information. Other methods for determining the similarity between the first target information and the matching identification information are also applicable to this application.
[0221] In some possible embodiments, if the electronic device failed to scan successfully the last time it performed a WIFI scan, it may be because the electronic device is not within the range of the WIFI connection. In this case, no matter how many times the WIFI scan is performed, the scan will not be successful. To avoid wasting resources caused by multiple scans, before implementing the steps shown in Figure 29, it is first necessary to determine whether the distance between the first location information and the obtained current location information is greater than a preset distance. If the WIFI connection was successful after the last WIFI scan, the first location information is the location when the WIFI connection was disconnected. If the connection was unsuccessful after the last WIFI scan, the first location information is the location information when the WIFI scan was performed. If it is determined that the distance between the first location information and the obtained current location information is less than the preset distance, there is no need to perform the steps shown in Figure 29.
[0222] For example: the first location information obtained during the last WIFI scan is school, the current location information is home, the distance between school and home is determined to be 500 meters, and the preset distance is 10 meters, then it is determined that the distance between the first location information and the current location information is greater than the preset distance. At this time, the steps shown in Figure 29 can be executed to determine whether a WIFI scan is required.
[0223] In other possible embodiments, the electronic device may frequently receive wake-up events. If each wake-up event triggers the steps shown in FIG. 29 , excessive resources will be consumed. Therefore, after detecting a wake-up event in the electronic device and before executing the steps shown in FIG. 29 , it is necessary to determine that the time interval between the first wake-up time and the current wake-up time is greater than a preset time interval. If the Wi-Fi connection was not successful after the last wake-up event, the first wake-up time is the time corresponding to the last wake-up event; if the Wi-Fi connection was successful after the last wake-up event, then the process proceeds directly to step 2901 after the current wake-up event.
[0224] For example, if the first wake-up time corresponding to the last wake-up event is determined to be 10:00, the current wake-up time of the acquired wake-up event is 10:03, and the interval between the first wake-up time and the current wake-up time is determined to be 3 minutes, and if the preset interval is 5 minutes, then the interval between the first wake-up time and the current wake-up time is determined to be less than the preset interval. In this case, the steps shown in Figure 29 do not need to be performed.
[0225] In some possible embodiments, since there are two ways to trigger an electronic device to switch from a screen-off state to a screen-on state, one is manual triggering by the user, and the other is screen-on state caused by the electronic device displaying a message or notification (i.e., passive triggering); in the case of passive triggering, it may indicate that the user has no WIFI connection requirements, and no WIFI scan is required at this time. Therefore, after detecting that the electronic device switches from a screen-off state to a screen-on state, before executing the steps shown in Figure 29, it is necessary to determine whether the target operation triggered by the user is received. If received, step 2901 is executed. If not received, step 2901 is not required.
[0226] That is, in this application, after detecting the screen-on event, it is determined whether the user has a need for a WIFI connection by determining whether a target operation triggered by the user is received; this method ensures that a WIFI scan can be performed in a timely manner when the user has a need for a WIFI connection, and avoids the waste of resources caused by multiple scans.
[0227] It should be noted that the target operations in this application include but are not limited to: clicking, double-clicking, triple-clicking, touching, sliding, pressing buttons, etc.; that is, this application does not limit the specific implementation methods of the target operations, and all operations triggered by the user can be regarded as target operations in this application.
[0228] In this application, WIFI scanning is triggered only when the scanning conditions are met. Through this method, the hit rate of WIFI scanning is improved, the performance experience of the product is enhanced, and the power consumption generated by unnecessary WIFI scanning is saved.
[0229] In order to further save power consumption, before performing a WIFI scan, it is possible to determine whether a WIFI scan is required by following the steps shown in FIG31 , wherein:
[0230] In step 3101: obtain the number of WIFI scans that have been performed.
[0231] In this application, the number of scans refers to the number of WIFI scans performed before executing the steps shown in Figure 31 this time.
[0232] For example, if the time of executing the process is 8:00 and it is determined that no WIFI connection has been successfully made before 8:00, the number of successes can be determined to be 0.
[0233] In step 3102: the scanning duration is determined based on the number of scans.
[0234] In order to make the WIFI scanning method provided in this application more universal, the scanning duration in this application can be set to a fixed value or a function associated with the number of scans.
[0235] If the scanning time is a fixed value, the triggering method of step 2901 is fixed period triggering. If the scanning time is not a fixed value, it means that the triggering method of step 2901 is non-fixed period triggering.
[0236] For example, if the scan duration is determined to be a fixed value of 30 minutes, then the scan duration will always be 30 minutes regardless of the number of scan times.
[0237] For another example, the function corresponding to the number of scans and the scan duration is T=30x, where T is the scan duration and x is the number of scans. Assuming that the number of scans is 0, T is 0 minutes; if the number of scans is 1, T is 30 minutes; if the number of scans is 2, T is 60 minutes.
[0238] It is important to note that a successful WIFI scan does not mean that you can successfully connect to WIFI. Therefore, after the last WIFI scan, you can appropriately extend the scan cycle to reduce power consumption.
[0239] In step 3103: obtain the current time and the time of the last WIFI scan.
[0240] In this application, the current time is the time when the process is executed this time.
[0241] In step 3104: a first duration is determined based on the current time and the time of the last WIFI scan.
[0242] For example, if the current time is 8:00 and the last WIFI scan was performed at 7:30, then the first duration can be determined to be 30 minutes.
[0243] In step 3105: determine whether the first duration is less than the scanning duration, if not, proceed to step 3106, otherwise proceed to step 3107.
[0244] For example, the function corresponding to the number of scans and the scan duration is T=30x, where T is the scan duration and x is the number of scans. The number of scans is determined to be 0, and the scan duration is 0 minutes. The current time is obtained as 8:00, and the last WIFI scan time is 7:30, so the first duration is determined to be 30 minutes. It can be determined that the first duration is not less than the scan duration.
[0245] In step 3106: update the number of scans and enter the steps shown in Figure 29.
[0246] If the Wi-Fi scan is successfully performed this time, the scan count needs to be updated to ensure that the accurate scan count can be obtained the next time the process is executed.
[0247] In step 3107: no WIFI scanning is performed and the process ends.
[0248] In some possible embodiments, the method for updating the number of scans may be an addition method, that is, adding one to the number of scans obtained last time to obtain the number of scans this time.
[0249] It should be noted that the method for updating the number of scans given in this application is only an embodiment and does not limit the method for updating the number of scans. In specific implementation, the number of scans obtained last time can be added by two to obtain the number of scans this time. This application does not limit this.
[0250] In some possible embodiments, when the SIM card is not inserted or the SIM card is in arrears, the first target information cannot be obtained, and the mobile network cannot be used in this case; secondly, when the communication of the electronic device is abnormal, although the mobile network can still be used, the first target information cannot be obtained. Therefore, in order to connect to WIFI in time to facilitate the user to use the network, and to avoid the consumption of mobile network resources caused by the use of the mobile network, a WIFI scan can be performed directly when it is determined that the first target information cannot be obtained.
[0251] In some possible embodiments, after implementing the steps shown in Figure 29, if it is determined that a WIFI scan is required, the WIFI scan is started. In this application, a full scan method or a targeted scan method can be used when performing a WIFI scan.
[0252] In the full scan method, the electronic device directly scans all possible Wi-Fi networks and selects a target Wi-Fi network to connect to. The target Wi-Fi network can be the one with the strongest signal among all the scanned Wi-Fi networks, or the one whose last connection time is closest to the current time.
[0253] In the targeted scanning method, the electronic device determines the target entry in the information table based on the first target information and scans the Wi-Fi corresponding to the Wi-Fi information in the target row. To ensure the success rate of Wi-Fi connection, if the connection is not successful, a full scan will be performed again.
[0254] In some possible embodiments, after implementing step 3001, multiple target entries may be determined. At this time, the method of steps 3002-3004 can be continued to be implemented for each target entry to determine the similarity. At this time, there may be multiple target entries whose similarities with the first target information are greater than the preset similarity threshold. At this time, the time difference between the most recent valid time and the current time can be determined, and the WIFI corresponding to the WIFI information in the target entry with the smallest time difference can be scanned. If the scan is unsuccessful, the corresponding WIFI is scanned in order from small to large according to the time difference. If the WIFI corresponding to the WIFI information in all target entries is not successfully connected, a full scan is performed again.
[0255] For example, as shown in FIG32 , it is determined that the target entries are entry 3 and entry 4, and the current time is 2023 / 12 / 26. It is determined that the WIFI corresponding to BSSID4 in entry 4 should be scanned first. If the connection is not successful, the WIFI corresponding to BSSID3 in entry 3 should be scanned again. If the connection is still not successful, a full scan is performed again.
[0256] Based on the same inventive concept, after introducing a wireless network scanning method provided in an embodiment of the present application, as shown in FIG33 , a wireless network scanning device 3300 provided in an embodiment of the present application is described below. The device includes:
[0257] A first target information acquisition module 33001 is configured to acquire first target information; the first target information includes: a station cell identifier and a neighboring cell identifier, wherein the station cell identifier is a cell identifier of a station cell to which the electronic device is connected, and the neighboring cell identifier is a cell identifier of a neighboring cell corresponding to the station cell;
[0258] The scanning module 33002 is used to determine whether to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information; wherein the matching identification information includes: a historical resident cell identification and a historical neighboring cell identification; the historical resident cell identification is a cell identification of a resident cell to which the electronic device has been connected, and the historical neighboring cell identification is a cell identification of a neighboring cell corresponding to the resident cell to which the electronic device has been connected.
[0259] In some possible embodiments, the first target information acquisition module 33001 is specifically used to: acquire the first target information in response to detecting that the first cycle has been reached; or, acquire the first target information in response to detecting that the screen-off duration has reached the second cycle; or, acquire the first target information in response to detecting that the screen-on duration has reached the third cycle; or, acquire the first target information in response to detecting that the electronic device changes from screen-off to screen-on; or, acquire the first target information in response to detecting that the track fence function is turned off; or, acquire the first target information in response to detecting that the electronic device is restarted; or, acquire the first target information in response to detecting that a wake-up event has occurred in the electronic device.
[0260] In some possible embodiments, before obtaining the first target information, the first target information obtaining module 33001 is further used to: determine whether the distance between the electronic device's location and the first location is greater than a preset distance, and the first location is the location of the electronic device during the previous WIFI scan.
[0261] In some possible embodiments, after the first target information acquisition module 33001 detects a wake-up event occurring in the electronic device, it is also used to: determine that the time interval between the time when the wake-up event occurs and the first wake-up time is greater than a preset time interval, and the first wake-up time is the time when the last wake-up event occurred in the electronic device.
[0262] In some possible embodiments, the first target information acquisition module 33001 is used to: acquire the first target information in response to a user operation switching the screen from off to on.
[0263] In some possible embodiments, the scanning module 33002 is specifically used to: if the matching identification information includes the on-network cell identifier in the first target information, determine the similarity as a first preset value; if the matching identification information does not include the on-network cell identifier in the first target information, determine the similarity as a second preset value; wherein the first preset value is greater than a preset similarity threshold, and the second preset value is less than the preset similarity threshold.
[0264] In some possible embodiments, the scanning module 33002 is specifically used to: if the matching identification information includes any one of the resident cell identification or the neighboring cell identification in the first target information, determine the similarity as a first preset value; if the matching identification information does not include the resident cell identification and the neighboring cell identification in the first target information, determine the similarity as a second preset value; wherein the first preset value is greater than the preset similarity threshold, and the second preset value is less than the preset similarity threshold.
[0265] In some possible embodiments, the scanning module 33002 is specifically used to: retrieve a target entry in the matching identification information based on the resident cell identifier; the matching identification information contains at least one entry, each entry includes the resident cell identifier and at least one neighboring cell identifier; determine the number of identical cell identifiers in the first target information and the target entry; determine the total number of cell identifiers in the first target information and the target entry; and use the ratio of the number of identical cell identifiers to the total number as the similarity.
[0266] In some possible embodiments, after determining whether to perform a WIFI scan based on the similarity between the first target information and the matching identification information, the scanning module 33002 is further used to: when determining to perform a WIFI scan based on the similarity between the first target information and the matching identification information, determine the target WIFI information corresponding to the first target information in the matching identification information; and connect to the WIFI corresponding to the target WIFI information.
[0267] In some possible embodiments, before performing a WIFI scan, the scanning module 33002 determines based on the similarity between the first target information and the matching identification information, it is also used to: obtain the number of scans that have been performed on the WIFI scan; and, obtain the scan duration; obtain the current time and the time of the last WIFI scan; determine a first duration based on the current time and the time of the last WIFI scan; and determine that the first duration is not less than the scan duration.
[0268] In some possible embodiments, after the scanning module 33002 determines that the first duration is not less than the scanning duration, it is further configured to: update the number of scans.
[0269] In some possible embodiments, the scanning module 33002 is specifically used to: obtain a preset scanning duration; or obtain a scanning duration determined according to the number of scans.
[0270] In some possible embodiments, the scanning module 33002 is further configured to: perform a WIFI scan if the first target information is not obtained.
[0271] In some possible embodiments, the scanning module 33002 is also used to: obtain second target information when the electronic device is in a WIFI connection state; the second target information includes: a resident cell identifier and a neighboring cell identifier, the resident cell identifier is the cell identifier of the resident cell to which the electronic device is connected, and the neighboring cell identifier is the cell identifier of the neighboring cell corresponding to the resident cell; and update the matching identification information based on the second target information.
[0272] In some possible embodiments, before the scanning module 33002 updates the matching identification information based on the second target information, it is also used to: determine whether the resident cell identification in the matching identification information exists with the resident cell identification in the second target information; update the matching identification information based on the second target information, including: if not, updating the matching identification information based on the second target information.
[0273] In some possible embodiments, the scanning module 33002 is also used to: if present, determine whether the neighboring cell identifier in the second target information is included in the neighboring cell identifier corresponding to the target row; the target row is the row in the matching identifier information that is the same as the resident cell identifier in the second target information; if not, update the matching identifier information in the second target information, or update the matching identifier information based on the target neighboring cell identifier; the target neighboring cell identifier is the neighboring cell identifier in the second target information that is not included in the neighboring cell identifier corresponding to the target row.
[0274] In some possible embodiments, the scanning module 33002 updates the matching identification information based on the target neighboring cell identifier, specifically for: if yes, determining whether the WIFI information corresponding to the resident cell identifier in the WIFI information in the matching identification information is the same as the acquired WIFI information; if different, updating the matching identification information based on the second target information.
[0275] In some possible embodiments, the scanning module 33002 is further configured to: if the times are the same, obtain the current time, and use the current time to update the latest valid time corresponding to the resident cell identifier stored in the matching identification information.
[0276] In some possible embodiments, the scanning module 33002 is specifically used to: construct a target entry based on the second target information; and insert the target entry into the matching identification information.
[0277] In some possible embodiments, the matching identification information includes at least one entry, each entry includes the most recent valid time, and the scanning module 33002 is further used to: obtain the current time and obtain each most recent valid time in the matching identification information; determine the time difference between each most recent valid time and the current time; and remove the entry corresponding to the most recent valid time whose time difference is greater than a preset time difference value from the matching identification information.
[0278] In some possible embodiments, if it is determined that the electronic device is in a WIFI connection state, the scanning module 33002 is further used, after detecting the first target event, to update the matching identification information based on the preset target information and the acquired WIFI information if the second target information is not acquired.
[0279] Corresponding to the above embodiments, the present application also provides an electronic device. Figure 34 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 3400 may include: a processor 3401, a memory 3402, and a communication unit 3403. These components communicate through one or more buses. Those skilled in the art will understand that the structure of the electronic device shown in the figure does not constitute a limitation on the embodiments of the present invention. It can be a bus structure or a star structure, and can also include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0280] The communication unit 3403 is configured to establish a communication channel so that the electronic device can communicate with other devices, receive user data sent by other devices, or send user data to other devices.
[0281] The processor 3401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs and / or modules stored in the memory 3402, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 3401 can only include a central processing unit (CPU). In an embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0282] The memory 3402 is used to store the execution instructions of the processor 3401. The memory 3402 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0283] When the execution instructions in the memory 3402 are executed by the processor 3401, the electronic device 3400 is enabled to execute part or all of the steps in the embodiment shown in FIG. 3 .
[0284] In a specific implementation, the present invention further provides a computer storage medium, wherein the computer storage medium may store a program that, when executed, may include some or all of the steps of each embodiment of the calling method provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0285] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus a necessary general-purpose hardware platform. Based on this understanding, the technical solutions in the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention or certain portions of the embodiments.
[0286] In this specification, reference can be made to the same or similar parts between the various embodiments. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
Claims
1. A wireless network WIFI scanning method, characterized in that: Applied to electronic equipment, the method includes: Obtaining first target information; the first target information includes: a resident cell identifier and a neighboring cell identifier, the resident cell identifier being the cell identifier of the resident cell to which the electronic device is connected, and the neighboring cell identifier being the cell identifier of the neighboring cell corresponding to the resident cell; Determining whether to perform a WIFI scan is based on the similarity between the first target information and the matching identification information; wherein the matching identification information includes: a historical resident cell identification and a historical neighboring cell identification; the historical resident cell identification is a cell identification of a resident cell to which the electronic device has been connected, and the historical neighboring cell identification is a cell identification of a neighboring cell corresponding to the resident cell to which the electronic device has been connected.
2. The method according to claim 1, characterized in that The acquiring of the first target information includes: In response to detecting that the first cycle has arrived, acquiring the first target information; or, In response to detecting that the screen-off duration reaches the second period, acquiring the first target information; or, In response to detecting that the screen-on duration reaches the third period, acquiring the first target information; or, In response to detecting that the electronic device switches from a screen-off state to a screen-on state, acquiring the first target information; or, In response to detecting that the track fence function is turned off, acquiring the first target information; or, In response to detecting that the electronic device is restarted, acquiring the first target information; or, In response to detecting a wake-up event of the electronic device, the first target information is acquired.
3. The method according to claim 2, characterized in that Before obtaining the first target information, the method further includes: It is determined that the distance between the location of the electronic device and a first location is greater than a preset distance, where the first location is the location of the electronic device during a previous WIFI scan.
4. The method according to claim 2, characterized in that After detecting that a wake-up event occurs on the electronic device and before acquiring the first target information, the method further includes: It is determined that a time interval between a time when the wake-up event occurs and a first wake-up time is greater than a preset time interval, where the first wake-up time is a time when a wake-up event last occurred on the electronic device.
5. The method according to claim 2, characterized in that The obtaining of the first target information includes: In response to a user operation switching the screen from off to on, the first target information is obtained.
6. The method according to claim 1, characterized in that The similarity between the first target information and the matching identification information is determined according to the following method: If the matching identification information includes the resident cell identifier in the first target information, determining that the similarity is a first preset value; If the matching identification information does not include the resident cell identifier in the first target information, determining that the similarity is a second preset value; The first preset value is greater than a preset similarity threshold, and the second preset value is less than the preset similarity threshold.
7. The method according to claim 1, characterized in that The similarity between the first target information and the matching identification information is determined according to the following method: If the matching identification information includes any one of the resident cell identifier or the neighboring cell identifier in the first target information, determining that the similarity is a first preset value; If the matching identification information does not include the resident cell identifier and the neighboring cell identifier in the first target information, determining that the similarity is a second preset value; The first preset value is greater than the preset similarity threshold, and the second preset value is less than the preset similarity threshold.
8. The method according to claim 1, characterized in that The similarity between the first target information and the matching identification information is determined according to the following method: Retrieving a target entry from the matching identification information based on the resident cell identifier; the matching identification information includes at least one entry, each entry including the resident cell identifier and at least one neighboring cell identifier; Determining the number of identical cell identifiers in the first target information and the target entry; Determining the total number of cell identifiers in the first target information and the target entry; The similarity is determined based on a ratio of the number of the same cell identifiers to the total number.
9. The method according to claim 1, characterized in that After determining whether to perform a Wi-Fi scan based on the similarity between the first target information and the matching identification information, the method further includes: When performing a WIFI scan based on the similarity between the first target information and the matching identification information, determining target WIFI information corresponding to the first target information in the matching identification information; Connect to the WIFI corresponding to the target WIFI information.
10. The method according to claim 1, characterized in that Before determining to perform a WIFI scan based on the similarity between the first target information and the matching identification information, the method further includes: Get the number of WIFI scans that have been performed; and get the scan duration; Get the current time and the time of the last WIFI scan; Determine a first duration based on the current time and the time of the last WIFI scan; Determine that the first duration is not less than the scanning duration.
11. The method according to claim 10, characterized in that After determining that the first duration is not less than the scanning duration, the method further includes: The scan count is updated.
12. The method according to claim 10, characterized in that The acquisition scanning duration includes: Get the preset scan duration; or, Obtain a scan duration determined according to the number of scans.
13. The method according to any one of claims 1 to 12, characterized in that: The method further comprises: If the first target information is not obtained, a WIFI scan is performed.
14. The method according to any one of claims 1 to 12, characterized in that: The method further comprises: When the electronic device is in a WIFI connection state, obtaining second target information; the second target information includes: a resident cell identifier and a neighboring cell identifier, the resident cell identifier being a cell identifier of a resident cell to which the electronic device is connected, and the neighboring cell identifier being a cell identifier of a neighboring cell corresponding to the resident cell; The matching identification information is updated based on the second target information.
15. The method according to claim 14, characterized in that Before updating the matching identification information based on the second target information, the method further includes: Determine whether the on-network cell identifier in the matching identification information is the on-network cell identifier in the second target information; The updating of the matching identification information based on the second target information includes: If not, the matching identification information is updated based on the second target information.
16. The method according to claim 15, characterized in that The method further comprises: If so, determining whether the neighboring cell identifier in the second target information is included in the neighboring cell identifier corresponding to the target row; the target row is the row in the matching identification information that is identical to the resident cell identifier in the second target information; If not, update the matching identification information in the second target information, or update the matching identification information based on the target neighboring cell identifier; the target neighboring cell identifier is the neighboring cell identifier in the second target information that is not included in the neighboring cell identifier corresponding to the target row.
17. The method according to claim 16, characterized in that The updating of the matching identification information based on the target neighboring cell identifier includes: The target neighboring cell identifier is added to the neighboring cell identifier corresponding to the target row.
18. The method according to claim 16, characterized in that The method further comprises: If so, determining whether the WIFI information corresponding to the resident cell identifier in the WIFI information in the matching identification information is the same as the acquired WIFI information; If different, the matching identification information is updated based on the second target information.
19. The method according to claim 18, characterized in that The method further comprises: If they are the same, the current time is obtained, and the latest valid time corresponding to the resident cell identifier stored in the matching identification information is updated using the current time.
20. The method according to any one of claims 15 to 18, characterized in that: Updating matching identification information based on the second target information includes: constructing a target entry based on the second target information; The target entry is inserted into the matching identification information.
21. The method according to claim 14, wherein The matching identification information includes at least one entry, each entry includes a most recent valid time, and the method further includes: Obtain the current time and each most recent valid time in the matching identification information; determining a time difference between each of the most recent valid times and the current time; The entries corresponding to the latest valid time whose time difference is greater than the preset time difference value are removed from the matching identification information.
22. The method according to claim 14, wherein If it is determined that the electronic device is in a WIFI connection state, then after detecting the first target event, the method further includes: If the second target information is not obtained, the matching identification information is updated based on the preset target information and the obtained WIFI information.
23. An electronic device, characterized in that: The electronic device comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method according to any one of claims 1 to 22.
24. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 22.
Citation Information
Patent Citations
Wireless network scanning method, device and equipment and storage medium
CN120568439A
Method and device for controlling wireless local area network module of terminal
CN104469820A
Cell measurement method, measurement device, terminal equipment, chip and storage medium
CN112888045A
Device and Method for WiFi Scan Optimization
US20150351012A1
Method and system for provisioning service continuity in a wireless network
WO2015128880A2