WiFi Connection Method and Related Devices

By establishing a mapping relationship between BSSID and WiFi passwords in electronic devices, access failure caused by different passwords of multiple WiFi networks with the same SSID is solved, and a more stable and efficient WiFi connection experience is achieved.

CN118474739BActive Publication Date: 2025-05-27HONOR DEVICE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311520324.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2025-05-27
Estimated Expiration
2043-11-14

AI Technical Summary

Technical Problem

In some scenarios, when electronic devices use stored passwords to access WiFi networks with the same SSID, they may have problems such as not being able to connect, resulting in cumbersome user operations and reducing user experience.

Method used

By establishing a mapping relationship between BSSID and WiFi password, electronic devices can save passwords of multiple WiFi networks with the same SSID, so as to find the corresponding password based on the BSSID and automatically access the WiFi network.

Benefits of technology

Reduces the scenarios where WiFi network access fails due to password errors, improves users' network usage experience, and ensures stable connections to WiFi networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118474739B_ABST
    Figure CN118474739B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a WiFi connection method and related devices, which relate to the field of terminal technologies and are applied to electronic devices. The method includes: when the electronic device searches for a first WiFi network, accessing the first WiFi network using a first password; wherein, a mapping relationship between the first basic service set identifier (BSSID) of the first WiFi network and the first password is stored in the electronic device; when the electronic device searches for a second WiFi network, accessing the second WiFi network using a second password; wherein, a mapping relationship between the second BSSID of the second WiFi network and the second password is also stored in the electronic device; the service set identifier (SSID) of the first WiFi network and the SSID of the second WiFi network are both the first SSID; the first BSSID is different from the second BSSID; the first password is different from the second password. In this way, scenarios where WiFi network access fails due to different passwords corresponding to multiple WiFi networks with the same SSID can be reduced, improving the user's Internet usage experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technologies, and in particular, to a WiFi connection method and related devices. Background Art

[0002] An electronic device can access the network using a mobile Internet access channel of wireless fidelity (WiFi).

[0003] In a possible implementation, when accessing a new WiFi network, a user can input the password of the WiFi network into the electronic device. The electronic device accesses the WiFi network and stores the password of the WiFi network. Subsequently, when the electronic device turns on the WiFi connection function and searches for the WiFi network, the electronic device can automatically access the WiFi network based on the stored password.

[0004] However, in some scenarios, when the electronic device accesses the WiFi network using the stored password, there may be a problem that the electronic device cannot connect to the WiFi network. Summary of the Invention

[0005] Embodiments of this application provide a WiFi connection method and related devices, which are applied to the field of terminal technologies. By establishing a mapping relationship between a BSSID and a WiFi password, an electronic device can save the passwords of multiple WiFi networks with the same SSID, reduce the scenarios where the WiFi network access fails due to incorrect passwords, and improve the user's Internet experience.

[0006] In a first aspect, an embodiment of this application proposes a WiFi connection method, which is applied to an electronic device. The method includes: when the electronic device searches for a first WiFi network, accessing the first WiFi network using a first password; where a mapping relationship between a first basic service set identifier BSSID of the first WiFi network and the first password is stored in the electronic device; when the electronic device searches for a second WiFi network, accessing the second WiFi network using a second password; where a mapping relationship between a second BSSID of the second WiFi network and the second password is also stored in the electronic device; the service set identifier SSID of the first WiFi network and the SSID of the second WiFi network are both a first SSID; the first BSSID is different from the second BSSID; the first password is different from the second password. In this way, the electronic device can accurately find the corresponding password according to the BSSID of the WiFi network based on the mapping relationship between the BSSID and the password, and use the password to access the WiFi network; it can reduce the scenarios where the WiFi network access fails due to different passwords corresponding to multiple WiFi networks with the same SSID, and improve the user's Internet experience.

[0007] In a possible implementation, after accessing the first WiFi network using the first password, the following steps are further included: searching for a WiFi network with the same SSID as the first one; the BSSID of the WiFi network being the second BSSID; accessing the WiFi network using the first password; in the case where the electronic device fails to access the WiFi network, determining whether the electronic device has accessed the second BSSID; in the case where the electronic device has not accessed the second BSSID, prompting the user to input the second password; in the case where the electronic device receives the operation of the user inputting the second password, saving the mapping relationship between the second BSSID and the second password. In this way, in the case where the second BSSID is an un-stored BSSID, the electronic device can save the relationship among the first SSID, the second BSSID, and the second password, so that the electronic device can subsequently use the second password to access the second WiFi network, reducing the scenario of WiFi network access failure caused by incorrect passwords and enhancing the user's Internet experience.

[0008] In a possible implementation, the mapping relationship table of the electronic device stores the mapping relationship between the first SSID, the BSSIDs of multiple first WiFi networks, and the first password; determining whether the electronic device has accessed the BSSID of the WiFi network includes: searching in the mapping relationship table for the BSSIDs of multiple first WiFi networks corresponding to the first SSID; searching among the BSSIDs of multiple first WiFi networks for whether there is a second BSSID. In this way, the electronic device can search for the second BSSID among the stored BSSIDs, so as to subsequently establish the mapping relationship between the second BSSID and the second password.

[0009] In a possible implementation, saving the mapping relationship between the second BSSID and the second password includes: saving the mapping relationship among the first SSID, the second BSSID, and the second password in the mapping relationship table; wherein, in the mapping relationship table, the BSSIDs corresponding to the first SSID include the second BSSID and the BSSIDs of multiple first WiFi networks; wherein, the BSSIDs of multiple first WiFi networks all have a mapping relationship with the first password, and the second BSSID has a mapping relationship with the second password. In this way, the electronic device can save the mapping relationship between multiple WiFi networks with the same SSID and multiple passwords, so as to subsequently be able to accurately use the corresponding password to access the WiFi network.

[0010] In a possible implementation, prompting the user to enter a second password includes: popping up a prompt message on the first interface; wherein, the pop-up window includes the first SSID, the prompt message, an input area for the WiFi password, and a first button; the prompt message is used to indicate that the user's WiFi password is incorrect and to re-enter the WiFi password; the first button is used to indicate connecting to the WiFi network with the same SSID as the first SSID; and / or, displaying a notification message on the first interface; the notification message includes the first SSID and the prompt message. In this way, when the WiFi network connection fails during reconnection, the electronic device can promptly remind the user to enter the WiFi password, so as to save the mapping relationship based on the password entered by the user subsequently.

[0011] Wherein, the first interface may correspond to Figure 8 the interface shown in b of Figure 9 the interface shown in a of Figure 10 and / or the interface shown in Figure 8 the connection button 805 in the interface shown in b of Figure 9 the connection button 905 in the interface shown in b of Figure 10 and / or the connection button 1005 in

[0012] In a possible implementation, after the electronic device searches for the second WiFi network, it includes: searching for the second BSSID in the mapping relationship table to obtain the second password corresponding to the second BSSID. In this way, the electronic device can accurately find the corresponding password in the mapping relationship table using the BSSID, improving the success rate of WiFi network connection and enhancing the user experience.

[0013] In a possible implementation, searching for the second BSSID in the mapping relationship table includes: respectively obtaining the number of WiFi passwords corresponding to the first SSID and the number of BSSIDs in the mapping relationship table; when the number of WiFi passwords corresponding to the first SSID is greater than 1 and the number of BSSIDs corresponding to the first SSID is less than or equal to the first preset value, searching for the second BSSID among the BSSIDs corresponding to the first SSID. In this way, when the number of BSSIDs corresponding to the same SSID is small, the electronic device can quickly access the WiFi network by querying the BSSID, improving the network connection efficiency and enhancing the user experience.

[0014] In a possible implementation, after the electronic device searches for the second Wi-Fi network, it further includes: obtaining the number of Wi-Fi passwords corresponding to the first SSID and the number of BSSIDs in the mapping relation table respectively; in the case that the number of Wi-Fi passwords corresponding to the first SSID is greater than 1 and less than or equal to a second preset value, and the number of BSSIDs corresponding to the first SSID is greater than a first preset value, using any password corresponding to the first SSID to attempt to access the second Wi-Fi network; the passwords corresponding to the first SSID include: a first password and a second password; if the access to the second Wi-Fi network fails, using the other password corresponding to the first SSID except any password to attempt to access the second Wi-Fi network; until successfully accessing the second Wi-Fi network with the second password. In this way, when the number of BSSIDs corresponding to the same SSID is large and the corresponding Wi-Fi passwords are few, the electronic device can attempt to traverse the passwords to quickly access the Wi-Fi network, reduce the time for traversing and querying BSSIDs, improve the network connection efficiency, and enhance the user experience.

[0015] In a possible implementation, after accessing the first Wi-Fi network with the first password, it further includes: searching for the Wi-Fi network with the same first SSID again; the BSSID of the Wi-Fi network is the first BSSID; accessing the Wi-Fi network with the first password; in the case that the electronic device fails to access the Wi-Fi network, determining whether the electronic device has accessed the first BSSID; in the case that the electronic device has accessed the first BSSID, prompting the user to input a third password; in the case that the electronic device receives the operation of the user inputting the third password, updating the mapping relation between the first BSSID and the first password to the mapping relation between the first BSSID and the third password. In this way, when the first BSSID is a previously saved BSSID, the electronic device can update the mapping relation between the first BSSID and the password, improving the accuracy of the mapping relation.

[0016] In a possible implementation, it further includes: in the case that the electronic device searches for the third Wi-Fi network, accessing the third Wi-Fi network with the fourth password; wherein, the mapping relation between the third BSSID and the fourth password of the third Wi-Fi network is stored in the electronic device; the third SSID of the third Wi-Fi network is different from the first SSID. In this way, in the case that one SSID corresponds to one Wi-Fi network, the electronic device can also use the mapping relation table to access the Wi-Fi network, enriching the connection methods of the Wi-Fi network.

[0017] In a possible implementation, after the electronic device detects a third Wi-Fi network, it includes: obtaining the number of Wi-Fi passwords corresponding to the third SSID in the mapping relation table; when the number of Wi-Fi passwords corresponding to the third SSID is 1, obtaining the fourth password corresponding to the third SSID. In this way, when one SSID corresponds to one Wi-Fi network, the electronic device can quickly access the Wi-Fi network using the password corresponding to the SSID, reducing the time for traversing BSSIDs, improving the network connection efficiency, and enhancing the user experience.

