Examples
The Tock C library provides a few Bluetooth Low Energy Examples whereas the Rust Library does not so we have translated two of these examples to Rust. One problem here is that the C library actually provides proper support for interacting with the BLE Advertising Driver but the Rust library (currently) doesn't. This means we had to port these parts and have to interact directly through the abstraction of the syscall interface with the driver ourselves.
BLE Advertising
The Rust BLE Advertising Example is a rough translation of the C Advertising Example and libtock-c library code. It sets the device up to send an advertisement of the device "TockOS" and some data packet every 300ms.
This is how the UART Console looks in renode:
And this is how the advertisement packets that are sent are structured (they are sent on the three primary advertising channels 37, 38, and 39):
BLE Scanning
The Rust BLE Scanning Example is a rough translation of the C Scanning Example and libtock-c library code. It waits until it receives exactly one advertisement and prints it to the screen.
When running the tock_demo
this is what the scanner receives: