Method and device for acquiring a wifi list

By transferring the Wi-Fi scanning capability to the IoT device and performing buffering accumulation and deduplication on the mobile terminal, the instability issue when IoT devices obtain the Wi-Fi list is resolved, achieving stable display and low resource consumption of the Wi-Fi list.

CN123145666APending Publication Date: 2026-11-20BEIJING QIREN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611399744.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-10
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

When IoT devices obtain a list of surrounding Wi-Fi networks, issues such as operating system permission restrictions, uncontrollable Bluetooth transmission timing, out-of-order and duplicate data packets, and a lack of unified transmission control lead to unstable Wi-Fi list display, resulting in problems such as duplicates, content jumps, and interface lag.

Method used

The Wi-Fi scanning capability is transferred from the mobile terminal to the IoT device. The entry packets are transmitted via Bluetooth Low Energy communication, and buffering and deduplication are performed on the mobile terminal side. Deduplication and display are triggered only when predetermined conditions are met or no new packets arrive for a predetermined period of time, thereby reducing system resource consumption and avoiding frequent refreshes.

Benefits of technology

It achieves a stable display of the Wi-Fi list on IoT devices, avoiding duplicate access points and content jumps, and improving the stability and efficiency of interface refresh.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123145666A_ABST
    Figure CN123145666A_ABST
Patent Text Reader

Abstract

The application relates to the field of network configuration of Internet of Things devices, and discloses a Wifi list acquisition method and device. The application performs Wifi scanning by an Internet of Things device, and a mobile terminal only receives scanning results, so that a complete Wifi list is obtained. After receiving an entry package, the application does not directly display the entry package, but generates buffer accumulation information according to the received entry package. When the buffer accumulation information meets a predetermined trigger condition and / or there is no newly received entry package within a predetermined time length, subsequent all entry package deduplication and display operations are triggered, so that the trigger frequency is reduced, system resource consumption caused by dense arrival of entry packages is effectively reduced, and the method can avoid frequent refreshing of a display interface, avoid repeated access points, content jumping and rendering lagging in the display process of the Wifi list, and thus stable display of the Wifi list is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of IoT device network configuration, and in particular to a method and device for obtaining a Wi-Fi list. Background Technology

[0002] In the network configuration process of IoT devices, mobile terminals need to obtain a list of surrounding Wi-Fi networks for users to choose from. Mobile terminals typically obtain this list by calling the system's built-in Wi-Fi scanning interface. However, due to user privacy considerations, mobile terminal operating systems strictly limit third-party applications from calling the Wi-Fi scanning interface, preventing them from obtaining the surrounding Wi-Fi list during the configuration process. Traditional solutions attempt to transfer the Wi-Fi scanning function from the mobile terminal to the IoT device, with the device scanning and transmitting the results to the mobile terminal. However, when the IoT device transmits the scanned Wi-Fi access point information back via Bluetooth, the lack of reliable segmented transmission control, timing control, and acknowledgment mechanisms makes it prone to data packet out-of-order transmission, duplication, or loss during transmission, especially in situations with co-channel interference or distance jitter. This results in duplicate access points in the Wi-Fi list displayed on the mobile terminal's interface, and frequent interface refreshes cause content jumps and rendering stutters in the displayed Wi-Fi list.

[0003] Therefore, how to reliably acquire and display the list of Wi-Fi networks scanned by IoT devices is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] This application provides a method and device for obtaining a Wi-Fi list, so as to reliably obtain and display the Wi-Fi list scanned by IoT devices.

[0005] Firstly, this application provides a method for obtaining a Wi-Fi list, the method being applied to a mobile terminal, comprising: Send Wi-Fi scanning commands to IoT devices; Receive the entry packet returned by the IoT device; the entry packet is a data packet generated by the IoT device by encapsulating the information of each scanned access point; Generate buffer accumulation information based on the received entry packets; When the buffer accumulation information meets the predetermined triggering condition, and / or no new entry packets are received within a predetermined time period, all received entry packets are deduplicated. A list of Wi-Fi networks is generated and displayed based on the deduplicated entry packets.

[0006] Optionally, a Wi-Fi scanning command is sent to the IoT device, including: Generate the task identifier for this round of scanning; A Wi-Fi scanning command is generated using a predefined communication protocol payload structure; the Wi-Fi scanning command includes: a scanning command code and the task identifier; Send the Wi-Fi scanning command to the Internet of Things device.

[0007] Optionally, receiving the entry packet returned by the IoT device includes: Receive data packets returned by the IoT device; the data packets are generated by the IoT device using a predefined communication protocol payload structure; Extract the instruction code and entry number from the data packet; When the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the data packet is treated as an entry packet; When the instruction code is a return instruction code and the entry sequence number is a negative integer, the data packet is used as an end marker packet.

[0008] Optionally, after receiving the data packet returned by the IoT device, the method further includes: Obtain the task identifier carried in the data packet; If the task identifier carried is the same as the task identifier of the current scan, the data packet is retained; if the task identifier carried is different from the task identifier of the current scan, the data packet is discarded.

[0009] Optionally, after sending the Wi-Fi scanning command to the IoT device, the following steps are also included: Start a timeout timer. When the timeout duration exceeds the timeout threshold and no end marker packet or entry packet is received, display a message indicating that the scan is unresponsive.

[0010] Optionally, after the data packet is used as an end-of-processing marker packet, the following further includes: Extract the total number of entries in the end-of-packet marker; When the total number of entries is greater than zero, it is determined that the IoT device has sent all the entry packets of this round of scanning. When no new entry packets are received within a predetermined time, all received entry packets are deduplicated, and a Wi-Fi list is generated and displayed based on the deduplicated entry packets. When the total number of entries is zero, the scan result is determined to be empty, and a blank Wi-Fi list is displayed.

[0011] Optionally, deduplication of all received entry packets includes: Retrieve the service set identifier for all item packages; The duplicate entry packets with the same service set identifier and the entry packets that match the device hotspot of the mobile terminal are removed from all entry packets to obtain the deduplicated entry packets.

[0012] Secondly, this application provides an Internet of Things (IoT) device, comprising: Memory, used to store computer programs; When a processor executes the computer program, it performs the following steps: Receive Wi-Fi scanning commands sent by mobile terminals; In response to the Wifi scanning command, initiate a Wifi scan to obtain information about each access point; Each access point's information is encapsulated to generate an entry packet; The entry packet is sent to the mobile terminal so that the mobile terminal generates buffer accumulation information based on the received entry packet. When the buffer accumulation information meets a predetermined trigger condition and / or no new entry packet is received within a predetermined time period, all received entry packets are deduplicated. A Wi-Fi list is generated and displayed based on the deduplicated entry packets.

[0013] Optionally, when the processor executes the computer program, it specifically implements the following steps: using a predefined communication protocol payload structure, it encapsulates each scanned access point information into a data packet; the data packet carries an instruction code and an entry number; wherein, when the instruction code is a return instruction code and the entry number is a non-negative integer, the data packet is an entry packet; when the instruction code is a return instruction code and the entry number is a negative integer, the data packet is an end marker packet.