[0018] In a possible implementation, in the mapping relation table, the mapping relation corresponding to the first SSID further includes the following parameters: a first geofence and a second geofence; the first geofence includes the coverage area of the first Wi-Fi network, and the first geofence corresponds to the first password; the second geofence includes the coverage area of the second Wi-Fi network, and the second geofence corresponds to the second password; after the electronic device detects the second Wi-Fi network, it further includes: obtaining the location of the electronic device; accessing the second Wi-Fi network using the second password, including: when the electronic device is located within the second geofence, accessing the second Wi-Fi network using the second password corresponding to the second geofence. In this way, the electronic device can also use geofences to distinguish between the first Wi-Fi network and the second Wi-Fi network, reducing the time for traversing BSSIDs, improving the network connection efficiency, and enhancing the user experience.

[0019] In a possible implementation, there is a partially overlapping area between the first geofence and the second geofence. After the electronic device detects the second Wi-Fi network, it further includes: when the electronic device is located within the overlapping area between the first geofence and the second geofence, searching for the second BSSID in the mapping relation table to obtain the second password corresponding to the second BSSID; and accessing the second Wi-Fi network using the second password. In this way, when the first Wi-Fi network and the second Wi-Fi network cannot be distinguished using geofences, the electronic device can accurately distinguish between the first Wi-Fi network and the second Wi-Fi network through the BSSID and access the Wi-Fi network using the corresponding password.

[0020] In a second aspect, embodiments of the present application provide an electronic device, which may also be referred to as a terminal device, a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The electronic device may be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, and so on.

[0021] The electronic device includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method in the first aspect.

[0022] In a third aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the method in the first aspect is implemented.

[0023] In a fourth aspect, embodiments of the present application provide a computer program product including a computer program. When the computer program is run, a computer is caused to execute the method in the first aspect.

[0024] In a fifth aspect, embodiments of the present application provide a chip including a processor, and the processor is used to call a computer program in a memory to execute the method in the first aspect.

[0025] It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar and will not be elaborated herein. Description of the Drawings

[0026] Figure 1 Schematic diagram of a WiFi connection interface in a possible implementation;

[0027] Figure 2Schematic diagram of a communication system provided by an embodiment of the present application;

[0028] Figure 3 Another schematic diagram of a communication system provided by an embodiment of the present application;

[0029] Figure 4 Schematic diagram of the structure of electronic device 100 provided by an embodiment of the present application;

[0030] Figure 5 Software structure block diagram of electronic device 100 provided by an embodiment of the present application;

[0031] Figure 6 Schematic flowchart of a WiFi connection method provided by an embodiment of the present application;

[0032] Figure 7 Another schematic flowchart of a WiFi connection method provided by an embodiment of the present application;

[0033] Figure 8 Schematic interface diagram of a WiFi connection method provided by an embodiment of the present application;

[0034] Figure 9 Another schematic interface diagram of a WiFi connection method provided by an embodiment of the present application;

[0035] Figure 10 Another schematic interface diagram of a WiFi connection method provided by an embodiment of the present application;

[0036] Figure 11 Another schematic flowchart of a WiFi connection method provided by an embodiment of the present application;

[0037] Figure 12 Schematic flowchart of a WiFi connection method provided by an embodiment of the present application;

[0038] Figure 13 Schematic diagram of the structure of a WiFi connection device provided by an embodiment of the present application. Detailed implementation manners

[0039] To facilitate a clear description of the technical solutions of the embodiments of the present application, the following briefly introduces some terms and technologies involved in the embodiments of the present application:

[0040] 1) Station (STA): An electronic device equipped with a wireless network connection function.

[0041] 2) Access Point (AP): A device with wireless-to-wired bridging functionality; the AP is a key node for STAs to access the upper-layer network. In the embodiments of this application, the AP can be understood as a router and / or a base station.

[0042] 3) Distribution System (DS): The coverage area of a WiFi network is related to the physical layer coverage area of the AP, and the physical layer coverage area of the AP determines the direct communication distance between STAs. In some scenarios, the coverage area of a single AP is small. For example, the AP in a home scenario; while for public places such as schools, shopping malls, and subway stations, the physical layer coverage area of a single AP is small. To expand the coverage area, multiple APs can be connected to enable mutual communication. The logical component that connects multiple APs can be understood as a distribution system.

[0043] 4) Basic Service Set (BSS): The basic building block of an 802.11 wireless local area network, consisting of a group of workstations and access points that communicate with each other. For example, a BSS can include an AP and all STAs within the service range of that AP.

[0044] 5) Basic Service Set Identifier (BSSID): Used to represent the identifier of the BSS. The BSSID corresponds to the AP, and the BSSID can be understood as the physical address (also known as the MAC address) of the AP in the BSS.

[0045] 5) Extended Service Set (ESS): An ESS network can include multiple BSS networks. Among them, multiple BSSs are placed adjacent to each other, and the APs in multiple BSSs are interconnected through the DS. The ESS can include the AP in any BSS and multiple STAs in any BSS. STAs can complete communication within the same ESS, and STAs can move within the coverage areas of multiple BSSs subordinate to the ESS.

[0046] It can be understood that the coverage area of a BSS network is small. For public places such as schools, shopping malls, and subway stations, a large-scale network coverage can be achieved by setting up an ESS.

[0047] 6) Service Set Identifier (SSID): The SSID is used to represent the identifier of the ESS. Among them, the SSID can be understood as the name of the WiFi network.

[0048] 7) Others

[0049] For the convenience of clearly describing the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.

[0050] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (item)" or similar expressions thereof refer to any combination of these items, including any combination of single items or plural items. For example, at least one (item) of a, b, or c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, and c may be single or multiple.

[0051] It should be noted that "when... " in the embodiments of the present application may be at the instant when a certain situation occurs or within a period of time after a certain situation occurs. The embodiments of the present application do not make specific limitations on this. In addition, the display interface provided in the embodiments of the present application is only an example, and the display interface may also include more or less content.

[0052] The electronic device may support WiFi communication. For example, in Scenario 1, the office area of Company A can provide WiFi network services, and the WiFi name of Company A is "CAT". When the user is located in Company A, the user's electronic device can access the WiFi network of Company A. The access process may be as follows:

[0053] The electronic device can enter the interface as shown in a in Figure 1 based on the wireless local area network (WLAN) setting item in the settings application or the drop - down menu interface. In the interface as shown in a in Figure 1 , the WLAN switch button 101 is in the on state, and the electronic device displays the WiFi names that can be searched in the current area. For example, the button 102 for accessing the "CAT" WiFi network and the button for accessing the "CMCC - XXXX" WiFi network. When the electronic device receives a trigger operation for the button 102, the electronic device enters the interface as shown in b in Figure 1 .

[0054] In Figure 1 In the interface shown in b, the electronic device displays a WiFi password input pop-up window, which includes the WiFi name and the password input box 103. The user can enter the password corresponding to the WiFi in the password input box 103. For example, the password is 88888888. When the electronic device receives a trigger operation for the connection button 104, the electronic device enters Figure 1 the interface shown in c. Figure 1 In the interface shown in c, the electronic device displays that it has connected to the WiFi network "CAT", and the electronic device can use this network for online services; and the electronic device can save the WiFi name as "CAT" and the corresponding password as 88888888.

[0055] For another example, in Scenario 2, Company A can provide WiFi network services, and the WiFi name of Company A is "CAT". The electronic device has previously connected to the wireless network with the WiFi name "CAT" and stored the password of this WiFi, and the WiFi network of Company A has not changed the password. When the user enters Company A again, if the WLAN switch button in the electronic device is in the on state, the electronic device automatically connects to the "CAT" WiFi network. The electronic device can use this network for online services.

[0056] However, in a possible implementation, the following problem scenario may occur: The WiFi name of Company A and the corresponding WiFi password are stored in the user's electronic device, the WLAN switch button of the electronic device is in the on state, and neither the WiFi name nor the WiFi password of Company A has changed. When the user enters Company A with the electronic device, the electronic device cannot connect to the wireless network with the WiFi name "CAT".

[0057] The reason for the above problem scenario may be that the name of the WiFi network at the user's home is the same as the name of the WiFi network at the user's company, but the password of the WiFi network at the user's home is different from the password of the WiFi network at the user's company. For example, the WiFi name of Company A is "CAT" and the WiFi password is 88888888; the WiFi name at the user's home is "CAT" and the WiFi password is 66666666.

[0058] When the user is in Company A, the electronic device uses the WiFi password 88888888 to access the WiFi "CAT" of Company A, and the electronic device saves the mapping relationship between the WiFi name "CAT" and the WiFi password 88888888 to ensure that it can automatically connect to the wireless network of Company A when entering Company A next time.

[0059] After the user returns home from Company A, the electronic device retrieves a wireless network with the WiFi name "CAT" around the home, and the electronic device uses the WiFi password 88888888 to connect to the "CAT" wireless network. However, since this WiFi password is inconsistent with the home WiFi password, the electronic device fails to connect to the wireless network with the WiFi name "CAT". At this time, the user can enter the home WiFi password 66666666 in the electronic device based on the interface shown in Figure 1 as shown in b, and the electronic device can connect to the "CAT" wireless network at home based on the WiFi password 66666666. The electronic device saves the mapping relationship between the WiFi name "CAT" and the WiFi password 66666666.

[0060] When the user comes to Company A again, the electronic device uses the WiFi password 66666666 to connect to the "CAT" wireless network. However, since this WiFi password is inconsistent with the Company A WiFi password, the electronic device fails to connect to the wireless network with the WiFi name "CAT".

[0061] Therefore, when the WiFi names of multiple locations are the same but the WiFi passwords are all different, the electronic device can only retain the mapping relationship between the WiFi name and password of one location. The WiFi password in the mapping relationship cannot match the WiFi passwords of other locations among multiple locations. When the electronic device is located in other locations, it cannot automatically connect to the wireless network. If the electronic device accesses the wireless network of other locations based on a new password, the electronic device will update the mapping relationship. Subsequently, although the electronic device is within the coverage area of the previously connected WiFi network, but the mapping relationship of the electronic device has been updated, the electronic device may not be able to automatically connect to the previously accessed wireless network.

