Bluetooth Mesh Stack Event Handling#
The Bluetooth mesh stack for the Wireless Geckos is an event-driven architecture, where events are handled in the main while loop. The Bluetooth mesh stack runs on top of the Silicon Labs Bluetooth stack.
Bluetooth LE versus Bluetooth Mesh Event#
The Bluetooth mesh protocol is built on top of Bluetooth Low Energy. This mean that a device running a Bluetooth LE stack will be able to receive a Bluetooth mesh PDU but will not be able to interpret the data that it contains. Nevertheless, a node or device can run both. In effect, it is possible to have Bluetooth LE and Bluetooth mesh events treated separately in an application.
In this particular case, Bluetooth LE and Bluetooth mesh event application state machines need to be separate. In other words, the Bluetooth LE and Bluetooth mesh events cannot be treated in a unique switch-case statement.
At the application level, the Silicon Labs Bluetooth Mesh API provides a way to differentiate Bluetooth mesh events from Bluetooth LE events. This is done through the Bluetooth mesh listener.
The Bluetooth mesh events in the stack are handled similarly to the regular Bluetooth LE events. In a freshly created project, the Bluetooth mesh switch case statement is performed by the routine sl_btmesh_step()
and sl_btmesh_process_event()
.
For more information on how events are processed in both the Bluetooth LE and mesh stacks, refer to the Bluetooth Stack Event Handling section in Silicon Labs Bluetooth C Application Developer’s Guide for SDK v3.x.