[0014] Compared with the prior art, the above-mentioned technical solution of this application has the following advantages: This application discloses a method and device for obtaining a Wi-Fi list. In this application, an IoT device performs a Wi-Fi scan, and the mobile terminal only receives the scan results to obtain a complete Wi-Fi list. After receiving the entry packet, this application does not directly display it, but generates buffer accumulation information based on the received entry packet. When the buffer accumulation information meets the predetermined trigger condition and / or there is no new entry packet received within a predetermined time period, the subsequent deduplication and display operation of all entry packets is triggered. This method reduces the trigger frequency from once per entry packet to once when the trigger condition is met or once when there is no new entry packet received within a predetermined time period. This effectively reduces the system resource consumption caused by the dense arrival of entry packets, avoids frequent refresh of the display interface, and avoids access point duplication, content jumping, and rendering lag during the display of the Wi-Fi list, thereby achieving a stable display of the Wi-Fi list. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0018] Figure 1 A schematic diagram of a Wifi list acquisition system provided in an embodiment of this application; Figure 2 This application provides an overall architecture block diagram of the entry packet sending system provided in its embodiments. Figure 3 A schematic flowchart illustrating a method for obtaining a Wi-Fi list provided in an embodiment of this application; Figure 4 A timing diagram of the transmission of each Wifi list item and the EOF marker provided in the embodiments of this application; Figure 5 A flowchart of the Wifi list data processing provided in this application embodiment; Figure 6 This is a flowchart of the EOF processing branch provided in the embodiments of this application; Figure 7 This is a schematic diagram of the timeout exception branch process provided in the embodiments of this application; Figure 8 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0019] This specific embodiment is merely an explanation of this application and is not intended to limit it. After reading this specification, those skilled in the art can make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they are within the scope of this application.

[0020] It should be noted that, in the optional embodiments of this application, the data related to object information, when applied to specific products or technologies, requires the permission or consent of the object. Furthermore, the collection, use, and processing of this data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. In other words, if the embodiments of this application involve data related to an object, it must be obtained with the object's authorization and consent, the authorization and consent of relevant departments, and in accordance with the relevant laws, regulations, and standards of the country and region. If the embodiments involve personal information, the acquisition of all personal information requires the individual's consent. If sensitive information is involved, the separate consent of the information subject is required. The embodiments also need to be implemented with the object's authorization and consent.

[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] Furthermore, the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this document, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship. To better understand and illustrate the solutions of the embodiments of this application, some technical terms involved in the embodiments of this application are briefly explained below.

[0023] Traditional solutions have the following technical problems when obtaining the Wi-Fi list: 1. Limited Wi-Fi scanning interface in mobile operating systems: Currently, iOS and Android restrict applications' access to the system scanning interface in order to prevent geolocation tracking. Applications can only obtain the single Wi-Fi currently connected and cannot directly obtain a list of surrounding Wi-Fi networks.

[0024] 2. The timing of the GATT (Generic Attribute Profile) channel in BLE (Bluetooth Low Energy) is uncontrollable: In traditional solutions, IoT devices transmit data back through the GATT notification mechanism. However, the GATT notification mechanism of BLE is a one-way push without connection or receipt. The order and time interval of multiple data packets sent by IoT devices arrive at the mobile terminal are completely random, resulting in obvious timing uncertainty.

[0025] 3. Lack of unified control over large data transmission and termination: A complete Wi-Fi list typically contains dozens of access point entries, far exceeding the capacity limit of BLE single packet MTU (Maximum Transmission Unit). Without a unified packet unpacking and return protocol, mobile terminals cannot know when IoT devices have finished transmitting; they usually can only rely on estimated timeouts to determine whether transmission has ended, leading to excessively long waiting times or incomplete list loading.

[0026] 4. Deduplication and sorting issues: Bluetooth retransmission often leads to the sending of duplicate packets, and IoT devices may detect different signal strengths of the same Wi-Fi network on different channels. Directly displaying these signals can cause duplicate access points or disordered order in the Wi-Fi list.

[0027] To address the aforementioned technical problems, this application provides a method and device for obtaining a Wi-Fi list, enabling the stable acquisition and display of a Wi-Fi list scanned by an IoT device.

[0028] For ease of understanding, the system architecture to which the technical solution of this application applies is described below. See also... Figure 1 The figure shows a schematic diagram of a Wi-Fi list acquisition system provided in an embodiment of this application. As shown, the system includes a mobile terminal 11 and an Internet of Things device 12.

[0029] Mobile terminal 11 is used to send Wi-Fi scanning instructions to IoT device 12 and receive entry packets returned by IoT device 12. It generates buffer accumulation information based on the received entry packets. When the buffer accumulation information meets a predetermined trigger condition and / or no new entry packets are received within a predetermined time period, it deduplicates all received entry packets, generates a Wi-Fi list based on the deduplicated entry packets, and displays it.

[0030] The Internet of Things (IoT) device 12 is used to receive the Wi-Fi scanning command sent by the mobile terminal 11, scan the surrounding access point information in response to the Wi-Fi scanning command, encapsulate the information of each scanned access point to generate an entry packet, and return the entry packet to the mobile terminal 11.

[0031] The mobile terminal 11 in this application includes, but is not limited to, portable electronic devices with wireless communication capabilities and user interfaces, such as smartphones, tablets, smartwatches, and smart bracelets. The IoT device 12 includes, but is not limited to, electronic devices with wireless communication capabilities and requiring network access, such as network cameras, smart locks, and smart speakers. The mobile terminal 11 and the IoT device 12 can connect via Bluetooth Low Energy GATT communication to transmit interactive data between them. Alternatively, they can use Bluetooth SPP (Serial Port Profile) serial port channels, NFC (Near Field Communication) pairing transmission, or UDP (User Datagram Protocol) multicast backhaul data packets over a local area network before establishing a Wi-Fi hotspot.

[0032] See Figure 2 This is a block diagram of the overall architecture of the entry packet sending system provided in this application embodiment. The system architecture diagram includes a mobile terminal 11 and an Internet of Things (IoT) device 12. The mobile terminal 11 includes a data receiving unit 111, a pipeline processing unit 112, and a Wi-Fi list display unit 113. The IoT device 12 includes a Wi-Fi scanning unit 121 and a BLE peripheral unit 122. The mobile terminal 11 and the IoT device 12 transmit interactive data through the BLE notification channel 13.

[0033] Specifically, the Wi-Fi scanning unit 121 actively scans for surrounding Wi-Fi access points to obtain information about each access point. The BLE peripheral unit 122 encapsulates each scanned access point information into an entry packet and sends it to the mobile terminal 11 via the BLE notification channel 13. The data receiving unit 111 receives the entry packets and end-of-line marker packets sent by the IoT device 12 via the BLE notification channel 13. The pipeline processing unit 112 sequentially performs buffer collection, debounce processing, deduplication filtering, and sorting output operations on the received entry packets to generate a processed Wi-Fi list. The Wi-Fi list display unit 113 displays the processed Wi-Fi list through an interface. Figure 2 The data flow is as follows: Wifi scanning unit 121 - BLE peripheral unit 122 - BLE notification channel 13 - data receiving unit 111 - pipeline processing unit 112 - Wifi list display unit 113.

[0034] This application transfers the Wi-Fi scanning capability from the mobile terminal 11 to the IoT device 12, allowing the IoT device 12 to detect surrounding Wi-Fi networks. This bypasses the mobile operating system's permission restrictions on third-party applications directly accessing the system's Wi-Fi scanning interface. Furthermore, this application utilizes a pipelined processing unit 112 to perform buffering, dejittering, and deduplication pipelined operations, ensuring a stable UI (User Interface) refresh rate and preventing frequent jumps or repetitions of list items when the mobile terminal 11 receives high-frequency continuous Bluetooth notifications.

[0035] See Figure 3 This is a schematic flowchart illustrating a method for obtaining a Wi-Fi list according to an embodiment of this application. The method is applied to a mobile terminal and includes: S101, Send a Wi-Fi scanning command to the IoT device.

[0036] In this application, during the network configuration process, the mobile terminal of the IoT device needs to obtain a list of surrounding Wi-Fi networks. At this time, the mobile terminal needs to generate a Wi-Fi scanning command and send it to the IoT device. This Wi-Fi scanning command instructs the IoT device to initiate a Wi-Fi scanning operation to obtain information about available access points in the surrounding environment. An access point (AP) is a device that provides Wi-Fi network access services.

[0037] S102. Receive the entry packet returned by the IoT device; the entry packet is a data packet generated by the IoT device by encapsulating the information of each access point scanned.

[0038] In this application, after receiving a Wi-Fi scanning command, the IoT device initiates a Wi-Fi scanning function to scan for surrounding access points. For each access point scanned, the IoT device encapsulates the access point's information into an entry packet, which is the Wi-Fi list data packet. This entry packet is then returned to the mobile terminal via communication methods such as Bluetooth Low Energy. The entry packet contains information such as the access point's Service Set Identifier (SSID), Media Access Control (MAC) address, Received Signal Strength Indicator (RSSI), and channel. This application independently encapsulates the information of each access point into an entry packet, controlling the size of each entry packet within the maximum transmission unit capacity of a single Bluetooth Low Energy communication. This allows each access point's information to be transmitted independently, avoiding data truncation or transmission failure due to insufficient single-packet capacity.

[0039] S103. Generate buffer accumulation information based on the received entry packets.

[0040] In this application, after receiving an entry packet, the mobile terminal needs to generate buffer accumulation information based on the received entry packet. This buffer accumulation information is used to determine whether batch processing of the received entry packets is required, thus buffering and collecting the received entry packets. Subsequent debouncing, deduplication filtering, and display operations are only performed after the buffer accumulation information meets a predetermined trigger condition, avoiding performance issues caused by packet-by-packet processing. For example, the buffer accumulation information may include the total size of the received data packets in bytes, the rate at which entry packets are received, etc.

[0041] S104. When the buffered accumulated information meets the predetermined triggering condition, and / or no new entry packets are received within the predetermined time period, all received entry packets are deduplicated.

[0042] The buffer accumulation information in this application changes dynamically based on the received entry packets. The mobile terminal continuously monitors whether the buffer accumulation information meets a predetermined trigger condition, and simultaneously monitors whether no new entry packets are received within a predetermined time period. When at least one of the above two conditions is met, a deduplication operation is triggered on all received entry packets. The predetermined trigger condition corresponds to the type of buffer accumulation information. If the buffer accumulation information is the total byte size of the received data packets, then meeting the predetermined trigger condition means that the total byte size of the received data packets exceeds a predetermined byte threshold; if the buffer accumulation information is the rate at which entry packets are received, then meeting the predetermined trigger condition means that the rate at which entry packets are received is less than a predetermined rate.

[0043] Specifically, under the BLE GATT notification mechanism, the time interval between the transmission of each entry packet by the IoT device is not fixed. When there is co-channel interference on the wireless channel or jitter occurs in the distance between the mobile terminal and the device, the link layer retransmission mechanism of the BLE protocol stack will be triggered, causing fluctuations in the time interval between the arrival of each entry packet at the mobile terminal. In this application, the mobile terminal performs deduplication operation using at least one of the following triggering methods based on the satisfaction of the buffered accumulated information and the reception status of the entry packets: The first triggering method: When the buffer accumulation information meets the predetermined triggering conditions and no new entry packets are received within a predetermined time period, the mobile terminal performs deduplication and display on all received entry packets. Specifically, when the mobile terminal senses that the buffer accumulation information meets the predetermined triggering conditions, it does not immediately perform deduplication and display on the received entry packets. Instead, it starts a dejitter timer and waits for a predetermined time period. This predetermined time period can be customized according to the actual situation. In this embodiment, it can be set to 500ms. The mobile terminal detects whether any new entry packets arrive within the predetermined time period. If no new entry packets arrive within the predetermined time period, it indicates that the transmission link is stable, and at this time, it performs deduplication and display on all received entry packets. If a new entry packet arrives within the predetermined time period, the mobile terminal determines that the transmission is still in progress, resets the dejitter timer, and restarts the waiting until no new packets arrive within a consecutive predetermined time period, and then performs deduplication on all received entry packets. In this way, the mobile terminal can actively filter out the interference of unstable packet arrival time caused by BLE link jitter on UI refresh, and only perform interface output when the transmission link is in a stable state, thereby avoiding frequent jumps in list content.

[0044] The second triggering method: When the accumulated buffer information meets the predetermined triggering conditions, the mobile terminal immediately performs deduplication and displays all received item packets, without waiting for a predetermined time period to check if any new item packets have been received. In this method, the mobile terminal triggers the deduplication operation immediately after the accumulated buffer information meets the predetermined triggering conditions, resulting in the fastest response time and making it suitable for scenarios where IoT devices rapidly and continuously send packets. Under this triggering method, the refresh frequency can be reduced by batch aggregating item packets, turning high-frequency triggering into low-frequency triggering, thereby reducing the number of times the list content jumps and improving the stability of the interface display.

[0045] The third triggering method: When no new entry packets are received within a predetermined time period, the mobile terminal performs deduplication and display on all received entry packets without waiting for the accumulated buffer information to meet the predetermined triggering conditions. Specifically, the mobile terminal continuously monitors the reception status of entry packets, starting the timer from the first received entry packet. If no new packets arrive within the predetermined time period, deduplication and display are triggered; if new packets arrive during this period, the timer is reset and the waiting continues. This method ensures that the list is displayed after transmission stabilizes, avoiding content jumps during the display of the Wi-Fi list.

[0046] In this application, deduplication of all received entry packets means filtering out duplicate entry packets corresponding to the same access point, retaining only one entry packet for each access point, thereby avoiding the display of duplicate access points in the Wi-Fi list.

[0047] S105. Generate and display a Wi-Fi list based on the deduplicated entry packets.

[0048] In this application, the mobile terminal sorts the deduplicated entry packets, generates a Wi-Fi list based on the sorted entry packets, and displays the Wi-Fi list on the mobile terminal's user interface. The sorting method can be various, such as sorting by the historical connection success rate, historical connection count, or access point name of each entry packet's corresponding access point, and is not specifically limited here. The Wi-Fi list includes access points corresponding to the deduplicated entry packets. Users can select a target access point from the Wi-Fi list and enter the password to complete the network configuration operation for IoT devices.

[0049] As can be seen, in this embodiment, by transferring the Wi-Fi scanning capability to the IoT device, the mobile terminal can obtain the surrounding Wi-Fi list without calling the system's Wi-Fi scanning interface, eliminating the impact of operating system permission restrictions on the network configuration process. This application does not directly display the received entry packets, but instead generates buffered accumulation information based on the received entry packets. When the buffered accumulation information meets a predetermined trigger condition and / or no new entry packets are received within a predetermined time period, the subsequent deduplication and display operations for all entry packets are triggered. This method reduces the trigger frequency from once per entry packet to once when the trigger condition is met or once when no new entry packets are received within a predetermined time period. This effectively reduces system resource consumption caused by dense arrival of entry packets, avoids frequent refreshes of the display interface, and prevents access point duplication, content jumps, and rendering stuttering during the Wi-Fi list display process, thereby achieving stable display of the Wi-Fi list.

[0050] In another embodiment of this application, sending a Wi-Fi scanning command to an IoT device includes: Generate the task identifier for this round of scanning; A Wi-Fi scanning command is generated using a predefined communication protocol payload structure; the Wi-Fi scanning command includes: a scanning command code and the task identifier; Send the Wi-Fi scanning command to the Internet of Things device.

[0051] In this application, the mobile terminal generates a task identifier (taskid) for each round of Wi-Fi scanning. This task identifier is a unique and incrementing value. For example, the mobile terminal can maintain a global counter, using the current value of the counter as the task identifier for each new scanning task, and then incrementing the counter. Alternatively, the mobile terminal can also generate the task identifier based on the current timestamp.

[0052] The mobile terminal generates a Wi-Fi scanning command according to a predefined communication protocol payload structure. This payload structure can be in JSON (JavaScript Object Notation, a lightweight data interchange format), specifically in the form: {"c": command code, "d": {business data dictionary}}. Here, 'c' represents the command code, and 'd' represents the business data dictionary. This predefined communication protocol payload structure is a pre-agreed data format between the mobile terminal and the IoT device, ensuring that both can correctly parse and generate the command.

[0053] In this application, the mobile terminal fills the scan command code (code), task identifier (taskid), and scan timeout duration into the aforementioned JSON structure to generate a Wi-Fi scan command (start_scan_wifi). The scan timeout duration indicates the maximum time the IoT device can perform a scan operation. When the scan timeout duration is reached, the IoT device stops scanning and returns the scanned results. Correspondingly, when a user cancels network configuration, scanning needs to be stopped. The mobile terminal sends a stop scan command (stop_scan_wifi) to the IoT device. This stop scan command instructs the IoT device to terminate the current Wi-Fi scan operation prematurely. The stop scan command includes a stop scan command code (code), task identifier (taskid), and scan timeout duration (timeout).

[0054] It should be noted that the scan command code and the stop scan command code are different in this embodiment to distinguish the command type. For example, the scan command code can be set to 1 to identify the command as a start scan command, and the stop scan command code can be set to 2 to identify the command as a stop scan command. The specific value of the command code can also be adjusted according to the actual situation, as long as the two types of commands can be distinguished, and there is no specific limitation here.

[0055] In this application, the mobile terminal can send a Wi-Fi scanning command to an IoT device via a Bluetooth Low Energy communication connection. After receiving the Wi-Fi scanning command, the IoT device parses the scanning command code, task identifier, and scanning timeout duration, and then initiates the Wi-Fi scanning operation.

[0056] In another embodiment of this application, after receiving the data packet returned by the IoT device, the method further includes: obtaining the task identifier carried in the data packet; retaining the data packet when the carried task identifier is the same as the task identifier of the current scan; and discarding the data packet when the carried task identifier is different from the task identifier of the current scan.

[0057] In this application, after receiving a data packet returned by an IoT device, the mobile terminal parses the data packet and extracts the task identifier carried in it. This task identifier is obtained by the IoT device from the Wi-Fi scanning command sent by the mobile terminal and inserted into the data packet when it generates the data packet. The mobile terminal compares the extracted task identifier with the task identifier of the current scan. If they are the same, it means the data packet belongs to the current scan task, and the mobile terminal retains the data packet. If the data packet is an entry packet, it is used for subsequent deduplication and list generation; if the data packet is an end marker packet, it is used for subsequent transmission end determination. If they are different, it means the data packet belongs to data remnants from other scan tasks, such as a late packet from the previous scan or a data packet sent by another device. The mobile terminal discards this data packet and does not use it for any subsequent processing operations.

[0058] As can be seen, this embodiment introduces task identifiers, giving each round of scanning a unique identifier, thus isolating multiple rounds of scanning. If the task identifier of a received data packet differs from that of the current round of scanning, the data packet can be discarded, effectively filtering data packets from non-current scanning tasks, avoiding crosstalk between data from different rounds of scanning, and preventing out-of-order mixing. Furthermore, by adopting a predefined JSON communication protocol payload structure, a unified command format is achieved between the mobile terminal and the IoT device. By setting a scan timeout duration, the IoT device can proactively terminate the scan and return the scanned results if the scanning time is too long, avoiding indefinite waiting for the scanning operation.

[0059] In another embodiment of this application, receiving the entry packet returned by the IoT device includes: Receive data packets returned by the IoT device; the data packets are generated by the IoT device using a predefined communication protocol payload structure; Extract the instruction code and entry number from the data packet; When the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the data packet is treated as an entry packet; When the instruction code is a return instruction code and the entry sequence number is a negative integer, the data packet is used as an end marker packet.

[0060] In this embodiment, the received data packets can be classified and identified based on the instruction code and entry sequence number in the data packet to distinguish between entry packets and end-of-pipe packets. The data packet is generated by the IoT device using a predefined communication protocol payload structure. This communication protocol payload structure is the same as that in the previous embodiment, both including instruction codes and a service data dictionary. Each data packet returned by the IoT device is encapsulated using this structure.

[0061] In this application, the instruction codes in the entry packet and the end marker packet are the same, which is referred to as the return instruction code. The specific value of the return instruction code can be set according to the actual situation. In this embodiment, the return instruction code is set to 101. That is, if the instruction code in the received data packet is the return instruction code 101, then the data packet is the entry packet or end marker packet related to the Wi-Fi list returned by the IoT device.

[0062] The service data dictionary of the entry packet contains the following fields: SSID, MAC, RSSI, channel, task identifier, entry sequence number, and total number of entries. The channel is used to represent the working channel of the access point. The entry sequence number represents the entry sequence number of the entry packet in the current scan round, and the entry sequence number starts from 0 and increments sequentially to identify the sending order of each entry packet. The total number of entries represents the total number of access point entries in the current scan round. The total number of entries in each entry packet in the same scan round is the same, which is the total number of access points scanned in that round. In addition, the task identifier of each entry packet in the same scan round is the same, which is the task identifier of this scan round.

[0063] In one implementation, a simplified JSON format is used as the serialization method for the communication protocol payload between the mobile terminal and the IoT device. Specifically, to minimize the data volume transmitted per Bluetooth packet to accommodate the small MTU limitation in the BLE GATT notification mechanism, each field in the service data dictionary uses a single-letter key name, such as 's' for Service Set Identifier (SSID), 'm' for MAC address, 'r' for Signal Strength (RSSI), 'ch' for channel, 'tk' for task identifier, 'i' for entry number, and 'c' for total number of entries. This single-letter key name method significantly reduces the byte size of the payload compared to using full English word key names, allowing each entry packet to be transmitted completely in a single BLE notification.

[0064] It should be noted that the technical solution of this application is not limited to the JSON format described above. As an alternative implementation for further compressing the payload size, mobile terminals and IoT devices can also use any of the following serialization formats: BSON (Binary JSON), MessagePack, or a custom binary byte stream. BSON is a JSON-like binary format that supports the same data structure as JSON, but uses binary encoding for storage and transmission. Compared to text-based JSON, BSON produces a shorter byte length after serialization while retaining the structured expressive capabilities of JSON, making it easier for mobile terminals to parse. MessagePack is a binary serialization format that encodes the data structure into a compact binary format. Compared to JSON, MessagePack requires fewer bytes to transmit the same data, making it particularly suitable for BLE communication scenarios with limited MTU. A custom binary byte stream refers to a pre-agreed fixed byte length allocation rule between the mobile terminal and the IoT device, where each field is sequentially filled into a fixed-length byte array according to a predetermined order and byte length. For example, the task identifier (tk) is fixed at 2 bytes, the entry sequence number (i) is fixed at 2 bytes, the total number of entries (c) is fixed at 2 bytes, and the signal strength (r) is fixed at 1 byte. The service set identifier (s) and MAC address (m) are written according to their actual length and their length is indicated in the header. This method does not rely on any general serialization protocol. The encoding and decoding rules are agreed upon by the communicating parties themselves, which can perform extreme compression on specific business data and maximize the use of the ultra-small MTU payload space.

[0065] This application, through any of the above formats, can further reduce the byte overhead of data packets in BLE channels with ultra-small MTU, reduce the number of packet transmissions caused by excessive load, thereby reducing the probability of data packet loss and transmission delay, and improving the transmission efficiency of BLE channels in Wi-Fi list backhaul scenarios.

[0066] In this application, after the IoT device has sent all entry packets or has not scanned an access point, it will send an End of File (EOF) packet to the mobile terminal. The EOF packet also adopts a unified communication protocol payload structure, and its instruction code is the same as that of the entry packets. However, the business data dictionary differs from that of the entry packets in the following ways: the EOF packet contains a tk field, an i field, and a c field, where the i field is fixed as a negative integer to distinguish it from the positive integer entry sequence number. For example, the i field is set to -1.

