A WiFi device automatic network configuration method, WiFi device, electronic device and storage medium

By acquiring the preamble and data code in monitoring mode and performing XOR verification, automatic network configuration of WiFi devices is achieved, solving the problems of complex user operation and parsing errors in existing technologies. This method is suitable for in-vehicle WiFi devices in new energy vehicles.

CN115802449BActive Publication Date: 2026-05-26CHONGQING CHANGAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING CHANGAN TECH CO LTD
Filing Date
2022-10-21
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing WiFi device configuration methods are complex, requiring users to manually enter network information. Furthermore, the parsing of the AP's SSID and password is easily interfered with, leading to inconvenience and failure in configuration.

Method used

By scanning the WiFi channel in monitoring mode to obtain the boot code, extract the MAC source address, obtain and reassemble the packet data code, perform XOR verification, automatically connect to the target router, and send back IP information, the system can achieve automatic network configuration without user input.

Benefits of technology

It enables automated network configuration for WiFi devices, reducing user operations and improving the convenience and success rate of network configuration. It is suitable for in-vehicle WiFi devices in new energy vehicles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115802449B_ABST
    Figure CN115802449B_ABST
Patent Text Reader

Abstract

This invention provides a method for automatic network configuration of WiFi devices, as well as WiFi devices, electronic devices, and storage media. The automatic network configuration method includes the following steps: scanning WiFi channels in monitoring mode to obtain the WiFi channel where the preamble is located; staying on the WiFi channel where the preamble is located and extracting the hardware address sent by the preamble; obtaining the data code sent by the hardware address and repackaging the data code to obtain the original data packet, wherein the data code is encoded by the network configuration program and then sent; performing XOR verification on the data of the original data packet; if the verification passes, automatically connecting to the target router and sending back the IP information assigned after connecting to the network to the network configuration program. This invention can eliminate the need for users to input network information and simultaneously complete the network configuration of one or more WiFi devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wireless communication technology, specifically to a method and apparatus for automatic network configuration of WiFi devices, electronic devices, and storage media. Background Technology

[0002] With the continuous development of new energy vehicles, they are gradually evolving into software-defined vehicles. WiFi (Wireless Fidelity) devices will play an important role in the future automotive field, and providing network support for WiFi devices will also affect the further development of new energy vehicles.

[0003] Currently, mainstream network configuration protocols in the market, such as AP (Access Point) configuration, SmartConfig configuration, and Bluetooth-assisted configuration, still have certain user operation costs and do not provide a convenient and quick configuration method. For example, patent CN108449770A discloses a smart hardware WiFi configuration method, which requires users to use a mobile device to turn on a manufacturer's default AP hotspot and then input the AP information to be connected to to complete the configuration. However, users may not know the manufacturer's default AP information, which increases the user's learning cost. If multiple devices need to connect to WiFi simultaneously, it will increase the user's workload, making it less user-friendly. Patent CN110167193A discloses an automatic WiFi configuration method and WiFi device. The WiFi device captures broadcast packets and data packets sent by at least one router in listening mode, parses the WiFi name and password of the target router, and then connects to the target router. Since routers typically send broadcast packets or data packets that don't only contain network configuration information, information sent by other devices may also be intercepted by WiFi devices. This can interfere with resolving the AP's SSID and password. Without verifying the encrypted information, WiFi devices are very likely unable to resolve the correct AP's SSID and password.

[0004] Therefore, there is a need to provide a simple and efficient method for configuring WiFi devices to reduce manual operation by users and enable automatic connection of in-vehicle WiFi devices. Summary of the Invention

[0005] In view of the shortcomings of the prior art described above, the present invention provides a method for automatic network configuration of WiFi devices, as well as WiFi devices, electronic devices, and storage media, to solve the above-mentioned technical problems.

[0006] The automatic network configuration method for WiFi devices provided by this invention includes:

[0007] In monitoring mode, scan the WiFi channel to obtain the WiFi channel where the boot code is located. The boot code is issued by the network configuration program of the smart device that has been connected to the target router.

