Device networking method, system and computer program product

By using a device networking method based on peer-to-peer device design, flexible switching and automatic networking of devices within the system are achieved, solving the problem of fixed master-slave architecture in existing technologies and improving the system's flexibility and scalability.

CN120675873BActive Publication Date: 2026-04-21JIANGSU CARBON TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGSU CARBON TECHNOLOGY CO LTD
Filing Date
2025-07-15
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing device networking technologies, the fixed master-slave architecture results in poor system flexibility, making it difficult to adapt to different application scenarios. When expanding devices, reconfiguration is required, and the system stability and fault tolerance are insufficient when the host fails.

Method used

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

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 system's practicality and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675873B_ABST
    Figure CN120675873B_ABST
Patent Text Reader

Abstract

This application discloses a device networking method, system, and computer program product, belonging to the field of networking technology. The method includes: setting each device in the system to include an external power input port and multiple expansion interfaces; using the device connected to the system power supply as the root node of the network; detecting whether any nodes have joined through the physical layer of the expansion interfaces, and obtaining basic information about the nodes through the network layer. It determines whether any unjoined nodes are identified in other networks; if so, it selects a network as the next network based on the maximum supported layer number of the root node, the number of network layers, or the current node's layer number. After switching network relationships, it becomes a lower-level node of the already joined node and applies to join the root node, until only one network remains in the system. This application implements a plug-and-play networking system. Individual devices can work independently and can also form tree systems of different sizes through contact points, meeting the networking needs of diverse scenarios. The system is simple to construct and effectively enhances its flexibility and scalability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In existing device networking technologies, most systems adopt a fixed master-slave architecture. Once the roles of the master and slave devices are determined, they are difficult to change, which makes the system lack flexibility in response to different application scenarios. When it is necessary to adjust the system structure or expand the number of devices, the entire system often needs to be reconfigured, which is complex and inefficient, and cannot meet rapidly changing actual needs. Under this fixed architecture, if the master fails, the entire system may be paralyzed, and the slave devices cannot temporarily assume the functions of the master to maintain system operation, which greatly affects the system's stability and fault tolerance. Summary of the Invention

[0003] This 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 as follows:

[0005] A device networking method, comprising,

[0006] Step S1: Configure each device in the system, including: external power input port and multiple expansion interfaces; power on the system, the device with external power input acts as the root node of the network, and the remaining devices act as nodes in the system;

[0007] Step S2: Joined nodes in each network detect connected unjoined nodes through the physical layer of the extended interface, and obtain basic information about the unjoined nodes through the network layer of the extended interface;

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

[0009] Step S4: Determine whether to switch network relationships for nodes that have not been added 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 yes, proceed to step S6; if no, proceed to step S5.

[0010] Step S5: The already joined node becomes an unjoined node in other networks, return to step S2;

[0011] Step S6: Unjoined nodes switch their network relationship to the current network and become the lower-level nodes of the joined nodes in the current network;

[0012] Step S7: The joined node requests to join the unjoined node from the root node, synchronizes the root node's allocation information with the unjoined node, and the unjoined node joins the network. Then, return 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 unjoined nodes, including: actively pulling down the communication pins of idle expansion interfaces at random intervals; the physical layer detects that the level of the communication pins is pulled down outside the active pulling-down time, and determines that there are unjoined nodes connected; otherwise, there are no unjoined nodes connected.

[0014] Optionally, the network layer of the extended interface uses a half-duplex single-wire universal asynchronous transceiver for communication. Information transmission in a network can only occur between two directly connected nodes. Before any node joins the current network, power is only used for communication when connecting through the extended interface.

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

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

[0017] Information loss scenario: An upper-level node sends information to a lower-level node, but the lower-level node does not respond before the timeout period. After the upper-level node resends the information to the lower-level node, the lower-level node responds to the upper-level node before the timeout period.

[0018] Node removal scenario: When an upper-level node sends a message to a lower-level node, and the lower-level node does not respond before the timeout period, and this is repeated multiple times and the lower-level node still does not respond before the timeout period, the node is determined to have been removed.

[0019] Optionally, the address encoding of a node is based on a byte as the addressing unit, with one byte representing one node address; during addressing, the addressing content of an intermediate node is not transmitted to the lower-level node.

[0020] Communication uses data packets for information transmission. Data packets include actively sent data packets and responding data packets. The sending commands of 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 responding 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-layer network triggers and records the number of network time units, which is then sent to the upper-layer node.

[0023] The upper-layer node calculates the initial value of the calibration time difference transmitted from the upper-layer node to the lower-layer node, and sends the synchronization time data packet containing the initial value of the time difference to the lower-layer node through a universal asynchronous transceiver;

[0024] The lower-level node's universal asynchronous transceiver receives synchronous time data packets;

[0025] The lower-level network triggers the recording of network time units, sends them to the lower-level nodes, and calculates the actual value of the calibration time difference in real time to achieve time difference calibration.

[0026] Optionally, the determination of whether to switch network relationships for nodes not yet joined is based on the maximum supported layers of the root node, the number of network layers, or the current node's layer number. This includes: selecting the network with the larger maximum supported layers of the root node as the subsequent network, and switching the network relationship for nodes not yet joined; if the maximum supported layers of the root nodes of the two networks are the same, selecting the network with the larger number of network layers as the subsequent network, and switching the network relationship for nodes not yet joined; if the maximum supported layers of the root nodes and the number of network layers of the two networks are the same, selecting the network with the larger number of current node layers as the subsequent network, and switching the network relationship for nodes not yet joined; if all the above conditions are consistent, selecting the network of a node already joined as the subsequent network, and switching the network relationship for nodes not yet joined.

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

[0028] A node that has joined sends a command to a node that has not joined to obtain node information. The node that has not joined responds with node information indicating that it is in another network.

[0029] A node that has joined the network sends a command to a node that has not joined the network relationship to switch the network relationship; the node that has not joined responds by waiting for the switch.

[0030] The parent node of a node that has not joined synchronizes its time with the node that has not joined. The node that has joined sends a network switching command to the node that has not joined again. The node that has not joined determines the network switching relationship and responds with a switch agreement.

[0031] A joined node sends a command to a non-joined node to retrieve node status information, and the non-joined node responds that it is switching over.

[0032] A node that has not joined sends a command to an upper-level node to switch network relationships, and the upper-level node responds with agreement to the switch.

[0033] The unjoined node sends a command to the upper-level node to obtain node information, and the upper-level node responds that the switchover is complete.

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

[0035] A node that has joined sends a command to a node that has not joined to retrieve node information, and the node that has not joined responds by updating its node list.

[0036] A device networking system is provided for executing the device networking method as described in any one of the above descriptions. 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 the above descriptions.

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

[0038] The device networking method, system, and computer program products provided in this application, through the adoption of peer-to-peer device design, enable all devices in the system to flexibly switch as master or slave devices according to actual strategies. After connecting to the system power supply, they automatically expand and form a network, realizing a plug-and-play networking system and improving the flexibility and adaptability of system configuration. Individual devices can work independently or form tree systems of different sizes with the help of reserved contact points, realizing flexible expansion from the smallest unit to complex systems, meeting the networking needs in diverse scenarios. At the same time, the tree structure construction method is simple and convenient, and the required scale of system can be quickly built without complicated pre-planning, effectively enhancing the practicality and scalability of the system.

[0039] To make the above-mentioned features and advantages of the application more apparent and understandable, specific embodiments are provided below, and detailed descriptions are given in conjunction with the accompanying drawings. Attached Figure Description

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

[0041] Figure 2 This is a flowchart for switching network relationships.

[0042] Figure 3 This is a schematic diagram of the state transition of a single node. Detailed Implementation

[0043] To make the objectives and technical solutions of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the described embodiments of this application without creative effort are within the scope of protection of this application.

[0044] This application provides a device networking method. Please refer to [link / reference]. Figure 1 , Figure 1A flowchart illustrating the device networking method provided in this application. The device networking method includes steps S1 to S7.

[0045] Step S1: Configure each device in the system, including: external power input port and multiple expansion interfaces; power on the system, the device with external power input acts as the root node of the network, and the remaining devices act as nodes in the system.

[0046] Step S2: Joined nodes in each network detect unjoined nodes through the physical layer of the extended interface, and obtain basic information about unjoined nodes through the network layer of the extended interface.