[0067] Therefore, in this application, after receiving a data packet, the mobile terminal needs to parse it to extract the instruction code and entry sequence number. When the mobile terminal parses the data packet and finds that the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the mobile terminal determines the data packet as an entry packet. This entry packet contains complete information about an access point, including the service set identifier, media access control address, received signal strength, channel, task identifier, entry sequence number, and total number of entries. When the mobile terminal parses the data packet and finds that the instruction code is a return instruction code and the entry sequence number is a negative integer, the mobile terminal determines the data packet as an end marker packet. This end marker packet does not contain access point information, only the task identifier and the total number of entries.

[0068] In another embodiment of this application, after using the data packet as an end marker packet, the method further includes: extracting the total number of entries in the end marker packet; When the total number of entries is greater than zero, it is determined that the IoT device has sent all the entry packets for this round of scanning. When no new entry packets are received within the predetermined time, all received entry packets are deduplicated, and a Wi-Fi list is generated and displayed based on the deduplicated entry packets. When the total number of entries is zero, it is determined that the scanning result is empty, and a blank Wi-Fi list is displayed.

[0069] In this application, after the mobile terminal identifies the data packet as an end-of-scan packet, it can extract the total number of entries from the end-of-scan packet. This total number of entries is located in the 'c' field of the business data dictionary and represents the total number of access points scanned in this round of scanning. The mobile terminal parses this total number of entries from the end-of-scan packet. When the total number of entries parsed by the mobile terminal is greater than zero, it indicates that the IoT device has actually scanned access points and has sent all entry packets. Therefore, the mobile terminal can, without waiting for the buffer accumulation information to meet the predetermined trigger condition, deduplicate all received entry packets within a predetermined time period if no new entry packets are received, and generate a Wi-Fi list for display based on the deduplicated entry packets. Since the mobile terminal knows that all entry packets have been sent after receiving the end-of-scan packet, the received entry packets at this time constitute the complete dataset for this round of scanning.

[0070] When the total number of entries parsed by the mobile terminal is zero, it indicates that the IoT device has performed a Wi-Fi scan, but there are no available access points nearby. At this point, the mobile terminal no longer waits for entry packets, directly determining the scan result to be empty, and displays a blank Wi-Fi list on the user interface. Optionally, the mobile terminal can also display a prompt message while showing the blank Wi-Fi list, such as "Please check the network environment of the IoT device's location."

[0071] For example: After the IoT device completes a normal scan and sends all N entry packets one by one, the i field in the EOF packet is -1, the c field is N (the actual total number of entries), and the tk field is the current task ID; if the IoT device finds that the scan result is empty and there is no access point after scanning, it does not send any entry packets, and the i field in the EOF packet is -1, the c field is 0, and the tk field is the current task ID.

[0072] See Figure 4 This is a timing diagram of the transmission of the Wi-Fi list item by item and the EOF marker provided in the embodiments of this application. The mobile terminal is the mobile phone, and the device is the networked device. The interaction process is described here: S201: The mobile device sends a Wi-Fi scanning command to the device. The scanning command carries the task identifier (taskId=K) and scanning timeout duration (timeout=7s) for this round of scanning.

[0073] S202: After receiving the Wi-Fi scanning command sent by the mobile phone, the device starts Wi-Fi scanning and scans for Wi-Fi access points in the surrounding environment.

[0074] S203: After the device completes the scan, it encapsulates each scanned access point information into an entry packet and sends each entry packet back to the mobile device sequentially. The first entry packet is Wi-Fi entry packet #0, with entry number i=0 and a total number of access point entries c=N; the second entry packet is Wi-Fi entry packet #1, with entry number i=1 and a total number of access point entries c=N; and so on, until the last entry packet, Wi-Fi entry packet #N-1, with entry number i=N-1 and a total number of access point entries c=N.

[0075] S204: After all N entry packets have been sent, the device sends an EOF end marker packet to the mobile phone. In this EOF packet, i=-1 and c=N, which is used to indicate that all Wi-Fi entries in this round have been sent.

[0076] S205: After receiving the EOF packet, the mobile device compares the number of received entry packets with the value of the 'c' field in the EOF packet. If they match, the transmission round is considered complete. All received entry packets are then deduplicated, sorted, and a Wi-Fi list is generated and displayed.

[0077] also, Figure 4 The processing flow for two special scenarios is also shown: S204a: In a zero-entry scenario, if the total number of access point entries scanned by the device is zero (c=0), the device does not send any entry packets but directly sends an EOF packet with i=-1 and c=0. The mobile device can determine that the scan result is empty based on the EOF packet with c=0 and directly displays an empty list prompt interface.

[0078] S205a: In incomplete reception scenarios, if the number of entry packets received by the mobile device is less than the value of the c field in the EOF packet, the current round of transmission is determined to be incomplete. In this case, the mobile device generates and displays a Wi-Fi list based on the received entry packets.

[0079] As can be seen, in this embodiment, the mobile terminal can quickly and accurately determine whether a data packet includes entries or an end-of-transmission packet by parsing the instruction code and entry sequence number fields in the data packet, thus effectively distinguishing the data packet type. Furthermore, this application can also obtain the total number of entries in the end-of-transmission packet. When the total number of entries is greater than zero, the mobile terminal knows from the end-of-transmission packet that all entry packets have been sent, avoiding timeout waiting and shortening the waiting time for list display. When the total number of entries is zero, the mobile terminal knows that the IoT device has not scanned an access point, clarifying that the Wi-Fi list is empty rather than due to a transmission interruption, so as to promptly notify the user.

[0080] In another embodiment of this application, deduplication of all received entry packets includes: Retrieve the service set identifier for all item packages; The duplicate entry packets with the same service set identifier and the entry packets that match the device hotspot of the mobile terminal are removed from all entry packets to obtain the deduplicated entry packets.

[0081] In this embodiment, the mobile terminal performs deduplication on all received entry packets to eliminate duplicate access point information caused by Bluetooth retransmission at the underlying layer. Specifically, the mobile terminal uses a Set data structure for deduplication. A Set is a data structure used to store unique elements, and its characteristic is that it does not allow storing duplicate elements. When an element is added to a Set, the Set automatically determines whether the element already exists: if it does not exist, the element is added to the Set; if it already exists, the number of elements in the Set remains unchanged.

[0082] In this application, the mobile terminal extracts the Service Set Identifier (SSID) of each access point from each entry packet, and uses the SSID as the key of the set. The mobile terminal inserts the SSIDs from all entry packets into the set one by one. When multiple entry packets carry the same SSID, only the latest entry packet corresponding to that SSID is retained.

[0083] Simultaneously, the mobile terminal also performs a filtering operation for its own hotspots. The mobile terminal obtains a preset regular expression, which is used to match a specific format of the service set identifier or MAC address corresponding to the mobile terminal's own hotspot. Specifically, the mobile terminal compares the service set identifier or MAC address in each entry packet one by one with the preset regular expression. If a match is successful, the access point corresponding to that entry packet is determined to be the mobile terminal's own device hotspot, and the entry packet is deleted from the set of entry packets to be displayed; if the match fails, the entry packet is retained.

[0084] As can be seen, in this embodiment, by using the service set identifier as the unique identifier for deduplication, the problem of the same access point appearing multiple times due to Bluetooth underlying retransmission is eliminated, ensuring that each access point in the Wi-Fi list is displayed only once. By filtering entry packets that match the device hotspots of mobile terminals, hotspots emitted by IoT devices themselves are prevented from appearing in the list and interfering with user selection, thus improving the accuracy of the list.

[0085] In another embodiment of this application, generating and displaying a Wi-Fi list based on deduplicated entry packets includes: determining the signal strength of each deduplicated entry packet; sorting the deduplicated entry packets in descending order of signal strength; and generating and displaying a Wi-Fi list based on the sorted entry packets.