[0008] Stay on the WiFi channel where the preamble is located, and extract the hardware address (Media Access Control, MAC source address, Media Access Control source address) sent by the preamble;

[0009] The data code sent by the MAC source address is obtained, and the data code is reassembled to obtain the original data packet. The data packet is sent by the network configuration program after encoding the wireless network access point (AP) information.

[0010] Perform XOR verification on the data in the original data packet;

[0011] If the verification passes, the system will automatically connect to the target route and send the assigned IP information back to the network configuration program.

[0012] In one embodiment of the present invention, the step of scanning the WiFi channel in monitoring mode to obtain the WiFi channel where the preamble is located includes:

[0013] In monitoring mode, multiple WiFi channels are scanned sequentially, and WiFi data frames in each WiFi channel are captured.

[0014] The length of the WiFi data frame is calculated according to the format of the User Datagram Protocol (UDP).

[0015] The length of the WiFi data frame is compared with the length of the preamble. If the two lengths are the same, the preamble exists in the channel; if they are not the same, the preamble does not exist in the channel, and the system automatically switches to the next channel until the preamble is obtained.

[0016] In one embodiment of the present invention, the time for the network configuration program to send the preamble is greater than or equal to the time for the WiFi device to scan all channels.

[0017] In one embodiment of the present invention, obtaining the data code sent by the hardware address and reassembling the data code to obtain the original data packet includes:

[0018] Receive the data code sent by the distribution network program;

[0019] Redundancy calculations are performed based on the position of each byte of the data code to reassemble the data code and obtain the original data packet.

[0020] In one embodiment of the present invention, the data code sent by the network configuration program is obtained by the network configuration program by performing redundancy calculation on the original data frame according to each byte and the position of each byte; wherein, the original data frame is the wireless network access point information, and the wireless network access point information includes the IP information, WiFi name and WiFi password of the smart device that has been connected to the target router.

[0021] In one embodiment of the present invention, XOR verification is performed on the data in the original data packet, including:

[0022] The calculated value of the original data packet is compared with the check value of the original data frame transmission. The original data frame is AP information, which includes the IP information, WiFi name, and WiFi password of the smart device that has been connected to the target router.

[0023] If the calculated data value is the same as the verification value, the verification passes; if the calculated data value is different from the verification value, the verification fails.

[0024] In one embodiment of the present invention, if the verification passes, the target route is automatically connected, and the IP information allocated after the network connection is sent back to the network configuration program, including:

[0025] After the data verification is successful, the WiFi device extracts the WiFi name and WiFi password from the original data frame and connects to the target router;

[0026] The WiFi device sends the assigned IP information after connecting to the network back to the network configuration program based on the IP information in the original data frame, thus completing the successful network connection notification.

[0027] The WiFi device of the present invention includes a preamble acquisition module, a hardware address acquisition module, a data packet acquisition module, a verification module, and a connection module. The preamble acquisition module is configured to scan WiFi channels in monitoring mode to obtain the WiFi channel where the preamble is located. The preamble is issued by the network configuration program of a smart device that has already connected to a target router. The hardware address acquisition module is configured to stay on the WiFi channel where the preamble is located and extract the hardware address sent by the preamble. The data code acquisition module is configured to obtain the data code sent by the hardware address and reassemble the data code to obtain the original data packet. The data code is issued by the network configuration program after encoding the wireless network access point information. The verification module is configured to perform XOR verification on the data of the original data packet. The connection module is configured to automatically connect to the target router when the verification passes and send back the IP information assigned after the network connection to the network configuration program.

[0028] The electronic device of the present invention includes one or more processors and a storage device, wherein the storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device enables the automatic network configuration method of the WiFi device described above.

[0029] The storage medium of the present invention stores a computer program, which, when executed by the processor of a computer, causes the computer to execute the WiFi device configuration method of the present invention.

