Intelligent device wi-fi fast networking method
Patent Information
- Application Number
- CN202610610436.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-06
- Publication Date
- 2026-08-18
AI Technical Summary
现有方案中,AP模式需用户反复手动切换手机Wi-Fi连接,操作割裂且批量部署时重复次数多;一键配网因手机与设备信道不同步,首次成功率较低,且多采用简单异或加密,易被同频段恶意设备嗅探破解;WPS模式因PIN码暴力破解漏洞已被主流系统及路由器厂商默认禁用,通用性差
本发明通过配网发起终端在保持与目标路由器连接的状态下,采用多信道轮询广播方式发送配网指令,同时待组网智能设备在未连接网络时进入监听模式并在多个信道上跳频扫描,解决了现有AP模式需要用户手动切换Wi-Fi连接导致操作繁琐、以及一键配网因手机与设备信道不同步导致配网成功率低的问题,实现无需用户干预的单次广播快速入网;通过多个待组网设备采用统一的触发方式同时进入监听模式,并结合随机退避机制并发向目标路由器发起连接,解决了批量部署时需逐个触发设备、重复操作易超时失败的问题,实现多设备并行高效组网;通过对设备类型码和部署环境系数进行加权计算得到安全等级,并根据低、中、高安全等级分别采用固定密钥加密、标准对称加密或混合加密,解决了单一加密方式无法兼顾低功耗设备效率与高敏感设备安全需求的问题,实现安全性与资源消耗的差异化匹配;通过信道质量评估自适应调整各信道的发送包数和总轮询轮次,解决了复杂干扰环境下配网可靠性差的问题,提升弱信号或高干扰场景下的组网成功率,进而整体提高用户体验。
Smart Images

