Device networking method, system and computer program product

The device networking method designed through peer-to-peer devices solves the problem of fixed master-slave architecture in the existing technology, realizes flexible switching and plug-and-play of devices, and improves the flexibility and scalability of the system.

CN120675873AActive Publication Date: 2025-09-19JIANGSU CARBON TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510970727.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-15
Publication Date
2025-09-19
Estimated Expiration
2045-07-15

AI Technical Summary

Technical Problem

In existing device networking technologies, the fixed master-slave architecture results in poor system flexibility and difficulty adapting to different application scenarios. Reconfiguration is required when expanding devices, and host failures affect system stability and fault tolerance.

Method used

It adopts peer-to-peer device design and realizes automatic detection and information exchange between nodes through extended interfaces, allowing devices to flexibly switch to host or slave, forming a tree network and realizing plug-and-play.

Benefits of technology

It improves the flexibility and adaptability of system configuration, supports networking requirements in diverse scenarios, simplifies the system expansion process, and enhances the practicality and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675873A_ABST
    Figure CN120675873A_ABST
Patent Text Reader

Abstract

The invention discloses a device networking method and system and a computer program product, and belongs to the technical field of networking, and the method comprises the steps: setting each device in the system to comprise an external power supply input port and a plurality of expansion interfaces; a device connected with a system power supply is used as a root node of the network; whether nodes are added or not is detected through a physical layer of the expansion interface, and basic information of the nodes is obtained through a network layer. And judging whether the unadded node is identified in other networks, if so, selecting a network as a subsequent network according to the maximum support layer number of the root node, the network layer number or the current node layer number, switching the network relationship and then taking the network as a lower layer node of the added node, and applying for adding to the root node until only one network exists in the system. According to the plug-and-play networking system, the single devices can work independently, tree systems of different scales can be formed through the contact points, networking requirements in diversified scenes are met, construction is simple, and the flexibility and expansibility of the system are effectively enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of networking technology, and in particular to a device networking method, system, and computer program product. Background Art

[0002] In existing device networking technologies, most systems utilize a fixed master-slave architecture. Once the master and slave roles are determined, they are difficult to change. This makes the system inflexible when adapting to different application scenarios. Adjusting the system structure or expanding the number of devices often requires reconfiguring the entire system, which is complex and inefficient, and unable to meet rapidly changing needs. With this fixed architecture, if the master fails, the entire system may be paralyzed, and the slaves cannot temporarily assume the master function to maintain system operation, significantly affecting the system's stability and fault tolerance. Summary of the Invention

[0003] The present application aims to provide a device networking method, system and computer program product that can meet different application scenarios.

[0004] To achieve the above objectives, the technical solution of this application is:

[0005] A device networking method, comprising:

[0006] Step S1: Set up each device in the system, including an external power input port and multiple expansion interfaces; power on the system, and the device that inputs external power serves as the root node of a network, and the remaining devices serve as nodes in the system;

[0007] Step S2: The joined nodes in each network detect the connected non-joined nodes through the physical layer of the extended interface and obtain basic information of the non-joined nodes through the network layer of the extended interface;

[0008] Step S3: Determine whether the unjoined node is identified in other networks. If so, proceed to step S4; if not, proceed to step S7;

[0009] Step S4: Determine whether the non-joined node should switch network relationships based on the maximum number of layers supported by the root node, the number of network layers, or the number of layers of the current node; if so, proceed to step S6; if not, proceed to step S5;

[0010] Step S5: The joined nodes are treated as non-joined nodes in other networks, and the process returns to step S2;

[0011] Step S6: The non-joined node switches its network relationship to the current network and becomes a lower-layer node of the joined node of the current network;

[0012] Step S7: the joined node applies to the root node for joining the non-joined node, synchronizes the root node's allocation information to the non-joined node, and the non-joined node joins the network, and returns to step S2 until there is only one network in the system.

[0013] Optionally, the expansion interface includes contact points: power +, power - and communication pins; the physical layer of the expansion interface detects the docked non-joined nodes, including: actively pulling down the communication pins of the idle expansion interface at random intervals, and the physical layer detects that the level of the communication pin is pulled down outside the time of active pulling down, and determines that there is a non-joined node connected, otherwise there is no non-joined node connected.