[0030] The beneficial effects of this invention are as follows: The automatic network configuration method for WiFi devices in this invention utilizes a smart device with computing capabilities to run a network configuration program. This program can directly obtain the AP information of the smart device and transmit the AP information through SmartConfig technology. The WiFi device obtains the AP information in monitoring mode and automatically connects to the AP. After successfully connecting to the AP, the WiFi device sends the assigned IP information back to the network configuration program, completing the successful network connection notification. This invention eliminates the need for users to input network information; simply starting the network configuration program completes the network configuration for one or more WiFi devices, achieving true user-input-free operation, convenience, speed, and improved user experience.

[0031] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0032] 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. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0033] Figure 1 This is a schematic diagram illustrating the implementation environment of an automatic network configuration method for WiFi devices, as shown in an exemplary embodiment of this application.

[0034] Figure 2 This is a flowchart illustrating an exemplary embodiment of the WiFi device automatic network configuration method.

[0035] Figure 3 This is a schematic diagram of the original data frame data structure of this application;

[0036] Figure 4 This is a schematic diagram illustrating the process of obtaining a preamble code through channel scanning in an automatic network configuration method for WiFi devices, as shown in an exemplary embodiment of this application.

[0037] Figure 5 yes Figure 2 A schematic diagram of the WiFi data frame data structure in the embodiment shown;

[0038] Figure 6 This is a schematic diagram illustrating the data code reconstruction process of an automatic network configuration method for WiFi devices, as shown in an exemplary embodiment of this application.

[0039] Figure 7 This is an exemplary embodiment of the present application illustrating the interaction flowchart between the vehicle's infotainment system and the WiFi device for automatic WiFi network configuration;

[0040] Figure 8 This is a block diagram illustrating a WiFi device in an exemplary embodiment of this application;

[0041] Figure 9 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation

[0042] The embodiments of the present invention will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention and not for limiting the scope of protection of the present invention.

[0043] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0044] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.

[0045] Currently, the most common wireless network configuration methods are AP configuration and Smartconfig one-click configuration. AP configuration involves switching the smart device to AP mode (similar to a router, forming a local area network), while the mobile phone is in station mode. The mobile phone connects to the smart device in AP mode to form a local area network. The mobile phone and smart device can then establish socket communication for data exchange. The mobile phone obtains a list of WiFi routers, selects the desired router's SSID (WiFi name), and enters the login password. After receiving the SSID and password, the smart device automatically switches its network mode from AP mode to station mode and then actively connects to the router, completing the network configuration. AP configuration is quite stable, achieving almost a 100% success rate. However, AP mode is more complex to operate, requiring manual switching of the mobile phone's WiFi connection network. It first connects to the smart device's AP network, configures it, and then reverts to the normal WiFi network; it is only suitable for applications with indoor WiFi networks.

[0046] The Smart Config one-click configuration mode switches the smart hardware to the Smart Config one-click network configuration method. The phone connects normally to the Wi-Fi router, and the mobile app sends a UDP broadcast packet containing the router's encrypted SSID and password. The Wi-Fi module with built-in Smart Config functionality has a monitor mode, which can capture broadcast packets in the air. The Wi-Fi module scans all currently connectable routers to identify their channels and listens to each channel. After receiving the encrypted broadcast packet from the phone, it decrypts it to reveal the SSID and password of the connectable router. It then switches the connection mode from monitor mode to station mode, actively connecting to the router and logging into the cloud. When both the phone and smart hardware are connected to the same router, the smart hardware submits its identification code and app registration ID to the cloud server, thus binding the smart hardware and phone. From this point on, the two can interact. The Smart config one-click configuration mode is easy to operate. However, when the router sends broadcast packets, it usually does not only include network configuration information. Information sent by other devices may also be listened to by the WiFi module. This will interfere with the resolution of the AP's SSID and password. Without information bit verification of the encrypted information, the smart hardware will most likely fail to resolve the correct AP's SSID and password.

