CN112787898B - Device data communication method, device, electronic device and storage medium - Google Patents

Device data communication method, device, electronic device and storage medium Download PDF

Info

Publication number
CN112787898B
CN112787898B CN202011593892.2A CN202011593892A CN112787898B CN 112787898 B CN112787898 B CN 112787898B CN 202011593892 A CN202011593892 A CN 202011593892A CN 112787898 B CN112787898 B CN 112787898B
Authority
CN
China
Prior art keywords
node
address
determining
target
executing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011593892.2A
Other languages
Chinese (zh)
Other versions
CN112787898A (en
Inventor
林羽帆
张强
郑锡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Midea Group Co Ltd
GD Midea Air Conditioning Equipment Co Ltd
Original Assignee
Midea Group Co Ltd
GD Midea Air Conditioning Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Midea Group Co Ltd, GD Midea Air Conditioning Equipment Co Ltd filed Critical Midea Group Co Ltd
Priority to CN202011593892.2A priority Critical patent/CN112787898B/en
Publication of CN112787898A publication Critical patent/CN112787898A/en
Application granted granted Critical
Publication of CN112787898B publication Critical patent/CN112787898B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/2803Home automation networks
    • H04L12/2807Exchanging configuration information on appliance services in a home automation network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Abstract

The invention relates to the technical field of communication, and provides a device data communication method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: the execution node determines communication data with a target node address, and the execution node has the execution node address; and determining a node to be received according to the executing node address and the target node address, and transmitting the communication data to the node to be received. The method, the device, the electronic equipment and the storage medium for equipment data communication are suitable for data communication in a tree network, and the addresses of all nodes are configured in an address configuration mode based on the bifurcation number and the hierarchy number of the tree network, so that all nodes can determine the transmission path of data according to the node addresses and the target node addresses, the data can be ensured to only have the target node addresses in the transmission process, other node information is not required to be added, the integrity of data encapsulation is kept, and the phenomenon that invalid data is excessively lengthy is avoided.

Description

Device data communication method, device, electronic device and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a device data communication method and apparatus, an electronic device, and a storage medium.
Background
At present, in the instant messaging of devices in a local home environment, a plurality of connections of the devices can be maintained, so that a node network is formed, and each device corresponds to one node. As the number of network nodes increases, the communication paths between local devices are continuously lengthened. Data sent by a device to another device in the network is often sent to the device through a cloud server addressing determination path, the address of the device is long, and the situations of less effective data and overstaffed invalid data can occur after the address of a heavy node is repackaged.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides an equipment data communication method which is suitable for data communication in a tree network, a carry counting system is determined based on the bifurcation number of the tree network, the content form of node addresses is determined, and a conversion relation between the node addresses is established based on the hierarchy number of the tree network, so that only a target node address is needed in the transmission process, a data transmission path from a source node to the target node can be determined based on the conversion relation, other node information is not needed to be added, the integrity of data encapsulation is kept, and the situation that invalid data is too lengthy is avoided.
The invention also provides a device data communication device, an electronic device and a storage medium.
The method for the data communication of the equipment is applied to a tree network formed by the connection of nodes, each node corresponds to one equipment, the node has a node address, and the node address is determined based on the branching number and the hierarchy number of the tree network; the method comprises the following steps:
an executing node determines communication data with a target node address, wherein the executing node is a source node or an intermediate node and is provided with an executing node address;
and the executing node determines a node to be received according to the executing node address and the target node address, and transmits the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node.
The device data communication method provided by the embodiment of the invention also has the following additional technical characteristics:
further, the determining a node to be received according to the executing node address and the target node address includes:
determining the layer levels of the execution nodes and the target nodes in the tree network according to the execution node addresses and the target node addresses;
determining a comparison result between the number of levels of the executing node and the target node in the tree network;
determining a candidate node address according to the target node address and the bifurcation number of the current tree network, wherein the candidate node address is the node address of a node in the tree where the target node is located, the node is at the same level as the executing node, and the tree is a link from the root node to the target node;
determining a matching result between the executing node address and the candidate node address;
and determining the node to be received according to the comparison result, the matching result and the routing table stored in the execution node.
Further, the determining a node to be received according to the comparison result, the matching result, and the routing table stored in the executing node includes:
and determining the comparison result as that the hierarchy number of the execution node is smaller than that of the target node, and determining the matching result as that the candidate node address is different from the execution node address, so that the superior node of the execution node is used as the node to be received.
Further, determining a node to be received according to the comparison result, the matching result and the routing table stored in the executing node, including:
and determining that the hierarchy number of the execution node is smaller than that of the target node as a comparison result, determining that the candidate node address is the same as the execution node address, and determining the node to be received in the branch where the target node is located according to the routing table stored in the execution node.
Further, the determining the candidate node address according to the target node address and the bifurcation number of the current tree network includes:
determining the level number of the target node in the tree network according to the target node address;
calculating candidate node addresses by k circulation times by adopting a first formula according to the target node address, the branching number and the hierarchy number of the current tree network;
wherein the first formula comprises:
INDEXex=INDEXself-(M-1)*MN+1-
B*MN-1+(M-1)*MN
wherein, INDEXexBeing node addresses of superordinate nodes, INDEXselfIs the node address of the node at this level, M is the number of bifurcationsN is the level number of the subordinate node, B takes values from 1 to M, and k is a positive integer.
Further, the determining a node to be received according to the comparison result, the matching result, and the routing table stored in the executing node includes:
and determining that the hierarchy number of the execution node is greater than or equal to that of the target node as a comparison result, and enabling the superior node of the execution node to be used as a node to be received.
Further, before determining a node to be received according to the executing node address and the target node address, the method further includes:
and the executing node determines that the executing node address is the same as the target node address, and processes the communication data.
Further, the method also comprises a step of determining the node address, which comprises the following steps:
determining the root node address of the root node according to the bifurcation number of the current tree network;
calculating the node address of each node by s circulation times by adopting a second formula according to the root node address, the branching number and the hierarchy number of the current tree network;
wherein the second formula comprises:
INDEXnext=INDEXself&(~MN)+B*MN-1+(M-1)*MN+1
wherein, INDEXnextBeing node addresses of subordinate nodes, INDEXselfIs the node address of the node at the current level, M is the bifurcation number, N is the level number of the lower level node, B takes values from 1 to M, s is a positive integer,&bit and symbol, -bit inverse symbol.
The device data communication device of the embodiment of the second aspect of the invention is applied to a tree network formed by connecting nodes, each node corresponds to one device, the node has a node address, and the node address is determined based on the branching number and the hierarchy number of the tree network; the device comprises:
the receiving module is used for determining communication data with a target node address;
the processing module is used for determining a node to be received according to an executing node address and the target node address and transmitting the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node;
the receiving module and the processing module belong to an execution node, and the execution node is a source node or an intermediate node and is provided with an execution node address.
An electronic device according to a third aspect of the invention comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the device data communication method as described above when executing the program.
A non-transitory computer-readable storage medium of a fourth aspect of the invention, having stored thereon a computer program which, when executed by a processor, carries out the steps of the device data communication method as described above.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart diagram of a data communication method of the apparatus of the present invention;
FIG. 2 is a schematic diagram of node relationships for a binary tree network of the present invention;
FIG. 3 is a node address relationship diagram based on a binary tree network according to the present invention;
FIG. 4 is a node address relationship diagram based on a ternary tree network according to the present invention;
FIG. 5 is a schematic diagram of the data communication device of the apparatus of the present invention;
fig. 6 is a schematic structural diagram of the electronic device of the present invention.
Detailed Description
The embodiments of the present invention will be described in further detail with reference to the drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Fig. 1 shows a schematic flow chart of a device data communication method provided by the present invention, which is applied to a tree network formed by connections between nodes, where the tree network may be a binary tree, a ternary tree, or a quadtree network. The tree network can be constructed by a WiFi + BLE mode, or a BLE mode or a WiFi mode. In the tree network, each node corresponds to a device (such as an intelligent refrigerator, an intelligent air conditioner, an intelligent television and the like), and each node has a unique node address.
In the invention, the node address completes configuration in a carry count system. For example, in a binary tree network, node addresses are configured in binary; in the ternary tree network, the node addresses are configured in ternary, and in the G-ary tree network, the node addresses are configured in G-ary. G is a positive integer.
In the tree network, after the number of branches is determined, the number of lower nodes of each node in the tree network is the same as the number of branches. Therefore, once the tree network is constructed, the bifurcation number of all nodes in the network is regarded as fixed, and the maximum bifurcation number and the minimum bifurcation number existing in the network are the same.
Since the node addresses mentioned above are configured in a carry count system, the branch number of the tree network is used to determine the carry count system of the node addresses.
Since each node will build the subordinate nodes according to the construction requirement of the bifurcated network. Therefore, each node has a hierarchy number matched with its own hierarchy in the tree network. For example, the source node is level 0, the subsequent nodes are sequentially configured to be level 1, 2, 3, 4, 5 … n in sequence, and n is a positive integer.
In the tree network, the root node is used as a host to connect with the secondary nodes (slaves), the secondary nodes are used as hosts to connect with the tertiary nodes (slaves), and each node can be connected with a plurality of lower-level nodes. Fig. 2 is a schematic diagram of node relationship of a binary tree network. The connection relationship between the nodes and the hierarchy of the nodes in the tree network can be seen in fig. 2.
In the present invention, the node address of the node is determined based on the number of branches and the number of hierarchies of the tree network. In the process of constructing the tree network, a source node is configured first, and at the moment, the address of the source node is configured based on the carry count determined by the branch number. And then configuring the address of the next-level node of the source node. At this time, the node address needs to complete numerical calculation based on the address of the source node according to the level number of the next-level node of the source node in the network and a preset calculation rule (such as a calculation formula), so as to obtain a carry count value corresponding to the address of the next-level node of the source node, and the carry count value is used as the node address of the next-level node of the source node. The node address allocation of the next-level node of the subsequent source node and the node address allocation of the subsequent subordinate node are realized according to the allocation process.
Therefore, the node address of the node is determined based on the number of the branches and the number of the levels of the tree network, and actually, the expression mode of the node address is determined according to the number of the branches, and then the node address of the node of the address to be configured is configured according to the node address of the upper node of the address to be configured and the number of the levels where the node of the address to be configured is located.
Communication data is transmitted between nodes in the tree network. The communication data is initiated by the source node and finally transmitted to the target node. The source node and the target node are both nodes in a tree network.
And transmitting the communication data to the target node, and performing subsequent processing by the target node. And if the source node needs to pass through other nodes from the target node, taking the other nodes as intermediate nodes on a transmission path corresponding to the communication data. And if the source node does not need to pass through other nodes to the target node, no intermediate node exists on a transmission path corresponding to the communication data.
The communication data is sent out by the source node and sent out again at the intermediate node, and finally reaches the target node. Therefore, the sending process of the communication data on the source node and the intermediate node is the same. Therefore, in the present invention, the description of the method is described in terms of the execution action of one node, and in this description, the source node or the intermediate node that processes the communication data is collectively referred to as an execution node.
As shown in fig. 1, the method comprises the steps of:
11. the execution node determines communication data with a target node address, is a source node or an intermediate node and is provided with the execution node address;
12. and the executing node determines a node to be received according to the executing node address and the target node address, and transmits the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node.
With respect to step 11 and step 12, it should be noted that, in the present invention, the executing node receives the communication data. The communication data includes a node address of the target node, that is, a target node address. Meanwhile, the executing node can acquire the own node address, namely the executing node address.
The communication data is processed at the executing node, and the processing result is sent to the target node by the executing node. During the process of the communication data reaching the target node, further transit by other nodes may exist. For this reason, the executing node needs to determine the nodes for relaying the communication data according to the executing node address and the destination node address, these nodes are called to-be-received nodes, and the to-be-received nodes are nodes for receiving the communication data next time. And if the current execution node can directly transmit the communication data to the target node, the target node is the node to be received. And if the current execution node can not directly transmit the communication data to the target node, the node for transferring the communication data is the node to be received.
As can be seen from the above description of the node address, the node address is configured in a carry count system. Therefore, in the invention, the execution node determines the node to be received according to the execution node address and the target node address, and actually, the address content of the execution node and the target node is obtained based on the carry counting system to determine the address content of the node to be received, so that the node to be received is determined according to the address content, and then the communication data is sent to the node to be received. Then, the node to be received is used as a new execution node to perform subsequent processing on the communication data.
The equipment data communication method provided by the invention is suitable for data communication in a tree network, a carry counting system is determined based on the bifurcation number of the tree network, the content form of the node address is determined, and the conversion relation between the node addresses is established based on the hierarchy number of the tree network, so that the data transmission path from a source node to a target node can be determined based on the conversion relation only by having the target node address in the transmission process, other node information is not required to be added, the integrity of data encapsulation is kept, and the phenomenon that invalid data is excessively lengthy is avoided.
In the further method of the present invention, the process of determining the node to be received according to the executing node address and the target node address is mainly explained, specifically as follows:
the execution node determines the hierarchy number of the execution node and the target node in the tree network according to the execution node address and the target node address;
determining a comparison result between the hierarchy numbers of the execution node and the target node in the tree network;
determining a candidate node address according to the target node address and the bifurcation number of the current tree network, wherein the candidate node address is the node address of a node in the tree where the target node is located, which is at the same level as the executing node, and the tree branch is a link from the root node to the target node;
determining a matching result between the executing node address and the candidate node address;
and determining the node to be received according to the comparison result, the matching result and the routing table stored in the execution node.
In this regard, it should be noted that, in the present invention, since the node address is based on the branch number determination carry count system of the tree network, the content form of the node address is determined, and the conversion relationship between the node addresses is established based on the hierarchy number of the tree network, so that the hierarchy of the node in the tree network can be determined according to the node address.
The hierarchy of the execution node and the target node can be seen, and the positions of the execution node and the target node are located, so that the comparison between the hierarchy numbers of the execution node and the target node in the tree network can show whether the execution node determines the node to be received in a downward direction or in an upward direction.
After the direction of searching the node to be received is determined, a candidate node address is determined according to the target node address and the bifurcation number of the current tree network.
And then matching the executing node address with the candidate node address to determine whether the two node addresses are the same address or not, so as to obtain a matching result.
And then, different addressing scenes can be obtained according to the comparison result and the matching result, and nodes to be received can be determined according to different preset selection modes corresponding to different scenes in different scenes. The selection mode represents the basis for selecting the node to be received in a certain scene.
In the present invention, when selecting the node to be received in different selection modes, the routing table stored in the executing node may be used for assistance, so as to achieve the purpose of determining the node to be received.
In the invention, the routing table stores the mapping relation between the node address and the node information in the network. Only the routing table of the root node stores the mapping relation between the node address and the node information in the whole network, and other nodes in the network only store the mapping relation between the node address and the node information of each lower node.
Therefore, in the invention, the addresses of some nodes on the branch where the target node is located can be determined according to the target node address and the bifurcation number of the current tree network, the nodes to be received are determined according to the relation between the node addresses and the executing node address, or after the relation between the node addresses and the executing node address is determined, the nodes to be received are determined according to the routing table stored in the executing node.
The further method of the invention adopts the comparison result between the layers of the execution node and the target node to determine the direction of searching the node to be received, and searches the node to be received in the specific direction, thereby reducing meaningless transmission paths.
In the further method of the above invention, the explanation mainly for the process of determining the node to be received according to the comparison result, the matching result and the routing table stored in the executing node is as follows:
1) and determining that the hierarchy number of the execution node is smaller than that of the target node, and determining that the candidate node address is different from the execution node address, so that the superior node of the execution node is used as the node to be received.
There is a scenario, as shown in fig. 2, which is a schematic diagram of node relationships in a certain tree network. Referring to fig. 2, a node a is a root node, a node E is an execution node, and a node H is a target node. And determining respective hierarchy numbers of 2 and 3 according to the node address of the node E and the node address of the node H. Therefore, the hierarchy number of the execution node is determined to be smaller than the hierarchy number of the target node (namely 2 is less than 3, which is equivalent to the level of the 2 nd layer higher than the level of the 3 rd layer), and at this time, the node address of the node in the branch where the target node is located and the node in the same hierarchy as the execution node is calculated by a preset calculation formula according to the target node address and the branching number of the current tree network.
Referring to fig. 2, the branch on which node H is located is A, B, D, H. The node D and the node E on the branch belong to the same level, and therefore the node address of the node D can be obtained through calculation.
And determining that the node address of the node D is different from the node address of the node E, wherein at the moment, a superior node B of the executing node is required to be used as a node to be received.
2) And determining that the hierarchy number of the execution node is smaller than that of the target node, determining that the candidate node address is the same as the execution node address, and determining the node to be received in the branch where the target node is located according to the routing table stored in the execution node.
There is a scenario, as shown in fig. 2, which is a schematic diagram of node relationships in a certain tree network. Referring to fig. 2, node a is a root node, node B is an executing node, and node H is a target node. The respective numbers of hierarchies are determined according to the node address of the node B and the node address of the node H, and are 1 and 3 respectively. Therefore, the hierarchy number of the execution node is determined to be smaller than the hierarchy number of the target node (namely 1 is less than 3, which is equivalent to the level of the 1 st layer is higher than the level of the 3 rd layer), and at this time, the node address of the node in the branch where the target node is located, which is at the same level as the execution node, is calculated by a preset calculation formula according to the target node address and the branching number of the current tree network.
Referring to fig. 2, the branch on which node H is located is A, B, D, H. Therefore, the node in the tree where the target node is located and at the same level as the executing node can only be the node B, that is, the node address of the node on the tree is the same as the executing node address.
Next, the node to be received in the branch where the node H is located needs to be determined according to the routing table stored in the node B.
The routing table stored by node B includes the node addresses of node D and node E, with node D being on the branch of node H. For this reason, the node D serves as a node to be received.
3) And determining that the hierarchy number of the execution node is greater than or equal to that of the target node, and enabling the superior node of the execution node to serve as a node to be received.
There is a scenario, as shown in fig. 2, which is a schematic diagram of node relationships in a certain tree network. Referring to fig. 2, node a is a root node, node H is an executing node, and node B is a target node. The respective numbers of hierarchies are determined according to the node address of the node H and the node address of the node B, and are 3 and 1, respectively. Therefore, the hierarchy number of the execution node is larger than that of the target node (namely 3 is less than 1, namely the level of the 3 rd layer is lower than that of the 1 st layer), at this time, the communication data can only be sent to the upper node D of the execution node, and the upper node D is used as a node to be received.
There is a scenario, as shown in fig. 2, which is a schematic diagram of node relationships in a certain tree network. Referring to fig. 2, node a is a root node, node D is an executing node, and node E is a target node. And determining respective hierarchy numbers of 2 and 2 according to the node address of the node D and the node address of the node E. Therefore, it can be determined that the number of hierarchical levels of the executing node is equal to the number of hierarchical levels of the target node (i.e., 2 is 2, which is equivalent to two nodes in the same hierarchical level), and at this time, the communication data can only be sent to the upper node B of the executing node, and the upper node B serves as a node to be received.
In addition, before determining the node to be received according to the executing node address and the target node address, that is, after the executing node receives the communication data, it is determined whether the executing node address is the same as the target node address, if so, it indicates that the executing node is the target node, and the communication data is transmitted in place.
The further method of the invention adopts the comparison result between the layers of the execution node and the target node to determine the direction of searching the node to be received, and searches the node to be received in the specific direction, thereby reducing meaningless transmission paths.
In the further method of the present invention, the processing procedure of calculating the node address of the node in the branch where the target node is located and the node in the same level as the executing node according to the target node address and the branch number of the current tree network is explained, specifically as follows:
determining the level number of the target node in the tree network according to the target node address;
calculating the node address of a node in the same level as the execution node in the branch where the target node is located by adopting a first formula according to the target node address, the branching number and the level number of the current tree network and k circulation times;
wherein the first formula comprises:
INDEXex=INDEXself-(M-1)*MN+1-
B*MN-1+(M-1)*MN
wherein, INDEXexBeing node addresses of superordinate nodes, INDEXselfThe node address of the node at the current level, M is the bifurcation number, N is the level number of the nodes at the next level, B takes values from 1 to M, and k is a positive integer.
There is a scenario, as shown in fig. 2, which is a schematic diagram of node relationships in a certain tree network. Referring to fig. 2, a node a is a root node, a node E is an execution node, and a node H is a target node. The number of levels determined from the node address of the node H is 3. Based on the first formula, the node address of the node D at the same level as the node E can be calculated once.
There is a scenario, as shown in fig. 2, which is a schematic diagram of node relationships in a certain tree network. Referring to fig. 2, a node a is a root node, a node C is an execution node, and a node H is a target node. The number of levels determined from the node address of the node H is 3. Based on the first formula, the node address of the node B at the same level as the node C can be calculated twice.
The further method of the invention can rapidly determine the node address of the node in the tree branch where the target node is located and the node in the same level as the execution node based on the specific calculation mode, thereby facilitating the execution of the subsequent processing action.
In the further method of the invention, the process of determining the node address is mainly explained, which is specifically as follows:
determining the root node address of the root node according to the bifurcation number of the current tree network;
calculating the node address of each node by s circulation times by adopting a second formula according to the root node address, the branching number and the hierarchy number of the current tree network;
wherein the second formula comprises:
INDEXnext=INDEXself&(~MN)+B*MN-1+(M-1)*MN+1
wherein, INDEXnextBeing node addresses of subordinate nodes, INDEXselfIs the node address of the node at the current level, M is the bifurcation number, N is the level number of the lower level node, B takes values from 1 to M, s is a positive integer,&bit and symbol, -bit inverse symbol.
In this regard, it should be noted that, in the present invention, if the branch number of the current tree network is M, the root node address is a binary code corresponding to 2M-2. For example, the binary tree root address is 2M-2 ═ 2, i.e. binary is 00000010.
Referring to fig. 2, after the address configuration of the root node a, the address configuration is performed for the node B and the node C according to the second formula once, then the address configuration is performed for the node DEFG according to the second formula twice, and so on until the node addresses of all the nodes in the network are configured. After the address configuration is completed, each node correspondingly stores a routing table of the node.
The further method of the invention can rapidly configure the address for the node in the tree network based on the specific calculation mode, thereby facilitating the execution of the subsequent processing action.
In the further method of the invention, the process of determining the level of the node in the tree network is mainly explained, which is specifically as follows:
for a tree network formed among devices in a home environment, each address is converted into an 8-bit corresponding carry number to meet the requirement, and the number of ' 0 ' bits which is calculated from high bits to the first non-0 ' is the Count according to the node address of the 8-bit number0The hierarchy of nodes can be calculated using the following third formula.
N=8-count0-2
The further method of the invention can be specially adapted to the configuration mode of the address based on the specific calculation mode, and can quickly calculate the hierarchy of the nodes in the tree network, thereby facilitating the execution of the subsequent processing action.
The above method is generally described below by specific examples, which are as follows:
as shown in fig. 3, a binary tree network is constructed by triggering from a node a, and a communication data is issued from a node G in the network and directed to a node L.
1. Node a connects to the slave devices, and assigns addresses B (00000101) and C (00000110) by reference to the second formula.
2. Node B, C is connected to the slave devices, respectively, and assigns address D, E, F, G.
3. Level 2 four nodes D, E, F, G connect the upper slave and assign address H, I, J, K, L, M, N, O.
4. The node L address resolves to a binary 00011000. The calculation level is 8-3-2-3 level according to the third formula.
5. The node G address resolves to binary 00001110. The calculation level is 8-4-2 ═ 2 according to the third formula.
6. From the node G address, the communication data is not directed to the node G, and the L address level is lower than the node G. The address of the node in the branch where the L address is located at the same level as the node G is calculated. Substituting the first equation calculates the address to be 00001100, which is not the node G address. The communication data is issued to the upper address of the node G.
7. The upper address of the node G is C00000110. The calculation level is level 1 according to the third formula.
8. From the node C address, the communication data is not directed to the node C, and the L address level is lower than the node C. The address of the node in the tree branch where the L address is located at the same level as the node C is calculated. Substituting into the first formula calculates the address as 00000110, which is the node C address.
9. And calculating whether the node in the same level as the lower-level address of the node C in the branch where the node L is located exists in the routing table of the node C. If it already exists, it is node F00001100, and the communication data is distributed to this node F.
10. The address of node F is 00001100. The hierarchy is calculated as level 2 according to a third formula.
11. From the node F address, the communication data is not directed to the node F. And the L address level is lower than node F. The address of the node in the branch where the L address is located at the same level as node F is calculated. Substituting the formula calculates the address to be 00001100. This address is the node F address.
12. And calculating whether the node in the same level as the lower-level address of the node F exists in the routing table of the node F or not in the branch where the node L is located. Already existing, node L00011000. The communication data is distributed to the node L.
13. The node L is a destination address of communication data. The node L starts processing the data, and the communication data completes one optimal path transmission.
As shown in fig. 4, the construction of the ternary tree network is triggered from node a, and node L issues a communication data to node B.
1. The node L address resolves to a ternary 00002100, which is calculated according to a third formula to a level 8-4-2.
2. The target node B resolves to a ternary 00000201, and calculates a level 8-5-2 to 1 according to the third formula.
3. Since the communication data is not directed to the node L and the node B hierarchy is higher than the node L, the communication data is directly sent to the upper node D (00000210).
4. From the node D address, the communication data is not directed to the node D, and the node B hierarchy is the same as the node D, so the data is sent directly to the upper node a (00000020).
5. From the node a address, the communication data is not directed to the node a, and the node B level is lower than the node a level. And node a is located on node B on the same branch. And calculating the lower level address of the node A in the branch, searching the node B from the lower level routing table of the node A, and sending the communication data to the node B.
6. From the node B, the communication data points to itself, and the node B starts processing the data, which completes an optimal path transmission.
Fig. 5 is a schematic structural diagram of a device data communication apparatus according to the present invention, which is applied to a tree network formed by connections between nodes, where each node corresponds to a device, and the node has a node address, and the node address is determined based on the number of branches and the number of levels of the tree network. Referring to fig. 5, the apparatus comprises a receiving module 51 and a processing module 52, wherein:
a receiving module 51, configured to determine communication data with a target node address;
the processing module 52 is configured to determine a node to be received according to the executing node address and the target node address, and transmit the communication data to the node to be received, where the node to be received is an intermediate node or a target node;
the receiving module and the processing module belong to an execution node, and the execution node is a source node or an intermediate node and is provided with an execution node address.
In the further apparatus of the above invention, the processing module, in the process of determining the node to be received according to the executing node address and the target node address, is specifically configured to:
determining a comparison result between the number of levels of the executing node and the target node in the tree network;
determining a candidate node address according to the target node address and the bifurcation number of the current tree network, wherein the candidate node address is the node address of a node in the tree where the target node is located, the node is at the same level as the executing node, and the tree is a link from the root node to the target node;
determining a matching result between the executing node address and the candidate node address;
and determining the node to be received according to the comparison result, the matching result and the routing table stored in the execution node.
In the further apparatus of the above invention, the processing module, in the process of determining the node to be received according to the comparison result, the matching result, and the routing table stored in the executing node, is specifically configured to:
and determining that the hierarchy number of the execution node is smaller than that of the target node, and determining that the candidate node address is different from the execution node address, so that a superior node of the execution node is used as a node to be received.
Or, determining that the hierarchy number of the execution node is smaller than that of the target node, determining that the candidate node address is the same as the execution node address, and determining the node to be received in the branch where the target node is located according to the routing table stored in the execution node.
Or, determining that the hierarchy number of the execution node is greater than or equal to that of the target node, and enabling the superior node of the execution node to serve as the node to be received.
In a further apparatus of the above invention, the processing module is further configured to: and determining that the address of the executing node is the same as the address of the target node, and processing the communication data.
In the above further apparatus of the invention, the processing module, in the process of determining the candidate node address according to the target node address and the bifurcation number of the current tree network, is specifically configured to:
determining the level number of the target node in the tree network according to the target node address;
calculating candidate node addresses by k circulation times by adopting a first formula according to the target node address, the branching number and the hierarchy number of the current tree network;
wherein the first formula comprises:
INDEXex=INDEXself-(M-1)*MN+1-
B*MN-1+(M-1)*MN
wherein, INDEXexBeing node addresses of superordinate nodes, INDEXselfThe node address of the node at the current level, M is the bifurcation number, N is the level number of the nodes at the next level, B takes values from 1 to M, and k is a positive integer.
In a further apparatus of the above invention, the apparatus further comprises a configuration module, configured to:
determining the root node address of the root node according to the bifurcation number of the current tree network;
calculating the node address of each node by s circulation times by adopting a second formula according to the root node address, the branching number and the hierarchy number of the current tree network;
wherein the second formula comprises:
INDEXnext=INDEXself&(~MN)+B*MN-1+(M-1)*MN+1
wherein, INDEXnextBeing node addresses of subordinate nodes, INDEXselfIs the node address of the node at the current level, M is the bifurcation number, N is the level number of the lower level node, B takes values from 1 to M, s is a positive integer,&bit and symbol, -bit inverse symbol.
Since the inventive apparatus has the same principle as the inventive method described above, further explanation is omitted here.
It should be noted that, in the present invention, the relevant functional modules may be implemented by a hardware processor (hardware processor).
The device data communication apparatus provided in the above embodiment is suitable for data communication in a tree network, and configures addresses of nodes in an address configuration manner based on a bifurcation number and a hierarchy number of the tree network, so that each node can determine a transmission path of data according to a node address of the node and a target node address, and in a transmission process, it can be ensured that data only needs to have the target node address, no other node information needs to be added, integrity of data encapsulation is maintained, and invalid data is not excessively redundant.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor)61, a communication Interface (communication Interface)62, a memory (memory)63 and a communication bus 64, wherein the processor 61, the communication Interface 62 and the memory 63 complete communication with each other through the communication bus 64. The processor 61 may call logic instructions in the memory 63 to perform the following method: determining communication data with a target node address; and determining a node to be received according to the executing node address and the target node address, transmitting the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node, and the executing node is a source node or an intermediate node and is provided with the executing node address.
Furthermore, the logic instructions in the memory 63 may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Embodiments of the present invention further provide a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the method provided in the foregoing embodiments when executed by a processor, and the method includes: determining communication data with a target node address; and determining a node to be received according to the executing node address and the target node address, transmitting the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node, and the executing node is a source node or an intermediate node and is provided with the executing node address.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. The method is applied to a tree network formed by the connection of nodes, each node corresponds to one device, the nodes have node addresses, and the node addresses are determined based on the number of branches and the number of levels of the tree network; the method comprises the following steps:
an executing node determines communication data with a target node address, wherein the executing node is a source node or an intermediate node and is provided with an executing node address;
the executing node determines a node to be received according to the executing node address and the target node address, and transmits the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node;
wherein, the determining a node to be received according to the executing node address and the target node address comprises:
determining the layer levels of the execution nodes and the target nodes in the tree network according to the execution node addresses and the target node addresses;
determining a comparison result between the number of levels of the executing node and the target node in the tree network;
determining a candidate node address according to the target node address and the bifurcation number of the current tree network, wherein the candidate node address is the node address of a node in the tree where the target node is located, the node is at the same level as the executing node, and the tree is a link from the root node to the target node;
determining a matching result between the executing node address and the candidate node address;
and determining the node to be received according to the comparison result, the matching result and the routing table stored in the execution node.
2. The device data communication method according to claim 1, wherein the determining a node to be received according to the comparison result, the matching result, and the routing table stored in the executing node comprises:
and determining the comparison result as that the hierarchy number of the execution node is smaller than that of the target node, and determining the matching result as that the candidate node address is different from the execution node address, so that the superior node of the execution node is used as the node to be received.
3. The device data communication method according to claim 1, wherein the determining a node to be received according to the comparison result, the matching result, and the routing table stored in the executing node comprises:
and determining that the hierarchy number of the execution node is smaller than that of the target node as a comparison result, determining that the candidate node address is the same as the execution node address, and determining the node to be received in the branch where the target node is located according to the routing table stored in the execution node.
4. The device data communication method according to claim 2 or 3, wherein the determining the candidate node address according to the target node address and the bifurcation number of the current tree network comprises:
determining the level number of the target node in the tree network according to the target node address;
calculating candidate node addresses by k circulation times by adopting a first formula according to the target node address, the branching number and the hierarchy number of the current tree network;
wherein the first formula comprises:
INDEXex=INDEXself-(M-1)*MN+1-B*MN-1+(M-1)*MN
wherein, INDEXexBeing node addresses of superordinate nodes, INDEXselfThe node address of the node at the current level, M is the bifurcation number, N is the level number of the nodes at the next level, B takes values from 1 to M, and k is a positive integer.
5. The device data communication method according to claim 1, wherein the determining a node to be received according to the comparison result, the matching result, and the routing table stored in the executing node comprises:
and determining that the hierarchy number of the execution node is greater than or equal to that of the target node as a comparison result, and enabling the superior node of the execution node to be used as a node to be received.
6. The device data communication method according to claim 1, wherein before determining a node to be received from the executing node address and the target node address, further comprising:
and the executing node determines that the executing node address is the same as the target node address, and processes the communication data.
7. The device data communication method according to claim 1, wherein said method further comprises a node address determination step comprising:
determining the root node address of the root node according to the bifurcation number of the current tree network;
calculating the node address of each node by s circulation times by adopting a second formula according to the root node address, the branching number and the hierarchy number of the current tree network;
wherein the second formula comprises:
INDEXnext=INDEXself&(~MN)+B*MN-1+(M-1)*MN+1
wherein, INDEXnextBeing node addresses of subordinate nodes, INDEXselfIs the node address of the node at the current level, M is the bifurcation number, N is the level number of the lower level node, B takes values from 1 to M, s is a positive integer,&bit and symbol, -bit inverse symbol.
8. The device data communication device is applied to a tree network formed by connection among nodes, each node corresponds to one device, the nodes are provided with node addresses, and the node addresses are determined based on the number of branches and the number of levels of the tree network; the device comprises:
the receiving module is used for determining communication data with a target node address;
the processing module is used for determining a node to be received according to an executing node address and the target node address and transmitting the communication data to the node to be received, wherein the node to be received is an intermediate node or a target node;
the receiving module and the processing module belong to an execution node, and the execution node is a source node or an intermediate node and is provided with an execution node address;
wherein, the processing module is specifically configured to, in a process of determining a node to be received according to an executing node address and the target node address:
determining the layer levels of the execution nodes and the target nodes in the tree network according to the execution node addresses and the target node addresses;
determining a comparison result between the number of levels of the executing node and the target node in the tree network;
determining a candidate node address according to the target node address and the bifurcation number of the current tree network, wherein the candidate node address is the node address of a node in the tree where the target node is located, the node is at the same level as the executing node, and the tree is a link from the root node to the target node;
determining a matching result between the executing node address and the candidate node address;
and determining the node to be received according to the comparison result, the matching result and the routing table stored in the execution node.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the device data communication method according to any of claims 1 to 7 are implemented when the processor executes the program.
10. A non-transitory computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the device data communication method according to any one of claims 1 to 7.
CN202011593892.2A 2020-12-29 2020-12-29 Device data communication method, device, electronic device and storage medium Active CN112787898B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011593892.2A CN112787898B (en) 2020-12-29 2020-12-29 Device data communication method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011593892.2A CN112787898B (en) 2020-12-29 2020-12-29 Device data communication method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN112787898A CN112787898A (en) 2021-05-11
CN112787898B true CN112787898B (en) 2022-03-04