[0014] Optionally, the network layer of the expansion interface uses a half-duplex single-line universal asynchronous receiver and transmitter for communication. Information transmission in a network can only be carried out between two directly connected nodes. Before the node joins the current network, the power supply is only used for communication when docking through the expansion interface.

[0015] Optionally, the communication between two directly connected nodes includes:

[0016] Normally, the upper node sends information to the lower node, and the lower node responds to the upper node before the timeout.

[0017] Information loss: The upper node sends information to the lower node, but the lower node does not respond before the timeout. The upper node resends the information to the lower node, and the lower node responds to the upper node before the timeout.

[0018] Node removal situation: The upper node sends information to the lower node, and the lower node does not respond before the timeout period. After repeated multiple times, the lower node still does not respond before the timeout period, and the node is judged to be removed.

[0019] Optionally, the node address encoding uses bytes as addressing units, with one byte addressing one node; during addressing, the addressing content of the intermediate node is not transmitted to the lower-layer node;

[0020] Data packets are used to transmit information during communication. Data packets include actively sent data packets and response data packets. The sending commands of the actively sent data packets include: obtaining node information, allocating node system settings, synchronizing time, obtaining node status information, setting commands and switching network relationships; the response commands of the response data packets include: node information, node time information, node status information and switching network responses.

[0021] Optionally, the time synchronization process includes:

[0022] The upper network triggers the recording of network time units and sends it to the upper node;

[0023] The upper node calculates the initial value of the calibration time difference transmitted from the upper node to the lower node, and sends the synchronization time data packet containing the initial value of the time difference to the lower node via the universal asynchronous receiver transmitter;

[0024] The UART of the lower node receives the synchronization time data packet;

[0025] The lower-layer network triggers the recording of the number of network time units and sends it to the lower-layer nodes. The actual value of the calibration time difference is calculated in real time to achieve time difference calibration.

[0026] Optionally, whether the network relationship of the unjoined nodes is switched is determined based on the maximum number of layers supported by the root node, the number of network layers or the number of layers of the current node, including: selecting the network with the larger maximum number of layers supported by the root node of the two networks as the subsequent network, and not joining the node switching network relationship; if the maximum number of layers supported by the root nodes in the two networks is the same, selecting the network with the larger number of network layers of the two networks as the subsequent network, and not joining the node switching network relationship; if the maximum number of layers supported by the root nodes and the number of network layers in the two networks are the same, selecting the network with the larger number of layers of the current node as the subsequent network, and not joining the node switching network relationship; if the above conditions are all consistent, selecting the network with the joined nodes as the subsequent network, and not joining the node switching network relationship.

[0027] Optionally, the process of switching the network relationship includes:

[0028] The joined node sends a command to obtain node information to the non-joined node, and the non-joined node responds with node information indicating that it is in another network;

[0029] The joined node sends a switch network relationship command to the non-joined node, and the non-joined node responds with a switch wait;

[0030] The upper layer node of the non-joined node synchronizes time with the non-joined node. The joined node sends a network switching command to the non-joined node again. The non-joined node determines the network switching relationship and responds with a switch agreement.

[0031] The joined node sends a command to obtain node status information to the unjoined node, and the unjoined node responds that it is switching.

[0032] The non-joined node sends a command to the upper node to switch network relationship, and the upper node responds with a switch agreement;

[0033] The non-joined node sends a command to obtain node information to the upper node, and the upper node responds that the handover is complete.

[0034] The joined node sends a command to obtain node status information to the non-joined node, and the non-joined node responds that the handover is complete.

[0035] The joined node sends a get node information command to the unjoined node, and the unjoined node responds by updating the node list.

[0036] A device networking system for executing the device networking method as described in any one of the above, the device networking system comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the device networking method as described in any one of the above.

[0037] A computer program product includes a computer program, wherein when the computer program is executed by a processor, the device networking method as described in any one of the above descriptions is implemented.

[0038] The device networking method, system and computer program product provided in the present application adopt a peer-to-peer device design, so that all devices in the system can flexibly switch to the host or slave according to the actual strategy, and automatically expand the network to form a network after connecting to the system power supply, realizing a plug-and-play networking system, and improving the flexibility and adaptability of the system configuration; single devices can work independently, and can also form tree systems of different sizes with the help of reserved contact points, realizing flexible expansion from the smallest unit to the complex system, and meeting the networking needs in various scenarios. At the same time, the tree structure is constructed in a simple and convenient way, and a system of the required size can be quickly established without complex preliminary planning, effectively enhancing the practicality and scalability of the system.