[0047] SmartConfig one-click configuration technology is relatively mature. WiFi devices with monitoring capabilities can capture WiFi frames in the air. WiFi data frames encrypt their payload fields. Although the WiFi device cannot parse the payload content of the WiFi data frame, it can calculate its length. This payload content is the encrypted content of the IP data packet. Although it is encrypted, its length remains unchanged. A mapping table can be established based on the IP data packet length and the information to be transmitted. Finally, the information can be decrypted based on the data length to complete the information transmission. Based on this, embodiments of this application propose an automatic network configuration method for WiFi devices, a WiFi device, an electronic device, a computer-readable storage medium, and a computer program product. These embodiments will be described in detail below.

[0048] Figure 1 This is a schematic diagram illustrating the implementation environment of an automatic network configuration method for WiFi devices, as shown in an exemplary embodiment of this application. Figure 1 As shown, when configuring WiFi device 110, the user only needs to start the configuration program of smart device 120. The configuration program can directly obtain the AP information of smart device 120, avoiding the need for the user to input network information. The configuration program transmits the AP information of smart device 120 to WiFi device 110 through SmartConfig technology. WiFi device 110 obtains the AP information in monitoring mode and automatically connects. After WiFi device 110 successfully connects to the network, it notifies smart device 120, thereby realizing the interaction between smart device 120 and WiFi device 110. Figure 1 The smart device 120 shown has computing capabilities and can be a terminal device such as a smartphone, in-vehicle computer, tablet computer, or laptop computer, but is not limited to these.

[0049] Please see Figure 2 , Figure 2 This is a flowchart illustrating an exemplary embodiment of a WiFi device automatic network configuration method according to this application. This method can be applied to... Figure 1 The implementation environment is shown, and the method is specifically executed by the smart device 120 in that implementation environment. It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.

[0050] For example, the automatic WiFi device configuration method disclosed in this embodiment is applicable to in-vehicle WiFi devices in new energy vehicles. The smart device 120 is a smart terminal with computing capabilities installed in the vehicle, hereinafter referred to as the vehicle unit. The vehicle unit is connected to a wireless network and has a vehicle configuration program installed on it. Users only need to start the vehicle configuration program through virtual or physical buttons to configure one or more in-vehicle WiFi devices.

[0051] like Figure 2 As shown, in an exemplary embodiment, the automatic network configuration method for WiFi devices includes at least steps S210 to S250, which are described in detail below:

[0052] Step S210: Scan the WiFi channel in monitoring mode to obtain the WiFi channel where the preamble is located. The preamble is issued by the network configuration program of the smart device that has been connected to the target router.

[0053] First, it's important to clarify that the smart device connecting to the target router is a smart device connected to a wireless network. This wireless network can be 2G, 3G, 4G, 5G, Wi-Fi, etc. For example, a car's infotainment system can directly read the AP SSID, password, and IP address of the car's network configuration software, and then... Figure 3 The data structure shown is assembled into a raw data frame. After assembly, the vehicle network configuration program sends a preamble. The preamble is a distinguishable ASCII (American Standard Code for Information Interchange) character, which can be composed of any number of values ​​from 256 to 1024, such as 500, 501, 502, and 503. The vehicle network configuration program converts each value of the preamble into data of the corresponding UDP packet length and sends it to a fixed port 255.255.255.255. The WiFi device actively scans WiFi channels in listening mode until it obtains the WiFi channel containing the preamble. Furthermore, the time taken for the configuration program to send the preamble is greater than or equal to the time taken for the WiFi device to scan all WiFi channels. That is, the vehicle network configuration program will repeatedly broadcast the encoded preamble using UDP, and the time taken to send the preamble is no less than the time taken for the WiFi device to scan all WiFi channels, to ensure that the WiFi device has scanned all WiFi channels and obtained the preamble. For example, if a WiFi device has 13 channels, the time it takes for the vehicle's network configuration program to send the preamble is at least equal to the time it takes for the WiFi device to scan channels 1 to 13.

[0054] Step S220: Stay on the WiFi channel where the preamble is located, and extract the hardware address sent by the preamble.

[0055] After obtaining the preamble, the WiFi device will remain on the WiFi channel where the preamble is located, and simultaneously extract the MAC source address sent by the preamble. This is used to filter out all data packets that do not have this MAC source address in subsequent data packet captures. The WiFi device will remain on this channel waiting for the data code to be sent. If it does not receive the data code within a specified time, it will re-enter the channel scanning state.