Family

ID=75753239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011593892.2A Active CN112787898B (en) 2020-12-29 2020-12-29 Device data communication method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN112787898B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637371A (en) * 2020-07-31 2021-04-09 深圳优地科技有限公司 Node address determination method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FI103544B1 (en) * 1996-03-25 1999-07-15 Nokia Telecommunications Oy Procedure for determining addresses in a data network node
US6192051B1 (en) * 1999-02-26 2001-02-20 Redstone Communications, Inc. Network router search engine using compressed tree forwarding table
CN110138839B (en) * 2019-04-17 2020-08-18 华南理工大学 Internet of things address fast searching method based on eight-Diagram-array binary tree arrangement of book of changes

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637371A (en) * 2020-07-31 2021-04-09 深圳优地科技有限公司 Node address determination method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112787898A (en) 2021-05-11

Similar Documents

Publication Publication Date Title
KR102162730B1 (en) Technologies for distributed routing table lookup
CN108243103B (en) Apparatus, system and method for distributing routing protocol information in a clos network
US20200059412A1 (en) SDN Network System, Controller, and Controlling Method
CN109451540B (en) Resource allocation method and equipment for network slices
CN112260848B (en) Configuration method and device of virtual network function
CN105991660B (en) System for resource sharing among multiple cloud storage systems
CN104717081A (en) Gateway function realization method and device
JP2004208297A (en) System and method for rapid selection of device in tree topology network
CN111147372B (en) Downlink message sending and forwarding method and device
US20170289655A1 (en) Optical Network-On-Chip, Optical Router, and Signal Transmission Method
US11398981B2 (en) Path creation method and device for network on chip and electronic apparatus
KR101754618B1 (en) A method and apparatus for generating dinamic virtual network based on software defined networks
CN112543151B (en) SDN controller deployment method and device, electronic equipment and storage medium
CN108347377B (en) Data forwarding method and device
CN106789664B (en) Route aggregation method and device
CN112787898B (en) Device data communication method, device, electronic device and storage medium
US20200336385A1 (en) BGP Logical Topology Generation Method, and Device
CN114615179A (en) Message transmission method, device and system
CN117081648A (en) Satellite control method and device and electronic equipment
CN116055446B (en) Cross-network message forwarding method, electronic equipment and machine-readable storage medium
CN116915708A (en) Method for routing data packets, processor and readable storage medium
US9294399B2 (en) Method for learning media access control address, network device, and system
CN109451090A (en) A kind of domain name analytic method and device
CN110636005B (en) Knowledge routing method and device of knowledge center network
CN101989946B (en) Compression method of communication equipment route forwarding table

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant