A method and system for automatically connecting multiple devices in a local area network
After the device is powered on, the Internet of Things platform analyzes and replys to the registration address. The device automatically initiates the registration application, which solves the problem of time-consuming manual configuration of the registration address in the existing technology, realizes automatic connection of the device, and reduces the workload of staff.
Patent Information
- Application Number
- CN202411729441.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-04
AI Technical Summary
In the prior art, the automatic connection method of multiple devices under the LAN requires manual configuration of the registered address, which leads to a large workload of staff and repeated configurations when adding new equipment, which causes inconvenience to staff.
After powering on the device, the Internet of Things platform will subscribe and analyze the broadcast packet, reply to the device registration address, and the device initiates a registration application based on the registration address, realizing automatic connection.
The device can be automatically connected to the IoT platform by powering on, reducing the workload of staff and improving the efficiency and convenience of device connection.
Smart Images

Figure CN119767255A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of Internet of Things, and more specifically, relates to a method and system for automatically connecting multiple devices in a local area network. Background Art
[0002] With the development of the Internet of Things, there will be multiple devices under a local area network, and new devices will continue to be added. The existing connection method is to manually configure the platform's registration address on the device side before the device side can initiate a connection. Manually configuring multiple devices will consume a lot of work. Each new device needs to be configured before it can be connected to the platform, which brings inconvenience to the staff. Summary of the invention
[0003] The main purpose of the present invention is to provide a method and system for automatically connecting multiple devices in a local area network, aiming to enable the devices to automatically connect to the Internet of Things platform when powered on, thereby reducing the workload of staff.
[0004] According to a first aspect of the present invention, there is provided a method for automatically connecting multiple devices in a local area network, comprising the following steps:
[0005] Step 1: After the device is powered on, it continuously sends broadcast packets to the network segment where it is located;
[0006] Step 2: The IoT platform subscribes to the broadcast and obtains the broadcast packet for parsing;
[0007] Step 3: The IoT platform replies the information packet with the device registration address to the device;
[0008] Step 4: The device parses the information packet and obtains the device registration address;
[0009] Step 5: The device reads the device registration address to initiate a device registration application and connect to the IoT platform.
[0010] In the above-mentioned method for automatically connecting multiple devices in a local area network, in step 1, the content of the broadcast packet includes the model of the device and the SN code of the device, and the structure of the broadcast packet conforms to the first preset rule;
[0011] In step 2, after obtaining the content of the broadcast packet, determine whether the structure of the broadcast packet meets the first preset rule. If it does not meet the first preset rule, directly discard the broadcast packet without processing; if it meets the first preset rule, proceed to the next step.
[0012] In the above-mentioned method for automatically connecting multiple devices in a local area network, in step 1, the broadcast packet is encrypted;
[0013] In step 2, the IoT platform decrypts the broadcast packet to obtain the content of the broadcast packet.
[0014] In the above-mentioned method for automatic connection of multiple devices in a local area network, in step 1, the broadcast packet is symmetric encrypted by AES / ECB / PKCS5PADDING and encrypted by Base64.
[0015] In the above-mentioned LAN multi-device automatic connection method, in step 3, the Internet of Things platform combines the pre-configured device registration address and the content of the broadcast packet into an information packet, encrypts the information packet, and then replies the information packet to the device through the broadcast address of the broadcast packet.
[0016] In the above-mentioned method for automatically connecting multiple devices in a local area network, in step 3, the structure of the information packet complies with the second preset rule;
[0017] In step 4, after receiving the information packet, the device decrypts it to obtain the content of the information packet, and then makes the first judgment;
[0018] The first step of judging is to judge whether the structure of the information packet meets the second preset rule. If the structure of the information packet does not meet the second preset rule, the information packet is judged invalid and will not be processed further; if the structure of the information packet meets the second preset rule, the second step of judging is performed;
[0019] The second step is to determine whether the device SN is the SN code of this device. If the device SN of the information packet is not the SN code of this device, the information packet is determined to be invalid and no further processing is performed; if the device SN of the information packet is the SN code of this device, the information packet is determined to be valid and the device registration address is written into the environment variable.
[0020] According to a second aspect of the present invention, there is provided a local area network multi-device automatic connection system, comprising an Internet of Things platform and a device, wherein the device has a broadcast unit, a processing unit and a registration unit, and the Internet of Things platform has a subscription unit and a feedback unit;
[0021] The broadcast unit continuously sends broadcast packets to the network segment where the broadcast unit is located;
[0022] The subscription unit subscribes to the broadcast, obtains the broadcast packet and performs parsing;
[0023] The feedback unit replies the information packet with the device registration address to the device;
[0024] The processing unit parses the information packet to obtain the device registration address;
[0025] The registration unit reads the device registration address to initiate a device registration application and connects to the Internet of Things platform.
[0026] In the above-mentioned LAN multi-device automatic connection system, the content of the broadcast packet includes the model of the device and the SN code of the device, and the structure of the broadcast packet complies with the first preset rule;
[0027] After obtaining the content of the broadcast packet, the subscription unit determines whether the structure of the broadcast packet meets the first preset rule. If it does not meet the first preset rule, the broadcast packet is directly discarded without processing; if it meets the first preset rule, the content of the broadcast packet is sent to the feedback unit.
[0028] In the above-mentioned LAN multi-device automatic connection system, the feedback unit combines the pre-configured device registration address and the content of the broadcast packet into an information packet, encrypts the information packet, and then replies the information packet to the device through the broadcast address of the broadcast packet.
[0029] In the above-mentioned LAN multi-device automatic connection system, the structure of the information packet complies with the second preset rule;
[0030] After receiving the information packet, the processing unit decrypts the information packet to obtain the content of the information packet, and then performs the first step of determination;
[0031] The first step of judging is to judge whether the structure of the information packet meets the second preset rule. If the structure of the information packet does not meet the second preset rule, the information packet is judged invalid and will not be processed further; if the structure of the information packet meets the second preset rule, the second step of judging is performed;
[0032] The second step is to determine whether the device SN is the SN code of this device. If the device SN of the information packet is not the SN code of this device, the information packet is determined to be invalid and no further processing is performed; if the device SN of the information packet is the SN code of this device, the information packet is determined to be valid and the device registration address is written into the environment variable.
[0033] One of the above technical solutions of the present invention has at least one of the following advantages or beneficial effects:
[0034] In the present invention, after the device is powered on, it initiates a broadcast packet to the corresponding network segment, the Internet of Things platform subscribes to the broadcast, and the Internet of Things platform obtains the broadcast packet and parses it, and then replies the registration address to the device. The device can then initiate device registration according to the registration address and complete automatic connection. In this way, the device can automatically connect to the Internet of Things platform as long as it is powered on, without manual configuration, reducing the workload of staff. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The present invention is further described below in conjunction with the accompanying drawings and embodiments;
[0036] Figure 1 It is a flow chart of the method for automatically connecting multiple devices in a local area network of the present invention;
[0037] Figure 2 It is a schematic diagram of the local area network multi-device automatic connection system of the present invention. DETAILED DESCRIPTION
[0038] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0039] With the development of the Internet of Things, there will be multiple devices under a local area network, and new devices will continue to be added. The existing connection method is to manually configure the platform's registration address on the device side before the device side can initiate a connection. Manually configuring multiple devices will consume a lot of work. Each new device needs to be configured before it can be connected to the platform, which brings inconvenience to the staff.
[0040] The present application provides a method for automatically connecting multiple devices in a local area network. After the device is powered on, it initiates a broadcast packet to the corresponding network segment. The Internet of Things platform subscribes to the broadcast. After obtaining the broadcast packet, the Internet of Things platform parses it and then replies the registration address to the device. The device can then initiate device registration according to the registration address and complete automatic connection. In this way, the device can automatically connect to the Internet of Things platform as long as it is powered on, reducing the workload of the staff.
[0041] Reference Figure 1 As shown, a method for automatically connecting multiple devices in a local area network includes the following steps:
[0042] Step 1: After the device is powered on, it continuously sends broadcast packets to the network segment where it is located;
[0043] The content of the broadcast packet includes the device model and the device SN code, and the structure of the broadcast packet must comply with the first preset rule. For example, the structure of the broadcast packet must be [Q; device model; device SN];
[0044] At the same time, in order to enhance security, the broadcast packets need to be encrypted;
[0045] Preferably, the broadcast packet is encrypted by double encryption. Specifically, the broadcast packet is firstly encrypted by AES / ECB / PKCS5PADDING symmetric encryption with a key length of 128 bits, and then encrypted by Base64.
[0046] In addition, broadcast packets need to be divided into bytes, limited to 1024 bytes.
[0047] Step 2: The IoT platform subscribes to the broadcast and obtains the broadcast packet for parsing;
[0048] The IoT platform and the device are in the same LAN and the same IP network segment, and the broadcast port in the network segment is not occupied by other IPs;
[0049] After the IoT platform obtains the broadcast packet, it first unpacks the broadcast packet according to 1024 bytes, and then decrypts the broadcast packet, first using Base64 decryption, and then using the AES symmetric algorithm to decrypt the broadcast packet to obtain the content of the broadcast packet;
[0050] Then, it is determined whether the structure of the broadcast packet complies with the first preset rule. If it does not comply with the first preset rule, the broadcast packet is directly discarded without processing; if it complies with the first preset rule, the next step is performed.
[0051] Step 3: The IoT platform replies the information packet with the device registration address to the device;
[0052] After determining that the structure of the broadcast packet meets the first preset rule, the broadcast packet is determined to be valid, the pre-configured device registration address and the content of the broadcast packet are combined into an information packet, which is encrypted and then replied to the device through the broadcast address of the broadcast packet;
[0053] The structure of the information packet must comply with the second preset rule. For example, the structure of the information packet is [A; device model; device SN; registration address];
[0054] The encryption of information packets is similar to that of broadcast packets, both of which use double encryption.
[0055] Step 4: The device parses the information packet and obtains the device registration address;
[0056] Specifically, after receiving the information packet, the device decrypts it. The decryption method of the information packet is similar to that of the broadcast packet. After decryption, the content of the information packet is obtained and the first step of judgment is performed;
[0057] The first step of judging is to judge whether the structure of the information packet meets the second preset rule. If the structure of the information packet does not meet the second preset rule, the information packet is judged invalid and will not be processed further; if the structure of the information packet meets the second preset rule, the second step of judging is performed;
[0058] The second step is to determine whether the device SN is the SN code of the device. If the device SN of the information packet is not the SN code of the device, the information packet is determined to be invalid and no further processing is performed. If the device SN of the information packet is the SN code of the device, the information packet is determined to be valid and the device registration address is written into the environment variable.
[0059] Step 5: The device reads the device registration address to initiate a device registration application and connect to the IoT platform.
[0060] Reference Figure 2As shown, according to a second aspect of the present invention, a local area network multi-device automatic connection system is provided, comprising an Internet of Things platform 1 and a device 2, the device 2 having a broadcast unit 21, a processing unit 22 and a registration unit 23, and the Internet of Things platform 1 having a subscription unit 11 and a feedback unit 12;
[0061] After the device 2 is powered on, the broadcast unit 21 continuously sends broadcast packets to the network segment where the device 2 is located; the content of the broadcast packet includes the model of the device 2 and the SN code of the device 2, and the structure of the broadcast packet complies with the first preset rule; at the same time, in order to enhance security, the broadcast packet needs to be encrypted;
[0062] Preferably, the broadcast packet is encrypted by double encryption. Specifically, the broadcast packet is firstly encrypted by AES / ECB / PKCS5PADDING symmetric encryption with a key length of 128 bits, and then encrypted by Base64.
[0063] In addition, broadcast packets need to be divided into bytes, limited to 1024 bytes.
[0064] The subscription unit 11 subscribes to the broadcast, obtains the broadcast packet and parses it;
[0065] IoT platform 1 and device 2 are in the same LAN and the same IP network segment. The broadcast port in the network segment is not occupied by other IPs.
[0066] After IoT platform 1 obtains the broadcast packet, it first unpacks the broadcast packet according to 1024 bytes, and then decrypts the broadcast packet, first using Base64 decryption, and then using the AES symmetric algorithm to decrypt the broadcast packet to obtain the content of the broadcast packet;
[0067] Then, it is determined whether the structure of the broadcast packet complies with the first preset rule. If it does not comply with the first preset rule, the broadcast packet is directly discarded without processing; if it complies with the first preset rule, the content of the broadcast packet is sent to the feedback unit 12.
[0068] The feedback unit 12 replies the information packet with the device registration address to the device 2;
[0069] Specifically, the feedback unit 12 combines the pre-configured device registration address and the content of the broadcast packet into an information packet, encrypts the information packet, and then replies the information packet to the device 2 via the broadcast address of the broadcast packet;
[0070] The structure of the information packet complies with the second preset rule.
[0071] The processing unit 22 parses the information packet to obtain the device registration address;
[0072] After receiving the information packet, the processing unit 22 decrypts the information packet to obtain the content of the information packet, and then performs the first step of determination;
[0073] The first step of judging is to judge whether the structure of the information packet meets the second preset rule. If the structure of the information packet does not meet the second preset rule, the information packet is judged invalid and will not be processed further; if the structure of the information packet meets the second preset rule, the second step of judging is performed;
[0074] The second step is to determine whether the device SN is the SN code of device 2. If the device SN of the information packet is not the SN code of device 2, the information packet is determined to be invalid and no further processing is performed; if the device SN of the information packet is the SN code of device 2, the information packet is determined to be valid and the device registration address is written into the environment variable.
[0075] The registration unit 23 reads the device registration address to initiate a registration application for the device 2 and connects to the Internet of Things platform 1.
[0076] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for automatically connecting multiple devices in a local area network, characterized in that: The following steps are involved: Step 1: After the device is powered on, it continuously sends broadcast packets to the network segment where it is located; Step 2: The IoT platform subscribes to the broadcast and obtains the broadcast packet for parsing; Step 3: The IoT platform replies the information packet with the device registration address to the device; Step 4: The device parses the information packet and obtains the device registration address; Step 5: The device reads the device registration address to initiate a device registration application and connect to the IoT platform.
2. The method for automatically connecting multiple devices in a local area network according to claim 1, characterized in that: In step 1, the content of the broadcast packet includes the model of the device and the SN code of the device, and the structure of the broadcast packet complies with the first preset rule; In step 2, after obtaining the content of the broadcast packet, determine whether the structure of the broadcast packet meets the first preset rule. If it does not meet the first preset rule, directly discard the broadcast packet without processing; if it meets the first preset rule, proceed to the next step.
3. The method for automatically connecting multiple devices in a local area network according to claim 1, characterized in that: In step 1, the broadcast packet is encrypted; In step 2, the IoT platform decrypts the broadcast packet to obtain the content of the broadcast packet.
4. The method for automatically connecting multiple devices in a local area network according to claim 3, characterized in that: In step 1, the broadcast packet is symmetrically encrypted using AES / ECB / PKCS5PADDING and encrypted using Base64.
5. The method for automatically connecting multiple devices in a local area network according to claim 2, characterized in that: In step 3, the IoT platform combines the pre-configured device registration address and the content of the broadcast packet into an information packet, encrypts the information packet, and then replies the information packet to the device through the broadcast address of the broadcast packet.
6. The method for automatically connecting multiple devices in a local area network according to claim 5, characterized in that: In step 3, the structure of the information packet complies with a second preset rule; In step 4, after receiving the information packet, the device decrypts it to obtain the content of the information packet, and then makes the first judgment; The first step of judging is to judge whether the structure of the information packet meets the second preset rule. If the structure of the information packet does not meet the second preset rule, the information packet is judged invalid and will not be processed further; if the structure of the information packet meets the second preset rule, the second step of judging is performed; The second step is to determine whether the device SN is the SN code of this device. If the device SN of the information packet is not the SN code of this device, the information packet is determined to be invalid and no further processing is performed; if the device SN of the information packet is the SN code of this device, the information packet is determined to be valid and the device registration address is written into the environment variable.
7. A local area network multi-device automatic connection system, characterized in that: It includes an Internet of Things platform and a device, wherein the device has a broadcast unit, a processing unit and a registration unit, and the Internet of Things platform has a subscription unit and a feedback unit; The broadcast unit continuously sends broadcast packets to the network segment where the broadcast unit is located; The subscription unit subscribes to the broadcast, obtains the broadcast packet and performs parsing; The feedback unit replies the information packet with the device registration address to the device; The processing unit parses the information packet to obtain the device registration address; The registration unit reads the device registration address to initiate a device registration application and connects to the Internet of Things platform.
8. The LAN multi-device automatic connection system according to claim 7, characterized in that: The content of the broadcast packet includes the model of the device and the SN code of the device, and the structure of the broadcast packet complies with the first preset rule; After obtaining the content of the broadcast packet, the subscription unit determines whether the structure of the broadcast packet meets the first preset rule. If it does not meet the first preset rule, the broadcast packet is directly discarded without processing; if it meets the first preset rule, the content of the broadcast packet is sent to the feedback unit.
9. The LAN multi-device automatic connection system according to claim 8, characterized in that: The feedback unit combines the pre-configured device registration address and the content of the broadcast packet into an information packet, encrypts the information packet, and then replies the information packet to the device through the broadcast address of the broadcast packet.
10. The LAN multi-device automatic connection system according to claim 9, characterized in that: The structure of the information packet complies with a second preset rule; After receiving the information packet, the processing unit decrypts the information packet to obtain the content of the information packet, and then performs the first step of determination; The first step of judging is to judge whether the structure of the information packet meets the second preset rule. If the structure of the information packet does not meet the second preset rule, the information packet is judged invalid and will not be processed further; if the structure of the information packet meets the second preset rule, the second step of judging is performed; The second step is to determine whether the device SN is the SN code of this device. If the device SN of the information packet is not the SN code of this device, the information packet is determined to be invalid and no further processing is performed; if the device SN of the information packet is the SN code of this device, the information packet is determined to be valid and the device registration address is written into the environment variable.