[0056] Step S230: Obtain the data code sent by the hardware address, and reassemble the data code to obtain the original data packet. The data code is sent by the network configuration program after encoding the AP information.

[0057] The data code is generated by the vehicle's network configuration program by combining the AP SSID, password, and vehicle's IP address. Figure 3 The data structure shown is used to assemble packets to obtain raw data frames, which are then encoded and sent out.

[0058] Step S240: Perform XOR verification on the data in the original data packet.

[0059] The WiFi device compares the calculated value of the original data packet with the verification value of the original data frame transmission. If the calculated value is the same as the verification value, the verification passes; if the calculated value is different from the verification value, the verification fails, and the channel is scanned again.

[0060] Step S250: After successful verification, the system automatically connects to the target route and sends the assigned IP information back to the network configuration program.

[0061] After successful data verification, the WiFi device's configuration program extracts the AP SSID and password from the original data frame, connects to the AP, and successfully accesses the vehicle's AP. Based on the IP information in the original data frame, it sends its assigned IP information back to the vehicle's configuration program, completing the successful network connection notification. Multiple WiFi devices can capture the same WiFi data frame simultaneously, so this method can configure multiple WiFi devices concurrently. The vehicle's configuration program also starts a UDP server during program execution, waiting for successful network connection information from WiFi devices. This UDP server remains open throughout the program's runtime, waiting for information to be transmitted. When the vehicle's configuration program receives IP information from one WiFi device, it considers that one WiFi device to have successfully configured; receiving multiple IP information transmissions indicates that multiple WiFi devices have successfully configured.

[0062] Figure 4 yes Figure 2 The illustrated embodiment shows a flowchart of step S210, channel scanning to obtain the preamble. Figure 4 As shown, the process of scanning WiFi channels in monitoring mode to obtain the WiFi channel where the preamble is located may include steps S410 to S420, which are described in detail below:

[0063] Step S410: In monitoring mode, scan multiple WiFi channels sequentially and capture WiFi data frames in each channel.

[0064] When a WiFi device is powered on but not connected to the network, it continuously executes a network configuration program, meaning the WiFi device is in monitoring mode and sequentially scans multiple WiFi channels. The WiFi device stays on each WiFi channel for a period of time to capture WiFi data frames in the channel.

[0065] Step S420: Calculate the length of the WiFi data frame according to the UDP packet format.

[0066] Figure 5 This is a schematic diagram of the WiFi data frame structure. After the WiFi device captures the WiFi data frame in the channel, it parses the payload length according to the WiFi data frame format, and then subtracts the fixed frame header length of the IP packet and the fixed frame header length of the UDP packet to obtain the length, which is the default value of the transmitted data.

[0067] If the length of the WiFi data frame matches the length of the preamble, then the WiFi channel has a preamble; if the length of the WiFi data frame does not match the length of the preamble, then the WiFi channel does not have a preamble, and it will automatically switch to the next channel until a preamble is obtained.

[0068] Figure 6 yes Figure 2 The illustrated embodiment shows a flowchart of step S230, data code reconstruction. Figure 6 As shown, the process of obtaining the data code sent by the hardware address and reassembling the data code to obtain the original data packet may include steps S610 to S620, which are described in detail below:

[0069] Step S610: Receive the data code of the distribution network program.

[0070] The vehicle network configuration program will process the original data frames (i.e., AP SSID, password, and vehicle IP address) according to... Figure 3 The data structure shown is used to assemble packets. Redundancy calculations are performed on each byte and its position to obtain a new data frame. Each byte of the data frame is then converted into data of the corresponding UDP packet length, forming a data code that is sequentially sent to a fixed port 255.225.255.255. The vehicle network configuration program sequentially and repeatedly sends the encoded data code within a specified time.

[0071] Step S620: Redundancy calculation is performed based on the position of each byte of the data code to reassemble the data packet and obtain the original data packet.