[0047] Step S3: Determine if the unjoined node is identified in other networks. If yes, proceed to step S4; otherwise, proceed to step S7.

[0048] Step S4: Determine whether to switch network relationships for nodes that have not been added based on the root node level, network level, or current node level; if yes, proceed to step S6; if no, proceed to step S5.

[0049] Step S5: The joined node becomes an unjoined node in other networks, return to step S2.

[0050] Step S6: Unjoined nodes switch their network relationship to the current network and become the lower-level nodes of the joined nodes in the current network.

[0051] Step S7: The joined node requests to join the unjoined node from the root node, synchronizes the root node's allocation information with the unjoined node, and the unjoined node joins the network. Then, return to step S2 until there is only one network in the system.

[0052] The device networking method provided in this application, through the adoption of a peer-to-peer device design, enables all devices in the system to flexibly switch as master or slave devices according to actual strategies. After connecting to the system power supply, the network automatically expands and forms a network, realizing a plug-and-play networking system and improving the flexibility and adaptability of system configuration. Individual devices can work independently or form tree systems of different sizes with the help of reserved contact points, realizing flexible expansion from the smallest unit to complex systems, meeting the networking needs in diverse scenarios. At the same time, the tree structure is simple and convenient to build, and the required scale of system can be quickly built without complicated preliminary planning, effectively enhancing the practicality and scalability of the system.

[0053] In step S1, please refer to Figure 1 In step S1, the system is configured with various devices including an external power input port and multiple expansion interfaces; when the system is powered on, the device with the external power input acts as the root node of the network, and the remaining devices act as nodes in the system.

[0054] As an example, the external power input port is a decisive factor in whether a device can serve as the root node of a network, i.e., the host of a network. After the external power input port is connected to the system power supply, the device becomes the host of the network. Each device may also include multiple expansion interfaces in different locations for expanding the network. The number of expansion interfaces on each device determines the number of devices that can be connected to that device. In a network, there is only one host. The host expands outwards by connecting to the expansion interfaces of other devices, forming a tree structure, where the host is the root node of the tree structure. Other devices not connected to the system power supply are nodes to be expanded in the system; a node is the smallest unit of the system.

[0055] As an example, set the maximum number of layers that each node can support.