Figure CN122602161A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of network communication, and in particular to a method for rapid Wi-Fi networking of smart devices. Background Technology
[0002] Smart devices with no screen or weak input, such as smart bulbs, sockets, and sensors, cannot directly input Wi-Fi passwords and must rely on mobile phones or other terminals to assist in network setup. In existing solutions, AP mode requires users to repeatedly and manually switch their phone's Wi-Fi connection, resulting in fragmented operations and numerous repetitions during batch deployments; one-click network configuration has a low initial success rate due to the asynchronous channels of the phone and device, and often uses simple XOR encryption, making it vulnerable to sniffing and cracking by malicious devices on the same frequency band; WPS mode has been disabled by default by mainstream systems and router manufacturers due to PIN code brute-force vulnerabilities, resulting in poor universality.
[0003] The methods described above all require individual network configuration triggering for each device, such as long-pressing a button. They lack batch concurrency mechanisms, and repeated operations are prone to timeouts and failures during large-scale deployments. Furthermore, existing solutions employ simplistic encryption methods, providing redundant computation for low-sensitivity devices like light bulbs, while offering insufficient protection for highly sensitive devices like door locks. The fixed parameters for transmission, such as the number of channel transmissions and polling rounds, cannot adaptively adjust based on real-time channel quality, further degrading reliability in complex electromagnetic environments. Summary of the Invention
[0004] To provide a fast networking method that supports batch concurrency, adaptive channels, and differentiated encryption, this application provides a fast Wi-Fi networking method for smart devices.
[0005] Firstly, this application provides a method for rapid Wi-Fi networking of smart devices, employing the following technical solution: A method for rapid Wi-Fi networking of smart devices, the method comprising: S1. The network configuration initiating terminal sends a network configuration command via wireless broadcast while maintaining an established Wi-Fi connection with the target router; the network configuration command includes the target router's service set identifier and password; S2. At least one smart device to be networked enters the network configuration monitoring mode when it is not connected to any Wi-Fi network, and performs frequency hopping scan on multiple wireless channels to receive the network configuration command in step S1. S3. The intelligent device to be networked parses the received network configuration command to extract the service set identifier and password of the target router, and initiates a connection to the target router based on the service set identifier and password.
[0006] Optionally, the specific method by which the distribution network initiating terminal sends the distribution network command in step S1 is as follows: S11. The distribution network initiating terminal switches to channel 1 through channel 2 in sequence according to the preset channel sequence. Channels, continuously transmitted on each channel Each network data packet is sent, and after that, the process switches to the next channel until all preset channels have been polled and sent; among them, This represents the total number of available channels. It is an integer greater than or equal to 1; The specific expression is: ; in The total duration of a single polling transmission initiated by the terminal in the distribution network. This is the time required for switching between adjacent channels. The floor symbol; S12. During the polling process, the network initiating terminal maintains a network layer connection with the target router, and the network initiating terminal maintains a Wi-Fi connection with the target router. S13, The polling sending process is executed repeatedly. Each round, The specific expression is: ; The rounding up symbol, To find the maximum value function, The preset timeout period, The transmission duration for each data packet in the distribution network; The polling process continues until a successful network configuration confirmation is received from any of the smart devices to be networked, or until... Sending will stop after a certain number of rounds.
[0007] Optionally, when the number of smart devices to be networked is multiple: Multiple smart devices waiting to be networked can simultaneously enter the network monitoring mode through a unified triggering method; All smart devices in the distribution network monitoring mode independently perform frequency hopping scanning operations and each receive the same distribution network instruction broadcast by the distribution network initiating terminal. After successfully resolving the target router service set identifier and password in the network configuration command, each of the smart devices to be networked independently initiates a connection request to the target router. When multiple smart devices seeking to form a network simultaneously initiate connection requests to the target router, each device employs a random backoff strategy. The random delay time generated by each smart device waiting to form a network before initiating a connection. Determined by the following formula: ; In the formula, For the first Each device generates a uniformly random number with a value range of (0, 1). The preset baseline retreat time, This represents the total number of devices currently in a concurrent network. After broadcasting the network distribution command, the network distribution initiating terminal receives the network distribution status information returned by each smart device to be networked through the target router.
[0008] Optionally, before sending the network configuration command, a sensitivity level assessment of the smart devices to be networked is also included, specifically: The distribution network initiating terminal obtains the device type identification code of the intelligent device to be networked. and deployment environment coefficient The safety level value of the device is calculated using the following formula. : ; In the formula, This is a preset device type code, with a value range of 1 to 100. The larger the value, the higher the security requirements of the device. The environmental factor is set to a value between 0 and 1. and These are weighting coefficients, all of which are constants greater than 0; The calculated The value is compared with the preset security level range; if it is lower than the lower limit of the security level range, it is judged as a low-sensitivity device; if it is within the security level range, it is judged as a medium-sensitivity device; if it exceeds the security level range, it is judged as a high-sensitivity device.
[0009] Optionally, when the smart device to be networked is a low-sensitivity device, the first encryption mode is used for encryption; when the smart device to be networked is a medium-sensitivity device, the second encryption mode is used for encryption; and when the smart device to be networked is a high-sensitivity device, the first encryption mode and the second encryption mode are used for hybrid encryption.
[0010] Optionally, the first encryption mode is fixed key encryption, that is, a fixed key is agreed upon in advance between the distribution network initiating terminal and the smart device to be networked. The fixed key is burned into the memory when the device leaves the factory, and the same key is preset in the control application corresponding to the distribution network initiating terminal. The second encryption mode is standard symmetric encryption, using the AES-128 algorithm. The key is a personalized key written into the memory at the factory, and each smart device to be networked has a different key.
[0011] Optionally, the specific steps of hybrid encryption are as follows: The distribution network initiating terminal generates a 128-bit one-time session key Ks; Using Ks as the key, the service set identifier and password in the network distribution command are encrypted using the AES-128 algorithm to obtain the ciphertext Cd; Obtain the public key Puk of the smart device to be networked. This public key Puk is provided by the device to the network initiating terminal before the network configuration begins via Bluetooth broadcast or QR code. Ks is encrypted using the public key Puk and the RSA-1024 algorithm to obtain the ciphertext Ck; Concatenate the ciphertext Cd and ciphertext Ck in sequence to form a data packet Payload=Cd||Ck, and encapsulate it in the broadcast data packet of the network configuration command and send it. After the smart device in the network receives the network configuration command, it uses its own stored private key Prk to decrypt Ck to obtain Ks, and then uses Ks to decrypt Cd to recover the service set identifier and password. The one-time session key Ks is regenerated during each network configuration process and is valid only once. It is then cleared from the device memory after the network configuration is completed.
[0012] Optionally, before performing step S11, a channel quality assessment and adaptive parameter calculation step is also included: The distribution network initiating terminal sequentially sends probe packets on each available channel of the target router and records the received signal strength indication of each channel. and noise background The first number is calculated using the following formula. Quality factor of each channel : ; In the formula, The maximum received signal strength across all channels. The lowest noise floor among all channels; Based on the quality factor of each channel Dynamically adjust the number of packets sent per transmission on this channel. Total number of polling rounds The formula is adjusted as follows: ; ; In the formula, Based on the number of packets sent, The average quality factor for all channels. The standard deviation of the quality factor. Basic polling rounds; According to the dynamic calculation obtained by the distribution network initiating terminal Send the corresponding number of data packets on each channel.
[0013] Secondly, this application provides a method for rapid Wi-Fi networking of smart devices, which adopts the following technical solution: A computer device includes a processor, wherein the processor runs a program for a method for rapid Wi-Fi networking of a smart device as described in any one of the preceding claims.
[0014] Thirdly, this application provides a storage medium, which adopts the following technical solution: A storage medium storing a program for a method of quickly setting up a Wi-Fi network for a smart device as described in any one of the above claims.
[0015] In summary, this application includes at least one of the following beneficial technical effects: This invention enables network configuration commands to be sent via a multi-channel polling broadcast method by a network configuration initiating terminal while maintaining a connection with the target router. Simultaneously, the smart devices to be networked enter a listening mode and perform frequency hopping scans on multiple channels when not connected to the network. This solves the problems of cumbersome operation caused by manual Wi-Fi switching in existing AP modes and low success rates in one-click network configuration due to channel asynchrony between mobile phones and devices. It achieves rapid network access with a single broadcast without user intervention. Furthermore, by having multiple devices to be networked simultaneously enter listening mode using a unified triggering method and initiating connections to the target router concurrently via a random backoff mechanism, it eliminates the need for individual triggering during batch deployment. To address the issue of timeout failures due to repetitive operations and equipment, this system enables efficient parallel networking of multiple devices. Security levels are calculated by weighting device type codes and deployment environment coefficients. Based on low, medium, and high security levels, fixed-key encryption, standard symmetric encryption, or hybrid encryption are employed respectively. This solves the problem that a single encryption method cannot simultaneously meet the efficiency requirements of low-power devices and the security needs of highly sensitive devices, achieving a differentiated match between security and resource consumption. Furthermore, by adaptively adjusting the number of packets sent and the total number of polling rounds for each channel through channel quality assessment, the system addresses the issue of poor network reliability in complex interference environments, improving networking success rates in weak signal or high-interference scenarios, thereby enhancing the overall user experience. Attached Figure Description
[0016] Figure 1 This is a flowchart of the steps of a method for rapid Wi-Fi networking of smart devices proposed in this invention. Detailed Implementation
[0017] The embodiments of this application are described in detail below, and examples of the embodiments are shown in the accompanying drawings.
[0018] In the description of this specification, the references to "certain embodiments," "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples" refer to specific features, structures, materials, or characteristics described in connection with the described embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0019] This application discloses a method for rapid Wi-Fi networking of smart devices, referring to... Figure 1 ,include: S1. The network configuration initiating terminal sends a network configuration command via wireless broadcast while maintaining an established Wi-Fi connection with the target router; the network configuration command includes the target router's service set identifier and password; S2. At least one smart device to be networked enters the network configuration monitoring mode when it is not connected to any Wi-Fi network, and performs frequency hopping scan on multiple wireless channels to receive the network configuration command in step S1. S3. The intelligent device to be networked parses the received network configuration command to extract the service set identifier and password of the target router, and initiates a connection to the target router based on the service set identifier and password.
[0020] Example: The network configuration initiating terminal is a smartphone with a smart home app installed. After the user clicks the "Add Device" button in the app, the phone maintains its Wi-Fi connection with the home router (SSID: Home5G, password: 12345678). The phone broadcasts a network configuration command containing "Home5G" and "12345678" over the air via UDP. A smart light bulb (e.g., without a screen, only a physical button) that is to be networked automatically enters the network configuration monitoring mode after being powered on and not connected to any network. It cycles through Wi-Fi channels 1 to 13 for frequency hopping scanning (it can stay on each channel for 50ms). The light bulb captures the broadcast packet sent by the phone on channel 6, parses the SSID and password, and actively initiates a connection to Home5G.
[0021] This embodiment solves the problem of cumbersome operation caused by the network configuration initiating terminal directly broadcasting network configuration commands while maintaining a connection with the target router, in conjunction with frequency hopping scanning of the device to be networked. This is achieved by using the frequency hopping scanning of the device to be networked. The existing AP mode requires users to manually switch their mobile phone Wi-Fi connection (i.e., disconnecting the home Wi-Fi, connecting to the device hotspot, and then switching back to the home Wi-Fi). It also solves the problem of low packet reception success rate caused by channel asynchrony due to the fixed channel of the mobile phone and frequency hopping of the device. The embodiment allows the device to automatically complete the network access with only one click, without any manual switching or additional operation. This overcomes the dependence of traditional network configuration on the user's technical background and lowers the threshold for use.
[0022] In one embodiment, the specific method by which the distribution network initiating terminal sends the distribution network command in step S1 is as follows: S11. The distribution network initiating terminal switches to channel 1 through channel 2 in sequence according to the preset channel sequence. Channels, continuously transmitted on each channel Each network data packet is sent, and after that, the process switches to the next channel until all preset channels have been polled and sent; among them, This represents the total number of available channels. It is an integer greater than or equal to 1; The specific expression is: ;in The total duration of a single polling transmission initiated by the terminal in the distribution network. This is the time required for switching between adjacent channels. The rounding sign is used to determine the number of distribution network data packets that the distribution network initiating terminal continuously transmits on each channel. Thus, within the limited total time of a single polling session Within the system, efforts should be made to ensure that at least one data packet can be sent on each channel. At the same time, the number of transmissions should be reasonably allocated according to the channel switching overhead to avoid the device missing instructions due to too few packets being sent, or unnecessary time waste due to too many packets being sent. Typically, a value of 1000~3000ms is used; too short a value will lead to… If the time is too long, the reliability will decrease; if the time is too long, the total time of the distribution network will increase. Based on actual measurements, the typical value is 5ms. This formula guarantees that during traversal... When there are multiple channels, each channel receives an equal opportunity to transmit, and the total time does not exceed [a certain limit]. .
[0023] S12. During the polling process, the network initiating terminal maintains a network layer connection with the target router, and the network initiating terminal maintains a Wi-Fi connection with the target router. S13, The polling sending process is executed repeatedly. Each round, The specific expression is: ; The rounding up symbol, To find the maximum value function, The preset timeout period, The transmission duration for each data packet in the distribution network; this formula is used to determine the number of rounds that the polling transmission process needs to be repeated. Since the device may not begin frequency hopping scanning until any time after power-on, a single round of transmission may not cover the device's listening window. Repeating the transmission multiple times increases the probability of the device capturing network distribution commands. The formula uses the maximum value of 3 to ensure at least 3 rounds, preventing insufficient rounds if the timeout setting is too short. It is generally set to 10-30 seconds to balance user experience and success rate. Depending on the physical layer rate (11b / g / n, etc.), it is typically estimated in 1ms. This formula makes... Follow The number of rounds increases while the number decreases (because the time per round increases, and the total number of rounds decreases), thus achieving adaptive adjustment.
[0024] The polling process continues until a successful network configuration confirmation is received from any of the smart devices to be networked, or until... Sending will stop after a certain number of rounds.
[0025] Example: It is 13 (2.4GHz channels 1 to 13). It takes 5ms. If it is 2000ms, then The value is ⌊2000 / (13×5)⌋+1=31. The mobile phone continuously sends 31 network configuration packets on channel 1, taking 31 × [missing information - likely a number or time value]. (set up (1ms) = 31ms, plus 5ms switching time, switching to channel 2...; completing one round requires 13 × (31 + 5) = 468ms. Let... =10000ms =1ms, then the denominator = 13 × (1 × 31 + 5) = 468. The value is 21.37, rounded up to 22, and then the maximum value is taken when divided by 3. =22; the phone repeats 22 times (approximately 10 seconds), stopping early if any light bulb returns to confirm.
[0026] This embodiment addresses the fundamental flaw in traditional one-click network configuration, which is caused by mobile phones sending data on only one channel and devices potentially missing that channel during frequency hopping scanning, by employing a multi-channel polling and repeated rounds mechanism. It enables the sending end to actively cover all channels, and the repeated rounds ensure that the device can capture commands in a short time regardless of when it enters listening mode. This overcomes the congestion of the 2.4GHz band in homes and the uncertainty caused by automatic frequency hopping by routers, thereby improving the success rate of network configuration. Simultaneously, maintaining the connection between the mobile phone and the router effectively avoids network interruptions perceived by the user.
[0027] In one embodiment, when the number of smart devices to be networked is multiple: Multiple smart devices waiting to be networked can simultaneously enter the network monitoring mode through a unified triggering method. The unified triggering method includes, but is not limited to: automatic entry when the device is powered on, receiving the same physical button trigger signal, or receiving the same infrared or radio frequency wake-up signal. All smart devices in the distribution network monitoring mode independently perform frequency hopping scanning operations and each receive the same distribution network instruction broadcast by the distribution network initiating terminal. After successfully resolving the target router service set identifier and password in the network configuration command, each of the smart devices to be networked independently initiates a connection request to the target router. When multiple smart devices seeking to form a network simultaneously initiate connection requests to the target router, each device employs a random backoff strategy. The random delay time generated by each smart device waiting to form a network before initiating a connection. Determined by the following formula: In the formula, For the first Each device generates a uniformly random number with a value range of (0, 1). The preset baseline backoff time (in milliseconds, ranging from 50 to 200). This represents the total number of devices currently in a concurrent network. This formula is used to calculate the random backoff delay time for multiple devices attempting to connect concurrently. When a large number of devices simultaneously initiate connection requests to the router, without a delay, the router's association table will become instantly congested, causing numerous connection failures. This formula introduces a random factor to address this issue. and total number of devices This causes the backoff time to increase linearly with the number of devices, effectively distributing connection requests. A value of 100ms is commonly used; too short a value results in an ineffective backoff, while too long a value increases user waiting time. The denominator 10 in n / 10 is an empirical value that doubles the backoff window for 10 devices and triples it for 20 devices, consistent with actual collision probability models. This formula is simple, requiring no complex calculations other than division, making it suitable for implementation in embedded devices.
[0028] After broadcasting the network distribution command, the network distribution initiating terminal receives the network distribution status information returned by each smart device to be networked through the target router.
[0029] Example: A user simultaneously powers on 10 smart sockets. Each socket automatically enters network configuration monitoring mode upon power-on, triggering a unified network configuration command broadcast on the user's phone. Each of the 10 sockets receives this command during frequency hopping scanning and deciphers the router password. Since the 10 sockets initiate connections to the router almost simultaneously, to avoid conflicts, the first socket... Each socket generates a random number. The value ranges from 0.3 to 0.9. It is 100ms. If it is 10, then The delay for each socket varies from 60 to 180 ms, causing the connection to be initiated at different times. After the broadcast ends, the mobile phone polls the status of each socket through the router, showing that 9 sockets have been connected and 1 socket has timed out.
[0030] This embodiment solves the problem of existing network configuration methods requiring each device to be triggered individually by a button and network configuration information to be sent individually, leading to dozens of repetitive operations and frequent failures due to timeouts or omissions during batch deployment. It achieves parallel network access for a large number of devices in a single operation and overcomes potential collision conflicts when multiple devices connect to the router simultaneously, through a random backoff formula. Increase the number of devices The larger the window, the wider the backoff window, effectively reducing the probability of collisions and ensuring the success rate of large-scale deployments.
[0031] In one embodiment, before sending the network distribution command, a step of sensitivity level assessment for the intelligent devices to be networked is further included, specifically: The distribution network initiating terminal obtains the device type identification code of the intelligent device to be networked. and deployment environment coefficient The safety level value of the device is calculated using the following formula. : ; In the formula, This is a preset device type code, with a value range of 1 to 100. The larger the value, the higher the security requirement of the device. For example, smart door locks and cameras take a high value, while smart light bulbs and sockets take a low value. The environmental factor is set to a value between 0 and 1, which is input by the user through the App or automatically detected (0.2 for home environment, 0.5 for office environment, and 1.0 for public environment). and These are weighting coefficients, all of which are constants greater than 0, and are assumed to be weighting coefficients. =1, It is 2; This formula is used to quantitatively calculate the security level value of intelligent devices to be networked. The security requirements of a device depend not only on its own type (door lock, light bulb) but also on its deployment environment (home, office, public). A weighted average is used to combine these two factors into a comprehensive score, providing a numerical basis for subsequent encryption mode selection. The values of α and β can be adjusted according to the actual security strategy. If the device type is considered more important, α can be increased. The default β=2 reflects the emphasis on the environment. The formula result is a floating-point number, rounded to the nearest integer, and compared with a preset threshold. For low security, For China's security, (For high security). Thresholds 4 and 7 are set based on... and The typical distribution of has been verified through simulation.
[0032] The calculated L value is compared with the preset security level range; if it is lower than the lower limit of the security level range, it is judged as a low-sensitivity device; if it is within the security level range, it is judged as a medium-sensitivity device; if it exceeds the security level range, it is judged as a high-sensitivity device.
[0033] This embodiment introduces a device type code. and deployment environment coefficient The weighted calculation formula solves the problem that traditional power distribution networks use the same encryption strategy for all devices, resulting in over-encryption of low-sensitivity devices (wasting computing resources) or under-encryption of high-sensitivity devices (posing security risks). It enables dynamic and quantitative security level assessment based on the sensitivity of the device itself and the risk level of the environment, and overcomes the shortcomings of static configuration security strategies that cannot adapt to diverse smart home scenarios, providing a basis for subsequent selection of matching encryption modes.
[0034] In one embodiment, when the smart device to be networked is a low-sensitivity device, a first encryption mode is used for encryption; when the smart device to be networked is a medium-sensitivity device, a second encryption mode is used for encryption; and when the smart device to be networked is a high-sensitivity device, a hybrid encryption of the first and second encryption modes is used. Example: If a smart socket is determined to be a low-security device, the mobile phone uses a fixed key (preset 0xA5) to perform byte-by-byte XOR encryption of the router password before broadcasting it; if a smart door lock is determined to be a high-security device, the mobile phone first encrypts the password using AES-128 (temporary key Ks), then encrypts Ks using the door lock's public key RSA, concatenates the two, and broadcasts them.
[0035] The first encryption mode is fixed key encryption, that is, a fixed key is agreed upon in advance between the distribution network initiating terminal and the smart device to be networked. This fixed key is burned into the memory when the device leaves the factory, and the same key is preset in the control application corresponding to the distribution network initiating terminal. During encryption, the distribution network initiating terminal uses a fixed key to perform a byte-by-byte XOR operation on the service set identifier and password in the distribution network instruction to obtain the ciphertext; after the network intelligent device receives the ciphertext, it uses the same fixed key to perform an XOR operation to recover the plaintext; The second encryption mode is standard symmetric encryption, using the AES-128 algorithm. The key is a personalized key written into the memory at the factory, and each smart device to be networked has a different key.
[0036] Encryption is performed using CBC mode, with the initialization vector obtained by padding the lower 8 bytes of the device's MAC address with zeros. Once the networked smart device receives the ciphertext, it decrypts it using its own stored personalized key.
[0037] Example: For low-security sockets, the phone and socket have a pre-set fixed key 0x5A. The ASCII code for the router password 12345678 is [0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38]. XORing this with 0x5A yields the ciphertext [0x6B, 0x68, 0x69, 0x6E, 0x6F, 0x6C, 0x6D, 0x62]. The socket receives this ciphertext and XORs it with 0x5A to restore the original password.
[0038] For medium-security cameras, the mobile phone uses AES-128, and the key is the device's factory personalized key (such as 0x11, 0x22...). The IV is obtained by taking the lower 8 bytes of the camera's MAC address (such as AA:BB:CC:DD:EE:FF) and adding 5 0x00s to DD:EE:FF to form 16 bytes.
[0039] The specific steps of hybrid encryption are as follows: The distribution network initiating terminal generates a 128-bit one-time session key Ks; Using Ks as the key, the service set identifier and password in the network distribution command are encrypted using the AES-128 algorithm to obtain the ciphertext Cd; Obtain the public key Puk of the smart device to be networked. This public key Puk is provided by the device to the network initiating terminal before the network configuration begins via Bluetooth broadcast or QR code. Ks is encrypted using the public key Puk and the RSA-1024 algorithm to obtain the ciphertext Ck; Concatenate the ciphertext Cd and ciphertext Ck in sequence to form a data packet Payload=Cd||Ck, and encapsulate it in the broadcast data packet of the network configuration command and send it. After the smart device in the network receives the network configuration command, it uses its own stored private key Prk to decrypt Ck to obtain Ks, and then uses Ks to decrypt Cd to recover the service set identifier and password. The one-time session key Ks is regenerated during each network configuration process and is valid only once. It is then cleared from the device memory after the network configuration is completed.
[0040] Example: When a high-security smart door lock leaves the factory, it generates an RSA key pair (public key Puk, private key Prk). The public key is printed on a QR code. A mobile phone scans the QR code to obtain Puk, generates a random number Ks=0x3F2A... (128 bits), encrypts the router password with Ks to get Cd, and then encrypts Ks with Puk to get Ck. After concatenating Cd and Ck, the lock broadcasts the result. After receiving the signal, the lock first decrypts Ck with Prk to get Ks, and then decrypts Cd with Ks to get the password.
[0041] This embodiment resolves the contradiction between the inability of a single encryption method to simultaneously meet the lightweight requirements of low-power devices and the strong protection requirements of high-security devices by mapping security levels one-to-one with encryption modes, thus achieving a balance between security and resource consumption. It enables low-security devices to use XOR encryption, which has minimal computational overhead and is suitable for battery-powered sensors; medium-security devices use AES-128, providing industry-standard protection; and high-security devices use hybrid encryption to resist replay and man-in-the-middle attacks. This overcomes the shortcomings of traditional power distribution networks, which either over-protect, leading to high power consumption and slow network distribution for low-end devices, or under-protect, making high-risk devices vulnerable to attack. Meanwhile, two specific implementations of encryption modes are presented: the fixed-key XOR operation is extremely simple, suitable for low-end microcontrollers, with encryption and decryption time in the microsecond range, without affecting device startup speed; the AES-128CBC mode, combined with the device's unique key and MAC-derived IV, provides resistance to replay attacks and tamper-proof capabilities, suitable for moderately sensitive devices; thus solving the problem that low-end devices cannot support complex encryption algorithms, while providing acceptable strength for mid-range devices, achieving an effective match between encryption overhead and security level; It also solves the key distribution problem caused by the need for pre-shared keys (factory preset or transmitted through auxiliary channels) in pure symmetric encryption, as well as the inefficiency of pure asymmetric encryption when processing long data. It achieves high security by making the public key public and the private key never leaving the device. At the same time, it uses AES to efficiently process Wi-Fi credentials to overcome the threat of broadcast network configuration being sniffed in the air. Even if an attacker captures the network configuration packet, they cannot decrypt Ks because they do not have the device's private key, and therefore cannot obtain the router password. The one-time session key mechanism further ensures forward security.
[0042] In one embodiment, before performing step S11, a channel quality assessment and adaptive parameter calculation step is further included: The distribution network initiating terminal sequentially sends probe packets on each available channel of the target router and records the received signal strength indication of each channel. and noise background The first number is calculated using the following formula. Quality factor of each channel : ; In the formula, The maximum received signal strength across all channels. The lowest noise floor among all channels; This formula is used to calculate each channel. quality factor (percentage). This value reflects the ratio of the current signal quality of the channel to the optimal channel quality; a higher value indicates a cleaner channel and a stronger signal. Its purpose is to quantify the communication conditions of different channels, providing a basis for subsequent dynamic adjustments to the transmission strategy. This formula will... The signal-to-noise ratio (SNR) is limited to between 0% and 100%. If the SNR of a channel is close to the optimal channel, Approaching 100%; if the signal-to-noise ratio is very poor, Approaching 0%. Note: When... When it is negative, A value of 0% indicates that the channel is unavailable.
[0043] Based on the quality factor of each channel Dynamically adjust the number of packets sent per transmission on this channel. Total number of polling rounds The formula is adjusted as follows: ; This formula is used to dynamically adjust each channel. Number of packets sent in a single batch The core idea is to increase the number of packets sent for channels with below-average quality to compensate for their poor transmission conditions; and to appropriately reduce the number of packets for channels with above-average quality to save overall transmission time, thereby achieving an adaptive transmission strategy that allocates packets on demand. Taking 10 is a trade-off between total transmission time and reliability. The denominator uses... Instead of a fixed value, the adjustment range is related to the overall quality of the current environment: the worse the overall environment ( (Small), the larger the magnitude of a single adjustment, the more actively it compensates for weak channels.
[0044] ; In the formula, Based on the number of packets sent, The average quality factor for all channels. The standard deviation of the quality factor. Set the basic polling rounds (default 5); This formula is used to determine the channel quality fluctuation (standard deviation). The total number of polling rounds K is dynamically adjusted. When the quality differences between channels are large ( When the polling frequency is high (e.g., intermittent interference), it indicates an unstable environment. In this case, it is necessary to increase the polling frequency to cover more time windows and improve the success rate of the distribution network. Conversely, if the quality of each channel is consistent (e.g., high polling frequency), the network will be more stable. If the number of rounds is small, the number of rounds can be reduced to speed up the network distribution. A Ko value of 5 is an empirical value that guarantees a high success rate in most environments. When When it is 0.2, It is 6; when When it is 1, The value is 10. This formula adapts the number of polls to the complexity of the environment, avoiding over-sending in a clean environment and under-sending in a harsh environment.
[0045] According to the dynamic calculation obtained by the distribution network initiating terminal Send the corresponding number of data packets on each channel.
[0046] Example: The mobile phone measured on channel 1 -50dBm -90dBm -45dBm If it is -95dBm, then Let (-50+90) / (-45+95)=80%; It is 10. It is 75%. If 80% are higher than the mean, then The formula is ⌊10×(1+(0.75-0.8) / 0.75)⌋+1=10; if the channel quality is lower than the mean, then... Increase; Set 10%, If it is 5, then The value is ⌈5×(1+0.1 / 0.75)⌉=6.
[0047] This embodiment addresses the issues of high packet loss rates on heavily interfered channels (such as those near microwave ovens) and wasted resources on clean channels by using channel quality assessment and dynamic adjustment of the number of transmitted packets. It achieves adaptive compensation by transmitting more packets as quality deteriorates, thereby increasing the acquisition probability of weak signal devices. This overcomes the shortcomings of traditional solutions that apply equal effort to all channels and cannot cope with complex electromagnetic environments. Especially in high-density Wi-Fi environments such as apartments, it improves the reliability of distribution networks. Simultaneously, it utilizes standard deviation... Adjust the total number of polling rounds The more unstable the environment ( The larger the value, the more polling attempts are made, further ensuring a higher success rate under adverse conditions.
[0048] This application also discloses a computer device, including a processor, wherein the processor runs a program for a smart device Wi-Fi fast networking method as described in any one of the above embodiments.
[0049] This application also discloses a storage medium storing a program for a method of quickly setting up a smart device Wi-Fi network as described in any one of the above embodiments.
[0050] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A method for rapid Wi-Fi networking of smart devices, characterized in that, The method includes: S1. The network configuration initiating terminal sends a network configuration command via wireless broadcast while maintaining an established Wi-Fi connection with the target router; the network configuration command includes the target router's service set identifier and password; S2. At least one smart device to be networked enters the network configuration monitoring mode when it is not connected to any Wi-Fi network, and performs frequency hopping scan on multiple wireless channels to receive the network configuration command in step S1. S3. The intelligent device to be networked parses the received network configuration command to extract the service set identifier and password of the target router, and initiates a connection to the target router based on the service set identifier and password.
2. The method for rapid Wi-Fi networking of intelligent devices according to claim 1, characterized in that, The specific method by which the distribution network initiating terminal sends the distribution network command in step S1 is as follows: S11. The distribution network initiating terminal switches to channel 1 through channel 2 in sequence according to the preset channel sequence. Channels, continuously transmitted on each channel Each network data packet is sent, and after that, the process switches to the next channel until all preset channels have been polled and sent; among them, This represents the total number of available channels. It is an integer greater than or equal to 1; The specific expression is: ; in The total duration of a single polling transmission initiated by the terminal in the distribution network. This is the time required for switching between adjacent channels. The floor symbol; S12. During the polling process, the network initiating terminal maintains a network layer connection with the target router, and the network initiating terminal maintains a Wi-Fi connection with the target router. S13, The polling sending process is executed repeatedly. Each round, The specific expression is: ; The rounding up symbol, To find the maximum value function, The preset timeout period, The transmission duration for each data packet in the distribution network; The polling process continues until a successful network configuration confirmation is received from any of the smart devices to be networked, or until... Sending will stop after a certain number of rounds.
3. The method for rapid Wi-Fi networking of intelligent devices according to claim 1, characterized in that, When there are multiple smart devices to be networked: Multiple smart devices waiting to be networked can simultaneously enter the network monitoring mode through a unified triggering method; All smart devices in the distribution network monitoring mode independently perform frequency hopping scanning operations and each receive the same distribution network instruction broadcast by the distribution network initiating terminal. After successfully resolving the target router service set identifier and password in the network configuration command, each of the smart devices to be networked independently initiates a connection request to the target router. When multiple smart devices seeking to form a network simultaneously initiate connection requests to the target router, each device employs a random backoff strategy. The random delay time generated by each smart device waiting to form a network before initiating a connection. Determined by the following formula: ; In the formula, For the first Each device generates a uniformly random number with a value range of (0, 1). The preset baseline retreat time, This represents the total number of devices currently in a concurrent network. After broadcasting the network distribution command, the network distribution initiating terminal receives the network distribution status information returned by each smart device to be networked through the target router.
4. The method for rapid Wi-Fi networking of intelligent devices according to claim 1, characterized in that, Before sending the network configuration command, a sensitivity level assessment of the smart devices to be networked is also included, specifically: The distribution network initiating terminal obtains the device type identification code of the intelligent device to be networked. and deployment environment coefficient The safety level value of the device is calculated using the following formula. : ; In the formula, This is a preset device type code, with a value range of 1 to 100. The larger the value, the higher the security requirements of the device. The environmental factor is set to a value between 0 and 1. and These are weighting coefficients, all of which are constants greater than 0; The calculated The value is compared with the preset security level range; If the value is below the lower limit of the security level range, it is judged as a low-sensitivity device; If it falls within the security level range, it is classified as a medium-sensitive device. If it exceeds the safety level range, it is judged as a highly sensitive device.
5. The method for rapid Wi-Fi networking of intelligent devices according to claim 1, characterized in that, When the smart device to be networked is a low-sensitivity device, the first encryption mode is used for encryption; when the smart device to be networked is a medium-sensitivity device, the second encryption mode is used for encryption; when the smart device to be networked is a high-sensitivity device, the first encryption mode and the second encryption mode are used for hybrid encryption.
6. The method for rapid Wi-Fi networking of intelligent devices according to claim 5, characterized in that, The first encryption mode is fixed key encryption, that is, a fixed key is agreed upon in advance between the distribution network initiating terminal and the smart device to be networked. This fixed key is burned into the memory when the device leaves the factory, and the same key is preset in the control application corresponding to the distribution network initiating terminal. The second encryption mode is standard symmetric encryption, using the AES-128 algorithm. The key is a personalized key written into the memory at the factory, and each smart device to be networked has a different key.
7. The method for rapid Wi-Fi networking of intelligent devices according to claim 5, characterized in that, The specific steps of hybrid encryption are as follows: The distribution network initiating terminal generates a 128-bit one-time session key Ks; Using Ks as the key, the service set identifier and password in the network distribution command are encrypted using the AES-128 algorithm to obtain the ciphertext Cd; Obtain the public key Puk of the smart device to be networked. This public key Puk is provided by the device to the network initiating terminal before the network configuration begins via Bluetooth broadcast or QR code. Ks is encrypted using the public key Puk and the RSA-1024 algorithm to obtain the ciphertext Ck; Concatenate the ciphertext Cd and ciphertext Ck in sequence to form a data packet Payload=Cd||Ck, and encapsulate it in the broadcast data packet of the network configuration command and send it. After the smart device in the network receives the network configuration command, it uses its own stored private key Prk to decrypt Ck to obtain Ks, and then uses Ks to decrypt Cd to recover the service set identifier and password. The one-time session key Ks is regenerated during each network configuration process and is valid only once. It is then cleared from the device memory after the network configuration is completed.
8. The method for rapid Wi-Fi networking of intelligent devices according to claim 1, characterized in that, Before performing step S11, the process also includes channel quality assessment and adaptive parameter calculation steps: The distribution network initiating terminal sequentially sends probe packets on each available channel of the target router and records the received signal strength indication of each channel. and noise background The first number is calculated using the following formula. Quality factor of each channel : ; In the formula, The maximum received signal strength across all channels. The lowest noise floor among all channels; Based on the quality factor of each channel Dynamically adjust the number of packets sent per transmission on this channel. Total number of polling rounds The formula is adjusted as follows: ; ; In the formula, Based on the number of packets sent, The average quality factor for all channels. The standard deviation of the quality factor. Basic polling rounds; According to the dynamic calculation obtained by the distribution network initiating terminal Send the corresponding number of data packets on each channel.
9. A computer device, characterized in that, Includes a processor, wherein the processor runs a program for a method of fast Wi-Fi networking for smart devices as described in any one of claims 1-8.
10. A storage medium, characterized in that, The program stores a method for rapid Wi-Fi networking of smart devices as described in any one of claims 1-8.