[0086] In this embodiment, after deduplication, the mobile terminal extracts the received signal strength from each remaining packet. This received signal strength represents the signal strength of the access point as measured by the IoT device. A higher value indicates a stronger signal. The mobile terminal sorts the deduplicated packets according to their received signal strength, from highest to lowest. That is, it uses a descending order, placing the packet with the highest received signal strength at the top of the list. The mobile terminal then generates and displays a Wi-Fi list on the user interface based on the sorted packet order.

[0087] In another embodiment of this application, after sending a Wi-Fi scanning command to an IoT device, the method further includes: starting a timeout timer; when the timeout duration exceeds the timeout threshold and no end marker packet or entry packet is received, displaying a prompt message indicating that the scan is not responding.

[0088] In this application, after sending a Wi-Fi scanning command to an IoT device, the mobile terminal starts a timeout timer to accumulate the time. The mobile terminal continuously monitors whether the current timeout duration exceeds the timeout threshold, and simultaneously monitors whether an end marker packet or entry packet is received. It should be noted that the specific value of the timeout threshold can be set according to the actual application scenario. In environments with strong Bluetooth signals, the timeout threshold can be set to a shorter duration, such as 20 seconds, to avoid excessive waiting time for the user. In scenarios with weak Bluetooth signals, the timeout threshold can be set to a longer duration, such as 30 seconds, to tolerate potentially larger delays in Bluetooth transmission. Furthermore, different timeout thresholds can be set according to the type of IoT device; network cameras, due to their high-performance Wi-Fi scanning modules, can have a shorter timeout threshold, while smart sockets, due to their limited processing capabilities, can have a longer timeout threshold.

[0089] When the timeout period exceeds the timeout threshold, and the mobile terminal receives neither the end marker packet nor the entry packet, it indicates that the IoT device may not be responding to the scan command, the Bluetooth connection may have been lost, or the IoT device may be in an abnormal state. In this case, the mobile terminal determines that the transmission is unresponsive and displays a scan unresponsive message on the user interface. For example, this message may include prompts for the user to check if the device is powered on, check if the distance between the device and the phone is too far, and a retry button. When the timeout period exceeds the timeout threshold, but the mobile terminal has received at least one entry packet but not the end marker packet, it indicates that the end marker packet is lost. In this case, the received entry packets are used to display the Wi-Fi list without blocking user operation, and the Wi-Fi list is marked as incompletely received, and is refreshed and completed periodically.

[0090] As can be seen, in this embodiment, by arranging the access points in the Wi-Fi list in descending order according to signal strength, the access point with the strongest signal is displayed at the top of the Wi-Fi list, which makes it convenient for users to quickly locate and select the access point with the best signal, thus improving the efficiency of user operations in the network configuration process. This application, by comparing the timing duration with the timeout threshold, can promptly provide feedback to the user when the IoT device is unresponsive, avoiding indefinite waiting for the user and making it convenient for the user to take corresponding troubleshooting measures according to the prompts, thereby improving the user experience in network configuration failure scenarios.

[0091] In another embodiment of this application, generating buffer accumulation information based on the received entry packet includes: The receiving duration and the number of entry packets are generated based on the received entry packets; the receiving duration is the duration from the first receipt of an entry packet to the present, or the duration from the last time a predetermined trigger condition was met to the present; the number of entry packets is the total number of entry packets stored from the first receipt of an entry packet to the present, or the total number of entry packets stored from the last time a predetermined trigger condition was met to the present. When the duration of reception exceeds the duration threshold, or when the number of entry packets exceeds the number of entry packets threshold, it is determined that the buffer accumulation information meets the predetermined triggering condition; the buffer accumulation information includes the duration of reception and the number of entry packets.

[0092] In this application, whether the buffered accumulated information meets the predetermined trigger condition can be determined based on both the reception duration and the number of entry packets. The reception duration can be determined as follows: when an entry packet is first received, the duration from the moment of first packet reception to the current moment is taken as the reception duration of the first reception window; once the reception duration meets the trigger condition, the duration from the moment the predetermined trigger condition was last met to the current moment is taken as the reception duration of the next reception window, and so on. The number of entry packets can be determined as follows: when an entry packet is first received, the total number of entry packets received from the moment the predetermined trigger condition was last met to the current moment is taken as the number of entry packets in the first reception window; once the number of entry packets meets the predetermined trigger condition, the total number of entry packets received from the moment the predetermined trigger condition was last met to the current moment is taken as the number of entry packets in the next reception window, and so on.

[0093] The mobile terminal compares the generated reception duration with a duration threshold, and simultaneously compares the generated number of packet entries with a number of entry threshold. If the reception duration exceeds the duration threshold, or the number of packet entries exceeds the number of entry threshold, the mobile terminal determines that the buffered accumulated information meets a predetermined trigger condition. These two trigger conditions are logically ORed; meeting either condition triggers subsequent de-jitter detection and deduplication operations.

[0094] The specific values ​​for the duration threshold and the number of items threshold can be set according to the actual application scenario. For example, the duration threshold can be set to 2 seconds, and the number of items threshold can be set to 5. In scenarios where IoT devices rapidly and continuously send item packets, the number of item packets may quickly reach 5 within a short period. In this case, the mobile terminal triggers the response by using the number of items threshold. In scenarios where IoT devices send item packets at longer intervals, the number of item packets may not reach 5 for an extended period. In this case, the mobile terminal triggers the response by receiving a duration of 2 seconds, avoiding delays in list display due to waiting for more item packets.

[0095] As can be seen, in this embodiment, by employing a dual triggering mechanism of time window and cumulative quantity, a timely response is triggered by a quantity threshold when the device sends packets rapidly and continuously, avoiding unnecessary waiting delays; when the packet sending interval is long, a time threshold trigger is used to ensure processing progress and avoid infinite waiting. The two triggering conditions complement each other, with the first one being satisfied taking precedence, achieving a balance between response speed and data integrity.

[0096] In one alternative implementation, the mobile terminal can also dynamically adjust the duration threshold and the predetermined duration of the de-jitter waiting time in the predetermined trigger conditions according to the real-time signal quality of the current Bluetooth link, so as to adapt to the transmission stability requirements under different communication environments.

[0097] Specifically, the mobile terminal obtains the real-time signal strength (RSSI) of the Bluetooth link with the IoT device through the Bluetooth protocol stack to characterize the channel quality of the current Bluetooth communication link. The mobile terminal compares the obtained signal strength with several preset signal strength thresholds to determine the signal quality level of the current link. When the mobile terminal detects that the current Bluetooth signal strength is in a good state, such as RSSI ≥ -70dBm, it indicates that the current communication link quality is relatively good, and the stability and real-time performance of data packet transmission are high. In this case, the mobile terminal sets the duration threshold to a first preset duration, such as 2 seconds, and sets the predetermined duration to a first preset de-jitter duration, such as 500ms, to achieve timely response and rapid display of the Wi-Fi list.

[0098] When the mobile terminal detects that the current Bluetooth signal strength is at a moderate level, such as -85dBm ≤ RSSI < -70dBm, it indicates that there is some interference or distance attenuation in the current communication link, and data packets may experience a slight delay. In this case, the mobile terminal extends the duration threshold to a second preset duration, such as 3 seconds, and extends the predetermined duration to a second preset de-jitter duration, such as 800ms, to tolerate the impact of slight link fluctuations on data packet arrival time and avoid frequent triggering of incomplete batch output due to excessively short waiting times.

[0099] When the mobile terminal detects that the current Bluetooth signal strength is extremely weak, such as RSSI < -85dBm, it indicates that the current communication link quality is poor, and data packets may experience a high packet loss rate or a large transmission delay. In this case, the mobile terminal extends the duration threshold to a third preset duration, such as 4 seconds, and extends the preset duration to a third preset de-jitter duration, such as 1 second, to tolerate a higher packet loss rate and a greater transmission delay. This ensures that even in extreme environments with weak signals, the most complete Wi-Fi list can still be collected before displaying it, guaranteeing the final presentation effect of the list.

