I’d like to know how to establish a network with mesh Topology.
Have I to code the program or zigbee make it automatically ? Have I to write a route table by hand ?
For example:
Module 1 <-> Module 2 <-> Module 3
If I delete Module 2, how Module 1 can communicate with Module 3 ?
You should not use ZNet - look at the ZigBee forums.
Zigbee automatically manages those tables. So when you first set up the network and module 1 wants to talk to module 3, it looks in its route tables. if module 3 is NOT there, it forces a route discovery phase where the nodes exchange route info. If module 2 is alive, it will inform module #1 that it can forward to module 3 for it.
So now module #1 sends the message to module 2 (using the 16-bit network address, not MAC) and module 2 forwards to #3.
if module 2 fails, then module 1 gets no hand-off acknowledgement from module #2 & detects the route has failed, so it issues the route discovery again and if no method to reach module #3 returns, the module 1 cannot talk to #3. If you added a 4th node which could also see #3, then the route would move away from module #2 and to this new fourth node.
I hope that makes sense, but to answer your bigger question, this routing is automatic - other than ‘route discovery’ can cause latency issues where good messages might take 50msec to go from #1 via #2 to #3, but if route discovery is called for, that next message might take several seconds.