[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 the commands can be sent to the root node for unified control of the child nodes.

[0057] Specifically, the extension interface that connects to the upper-level node is called the upward extension interface, and the extension interface that connects to the lower-level node is called the downward extension interface.

[0058] As an example, each expansion interface includes contacts: power+, power-, and a communication pin. Expansion interfaces are connected to each other via these contacts.

[0059] In step S2, please refer to Figure 1 In step S2, the joined nodes in each network detect the unjoined nodes they are connecting to through the physical layer of the extended interface, and obtain the basic information of the unjoined nodes through the network layer of the extended interface.

[0060] As an example, the joined node is pulled high; after the expansion interface is connected to the node, it will pull the communication pin of the expansion interface low. The communication pin of the idle expansion interface is pulled low at random intervals. The physical layer of the idle expansion interface detects whether a node has joined based on the state of the communication pin. If the low level is detected as being actively pulled low during the randomly selected time interval of the expansion interface, it indicates that no node has joined; if the low level is detected as not being actively pulled low during the randomly selected time interval of the expansion interface, it indicates that a node has joined.

[0061] In one embodiment of this 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-wire Universal Asynchronous Receiver / Transmitter (UART) for communication, meaning that at any given time, only upper-layer nodes can send data to lower-layer nodes or vice versa, with a transmission baud rate of 115200bps per second.

[0063] As an example, before any node joins the current network, when connecting via the extended interface, power is only used for communication.

[0064] As an example, information transmission in a network can only occur between two directly connected nodes. Considering the directional conflict in single-line communication, upper-layer nodes can directly transmit information to lower-layer nodes, while lower-layer nodes must wait for instructions from upper-layer nodes before reporting data. Furthermore, upper-layer nodes will periodically send information to lower-layer nodes to report information.

[0065] Specifically, for an upper-level node to transmit information to a node in the next layer, it needs to be forwarded through an intermediate node to reach the lower-level node. That is, the lower-level node must be in a tree structure rooted at the upper-level node.

[0066] Specifically, a node cannot directly pass information to a node in a tree that is not at the same root. Instead, the information needs to be forwarded through the root node of the tree where both nodes are located.

[0067] As an example, when a directly connected upper-level node and a lower-level node exchange information, the lower-level node needs to respond before the timeout period Tout. Communication between directly connected upper-level and lower-level nodes includes:

[0068] Normally: the upper-level node sends information to the lower-level node, and the lower-level node responds with information to the upper-level node before the timeout period Tout.

[0069] Information loss scenario: An upper-level node sends information to a lower-level node, but the lower-level node does not respond before the timeout period Tout. After the upper-level node resends the information to the lower-level node, the lower-level node responds to the upper-level node before the timeout period Tout.

[0070] Node removal scenario: If an upper-level node sends a message to a lower-level node, and the lower-level node does not respond before the timeout period Tout, and this is repeated multiple times and the lower-level node still does not respond before the timeout period Tout, the node is determined to have been removed.

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

[0072] Specifically, if a middle node in a tree structure is removed from the current network, the child nodes of that middle node are also removed from the current network.

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

[0074] Table 1 Complete Address Codes

[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 / 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 intermediate nodes does not need to be transmitted to lower-level nodes. For example, the root node does not need to transmit the address of byte 0 to lower-level nodes. Therefore, the addressing to the final address only has the end address of byte N+1, reducing the transmission of useless information.

[0081] As an example, information is transmitted using data packets during communication. Data packets include actively sent data packets and response data packets. The format of both actively sent and response data packets includes: packet header, command, address, parameters, checksum, and packet trailer. The overall format of the data packet is shown in Table 3.

[0082] Table 3 Overall Data Packet Format

[0083]

[0084] As an example, the command in the data packet is 1 byte in total. When Bit7 = 0 in each byte, it indicates a send command. When Bit7 = 1 in each byte, it indicates a response command. Bit0 to Bit6 in each byte indicate other instructions for the command.

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

[0086] Table 4 shows the transmission commands for each byte's bits (Bits 0 to 6).

[0087]

[0088]

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

[0090] As an example, when the command of the data packet is set by the allocation node system, if the address is a specific node, the addressing setting is effective for the current node; if the address is a broadcast node, the addressing setting is effective for the entire network. In the response, the corresponding response field of the data packet can be empty. The enabling function parameters set by the allocation node system are shown in Table 5.

[0091] Table 5 Enable function parameters set for the distribution node system

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

[0093] As an example, when the command in the data packet is to synchronize time, the address can only be the current node, which is 0 or 0x0x (x != F); in the response, the corresponding response field of the data packet can be empty. The synchronization time parameter is the time calibration parameter 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 synchronization time data packet is shown in Table 6.

[0094] Table 6 Data Structure of Synchronization Time Data Packets

[0095]

[0096]

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

[0098] The time synchronization process includes steps S21 to S24.

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

[0100] Step S22: The upper-layer node calculates the initial value T_delta1 of the calibration time difference transmitted from the upper-layer node to the lower-layer node, and sends the synchronization time data packet containing the initial value T_delta1 to the lower-layer node through a universal asynchronous transceiver.

[0101] Step S23: The general asynchronous transceiver of the lower-level node receives the synchronization time data packet.

[0102] Step S24: The lower-layer network triggers the recording of network time units and sends them to the lower-layer nodes. The actual value of the calibration time difference T_delta2 is calculated in real time to achieve time difference T_delta calibration.

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

[0104] T_delta=T_delta_up+T_delta1+T_delta2.

[0105] As an example, when the command of the data packet is to retrieve 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 contain the node status.

[0106] As an example, when the command in the data packet is a setting command, all address formats are supported. Since there is a delay in the cascading of data packets sent by each node, the command in the data packet is set to synchronize the execution time of the execution nodes based on the root node's time, ensuring that the setting command is executed synchronously on all nodes in the network. Bit 7 indicates whether a synchronization timestamp is used. The encoding rules for the setting command are shown in Table 7.

[0107] Table 7 sets the encoding rules for commands.

[0108]

[0109]

[0110] As an example, when the command of the data packet is to switch network relationships, 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 relationships is shown in Table 6.

[0111] Table 6 Data Structure of Synchronization Time Data Packets

[0112]

[0113] As an example, when responding to a command, several states of the node can respond together, and the bits of the response command indicate the response content.

[0114] Specifically, the current command sent by the upper-level node must be responded to, and if other states are updated, a synchronous response is required. The response commands for bits 0 to 3 of each byte are shown in Table 7.

[0115] Table 7 shows the response commands for each byte's bits (Bits 0-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 Bit0 in the response command includes all information about the node and its subordinate nodes. The node information is reported according to the tree structure traversal principle. The content of a single node information is shown in Table 8.

[0118] Table 8 Information content of a single node

[0119] byte bit illustrate Byte0~Byte n-1 The address is the relative address of the responding 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 capabilities

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

[0121] Table 9 Node Capabilities

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

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

[0124] Table 10 shows the data structure of the overall data packet for node information.

[0125] byte bit value illustrate Byte0 0x01 This 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 containing the node time information of Bit1 in the response command is shown in Table 11.

[0127] Table 11 shows the data structure of the overall data packet for node time information.

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

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

[0130] Table 12 Data Structure of Event Packets for 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. The node events include: event 1 to event n, and the number of events is n. The data structure of the entire data packet containing the node status information in bit 2 of the response command is shown in Table 13.

[0133] Table 13 shows the data structure of the overall data packet for 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 overall data packet of the network response for switching the bit 3 of the response command is shown in Table 14.

[0136] Table 14 Data Structure of the Overall Data Packet in the Network Switching Response

[0137]

[0138]

[0139] In step S3, please refer to Figure 1 In step S3, determine whether the unjoined node is identified in other networks. If yes, proceed to step S4; otherwise, proceed to step S7.

[0140] As an example, a joined node obtains information about a non-joined node according to a command to obtain node information, and determines whether the non-joined node is identified in another network, that is, whether the non-joined device has power.

[0141] In step S4, please refer to Figure 1 In step S4, determine whether to switch the network relationship of the unjoined node based on the maximum number of supported layers of the root node, the number of network layers, or the number of layers of the current node; if yes, proceed to step S6; if no, proceed to step S5.

[0142] As an example, a joined node sends a command to a non-joined node to switch network relationships. The decision to switch network relationships for a non-joined node is determined based on the maximum supported layers of the root node, the number of network layers, or the current node's layer number. This includes: First, selecting the network with the larger maximum supported layers of the root node as the successor network (i.e., if the maximum supported layers of the root node in the current network > the maximum supported layers of the root node in the other network), the non-joined node responds with "switching agreed"; otherwise, it responds with "switching rejected." If the maximum supported layers of the root nodes in the two networks are the same, selecting the network with the larger layer number as the successor network (i.e., if the current network layer number > the other network layer number), the non-joined node responds with "switching agreed"; otherwise, it responds with "switching rejected." If the maximum supported layers of the root nodes and the number of network layers in the two networks are the same, selecting the network with the larger current node layer number as the successor network (i.e., if the current network's joined node layer number > the other network's non-joined node layer number), the non-joined node responds with "switching agreed"; otherwise, it rejects the switch. If all the above conditions are met, the network of the joined node is selected as the successor network, and the non-joined node responds with "switching agreed."

[0143] In step S5, please refer to Figure 1 In step S5, the joined node is treated as an unjoined node in other networks, and the process returns to step S2.

[0144] As an example, after a node that has joined becomes a non-joined node in another network, its hierarchical relationship with nodes connected to other networks is switched, and it becomes a lower-level node of nodes connected to other networks.

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

[0146] For example, please refer to Figure 2 , Figure 2 This is a flowchart for switching network relationships. The complete process for switching network relationships includes steps S61 to S68.

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

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

[0149] Step S63: The upper-layer node of the non-joined node synchronizes its 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.

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

[0151] Step S65: The unjoined node sends a command to the upper-layer node to switch network relationships, and the upper-layer node responds with agreement to the switch.

[0152] Step S66: The unjoined node sends a command to the upper-level node to obtain node information, and the upper-level node responds that the switchover is complete.

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

[0154] Step S68: Joined nodes send a command to non-joined nodes to obtain node information, and non-joined nodes respond by updating the node list.

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

[0156] In step S7, please refer to Figure 1 In step S7, the joined node requests to join the unjoined node from the root node, synchronizes the root node's allocation information with the unjoined node, and the unjoined node joins the network. Then, the process returns to step S2 until there is only one network in the system.

[0157] As an 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 requesting to join a non-joined node from the root node; the root node responding with the allocation node system setting command; and the joined node synchronizing the allocation information with the non-joined node and then putting its power supply into full use. At this point, the non-joined node officially joins the current network and becomes the next-level node after the joined node.

[0158] For example, please refer to Figure 3 , Figure 3 This is a schematic diagram of the state transition of a single node. After power-on, the node is enabled via communication function and waits to join the network. After being configured by the root node, it is enabled via node function and joins the network. If a switch between upper and lower layer relationships is performed, after the switch direction is changed, it waits for all child nodes connected to the node to switch together. After the switch is completed, it is enabled via node function and joins the network. When the node loses power, it returns to the power-off state.

[0159] As an example, nodes connected to the system power supply remain connected to the system power supply and participate in network operation after joining other networks, preventing a situation where a single host may be unable to support network operation when the number of network layers is too large.

[0160] The device networking method provided in this application, through the adoption of a peer-to-peer device design, enables all devices in the system to flexibly switch as master or slave devices according to actual strategies. After connecting to the system power supply, the network automatically expands and forms a network, realizing a plug-and-play networking system and improving the flexibility and adaptability of system configuration. Individual devices can work independently or form tree systems of different sizes with the help of reserved contact points, realizing flexible expansion from the smallest unit to complex systems, meeting the networking needs in diverse scenarios. At the same time, the tree structure is simple and convenient to build, and the required scale of system can be quickly built without complicated 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 sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they 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. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0162] This application also provides a device networking system, 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 any of the device networking methods described above.

[0163] This 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, and when the program instructions are executed by a computer, the computer is able to perform each step of the device networking method provided in the above embodiments.

[0164] The computer-executable instructions used to implement the methods of this application may be written in any combination of one or more programming languages. These computer-executable instructions may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the computer-executable instructions cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer-executable instructions may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a standalone software package, 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 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 provides input to the computer. Other types of devices may also be used to provide interaction with the user; feedback provided to the user may be any form of sensory feedback (e.g., visual feedback or haptic feedback); and input from the user may be received in any form, including: sound input, voice input, or haptic input.

[0166] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as data electronic devices), or computing systems that include middleware components (e.g., application electronic devices), or computing systems that include front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected via digital data communication (e.g., a communication network) of any form or medium. Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0167] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 this application has been disclosed above with reference to embodiments, it is not intended to limit this application. Anyone skilled in the art may make some modifications and refinements without departing from the spirit and scope of this application. Therefore, the scope of protection of this application shall be determined by the appended claims.