[0039] In order to make the above features and advantages of the application more obvious and easy to understand, the following embodiments are given and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 This is a flowchart of the device networking method provided in this application.

[0041] Figure 2 The flowchart of switching network relationships.

[0042] Figure 3 A schematic diagram of the state transition of a single node. DETAILED DESCRIPTION

[0043] To make the purpose and technical solutions of the embodiments of the present application clearer, the technical solutions of the embodiments of the present application will be clearly and completely described below in conjunction with the drawings of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the described embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] This application provides a device networking method, please refer to Figure 1 , Figure 1This is a flow chart of the device networking method provided in this application. The device networking method includes: steps S1 to S7.

[0045] Step S1: Set up each device in the system including: an external power input port and multiple expansion interfaces; power on the system, and the device that inputs external power serves as the root node of a network, and the remaining devices serve as nodes in the system.

[0046] Step S2: The joined nodes in each network detect the connected non-joined nodes through the physical layer of the extended interface, and obtain basic information of the non-joined nodes through the network layer of the extended interface.

[0047] Step S3: Determine whether the non-joined node has an identifier in other networks. If so, proceed to step S4; if not, proceed to step S7.

[0048] Step S4: Determine whether the non-joined nodes switch network relationships based on the root node layer number, network layer number or current node layer number; if so, proceed to step S6; if not, proceed to step S5.

[0049] Step S5: The joined nodes are treated as non-joined nodes in other networks, and the process returns to step S2.

[0050] Step S6: The non-joined node switches its network relationship to the current network and becomes a lower-layer node of the joined node of the current network.

[0051] Step S7: the joined node applies to the root node for joining the non-joined node, synchronizes the root node's allocation information to the non-joined node, and the non-joined node joins the network, and returns to step S2 until there is only one network in the system.

[0052] The device networking method provided in this application adopts a peer-to-peer device design, so that all devices in the system can flexibly switch to host or slave according to actual strategies, and automatically expand the network to form a network after connecting to the system power supply, realizing a plug-and-play networking system, and improving the flexibility and adaptability of system configuration; single devices can work independently, and can form tree systems of different sizes with the help of reserved contact points, realizing flexible expansion from the smallest unit to the complex system, and meeting the networking needs in diverse scenarios. At the same time, the tree structure is simple and convenient to construct, and a system of the required size can be quickly established without complex preliminary planning, effectively enhancing the practicality and scalability of the system.

[0053] In step S1, see Figure 1 In step S1, each device in the system is set to include: an external power input port and multiple expansion interfaces; when the system is powered on, the device that inputs external power serves as the root node of a network, and the remaining devices serve as nodes in the system.

[0054] As an example, the external power input port is a decisive factor in whether the device can serve as the root node of a network, that is, the host of a network. After the external power input port is connected to the system power supply, the device becomes the host of a network. Each device can also include multiple expansion interfaces in different positions for expanding the device combination network. The number of expansion interfaces of each device determines the number of devices connected to the device. In a network, there is only one host. The host is connected to the expansion interfaces of other devices through the expansion interface to expand outward to form a tree structure, in which the host serves as the root node of the tree structure. Other devices that are not connected to the system power supply serve as nodes to be expanded in the system, and the node is the smallest unit of the system.

[0055] As an example, set the maximum number of layers supported by each node.

[0056] Specifically, the system can include multiple networks, each of which is a tree structure with the host as the root node. Depending on the commands sent or received, each network can control a single node or send commands to the root node for unified control of the child nodes.

[0057] Specifically, the expansion interface connected to the upper-layer node is called an upward expansion interface, and the expansion interface connected to the lower-layer node is called a downward expansion interface.

[0058] As an example, each expansion interface includes contact points: power+, power-, and communication pins (PINs). The expansion interfaces are connected via the contact points.

[0059] In step S2, see Figure 1 In step S2, the joined nodes in each network detect the connected non-joined nodes through the physical layer of the extended interface, and obtain basic information of the non-joined nodes through the network layer of the extended interface.

