# ACE: A Routing Algorithm Based on Autonomous Channel Scheduling for Bluetooth Mesh Network
## 5 ACE: A Routing Algorithm Based on Autonomous Channel Scheduling for Bluetooth Mesh Network
### Design and Implementation
To this point, we tackle the challenge two and three with our autonomous channel scheduling scheme. **Routing update:** The routing algorithm described above can ensure a static network works very well. However, if a node in Bluetooth Mesh network moves, its neighbors have no idea about this change and continue sending packet on the specific channel to the moved node. Meanwhile, the moved node is keeping listening on its specific channel, but none of its new neighbors can send messages to it, causing the node to disconnect from the Bluetooth Mesh network. In order to adapt the routing algorithm to a dynamic network, we add a routing update module to guarantee the connectivity of the mesh network. The main idea to deal with node mobility problem is to make the moved node aware of its movement adaptively and then rejoin the network by searching for beacon packets autonomously. A beacon packet reuses secure network beacon as defined in specification section 3.9.3 [4] to reduce the traffic overhead. Still, we modified it to be sent on a fixed channel such as 37. By doing this, the moved node can discover its new neighbors by scanning for beacon packets on the previously known beacon channel and then rejoin the mesh network. During this process, the communications between other nodes are unaffected, and the moved nodes can update its neighbor and routing table adaptively. Our design is briefly described below. We set a routing update timer for a dynamic network. Each node should periodically send heartbeat packets to show its online state and periodically perform a routing update when the routing update timer timeout. It is worth noting that the TTL value in heartbeat packets sent in the route maintenance phase is set to 1, which means the node can be discovered only by its neighbor. In particular, each node should send a beacon packet periodically on a fixed beacon channel in case of the disconnection caused by mesh nodes' mobility. Concretely, we set an online timeout timer for each node. If a node does not receive any packet for several heartbeat packet periods, it means the node is most likely to be moved and disconnected from other nodes. So when the online timeout timer fired, the moved node will switch its scanning channel to the known beacon channel, then scans for beacon packets from neighbors. There are collisions between different beacon packets, especially in dense networks. To avoid the continuous collision between multiple neighbors, we set some random backoff for the beacon packets retransmission. Besides, the interval of beacon can be tweaked according to the network density. When the network density is greater, the interval of beacon should be reduced to ensure the beacon can be received in a relatively short time. Similar to the route creation phase, the moved node update the neighbor table and then sends'rediscovery packets' (heartbeat packets) whose TTL is set to the initial value in a shorter period. The purpose of doing so is to inform other nodes of this change as soon as possible. On the other hand, all nodes will update the routing table when the routing update timer timeout, which is very similar to the route creation phase. It is worth noting that the routing update timer period is much shorter than the duration of sending rediscovery packets, which can guarantee a solid and consistent route update of the entire network. Specifically, when the scale of the network is large, the setup and updating time of the routing table can be appropriately extended to ensure that the information of all nodes in the network is obtained and updated. Theoretically, the worst time of finishing updating for a new device will not exceed the sum of the expiration time of the routing table update timer and packets transmission time. A brief process of routing update can be concluded as follows:  
* First, the mobile node perceives the change of topological if it cannot receive the heartbeat message from the original neighbors on its scanning channel.