The networking of broadcast wireless networks and data communication method
Technical field
The present invention relates to a kind of networking and data communication method of broadcast wireless networks, belong to wireless data communication field.
Background technology
Wireless technology is increasingly extensive in the application of industry-by-industry, requires also improving constantly.In order to meet the demand of client, various wireless network all arises at the historic moment.But use wireless network usually to have following shortcoming in the market: 1, technical sophistication, be not easy to realize; 2, networking speed is slow; 3, network path is safeguarded complicated.
Summary of the invention
The object of the invention is to solve problems of the prior art, provide that a kind of networking process is simple, speed is fast, and do not need to carry out network path maintenance, the networking of technically simple broadcast wireless networks and data communication method.
The present invention is achieved in that a kind of network-building method of broadcast wireless networks, it is characterized in that: comprise the radio network be made up of a Centroid and multiple child node, the address history of all child nodes is stored in described Centroid, the address of described each child node is unique, and the address of described Centroid is unique; The networking step of described Centroid and child node comprises:
1) described Centroid powers on, and checks the quantity of child node and the address history of each child node of networking, and by the method that wireless synchronization is broadcasted, using the address history of child node and parameter grouping and as networking instruction to broadcast in net;
2) described child node powers on, wait-receiving mode networking instruction; After child node receives the networking instruction from Centroid broadcast, contrasted in the address of self and the address history of broadcast, if there is identical address, recorded announce parameter, is labeled as networking;
3) stop after the networking instruction including address history is all broadcasted one time by Centroid, networking terminates.
In step 1, when networking instruction is broadcasted by described Centroid in net, first address history is divided into M one group, be divided into N group, wherein M represents the number of the address history in every group, N represents the sum of the address history group be grouped, then broadcast transmission Article 1 networking instruction, and networking instruction comprises network parameter and the first group address archives; Set delay time subsequently, after delay time, broadcast transmission Article 2 networking instruction, until the complete N article of networking instruction of broadcast transmission.
In step 2, after described child node receives the networking instruction from Centroid broadcast, first check that whether the data that networking instruction comprises are correct, if data are incorrect, abandon data, keep accepting state, the networking instruction that wait-receiving mode is new;
If data are correct, judge whether forwarded over; If forwarded over, then abandon data, keep accepting state, the networking instruction that wait-receiving mode is new; If do not have forwarded over, then forward this networking instruction, after forwarding, address history in the address of self and networking instruction is contrasted, if there is identical address, records the parameter information in this networking instruction, and be configured in child node and use, child node has networked.
In networking process, when a part of child node powers on, the power-off of another part child node, when networking completes, the a part of child node networking success only powered on, at this moment, powers on another part child node of original power-off, the child node that this part newly powers on is newly-increased child node, and the networking process of described newly-increased child node and Centroid is:
Centroid is after networking completes, and according to child node address archives to all communications one time of all child node communication instructions, the successful child node communication success of networking, does not have the child node of networking can Communications failure; If find that there is the child node of Communications failure, by the address history of the child node of Communications failure and network data combination, broadcast transmission networking instruction; After newly-increased child node receives networking instruction, broadcast forwards, contrast address history, and conform to then record also parameters, and networking completes.
After networking completes, when there is the address history increase of change or child node or reduce in the network parameter of Centroid, the modification information of network parameter or child node must be notified each child node by Centroid, method is as follows: when Centroid finds that network parameter changes, to the whole network broadcast transmission network parameter alteration command, notify the child node of networking, change network parameter; When Centroid finds that the address history of child node increases, do not process, the archives that Add Address network according to newly-increased child node and process; When Centroid finds that address history part is deleted, address history deletion is passed through the whole network broadcast transmission from net instruction notification to the off-grid child node of needs; When child node receives parameter modification instruction, record also resets according to changed content; When child node receives from net instruction, the child node that address conforms to, dispatch from the factory recovery default setting, leaves network; Described network parameter comprise in the working channel of Centroid, mode of operation or network identity (PANID) any one or multiple.
Described child node in the foundation whether the networking instruction judging to receive is forwarded over is: the sequence number that networking instruction comprises and network identity.
A kind of data communication method, the method is used in the networking of broadcast wireless networks as above, it is characterized in that: when in Centroid needs with net, child node carries out data communication, destination address and communication data are broadcasted by the method that Centroid is broadcasted by wireless synchronization in the whole network; After child node receives communication data, comparison destination address and Self address, if address is different, continue broadcast; If address is identical, after waiting for two broadcast cycle, return information is broadcasted at the whole network by wireless synchronization broadcasting method by child node equally, and Centroid receives return information, this data communication success.
Concrete steps are:
A. Centroid: the method broadcast communication instruction that Centroid is broadcasted by wireless synchronization, this communication instruction comprises object child node address; After communication instruction is sent, wait for that child node replys response; If in an official hour, receive the reply response of object child node, communication success; Reply response if do not received in an official hour, this time Communications failure, repeated broadcast communication instruction, the sequence number of this broadcast adds 1, if repeated broadcast 3 times, does not still receive the reply response of target child node, then this time Communications failure;
B. child node: after child node receives the communication instruction from Centroid, first checks that whether the data that communication instruction comprises are correct; If data are incorrect, abandon data, keep accepting state, the data that wait-receiving mode is new; If data are correct, judge whether these data forward; If forwarded, abandon data, keep accepting state, the communication instruction that wait-receiving mode is new; If do not forwarded, broadcast forwards this communication instruction, and judges whether the address of child node self conforms to the destination address comprised in communication instruction, if be not inconsistent, abandons communication instruction, keeps accepting state, the communication instruction that wait-receiving mode is new; If conformed to, after waiting for the stipulated time, reply response message to Centroid broadcast transmission, reply response command format is identical with communication instruction.
The invention has the beneficial effects as follows: technically easily realize; Networking is simple, and speed is fast; Do not need to carry out route maintenance; Needed for real-time performance, hardware resource is little, reduces hardware cost.
Accompanying drawing explanation
Fig. 1 is Centroid networking flow chart of the present invention.
To be the present invention to network flow chart from node Fig. 2.
Fig. 3 is that Centroid of the present invention sends communication instruction flow chart.
Fig. 4 is that child node of the present invention receives communication instruction flow chart.
Embodiment
According to Fig. 1, Fig. 2, the network-building method of broadcast wireless networks of the present invention, comprises the radio network be made up of a Centroid and multiple child node, stores the address history of all child nodes in described Centroid, the address of described each child node is unique, and the address of described Centroid is unique.Described child node quantity is 1 ~ 65535.The position of described Centroid and child node can be divided into multilayer according to communication distance, and Centroid is the center of network, initiatively initiates networking, the notice of newly-increased node networking, network parameter or address history change, communication.The passive wait-receiving mode of child node is from the instruction such as networking, communication of Centroid.
One, networking: the networking step of described Centroid and child node comprises:
1) described Centroid powers on, carry out network parameter configuration, comprise network identity (PANID), channel etc., then the quantity of the child node of networking and the address history of each child node is checked, address history is divided into M one group, be divided into N group, wherein M represents the number of the address history in every group, N represents the sum of the address history group be grouped, the address history of child node and parameter are broadcasted as networking instruction according to order of packets by the method then broadcasted by wireless synchronization in net: first send Article 1 networking instruction, networking instruction comprises network parameter and the first group address archives, set delay time subsequently, after delay time, broadcast transmission Article 2 networking instruction, until the complete N article of networking instruction of broadcast transmission.
2) described child node powers on, wait-receiving mode networking instruction; After described child node receives the networking instruction from Centroid broadcast, first check that whether the data that networking instruction comprises are correct, if data are incorrect, abandon data, keep accepting state, the networking instruction that wait-receiving mode is new;
If data are correct, judge whether forwarded over; If forwarded over, then abandon data, keep accepting state, the networking instruction that wait-receiving mode is new; If do not have forwarded over, then forward this networking instruction, after forwarding, address history in the address of self and networking instruction is contrasted, if there is identical address, records the parameter information in this networking instruction, and be configured in child node and use, child node has networked.Described child node in the foundation whether the networking instruction judging to receive is forwarded over is: the sequence number that networking instruction comprises and network identity.
3) stop after the networking instruction including address history is all broadcasted one time by Centroid, networking terminates.
Two, newly-increased child node networking: in networking process, when a part of child node powers on, the power-off of another part child node, when networking completes, the a part of child node networking success only powered on, at this moment, powers on another part child node of original power-off, the child node that this part newly powers on is newly-increased child node, and the networking process of described newly-increased child node and Centroid is:
Centroid is after networking completes, and according to child node address archives to all communications one time of all child node communication instructions, the successful child node communication success of networking, does not have the child node of networking can Communications failure; If find that there is the child node of Communications failure, by the address history of the child node of Communications failure and network data combination, broadcast transmission networking instruction; After newly-increased child node receives networking instruction, broadcast forwards, contrast address history, and conform to then record also parameters, and networking completes.
Three, network parameter or child node archives change: after networking completes, when there is the address history increase of change or child node or reduce in the network parameter of Centroid, the modification information of network parameter or child node must be notified each child node by Centroid, method is as follows: when Centroid finds that network parameter changes, to the whole network broadcast transmission network parameter alteration command, notify the child node of networking, change network parameter; When Centroid finds that the address history of child node increases, do not process, the archives that Add Address network according to newly-increased child node and process; When Centroid finds that address history part is deleted, address history deletion is passed through the whole network broadcast transmission from net instruction notification to the off-grid child node of needs; When child node receives parameter modification instruction, record also resets according to changed content; When child node receives from net instruction, the child node that address conforms to, dispatch from the factory recovery default setting, leaves network; Described network parameter comprise in the working channel of Centroid, mode of operation or network identity (PANID) any one or multiple.
Four, communication: according to Fig. 3, Fig. 4, the present invention is when Centroid needs to carry out data communication with child node in net, and destination address and communication data are broadcasted by the method that Centroid is broadcasted by wireless synchronization in the whole network; After child node receives communication data, comparison destination address and Self address, if address is different, continue broadcast; If address is identical, after waiting for two broadcast cycle, return information is broadcasted at the whole network by wireless synchronization broadcasting method by child node equally, and Centroid receives return information, this data communication success.
Concrete steps are:
A. Centroid: the method broadcast communication instruction that Centroid is broadcasted by wireless synchronization, this communication instruction comprises object child node address; After communication instruction is sent, wait for that child node replys response; If in an official hour, receive the reply response of object child node, communication success; Reply response if do not received in an official hour, this time Communications failure, repeated broadcast communication instruction, the sequence number of this broadcast adds 1, if repeated broadcast 3 times, does not still receive the reply response of target child node, then this time Communications failure;
B. child node: after child node receives the communication instruction from Centroid, first checks that whether the data that communication instruction comprises are correct; If data are incorrect, abandon data, keep accepting state, the data that wait-receiving mode is new; If data are correct, judge whether these data forward; If forwarded, abandon data, keep accepting state, the communication instruction that wait-receiving mode is new; If do not forwarded, broadcast forwards this communication instruction, and judges whether the address of child node self conforms to the destination address comprised in communication instruction, if be not inconsistent, abandons communication instruction, keeps accepting state, the communication instruction that wait-receiving mode is new; If conformed to, after waiting for the stipulated time, reply response message to Centroid broadcast transmission, reply response command format is identical with communication instruction.
The channel applied in the present invention is divided into common channel and working channel.Described common channel refers to, the channel of child node and Centroid factory default, and the child node of non-networking all waits for networking on this common channel.Described working channel refers to, the communication channel that Centroid is specified, after networking terminates, and the whole nodes communication on this channel in network.
Described networking instruction sends on common channel, described communication instruction, sends on working channel respectively from net instruction, parameter modification instruction.
" wireless synchronization broadcast " described in the present invention is prior art, refers to that multiple node is after receiving same wireless data, carries out the method for wireless outside broadcast transmission simultaneously.