[0062] It can be understood that in a possible implementation, when the electronic device saves the WiFi network, it distinguishes according to the SSID (WiFi name) and saves the corresponding WiFi password. When the SSIDs of two locations are the same but the ranges of the two locations do not belong to the same ESS, the electronic device cannot distinguish the wireless networks corresponding to the two locations according to the SSID. For example, in a possible implementation, the mapping relationship of the WiFi network can be as shown in Table 1:

[0063] Table 1 In a possible implementation, the mapping relationship between the SSID and password of the WiFi network.

[0064] SSID Password SSID 1 Password 1 SSID 2 Password 2 SSID 3 Password 3 … … SSID n Password n

[0065] Among them, in Table 1, each SSID has a uniquely corresponding password. For example, SSID 1 corresponds to password 1; SSID 2 corresponds to password 2, and so on. Therefore, when there are scenarios where the SSIDs of multiple locations are the same but the passwords are different, the electronic device can only store the mapping relationship between the SSID and one password. This results in the situation where when the password does not correspond to the location, the electronic device cannot automatically connect to the wireless network using this password. The user needs to re-enter the password to access the wireless network, which is cumbersome for the user and reduces the user experience.

[0066] In view of this, the embodiments of the present application provide a WiFi connection method by saving the mapping relationship between each WiFi network and the corresponding WiFi password. For example, a WiFi network can be managed by an AP. Among them, the BSSID can be used to identify the AP, and the BSSIDs of different APs are also different. The electronic device can save the correspondence between the BSSID and the password. When the electronic device reconnects to a previously connected WiFi network, the electronic device can find the corresponding password through the BSSID of the WiFi network and use this password to connect to the WiFi network. In this way, when the names of two WiFi networks are the same, the electronic device can find the corresponding passwords according to the respective BSSIDs of the two WiFi networks and use the passwords to connect to the corresponding WiFi networks, reducing the scenarios where the WiFi network connection fails due to incorrect passwords and improving the user's network usage experience.

[0067] Before explaining the technical solution of the embodiments of the present application, first in combination with Figure 2 and Figure 3 explain the communication system in the embodiments of the present application. Figure 2 Shows a schematic diagram of a communication system applicable to the embodiments of the present application. As Figure 2 shown:

[0068] The communication system may include a network device 201 and an electronic device. The network device 201 may also be referred to as an access network device, which is an entity on the network side for transmitting or receiving signals. For example, the network device 201 may be an AP, an LTE base station, such as an evolved NodeB (eNB or e-NodeB), or an NR base station, such as a new radio controller (NRcontroller), a gNB. Alternatively, the network device may also be a centralized unit, a radio remote head, a micro base station, a relay, a distributed unit, a transmission reception point (TRP), or a transmission point (TP), or any other wireless access device, etc., and the embodiments of the present application do not limit this.

[0069] The electronic device may also be referred to as a terminal device, a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The terminal device may be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, and so on.

[0070] Among them, wearable devices, also known as wearable intelligent devices, are the general term for devices developed by applying wearable technologies to the intelligent design of daily wear, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are directly worn on the body or integrated into the user's clothes or accessories. Wearable devices are not only a kind of hardware device, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable intelligent devices include those with complete functions and large sizes that can achieve complete or partial functions without relying on a smartphone, such as smart watches or smart glasses, as well as those that only focus on a certain type of application function and need to cooperate with other devices such as smartphones, such as various smart bracelets and smart jewelry for physical sign monitoring.

[0071] In addition, in the embodiments of the present application, the electronic device may also be an electronic device in an Internet of Things (IoT) system. The IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network of human-machine interconnection and object-object interconnection. The embodiments of the present application do not limit the specific technologies and specific device forms adopted by the electronic device.

[0072] Specifically, in this communication system, the number of electronic devices can be one or more. For example, the electronic devices include electronic device 202 and electronic device 203. The coverage area of the WiFi network provided by the network device 201 can be BSS204. Taking a scenario as an example, for a small-scale place such as a family household, a single network device can well cover the user's network usage area. There is one network device 201 in the family household, such as a router; the network device 201 provides WiFi services for multiple electronic devices. For example, electronic device 202 is a laptop computer, and electronic device 203 is a mobile phone.

[0073] In a small-scale place such as a family household, the SSID of the WiFi network provided by the network device 201 can be the WiFi name. The SSID includes 1 BSSID, and the BSSID can be the mac address of the network device 201.

[0074] For large-scale places such as companies, shopping malls, and schools, the coverage ability of a single network device is limited, and multiple network devices can be used to expand the coverage area of the WiFi network. The communication system can be as Figure 3 shown:

[0075] The communication system includes multiple network devices and multiple electronic devices. For example, the network devices include network device 301 and network device 302, and network device 301 and network device 302 are connected via DS 303. Among them, network device 301 can provide WiFi services for electronic devices 304 and 305, and the coverage area of network device 301 is BSS 306; network device 302 can provide WiFi services for electronic devices 307 and 308, and the coverage area of network device 302 is BSS 309. The areas covered by network device 301 and network device 302 can be ESS 310, and ESS 310 can include BSS 306 and BSS 309.

[0076] In such a large venue, the WiFi network provided by network device 301 and the WiFi network provided by network device 302 are the same WiFi network, which can also be understood as the same ESS 310 network; the SSID of the WiFi network provided by network device 301 and the SSID of the WiFi network provided by network device 302 are the same, and both are the WiFi name of this WiFi network. The SSID includes multiple BSSIDs. For example, BSSID 1 can be the mac address of network device 301, and BSSID 2 can be the mac address of network device 302.

[0077] To better understand the embodiments of the present application, the structure of the electronic device in the embodiments of the present application will be introduced below:

[0078] Figure 4The structural schematic diagram of the electronic device 100 is shown. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a subscriber identification module (SIM) card interface 195, and an embedded secure element (eSE), etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0079] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0080] In the embodiments of the present application, the processor 110 may be used to execute the processes related to information processing in the WiFi connection method.

[0081] The wireless communication function of the electronic device 100 may be implemented through the antenna 2, the wireless communication module 160, etc.

[0082] The antenna 2 is used to transmit and receive electromagnetic wave signals. The antennas in the electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas may also be multiplexed to improve the utilization rate of the antennas. For example: the antenna 2 may be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna may be used in combination with a tuning switch.

[0083] In an embodiment of the present application, the electronic device can communicate with the network device through the antenna 2 and the wireless communication module 160. For example, the antenna 2 and the wireless communication module 160 of the electronic device 100 can receive the beacon frame of the network device; the electronic device 100 can send the SSID and password of the WiFi network to the network device based on the antenna 2 and the wireless communication module 160.

[0084] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0085] In the embodiment of the present application, when the WiFi network connection fails, the electronic device 100 may display a prompt message through the display screen 194 , and the prompt message is used to prompt the user to re-enter the password.

[0086] In the embodiment of the present application, the internal memory 121 may be used to execute storage-related steps in the WiFi connection method. For example, the internal memory 121 may store a mapping relationship between a WiFi network and a WiFi password.

[0087] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.

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

[0089] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system may include: application layer (applications), application framework layer (application framework), hardware abstract layer (hardware abstract layer, HAL) and kernel layer (kernel), where the kernel layer may become the driver layer.

[0090] The application layer can include a series of application packages.

[0091] like Figure 5 As shown, the application package may include a settings application. The settings application includes a function for setting up a WiFi network.

[0092] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.

[0093] As Figure 5 shown, the application framework layer may include a WiFi module. In the embodiments of the present application, the WiFi module can be used to manage the WiFi network. For example, the WiFi module can save the mapping relationship between the WiFi network and the WiFi password, search for the WiFi password in the mapping relationship table, and send down the WiFi password, etc.

[0094] The hardware abstraction layer may include a library module, and the library module can be, for example, a WiFi hardware abstraction (HAL) module. The Android system can load the corresponding library module for the device hardware, thereby achieving the purpose of the application framework layer accessing the device hardware.

[0095] The kernel layer is the layer between the hardware and the software. The kernel layer is used to drive the hardware to make it work. The kernel layer may include a WiFi driver. The hardware layer may include a WiFi chip, and the WiFi chip can receive and / or send WiFi data based on the antenna. For example, the WiFi data includes beacon frames, the SSID of the WiFi network, the BSSID of the WiFi network, and the WiFi password, etc.

[0096] Next, in combination with Figure 5 the following, the possible implementation manners of the WiFi connection method in the embodiments of the present application will be described.

[0097] In a possible implementation manner, the WiFi chip searches periodically to receive beacon frames from network devices. After the WiFi chip searches for a WiFi network, it reports the SSID and BSSID of the WiFi network to the settings application through the WiFi driver, the WiFi HAL module, and the WiFi module. The settings application provides an interactive interface for the WiFi networks that support access.

[0098] When the settings application receives an operation for accessing a WiFi network, the settings application sends down the WiFi password to the WiFi module. The WiFi module saves the mapping relationship between the WiFi password, the BSSID, and the SSID, and sends down the WiFi password and the SSID of the WiFi network to the WiFi chip through the WiFi HAL module and the WiFi driver. The WiFi chip sends the WiFi password and the SSID of the WiFi network to the network device to request network connection.

[0099] In the embodiments of the present application, the electronic device can save the mapping relationship between the WiFi network and the password. In the embodiments of the present application, two WiFi networks with the same SSID can be distinguished by the first WiFi network and the second WiFi network. For example, the SSIDs of the first WiFi network and the second WiFi network are both the first SSID; where the BSSID of the first WiFi network includes the first BSSID, the BSSID of the second WiFi network includes the second BSSID, and the BSSID of the first WiFi network is different from the BSSID of the second WiFi network. Below, taking the first WiFi network as the company's WiFi network and the second WiFi network as the WiFi network at home as an example, the execution process of the WiFi network connection method in the embodiments of the present application will be introduced through three scenarios.

[0100] Scenario 1: When the user arrives at the company for the first time and uses the electronic device to access the first WiFi network of the company; the electronic device can save the mapping relationship between the first SSID and the first password.

[0101] Scenario 2: The electronic device searches for a WiFi network with the same SSID as the first SSID; the electronic device uses the first password to access the WiFi network, but the access fails; after the electronic device receives the new password input by the user, it adds or updates the mapping relationship between the first SSID and the new password.