[0100] It should be noted that the specific values ​​of the aforementioned signal strength threshold, corresponding duration threshold, and jitter-reducing waiting time are merely illustrative examples. Those skilled in the art can reasonably set and adjust these values ​​according to actual application scenarios and the performance characteristics of the Bluetooth chip. Furthermore, dynamic adjustment can be performed continuously based on real-time measurements of the Bluetooth signal strength by the mobile terminal. That is, during each scan cycle, the mobile terminal continuously monitors the Bluetooth link signal quality and dynamically adjusts the corresponding time parameters when the signal quality changes.

[0101] Through the aforementioned dynamic adjustment mechanism, the mobile terminal can quickly respond to the user's scanning request and provide a timely display of the Wi-Fi list when the Bluetooth signal is good; when the Bluetooth signal is poor, the waiting time is extended to tolerate a higher packet loss rate and transmission delay, ensuring the integrity of the Wi-Fi list, thereby achieving a good user experience in different communication environments.

[0102] In one specific embodiment of this application, the mobile terminal is configured with a cascaded data processing pipeline, which includes, in sequence, buffer collection, debounce processing, deduplication and filtering, and sorting output.

[0103] Level 1: Buffer Collection: A dual triggering mechanism of time window and cumulative quantity is adopted. The time window value is the duration threshold, such as 2 seconds; the cumulative quantity value is the number of entries threshold, such as 5 entries. That is, the next level operation is triggered only when the time window reaches 2 seconds or the cumulative number of entries reaches 5, so as to avoid processing individual data packets one by one and reduce the frequency of processing operation calls. Level 2: Debouncing: Only when no new entry packets arrive within a predetermined time period will all currently accumulated entry packets be output to the next level. The predetermined time period can be a continuous 500 milliseconds to avoid content jumps in the Wi-Fi list during display due to unstable packet arrival times.

[0104] Level 3: Deduplication Filtering: Using a Set data structure, the Service Set Identifier (SSID) in each entry package is used as a unique key value for deduplication, while filtering out mobile terminal hotspots that match preset regular expressions.

[0105] Level 4: Sorted Output: Sort by signal strength (RSSI) value in each entry packet in descending order, and place the access point with the highest signal strength at the top of the Wi-Fi list.

[0106] See Figure 5 The flowchart below shows the Wifi list data processing procedure provided in this application embodiment, which includes the following: S301: BLE data packet arrives at the entry point.

[0107] The mobile device receives data packets sent by IoT devices through the BLE notification channel and enters the data processing flow.

[0108] S302: Extract the task identifier carried in the data packet and determine whether the task identifier is consistent with the task identifier of the current scan round; if consistent, proceed to step S303; if inconsistent, determine that the data packet is residual data from the old scan round and discard the data packet.

[0109] S303: Determine if the entry sequence number in the data packet is -1; If not, the data packet is determined to be an entry packet, and the process proceeds to S304; if yes, the data packet is determined to be an end marker packet, and the process proceeds to the EOF processing branch.

[0110] S304: Buffer Collection Layer: Monitors the duration and number of received packet entries. When the cumulative number of received packets reaches 5, or the duration reaches 2 seconds, S305 is executed. This dual-trigger mechanism avoids processing each packet individually, reducing the frequency of processing operations.

[0111] S305: Debouncing layer: Monitors whether a new entry packet arrives within 500 milliseconds. If no new entry packet arrives within 500 milliseconds, then execute S306.

[0112] If a new entry packet arrives within 500 milliseconds, the timer is reset and the system waits again. This debouncing process prevents frequent jumps in the displayed Wi-Fi list content due to unstable packet arrival times.

[0113] S306: Deduplication Layer: Use the Service Set Identifier (SSID) in each entry packet as the unique key value for deduplication, and continue to S307. For multiple entry packets with the same Service Set Identifier, only the most recently arrived entry packet is retained, and the remaining duplicate entries are deleted.

[0114] S307: Filtering layer: According to the preset regular expression rules, match the entry package corresponding to the mobile terminal's own hotspot and delete the entry package from the set of entry packages to be displayed; if the match is unsuccessful, keep the entry package and continue to execute S308.

[0115] S308: Sorting layer: Sort each deduplicated packet in descending order of signal strength (RSSI) value from high to low, and place the access point with the highest signal strength at the top of the Wi-Fi list.

[0116] S309: UI Presentation Layer: Generates a Wi-Fi list based on the sorted item packets, and performs final rendering and display through the user interface.

[0117] See Figure 6 Here is a flowchart of the EOF processing branch provided in the embodiments of this application, as follows: Figure 6 As shown, the process includes the following steps: S401: Extract the total number of entries in the end-marker packet; S402: Determine if the total number of entries is 0; If so, proceed to the empty list branch and execute S403: The IoT device has not detected any available Wi-Fi. The mobile device will directly display a prompt interface indicating that no available Wi-Fi has been detected, informing the user that there is no available Wi-Fi network in the vicinity.

[0118] If not, execute S404: The IoT device has completed sending all entry packets. The mobile phone verifies the integrity of the received entry packets based on the total number of entries in the end marker packet, and displays the Wi-Fi list based on the actual number of received entry packets.

[0119] See Figure 7 This is a schematic diagram of the timeout exception branch process provided in the embodiments of this application, such as... Figure 7 As shown, the process includes the following steps: S501: After the mobile phone sends a Wi-Fi scan command, a 30-second timeout timer is started; S502: If the timeout timer has lasted for 30 seconds and no EOF packet has been received, then determine whether the number of received entry packets is 0. If yes, then execute S503; otherwise, execute S504. S503: If the IoT device is found to be completely unresponsive, an error message will be displayed on the mobile device, and a retry operation entry will be provided for the user to re-initiate the scan.

[0120] S504: If the transmission is determined to be incomplete or the end marker packet is lost, the mobile phone will deduplicate and sort the received entry packets to generate and display the Wi-Fi list without blocking the user's selection operation. At the same time, the current round of reception is marked as incomplete reception and the next round of scanning is initiated through a timed refresh mechanism to complete the list.

[0121] In summary, this application bypasses system permission restrictions, successfully transferring Wi-Fi scanning capabilities to the device side and eliminating the negative impact of iOS / Android system-level restrictions on network configuration. This application also provides highly reliable transmission decisions by introducing EOF packets with i = -1 and c = 0, effectively determining when transmission ends, avoiding blind timeouts, and improving tolerance to packet loss and blank lists. When displaying the Wi-Fi list through the UI, this application uses a buffering and debouncing cascade pipeline to ensure a stable UI refresh rate on the mobile device when receiving high-frequency continuous Bluetooth notifications, preventing frequent jumps or repetitions of list items. This application uses single-letter simplified JSON, coupled with an optional bit-field binary header, to achieve data compression with a very small MTU, improving bandwidth utilization.

[0122] Figure 8 A structural diagram of an electronic device provided in this application embodiment includes: Memory 20 is used to store computer programs; The processor 21 is configured to execute a computer program to implement the steps of the method described in any of the above embodiments.

[0123] The electronic device provided in this embodiment is a terminal device, which may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.

[0124] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0125] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary storage or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc.

[0126] In some embodiments, the electronic device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0127] Those skilled in the art will understand that Figure 8 The structures shown do not constitute a limitation on electronic devices and may include more or fewer components than those shown.