[0072] After receiving the data code, the WiFi device reassembles the data packet based on the redundancy calculation of each byte's location to form the original data packet, which is then used for subsequent XOR verification of the original data packet.

[0073] Figure 7This is a schematic diagram illustrating the network distribution communication process in an exemplary application scenario. Figure 7 In the illustrated application scenario, the user initiates the vehicle network configuration program via a virtual or physical button. The program repeatedly broadcasts the encoded preamble via UDP broadcast at a certain frequency. Simultaneously, the WiFi device enters listening mode, sequentially scanning channels 1 to 13 to find the channel containing the preamble. Once the preamble is obtained, the WiFi device locks onto that channel, ready to receive the data code. The vehicle network configuration program sequentially and repeatedly sends the encoded data code within a specified time. After receiving the data code, the WiFi device reassembles it. The data is then verified. If verification is successful, the AP name and password are extracted, and the device automatically connects to the network. After successful connection, the device sends its assigned IP address back to the vehicle network configuration program. The program obtains the WiFi device's IP address, exits, and completes the network configuration. For detailed implementation processes, please refer to the descriptions in the aforementioned embodiments; they will not be repeated here.

[0074] Figure 8 This is a block diagram illustrating a WiFi device according to an exemplary embodiment of this application. The device can be applied to… Figure 1 The implementation environment shown can also be applied to other exemplary implementation environments. This embodiment does not limit the implementation environment to which the device is applicable.

[0075] like Figure 8 As shown, the exemplary WiFi device includes: a boot code acquisition module 801, a hardware address acquisition module 802, a data code acquisition module 803, a verification module 804, and a connection module 805. Specifically, the boot code acquisition module 801 is configured to scan WiFi channels in monitoring mode to obtain the WiFi channel where the boot code is located; the boot code is issued by the network configuration program of a smart device already connected to the target router. The hardware address acquisition module 802 is configured to stay on the WiFi channel where the boot code is located and extract the MAC source address sent by the boot code. The data code acquisition module 803 is configured to obtain the data packet sent by the hardware address and reassemble the data packet to obtain the original data packet; the data code is encoded by the AP information of the network configuration program and then sent. The verification module 804 is configured to perform XOR verification on the data of the original data packet. The connection module 805 is configured to, upon successful verification, extract the AP information, automatically connect to the target router based on the AP information, and send back the assigned IP information after network connection to the network configuration program.

[0076] It should be noted that the WiFi device provided in the above embodiments and the automatic network configuration method for the WiFi device provided in the above embodiments belong to the same concept. The specific way each module performs its operation has been described in detail in the method embodiments, and will not be repeated here. In practical applications, the traffic condition refresh device provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0077] Embodiments of this application also provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the automatic WiFi device configuration method provided in the above embodiments.

[0078] Figure 9 A schematic diagram of a computer system suitable for implementing the embodiments of this application is shown. It should be noted that... Figure 9 The computer system 900 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0079] like Figure 9 As shown, the computer system 900 includes a Central Processing Unit (CPU) 901, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 902 or programs loaded from storage portion 909 into Random Access Memory (RAM) 903, such as performing the methods described in the above embodiments. The RAM 903 also stores various programs and data required for system operation. The CPU 1201, ROM 1202, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0080] The following components are connected to I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 909 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to I / O interface 905 as needed. Removable media 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 910 as needed so that computer programs read from them can be installed into storage section 909 as needed.

[0081] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 909, and / or installed from removable medium 911. When the computer program is executed by central processing unit (CPU) 901, it performs various functions defined in the system of this application.

[0082] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0083] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0084] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0085] Another aspect of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the WiFi device automatic network pairing method as described above. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.

[0086] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the automatic WiFi device configuration method provided in the various embodiments described above.