[0060] For example, a joined node pulls up to a high level; after the expansion interface connects to the node, it pulls down the communication pin of the expansion interface. The communication pin of an idle expansion interface is pulled down at random intervals. The physical layer of the idle expansion interface detects whether a node has joined based on the status of the communication pin. If the low level is detected within the period of time when the expansion interface is pulled down randomly, it indicates that no node has joined. If the low level is detected not within the period of time when the expansion interface is pulled down randomly, it indicates that a node has joined.

[0061] In one embodiment of the present application, the interval time is 0.1 to 0.5 seconds.

[0062] As an example, the network layer of the extended interface uses a half-duplex single-line Universal Asynchronous Receiver / Transmitter (UART) for communication, that is, at the same time, data can only be sent from the upper node to the lower node or from the lower node to the upper node, and the baud rate per second is 115200bps.

[0063] For example, before a node joins the current network, the power supply is only used for communication when connecting through the expansion interface.

[0064] For example, information transmission in a network can only be carried out between two directly connected nodes. Considering the direction conflict of single-line communication, the upper-level node can directly transmit information to the lower-level node. The lower-level node must wait for the upper-level node to send instructions before reporting data; further, the upper-level node will send information at regular intervals to allow the lower-level node to report information.

[0065] Specifically, if an upper-layer node wants to transmit information to a node in an intermediate layer, the information must be forwarded through an intermediate node before reaching a lower-layer node. That is, the lower-layer node must be in a tree structure with the upper-layer node as the root.

[0066] Specifically, a node cannot directly transmit information to a node that is not on the same root tree. Information transmission needs to be forwarded through the root node of the tree where both nodes are located.

[0067] For example, when a directly connected upper-layer node and a lower-layer node transmit information, the lower-layer node needs to respond to the information before the timeout period Tout. The communication between the directly connected upper-layer node and the lower-layer node includes:

[0068] Normally, the upper node sends information to the lower node, and the lower node responds to the upper node before the timeout Tout.

[0069] Information loss: The upper node sends information to the lower node, but the lower node does not respond before the timeout Tout. The upper node resends the information to the lower node, and the lower node responds to the upper node before the timeout Tout.

[0070] Node removal situation: The upper node sends information to the lower node, and the lower node does not respond before the timeout period Tout. After repeated multiple times, the lower node still does not respond before the timeout period Tout, and the node is judged to be removed.

[0071] In a specific embodiment of the present application, after repeating 5 times, if the lower-level node still does not respond before the timeout period Tout, it is determined that the node is removed.

[0072] Specifically, if an intermediate node of the tree structure is removed from the current network, the child nodes of the intermediate node are also removed from the current network.

[0073] As an example, the address is a tree-structured addressing method. The address encoding uses bytes as the addressing unit. In the tree-structured addressing method, one byte addresses one node, and each byte contains 8 bits. The complete address encoding of each node is shown in Table 1.

[0074] Table 1 Complete address code

[0075] Byte bit value effect Byte0 Node Type + 0 Position Root node addressing Byte1 Level 1 node addressing ... ByteN N-level node addressing ByteN+1 Node type + 0 position / 0xF broadcast Address Location / Broadcast Identifier

[0076] As an example, the format of a single byte is shown in Table 2.

[0077] Table 2 Format of a single byte

[0078]

[0079]

[0080] Specifically, during addressing, the addressing content of the intermediate node may not be transmitted to the lower-level nodes. For example, the root node does not need to transmit the address of byte 0 to the lower-level nodes. Therefore, the final address is only the end address of byte ByteN+1, reducing the transmission of useless information.

[0081] As an example, data packets are used to transmit information during communication. The data packets include actively sent data packets and response data packets. The formats of the actively sent data packets and the response data packets include: a packet header, a command, an address, parameters, a cumulative checksum, and a packet tail. The overall format of the data packet is shown in Table 3.

[0082] Table 3 Overall format of data packet

[0083]

[0084] As an example, the command of the data packet is 1 byte in total. When Bit7 of each byte is 0, it indicates a send command. When Bit7 of each byte is 1, it indicates a reply command. Bits 0 to 6 of each byte indicate other instructions of the command.

[0085] As an example, the sending commands for bits Bit0 to Bit6 of each byte are shown in Table 4.

[0086] Table 4 Sending commands for bits Bit0 to Bit6 of each byte

[0087]

[0088]

[0089] As an example, when the command of the data packet is to obtain node information, the address can only be the current node, which is 0 or 0x0x (x!=F). At this time, the data packet has no parameter bit; when responding, the command bit Bit0 is set to 1.

[0090] For example, if the command in a data packet is for an allocation node system setting, the addressing setting applies to the current node if the address is a specific node, or to the entire network if the address is a broadcast node. In a response, the corresponding response field in the data packet can be left blank. The enabled function parameters for the allocation node system setting are shown in Table 5.

[0091] Table 5 Allocation node system settings enable function parameters

[0092] Bit Function Bit0 Node white light switch Bit1 Node white light brightness adjustment Bit2 Node white dot matrix adjustment Bit3 Node RGB color support Bit4 Node color matrix support

[0093] For example, when a packet contains a command for time synchronization, the address can only be the current node, either 0 or 0x0x (x!=F). In a response, the corresponding response field in the packet can be empty. The time synchronization parameters are the time calibration parameters of the root node, or the node sending the command, ensuring that all nodes in the network are synchronized to the root node's time. The data structure of the time synchronization packet is shown in Table 6.

[0094] Table 6 Data structure of synchronization time data packet

[0095]

[0096]

[0097] Where T_delta_up represents the calibration time difference, and T_count represents the number of time units of the recorded network.

[0098] The process of synchronizing time includes: step S21 to step S24.

[0099] Step S21: The upper layer network triggers recording of the number of network time units and sends it to the upper layer node.

[0100] Step S22: the upper node calculates the calibration time difference initial value T_delta1 transmitted from the upper node to the lower node, and sends the synchronization time data packet including the time difference initial value T_delta1 to the lower node via the universal asynchronous receiver / transmitter.

[0101] Step S23: The UART of the lower node receives the synchronization time data packet.

[0102] Step S24: The lower layer network triggers recording of the number of network time units, sends it to the lower layer node, and calculates in real time to obtain the actual value of the calibration time difference T_delta2, thereby achieving the time difference T_delta calibration.

[0103] The time difference T_delta is expressed as follows:

[0104] T_delta=T_delta_up+T_delta1+T_delta2.

[0105] For example, when the command of a data packet is to obtain the node status, the address can only be the current node, which is 0 or 0x0x (x!=F), and the data packet does not include parameters; when responding, the corresponding response field of the data packet must include the node status.

[0106] For example, when a data packet contains a set command, all address formats are supported. Because each node in the cascaded data packet transmission process has a delay, the command packet specifies a time based on the root node to synchronize nodes and ensure that the set command is executed synchronously across all nodes in the network. Bit 7 indicates whether the timestamp is synchronized. The encoding rules for the set command are shown in Table 7.

[0107] Table 7 Encoding rules for setting commands

[0108]

[0109]

[0110] As an example, when the command of the data packet is to switch network relations, the address can only be the current unit, which is 0 or 0x0x (x!=F); the data structure of the data packet for switching network relations is shown in Table 6.

[0111] Table 6 Data structure of synchronization time data packet

[0112]

[0113] As an example, when responding to a command, several states of the supporting node are responded together, and the bits of the response command represent the response content.

[0114] Specifically, the upper-layer node must respond to the current command sent, and if other states are updated, it must respond synchronously. The response commands for bits 0 to 3 of each byte are shown in Table 7.

[0115] Table 7 Response command for each byte bit 0 to bit 3

[0116] Bit value illustrate Bit0 0x1 Node Information Bit1 0x2 Node time information Bit2 0x3 Node status information Bit3 0x4 Switch network response

[0117] As an example, the node information of bit 0 of the response command includes all information of the node and its lower-level nodes. The node information is reported according to the tree structure traversal principle. The information content of a single node is shown in Table 8.

[0118] Table 8 Single node information content

[0119] Byte bit illustrate Byte 0~Byte n-1 The address is the relative address of the responded node as the root Byte n~Byte n+1 Node Type Byte n+2~Byte n+3 Node version Byte n+4~Byte n+5 Node Capacity

[0120] Specifically, the node capability bits are shown in Table 9.

[0121] Table 9 Node Capability Bits

[0122] Bit illustrate Bit0 Node white light switch Bit1 Node white light brightness adjustment Bit2 Node white dot matrix control Bit3 Node RGB color support Bit4 Node color matrix control Bit5 Key events Bit6 Is it already in another network?

[0123] Specifically, the data structure of the node information overall data packet is shown in Table 10.

[0124] Table 10 Data structure of the overall node information data packet

[0125] Byte bit value illustrate Byte0 0x01 Indicates a node information data packet Byte1~Byte2 Content Length Mark the current network layer number The remaining bytes Node information list

[0126] As an example, the data structure of the entire data packet of the node time information of bit 1 of the response command is shown in Table 11.

[0127] Table 11 Data structure of the overall data packet of node time information

[0128] Byte bit value illustrate Byte0 0x02 Byte1~Byte2 Network time units

[0129] As an example, the node status information of bit 2 of the response command includes an event packet (event_pack), and the data structure of the event packet of the node status information is shown in Table 12.

[0130] Table 12 Data structure of event packet of node status information

[0131]

[0132] Specifically, when the response command is node status information, the event address is the relative address of the responding node as the root. Node events include events 1 through n, with the number of events being n. The data structure of the entire node status information packet for bit 2 of the response command is shown in Table 13.

[0133] Table 13 Data structure of the overall data packet of node status information

[0134] Byte bit value illustrate Byte0 0x03 Byte1 Number of node states The remaining bytes Node event 1 to node event n

[0135] As an example, the data structure of the switching network response data packet of the response command bit Bit 3 is shown in Table 14.

[0136] Table 14 Data structure of the overall data packet of the switching network response

[0137]

[0138]

[0139] In step S3, see Figure 1 In step S3, it is determined whether the non-joined node has an identifier in other networks. If so, the process proceeds to step S4; if not, the process proceeds to step S7.

[0140] As an example, the joined node obtains the non-joined node information according to the command to obtain node information, and determines whether the non-joined node has an identifier in other networks, that is, determines whether the non-joined device has a power supply.

[0141] In step S4, see Figure 1 In step S4, it is determined whether the non-joined nodes switch network relationships based on the maximum number of supported layers of the root node, the number of network layers, or the number of current node layers; if so, proceed to step S6; if not, proceed to step S5.

[0142] As an example, a joined node sends a switch network relationship command to a non-joined node. Whether the non-joined node switches network relationships is determined based on the maximum number of layers supported by the root node, the number of network layers, or the number of layers of the current node, including: first, selecting the network with the larger maximum number of layers supported by the root node of the two networks as the subsequent network, that is, when the maximum number of layers supported by the root node of the current network is greater than the maximum number of layers supported by the root node of the other network, the non-joined node responds with a switch consent, otherwise it responds with a switch rejection; if the maximum number of layers supported by the root nodes of the two networks is the same, selecting the network with the larger number of layers as the subsequent network, that is, when the number of layers of the current network is greater than the number of layers of the other network, the non-joined node responds with a switch consent, otherwise it responds with a switch rejection; if the maximum number of layers supported by the root nodes and the number of network layers of the two networks are the same, selecting the network with the larger number of layers as the subsequent network, that is, when the number of layers of joined nodes in the current network is greater than the number of layers of non-joined nodes in the other network, the non-joined node responds with a switch consent, otherwise it responds with a switch rejection; if all of the above conditions are met, selecting the network with the joined node as the subsequent network, and the non-joined node responds with a switch consent.

[0143] In step S5, see Figure 1 In step S5, the joined node is treated as a non-joined node of other networks, and the process returns to step S2.

[0144] As an example, after the joined node becomes a non-joined node of other networks, it switches the upper and lower layer relationship with the nodes connected to other networks and becomes a lower layer node of the nodes connected to other networks.

[0145] In step S6, refer to Figure 1 In step S6, the non-joined node switches its network relationship to the current network and becomes a lower-layer node of the joined node of the current network.

[0146] As an example, see Figure 2 , Figure 2 The complete process of switching network relationships includes steps S61 to S68.

[0147] Step S61: the joined node sends a command to obtain node information to the non-joined node, and the non-joined node responds with node information indicating that it is in another network.

[0148] Step S62: the joined node sends a switch network relationship command to the non-joined node, and the non-joined node responds with a switch wait.

[0149] Step S63: The upper layer node of the non-joined node synchronizes time with the non-joined node, the joined node sends a network switching command to the non-joined node again, the non-joined node determines the network switching relationship and responds with a switching consent.

[0150] Step S64: the joined node sends a command to obtain node status information to the non-joined node, and the non-joined node responds that switching is in progress.

[0151] Step S65: The non-joining node sends a switch network relationship command to the upper node, and the upper node responds with a switch consent.

[0152] Step S66: The non-joined node sends a command to obtain node information to the upper node, and the upper node responds that the switching is completed.

[0153] Step S67: The joined node sends a command to obtain node status information to the non-joined node, and the non-joined node responds that the switching is completed.

[0154] Step S68: The joined node sends a command to obtain node information to the non-joined node, and the non-joined node responds by updating the node list.

[0155] As an example, after completing step S68, the node switches the network relationship.

[0156] In step S7, refer to Figure 1 In step S7, the joined node applies to the root node to join the non-joined node, synchronizes the root node's allocation information to the non-joined node, and the non-joined node joins the network, and returns to step S2 until there is only one network in the system.

[0157] For example, a joined node requests to join a non-joined node from the root node and synchronizes the root node's allocation information with the non-joined node. This includes: the joined node requests to join the non-joined node from the root node, the root node responds with a node allocation system configuration command, and the joined node synchronizes the allocation information with the non-joined node, fully utilizing its power supply. At this point, the non-joined node officially joins the current network and becomes the next-level node below the joined node.

[0158] As an example, see Figure 3 , Figure 3 This diagram shows the state transitions of a single node. After powering on, the node waits to join the network through communication enablement. After the root node is configured, it joins the network through node enablement. If a node switches between upper and lower layers, it waits for all child nodes connected to it to switch directions. After the switch is complete, it joins the network through node enablement. When the node loses power, it returns to the shutdown state.

[0159] For example, a node connected to a system power supply remains connected to the system power supply after joining other networks and participates in network operations, preventing a situation where a host may not be able to support network operations when the number of network layers is too large.

[0160] The device networking method provided in this application adopts a peer-to-peer device design, so that all devices in the system can flexibly switch to host or slave according to actual strategies, and automatically expand the network to form a network after connecting to the system power supply, realizing a plug-and-play networking system, and improving the flexibility and adaptability of system configuration; single devices can work independently, and can form tree systems of different sizes with the help of reserved contact points, realizing flexible expansion from the smallest unit to the complex system, and meeting the networking needs in diverse scenarios. At the same time, the tree structure is simple and convenient to construct, and a system of the required size can be quickly established without complex preliminary planning, effectively enhancing the practicality and scalability of the system.

[0161] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The order of execution of these sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with other steps or at least a portion of the sub-steps or stages of other steps.

[0162] The present application also provides a device networking system, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned device networking methods.

[0163] The present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the various steps of the device networking method provided in the above embodiment.

[0164] The computer-executable instructions for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer-executable instructions may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer-executable instructions are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer-executable instructions may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or electronic device.

[0165] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; feedback provided to the user can be any form of sensory feedback (e.g., visual feedback or tactile feedback); and input from the user can be received in any form, including acoustic input, voice input, or tactile input.

[0166] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as data electronics), or a computing system that includes middleware components (e.g., application electronics), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with embodiments of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0167] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0168] Although the present application has been disclosed above with reference to the embodiments, they are not intended to limit the present application. Anyone with ordinary knowledge in the technical field may make slight changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be determined by the scope of the appended patent application.

Claims

1. A device networking method, characterized in that: include, Step S1: Set up each device in the system, including an external power input port and multiple expansion interfaces; power on the system, and the device that inputs external power serves as the root node of a network, and the remaining devices serve as nodes in the system; Step S2: The joined nodes in each network detect the connected non-joined nodes through the physical layer of the extended interface and obtain basic information of the non-joined nodes through the network layer of the extended interface; Step S3: Determine whether the unjoined node is identified in other networks. If so, proceed to step S4; if not, proceed to step S7; Step S4: Determine whether the non-joined node should switch network relationships based on the maximum number of layers supported by the root node, the number of network layers, or the number of layers of the current node; if so, proceed to step S6; if not, proceed to step S5; Step S5: The joined nodes are treated as non-joined nodes in other networks, and the process returns to step S2; Step S6: The non-joined node switches its network relationship to the current network and becomes a lower-layer node of the joined node of the current network; Step S7: the joined node applies to the root node for joining the non-joined node, synchronizes the root node's allocation information to the non-joined node, and the non-joined node joins the network, and returns to step S2 until there is only one network in the system.

2. The device networking method according to claim 1, wherein: The expansion interface includes contact points: power +, power - and communication pins; The physical layer of the expansion interface detects the connected unjoined nodes, including: actively pulling down the communication pin of the idle expansion interface at random intervals, and the physical layer detects that the level of the communication pin is pulled down outside the active pulling-down time, and determines that there is an unjoined node connection; otherwise, there is no unjoined node connection.

3. The device networking method according to claim 2, wherein: The network layer of the expansion interface uses a half-duplex single-line universal asynchronous receiver and transmitter for communication. Information transmission in a network can only be carried out between two directly connected nodes. Before the node joins the current network, the power supply is only for communication when connecting through the expansion interface.

4. The device networking method according to claim 3, wherein: Communication between two directly connected nodes includes: Normally, the upper node sends information to the lower node, and the lower node responds to the upper node before the timeout. Information loss: The upper node sends information to the lower node, but the lower node does not respond before the timeout. The upper node resends the information to the lower node, and the lower node responds to the upper node before the timeout. Node removal situation: The upper node sends information to the lower node, and the lower node does not respond before the timeout period. After repeated multiple times, the lower node still does not respond before the timeout period, and the node is judged to be removed.

5. The device networking method according to claim 3, wherein: The node address encoding uses bytes as the addressing unit, and one byte addresses one node. When addressing, the addressing content of the intermediate node is not transmitted to the lower-level nodes. Data packets are used to transmit information during communication. Data packets include actively sent data packets and response data packets. The sending commands of the actively sent data packets include: obtaining node information, allocating node system settings, synchronizing time, obtaining node status information, setting commands and switching network relationships; the response commands of the response data packets include: node information, node time information, node status information and switching network responses.

6. The device networking method according to claim 5, wherein: The process of synchronizing time includes: The upper network triggers the recording of network time units and sends it to the upper node; The upper node calculates the initial value of the calibration time difference transmitted from the upper node to the lower node, and sends the synchronization time data packet containing the initial value of the time difference to the lower node via the universal asynchronous receiver transmitter; The UART of the lower node receives the synchronization time data packet; The lower-layer network triggers the recording of the number of network time units and sends it to the lower-layer nodes. The actual value of the calibration time difference is calculated in real time to achieve time difference calibration.

7. The device networking method according to claim 1, wherein: Judging whether the non-joined nodes switch network relationships based on the maximum number of layers supported by the root node, the number of network layers or the number of layers of the current node, including: selecting the network with the larger maximum number of layers supported by the root node of the two networks as the subsequent network, and not joining the node switching network relationship; if the maximum number of layers supported by the root nodes of the two networks is the same, selecting the network with the larger number of network layers of the two networks as the subsequent network, and not joining the node switching network relationship; if the maximum number of layers supported by the root nodes and the number of network layers of the two networks are the same, selecting the network with the larger number of layers of the current node as the subsequent network, and not joining the node switching network relationship; if the above conditions are all the same, selecting the network with the joined nodes as the subsequent network, and not joining the node switching network relationship.

8. The device networking method according to claim 7, wherein: The process of switching network relationships includes: The joined node sends a command to obtain node information to the non-joined node, and the non-joined node responds with node information indicating that it is in another network; The joined node sends a switch network relationship command to the non-joined node, and the non-joined node responds with a switch wait; The upper layer node of the non-joined node synchronizes time with the non-joined node. The joined node sends a network switching command to the non-joined node again. The non-joined node determines the network switching relationship and responds with a switch agreement. The joined node sends a command to obtain node status information to the unjoined node, and the unjoined node responds that it is switching. The non-joined node sends a command to the upper node to switch network relationship, and the upper node responds with a switch agreement; The non-joined node sends a command to obtain node information to the upper node, and the upper node responds that the handover is complete. The joined node sends a command to obtain node status information to the non-joined node, and the non-joined node responds that the handover is complete. The joined node sends a get node information command to the unjoined node, and the unjoined node responds by updating the node list.

9. A device networking system, characterized in that: Used to execute the device networking method as described in any one of claims 1 to 8, the device networking system includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the device networking method as described in any one of claims 1 to 8.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the device networking method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Node network access control method for tree topology wireless ad hoc network

    CN108024316A

  • Transformer area low-voltage loss control system and method

    CN112152321A

  • Wireless mobile ad hoc communication method and system

    CN112423364A

  • Energy management in wireless networks

    US20250113297A1