[0102] The electronic device searches for a WiFi network with the same SSID as the first SSID; for example, when the user is at home, the electronic device searches for the second WiFi network; or when the user comes to the company again, the electronic device searches for the first WiFi network.

[0103] Scenario 3: The mapping relationship table of the electronic device stores the mapping relationship related to the first WiFi network and the mapping relationship related to the second WiFi network; the electronic device accesses the corresponding WiFi network using the corresponding password according to the mapping relationship table.

[0104] The above three scenarios will be elaborated below.

[0105] Specifically, in Scenario 1, when the user arrives at the company for the first time and uses the electronic device to access the first WiFi network of the company; the electronic device can save the mapping relationship between the first SSID and the first password.

[0106] Below in combination with Figure 6 the process of the electronic device accessing the WiFi network for the first time and the process of saving the mapping relationship in the embodiments of the present application will be described, as Figure 6 shown:

[0107] S601. The electronic device displays a first interface; the first interface may include a second button and a third button; wherein the second button is in an on state, and when the second button is in an on state, the electronic device can access a WiFi network; the third button is used to indicate an accessible WiFi network.

[0108] The first interface can be, for example, Figure 1 The interface shown in a in FIG; the second button may correspond to the WLAN switch button 101, and the third button includes a button 102 for accessing a "CAT" WiFi network.

[0109] The electronic device may search for a first WiFi network, and the first SSID may be "CAT".

[0110] S602: The electronic device receives a trigger operation for a third button.

[0111] Accordingly, in Figure 1 In the interface shown in a, the electronic device receives a trigger operation of the user clicking button 102.

[0112] S603: In response to the triggering operation on the third button, the electronic device displays a pop-up window in the first interface.

[0113] Pop-ups can be used, for example Figure 1 The WiFi password input pop-up window in the interface shown in b.

[0114] S604: The electronic device receives a first password input by a user and receives a trigger operation for a first button.

[0115] The first password is such as a company password, and the first button is such as Figure 1 The connection button 104 in the interface shown in b.

[0116] S605: The electronic device initiates a connection request to the network device based on the first password and the first SSID.

[0117] The first SSID may be the name of the first WiFi network, for example, CAT. The network device may be an AP. The first SSID may be obtained by the electronic device based on a broadcast frame (beacon) of the network device.

[0118] S606: The electronic device saves a mapping relationship between the first SSID, the BSSID of the first WiFi network, and the first password.

[0119] In the embodiment of the present application, the mapping relationship table between WiFi networks and WiFi passwords can be shown in Table 2:

[0120] Table 2 is a mapping table of WiFi networks and passwords in an embodiment of the present application.

[0121]

[0122] Among them, for small places such as homes and convenience stores, the network coverage ability of a single AP can meet the Internet access needs of electronic devices in the above-mentioned places. If an electronic device has accessed the WiFi network in these places, the electronic device can store the mapping relationship between the WiFi network and the password; among them, the mapping relationship between the WiFi network and the password includes an SSID, a BSSID, and a WiFi password. For example, in Table 2: the mapping relationship between SSID1, BSSID1, and Password 1.

[0123] For large places such as companies, shopping malls, and airports, multiple APs are required for DS communication interconnection to expand the coverage of the WiFi network. If an electronic device has accessed the WiFi network in these places, the electronic device can store the mapping relationship between the WiFi network and the password; among them, the mapping relationship between the first WiFi network and the first password includes an SSID, multiple BSSIDs, and a WiFi password. For example, in Table 2: the first SSID is SSID3, there are 3 APs under the first WiFi network, and the BSSIDs of the 3 APs are BSSID 2, BSSID 4, and BSSID 5 respectively, and these BSSIDs all correspond to the first password (Password 3).

[0124] Subsequently, when the user enters these places again, when the electronic device searches for an available WiFi network and detects that the SSID of the available WiFi network is included in the mapping relationship, the electronic device can automatically access the WiFi network using the password corresponding to the SSID.

[0125] And / or, when the user enters these places again, when the electronic device searches for an available WiFi network and detects that the BSSID of the available WiFi network is included in the mapping relationship, the electronic device can automatically access the WiFi network using the password corresponding to the BSSID.

[0126] It can be understood that in the embodiments of the present application, to improve the efficiency of accessing the WiFi network and reduce the power consumption of the electronic device, when the electronic device searches for a WiFi network and finds that the number of WiFi passwords corresponding to the SSID of the WiFi network in the mapping relationship table is 1, the electronic device can use the WiFi password corresponding to the SSID to access the WiFi network. In this way, when one SSID in the mapping relationship table corresponds to multiple BSSIDs and one SSID corresponds to one password, the electronic device can access the WiFi network using the SSID and password without traversing multiple BSSIDs, thereby saving the network connection time and reducing the power consumption of the electronic device.

[0127] Scenario 2: The electronic device searches for a WiFi network with the same first SSID; the electronic device uses the first password to access the WiFi network, but the access fails; after the electronic device receives the new password input by the user, it adds or updates the mapping relationship between the first SSID and the new password.

[0128] In one embodiment, in the WiFi network reconnection scenario, the reason why the electronic device cannot automatically access the WiFi network using the saved password can be that the network device side updates the password of the WiFi network, and the old password stored in the electronic device is different from the newly set password, resulting in the electronic device being unable to access the WiFi network using the old password.

[0129] In another embodiment, in the WiFi network reconnection scenario, the reason why the electronic device cannot automatically access the WiFi network using the saved password can be that the names of two WiFi networks are the same, but the passwords are different; the password stored in the electronic device does not match the WiFi network to be connected, resulting in the electronic device being unable to access the WiFi network using this password.

[0130] The following combines Figure 7 and the above two situations to describe the process of the electronic device saving the mapping relationship in the embodiments of the present application, as Figure 7 shown:

[0131] S701: The electronic device searches for a WiFi network with the same first SSID.

[0132] The electronic device can periodically receive the beacon frames sent by the network device. When the electronic device searches for a WiFi network with the same first SSID, the electronic device can obtain the first SSID and the BSSID of this WiFi network from the beacon frame.

[0133] It can be understood that the WiFi network with the same first SSID can be the first WiFi network or the second WiFi network. The BSSID of this WiFi network can be the first BSSID or the second BSSID. In one possible implementation, this WiFi network is the first WiFi network, and the BSSID of this WiFi network is the first BSSID; in another possible implementation, this WiFi network is the second WiFi network, and the BSSID of this WiFi network is the second BSSID.

[0134] S702: The electronic device uses the first password to access the WiFi network.

[0135] In step S702, the mapping relationship table can be as shown in Table 2: The electronic device obtains a first SSID (such as SSID 3), and a password (such as password 3) corresponds to the first SSID. The electronic device can use the first password to access the WiFi network that is the same as the first SSID.

[0136] It can be understood that in the mapping relationship, one SSID corresponds to one password. To improve the network connection efficiency, when the electronic device queries that the number of passwords corresponding to the SSID is 1, the electronic device uses this password to access the WiFi network, rather than obtaining the password of the WiFi network by traversing the BSSID. For example, when the electronic device queries that the number of passwords corresponding to SSID 3 is 1, the electronic device uses password 3 to access the WiFi network, without the need to query BSSID 3, BSSID 4, and BSSID 5.

[0137] Optionally, the electronic device sends a network connection request to the network device, and the first SSID and the first password are carried in the network connection request.

[0138] Among them, the network connection request can include a probe request, an authentication request, and an association request.

[0139] S703. In the case where the electronic device fails to access the WiFi network, determine whether the electronic device has accessed the BSSID of this WiFi network.

[0140] Optionally, before determining whether the electronic device has accessed the BSSID of this WiFi network, it further includes: The electronic device receives a first instruction from the network device, and the first instruction is used to indicate that the password is incorrect and the first WiFi network cannot be accessed.

[0141] It can be understood that when the network connection fails due to an incorrect password, it can be solved by the WiFi connection method of the embodiments of the present application; when the network connection fails due to other reasons, the electronic device may not be able to solve this problem through the mapping relationship table. Here, after determining that the network connection fails due to an incorrect password, the electronic device can determine whether the electronic device has accessed the BSSID of this WiFi network.

[0142] It should be noted that when the WiFi network is the second WiFi network, the reason why the electronic device fails to access the WiFi network may be that: the mapping relationship between the second WiFi network and the second password is not stored, and the first SSID in the mapping relationship table includes the first password of the first wireless network, but does not include the second password of the second wireless network. When the WiFi network is the first WiFi network, the reason why the electronic device fails to access the WiFi network may be that: the password of the first WiFi network is updated, and the old password is different from the new password.

[0143] The mapping relationship between the first SSID, the BSSIDs of the multiple first WiFi networks, and the first password is stored in the mapping relationship table of the electronic device; judging whether the electronic device has accessed the BSSID of the WiFi network includes: when the WiFi network is the second WiFi network, finding the BSSIDs of the multiple first WiFi networks corresponding to the first SSID in the mapping relationship table; finding whether there is a second BSSID among the BSSIDs of the multiple first WiFi networks. Alternatively, when the WiFi network is the first WiFi network, finding the BSSIDs of the multiple first WiFi networks corresponding to the first SSID in the mapping relationship table; finding whether there is a first BSSID among the BSSIDs of the multiple first WiFi networks.

[0144] When the WiFi network is the second WiFi network, the electronic device may perform steps S704-S706; illustratively:

[0145] S704: If the electronic device has never accessed the second BSSID, prompt the user to enter a second password.

[0146] If the electronic device does not find the second BSSID in the mapping relationship, it means that the electronic device has not previously accessed the second WiFi network, and there is no mapping relationship related to the second BSSID in the mapping relationship.

[0147] It can be understood that, taking Table 2 as an example, the mapping relationship stored in the electronic device can be a first SSID (e.g., SSID3), multiple BSSIDs of the first WiFi network (e.g., BSSID 3, BSSID 4, and BSSID 5) and a first password (e.g., password 3), wherein the SSID of the first WiFi network is the same as the SSID of the second WiFi network, for example, the SSIDs of the two WiFi networks are both SSID 3; but the first password of the first WiFi network is different from the second password of the second WiFi network, for example, the password of the second WiFi network is password 4, and the password of the first WiFi network is password 3. In step S701, the electronic device uses SSID 3 and password 3 to initiate a connection request to the second WiFi network, and password 3 is not the password of the second WiFi network, so it cannot connect to the second WiFi network.

[0148] In this case, the BSSID of the first Wi-Fi network is different from that of the second Wi-Fi network. For example, the BSSIDs of the first Wi-Fi network include BSSID 3, BSSID 4, and BSSID 5, and the BSSID of the second Wi-Fi network is BSSID 6. The electronic device cannot find BSSID 6 in the mapping relationship. At this time, the electronic device can prompt the user to re-enter the password through a prompt message to connect to the second Wi-Fi network. The display method of the prompt message will be described in combination with the interface schematic diagram in the embodiments of the present application and will not be described here for the time being.

[0149] S705. When the electronic device receives the operation of the user inputting the second password, save the mapping relationship between the second BSSID and the second password.

[0150] Specifically, save the mapping relationship between the first SSID, the second BSSID, and the second password in the mapping relationship table; wherein, in the mapping relationship table, the BSSIDs corresponding to the first SSID include the second BSSID and the BSSIDs of multiple first Wi-Fi networks; wherein, the BSSIDs of multiple first Wi-Fi networks all have a mapping relationship with the first password, and the second BSSID has a mapping relationship with the second password.

[0151] The second BSSID is, for example, BSSID 6, and the second password is, for example, password 4. In the embodiments of the present application, the mapping relationship between the added Wi-Fi network and the password can be as shown in Table 3:

[0152] Table 3. In the embodiments of the present application, the mapping relationship table between the Wi-Fi network and the Wi-Fi password.

[0153]

[0154] It can be seen that under SSID 3, there are the BSSIDs of multiple first Wi-Fi networks and BSSID 6. Among them, the BSSIDs of multiple first Wi-Fi networks correspond to password 3, and BSSID 6 corresponds to password 4.

[0155] It should be noted that in the above mapping relationship, the list mapped to the real SSID can be used to distinguish different WiFi networks. For example, SSID 3 includes real_SSID 3a and real_SSID 3b, where the first WiFi network can be, for example, real_SSID 3a, and the second WiFi network can be, for example, real_SSID 3b. In actual networking scenarios, mapping to the real SSID and BSSID can be used to assist electronic devices to quickly and accurately find the password corresponding to the SSID of the WiFi network; however, when sending a networking request, the electronic device will not send the mapping to the real SSID to the network device.

[0156] S706: The electronic device accesses the second WiFi network using the first SSID and the second password.

[0157] The embodiment of the present application does not limit the order of step S706 and step S705. For example, when the electronic device receives an operation in which the user inputs the second password, the electronic device may first access the second WiFi network and then save the mapping relationship; these two steps may also be performed simultaneously.

[0158] Alternatively, when the WiFi network is the first WiFi network, the electronic device may execute steps S707-S709; illustratively, after step S703, the following may also be included:

[0159] S707: If the electronic device has accessed the first BSSID, prompt the user to enter a third password.

[0160] If the electronic device finds the first BSSID in the mapping relationship, it means that the electronic device has previously accessed the first WiFi network, and the mapping relationship of the first BSSID is stored in the mapping relationship. However, if the electronic device cannot access the first WiFi network based on the first password in the mapping relationship, it means that the first password in the mapping relationship is incorrect. The user may have modified the new password on the network device side, and the new password is inconsistent with the old password, resulting in a connection failure.

[0161] It can be understood that, taking Table 3 as an example, in the mapping relationship table, there is a mapping relationship between the first SSID (e.g., SSID3) and the first password (e.g., password 3) and the second password (password 4). The network device updates the first password (password 3) of the first WiFi network to the third password (e.g., password 5). In step S701, the electronic device uses SSID 3 and password 3 to initiate a connection request to the first WiFi network. Password 3 is not the updated password of the first WiFi network, so it cannot connect to the first WiFi network.

[0162] In this case, the electronic device can query the first BSSID (such as BSSID 3) in the mapping relationship, and the electronic device can prompt the user to re-enter the password through a prompt message to connect to the first WiFi network. In the embodiments of the present application, the display method of the prompt message will be described in combination with the interface schematic diagram later, and will not be described here first.

[0163] S708. When the electronic device receives the operation of the user inputting the third password, update the mapping relationship between the first BSSID and the first password to the mapping relationship between the first BSSID and the third password.

[0164] The first BSSID is, for example, BSSID 3, and the third password is, for example, password 5. In the embodiments of the present application, the updated mapping relationship between the WiFi network and the WiFi password can be shown in Table 4:

[0165] Table 4 Mapping relationship table of WiFi network and WiFi password.

[0166]

[0167] Among them, BSSID 3 and password 5 establish a mapping relationship to update the mapping relationship.

[0168] It can be understood that when there are multiple BSSIDs corresponding to the first WiFi network, the electronic device can map the passwords corresponding to the multiple BSSIDs to the third password. For example, after the update, BSSID 3, BSSID 4, and BSSID 5 all correspond to password 5.

[0169] S709. The electronic device accesses the first WiFi network using the first SSID and the third password.

[0170] The third password is, for example, password 5. The electronic device uses SSID 3 and password 5 to re-initiate a network connection request and accesses the first WiFi network.

[0171] In this way, the electronic device can determine the reason for the wrong password based on whether there is a BSSID of the first WiFi network in the mapping relationship, and add or update the mapping relationship to improve the accuracy of the mapping relationship, thereby improving the accuracy of the WiFi network connection method.

[0172] Next, in combination with Figures 8 - 10 Several ways for the electronic device to prompt the user to input the password in step S704 will be described.

[0173] The first method can be as Figure 8 shown: When the electronic device fails to connect to the network, the electronic device displays a pop-up window; among them, the pop-up window can include a prompt message.

[0174] Among them, when the electronic device is in the WiFi network setting interface, the electronic device can send a prompt message in the form of a pop-up window. The WiFi network setting interface can be, for example, Figure 8 the interface shown in a of Figure 8 In the interface shown in a of

[0175] Figure 8 , the electronic device can display the saved WiFi networks. For example, the button 801 for accessing the "CAT" WiFi network; among them, the button 801 can be marked with a prompt text, such as "Saved (Can access the Internet)", to indicate that the electronic device has accessed this WiFi network or other WiFi networks with the same SSID as this WiFi network before. Figure 8 The electronic device can attempt to automatically access the WiFi network using the password in the mapping relationship table. When the electronic device fails to connect to the network, the electronic device can display the interface shown in b of Figure 8 In the interface shown in b of

[0176] , a pop-up window 802 is included. The pop-up window 802 includes a prompt message (such as the prompt message 803), the first SSID (such as CAT), a password input box 804, and a connection button 805.

[0177] Among them, the prompt message 803 can be a text prompt of "Connection failed, please re-enter the password"; optionally, the prompt message 803 is also used to prompt the reason for the failure to connect to the second WiFi network. For example, the prompt message 803 can also be "The device does not store the password of the current WiFi network, please enter the password"; optionally, the prompt message 803 can also be in the form of a voice prompt, etc. The embodiments of the present application do not limit the specific content and form of the prompt message.

[0178] The second method can be as shown in Figure 9 When the electronic device fails to connect to the network, the electronic device displays a notification message; among them, the notification message can include a prompt message.

[0179] It can be understood that in the actual scenario, when the electronic device enters the range covered by the WiFi network, the electronic device can automatically connect to the WiFi network based on the stored password. Therefore, during the process of accessing the WiFi network, the electronic device may be in the screen-off state, or in the screen-on state and the WiFi network setting interface is not displayed. At this time, the electronic device can prompt the user in the form of a notification message, so that when the user needs the electronic device to provide network services, the user can re-enter the password in time according to the prompt of the notification message.

[0180] Taking the example of an electronic device being in the screen-on state and not displaying the WiFi network settings interface, for example, when the electronic device fails to connect to the network, the electronic device can display a notification message. For example, in the interface shown in Figure 9 as shown in a of

[0181] Figure 9 Figure 9 the electronic device displays a notification box 901, and the notification box 901 includes a prompt message and a first SSID. Figure 9 In the interface shown in b of

[0182] the pop-up window 902 includes a prompt message (such as the prompt message 903), a first SSID (such as CAT), a password input box 904, and a connection button 905.

[0183] Among them, the prompt message 903 can be a text prompt of "Connection failed, please re-enter the password"; the specific content and form of the prompt message in the embodiments of the present application are not limited.

[0184] Optionally, in some scenarios, within a preset duration, the electronic device can display the notification box 901; when the preset duration is exceeded, the electronic device does not display the notification box 901. When the electronic device receives a trigger operation of swiping down from the top of the screen, it can display a drop-down menu interface, where the drop-down menu interface includes the notification box 901.

[0185] The third method can be as shown in Figure 10 When the electronic device fails to connect to the network, the electronic device displays a notification message and a pop-up window.

[0186] For example, in the interface shown in Figure 10 the electronic device displays a notification box 1001 and a pop-up window 1002. The notification box 1001 includes a prompt message. The pop-up window 1002 includes a prompt message (prompt message 1003), a first SSID (such as CAT), a password input box 1004, and a connection button 1005.

[0187] The specific content and form of the prompt message in the embodiments of the present application are not limited.

[0188] The electronic device can receive the operation of the user entering a second password in the password input box 1004, display or hide the display of the second password; when the electronic device receives a trigger operation for the connection button 1005, the electronic device uses the second password to access the second WiFi network.

[0189] It can be understood that the electronic device can also display the prompt message in the form of the above pop-up window or notification, which will not be elaborated in the embodiments of the present application. In step S707, the specific content of the prompt message can be the same as that in step S704; for example, the text prompt can be "Connection failed, please re-enter the password"; the specific content of the two can also be different. For example, in step S704, the prompt message can prompt that the connection fails because the electronic device does not store the password of the second WiFi network; in step S707, the prompt message can prompt that the connection fails because the password is updated. The embodiments of the present application do not limit the display form of the prompt message.

[0190] Scenario 3: The mapping relation table of the electronic device stores the mapping relation related to the first WiFi network and the mapping relation related to the second WiFi network; the electronic device accesses the corresponding WiFi network using the corresponding password according to the mapping relation table. Taking the electronic device searching for the second WiFi network as an example, the internal interaction process of the electronic device in the embodiments of the present application will be described below, as Figure 11 shown below: Figure 11 shown:

[0191] The software architecture of the electronic device can be referred to Figure 5 as shown, in which the application layer can include a target application, such as a settings application; the application framework layer can include a WiFi module; the kernel layer can include a WiFi driver.

[0192] Specifically, S1101: The WiFi driver of the electronic device can obtain a first message from the network device, and the first message includes a first SSID and a second BSSID.

[0193] The network device can periodically broadcast beacon frames, and the beacon frames can include the SSID and BSSID of the WiFi network; for example, the beacon frame includes the first message, the WiFi network searched by the electronic device can be the second WiFi network, and the first message includes the first SSID and the second BSSID. The WiFi network chip of the electronic device can search for the beacon frame and upload the first message to the WiFi driver.

[0194] S1102: The WiFi driver of the electronic device reports the first message to the WiFi module.

[0195] S1103: The WiFi module of the electronic device searches for the second password of the second WiFi network based on the first message in the mapping relation.

[0196] After obtaining the first message, the WiFi module can search for the second password of the second WiFi network in the mapping relation table. Three possible implementation methods for searching for the second password are introduced below.

[0197] In the first possible implementation, the WiFi module obtains the first SSID; searches for the first SSID in the mapping relationship table; if the mapping relationship includes the first SSID and the number of passwords corresponding to the first SSID is one, the second password corresponding to the first SSID can be obtained; the WiFi module sends down the first SSID and the second password.

[0198] Among them, in the mapping relationship table, the first SSID corresponds to one password. For example, taking Table 3 as an example, the first SSID can be SSID 1, and the corresponding password is Password 1; the electronic device can use Password 1 and SSID 1 to quickly access the second WiFi network, reducing the time for traversing and querying the BSSID, thereby improving the network connection efficiency.

[0199] In the second possible implementation, the WiFi module obtains the first SSID; searches for the first SSID in the mapping relationship; if the mapping relationship includes the first SSID and the number of passwords corresponding to the first SSID is greater than 1, searches for the second BSSID in the mapping relationship; if the mapping relationship includes the second BSSID, the second password corresponding to the second BSSID can be obtained; the WiFi module sends down the first SSID and the second password.

[0200] Among them, in the mapping relationship table, the first SSID corresponds to multiple passwords. For example, taking Table 3 as an example, the first SSID can be SSID 3, and the corresponding passwords are Password 3 and Password 4 respectively; the electronic device can further search for the second BSSID in SSID 3. For example, the second BSSID is BSSID 6, and the password corresponding to BSSID 6 is Password 4. In this way, in a scenario where one SSID corresponds to multiple passwords, the electronic device can accurately obtain the second password of the second WiFi network based on the BSSID, so that the electronic device can successfully access the second WiFi network using the second password.

[0201] Optionally, search for the second BSSID in the mapping relationship table; if the mapping relationship includes the second BSSID, the second password corresponding to the second BSSID can be obtained; the WiFi module sends down the SSID and the second password of the second WiFi network, including:

[0202] If the number of BSSIDs corresponding to the first SSID in the mapping relationship is less than or equal to the first preset value, or the number of WiFi passwords corresponding to the first SSID is greater than the second preset value, search for the second BSSID in the mapping relationship table and set the password corresponding to the second BSSID as the second password.

[0203] It can be understood that when the number of BSSIDs corresponding to the first SSID in the mapping relationship is small, the electronic device can search for the second BSSID among multiple BSSIDs of the first SSID. In this way, the process of traversing the BSSIDs takes less time, and the electronic device can quickly find the second password corresponding to the second BSSID and connect to the WiFi network. For example, taking Table 3 as an example, the first SSID is SSID 3, and SSID 3 includes 4 BSSIDs. The electronic device uses the second BSSID (such as BSSID 6) to search among the 4 BSSIDs, and the electronic device can quickly obtain the second password (such as password 4).

[0204] When the number of BSSIDs corresponding to the first SSID in the mapping relationship table is large and the number of passwords corresponding to the first SSID is large, the electronic device needs to traverse and query multiple BSSIDs corresponding to the first SSID. It should be noted that when the number of passwords is small, the electronic device can try to connect using any password. After the connection fails, it tries to connect to the WiFi network using the next password; in this way, the electronic device can achieve the effect of quickly connecting to the WiFi network through fewer reconnections. When the number of passwords is large, this method is no longer applicable, and the electronic device needs to search for the second BSSID by traversing the BSSIDs.

[0205] In a third possible implementation manner, if the number of BSSIDs corresponding to the first SSID in the mapping relationship table is greater than a preset value and the number of passwords corresponding to the first SSID is less than or equal to a second preset value, any password corresponding to the first SSID is used as the second password for distribution.

[0206] It can be understood that when the number of BSSIDs corresponding to the first SSID in the mapping relationship table is large, the time-consuming for the electronic device to traverse and query the BSSIDs is long; at this time, if the number of passwords corresponding to the first SSID is small, the electronic device can try to connect to the second WiFi network using any password; if the electronic device fails to connect to the second WiFi network successfully, the electronic device replaces another password as the second password for distribution until the electronic device connects to the second WiFi network.

[0207] For example, the second WiFi network can be the WiFi network in an airport. The coverage area of the airport is large, and there are many APs connected to the DS. In the mapping relationship table, the first SSID corresponds to hundreds of BSSIDs, and the first SSID corresponds to 2 passwords. At this time, the workload of searching for the second BSSID among hundreds of BSSIDs is large and very time-consuming. The electronic device can use any password to connect to the second WiFi network. If the connection is successful, it means that this password is the password of the second WiFi network; if the connection fails, it means that this password is not the password of the second WiFi network; the electronic device uses another password to connect to the second WiFi network.

[0208] In practical applications, the number of times the electronic device reconnects to the second WiFi network is less than or equal to a second preset value, and the reconnection time is less than the time for the electronic device to search for the second BSSID among BSSIDs with a quantity greater than a first preset value, thereby improving the networking efficiency.

[0209] S1104. If the second password is found, the WiFi module sends the first SSID and the second password to the WiFi driver.

[0210] After obtaining the second password, the WiFi module can send the first SSID and the second password to the WiFi driver through the WiFi hardware abstraction module.

[0211] S1105. The WiFi driver of the electronic device sends the first SSID and the second password to the network device.

[0212] The WiFi driver transmits the first SSID and the second password to the WiFi chip, and the first SSID and the second password are sent to the network device by hardware such as the WiFi chip and the antenna to connect to the second WiFi network.

[0213] Alternatively, S1106. If the second password is not found, the WiFi module instructs the target device to display a prompt message.

[0214] S1107. When the electronic device receives an operation in which the user inputs the second password, the target application sends the second password to the WiFi module.

[0215] In steps S1106 and S1107, the process of the electronic device displaying the prompt message and receiving the second password can refer to the relevant descriptions in the Figures 8 - 10 illustrated embodiment, and will not be elaborated here.

[0216] S1108. The WiFi module of the electronic device saves the mapping relationship of the first SSID, the second BSSID, and the second password.

[0217] The process of the electronic device saving the mapping relationship can refer to the relevant description in step S706, and will not be elaborated here.

[0218] Optionally, the electronic device can distinguish multiple WiFi networks with the same SSID according to the area covered by the WiFi network.

[0219] Specifically, when the electronic device is at the first position, it searches for the first WiFi network and accesses the first WiFi network using the first password. Among them, the mapping relationship between the area covered by the first WiFi network and the first password, and the mapping relationship between the area covered by the second WiFi network and the second password are stored in the electronic device. The first position is within the area covered by the first WiFi network. The second position is within the area covered by the second WiFi network, and there is no overlapping area between the area covered by the first WiFi network and the area covered by the second WiFi network. The SSID of the first WiFi network is the same as the SSID of the second WiFi network, both being the first SSID, and the first password is different from the second password. When the electronic device is at the second position, it searches for the second WiFi network and accesses the second WiFi network using the second password.

[0220] Among them, the SSIDs of the first WiFi network and the second WiFi network are the same, but the passwords are different. The electronic device can save the mapping relationship between the area covered by the WiFi network and the password. The mapping relationship can be, for example, the mapping relationship between the area covered by the first WiFi network and the first password, and the mapping relationship between the area covered by the second WiFi network and the second password. When the electronic device is within the area covered by the first WiFi network, it accesses the WiFi network using the first password based on the mapping relationship. When the electronic device is within the area covered by the second WiFi network, it accesses the WiFi network using the second password based on the mapping relationship.

[0221] In a possible implementation, the area covered by the WiFi network can be set according to methods such as GPS, cell, and geofence.

[0222] Taking the geofence as an example, when the electronic device first accesses the first WiFi network, it can register the first geofence and add the mapping relationship between the first geofence and the first password in the mapping relationship. Among them, the accuracy of the first geofence is related to the coverage range of the first WiFi network.

[0223] When the electronic device first accesses the second WiFi network, it can register the second geofence and find the first password corresponding to the first SSID in the mapping relationship. It uses the first password to request access to the second WiFi network. After the connection fails, the electronic device detects whether the first SSID in the mapping relationship includes the second geofence and receives the second password. If the SSID of the first WiFi network in the mapping relationship does not include the second geofence, then the mapping relationship between the second BSSID, the second geofence, and the second password is added to the mapping relationship table.

[0224] The mapping relationship table can be as shown in Table 5:

[0225] Table 5 Mapping Relationship Table of WiFi Network and WiFi Password

[0226]

[0227] In Table 5, the first SSID is, for example, SSID 3, the first geofence is, for example, Geofence 3, and the first password is, for example, Password 3; the second geofence is, for example, Geofence 4, and the second password is, for example, Password 4.

[0228] Furthermore, embodiments of the present application can store the mapping relationship between the BSSID and the geofence. The mapping relationship can be as shown in Table 6:

[0229] Table 6 Mapping Relationship between WiFi Networks and WiFi Passwords

[0230]

[0231] For example, when the SSID of a WiFi network corresponds to multiple passwords, the electronic device can query the WiFi password according to the geofence where the electronic device is located. In some scenarios, there may be a situation where the coverage ranges of two WiFi networks partially overlap. At this time, the electronic device may not be able to accurately find the password of the network to be accessed according to the geofence; the electronic device can use the BSSID of the network to be accessed to further query the WiFi password. Embodiments of the present application show a feasible solution for the combined use of BSSID and geofence. In practical applications, the electronic device can also adopt other combination methods to solve the problem scenarios caused by two WiFi networks with the same SSID but different passwords. For example, combined use of BSSID and GPS, combined use of BSSID and cell, etc. Embodiments of the present application do not limit this.

[0232] Based on the above embodiments, embodiments of the present application provide a WiFi connection method. Exemplarily, Figure 12 is a schematic flowchart of a WiFi connection method provided by embodiments of the present application.

[0233] As Figure 12 shown, the WiFi connection method may include the following steps:

[0234] S1201. When the electronic device searches for a first WiFi network, access the first WiFi network using the first password; wherein, the mapping relationship between the first basic service set identifier BSSID of the first WiFi network and the first password is stored in the electronic device.

[0235] Among them, the process of the electronic device accessing the first WiFi network can refer to the relevant description in the Figure 6 shown embodiment, which will not be elaborated here.

[0236] S1202. When the electronic device detects the second Wi-Fi network, connect to the second Wi-Fi network using the second password. The electronic device stores a mapping relationship between the second BSSID of the second Wi-Fi network and the second password. The service set identifiers (SSIDs) of the first Wi-Fi network and the second Wi-Fi network are both the first SSID. The first BSSID is different from the second BSSID, and the first password is different from the second password.

[0237] Among them, the process of the electronic device connecting to the second Wi-Fi network can refer to Figure 11 the relevant description in the embodiment shown, which will not be elaborated here. In this way, the electronic device can accurately find the corresponding password according to the BSSID of the Wi-Fi network based on the mapping relationship between the BSSID and the password, and connect to the Wi-Fi network using the password, reducing the scenario of Wi-Fi network connection failure caused by different passwords for multiple Wi-Fi networks with the same SSID, and improving the user's network experience.

[0238] In a possible implementation, after connecting to the first Wi-Fi network using the first password, it further includes: detecting a Wi-Fi network with the same SSID as the first SSID; the BSSID of the Wi-Fi network is the second BSSID; connecting to the Wi-Fi network using the first password; when the electronic device fails to connect to the Wi-Fi network, determining whether the electronic device has connected to the second BSSID; when the electronic device has not connected to the second BSSID, prompting the user to input the second password; when the electronic device receives the operation of the user inputting the second password, saving the mapping relationship between the second BSSID and the second password.

[0239] Among them, this step can refer to Figure 7 the relevant description of steps S701 - S706 in the embodiment shown, which will not be elaborated here. In this way, when the second BSSID is an un-stored BSSID, the electronic device can save the relationship between the first SSID, the second BSSID, and the second password, so that the electronic device can connect to the second Wi-Fi network using the second password later, reducing the scenario of Wi-Fi network connection failure caused by incorrect passwords, and improving the user's network experience.

[0240] In a possible implementation, a mapping relationship between a first SSID, BSSIDs of multiple first WiFi networks, and a first password is stored in the mapping relationship table of the electronic device; determining whether the electronic device has accessed the BSSID of a WiFi network includes: finding the BSSIDs of multiple first WiFi networks corresponding to the first SSID in the mapping relationship table; and finding whether there is a second BSSID among the BSSIDs of multiple first WiFi networks. In this way, the electronic device can find the second BSSID among the stored BSSIDs, so as to establish a mapping relationship between the second BSSID and a second password subsequently.

[0241] In a possible implementation, saving the mapping relationship between the second BSSID and the second password includes: saving the mapping relationship between the first SSID, the second BSSID, and the second password in the mapping relationship table; wherein, in the mapping relationship table, the BSSIDs corresponding to the first SSID include the second BSSID and the BSSIDs of multiple first WiFi networks; wherein, the BSSIDs of multiple first WiFi networks all have a mapping relationship with the first password, and the second BSSID has a mapping relationship with the second password.

[0242] Wherein, the mapping relationship table can be as shown in Table 3 for example. In this way, the electronic device can save the mapping relationships between multiple WiFi networks with the same SSID and multiple passwords, so as to accurately use the corresponding password to access the WiFi network subsequently.

[0243] In a possible implementation, prompting the user to input the second password includes: popping up a prompt message in the first interface; wherein, the pop-up window includes the first SSID, the prompt message, an input area for the WiFi password, and a first button; the prompt message is used to instruct the user that the WiFi password is incorrect and to re-enter the WiFi password; the first button is used to indicate connecting to the WiFi network with the same SSID as the first SSID; and / or, displaying a notification message in the first interface; the notification message includes the first SSID and the prompt message.

[0244] Wherein, the first interface can correspond to Figure 8 the interface shown in b of Figure 9 the interface shown in a of Figure 10 and / or the interface shown in Figure 8 The first button can correspond to the connection button 805 in the interface shown in b of Figure 9 the connection button 905 in the interface shown in b of Figure 10 and / or the connection button 1005 in Figure 8 This step can refer to Figure 9 and Figure 10The relevant descriptions in the illustrated embodiments will not be elaborated here. In this way, when the connection to the WiFi network fails, the electronic device can promptly remind the user to enter the WiFi password, so as to save the mapping relationship based on the password entered by the user subsequently.

[0245] In a possible implementation, after the electronic device searches for the second WiFi network, it includes: searching for the second BSSID in the mapping relationship table to obtain the second password corresponding to the second BSSID. In this way, the electronic device can accurately find the corresponding password in the mapping relationship table using the BSSID, improving the success rate of WiFi network connection and enhancing the user experience.

[0246] In a possible implementation, searching for the second BSSID in the mapping relationship table includes: respectively obtaining the number of WiFi passwords and the number of BSSIDs corresponding to the first SSID in the mapping relationship table; when the number of WiFi passwords corresponding to the first SSID is greater than 1 and the number of BSSIDs corresponding to the first SSID is less than or equal to the first preset value, searching for the second BSSID among the BSSIDs corresponding to the first SSID.

[0247] Among them, this step can refer to the relevant descriptions in step S1103 and will not be elaborated here. In this way, when the number of BSSIDs corresponding to the same SSID is small, the electronic device can quickly access the WiFi network by querying the BSSID, improving the network connection efficiency and enhancing the user experience.

[0248] In a possible implementation, after the electronic device searches for the second WiFi network, it further includes: respectively obtaining the number of WiFi passwords and the number of BSSIDs corresponding to the first SSID in the mapping relationship table; when the number of WiFi passwords corresponding to the first SSID is greater than 1 and less than or equal to the second preset value, and the number of BSSIDs corresponding to the first SSID is greater than the first preset value, attempting to access the second WiFi network using any one of the passwords corresponding to the first SSID; the passwords corresponding to the first SSID include: the first password and the second password; if the access to the second WiFi network fails, then attempting to access the second WiFi network using the other password corresponding to the first SSID except any one of the passwords; until successfully accessing the second WiFi network using the second password.

[0249] Among them, this step can refer to the relevant descriptions in step S1103 and will not be elaborated here. In this way, when the number of BSSIDs corresponding to the same SSID is large and the number of corresponding WiFi passwords is small, the electronic device can attempt to access the WiFi network quickly by traversing the passwords, reducing the time for traversing and querying the BSSID, improving the network connection efficiency and enhancing the user experience.

[0250] In a possible implementation, after accessing the first Wi-Fi network using the first password, the following steps are further included: searching again for a Wi-Fi network with the same SSID as the first one; the BSSID of the Wi-Fi network being the first BSSID; accessing the Wi-Fi network using the first password; in the case where the electronic device fails to access the Wi-Fi network, determining whether the electronic device has accessed the first BSSID; in the case where the electronic device has accessed the first BSSID, prompting the user to input a third password; in the case where the electronic device receives the operation of the user inputting the third password, updating the mapping relationship between the first BSSID and the first password to the mapping relationship between the first BSSID and the third password.

[0251] Among them, this step can refer to Figure 7 the relevant descriptions in steps S701 - S703, S707 - S709 in the embodiment shown. Details are not described herein again. In this way, when the first BSSID is a BSSID that has been saved, the electronic device can update the mapping relationship between the first BSSID and the password, improving the accuracy of the mapping relationship.

[0252] In a possible implementation, the following steps are further included: in the case where the electronic device searches for a third Wi-Fi network, accessing the third Wi-Fi network using a fourth password; among them, a mapping relationship between the third BSSID and the fourth password of the third Wi-Fi network is stored in the electronic device; the third SSID of the third Wi-Fi network is different from the first SSID. In this way, in the case where one SSID corresponds to one Wi-Fi network, the electronic device can also access the Wi-Fi network using the mapping relationship table, enriching the connection methods of the Wi-Fi network.

[0253] In a possible implementation, after the electronic device searches for the third Wi-Fi network, the following steps are included: obtaining the number of Wi-Fi passwords corresponding to the third SSID in the mapping relationship table; in the case where the number of Wi-Fi passwords corresponding to the third SSID is 1, obtaining the fourth password corresponding to the third SSID.

[0254] Among them, this step can refer to Figure 6 the relevant descriptions in the embodiment shown. Details are not described herein again. In this way, in the case where one SSID corresponds to one Wi-Fi network, the electronic device can quickly access the Wi-Fi network using the password corresponding to the SSID, reducing the time for traversing the BSSID, improving the network connection efficiency, and enhancing the user experience.

[0255] In a possible implementation, in the mapping relationship table, the mapping relationship corresponding to the first SSID further includes the following parameters: a first geofence and a second geofence; the first geofence includes the coverage area of the first WiFi network, and the first geofence corresponds to the first password; the second geofence includes the coverage area of the second WiFi network, and the second geofence corresponds to the second password; after the electronic device detects the second WiFi network, it further includes: obtaining the location of the electronic device; accessing the second WiFi network using the second password, including: when the electronic device is located within the second geofence, accessing the second WiFi network using the second password corresponding to the second geofence.

[0256] Among them, this step can refer to the description related to the geofence in the above embodiment, and will not be elaborated here. In this way, the electronic device can also use the geofence to distinguish between the first WiFi network and the second WiFi network, reduce the time for traversing the BSSID, improve the network connection efficiency, and enhance the user experience.

