Disclosure of Invention
In view of this, the present invention provides a method for constructing a hybrid mesh network, a method for transmitting data, and a device thereof, which reduce the influence of signal interference on the mesh network and improve the data transmission efficiency.
The embodiment of the invention provides a method for constructing a hybrid mesh network, which comprises the following steps:
constructing a plurality of different wireless mesh networks on a data link layer;
adding a fusion layer between the data link layer and the network layer;
and distributing a new node address for each host node of the mesh network at the fusion layer to form a hybrid mesh network.
Optionally, the multiple different wireless mesh networks include:
a mesh network based on Bluetooth and a mesh network based on Wi-Fi.
The embodiment of the invention provides a hybrid mesh network construction device, which comprises:
the device comprises a construction unit, a data link layer and a data transmission unit, wherein the construction unit is used for constructing a plurality of different wireless mesh networks on the data link layer;
an adding unit, configured to add a fusion layer between the link layer and the network layer;
and the distribution unit is used for distributing a new node address to the host node of each mesh network in the fusion layer.
The data transmission method provided by the embodiment of the invention is applied to a constructed hybrid mesh network, and comprises the following steps:
acquiring link parameters of each mesh network in the mixed mesh network;
determining the priority of each mesh network according to the link parameters of each mesh network;
selecting a mesh network with the highest priority as a target mesh network;
and transmitting the data message to a destination address through the target mesh network.
Optionally, the transmitting the data packet to the destination address through the target mesh network includes:
judging whether the address of the current host node is the same as the destination address or not;
if the address of the current host node is different from the destination address, judging whether the life time of the data message is zero;
if the current life time of the data message is not zero, judging whether the routing table of the current host node records the target address or not;
if the target address is recorded by the routing table of the current host node, reducing the life time of the data message by one;
sending the data message to a next hop host node of the current host node, taking the next hop host node as the current host node, and returning to execute to judge whether the address of the current host node is the same as the destination address;
and if the address of the current host node is the same as the destination address, ending the process.
Optionally, the method further includes:
if the target address is not recorded in the routing table of the current host node, generating the routing table with the target address as a main key by adopting a preset discovery protocol;
generating error information;
and feeding back the error information to the host node of the last hop of the current host node.
Optionally, the method further includes:
if the receiving node in the routing table can not receive the data message, deleting the routing information according to which the data message is transmitted in the routing table;
generating abnormal receiving information; the abnormal reception information includes: routing information and information reception failure reminding according to which the data message is transmitted;
and feeding back the abnormal receiving information to the sending node, and broadcasting the abnormal receiving information to other host nodes.
The data transmission device provided by the embodiment of the invention is applied to a constructed hybrid mesh network, and comprises the following components:
the acquiring unit is used for acquiring link parameters of each mesh network in the mixed mesh network;
a determining unit, configured to determine a priority of each mesh network according to the link parameter of each mesh network;
the selecting unit is used for selecting the mesh network with the highest priority as a target mesh network;
and the transmission unit is used for transmitting the data message to a destination address through the target mesh network.
Optionally, the transmission unit includes:
the first judging subunit is used for judging whether the address of the current host node is the same as the destination address or not;
a second determining subunit, configured to determine whether a lifetime of the data packet is zero, if the address of the current host node is different from the destination address;
a third determining subunit, configured to determine whether the routing table of the current host node records the target address if the current lifetime of the data packet is not zero;
the life time control unit is used for subtracting one from the life time of the data message if the target address is recorded by the routing table of the current host node;
a sending subunit, configured to send the data packet to a next-hop host node of a current host node, use the next-hop host node as the current host node, and return to execute the judgment of whether an address of the current host node is the same as a destination address;
and the ending unit is used for ending if the address of the current host node is the same as the destination address.
Optionally, the method further includes:
a first generating subunit, configured to generate, if the target address is not recorded in the routing table of the current host node, a routing table with the target address as a primary key by using a preset discovery protocol;
a second generating subunit, configured to generate error information;
and the feedback subunit is used for feeding back the error information to the host node of the last hop of the current host node.
The embodiment of the invention discloses a construction method of a hybrid mesh network and a data transmission method according to the hybrid mesh network. When data transmission is carried out, firstly, the priority of each mesh network is determined according to the link parameters of each mesh network in the mixed mesh network, and the target mesh network with the highest priority is determined, namely the target mesh network with the best transmission effect is determined, and the data message is transmitted to the destination address according to the target mesh network. Therefore, in the process of data transmission, a mesh network is not used singly for data transmission, but the mesh network with the highest transmission efficiency is selected for data transmission each time the data transmission is carried out. Therefore, the influence of signal interference on the mesh network is reduced, and the data transmission efficiency is improved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flowchart of a method for constructing a hybrid mesh network according to an embodiment of the present invention is shown, where the method includes:
s101: constructing a plurality of different wireless mesh networks on a data link layer;
as shown in fig. 2, which is a schematic diagram of 7 layers of protocol layers of the OSI network model, it can be known that the IOS network model includes: physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer. In this embodiment, a plurality of different mesh networks need to be built in the data link layer of the OSI network model, for example, a mesh network based on bluetooth and a mesh network based on Wi-Fi may be respectively built in the data link layer, which is specifically equivalent to building a mesh network based on bluetooth and a mesh network based on Wi-Fi in the data link layer.
Specifically, in the data link layer, the standard protocols of different radio frequency hardware are respectively adopted to construct respective mesh networks, specifically, the construction of the mesh network based on the bluetooth is based on the standard protocol of the bluetooth radio frequency hardware, and the construction of the mesh network based on the Wi-Fi is based on the standard protocol of the Wi-Fi radio frequency hardware.
S102: adding a fusion layer between the data link layer and the network layer;
in this embodiment, the execution sequence of S101 and S102 is not limited, and S101 may be executed first, and then S102 may be executed; or executing S101 after executing S102; alternatively, S101 and S102 may be performed simultaneously.
S103: and distributing a new node address for each host node of the mesh network at the fusion layer to form a hybrid mesh network.
In this embodiment, since the radio frequency hardware of each mesh network has its own address, in the hybrid mesh network, when the next hop node is selected, data cannot be transmitted to the radio frequency hardware addresses of other mesh networks through the radio frequency hardware address of one mesh network, so that a node address needs to be reassigned to the host node address of each mesh network, the newly assigned node address is used only in the fusion layer, and the physical layer of the specific mesh network still uses its own original radio frequency hardware address. Thus, the message with the newly allocated node address can carry out data transmission between the host nodes through any mesh network.
In this embodiment, it should be noted that the hybrid mesh network includes mesh networks of at least two different technologies, which may include: the mesh network based on Wi-Fi and the mesh network based on Bluetooth can also be mesh networks based on other transmission technologies.
In this embodiment, when a hybrid mesh network is constructed, a fusion layer is added between a data link layer and a network layer, and after a plurality of different mesh networks are constructed on the data link layer, a new node address is allocated to a host node of each mesh network on the fusion layer, so that the hybrid mesh network can transmit data packets according to the new node address.
Referring to fig. 3, a schematic structural diagram of a hybrid mesh network constructing apparatus according to an embodiment of the present invention is shown, where the apparatus includes:
a constructing unit 301, configured to construct a plurality of different wireless mesh networks on a data link layer;
an adding unit 302, configured to add a fusion layer between the link layer and the network layer;
and the allocating unit 303 is configured to allocate a new node address to each host node of the mesh network at the fusion layer, so as to form a hybrid mesh network.
Optionally, the multiple different wireless mesh networks include:
a mesh network based on Bluetooth and a mesh network based on Wi-Fi.
By the device of the embodiment, when the hybrid mesh network is constructed, the fusion layer is added between the data link layer and the network layer, and after a plurality of different mesh networks are constructed on the data link layer, a new node address is allocated to the host node of each mesh network on the fusion layer, so that the hybrid mesh network can transmit data messages according to the new node address.
Referring to fig. 4, a flowchart of a data transmission method provided in an embodiment of the present invention is shown, where in this embodiment, the method includes:
s401: acquiring link parameters of each mesh network in the mixed mesh network;
in this embodiment, the link parameters of the mesh network include: RSSI (English full name: Received Signal Strength), Hop Count from a target node, arrival time, packet loss rate and other parameters which can represent data transmission efficiency.
S402: determining the priority of each mesh network according to the link parameters of each mesh network;
in this embodiment, the priority of each mesh network may be determined according to the link parameter of each mesh network mentioned in S401.
For example, the following steps are carried out: after the link parameters of each mesh network are obtained, the link parameters of each network can be analyzed, and each link parameter is scored according to the analysis result, wherein different scores can represent the signal condition of the mesh network represented by the parameters, and the higher the score is, the better the signal of the mesh network is represented. And finally, according to the weights of different link parameters, adding and averaging the scores of the link parameters of each mesh network to obtain the priority value of the mesh network, wherein different priority values indicate that the mesh network has different priorities.
S403: selecting a mesh network with the highest priority as a target mesh network;
in this embodiment, when the data packet is transmitted, the mesh network with the strongest signal and the highest transmission efficiency needs to be selected, and in the mixed mesh network, the signal strengths of different mesh networks are represented by priorities, so the mesh network with the highest priority needs to be selected.
S404: and transmitting the data message to a destination address through the target mesh network.
In this embodiment, after determining the mesh network for transmitting the data packet, the data packet needs to be transmitted through the target mesh network, specifically, referring to fig. 5, S404 includes:
s501: judging whether the address of the current host node is the same as the destination address or not;
s502: if the address of the current host node is different from the destination address, judging whether the life time of the data message is zero;
s503: and if the current life time of the data message is zero, ending the process.
S504: if the current life time of the data message is not zero, judging whether the routing table of the current host node records the target address or not;
s505: if the target address is recorded by the routing table of the current host node, reducing the life time of the data message by one, sending the data message to a next-hop host node of the current host node, taking the next-hop host node as the current host node, and returning to execute S501;
s506: if the address of the current host node is the same as the destination address, ending the process;
s507: if the target address is not recorded in the routing table of the current host node, generating the routing table with the target address as a main key by adopting a preset discovery protocol, generating error information, and sending the error information to the last hop host node of the current host node.
In this embodiment, after receiving the data packet, the host node compares whether the address of the host node and the destination address of the data packet are the same address, and if the addresses are the same, the data packet is sent to the destination address, and then the process is ended. If not, the data message needs to be forwarded by the next-hop host node of the host node, and the steps from S501 to S507 are sequentially executed until the target address is found.
However, the data packet has a certain time period, that is, the data packet is most forwarded and cannot exceed the preset time threshold at this time, that is, the host node through which the data packet passes cannot pass the preset time threshold. Therefore, before the host node of the next hop forwards the data packet, it needs to determine whether the lifetime of the data packet is zero.
In this embodiment, when the current host node forwards the data packet, it is further required to determine whether the target address is recorded in the routing table of the current host node, and if the target address is recorded, the data packet is sent to the next hop address of the host node for forwarding. However, if the target address is not recorded in the routing table of the current host node, the data transmission is erroneous, and it is necessary to generate error information and send the error information to the host node of the previous hop of the current host node. However, in order to correctly forward the data packet to the destination address when the data packet transmitted to the destination address is received again next time, a routing table with the destination address as a primary key needs to be generated by using a preset discovery protocol.
In this embodiment, in the process of data transmission, if a receiving node in a routing table cannot correctly receive a data packet, for example, if a packet is lost or the transmission time is over, the receiving node in the routing table cannot normally receive the data packet, the abnormal route needs to be deleted in the routing table, and the failure information needs to be fed back to the sending node, and meanwhile, the routing failure information is also broadcast to other host nodes, so as to prevent other host nodes from selecting an address of a next hop by using the abnormal route, specifically, the method includes:
if the receiving node in the routing table can not receive the data message, deleting the routing information according to which the data message is transmitted in the routing table;
generating abnormal receiving information; the abnormal reception information includes: routing information and information reception failure reminding according to which the data message is transmitted;
and feeding back the abnormal receiving information to the sending node, and broadcasting the abnormal receiving information to other host nodes.
In this embodiment, when data transmission is performed, first, according to link parameters of each mesh network in the hybrid mesh network, the priority of each mesh network is determined, and a target mesh network with the highest priority is determined, that is, a target mesh network with the best transmission effect is determined, and a data packet is transmitted to a destination address according to the target mesh network. Therefore, in the process of data transmission, the unit does not use a mesh network to transmit data any more, and the mesh network with the highest transmission efficiency is selected to transmit data each time data transmission is performed. Therefore, the influence of signal interference on the mesh network is reduced, and the data transmission efficiency is improved.
Referring to fig. 6, a data transmission apparatus provided in an embodiment of the present invention is shown, where the apparatus is applied to a constructed hybrid mesh network, and in this embodiment, the apparatus includes:
an obtaining unit 601, configured to obtain a link parameter of each mesh network in a hybrid mesh network;
a determining unit 602, configured to determine a priority of each mesh network according to the link parameter of each mesh network;
a selecting unit 603, configured to select a mesh network with the highest priority as a target mesh network;
a transmission unit 604, configured to transmit the data packet to a destination through the target mesh network
An address. Optionally, the transmission unit includes:
the first judging subunit is used for judging whether the address of the current host node is the same as the destination address or not;
a second determining subunit, configured to determine whether a lifetime of the data packet is zero, if the address of the current host node is different from the destination address;
a third determining subunit, configured to determine whether the routing table of the current host node records the target address if the current lifetime of the data packet is not zero;
the life time control unit is used for subtracting one from the life time of the data message if the target address is recorded by the routing table of the current host node;
a sending subunit, configured to send the data packet to a next-hop host node of a current host node, use the next-hop host node as the current host node, and return to execute the judgment of whether an address of the current host node is the same as a destination address;
and the ending unit is used for ending if the address of the current host node is the same as the destination address.
Optionally, the method further includes:
a first generating subunit, configured to generate, if the target address is not recorded in the routing table of the current host node, a routing table with the target address as a primary key by using a preset discovery protocol;
a second generating subunit, configured to generate error information;
and the feedback subunit is used for feeding back the error information to the host node of the last hop of the current host node.
By the device of the embodiment, in the process of data transmission, a mesh network is no longer used by the unit for data transmission, and the mesh network with the highest transmission efficiency is selected for data transmission each time the data transmission is performed. Therefore, the influence of signal interference on the mesh network is reduced, and the data transmission efficiency is improved.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.