Claims

1. A device networking method, characterized in that, include, Step S1: Configure each device in the system, including: external power input port and multiple expansion interfaces; power on the system, the device with external power input acts as the root node of the network, and the remaining devices act as nodes in the system; Step S2: Joined nodes in each network detect connected unjoined nodes through the physical layer of the extended interface, and obtain basic information about the unjoined nodes through the network layer of the extended interface; Step S3: Determine if the unjoined node is identified in other networks. If yes, proceed to step S4; otherwise, proceed to step S7. Step S4: Determine whether to switch network relationships for nodes that have not been added 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 yes, proceed to step S6; if no, proceed to step S5. Step S5: The already joined node becomes an unjoined node in other networks, return to step S2; Step S6: Unjoined nodes switch their network relationship to the current network and become the lower-level nodes of the joined nodes in the current network; Step S7: The joined node requests to join the unjoined node from the root node, synchronizes the root node's allocation information with the unjoined node, and the unjoined node joins the network. Then, return to step S2 until there is only one network in the system.

2. The device networking method as described in claim 1, characterized in that, The expansion interface includes contact points: power+, power-, and communication pins; The physical layer of the extended interface detects unjoined nodes by: actively pulling down the communication pins of idle extended interfaces at random intervals; the physical layer detects if the communication pin level is pulled down outside the active pulling-down time to determine if an unjoined node is connected; otherwise, no unjoined node is connected.

3. The device networking method as described in claim 2, characterized in that, The network layer of the extended interface uses a half-duplex single-wire universal asynchronous transceiver for communication. Information transmission in a network can only occur between two directly connected nodes. Before any node joins the current network, power is only supplied for communication when connecting through the extended interface.

4. The device networking method as described in claim 3, characterized in that, Communication between two directly connected nodes includes: Normally, the upper-level node sends information to the lower-level node, and the lower-level node responds with information to the upper-level node before the timeout period. Information loss scenario: An upper-level node sends information to a lower-level node, but the lower-level node does not respond before the timeout period. After the upper-level node resends the information to the lower-level node, the lower-level node responds to the upper-level node before the timeout period. Node removal scenario: When an upper-level node sends a message to a lower-level node, and the lower-level node does not respond before the timeout period, and this is repeated multiple times and the lower-level node still does not respond before the timeout period, the node is determined to have been removed.

5. The device networking method as described in claim 3, characterized in that, The address encoding of a node is based on bytes as the addressing unit, with one byte representing one node address. During addressing, the addressing content of an intermediate node is not transmitted to the lower-level node. Communication uses data packets for information transmission. Data packets include actively sent data packets and responding data packets. The sending commands of 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 responding data packets include: node information, node time information, node status information, and switching network responses.

6. The device networking method as described in claim 5, characterized in that, The process of synchronizing time includes: The upper-layer network triggers and records the number of network time units, which is then sent to the upper-layer node. The upper-layer node calculates the initial value of the calibration time difference transmitted from the upper-layer node to the lower-layer node, and sends the synchronization time data packet containing the initial value of the time difference to the lower-layer node through a universal asynchronous transceiver; The lower-level node's universal asynchronous transceiver receives synchronous time data packets; The lower-level network triggers the recording of network time units, sends them to the lower-level nodes, and calculates the actual value of the calibration time difference in real time to achieve time difference calibration.

7. The device networking method as described in claim 1, characterized in that, The decision to switch network relationships for unjoined nodes is based on the maximum supported layers of the root node, the number of network layers, or the current node's layer number. This includes: selecting the network with the larger maximum supported layers of the root node as the successor network, and switching the network relationship for unjoined nodes; if the maximum supported layers of the root nodes of the two networks are the same, selecting the network with the larger network layer number as the successor network, and switching the network relationship for unjoined nodes; if the maximum supported layers of the root nodes and the number of network layers of the two networks are the same, selecting the network with the larger current node layer as the successor network, and switching the network relationship for unjoined nodes; if all the above conditions are met, selecting the network with already joined nodes as the successor network, and switching the network relationship for unjoined nodes.

8. The device networking method as described in claim 7, characterized in that, The process of switching network relationships includes: A node that has joined sends a command to a node that has not joined to obtain node information. The node that has not joined responds with node information indicating that it is in another network. A node that has joined the network sends a command to a node that has not joined the network relationship to switch the network relationship; the node that has not joined responds by waiting for the switch. The parent node of a node that has not joined synchronizes its time with the node that has not joined. The node that has joined sends a network switching command to the node that has not joined again. The node that has not joined determines the network switching relationship and responds with a switch agreement. A joined node sends a command to a non-joined node to retrieve node status information, and the non-joined node responds that it is switching over. A node that has not joined sends a command to an upper-level node to switch network relationships, and the upper-level node responds with agreement to the switch. The unjoined node sends a command to the upper-level node to obtain node information, and the upper-level node responds that the switchover is complete. The joined node sends a command to the non-joined node to obtain node status information, and the non-joined node responds that the switchover is complete; A node that has joined sends a command to a node that has not joined to retrieve node information, and the node that has not joined responds by updating its node list.

9. A device networking system, characterized in that, The device networking system is used to perform the device networking method as described in any one of claims 1 to 8, the device networking system comprising: one or more processors; a storage device for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to 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 the processor, it implements the device networking method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Transformer area low-voltage loss control system and method

    CN112152321A

  • Wireless mobile ad hoc communication method and system

    CN112423364A