[0257] In a possible implementation, there is a partially overlapping area between the first geofence and the second geofence. After the electronic device detects the second WiFi network, it further includes: when the electronic device is located in the overlapping area between the first geofence and the second geofence, searching for the second BSSID in the mapping relationship table to obtain the second password corresponding to the second BSSID; and accessing the second WiFi network using the second password.

[0258] Among them, this step can refer to the description related to the geofence in the above embodiment, and will not be elaborated here. In this way, when the geofence cannot be used to distinguish between the first WiFi network and the second WiFi network, the electronic device can accurately distinguish between the first WiFi network and the second WiFi network through the BSSID and access the WiFi network using the corresponding password.

[0259] The WiFi connection method of the embodiments of the present application has been described above. Next, the device for executing the above WiFi connection method provided by the embodiments of the present application will be described. Those skilled in the art can understand that the method and the device can be combined and cited with each other, and the related device provided by the embodiments of the present application can execute the steps in the above WiFi connection method.

[0260] As Figure 13 shown, the WiFi connection device 1300 can be used in a communication device, a circuit, a hardware component, or a chip. The WiFi connection device includes: a display unit 1301 and a processing unit 1302. Among them, the display unit 1301 is used to support the display steps executed by the WiFi connection device 1300; the processing unit 1302 is used to support the information processing steps executed by the WiFi connection device 1300.

[0261] In a possible implementation, the WiFi connection device 1300 may also include a communication unit 1303. Specifically, the communication unit is used to support the WiFi connection device 1300 to perform the steps of sending data and receiving data. Among them, the communication unit 1303 may be an input or output interface, a pin, or a circuit, etc.

[0262] In a possible embodiment, the WiFi connection device may further include: a storage unit 1304. The processing unit 1302 and the storage unit 1304 are connected by a line. The storage unit 1304 may include one or more memories, and the memory may be a device or a component in a circuit for storing programs or data. The storage unit 1304 may exist independently and be connected to the processing unit 1302 of the WiFi connection device through a communication line. The storage unit 1304 may also be integrated with the processing unit 1302.

[0263] The storage unit 1304 may store computer-executable instructions of the method in the terminal device, so that the processing unit 1302 executes the method in the above embodiments. The storage unit 1304 may be a register, a cache, or a RAM, etc. The storage unit 1304 may be integrated with the processing unit 1302. The storage unit 1304 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, and the storage unit 1304 may be independent of the processing unit 1302.

[0264] The WiFi connection method provided by the embodiments of the present application can be applied to an electronic device with communication functions. The electronic device includes a terminal device, and the specific device form of the terminal device and the like can refer to the above relevant descriptions, which will not be elaborated here.

[0265] The embodiments of the present application provide an electronic device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the above method.

[0266] The embodiments of the present application provide a chip. The chip includes a processor, and the processor is used to call a computer program in the memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those of the above relevant embodiments, which will not be elaborated here.

[0267] Embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned method is implemented. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored on or transmitted over a computer-readable medium as one or more instructions or code. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0268] In one possible implementation, the computer-readable medium may include RAM, ROM, a compact disc read-only memory (CD-ROM), or other optical disc storage, a magnetic disk storage, or any other magnetic storage device, or any other medium targeted to carry the required program code in the form of instructions or data structures and accessible by a computer. Moreover, any connection is properly termed a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of the medium. As used herein, disk and optical disc include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs utilize lasers to optically reproduce data. The above combinations should also be included within the scope of the computer-readable medium.

[0269] Embodiments of the present application provide a computer program product. The computer program product includes a computer program that, when run, causes a computer to execute the above-mentioned method.

[0270] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable devices to generate a machine, such that the instructions executed by the processing unit of the computer or other programmable data processing devices generate means for implementing the processes Figure 1means for the functions specified in one or more processes and / or blocks Figure 1 means for the functions specified in one or more blocks.

[0271] In the above specific embodiments, the object, technical solution and beneficial effects of the present invention have been further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention shall be included in the protection scope of the present invention.

Claims

1. A WiFi connection method, characterized in that, applied to an electronic device, the method includes: When the electronic device searches for a first WiFi network, access the first WiFi network using a first password; wherein, the mapping relationship between the first basic service set identifier BSSID of the first WiFi network and the first password is stored in the mapping relationship table of the electronic device; When the electronic device searches for a second WiFi network, access the second WiFi network using a second password; wherein, the mapping relationship between the second BSSID of the second WiFi network and the second password is also stored in the mapping relationship table of the electronic device; the service set identifier SSID of the first WiFi network and the SSID of the second WiFi network are both the first SSID; the first BSSID is different from the second BSSID; the BSSID is used to identify the AP corresponding to the WiFi network, and different BSSIDs correspond to different APs, and the AP is used to provide the WiFi network; the first password is different from the second password; After the electronic device searches for the second WiFi network, it includes: Obtain the number of WiFi passwords and the number of BSSIDs corresponding to the first SSID in the mapping relationship table respectively; When the number of WiFi passwords corresponding to the first SSID is greater than 1, and the number of BSSIDs corresponding to the first SSID is less than or equal to a first preset value, search for the second BSSID among the BSSIDs corresponding to the first SSID to obtain the second password corresponding to the second BSSID; or, When the number of WiFi passwords corresponding to the first SSID is greater than 1 and less than or equal to a second preset value, and the number of BSSIDs corresponding to the first SSID is greater than the first preset value, use any password corresponding to the first SSID to attempt to access the second WiFi network; the passwords corresponding to the first SSID include: the first password and the second password; If the access to the second WiFi network fails, use another password corresponding to the first SSID, other than the any password, to attempt to access the second WiFi network; until the second password is successfully used to access the second WiFi network.

2. The method according to claim 1, characterized in that, after accessing the first WiFi network using the first password, it further includes: searching for a WiFi network with the same SSID as the first SSID; the BSSID of the WiFi network is the second BSSID; accessing the WiFi network using the first password; when the electronic device fails to access the WiFi network, determining whether the electronic device has accessed the second BSSID; when the electronic device has not accessed the second BSSID, prompting the user to input the second password; When the electronic device receives an operation in which the user inputs the second password, save the mapping relationship between the second BSSID and the second password.

3. The method according to claim 2, wherein, in the mapping relationship table of the electronic device, the mapping relationship between the first SSID, the BSSIDs of multiple first WiFi networks, and the first password is stored; the step of determining whether the electronic device has accessed the BSSID of the WiFi network includes: finding the BSSIDs of multiple first WiFi networks corresponding to the first SSID in the mapping relationship table; finding whether the second BSSID exists among the BSSIDs of multiple first WiFi networks.

4. The method according to claim 2, wherein, saving the mapping relationship between the second BSSID and the second password includes: saving the mapping relationship between the first SSID, the second BSSID, and the second password in the mapping relationship table; wherein, in the mapping relationship table, the BSSIDs corresponding to the first SSID include the second BSSID and the BSSIDs of multiple first WiFi networks; among them, the BSSIDs of multiple first WiFi networks all have a mapping relationship with the first password, and the second BSSID has a mapping relationship with the second password.

5. The method according to claim 2, wherein, prompting the user to input the second password includes: popping up a prompt message on the first interface; wherein, the pop-up window includes the first SSID, the prompt message, an input area for the WiFi password, and a first button; the prompt message is used to indicate that the user's WiFi password is incorrect and to re-enter the WiFi password; the first button is used to indicate connecting to the WiFi network with the same first SSID; and / or, displaying a notification message on the first interface; the notification message includes the first SSID and the prompt message.

6. The method according to any one of claims 1-5, wherein, after accessing the first WiFi network using the first password, further includes: searching for the WiFi network with the same first SSID again; the BSSID of the WiFi network is the first BSSID; accessing the WiFi network using the first password; when the electronic device fails to access the WiFi network, determining whether the electronic device has accessed the first BSSID; when the electronic device has accessed the first BSSID, prompting the user to input a third password; when the electronic device receives an operation in which the user inputs the third password, updating the mapping relationship between the first BSSID and the first password to the mapping relationship between the first BSSID and the third password.

7. The method according to any one of claims 1-5, wherein, further includes: When the electronic device detects a third Wi-Fi network, it accesses the third Wi-Fi network using a fourth password; wherein, a mapping relationship between a third BSSID of the third Wi-Fi network and the fourth password is stored in the electronic device; the third SSID of the third Wi-Fi network is different from the first SSID.

8. The method according to claim 7, wherein, after the electronic device detects the third Wi-Fi network; it includes: obtaining the number of Wi-Fi passwords corresponding to the third SSID in the mapping relationship table; when the number of Wi-Fi passwords corresponding to the third SSID is 1, obtaining the fourth password corresponding to the third SSID.

9. The method according to claim 1, wherein, in the mapping relationship table, the mapping relationship corresponding to the first SSID further includes the following parameters: a first geofence and a second geofence; the first geofence includes the coverage area of the first Wi-Fi network, and the first geofence corresponds to the first password; the second geofence includes the coverage area of the second Wi-Fi network, and the second geofence corresponds to the second password; after the electronic device detects the second Wi-Fi network, it further includes: obtaining the location of the electronic device; the step of using the second password to access the second Wi-Fi network includes: when the electronic device is located within the second geofence, using the second password corresponding to the second geofence to access the second Wi-Fi network.

10. The method according to any one of claims 1-5, 8-9, wherein, there is a partially overlapping area between the first geofence and the second geofence. After the electronic device detects the second Wi-Fi network, it further includes: when the electronic device is located within the overlapping area between the first geofence and the second geofence, searching for the second BSSID in the mapping relationship table, obtaining the second password corresponding to the second BSSID; and using the second password to access the second Wi-Fi network.

11. An electronic device, wherein, it includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, causing the electronic device to execute the method according to any one of claims 1-10.

12. A computer-readable storage medium storing a computer program, wherein, when the computer program is executed by a processor, it implements the method according to any one of claims 1-10.

13. A computer program product, wherein, it includes a computer program, and when the computer program is run, it causes a computer to execute the method according to any one of claims 1-10.

Citation Information

Patent Citations

  • System and method for connecting wireless access points with same SSID and different passwords

    CN105357671A

  • Method for controlling networking of smart home equipment, and equipment

    CN111491297A

  • Wireless network connection method, electronic equipment and chip system

    CN113973398A