Network distribution method, network distribution device, electronic equipment and storage medium
The IoT device simultaneously enables mixed and AP modes, monitors UDP broadcasts and connects to mobile devices through AP mode when they fail, solving the problem of low distribution network success rate caused by not supporting UDP broadcast routers and improving distribution network success rate.
Patent Information
- Application Number
- CN202411233425.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2025-01-07
AI Technical Summary
IoT devices cannot realize WiFi distribution network without a router that does not support UDP broadcast, resulting in a low success rate of distribution network.
IoT devices turn on both promiscuous mode and AP mode, and listen to UDP broadcast in promiscuous mode. If the target UDP broadcast is not monitored, a communication connection will be established with the mobile device through AP mode, receive distribution network request messages, and connect with the router in STA mode. Establish communication connections and realize distribution network.
It improves the distribution network success rate of IoT devices without supporting UDP broadcast routers, ensuring the stability and success rate of distribution process.
Smart Images

Figure CN119277480A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of wireless communication technology, and in particular to a network distribution method, a network distribution device, an electronic device and a storage medium. Background Art
[0002] With the continuous development of the Internet, there are more and more scenarios for using WiFi in daily life. Among them, the networking of Internet of Things (IoT) devices generally relies on WiFi connection. IoT devices need to be connected to a router to realize data reporting and remote control. The process of IoT devices obtaining the name and password of the WiFi hotspot is usually called WiFi configuration.
[0003] There are many ways to configure IoT devices, the most commonly used one-click configuration (Smartconfig). The operating principle of one-click configuration is: after the mobile phone is connected to the router, the name and password of the router are broadcast through the User Datagram Protocol (UDP). When the IoT device is in promiscuous mode, it will receive and parse the broadcast packet sent by the mobile phone, obtain the name and password of the router and connect. However, not all routers support the UDP broadcast function. When encountering such a router that does not support broadcasting, the IoT device cannot achieve WiFi configuration, which reduces the success rate of IoT device configuration.
[0004] Therefore, how to improve the success rate of IoT device network configuration has become an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present application provide a network configuration method, a network configuration device, an electronic device, and a storage medium, which aim to solve the problem of low success rate of network configuration of IoT devices.
[0006] In the first aspect, an embodiment of the present application provides a network configuration method, which is applied to an Internet of Things device, wherein the Internet of Things device simultaneously turns on a promiscuous mode and an AP mode, and the method includes: listening to a UDP broadcast in the promiscuous mode; when no target UDP broadcast is heard within a preset time period, establishing a communication connection with a mobile device through the AP mode, wherein the target UDP broadcast is a UDP broadcast carrying the identity information of a router; receiving a network configuration request message sent by the mobile device, wherein the network configuration request message includes the identity information of the router; and establishing a communication connection with the router in the STA mode based on the network configuration request message.
[0007] In a possible implementation, after listening to UDP broadcast in the promiscuous mode, the method further includes: starting a configuration service, the configuration service including an HTTP service; after the mobile device obtains the address information of the IoT device, receiving a configuration request message sent by the mobile device based on the HTTP service; the address information includes the IP address, port number and configuration interface of the IoT device; and modifying the communication configuration information based on the configuration request message.
[0008] In a possible implementation, after establishing a communication connection with the router in STA mode based on the network configuration request message, the method further includes: joining a target multicast address; receiving a device discovery request message sent by the mobile device through the router based on the target multicast address; in response to the device discovery request message, sending device information to the mobile device, so that the mobile device adds the IoT device to a target device list based on the device information; the device information includes the IP address of the IoT device.
[0009] In the second aspect, an embodiment of the present application provides a network configuration method, which is applied to a mobile device, and the method includes: after establishing a communication connection with a router, sending a target UDP broadcast, wherein the target UDP broadcast is a UDP broadcast carrying the identity information of the router; if the Internet of Things device is in promiscuous mode and fails to hear the target UDP broadcast within a preset time period, establishing a communication connection with the Internet of Things device based on the AP mode of the Internet of Things device; the Internet of Things device simultaneously turns on the promiscuous mode and the AP mode; sending a network configuration request message to the Internet of Things device, so that the Internet of Things device establishes a communication connection with the router in STA mode based on the network configuration request message; the network configuration request message includes the identity information of the router.
[0010] In a possible implementation, after the communication connection with the router is established and the target UDP broadcast is sent, the method further includes: after the IoT device starts the configuration service, obtaining the address information of the IoT device, the address information including the IP address, port number and configuration interface of the IoT device, and the configuration service including the HTTP service; based on the address information, sending a configuration request message to the IoT device, so that the IoT device modifies the communication configuration information based on the configuration request message.
[0011] In a possible implementation, after the communication connection with the router is established, sending the target UDP broadcast includes: after the communication connection with the router is established, sending the target UDP broadcast through a first application;
[0012] The method also includes: if the IoT device is in promiscuous mode, it monitors the target UDP broadcast within the preset time period, establishes a communication connection with the router based on the target UDP broadcast, and after joining the target multicast address, establishes a communication connection with the router based on a second application; sends a device discovery request message to the target multicast address through the router; receives device information sent by the IoT device based on the second application, the device information includes the IP address of the IoT device; and adds the IoT device to the target device list through the second application according to the device information.
[0013] In a possible implementation, the sending a network configuration request message to the IoT device includes: sending a network configuration request message to the IoT device through a first application;
[0014] After sending a network configuration request message to the IoT device so that the IoT device establishes a communication connection with the router in the STA mode based on the network configuration request message, the method further includes: disconnecting the communication connection with the IoT device through the first application; establishing a communication connection with the router based on the second application; sending a device discovery request message to a target multicast address through the router, wherein the target multicast address is a multicast address joined by the IoT device after establishing a communication connection with the router; receiving device information sent by the IoT device based on the second application, wherein the device information includes the IP address of the IoT device; and adding the IoT device to a target device list through the second application according to the device information.
[0015] In the third aspect, an embodiment of the present application provides a network configuration device, which is applied to an Internet of Things device, wherein the Internet of Things device simultaneously turns on a promiscuous mode and an AP mode, and the device includes: a monitoring module, which is used to monitor UDP broadcasts in the promiscuous mode; a connection module, which is used to establish a communication connection with a mobile device through the AP mode when the target UDP broadcast is not monitored within a preset time period, and the target UDP broadcast is a UDP broadcast carrying the identity information of the router; a receiving module, which is used to receive a network configuration request message sent by the mobile device, and the network configuration request message includes the identity information of the router; a network configuration module, which is used to establish a communication connection with the router in the STA mode based on the network configuration request message.
[0016] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method described in the first aspect or the second aspect or any one of the implementation methods thereof is implemented.
[0017] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect or the second aspect or any one of the implementation methods thereof is implemented.
[0018] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method described in the first aspect or the second aspect or any one of the implementation methods therein.
[0019] Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows: when the IoT device turns on the promiscuous mode and AP mode at the same time, and does not listen to the target UDP broadcast carrying the router's identity information in the promiscuous mode, that is, when the network configuration fails through the one-key network configuration method, a connection is established with the mobile device in the AP mode, and a network configuration request message is received from the mobile device, the network configuration request message including the router's identity information; based on the network configuration request message, the router is connected in the STA mode. The present application gives priority to the one-key network configuration, and in the event of the failure of the one-key network configuration, the IoT device establishes a connection with the mobile device in the AP mode, and the network configuration of the IoT device is realized through the network configuration request message containing the router's identity information sent by the mobile device, which improves the success rate of the IoT device network configuration compared to the situation where only the one-key network configuration method is used for network configuration.
[0020] It can be understood that the network distribution device, electronic device, computer-readable storage medium and computer program product provided in the embodiments of the present application have the same beneficial effects as the above-mentioned network distribution method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 It is a flowchart of a one-key network configuration method;
[0023] Figure 2 A flowchart of an AP network configuration method is shown;
[0024] Figure 3 A schematic diagram of the structure of a distribution network system provided in one embodiment of the present application;
[0025] Figure 4A schematic diagram of a flow chart of a network configuration method provided in one embodiment of the present application;
[0026] Figure 5 A flowchart of another network configuration method provided in an embodiment of the present application;
[0027] Figure 6 A flowchart of another network configuration method provided in an embodiment of the present application;
[0028] Figure 7 A flowchart of another network configuration method provided in an embodiment of the present application;
[0029] Figure 8 A flowchart of another network configuration method provided in an embodiment of the present application;
[0030] Fig. 9 A structural block diagram of a distribution network device provided in one embodiment of the present application;
[0031] Fig.10 A structural block diagram of another network distribution device provided in an embodiment of the present application;
[0032] Fig.11 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0033] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0034] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0035] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0036] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0037] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0038] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0039] IoT devices need to be connected to a router to implement data reporting and remote control. The process of IoT devices obtaining the account and password of a WiFi hotspot is usually called WiFi configuration.
[0040] There are many ways to configure WiFi network, the commonly used ones are one-click configuration (Smartconfig), hotspot configuration (SoftAP) and Bluetooth configuration (Bleconfig).
[0041] One-click network configuration is the network configuration method with the greatest advantages but the most obvious disadvantages. With its simple operation, the one-click network configuration technology has basically occupied more than 90% of IoT devices on the market. For example, Figure 1As shown in the figure, the one-click network configuration process includes: after the mobile device is connected to the router, the identity information of the router is broadcasted through the APP software in the form of UDP broadcast. When the IoT device is in promiscuous mode (Sniffer), it will capture the UDP broadcast packet in the environment, capture the target UDP broadcast containing the identity information of the router, and parse it to obtain the identity information of the router and establish a communication connection with the router based on it. The process is simple and convenient and supports batch network configuration. The disadvantage is that not all routers support the UDP broadcast function. If you encounter a few routers that do not support broadcasting, you cannot achieve network configuration through one-click network configuration; in addition, if the router is set to 5G and 2.4G dual-band and the account password is the same, the mobile device will connect to 5G by default and send UDP broadcast, but the 2.4G IoT device cannot obtain it, and it is necessary to set independent account passwords for the two frequency bands of the router.
[0042] Hotspot network configuration (Soft AP) is a complex but most stable network configuration method. Figure 2 As shown, the process of hotspot network configuration includes: the IoT device enters the access point (AP) mode, the mobile device turns on WiFi through the APP software to find the IoT device hotspot for connection, and sends a network configuration request message to the IoT device through the APP software. The network configuration request message includes the identity information of the router (such as account number and password, etc.), and the IoT device establishes a communication connection with the router based on the network configuration request message. Since the mobile device directly connects to the IoT device for communication, there is no router involved in the process, so there is no router compatibility issue, and it has no effect on 2.4G / 5G routers with the same name, multiple WiFi routers with the same name in the same scenario, etc., and the success rate is almost 100%.
[0043] The principle of Bluetooth network configuration is similar to that of hotspot network configuration, except that the Bluetooth cost is increased and the device hotspot connection is replaced with device Bluetooth connection.
[0044] Based on the above-mentioned multiple WiFi network configuration methods, in order to improve the success rate of IoT device network configuration, the present application proposes a network configuration method, which is applied to IoT devices. The IoT devices simultaneously turn on the promiscuous mode and AP mode, and listen to UDP broadcasts in the promiscuous mode; when the target UDP broadcast is not heard within the preset time period, a communication connection is established with the mobile device through the AP mode, and the target UDP broadcast is a UDP broadcast carrying the identity information of the router; a network configuration request message sent by the mobile device is received, and the network configuration request message includes the identity information of the router; based on the network configuration request message, a communication connection is established with the router in the STA mode.
[0045] For ease of understanding, the technical solution of the present application will be described in detail below with reference to the accompanying drawings.
[0046] Figure 3 This is a schematic diagram of the structure of a distribution network system provided in one embodiment of the present application. Figure 3 As shown, the distribution network system 300 includes an IoT device 310, a mobile device 320, and a router 330. The IoT device 310, the mobile device 320, and the router 330 can be connected to each other in communication.
[0047] Specifically, the IoT device 310 is provided with a WiFi module, which has working modes such as AP, Station (STA), AT+STA, Sniffer, etc., and supports AP mode and Sniffer mode to work simultaneously. And the HyperText Transfer Protocol (HTTP) service is used for the local area configuration. When the user uses the APP in the mobile device 320 to configure the network, he can choose to connect to the hotspot of the router 330 to directly perform a one-click network configuration operation. In the rare case of failure, the user is prompted to switch to the hotspot of the IoT device 310 in AP mode, access the fixed HTTP interface to set the WiFi account password, and after the IoT device 310 obtains the account password, it switches to STA mode to connect to the router 330.
[0048] Among them, STA mode is the terminal mode, which is similar to the working mode when a mobile phone is connected to a router; AP mode is to use the IoT device 310 as a virtual routing AP, and other terminals can connect to the AP; AP+STA mode is the coexistence of AP mode and STA mode, which is mostly used for large-scale networking; when in Sniffer mode, the IoT device 310 receives all wireless data packets in the air, which is mostly used for monitoring, one-click network configuration, etc.
[0049] IoT device 310 can be any device, for example, office equipment (such as projectors, printers, mice, etc.), smart home equipment (such as lighting equipment, cooking equipment, cleaning equipment, etc.), urban public facilities (such as road monitoring cameras, fire fighting equipment, etc.), factory assembly line equipment (such as various position sensors, drive motors, etc.), construction equipment (such as winches, electric welders), and other equipment, and this application does not limit them.
[0050] The mobile device 320 may be a mobile phone, a tablet, a laptop, a wearable device, etc. In some embodiments, the mobile device 320 may have a better user interaction interface, for example, a touch screen, a camera, etc.
[0051] In a specific implementation, the IoT device 310 turns on the promiscuous mode and the AP mode at the same time, and listens to the UDP broadcast in the promiscuous mode; after the mobile device 320 is connected to the router 330 for communication, it sends a target UDP broadcast carrying the identity information of the router 330. If the IoT device 310 listens to the target UDP broadcast within a preset time period, it parses the target UDP broadcast to obtain the identity information of the router 330, and establishes a communication connection with the router 330 through the identity information; if the IoT device 310 does not listen to the target UDP broadcast within the preset time period, it establishes a communication connection with the mobile device 320 through the AP mode, and the mobile device 320 sends a network configuration request message containing the identity information of the router 330 to the IoT device 310. Based on the network configuration request message, the IoT device 310 establishes a communication connection with the router 330 in the STA mode to realize WiFi network configuration.
[0052] It should be noted that the preset time period can be customized according to actual conditions, and this application does not limit this.
[0053] Understandably, Figure 3 The system architecture shown is only an example of the distribution network system provided by the present application. In other embodiments of the present application, the distribution network system 300 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware, and the present application does not limit this.
[0054] Figure 4 This is a flow chart of a network configuration method provided in an embodiment of the present application. For the sake of convenience, only the part related to the present embodiment is shown. The method provided in the present embodiment is applied to an IoT device. As an example, the IoT device can be Figure 3 The IoT device 310 in the distribution network system 300 shown in the figure, the method provided in this embodiment includes the following steps:
[0055] S410, listen to UDP broadcast in promiscuous mode.
[0056] Specifically, the promiscuous mode is a data receiving mode of the IoT device. When the IoT device is in the promiscuous mode, it can receive all messages passing through it, regardless of whether the destination address of the message is the IoT device.
[0057] In the specific implementation, the IoT device turns on the promiscuous mode and AP mode at the same time, and listens to all UDP broadcasts in the promiscuous mode.
[0058] S420, when the target UDP broadcast is not monitored within the preset time period, establishing a communication connection with the mobile device through the AP mode, the target UDP broadcast is a UDP broadcast carrying the identity information of the router.
[0059] Specifically, when the IoT device works in AP mode, it can function as an AP device. For example, when the IoT device works in AP mode, it is responsible for monitoring the connection request of the mobile device to establish a communication connection with the mobile device based on the connection request.
[0060] In a specific implementation, the IoT device continuously listens to all UDP broadcasts in promiscuous mode. When no target UDP broadcast carrying the router's identity information is heard within a preset period of time, the IoT device receives a connection request message sent by the mobile device through the AP link LAN. In response to the connection request message, the IoT device establishes a communication connection with the mobile device in AP mode.
[0061] As an example, the preset time period is one minute. When the IoT device is in promiscuous mode and fails to detect the target UDP broadcast within one minute, a communication connection is established with the mobile device through the AP mode.
[0062] As an example, the mobile device and the router are Figure 3 The mobile device 320 and the router 330 in the distribution network system 300 are shown.
[0063] It should be noted that the preset time period of one minute is only an example. In other embodiments, the preset time period can be set to other values according to actual needs, and this application does not limit this.
[0064] S430, receiving a network configuration request message sent by a mobile device, where the network configuration request message includes identity information of a router.
[0065] Specifically, the identity information of the router includes a service set identifier (SSID), that is, the network name of the router, a basic service set identifier (BSSID), that is, the media access control (MAC) address of the router, a password or other identifiers.
[0066] In a specific implementation, after the IoT device establishes a communication connection with the mobile device in AP mode, a network configuration request message containing router identity information sent by the mobile device is received through the AP link local area network.
[0067] S440: Establish a communication connection with the router in STA mode based on the network configuration request message.
[0068] In the specific implementation, after the IoT device receives the network configuration request message sent by the mobile device in AP mode, it switches from AP mode to STA mode. In STA mode, it searches for the corresponding router through the router account and enters the password. After completing the identity authentication, it establishes a communication connection with the router in STA mode.
[0069] In the technical solution provided in this embodiment, the IoT device turns on the promiscuous mode and AP mode at the same time, and preferentially uses the one-key network configuration method in the promiscuous mode for network configuration. When the one-key network configuration fails, the IoT device establishes a communication connection with the mobile device in the AP mode, and performs network configuration through the AP network configuration method, thereby improving the success rate of network configuration of the IoT device.
[0070] Figure 5 A flowchart of another network configuration method provided in an embodiment of the present application. Figure 5 As shown, based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, after the IoT device listens to the UDP broadcast in the promiscuous mode, it also includes:
[0071] Enable configuration services, including HTTP services;
[0072] After the mobile device obtains the address information of the IoT device, the configuration request message sent by the mobile device is received based on the HTTP service; the address information includes the IP address, port number and configuration interface of the IoT device;
[0073] The communication configuration information is modified based on the configuration request message.
[0074] Specifically, the IoT device configures the local area network to use HTTP service. The communication configuration information of the IoT device can be modified by simply passing the IP address + port number + corresponding interface request of the IoT device. The communication configuration information includes WiFi configuration, etc.
[0075] In one possible implementation, Figure 5As shown in the method 1, when the IoT device listens to the target UDP broadcast within the preset time period, and establishes a communication connection with the router by parsing the identity information of the router obtained by the target UDP broadcast, the IoT device and the mobile device are both connected to the same router LAN, and can communicate through the HTTP service, receive the configuration request message sent by the mobile device through the address information of the IoT device obtained based on the HTTP service, and modify the communication configuration information based on the configuration request message, wherein the address information of the IoT device can be returned to the mobile device through the router when the IoT device configures the network based on the target UDP broadcast, or read by the mobile device by sending a device discovery instruction to the IoT device, the address information includes the IP address, port number and configuration interface of the IoT device, and the communication configuration information includes the WiFi configuration information. Since the IoT device has completed the network configuration at this time, the configuration request message actually modifies the communication configuration information of the IoT device through the interface.
[0076] In another possible implementation, Figure 5 As shown in the second method, the IoT device does not monitor the target UDP broadcast within the preset time period, and establishes a communication connection with the mobile device through the AP mode. When the IoT device is configured in the AP mode, the mobile device and the IoT device are in the same local area network. When the IoT device is in AP mode, it is equivalent to a small router. The IoT device will have a fixed IP address, which is usually the IP set by the IoT device at the factory, and is used for communication in AP mode. The IoT device receives the configuration request message sent by the mobile device through the fixed IP address of the IoT device, as well as the address information such as the port number and the configuration interface, and modifies the communication configuration information based on the configuration request message, wherein the communication configuration information includes the WiFi configuration information. Since the IoT device has not yet implemented the network configuration at this time, the IoT device receiving the configuration request message sent by the mobile device in AP mode is equivalent to the mobile device configuring the IoT device through the interface.
[0077] The technical solution provided in this embodiment realizes the modification of the communication configuration information of the IoT device when different network configuration methods are used to implement the network configuration of the IoT device, thereby improving the flexibility of modifying the communication configuration information of the IoT device.
[0078] Figure 6 A flowchart of another network configuration method provided in an embodiment of the present application is provided. Figure 6 As shown, based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, after the IoT device establishes a communication connection with the router in STA mode based on the network configuration request message, it also includes:
[0079] Join the target multicast address;
[0080] receiving a device discovery request message sent by a mobile device through a router based on a target multicast address;
[0081] In response to the device discovery request message, device information is sent to the mobile device so that the mobile device adds the IoT device to a target device list based on the device information; the device information includes the IP address of the IoT device.
[0082] Specifically, the target multicast address is a fixed multicast address. When the IoT device connects to the router and joins the local area network, it applies to join the target multicast address. When the router receives a message with the target multicast address, it forwards it to the IoT device that joins the target multicast address.
[0083] In a specific implementation, the IoT device applies to join the target multicast address after establishing a communication connection with the router. The router receives a device discovery request message sent by the mobile device. When there is a device discovery request message sent to the target multicast address, the router forwards the device discovery request message to the IoT device joined to the target multicast address. The IoT device sends device information to the mobile device based on the device discovery request message, so that the mobile device can add the IoT device to the target device list based on the device information.
[0084] As an example, the IoT device establishes a communication connection with the router through the target UDP broadcast or network configuration request message sent by the first application to the mobile device, and is added to the device list of the first application. The second application of the mobile device wants to add the IoT device to its own device list, that is, the target device list. The mobile device connects to the router through the second application, and the IoT device receives the device discovery request message sent by the second application through the router. Based on the device discovery request message, the IoT device sends device information including its own IP address to the second application, so that the second application adds the IoT device to the target device list based on the device information.
[0085] The technical solution provided in this embodiment is that after the IoT device establishes a communication connection with the router, it joins the target multicast address; receives a device discovery request message sent by the mobile device through the router based on the target multicast address; sends device information to the mobile device based on the device discovery request message, so that the mobile device adds the IoT device to the target device list based on the device information. When the mobile device wants to add the IoT device to the target device list, there is no need to perform network configuration operations again, which improves the network configuration efficiency of the IoT device and enhances the user experience.
[0086] Figure 7This is a flow chart of another network configuration method provided in an embodiment of the present application. For the sake of convenience, only the part related to this embodiment is shown. The method provided in this embodiment is applied to a mobile device. As an example, the mobile device can be Figure 3 The mobile device 320 in the distribution network system 300 shown in the figure, the method provided in this embodiment includes the following steps:
[0087] S710, after the communication connection with the router is established, a target UDP broadcast is sent, where the target UDP broadcast is a UDP broadcast carrying the identity information of the router.
[0088] Specifically, the identity information of the router carried by the target UDP broadcast includes SSID, BSSID, password or other identifiers.
[0089] In a specific implementation, after successfully connecting to a router, the mobile device will send a target UDP broadcast carrying the router's identity information to a specific broadcast address to inform other devices in the local area network of the existence or status of the router. The broadcast address represents all IoT devices in the local area network.
[0090] S720: If the IoT device does not monitor the target UDP broadcast within a preset period of time in the promiscuous mode, a communication connection is established with the IoT device based on the AP mode of the IoT device; the IoT device turns on the promiscuous mode and the AP mode at the same time.
[0091] In a specific implementation, if the IoT device is in promiscuous mode and fails to listen to the target UDP broadcast sent by the mobile device within a preset period of time, the mobile device will receive a prompt message, which is used to prompt the IoT device that the network configuration through the target UDP broadcast has failed and needs to be connected to the IoT device hotspot. Based on the prompt message, the mobile device establishes a communication connection with the IoT device in AP mode.
[0092] S730, sending a network configuration request message to the IoT device, so that the IoT device establishes a communication connection with the router in STA mode based on the network configuration request message; the network configuration request message includes the identity information of the router.
[0093] In a specific implementation, after the mobile device establishes a communication connection with the IoT device in AP mode, it sends a network configuration request message carrying the identity information of the router to the device that establishes the communication connection with the IoT device, so that the IoT device can implement network configuration based on the network configuration request message, that is, the IoT device can implement network configuration through the AP network configuration method.
[0094] The technical solution provided in this embodiment is that after the mobile device is connected to the router for communication, it sends a target UDP broadcast carrying the router's identity information. If the IoT device fails to configure the network based on the target UDP broadcast, the mobile device will receive a prompt message, and based on the prompt message, establish a communication connection with the IoT device in AP mode, and send a network configuration request message to the IoT device, so that the IoT device establishes a communication connection with the router based on the network configuration request message, thereby improving the success rate and efficiency of the IoT device's network configuration and enhancing the user experience.
[0095] Combination Figure 5 As shown, based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, after the mobile device is connected to the router for communication, after sending the target UDP broadcast, it also includes:
[0096] After the IoT device starts the configuration service, the address information of the IoT device is obtained. The address information includes the IP address, port number and configuration interface of the IoT device. The configuration service includes HTTP service.
[0097] Based on the address information, a configuration request message is sent to the IoT device, so that the IoT device modifies the communication configuration information based on the configuration request message.
[0098] In one possible implementation, Figure 5 As shown in the method 1, when the IoT device listens to the target UDP broadcast within the preset time period, and establishes a communication connection with the router by parsing the identity information of the router obtained by the target UDP broadcast, the IoT device and the mobile device are both connected to the same router LAN and can communicate through the HTTP service. After the IoT device starts the configuration service, the mobile device obtains the address information of the IoT device by returning the address information of the router when the IoT device configures the network based on the target UDP broadcast, or by sending a device discovery instruction to the IoT device to read the address information, and sends a configuration request message to the IoT device based on the obtained address information, wherein the address information includes the IP address, port number and configuration interface of the IoT device, and the communication configuration information includes the WiFi configuration information. Since the IoT device has completed the network configuration at this time, the configuration request message actually modifies the communication configuration information of the IoT device through the interface.
[0099] In another possible implementation, Figure 5As shown in the second method, when the IoT device does not monitor the target UDP broadcast within the preset time period, it establishes a communication connection with the mobile device through the AP mode. When the IoT device is configured in the AP mode, the mobile device and the IoT device are in the same local area network. When the IoT device is in AP mode, it is equivalent to a small router. The IoT device will have a fixed IP address, which is usually the IP set by the IoT device at the factory, and is used for communication in AP mode. The mobile device obtains the fixed IP address of the IoT device, as well as address information such as the port number and configuration interface, and sends a configuration request message to the IoT device through the address information, where the communication configuration information includes WiFi configuration information. Since the IoT device has not yet implemented network configuration at this time, the mobile device sending a configuration request message to the IoT device in AP mode is equivalent to the mobile device configuring the IoT device through the interface.
[0100] The technical solution provided in this embodiment realizes the modification of the communication configuration information of the IoT device when different network configuration methods are used to implement the network configuration of the IoT device, thereby improving the flexibility of modifying the communication configuration information of the IoT device.
[0101] Combination Figure 6 As shown in the method 1 in the above embodiment, based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, after the communication connection with the router is established, the target UDP broadcast is sent, including: after the communication connection with the router is established, the target UDP broadcast is sent through the first application. The method also includes:
[0102] If the IoT device is in promiscuous mode and monitors the target UDP broadcast within a preset period of time, a communication connection is established with the router based on the target UDP broadcast, and after joining the target multicast address, a communication connection is established with the router based on the second application;
[0103] Send a device discovery request message to the target multicast address through a router;
[0104] receiving device information sent by the IoT device based on the second application, where the device information includes an IP address of the IoT device;
[0105] According to the device information, the IoT device is added to the target device list through the second application.
[0106] In a specific implementation, the IoT device, in promiscuous mode, listens to the target UDP broadcast sent by the mobile device through the first application within a preset time period, and establishes a communication connection with the router based on the target UDP broadcast, and joins the target multicast address. At this time, the IoT device and the mobile device are both connected to the same router LAN, and the IoT device has been added to the device list of the first application. If the second application of the mobile device wants to add the IoT device to its own device list, that is, the target device list, the mobile device connects to the router through the second application, and sends a device discovery request message to the target multicast address through the router; receives the device information sent by the IoT device based on the second application; and then adds the IoT device to the target device list through the second application based on the device information.
[0107] The technical solution provided by this embodiment is that when the IoT device implements one-click network configuration based on the target UDP broadcast sent by the mobile device through the first application, the mobile device connects to the router through the second application, sends a device discovery request message to the target multicast address where the IoT device is located through the router, and receives the device information sent by the IoT device based on the second application; and according to the device information, the IoT device is added to the target device list through the second application, without the need to perform network configuration operations again, thereby improving the network configuration efficiency of the IoT device and enhancing the user experience.
[0108] Combination Figure 6 As shown in the second method in the above embodiment, based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, in this embodiment, sending a network configuration request message to the Internet of Things device includes: sending a network configuration request message to the Internet of Things device through a first application; after sending the network configuration request message to the Internet of Things device so that the Internet of Things device establishes a communication connection with the router in the STA mode based on the network configuration request message, it also includes:
[0109] Disconnecting the communication connection with the IoT device through the first application;
[0110] establishing a communication connection with the router based on the second application;
[0111] Send a device discovery request message to the target multicast address through the router. The target multicast address is the multicast address that the IoT device joins after establishing a communication connection with the router;
[0112] receiving device information sent by the IoT device based on the second application, where the device information includes an IP address of the IoT device;
[0113] According to the device information, the IoT device is added to the target device list through the second application.
[0114] In a specific implementation, when the IoT device is in promiscuous mode and does not monitor the target UDP broadcast sent by the mobile device within a preset period of time, the mobile device establishes a communication connection with the IoT device in AP mode through the first application, and then sends a network configuration request message to the IoT device through the first application. The IoT device establishes a communication connection with the router based on the network configuration request message, and adds the IoT device to the device list of the first application. At this time, the mobile device and the IoT device are in the same local area network. If the second application of the mobile device wants to add the IoT device to its own device list, that is, the target device list, it first disconnects the communication connection with the IoT device through the first application; establishes a communication connection with the router based on the second application; sends a device discovery request message to the target multicast address where the IoT device is located through the router; receives the device information sent by the IoT device based on the second application, and adds the IoT device to the target device list through the second application according to the device information.
[0115] The technical solution provided in this embodiment is that when the mobile device uses the AP network configuration method through the first application to implement network configuration of the IoT device, the communication connection with the IoT device is first disconnected through the first application; a communication connection is established with the router based on the second application; a device discovery request message is sent to the target multicast address where the IoT device is located through the router; device information sent by the IoT device is received based on the second application, and the IoT device is added to the target device list through the second application according to the device information, without the need to perform network configuration operations again, thereby improving the network configuration efficiency of the IoT device and enhancing the user experience.
[0116] Figure 8 A flow chart of another network configuration method provided in an embodiment of the present application, combined with Figure 8 As shown, based on the above embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, the method provided in this embodiment includes:
[0117] The mobile device establishes a communication connection with the router through the first application and sends a target UDP broadcast, where the target UDP broadcast is a UDP broadcast carrying the identity information of the router.
[0118] like Figure 8 As shown in the method 1, when the IoT device listens to the target UDP broadcast within the preset time period in the promiscuous mode, it establishes a communication connection with the router based on the target UDP broadcast and joins the target multicast address;
[0119] When establishing a communication connection with the router, the address information is returned to the first application through the router, and the configuration service is started at the same time; the mobile device sends a configuration request message to the IoT device through the first application based on the address information returned by the IoT device; the IoT device modifies the communication configuration information based on the configuration request message;
[0120] The mobile device establishes a communication connection with the router through the second application, and sends a device discovery request message to the target multicast address through the router; the IoT device responds to the device discovery request message and sends device information to the second application, and the mobile device adds the IoT device to the target device list through the second application based on the device information.
[0121] like Figure 8 As shown in the second method, when the IoT device is in promiscuous mode and fails to monitor the target UDP broadcast within a preset period of time, the first application of the mobile device displays a prompt message, prompting to establish a communication connection with the IoT device in AP mode; the mobile device connects to the IoT device hotspot through the first application based on the prompt message, and sends a network configuration request message carrying the identity information of the router to the IoT device. Based on the network configuration request message, the IoT device establishes a communication connection with the router in STA mode and joins the target multicast address;
[0122] The IoT device starts the configuration service, the mobile device obtains the address information of the IoT device through the first application, the address information includes the fixed IP address of the IoT device, as well as the port number and the configuration interface, and sends a configuration request message to the IoT device based on the address information, and the IoT device modifies the communication configuration information based on the configuration request message;
[0123] The mobile device disconnects the communication connection with the IoT device through the first application, establishes a communication connection with the router based on the second application, and sends a device discovery request message to the target multicast address through the router. The IoT device responds to the device discovery request message and sends device information to the mobile device. The device information includes the IP address of the IoT device. The mobile device adds the IoT device to the target device list through the second application based on the device information.
[0124] The technical solution provided in this embodiment improves the success rate of IoT device network configuration, and no matter what network configuration method the IoT device uses to achieve network configuration, it can modify the communication configuration information and add the IoT device to the target device list, thereby improving the flexibility of operation and enhancing the user experience.
[0125] Fig. 9 This is a structural block diagram of a network distribution device provided in one embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown. Fig. 9The network configuration device 900 is applied to IoT devices, and the network configuration device 900 may include a monitoring module 901, a connection module 902, a receiving module 903 and a network configuration module 904.
[0126] A monitoring module 901 is used to monitor UDP broadcast in promiscuous mode;
[0127] The connection module 902 is used to establish a communication connection with the mobile device through the AP mode when the target UDP broadcast is not monitored within a preset period of time, and the target UDP broadcast is a UDP broadcast carrying the identity information of the router;
[0128] The receiving module 903 is used to receive a network configuration request message sent by a mobile device, where the network configuration request message includes the identity information of the router;
[0129] The network configuration module 904 is used to establish a communication connection with the router in the STA mode based on the network configuration request message.
[0130] A network distribution device provided in an embodiment of the present application has the same beneficial effects as the above-mentioned network distribution method.
[0131] In one embodiment, the network distribution device 900 further includes:
[0132] The configuration service startup module is used to start the configuration service, which includes the HTTP service;
[0133] A first message receiving module is used to receive a configuration request message sent by the mobile device based on the HTTP service after the mobile device obtains the address information of the IoT device; the address information includes the IP address, port number and configuration interface of the IoT device;
[0134] The configuration information modification module is used to modify the communication configuration information based on the configuration request message.
[0135] In one embodiment, the network distribution device 900 further includes:
[0136] Multicast address joining module, used to join the target multicast address;
[0137] A second message receiving module, configured to receive a device discovery request message sent by a mobile device through a router based on a target multicast address;
[0138] The device information sending module is used to send device information to the mobile device in response to the device discovery request message, so that the mobile device adds the Internet of Things device to the target device list based on the device information; the device information includes the IP address of the Internet of Things device.
[0139] Fig.10This is a structural block diagram of another network distribution device provided in one embodiment of the present application. For the sake of convenience, only the part related to the embodiment of the present application is shown. Fig.10 The network configuration device 1000 is applied to a mobile device, and the network configuration device 1000 may include a first sending module 1001 , a connecting module 1002 , and a second sending module 1003 .
[0140] The first sending module 1001 is used to send a target UDP broadcast after communicating with the router, where the target UDP broadcast is a UDP broadcast carrying the identity information of the router;
[0141] The connection module 1002 is used to establish a communication connection with the IoT device based on the AP mode of the IoT device if the IoT device does not monitor the target UDP broadcast within a preset period of time in the promiscuous mode; the IoT device turns on the promiscuous mode and the AP mode at the same time;
[0142] The second sending module 1003 is used to send a network configuration request message to the IoT device, so that the IoT device establishes a communication connection with the router in the STA mode based on the network configuration request message; the network configuration request message includes the identity information of the router.
[0143] A network distribution device provided in an embodiment of the present application has the same beneficial effects as the above-mentioned network distribution method.
[0144] In one embodiment, the network distribution device 1000 further includes:
[0145] The address information acquisition module is used to obtain the address information of the IoT device after the IoT device starts the configuration service. The address information includes the IP address, port number and configuration interface of the IoT device. The configuration service includes HTTP service;
[0146] The third sending module is used to send a configuration request message to the Internet of Things device based on the address information, so that the Internet of Things device modifies the communication configuration information based on the configuration request message.
[0147] In one embodiment, the first sending module 1001 includes:
[0148] A first sending submodule, used for sending a target UDP broadcast through a first application after communication with the router is established;
[0149] The network distribution device 1000 further includes:
[0150] The first communication connection module is used for, if the IoT device is in promiscuous mode, to monitor the target UDP broadcast within a preset period of time, to establish a communication connection with the router based on the target UDP broadcast, and to establish a communication connection with the router based on the second application after adding the target multicast address;
[0151] A fourth sending module, used for sending a device discovery request message to a target multicast address through a router;
[0152] A first receiving module, configured to receive device information sent by the IoT device based on the second application, where the device information includes an IP address of the IoT device;
[0153] The first device adding module is used to add the Internet of Things device to the target device list through the second application according to the device information.
[0154] In one embodiment, the second sending module 1003 includes:
[0155] A second sending submodule, used to send a network configuration request message to the Internet of Things device through the first application;
[0156] The network distribution device 1000 further includes:
[0157] A communication connection disconnection module, used to disconnect the communication connection with the IoT device through the first application;
[0158] A second communication connection module, used to establish a communication connection with the router based on the second application;
[0159] A fifth sending module, used to send a device discovery request message to a target multicast address through a router, where the target multicast address is a multicast address that the IoT device joins after establishing a communication connection with the router;
[0160] A second receiving module, configured to receive device information sent by the IoT device based on a second application, where the device information includes an IP address of the IoT device;
[0161] The second device adding module is used to add the Internet of Things device to the target device list through the second application according to the device information.
[0162] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0163] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0164] Fig.11 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Fig.11 As shown, the electronic device 11 of this embodiment includes: at least one processor 110 ( Fig.11 Only one is shown in the figure), a memory 111, and a computer program 112 stored in the memory 111 and executable on at least one processor 110, the processor 110 executes the computer program 112 to implement the above Figure 4 , Figure 5 , Figure 6 , Figure 7 or Figure 8 The steps in the method embodiment, or the implementation of the above Fig. 9 or Fig.10 Functions of each module / unit in the device embodiment.
[0165] As an example, the electronic device 11 may be Figure 3 The IoT device 310 or the mobile device 320 in the embodiment. The electronic device 11 may include but is not limited to a processor 110 and a memory 111. It can be understood by those skilled in the art that Fig.11 It is only an example of the electronic device 11 and does not constitute a limitation on the electronic device 11. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0166] The processor 110 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0167] In some embodiments, the memory 111 may be an internal storage unit of the electronic device 11, such as a hard disk or memory of the electronic device 11. In other embodiments, the memory 111 may also be an external storage device of the electronic device 11, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 11. Further, the memory 111 may also include both an internal storage unit of the electronic device 11 and an external storage device. The memory 111 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of a computer program. The memory 111 may also be used to temporarily store data that has been output or is to be output.
[0168] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0169] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include at least: any entity or device capable of carrying the computer program code to an electronic device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0170] A computer-readable storage medium provided in an embodiment of the present application has the same beneficial effects as the above-mentioned network distribution method.
[0171] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0172] A computer program product provided in an embodiment of the present application has the same beneficial effects as the above-mentioned network distribution method.
[0173] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0174] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0175] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0176] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0177] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A network distribution method, characterized in that: Applied to an Internet of Things device, the Internet of Things device simultaneously turns on the promiscuous mode and the AP mode, and the method includes: Listen to UDP broadcasts in said promiscuous mode; When the target UDP broadcast is not monitored within the preset period, a communication connection is established with the mobile device through the AP mode, wherein the target UDP broadcast is a UDP broadcast carrying the identity information of the router; Receiving a network configuration request message sent by the mobile device, wherein the network configuration request message includes identity information of the router; Based on the network configuration request message, a communication connection is established with the router in STA mode.
2. The method according to claim 1, characterized in that After monitoring the UDP broadcast in the promiscuous mode, the method further includes: Enable configuration services, including HTTP services; After the mobile device obtains the address information of the IoT device, a configuration request message sent by the mobile device is received based on the HTTP service; the address information includes the IP address, port number and configuration interface of the IoT device; The communication configuration information is modified based on the configuration request message.
3. The method according to claim 1, characterized in that After establishing a communication connection with the router in STA mode based on the network configuration request message, the method further includes: Join the target multicast address; receiving a device discovery request message sent by the mobile device through the router based on the target multicast address; In response to the device discovery request message, device information is sent to the mobile device so that the mobile device adds the IoT device to a target device list based on the device information; the device information includes an IP address of the IoT device.
4. A network distribution method, characterized in that: Applied to a mobile device, the method comprises: After the communication connection with the router is established, a target UDP broadcast is sent, wherein the target UDP broadcast is a UDP broadcast carrying the identity information of the router; If the IoT device does not monitor the target UDP broadcast within a preset period of time in the promiscuous mode, a communication connection is established with the IoT device based on the AP mode of the IoT device; the IoT device turns on the promiscuous mode and the AP mode at the same time; A network configuration request message is sent to the IoT device, so that the IoT device establishes a communication connection with the router in STA mode based on the network configuration request message; the network configuration request message includes the identity information of the router.
5. The method according to claim 4, characterized in that After the communication connection with the router is established, after sending the target UDP broadcast, the method further comprises: After the IoT device starts the configuration service, the address information of the IoT device is obtained, the address information includes the IP address, port number and configuration interface of the IoT device, and the configuration service includes HTTP service; Based on the address information, a configuration request message is sent to the Internet of Things device, so that the Internet of Things device modifies communication configuration information based on the configuration request message.
6. The method according to claim 4, characterized in that After the communication connection with the router is established, the target UDP broadcast is sent, including: After establishing a communication connection with the router, sending the target UDP broadcast through the first application; The method further comprises: If the IoT device is in promiscuous mode and monitors the target UDP broadcast within the preset time period, a communication connection is established with the router based on the target UDP broadcast, and after joining the target multicast address, a communication connection is established with the router based on the second application; Sending a device discovery request message to a target multicast address through the router; Receive device information sent by the IoT device based on the second application, where the device information includes an IP address of the IoT device; According to the device information, the IoT device is added to a target device list through the second application.
7. The method according to claim 4, characterized in that The sending a network configuration request message to the IoT device includes: Sending a network configuration request message to the IoT device through a first application; After sending the network configuration request message to the IoT device so that the IoT device establishes a communication connection with the router in the STA mode based on the network configuration request message, the method further includes: Disconnecting the communication connection with the IoT device through the first application; Establishing a communication connection with the router based on a second application; Sending a device discovery request message to a target multicast address through the router, where the target multicast address is a multicast address that the IoT device joins after establishing a communication connection with the router; Receive device information sent by the IoT device based on the second application, where the device information includes an IP address of the IoT device; According to the device information, the IoT device is added to a target device list through the second application.
8. A network distribution device, characterized in that: Applied to an Internet of Things device, the Internet of Things device simultaneously turns on the promiscuous mode and the AP mode, and the device includes: A monitoring module, used for monitoring UDP broadcast in the promiscuous mode; A connection module, configured to establish a communication connection with a mobile device through the AP mode when a target UDP broadcast is not monitored within a preset period of time, wherein the target UDP broadcast is a UDP broadcast carrying the identity information of the router; A receiving module, configured to receive a network configuration request message sent by the mobile device, wherein the network configuration request message includes the identity information of the router; The network configuration module is used to establish a communication connection with the router in STA mode based on the network configuration request message.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 3 or 4 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 3 or 4 to 7 is implemented.