List loading method and device, chip and storage medium
By using hash tables for WiFi matching in your mobile phone, the problem of slow loading speed caused by linear search is solved, faster matching and loading is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202510198766.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-06-10
AI Technical Summary
When scanning nearby WiFi information in a mobile phone, linear search matching is required, resulting in slow loading of access device lists and affecting user experience.
Using a hash table-based method, by constructing a hash table of the scanned access device and finding whether the saved access device exists in the hash table, the matching complexity of O(1) is achieved and the matching speed is improved.
It significantly reduces the matching complexity between the scanned access devices and the saved access devices, improves the matching speed, optimizes the loading speed of the access device list, and improves the user experience.
Smart Images

Figure CN120129026A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a method, apparatus, chip, and storage medium for loading a list. Background Art
[0002] With the development of mobile communication and the continuous improvement of people's living standards, the use of various mobile terminals such as mobile phones has become increasingly popular. Mobile phones have become an indispensable communication tool in people's lives, facilitating users to access the network anytime and anywhere and obtain information from the network.
[0003] Currently, connecting a mobile phone to wireless fidelity (WiFi) is one of the most common usage scenarios for users. When a user needs to connect to WiFi, they can turn on the WiFi switch in the Settings module of the mobile phone, and the mobile phone can scan for nearby WiFi information. After the mobile phone scans for nearby WiFi information, it can load a list, display the nearby available WiFi scanned in the form of a list, and display the saved WiFi at the top. After the WiFi list is loaded, the mobile phone can automatically connect to the saved WiFi or receive a manual selection from the user for the WiFi to be accessed. Therefore, the loading of the WiFi list is crucial for the user experience. Summary of the Invention
[0004] Embodiments of this application provide a method, apparatus, chip, and storage medium for loading a list. Based on the method described in this application, the linear search and matching method can be avoided, the matching complexity between the scanned access devices and the saved access devices can be reduced, the matching speed between the scanned access devices and the saved access devices can be increased, which is beneficial to optimizing the loading speed of the access device list and improving the user experience.
[0005] In a first aspect, this application provides a method for loading a list. The method includes: obtaining a first identifier set, where the first identifier is the identifier of a scanned access device; obtaining a second identifier set, where the second identifier is the identifier of a saved access device; determining a matching result between a first identifier in the first identifier set and a second identifier in the second identifier set based on a built hash table, where the hash table includes: a first hash table built based on the first identifier in the first identifier set, or a second hash table built based on the second identifier in the second identifier set; and loading the access information of the access device determined according to the matching result into the list.
[0006] Based on the method described in the first aspect, by determining the matching relationship between the scanned access devices and the saved access devices based on a hash table, the linear search matching method can be avoided, the matching complexity between the scanned access devices and the saved access devices can be effectively reduced, the matching speed between the scanned access devices and the saved access devices can be increased, which is beneficial to optimizing the loading speed of the access device list and improving the user experience.
[0007] In a possible implementation, the first hash table is established based on a first hash function, and each first identifier in the first identifier set is saved as a key in the first hash table. Based on the established hash table, determining the matching result between the first identifiers in the first identifier set and the second identifiers in the second identifier set includes: based on the first hash function, for each second identifier in the second identifier set, checking whether it exists in the first hash table; based on at least one second identifier in the second identifier set existing in the first hash table, determining that there is a matching relationship between at least one second identifier in the second identifier set and at least one first identifier in the first identifier set.
[0008] Based on this implementation, by constructing a hash table of the scanned access devices and checking whether the saved access devices exist in the hash table, since the time complexity of the search process is O(1), the saved access devices can be effectively matched with the scanned access devices, significantly improving the matching efficiency.
[0009] In a possible implementation, the method further includes: maintaining the first hash table; in response to a change in one or more first identifiers obtained by scanning access devices, performing an incremental update on the first hash table.
[0010] Based on this implementation, when the identifier of the scanned access device changes, through incremental update, the dynamic changes of the network environment can be responded to, ensuring that the hash table always remains in the latest state, improving the real-time response ability, and moreover, incrementally updating the hash table instead of rebuilding the hash table every time avoids unnecessary repeated calculations and further improves the performance.
[0011] In a possible implementation, the second hash table is established based on a second hash function, and each second identifier in the second identifier set is saved as a key in the second hash table. Based on the established hash table, determining the matching result between the first identifiers in the first identifier set and the second identifiers in the second identifier set includes: based on the second hash function, for each first identifier in the first identifier set, checking whether it exists in the second hash table; based on at least one first identifier in the first identifier set existing in the second hash table, determining that there is a matching relationship between at least one first identifier in the first identifier set and at least one second identifier in the second identifier set.
[0012] Based on this implementation manner, by constructing a hash table of the saved access devices and checking whether the scanned access devices exist in the hash table, since the time complexity of the checking process is O(1), it can effectively match the scanned access devices with the saved access devices, significantly improving the matching efficiency. Moreover, since the hash table of the saved access devices can be constructed during idle time and there is no need to construct it in real time during each scan, the matching efficiency can be further improved.
[0013] In a possible implementation manner, the second hash table also stores the information of the saved access devices respectively corresponding to each second identifier in the second identifier set. The information of the saved access devices serves as the value value and forms key-value pairs with their corresponding second identifiers respectively.
[0014] Based on this implementation manner, by binding the device information of the saved access devices with the identifiers, it is beneficial to directly obtain the detailed information related to the access devices, ensuring that the status and data of the devices can be consulted at any time, which is applicable to data tracking and management during the device connection process and is beneficial to optimizing the device management and query processes.
[0015] In a possible implementation manner, the method further includes: maintaining the second hash table; and updating the second hash table in response to a change in the information of the saved access devices.
[0016] Based on this implementation manner, as the information of the access devices changes, the hash table can be automatically updated, which can maintain the consistency and currency of the data, ensure that the device management information always matches the actual situation, and improve the adaptive ability of the system.
[0017] In a possible implementation manner, the first identifier and the second identifier include the SSID and / or BSSID of the access device.
[0018] Based on this implementation manner, the matching manner can be made more flexible, which is beneficial to avoiding hash collisions and more accurately identifying access devices.
[0019] In a second aspect, the present application provides a communication device. The device can be a terminal device, or a device in the terminal device, or a device that can be used in matching with the terminal device; wherein, the communication device can also be a chip system, and the communication device can execute the method performed by the terminal device in the first aspect. The functions of the communication device can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the above functions. The unit can be software and / or hardware. The operations and beneficial effects performed by the communication device can refer to the method and beneficial effects in the first aspect above, and the repeated parts will not be described again.
[0020] In a third aspect, the present application provides a communication device, which includes a processor. When the processor calls a computer program in a memory, the method executed by the terminal device in the method of the first aspect is executed.
[0021] In a fourth aspect, the present application provides a communication device, which includes a processor and a memory. The memory is used to store computer-executable instructions; the processor is used to execute the computer-executable instructions stored in the memory, so that the communication device executes the method executed by the terminal device in the method of the first aspect.
[0022] In a fifth aspect, the present application provides a communication device, which includes a processor, a memory, and a transceiver. The transceiver is used to receive or send signals; the memory is used to store a computer program; the processor is used to call the computer program from the memory to execute the method executed by the terminal device in the method of the first aspect.
[0023] In a sixth aspect, the present application provides a communication device, which includes a processor and an interface circuit. The interface circuit is used to receive computer-executable instructions and transmit them to the processor; the processor runs the computer-executable instructions to execute the method executed by the terminal device in the method of the first aspect.
[0024] In a seventh aspect, the present application provides a computer-readable storage medium, which is used to store computer-executable instructions. When the computer-executable instructions are executed, the method executed by the terminal device in the method of the first aspect is performed.
[0025] In an eighth aspect, the present application provides a communication device, which includes a function or unit for executing any method in the first aspect.
[0026] In a ninth aspect, the present application provides a computer program product including a computer program. When the computer program is executed, the method executed by the terminal device in the method of the first aspect is implemented.
[0027] In a tenth aspect, the present application provides a communication system, which includes a terminal device and a network device; wherein the terminal device is used to execute the method of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a schematic diagram of a communication scenario provided by an embodiment of the present application;
[0029] Figure 2 is a flowchart of a list loading method provided by an embodiment of the present application;
[0030] Figure 3It is a schematic flowchart of a list loading method provided by an embodiment of the present application;
[0031] Figure 4 It is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present application;
[0032] Figure 5 It is a schematic diagram of the software and hardware architecture layering of an electronic device provided by an embodiment of the present application;
[0033] Figure 6 It is a schematic diagram of the structure of a communication device provided by an embodiment of the present application;
[0034] Figure 7 It is a schematic diagram of the structure of a communication device provided by an embodiment of the present application;
[0035] Figure 8 It is a schematic diagram of the structure of a chip provided by an embodiment of the present application. Detailed implementation manners
[0036] Terms such as "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0037] Referring to "embodiment" herein means that a specific feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0038] In this application, "at least one (item)" means one or more, "a plurality" means two or more, "at least two (items)" means two, three or more, and "and / or" is used to describe the corresponding relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can represent three situations: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (item) of the following" or its similar expressions 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 can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0039] As used in the following description of the embodiments of this application, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes other steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices. It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any method or design solution described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or having more advantages than other methods or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0040] Figure 1 It is a schematic diagram of a communication scenario provided by the embodiments of this application.
[0041] To facilitate the understanding of the embodiments of this application, first, Figure 1 Taking the communication scenario shown in
[0042] Currently, with the development of mobile communication, the demand for users to connect to the network through terminal devices is increasing day by day. To facilitate users' access to the network through terminal devices, families, merchants, shopping malls, enterprises, etc. may be equipped with one or more access devices to provide network coverage, such as WiFi coverage, so that terminal devices can maintain network connections. Therefore, when the need to connect to the network arises, terminal devices can often scan multiple access devices nearby.
[0043] Figure 1 Taking three access devices and one terminal device as an example, as Figure 1 shown, this communication scenario includes a first access device 110, a second access device 112, and a third access device 114, as well as a terminal device 120 that accesses the network through the first access device 110, the second access device 112, or the third access device 114. The network coverage provided by the first access device 110, the second access device 112, and the third access device 114 overlaps with each other. In this scenario, the terminal device 120 can, according to requirements, access the network through the WiFi coverage provided by the first access device 110, the second access device 112, and the third access device 114 at will.
[0044] In some embodiments, the first access device 110, the second access device 112, and the third access device 114 may also be referred to as wireless access points (APs).
[0045] In some embodiments, the first access device 110, the second access device 112, and the third access device 114 can be any device capable of providing network access functions for the terminal device 120, such as a router.
[0046] In some embodiments, the first access device 110, the second access device 112, and the third access device 114 can be configured with the same WiFi Service Set Identifier (SSID) and password. For example, the first access device 110, the second access device 112, and the third access device 114 can be access devices configured by the same family, merchant, shopping mall, or enterprise.
[0047] In some embodiments, the first access device 110, the second access device 112, and the third access device 114 can be configured with different WiFi SSIDs and passwords. That is to say, the first access device 110 and the second access device 112 can each have their own independently configured WiFi SSIDs and passwords. For example, the first access device 110, the second access device 112, and the third access device 114 can be access devices respectively configured by different families, merchants, shopping malls, or enterprises.
[0048] In some embodiments, the first access device 110, the second access device 112, and the third access device 114 may each be configured with a Basic Service Set Identifier (BSSID). Optionally, the BSSIDs of the first access device 110, the second access device 112, and the third access device 114 may be the respective Media Access Control (MAC) addresses of the first access device 110, the second access device 112, and the third access device 114.
[0049] In some embodiments, the first access device 110, the second access device 112, and the third access device 114 may each be configured with multiple virtual BSSIDs, and these virtual BSSIDs are all different.
[0050] In some embodiments, the terminal device 120 may include a device that provides voice and / or data connectivity to a user. For example, the terminal device 120 is a device with wireless transceiver functions and can be deployed on land, including indoors or outdoors, handheld, wearable, or vehicle-mounted; it can also be deployed on water (such as a ship, etc.); it can also be deployed in the air (such as an airplane, a balloon, a satellite, etc.).
[0051] In some embodiments, the terminal device 120 may be a mobile phone, a tablet computer (Pad), a computer with wireless transceiver functions, a virtual reality (VR) terminal, an augmented reality (AR) terminal, a wireless terminal in industrial control, a vehicle-mounted terminal, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a wearable terminal, and so on. The embodiments of this application do not limit the application scenarios.
[0052] In some embodiments, the terminal device 120 may sometimes also be referred to as a terminal, a user equipment (UE), a mobile station (MS), a mobile termination (MT), an access terminal, a vehicle-mounted terminal, an industrial control terminal, a UE unit, a UE station, a mobile station, a mobile platform, a remote station, a remote terminal, a mobile device, a UE terminal, a wireless communication device, a UE agent, or a UE device, etc.
[0053] By way of example and not limitation, in the embodiments of the present application, the terminal device 120 may also be a wearable device. A wearable device, also known as a wearable intelligent device, is a general term for devices developed by applying wearable technology to the intelligent design of daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is either directly worn on the body or integrated into the user's clothing or accessories. A wearable device is not only a hardware device, but also realizes 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 realize complete or partial functions without relying on a smart phone, 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 smart phones, such as various smart bracelets and smart jewelry for physical sign monitoring.
[0054] It can be understood that in the embodiments of the present application, all or part of the functions of the terminal device 120 may also be implemented by software functions running on hardware, or by virtualized functions instantiated on a platform (such as a cloud platform). In the embodiments of the present application, the device for implementing the functions of the terminal device 120 may be the terminal device or a device capable of supporting the terminal device to implement the functions, such as a chip system or a combined device or component capable of implementing the functions of the terminal device, and this device may be installed in the terminal device.
[0055] It can be understood that as the terminal device 120 moves in the venue, the terminal device 120 may roam between different access devices to Figure 1 For example, the terminal device 120 may roam from the first access device 110 to the second access device 112.
[0056] It should be noted that Figure 1 is only a schematic diagram of a communication scenario, and other devices may also be included in this communication scenario, for example, other access devices and / or terminal devices, which are not shown in Figure 1 . The embodiments of the present application do not limit the number of various devices included in this communication scenario.
[0057] After the terminal device scans the WiFi provided by the nearby access device, it can load a list. This list can display the nearby available WiFi scanned, and moreover, this list can also display the saved WiFi at the top, so as to facilitate the user to select the WiFi to be accessed, or the terminal device can also be configured to automatically connect to the WiFi at the top, improving the user experience.
[0058] Figure 2 is a flowchart of a list loading method provided by the embodiments of the present application.
[0059] Figure 2 Schematically shows some of the processes involved in a terminal device from turning on the WiFi switch to list display.
[0060] S201. Activate and scan the WiFi module.
[0061] After the user turns on the WiFi switch of the terminal device, the terminal device can immediately activate the WiFi module and start scanning for nearby connectable WiFi networks.
[0062] The scan results will form a list containing all networks (such as information like SSID, BSSID, RSSI, etc.), usually denoted as "cachedAccessPoints".
[0063] S202. Load the saved WiFi information.
[0064] Next, the device loads the WiFi information saved by the user from local storage (such as a configuration file, usually denoted as "configs").
[0065] These saved information include the identifiers (such as SSID and / or BSSID) of the historically connected WiFi and their related connection parameters (such as passwords).
[0066] S203. Matching process.
[0067] The terminal device compares the saved WiFi with the scanned WiFi one by one.
[0068] Specifically, for each saved WiFi record, the system traverses the scanned WiFi to determine whether their identifiers (SSID or BSSID) are the same.
[0069] If the match is successful, the system marks this network as a "saved connectable WiFi".
[0070] If there is no match, this network is only treated as an ordinary connectable WiFi.
[0071] For example, if there are M saved WiFi and N scanned WiFi, the terminal device will compare the M saved WiFi with the N scanned WiFi one by one, that is, perform M×N matching comparisons.
[0072] In this way, it can ensure the accurate matching between the saved WiFi and the scanned WiFi.
[0073] S204. Construct and sort the list.
[0074] According to the matching results, the terminal device can construct a complete WiFi list.
[0075] Generally, the terminal device will display the "saved connectable WiFis" at the top (because users are more likely to prefer these networks first), and other WiFis can be sorted and displayed according to signal strength, frequency band, or other priority factors.
[0076] S205. List display and automatic connection.
[0077] Finally, the terminal device can load the refreshed Wi-Fi list and present it to the user. Among them, the top saved WiFis usually initiate connection attempts automatically to enhance the user experience; other WiFis can be manually selected by the user for connection.
[0078] With the daily use of the terminal device, the number of saved WiFis will be increasing. Especially for some practitioners in the fields of communication and wireless networks who need to frequently connect and debug different Wi-Fi networks, the number of saved WiFis in their terminal devices may be very large. According to statistics, after some users have used their mobile phones for three years, the number of saved networks can reach more than 3,000.
[0079] In the case of a large number of saved networks, when the terminal device turns on the Wi-Fi switch, since each saved Wi-Fi needs to be compared and matched with the scanned WiFis one by one, the overall matching time complexity is relatively high (roughly M×N, that is, the number of saved WiFis multiplied by the number of scanned WiFis), and the refresh and loading of the list will be very slow, which greatly affects the user experience.
[0080] Taking the number of saved WiFis as 3,000 as an example, assuming the number of scanned WiFis (i.e., nearby connectable WiFis) is 20, then the number of comparison and matching times is 3,000×20 = 60,000 times, which may take 3 to 6 seconds to fully load the list, resulting in a very serious sense of lag and seriously affecting the user experience.
[0081] To facilitate the understanding of the solution provided by the embodiments of the present application, the following briefly introduces the relevant concepts involved in the embodiments of the present application:
[0082] 1. Hash Table
[0083] A hash table is a key-value structure used for efficient storage and retrieval of data. Its core idea is: through a hash function, the key is converted into an index, and then the data is stored at the position corresponding to this index.
[0084] A hash table is usually composed of hash buckets, and each bucket stores key-value pairs. Each hash bucket has a corresponding index and is stored at the position corresponding to that index.
[0085] Since the computational time complexity of the hash function is O(1), when looking up data, the hash function can directly jump to the corresponding index, avoiding traversing the entire data structure and improving the lookup speed.
[0086] In some embodiments, the hash table can also be denoted as HashMap.
[0087] 2. Hash Function
[0088] The hash function is the core of the hash table and determines how data is stored in the hash table.
[0089] The hash function is mainly used for: calculating the hash value of the Key to map the Key to a discrete integer value; mapping the hash value to an array index to determine the data storage location; and trying to ensure the uniform distribution of hash values, thereby ensuring the uniform distribution of data and avoiding hash collisions.
[0090] 3. The Connection between the Hash Table and the Hash Function
[0091] The hash function can be used to calculate the hash value of the Key and map it to the hash table index.
[0092] The hash table can be used to store data at the corresponding position according to the index obtained from the hash function.
[0093] Therefore, the hash table depends on the hash function for data storage and query.
[0094] For example, during the process of storing data, the index can be obtained by calculating hash(Key) % Table_Size, and then the Key-Value data can be stored at that index position.
[0095] For example, during the process of querying data, the index can be obtained by calculating hash(Key) % Table_Size, and then directly jump to that index position to read the data.
[0096] Therefore, during the process of loading the WiFi list, using a hash table to match the saved WiFi and the scanned WiFi can greatly accelerate the matching speed, improve the matching efficiency, reduce the waiting time for list refreshing, and enhance the user experience.
[0097] Figure 3 It is a schematic flowchart of a list loading method according to an embodiment of the present application. As Figure 3As shown, the execution entity of the list loading method may be the above-mentioned terminal device. Or, Figure 3 the execution entity of the method shown may be a chip in the terminal device. The embodiments of the present application do not make any limitations. Among them:
[0098] S301. Obtain a first identifier set, where the first identifier is the identifier of the accessed device scanned.
[0099] The terminal device may obtain the first identifier set by scanning the network coverage, such as WiFi coverage. The first identifier set may include one or more first identifiers. These one or more first identifiers are respectively the identifiers of one or more accessed devices scanned.
[0100] In some embodiments, the first identifier may be the Service Set Identifier (SSID) of the accessed device scanned.
[0101] In some embodiments, the first identifier may be the Basic Service Set Identifier (BSSID) of the accessed device scanned. Optionally, the BSSID of the accessed device scanned may include the Media Access Control (MAC) address of the accessed device scanned.
[0102] For the case where the accessed device is configured with multiple virtual BSSIDs, it can be considered that there are multiple virtual accessed devices, and each virtual accessed device has a virtual BSSID of its own.
[0103] These scan results may form a list containing all scanned networks (such as information such as SSID, BSSID, RSSI, etc.), which is usually denoted as "cachedAccessPoints".
[0104] S302. Obtain a second identifier set, where the second identifier is the identifier of the accessed device that has been saved.
[0105] The terminal device may load the list of accessed devices that have been saved, such as the saved WiFi list, to obtain the second identifier set. The second identifier set may include one or more second identifiers. These one or more second identifiers are respectively the identifiers of one or more accessed devices that have been saved.
[0106] In some embodiments, the second identifier may be the SSID of the accessed device that has been saved.
[0107] In some embodiments, the second identifier may be the BSSID of the saved access device. Optionally, the BSSID of the saved access device may include the MAC address of the saved access device.
[0108] For the case where an access device is configured with multiple virtual BSSIDs, they can be saved as multiple virtual access devices, each virtual access device having a respective virtual BSSID.
[0109] The list of saved access devices is usually denoted as "configs" and can be saved, for example, in the WiFi module of the terminal device.
[0110] S303. Based on the established hash table, determine the matching result between the first identifier in the first identifier set and the second identifier in the second identifier set.
[0111] Wherein, the hash table includes: a first hash table established based on the first identifier in the first identifier set, or a second hash table established based on the second identifier in the second identifier set.
[0112] In some embodiments, the key of the first hash table may be the identifier of each scanned access device, i.e., the first identifier (such as SSID, BSSID). Optionally, the value may be the relevant information of the scanned access device (such as device name, signal strength, etc.). Optionally, the value may be left empty and directly form a key-value pair with the first identifier of the scanned access device to establish the first hash table.
[0113] In some embodiments, the key of the second hash table may be the identifier of each saved access device, i.e., the second identifier (such as SSID, BSSID). The value may be the information related to the saved access device (such as password, encryption method, etc.).
[0114] Based on the established hash table, the terminal device can match the first identifier of the scanned access device with the second identifier of the saved access device. By checking whether each first identifier in the first identifier set exists in the second identifier set, the terminal device can quickly determine which scanned access devices (e.g., connectable WiFi) belong to the saved access devices (e.g., saved WiFi).
[0115] In some embodiments, the first hash table may be established based on a first hash function. Each first identifier in the first identifier set may be saved as a key in the first hash table respectively. Based on the established hash table, determining the matching result between the first identifiers in the first identifier set and the second identifiers in the second identifier set may include: based on the first hash function, for each second identifier in the second identifier set, looking up whether it exists in the first hash table; based on at least one second identifier in the second identifier set existing in the first hash table, determining that there is a matching relationship between at least one second identifier in the second identifier set and at least one first identifier in the first identifier set.
[0116] The terminal device may construct a first hash table based on the first identifiers (such as the unique identifier of the device, SSID, BSSID, etc.) in the first identifier set of the scanned access device.
[0117] The key of the first hash table may be the first identifier, and its value may be the device information of the scanned access device associated with the identifier (such as the signal strength of WiFi, connection method, etc.). Or, the first hash table may only contain the first identifier itself, that is, only contain the key and the value is empty.
[0118] The terminal device may use the first hash function to convert each first identifier into an index of the hash table based on the hash value calculated from the first identifier, and store it in the position corresponding to the index in the first hash table.
[0119] After constructing the first hash table, the terminal device may then look up the second identifiers (such as the saved WiFi identifiers) in the second identifier set of the saved access devices based on the first hash function, and determine which second identifiers exist in the first hash table, that is, it indicates that the second identifier matches the first identifier at the corresponding position in the first hash table, and thus obtain the matching result.
[0120] The lookup process may include: for each second identifier in the second identifier set (such as the identifier of the saved WiFi), looking up whether the second identifier exists in the first hash table through the first hash function.
[0121] If the second identifier does not exist in the first hash table, it means that the second identifier is not in the identifier set of the scanned access device and thus cannot match the first identifier.
[0122] If the second identifier exists in the first hash table, it indicates that the second identifier matches the first identifier in the first identifier set corresponding to the same position in the first hash table. Optionally, the defined matching logic can be further used to determine the matching relationship between the second identifier and the first identifier in the same position in the first hash table to obtain a more accurate matching result.
[0123] It can be understood that by constructing a hash table of the scanned access devices and checking whether the saved access devices exist in the hash table, since the time complexity of the search process is O(1), it is possible to effectively match the saved access devices with the scanned access devices, significantly improving the matching efficiency.
[0124] Taking the example where the number of saved WiFis M = 3000 in the user's terminal device and the number of scanned WiFis N = 20 that can be connected nearby, in this example, the number of operations that the terminal device needs to perform is 20 + 3000 = 3020 times. Among them, 20 times is the number of times to construct the 20 scanned WiFis one by one into the hash table, and 3000 times is the number of times to compare whether the saved WiFis match the scanned WiFis.
[0125] It can be seen that compared with the linear one-by-one comparison and matching, the number of executions can be optimized from 60000 times to 3000 times, theoretically optimized by nearly 20 times, that is, the number of scanned WiFis N, greatly improving the matching efficiency.
[0126] In some embodiments, the method may further include: maintaining a first hash table; and incrementally updating the first hash table in response to a change in one or more first identifiers obtained by scanning an access device.
[0127] The terminal device can maintain the first hash table and only incrementally update the first hash table when the first identifier of the scanned access device changes, without reconstructing the first hash table every time it scans. Such a change may be caused by the movement of the terminal device. For example, when the terminal device moves at a low speed or within a small range, the set of first identifiers of the scanned access devices will not change significantly, only a small number of first identifiers change, for example, a small number of new WiFis are scanned, or some of the original WiFis are not scanned continuously for multiple times.
[0128] It can be understood that when the identifier of the scanned access device changes, through incremental update, it is possible to respond to the dynamic changes of the network environment, ensure that the hash table always maintains the latest state, improve the real-time response ability, and moreover, incrementally update the hash table instead of reconstructing the hash table every time, avoiding unnecessary repeated calculations and further improving the performance.
[0129] In some embodiments, the second hash table may be established based on a second hash function. Each second identifier in the second identifier set may be saved as a key in the second hash table respectively. Based on the established hash table, determining the matching result between the first identifiers in the first identifier set and the second identifiers in the second identifier set may include: based on the second hash function, for each first identifier in the first identifier set, checking whether it exists in the second hash table; based on at least one first identifier in the first identifier set existing in the second hash table, determining that there is a matching relationship between at least one first identifier in the first identifier set and at least one second identifier in the second identifier set.
[0130] The terminal device may construct a second hash table based on the second identifiers (such as the unique identifier of the device, SSID, BSSID, etc.) in the second identifier set of the saved access devices.
[0131] The key of the second hash table may be the second identifier, and its value may be the relevant information of the saved access device associated with the identifier (such as password, encryption method, etc.).
[0132] The terminal device may use the second hash function to convert each second identifier into an index of the hash table based on the hash value calculated from the second identifier, and store it at the position corresponding to the index in the second hash table.
[0133] After constructing the second hash table, the terminal device may then perform a lookup based on the second hash function for the first identifiers (such as the scanned WiFi identifier) in the first identifier set of the scanned access devices to determine which first identifiers exist in the second hash table, indicating that the first identifier matches the second identifier at the corresponding position in the second hash table, and thus obtaining the matching result.
[0134] The lookup process may include: for each first identifier (such as the identifier of the scanned WiFi) in the first identifier set, checking whether the first identifier exists in the second hash table through the second hash function.
[0135] If the first identifier does not exist in the second hash table, it means that the first identifier is not in the identifier set of the saved access devices and cannot be matched with the second identifier.
[0136] If the first identifier exists in the second hash table, it means that the first identifier matches the second identifier corresponding to the same position in the second identifier set. Optionally, a defined matching logic may further be used to determine the matching relationship between the first identifier and the second identifier at the same position in the second hash table to obtain a more accurate matching result.
[0137] By constructing a hash table of saved access devices and checking whether the scanned access devices exist in the hash table, since the time complexity of the checking process is O(1), it can effectively match the scanned access devices with the saved access devices, significantly improving the matching efficiency. Moreover, since the hash table of saved access devices can be constructed during idle time and does not need to be constructed in real time during each scan, the matching efficiency can be further enhanced.
[0138] Similarly, taking the example where the number M of WiFis saved in the user's terminal device is 3000 and the number N of scanned WiFis that can be connected nearby is 20. In this example, since the hash table of saved WiFis can be constructed and saved in the terminal device during idle time, when matching and comparing the saved WiFis with the scanned WiFis, the number of operations that the terminal device needs to perform is only 20 times, that is, the number of comparison times for matching the 20 scanned WiFis with the saved WiFis through the hash table.
[0139] It can be seen that compared with linear one-by-one comparison and matching, the number of executions can be optimized from 60000 times to 20 times, theoretically optimized by nearly 3000 times, which is the number M of saved WiFis, greatly improving the matching efficiency.
[0140] In some embodiments, the second hash table also stores information of the saved access devices respectively corresponding to each second identifier in the second identifier set. The information of the saved access devices serves as the value value, and respectively forms key-value pairs with their corresponding second identifiers.
[0141] The terminal device can also bind the relevant information (password, encryption method, etc.) of the saved access devices with the identifiers of these saved access devices, and save them in the second hash table in the form of key-value pairs, so that after the scanned access device successfully matches the saved access device, the terminal device can directly query the relevant information of the corresponding access device, which is beneficial for the terminal device to automatically connect to the access device.
[0142] It can be understood that by binding the device information of the saved access devices with the identifiers, it is beneficial to directly obtain the detailed information related to the access devices, ensuring that the status and data of the devices can be checked at any time, which is applicable to data tracking and management during the device connection process, and is beneficial for optimizing the device management and query processes.
[0143] In some embodiments, the method further includes: maintaining the second hash table; and updating the second hash table in response to a change in the information of the saved access devices.
[0144] The terminal device can maintain a second hash table and update the second hash table when the relevant information (such as password, encryption method, etc.) of the saved access device changes, so that after the scanned access device successfully matches the saved access device, the terminal device can successfully connect to the corresponding access device.
[0145] It can be understood that as the information of the access device changes, the terminal device can automatically update the hash table, which can maintain the consistency and currency of the data, ensure that the device management information always matches the actual situation, and improve the adaptive ability of the system.
[0146] In some embodiments, the first identifier and the second identifier include the SSID and / or BSSID of the access device.
[0147] Optionally, the first identifier and the second identifier can only include the SSID of the access device.
[0148] That is to say, the first identifier can only include the SSID of the scanned access device, and the second identifier can only include the SSID of the saved access device.
[0149] Using the SSID as the key in the hash table can avoid the inconvenience of repeatedly entering the password for WiFis with the same name and the same password. For example, currently many routing devices can simultaneously send WiFis in both the 2.4G and 5G frequency bands, and the two WiFis can have the same name (the same SSID) and the same password. Using the SSID as the key can eliminate the need to repeatedly enter the password for the two-band WiFis and can save the resource overhead of the hash table.
[0150] However, for WiFis with the same SSID but different passwords, connection failures may occur, or other hash conflict resolution methods / algorithms need to be adapted to handle the relevant information of access devices with the same SSID.
[0151] Optionally, the first identifier and the second identifier can only include the BSSID of the access device.
[0152] That is to say, the first identifier can only include the BSSID of the scanned access device, and the second identifier can only include the BSSID of the saved access device.
[0153] Using the BSSID as the key can distinguish between two different WiFis even if they have the same name (such as SSID), but WiFis with the same name and the same password need to be saved separately.
[0154] Optionally, the first identifier and the second identifier can include the SSID and BSSID of the access device.
[0155] That is to say, the first identifier may include the SSID and BSSID of the scanned access device, and the second identifier may include the SSID and BSSID of the saved access device.
[0156] In some cases, a combination of SSID and BSSID can be used as an identifier.
[0157] The SSID and BSSID can be combined to form a unique identifier as the key of the hash table. In this way, each entry in the hash table (hash bucket, which can be the relevant information of the access device in this application) can be uniquely identified according to the SSID and BSSID.
[0158] The combined key can be a string (e.g., "SSID_BSSID").
[0159] Alternatively, the SSID and BSSID can be merged into a numerical value and used as the key of the hash table. For example, different (independent) hash functions can be used to calculate the hash values for the SSID and BSSID in the identifier, and then the hash values of the two are combined to create a key. For example, after summing the hash values of the two, the hash function is used again to calculate the hash value.
[0160] Hash conflicts are usually caused by the uneven distribution of hash values. Therefore, using two independent hash functions to process the SSID and BSSID to obtain hash values and combining them is conducive to better distribution of the keys in the hash table and helps reduce the possibility of hash conflicts.
[0161] In some cases, a hierarchical hash structure can be constructed using the SSID and BSSID.
[0162] Specifically, first, a first-level hash table can be constructed based on the SSID as the key. The value of this first-level hash table is a second-level hash table constructed based on the BSSID as the key, and the relevant information of the access device corresponding to the SSID and BSSID is stored as the value of the second-level hash table.
[0163] Since the combination of the SSID and BSSID forms a two-level hash table, the conflicts in the first-level hash table have been effectively reduced. Then, a second hash is performed on the BSSID within each SSID, which is conducive to further dispersing the conflicts and helps improve the accuracy and stability of network connections. Moreover, this hierarchical hash structure can support complex multi-level data organization, making multi-level device management possible.
[0164] It can be understood that through the design that the first identifier and the second identifier include the SSID and / or BSSID of the access device, the matching method can be made more flexible, which is conducive to avoiding hash conflicts and more accurately identifying the access device.
[0165] S304. Load the access information of the access device determined according to the matching result into the list.
[0166] The terminal device can load the relevant information (such as SSID, BSSID, signal strength, encryption method, etc.) of the successfully matched access device into the WiFi list according to the matching result.
[0167] Generally, the saved access devices that are successfully matched can be displayed at the top, because these access devices may be the devices that the user will connect to first.
[0168] The scanned access devices can be sorted and displayed according to priorities such as signal strength and frequency band (2.4GHz / 5GHz).
[0169] Furthermore, if the scanned access device matches the saved access device, the terminal device can also automatically attempt to connect to the access device to improve the user experience.
[0170] It can be understood that by determining the matching relationship between the scanned access device and the saved access device based on a hash table, the linear search matching method can be avoided, the matching complexity between the scanned access device and the saved access device can be effectively reduced, the matching speed between the scanned access device and the saved access device can be improved, the access device that is matched can be determined with a complexity of O(1), which is beneficial to optimizing the loading speed of the access device list and improving the user experience.
[0171] The list loading method provided by the embodiments of the present application can be applied to the user's electronic device. For example, the electronic device can be a mobile phone, a tablet computer, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device, a media player and other portable mobile devices with image processing capabilities, or the electronic device can also be a wearable electronic device such as a smart watch. The embodiments of the present application do not impose special restrictions on the specific form of the device.
[0172] Figure 4 It is a schematic diagram of the hardware structure of an electronic device provided by the embodiments of the present application.
[0173] The electronic device 400 may include a processor 410, an external memory interface 420, an internal memory 421, a universal serial bus (USB) interface 430, a charging management module 440, a power management module 441, a battery 442, antenna 1, antenna 2, a mobile communication module 450, a wireless communication module 460, an audio module 470, a speaker 470A, a receiver 470B, a microphone 470C, a headphone jack 470D, a sensor module 480, keys 490, a motor 491, an indicator 492, a camera 493, a display screen 494, and a subscriber identification module (SIM) card interface 495, etc. The sensor module 480 may include a pressure sensor 480A, a gyroscope sensor 480B, a barometric pressure sensor 480C, a magnetic sensor 480D, an acceleration sensor 480E, a distance sensor 480F, a proximity light sensor 480G, a fingerprint sensor 480H, a temperature sensor 480J, a touch sensor 480K, an ambient light sensor 480L, a bone conduction sensor 480M, etc.
[0174] The processor 410 may include one or more processing units. For example, the processor 410 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0175] Among them, the controller may be the nerve center and command center of the electronic device 400. The controller may generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0176] A memory may also be provided in the processor 410 for storing instructions and data.
[0177] In some embodiments, the memory in the processor 410 is a cache memory. This memory can store instructions or data that the processor 410 has just used or recycled. If the processor 410 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 410, and thus improves the efficiency of the system. The processor 410 calls the instructions or data stored in the memory to cause the electronic device 400 to execute the methods performed by the electronic device in the following method embodiments.
[0178] In some embodiments, the processor 410 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0179] The charging management module 440 is configured to receive a charging input from a charger. Among them, the charger can be a wireless charger or a wired charger.
[0180] The power management module 441 is used to connect the battery 442, the charging management module 440, and the processor 410. The power management module 441 receives inputs from the battery 442 and / or the charging management module 440 and supplies power to the processor 410, the internal memory 421, the external memory, the display screen 494, the camera 493, and the wireless communication module 460, etc. In some other embodiments, the power management module 441 may also be disposed in the processor 410.
[0181] The wireless communication function of the electronic device 400 can be implemented by the antenna 1, the antenna 2, the mobile communication module 450, the wireless communication module 460, the modulation and demodulation processor, and the baseband processor, etc.
[0182] Antenna 1 and Antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 400 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, Antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0183] The mobile communication module 450 can provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the electronic device 400. The mobile communication module 450 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
[0184] The mobile communication module 450 can receive electromagnetic waves through Antenna 1, and perform processing such as filtering and amplifying on the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 450 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through Antenna 1 and radiate it out.
[0185] In some embodiments, at least some functional modules of the mobile communication module 450 can be disposed in the processor 410.
[0186] In some embodiments, at least some functional modules of the mobile communication module 450 and at least some modules of the processor 410 can be disposed in the same device.
[0187] The modulation and demodulation processor can include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor.
[0188] The wireless communication module 460 can provide solutions for wireless communications applied to the electronic device 400, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), BLE broadcast, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc.
[0189] The wireless communication module 460 can be one or more devices integrating at least one communication processing module. The wireless communication module 460 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 410. The wireless communication module 460 can also receive the signals to be sent from the processor 410, perform frequency modulation on them, amplify them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0190] The electronic device can be connected to a Bluetooth headset through the wireless communication module 460.
[0191] The display screen 494 is used to display images, videos, etc. The display screen 494 includes a display panel. In some embodiments, the electronic device 400 can include one or N display screens 494, where N is a positive integer greater than 1. Among them, the display screen 494 can be an outward-foldable folding screen, that is, a display screen that folds outward.
[0192] The electronic device 400 can implement a shooting function through an ISP, a camera 493, a video codec, a GPU, a display screen 494, an application processor, etc. The ISP is used to process the data fed back by the camera 493. The camera 493 is used to capture static images or videos. The camera 493 can include a front camera and a rear camera. The front camera is located in the display area of the screen, and the rear camera is located in the back area of the screen.
[0193] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. The video codec is used to compress or decompress digital videos. The electronic device 400 can support one or more video codecs.
[0194] The NPU is a neural-network (NN) computing processor. By learning from the structure of biological neural networks, such as the transmission mode between human brain neurons, it can quickly process input information and can also continuously self-learn.
[0195] The external memory interface 420 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 400. The external memory card communicates with the processor 410 through the external memory interface 420 to implement the data storage function.
[0196] The internal memory 421 can be used to store computer-executable program codes, and the executable program codes include instructions. The processor 410 executes various functional applications and data processing of the electronic device 400 by running the instructions stored in the internal memory 421. The internal memory 421 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function), etc. The data storage area can store data created during the use of the electronic device 400 (such as audio data), etc. In addition, the internal memory 421 can include a high-speed random access memory and can also include a non-volatile memory, such as a flash memory device, etc.
[0197] The electronic device 400 can implement audio functions through the audio module 470, the speaker 470A, the receiver 470B, the microphone 470C, the headphone jack 470D, and the application processor, etc. For example, music playback, recording, etc.
[0198] The audio module 470 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 470 can also be used to encode and decode audio signals.
[0199] In some embodiments, the audio module 470 can be disposed in the processor 410, or some functional modules of the audio module 470 can be disposed in the processor 410.
[0200] The speaker 470A, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal.
[0201] The receiver 470B, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal.
[0202] The microphone 470C, also known as the "microphone", "transmitter", is used to convert a sound signal into an electrical signal.
[0203] The headphone jack 470D is used to connect a wired headphone.
[0204] The electronic device 400 can implement the function of acquiring signals through the sensor module 480.
[0205] The pressure sensor 480A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 480A can be disposed on the display screen 494.
[0206] The gyroscope sensor 480B can be used to determine the motion posture of the electronic device 400.
[0207] The barometric pressure sensor 480C is used to measure barometric pressure.
[0208] The magnetic sensor 480D includes a Hall sensor.
[0209] The acceleration sensor 480E can detect the magnitude of the acceleration of the electronic device 400 in various directions (generally three axes).
[0210] The distance sensor 480F is used to measure distance. The proximity light sensor 480G may include, for example, a light emitting diode (LED) and a light detector.
[0211] The ambient light sensor 480L is used to sense the ambient light brightness.
[0212] The fingerprint sensor 480H is used to collect fingerprints.
[0213] The temperature sensor 480J is used to detect temperature.
[0214] The touch sensor 480K is also called a "touch panel".
[0215] The touch sensor 480K can be disposed on the display screen 494. The touch sensor 480K and the display screen 494 form a touch screen, which is also called a "touch screen". The touch sensor 480K is used to detect touch operations acting thereon or nearby.
[0216] The bone conduction sensor 480M can acquire vibration signals.
[0217] The keys 490 include a power-on key, volume keys, etc.
[0218] The motor 491 can generate a vibration prompt.
[0219] The indicator 492 can be an indicator light, which can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0220] The SIM card interface 495 is used to connect a SIM card.
[0221] In addition, an operating system runs on the above components. For example, operating systems such as iOS and Android. The operating system of the electronic device 400 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservices architecture, or cloud architecture. In this embodiment of the application, the Android system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the electronic device 400. It should be noted that although this embodiment of the application takes the Android system as an example for description, its basic principle also applies to electronic devices with other operating systems.
[0222] It can be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 400. In other embodiments of the present application, the electronic device 400 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 illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0223] The electronic device may also have a layered architecture of software, and different layers may be provided with their respective corresponding modules or components for implementing corresponding functions.
[0224] Figure 5 It is a schematic diagram of the layered architecture of the software and hardware of an electronic device provided by an embodiment of the present application.
[0225] Such as Figure 5 As shown, the software and hardware architecture of the electronic device may adopt a layered architecture. The layered architecture divides the system into several layers, and each layer has a clear role and division of labor. Communication between layers is through software interfaces.
[0226] Such as Figure 5 As shown, the software and hardware structure framework of the electronic device involved in the present application may include an application layer, an application framework layer (framework, FWK), a system library, and an Android runtime, a hardware abstract layer (hardware abstract layer, HAL) (not shown), a kernel layer, and a hardware layer.
[0227] The application layer (application) may include a series of applications. For example, the application package may include applications such as WLAN applications, Bluetooth applications, application continuation, call sharing, notification sharing, keyboard and mouse sharing, file sharing, screen mirroring, video, and gallery, as well as other applications not shown, such as music, camera, browser, and other applications.
[0228] The WLAN application is mainly used to implement the opening, connection, and setting of WLAN, and the Bluetooth application is used to implement the opening, connection, and setting of Bluetooth.
[0229] In some embodiments, the WLAN application may be a sub-application of a settings application (not shown), and the settings application may be used to set various functions of the electronic device.
[0230] The application continuation application is used to implement the mutual continuation of the content and usage status of applications between this electronic device and nearby devices.
[0231] The call sharing application is used to implement the answering and continuation of calls from this electronic device by nearby devices. Exemplarily, the smart screen can answer calls from this electronic device, and tablets and computers also support making calls.
[0232] Notification sharing is used to enable nearby devices to receive notifications from this electronic device and support processing on these devices.
[0233] Keyboard and mouse sharing is used to share input devices between this electronic device and nearby computers, or to share the mouse, keyboard, and touchpad of a computer or tablet for use with this electronic device. It can also enable cross-device file transfer, cross-device window display and use.
[0234] The file sharing application is used to wirelessly share files with other electronic devices within the same network, enabling fast file sharing or printing.
[0235] The screen mirroring application is used to link the local device to a large-screen device to display content such as videos shown on this electronic device through the large-screen device, or to link the local device to a small-screen device to display content such as videos shown on the small-screen device through the large screen on this electronic device. Here, "large screen" and "small screen" refer to the relative sizes of the display screens of electronic devices.
[0236] 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. The application framework layer may include a window manager, a content provider, a view system, a resource manager, a path establishment system, a session management system, and a sending and receiving system, etc.
[0237] The application framework layer may also include a hash map and hash collision management.
[0238] The hash map can be used to create a hash table, and the hash collision management can be used to resolve hash collisions. The specific function implementation can refer to the method shown and described as Figure 3 shown and will not be elaborated here.
[0239] Runtime is responsible for the scheduling and management of the system. Runtime includes a core library and a virtual machine. Among them, the core library consists of two parts: one part is the functional functions that need to be called by a programming language (e.g., the Java language), and the other part is the core library of the system.
[0240] The application layer and the application framework layer can run in the virtual machine. The virtual machine executes the programming files (e.g., Java files) of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0241] The system library may include multiple functional modules. For example: Surface Manager, Media Libraries, 3D image processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc.
[0242] The Surface Manager is used to manage the display subsystem and provides the fusion of 2D (2-Dimensional) and 3D (3-Dimensional) layers for multiple applications.
[0243] The Media Libraries support the playback and recording of multiple common audio and video formats, as well as static image files, etc. The Media Libraries can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0244] The 3D image processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0245] The 2D graphics engine is a drawing engine for 2D drawing.
[0246] The ARP state is used to obtain and maintain the ARP information of the access device and determine whether the ARP state of the access device is normal.
[0247] The Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and the upper-layer software, and its purpose is to abstract the hardware. The Hardware Abstraction Layer is an abstract interface for device kernel drivers and is used to implement an application programming interface for accessing the underlying device to a higher-level Java API framework. HAL can contain multiple library modules, and each library module implements an interface for a specific type of hardware component.
[0248] The kernel layer is the foundation of the Android operating system, and all the final functions of the Android operating system are completed through the kernel layer. The kernel layer can contain WiFi drivers, Bluetooth drivers, display drivers, camera drivers, audio drivers, etc.
[0249] The Bluetooth driver is used to drive the Bluetooth module.
[0250] The WiFi driver is used to drive the WiFi module, and furthermore, the WiFi driver can also be used to implement WiFi connection / authorization and the function of determining the WiFi roaming state.
[0251] The hardware layer may include a WiFi module, a Bluetooth module, etc., and may also include a display, a microphone, a camera, a memory, an audio encoder, a video encoder, and so on.
[0252] It should be noted that what this application providesFigure 5 The schematic diagram of the software structure of the electronic device shown is only an example,
[0253] and does not limit the specific module division in different layers of the Android operating system. Specifically, reference can be made to the introduction of the software structure of the Android operating system in the conventional technology. In addition, the device communication method provided in this application can also be implemented based on other operating systems, and no further examples will be given in this application.
[0254] Figure 6 It is a schematic diagram of the structure of a communication device according to an embodiment of the present application. Figure 6 The communication device 600 shown can be a terminal device, or a device in the terminal device, or a device that can be used in matching with the terminal device.
[0255] Figure 6 The communication device 600 shown may include an acquisition unit 601 and a processing unit 602. Among them:
[0256] The acquisition unit 601 is used to acquire a first identifier set, where the first identifier is the identifier of the accessed device scanned.
[0257] The acquisition unit 601 is further used to acquire a second identifier set, where the second identifier is the identifier of the accessed device that has been saved.
[0258] The processing unit 602 is used to determine the matching result between the first identifier in the first identifier set and the second identifier in the second identifier set based on the established hash table, where the hash table includes: a first hash table established based on the first identifier in the first identifier set, or a second hash table established based on the second identifier in the second identifier set.
[0259] The processing unit 602 is further used to load the access information of the accessed device determined according to the matching result into the list.
[0260] The communication device 600 provided in the present application can avoid using the linear search matching method by determining the matching relationship between the accessed device scanned and the accessed device that has been saved based on the hash table, effectively reducing the matching complexity between the accessed device scanned and the accessed device that has been saved, improving the matching speed between the accessed device scanned and the accessed device that has been saved, being beneficial to optimizing the loading speed of the accessed device list, and enhancing the user experience.
[0261] In a possible implementation, the first hash table is established based on a first hash function. Each first identifier in the first identifier set is saved as a key in the first hash table. Based on the established hash table, determining the matching result between the first identifiers in the first identifier set and the second identifiers in the second identifier set includes: based on the first hash function, for each second identifier in the second identifier set, checking whether it exists in the first hash table; based on at least one second identifier in the second identifier set existing in the first hash table, determining that there is a matching relationship between at least one second identifier in the second identifier set and at least one first identifier in the first identifier set.
[0262] Based on this implementation, by constructing a hash table of the scanned access devices and checking whether the saved access devices exist in the hash table, since the time complexity of the lookup process is O(1), it can effectively match the saved access devices with the scanned access devices, significantly improving the matching efficiency.
[0263] In a possible implementation, the processing unit 602 is further configured to: maintain the first hash table; in response to a change in one or more first identifiers obtained by scanning the access device, perform an incremental update on the first hash table.
[0264] Based on this implementation, when the identifier of the scanned access device changes, through incremental update, it can respond to the dynamic changes of the network environment, ensure that the hash table always maintains the latest state, improve the real-time response ability, and moreover, incrementally update the hash table instead of rebuilding the hash table every time, avoiding unnecessary repeated calculations and further improving the performance.
[0265] In a possible implementation, the second hash table is established based on a second hash function. Each second identifier in the second identifier set is saved as a key in the second hash table. Based on the established hash table, determining the matching result between the first identifiers in the first identifier set and the second identifiers in the second identifier set includes: based on the second hash function, for each first identifier in the first identifier set, checking whether it exists in the second hash table; based on at least one first identifier in the first identifier set existing in the second hash table, determining that there is a matching relationship between at least one first identifier in the first identifier set and at least one second identifier in the second identifier set.
[0266] Based on this implementation method, by constructing a hash table of the saved access devices and checking whether the scanned access devices exist in the hash table, since the time complexity of the search process is O(1), it can effectively match the scanned access devices with the saved access devices, significantly improving the matching efficiency. Moreover, since the hash table of the saved access devices can be constructed during idle time and does not need to be constructed in real time during each scan, the matching efficiency can be further improved.
[0267] In a possible implementation method, the second hash table also stores the information of the saved access devices respectively corresponding to each second identifier in the second identifier set. The information of the saved access devices serves as the value value, and respectively forms key-value pairs with their corresponding second identifiers.
[0268] Based on this implementation method, by binding the device information of the saved access devices with the identifiers, it is beneficial to directly obtain the detailed information related to the access devices, ensuring that the status and data of the devices can be checked at any time, which is applicable to data tracking and management during the device connection process and is beneficial to optimizing the device management and query processes.
[0269] In a possible implementation method, the processing unit 602 is further configured to: maintain the second hash table; and update the second hash table in response to a change in the information of the saved access devices.
[0270] Based on this implementation method, as the information of the access devices changes, the hash table can be automatically updated, which can maintain the consistency and currency of the data, ensure that the device management information always matches the actual situation, and improve the adaptive ability of the system.
[0271] In a possible implementation method, the first identifier and the second identifier include the SSID and / or BSSID of the access device.
[0272] Based on this implementation method, the matching method can be made more flexible, which is beneficial to avoiding hash collisions and more accurately identifying access devices.
[0273] Figure 7 It is a schematic structural diagram of a communication device provided by an embodiment of the present application. The communication device 700 may be the terminal device or the network device in the above method embodiment, or may also be a chip, a chip system, or a processor, etc. that supports the terminal device or the network device to implement the above method. This communication device can be used to implement the method described in the above method embodiment, and specific reference can be made to the description in the above method embodiment.
[0274] The communication device 700 may include one or more processors 701. The processor 701 may be a general-purpose processor or a dedicated processor, etc. For example, it may be a baseband processor or a central processing unit. The baseband processor may be used to process the communication protocol and communication data, and the central processing unit may be used to control the communication device (such as a base station, a baseband chip, a terminal, a terminal chip, a DU or a CU, etc.), execute a software program, and process the data of the software program.
[0275] Optionally, the communication device 700 may include one or more memories 702, on which instructions 704 may be stored, and the instructions may be executed on the processor 701, so that the communication device 700 performs the method described in the above method embodiment. Optionally, data may also be stored in the memory 702. The processor 701 and the memory 702 may be provided separately or integrated together.
[0276] Optionally, the communication device 700 may further include a transceiver 705 and an antenna 706. The transceiver 705 may be referred to as a transceiver unit, a transceiver, or a transceiver circuit, etc., and is used to implement a transceiver function. The transceiver 705 may include a receiver and a transmitter, the receiver may be referred to as a receiver or a receiving circuit, etc., and is used to implement a receiving function; the transmitter may be referred to as a transmitter or a transmitting circuit, etc., and is used to implement a transmitting function. Figure 6 The processing unit 602 shown may be the processor 701 .
[0277] In another possible design, the processor 701 may include a transceiver for implementing the receiving and sending functions. For example, the transceiver may be a transceiver circuit, or an interface, or an interface circuit. The transceiver circuit, interface, or interface circuit for implementing the receiving and sending functions may be separate or integrated. The above-mentioned transceiver circuit, interface, or interface circuit may be used for reading and writing code / data, or the above-mentioned transceiver circuit, interface, or interface circuit may be used for transmitting or delivering signals.
[0278] In another possible design, optionally, the processor 701 may store an instruction 703, and the instruction 703 runs on the processor 701, so that the communication device 700 can execute the method described in the above method embodiment. The instruction 703 may be solidified in the processor 701, in which case the processor 701 may be implemented by hardware.
[0279] The communication device described in the above embodiments may be a terminal device or a network device, but the scope of the communication device described in the embodiments of the present application is not limited thereto, and the structure of the communication device may not be limited thereto. Figure 7 The communication device may be an independent device or may be part of a larger device. For example, the communication device may be:
[0280] (1) An independent integrated circuit IC, or chip, or chip system or subsystem;
[0281] (2) A set having one or more ICs, optionally, the IC set may also include storage components for storing data and instructions;
[0282] (3) ASIC, such as a modem (MSM);
[0283] (4) A module that can be embedded in other devices;
[0284] (5) A receiver, terminal, smart terminal, cellular phone, wireless device, handset, mobile unit, vehicle-mounted device, network device, cloud device, artificial intelligence device, etc.;
[0285] (6) Others, etc.
[0286] For the case where the communication device can be a chip or a chip system, reference can be made to Figure 8 The structural schematic diagram of the shown chip. Figure 8 The shown chip 800 includes a processor 801 and an interface 802. Optionally, it may further include a memory 803. Among them, the number of processors 801 can be one or more, and the number of interfaces 802 can be multiple.
[0287] For the case where the chip is used to implement the terminal device or network device in the embodiments of the present application:
[0288] The interface 802 is used to receive or output signals;
[0289] The processor 801 is used to perform data processing operations of the terminal device or network device.
[0290] It can be understood that some optional features in the embodiments of the present application can, in some scenarios, be independently implemented without relying on other features, such as the current scheme it is based on, to solve the corresponding technical problems and achieve the corresponding effects. In some scenarios, they can also be combined with other features according to requirements. Correspondingly, the communication devices given in the embodiments of the present application can also correspondingly implement these features or functions, which will not be elaborated here.
[0291] It should be understood that the processor in the embodiments of the present application may be an integrated circuit chip with the ability to process signals. In the implementation process, the steps of the above method embodiments may be completed by the integrated logic circuit in the hardware of the processor or instructions in the form of software. The above processor may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0292] It can be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0293] The present application also provides a computer-readable medium, in which a computer program or instructions are stored. When the computer program or instructions are executed by a communication device, the functions of any of the above method embodiments are implemented.
[0294] The present application also provides a computer program product including instructions. When a computer reads and executes the computer program product, the computer is enabled to implement the functions of any of the above method embodiments.
[0295] The present application provides a communication system, which includes a terminal device and a network device; wherein the terminal device is used to execute the method executed by the terminal device in the above embodiments, and the network device is used to execute the method executed by the network device in the above embodiments.
[0296] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0297] The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0298] The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.).
[0299] The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrating one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a high-density digital video disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0300] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain operations can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0301] The descriptions of the embodiments provided in this application can be referred to each other. Each description of an embodiment has its own emphasis. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. For the convenience and conciseness of description, for example, regarding the functions and operations performed by the various devices and apparatuses provided in the embodiments of this application, reference can be made to the relevant descriptions of the method embodiments of this application. The method embodiments can also refer to, combine with, or cite each other, and the device embodiments can also do the same.
[0302] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, not to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A list loading method, characterized in that: The method comprises: Acquire a first identification set, wherein the first identification is an identification of a scanned access device; Acquire a second identification set, wherein the second identification is an identification of a saved access device; Determine, based on the established hash table, a matching result between a first identifier in the first identifier set and a second identifier in the second identifier set, wherein the hash table includes: a first hash table established based on the first identifier in the first identifier set, or a second hash table established based on the second identifier in the second identifier set; The access information of the access device determined according to the matching result is loaded into the list.
2. The method according to claim 1, characterized in that The first hash table is established based on a first hash function, each first identifier in the first identifier set is respectively stored as a key Key in the first hash table, and determining a matching result between a first identifier in the first identifier set and a second identifier in the second identifier set based on the established hash table includes: Based on the first hash function, searching for each second identifier in the second identifier set to determine whether the second identifier exists in the first hash table; Based on the fact that at least one second identifier in the second identifier set exists in the first hash table, it is determined that there is a matching relationship between at least one second identifier in the second identifier set and at least one first identifier in the first identifier set.
3. The method according to claim 2, characterized in that The method further comprises: Maintaining the first hash table; In response to a change in one or more first identifiers obtained by scanning access devices, the first hash table is incrementally updated.
4. The method according to claim 1, characterized in that: The second hash table is established based on a second hash function, each second identifier in the second identifier set is respectively stored as a key Key in the second hash table, and determining a matching result between a first identifier in the first identifier set and a second identifier in the second identifier set based on the established hash table includes: Based on the second hash function, searching for each first identifier in the first identifier set to determine whether the first identifier exists in the second hash table; Based on the fact that at least one first identifier in the first identifier set exists in the second hash table, it is determined that a matching relationship exists between at least one first identifier in the first identifier set and at least one second identifier in the second identifier set.
5. The method according to claim 4, characterized in that The second hash table also stores the saved access device information corresponding to each second identifier in the second identifier set, and the saved access device information is used as the value value to form a key-value pair with the corresponding second identifier.
6. The method according to claim 5, characterized in that The method further comprises: Maintaining the second hash table; In response to a change in the stored information of the access device, the second hash table is updated.
7. The method according to any one of claims 1 to 6, characterized in that The first identifier and the second identifier include an SSID and / or a BSSID of an access device.
8. A communication device, characterized in that: include: An acquiring unit, configured to acquire a first identification set, wherein the first identification is an identification of a scanned access device; The acquisition unit is further configured to acquire a second identification set, wherein the second identification is an identification of a saved access device; a processing unit, configured to determine a matching result between a first identifier in the first identifier set and a second identifier in the second identifier set based on an established hash table, wherein the hash table comprises: a first hash table established based on the first identifier in the first identifier set, or a second hash table established based on the second identifier in the second identifier set; The processing unit is further configured to load access information of the access device determined according to the matching result into the list.
9. A communication device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are coupled, and the processor is used to implement the method according to any one of claims 1 to 7.
10. A chip, characterized in that: It comprises a processor and an interface, wherein the processor and the interface are coupled; the interface is used to receive or output signals, and the processor is used to execute code instructions so that the method described in any one of claims 1 to 7 is executed.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called by the computer, the computer executes the method according to any one of claims 1 to 7.
12. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and equipment for assistance inquiry, method and equipment for inquiry, and named query system
CN103186653A
Wireless local area network connection method and device
CN105744598A
Method for automatically switching configured routers by intelligent equipment
CN108012311A
Hash conflict processing method and device and computer readable storage medium
CN111352931A
Data retrieval method, device and equipment and machine readable storage medium
CN114647658A