[0128] In another embodiment of this application, a different method for obtaining a Wi-Fi list is provided. This method is applied to Internet of Things (IoT) devices. The method for obtaining a Wi-Fi list applied to IoT devices described below corresponds to the method for obtaining a Wi-Fi list applied to mobile terminals described above. The method includes the following steps: Receive Wi-Fi scanning commands sent by mobile terminals; In response to the Wifi scanning command, initiate a Wifi scan to obtain information about each access point; Each access point's information is encapsulated to generate an entry packet; The entry packet is sent to the mobile terminal so that the mobile terminal generates buffer accumulation information based on the received entry packet. When the buffer accumulation information meets a predetermined trigger condition and / or no new entry packet is received within a predetermined time period, all received entry packets are deduplicated. A Wi-Fi list is generated and displayed based on the deduplicated entry packets.

[0129] In another embodiment of this application, receiving a Wi-Fi scanning command sent by a mobile terminal includes: The system receives a Wi-Fi scanning command sent by a mobile terminal, which carries a scanning instruction code and a task identifier; wherein the task identifier is the task identifier for this round of scanning; and the Wi-Fi scanning command is generated using a predefined communication protocol payload structure.

[0130] In another embodiment of this application, the information of each scanned access point is encapsulated to generate an entry packet, including: Using a predefined communication protocol payload structure, the information of each scanned access point is encapsulated into a data packet; the data packet carries an instruction code and an entry sequence number; wherein, when the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the data packet is an entry packet; when the instruction code is a return instruction code and the entry sequence number is a negative integer, the data packet is an end marker packet.

[0131] In another embodiment of this application, the data packet also carries a task identifier for the current scan, so that the mobile terminal compares the task identifier carried in the data packet with the task identifier for the current scan; when the task identifier carried is the same as the task identifier for the current scan, the data packet is retained; when the task identifier carried is different from the task identifier for the current scan, the data packet is discarded.

[0132] In another embodiment of this application, if the Wi-Fi scanning command carries a scan timeout duration, then actively scanning for surrounding Wi-Fi access points and obtaining information about each access point includes: In response to the Wi-Fi scanning command, a Wi-Fi scan is initiated, and a scan timer is started. If the scanning timeout duration does not exceed the scanning timeout duration, the scanning operation continues to be performed to obtain information about each access point. The scanning stops when the scan timing duration exceeds the scan timeout duration.

[0133] In another embodiment of this application, an Internet of Things (IoT) device is also disclosed, comprising: Memory, used to store computer programs; The processor, when executing the computer program, implements the steps of the acquisition method applied to Internet of Things devices described above.

[0134] Specifically, when the processor executes the computer program, it performs the following steps: Receive Wi-Fi scanning commands sent by mobile terminals; In response to the Wifi scanning command, initiate a Wifi scan to obtain information about each access point; Each access point's information is encapsulated to generate an entry packet; The entry packet is sent to the mobile terminal so that the mobile terminal generates buffer accumulation information based on the received entry packet. When the buffer accumulation information meets a predetermined trigger condition and / or no new entry packet is received within a predetermined time period, all received entry packets are deduplicated. A Wi-Fi list is generated and displayed based on the deduplicated entry packets.

[0135] In another embodiment of this application, when the processor executes the computer program, it is specifically used to implement the following steps: Using a predefined communication protocol payload structure, the information of each scanned access point is encapsulated into a data packet; the data packet carries an instruction code and an entry sequence number; wherein, when the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the data packet is an entry packet; when the instruction code is a return instruction code and the entry sequence number is a negative integer, the data packet is an end-of-life marker packet. In another exemplary embodiment, a computer storage medium is also provided, wherein when the program instructions are executed by a processor, they implement the steps of the method described in any of the above method embodiments.

[0136] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the current technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, magnetic disks, or optical disks, and other media capable of storing program code.

[0137] The various embodiments described in this specification are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” used herein may also mean the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a specific order described or illustrated, unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0138] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0139] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for obtaining a Wi-Fi list, characterized in that, The acquisition method is applied to a mobile terminal and includes: sending a Wi-Fi scanning command to an Internet of Things (IoT) device; Receive the entry packet returned by the IoT device; the entry packet is a data packet generated by the IoT device by encapsulating the information of each scanned access point; Generate buffer accumulation information based on the received entry packets; When the buffer accumulation information meets the predetermined triggering condition, and / or no new entry packets are received within a predetermined time period, all received entry packets are deduplicated. A list of Wi-Fi networks is generated and displayed based on the deduplicated entry packets.

2. The acquisition method according to claim 1, characterized in that, Sending Wi-Fi scanning commands to IoT devices, including: Generate the task identifier for this round of scanning; A Wi-Fi scanning command is generated using a predefined communication protocol payload structure; the Wi-Fi scanning command includes: a scanning command code and the task identifier; Send the Wi-Fi scanning command to the Internet of Things device.

3. The acquisition method according to claim 2, characterized in that, The entry packet returned by the IoT device includes: Receive data packets returned by the IoT device; the data packets are generated by the IoT device using a predefined communication protocol payload structure; Extract the instruction code and entry number from the data packet; When the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the data packet is treated as an entry packet; When the instruction code is a return instruction code and the entry sequence number is a negative integer, the data packet is used as an end marker packet.

4. The acquisition method according to claim 3, characterized in that, After receiving the data packet returned by the IoT device, the method further includes: Obtain the task identifier carried in the data packet; If the task identifier carried is the same as the task identifier of the current scan, the data packet is retained; if the task identifier carried is different from the task identifier of the current scan, the data packet is discarded.

5. The acquisition method according to claim 4, characterized in that, After sending a Wi-Fi scanning command to the IoT device, it also includes: Start a timeout timer. When the timeout duration exceeds the timeout threshold and no end marker packet or entry packet is received, display a message indicating that the scan is unresponsive.

6. The acquisition method according to claim 3, characterized in that, After the data packet is used as an end marker packet, it also includes: Extract the total number of entries in the end-of-packet marker; When the total number of entries is greater than zero, it is determined that the IoT device has sent all the entry packets of this round of scanning. When no new entry packets are received within a predetermined time, all received entry packets are deduplicated, and a Wi-Fi list is generated and displayed based on the deduplicated entry packets. When the total number of entries is zero, the scan result is determined to be empty, and a blank Wi-Fi list is displayed.

7. The method for obtaining according to any one of claims 1 to 6, characterized in that, Deduplication of all received entry packets includes: Retrieve the service set identifier for all item packages; The duplicate entry packets with the same service set identifier and the entry packets that match the device hotspot of the mobile terminal are removed from all entry packets to obtain the deduplicated entry packets.

8. The acquisition method according to claim 7, characterized in that, A list of Wi-Fi networks is generated and displayed based on the deduplicated entry packets, including: Determine the signal strength of each deduplicated packet; The deduplicated packets are sorted in descending order of signal strength, and a Wi-Fi list is generated and displayed based on the sorted packets.

9. An Internet of Things (IoT) device, characterized in that, include: Memory, used to store computer programs; When a processor executes the computer program, it performs the following steps: Receive Wi-Fi scanning commands sent by mobile terminals; In response to the Wifi scanning command, initiate a Wifi scan to obtain information about each access point; Each access point's information is encapsulated to generate an entry packet; The entry packet is sent to the mobile terminal so that the mobile terminal generates buffer accumulation information based on the received entry packet. When the buffer accumulation information meets a predetermined trigger condition and / or no new entry packet is received within a predetermined time period, all received entry packets are deduplicated. A Wi-Fi list is generated and displayed based on the deduplicated entry packets.

10. The Internet of Things device according to claim 9, characterized in that, When the processor executes the computer program, it specifically performs the following steps: Using a predefined communication protocol payload structure, the information of each scanned access point is encapsulated into a data packet; the data packet carries an instruction code and an entry sequence number; wherein, when the instruction code is a return instruction code and the entry sequence number is a non-negative integer, the data packet is an entry packet; when the instruction code is a return instruction code and the entry sequence number is a negative integer, the data packet is an end marker packet.