[0087] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method for automatic network configuration of a WiFi device, characterized in that, The method includes: In monitoring mode, scan the WiFi channel to obtain the WiFi channel where the boot code is located. The boot code is issued by the network configuration program of the smart device that has been connected to the target router. Stay on the WiFi channel where the preamble is located, and extract the hardware address sent by the preamble; The data code sent by the hardware address is obtained, and the data code is reassembled to obtain the original data packet. The data code is sent by the network configuration program after encoding the wireless network access point information. Perform XOR verification on the data in the original data packet; If the verification passes, the system will automatically connect to the target route and send the assigned IP information back to the network configuration program. The step of scanning the WiFi channel in monitoring mode to obtain the WiFi channel where the preamble is located includes: In monitoring mode, multiple WiFi channels are scanned sequentially, and WiFi data frames in each WiFi channel are captured. The length of the WiFi data frame is calculated according to the format of the User Datagram Protocol packet; The length of the WiFi data frame is compared with the length of the preamble. If the two lengths are the same, the preamble exists in the channel; if they are not the same, the preamble does not exist in the channel, and the system automatically switches to the next channel until the preamble is obtained.

2. The automatic network configuration method for WiFi devices according to claim 1, characterized in that, The time it takes for the network configuration program to send the preamble is greater than or equal to the time it takes for the WiFi device to scan all channels.

3. The automatic network configuration method for WiFi devices according to claim 1, characterized in that, Obtain the data code sent by the hardware address, and reassemble the data code to obtain the original data packet, including: Receive the data code sent by the distribution network program; Redundancy calculations are performed based on the position of each byte of the data code to reassemble the data code and obtain the original data packet.

4. The automatic network configuration method for WiFi devices according to claim 3, characterized in that, The data code sent by the network configuration program is obtained by the network configuration program redundancy calculation of the original data frame according to each byte and the position of each byte; wherein, the original data frame is the wireless network access point information, which includes the IP information, WiFi name and WiFi password of the smart device that has been connected to the target router.

5. The automatic network configuration method for WiFi devices according to claim 1, characterized in that, Performing an XOR check on the data in the original data packet includes: The calculated value of the original data packet is compared with the verification value of the original data frame transmission. The original data frame is the wireless network access point information, which includes the IP information, WiFi name, and WiFi password of the smart device that has been connected to the target router. If the calculated data value is the same as the verification value, the verification passes; if the calculated data value is different from the verification value, the verification fails.

6. The automatic network configuration method for WiFi devices according to claim 4, characterized in that, If the verification passes, the system automatically connects to the target route and sends the assigned IP information back to the network configuration program, including: After the data verification is successful, the WiFi device extracts the WiFi name and WiFi password from the original data frame and connects to the target router; The WiFi device sends the assigned IP information after connecting to the network back to the network configuration program based on the IP information in the original data frame, thus completing the successful network connection notification.

7. A WiFi device, characterized in that, include: The preamble acquisition module is configured to scan WiFi channels in monitoring mode to obtain the WiFi channel where the preamble is located. The preamble is issued by the network configuration program of the smart device that has been connected to the target router. The hardware address acquisition module is configured to stay on the WiFi channel where the preamble is located and extract the hardware address sent by the preamble; The data code acquisition module is configured to acquire the data code sent by the hardware address and reassemble the data code to obtain the original data packet. The data code is sent by the network configuration program after encoding the wireless network access point information. The verification module is configured to perform XOR verification on the data in the original data packet; The connection module is configured to automatically connect to the target route when the verification is successful, and to send back the IP information assigned after the network connection to the network configuration program; The preamble acquisition module scans WiFi channels in monitoring mode to obtain the WiFi channel where the preamble is located, including: In monitoring mode, multiple WiFi channels are scanned sequentially, and WiFi data frames in each WiFi channel are captured. The length of the WiFi data frame is calculated according to the format of the User Datagram Protocol packet; The length of the WiFi data frame is compared with the length of the preamble. If the two lengths are the same, the preamble exists in the channel; if they are not the same, the preamble does not exist in the channel, and the system automatically switches to the next channel until the preamble is obtained.

8. An electronic device, characterized in that, The electronic device includes: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to implement the WiFi device automatic network configuration method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the computer's processor, causes the computer to perform the WiFi device automatic network configuration method according to any one of claims 1 to 6.