microReticulumTbeam/exercises/303_microReticulum_ble_link_ping_pong/README.md
2026-05-19 15:38:06 -07:00

3.2 KiB

Exercise 303: microReticulum BLE negotiated Link ping-pong

This exercise is the BLE analogue of Exercise 203.

Exercise 301 proved PLAIN packets over the ESP32/T-Beam BLE interface. Exercise 302 proved announced SINGLE destinations over BLE. Exercise 303 adds a negotiated Reticulum Link: the nodes begin with BLE connectivity and SINGLE destination announces, then one node opens a Link to the peer's announced SINGLE destination.

BLE GATT connection -> Identity -> SINGLE destination -> announce -> peer learns identity/path -> LINKREQUEST/LRPROOF handshake -> ACTIVE Link -> link DATA packets

For this exercise, BLE roles are still explicit:

AMY -> BLE central/client
BOB -> BLE peripheral/server

BOB must be started first so it is advertising when AMY scans. This ordering is a BLE transport requirement in the current 300-series exercises, not a Reticulum Link requirement. Inside Reticulum, AMY opens the Link to BOB because the lower lexical node label initiates, matching Exercise 203.

An equal-peer BLE exercise should come after this, because it changes the BLE interface itself to dual-role operation and deterministic connection direction. A likely name is 304_microReticulum_ble_dual_role_ping_pong.

Build, Upload, And Monitor

In one console:

source /home/jlpoole/rnsenv/bin/activate
cd /usr/local/src/microreticulum/microReticulumTbeam
pio run -d exercises/303_microReticulum_ble_link_ping_pong -e bob -t upload --upload-port /dev/ttytBOB && \
pio device monitor -d exercises/303_microReticulum_ble_link_ping_pong -e bob

In another console:

source /home/jlpoole/rnsenv/bin/activate
cd /usr/local/src/microreticulum/microReticulumTbeam
pio run -d exercises/303_microReticulum_ble_link_ping_pong -e amy -t upload --upload-port /dev/ttytAMY && \
pio device monitor -d exercises/303_microReticulum_ble_link_ping_pong -e amy

The shorter form should also work once the symlinks exist:

pio run -d exercises/303_microReticulum_ble_link_ping_pong -e bob -t upload
pio device monitor -d exercises/303_microReticulum_ble_link_ping_pong -e bob

Expected Output

After the BLE GATT connection is made, each node prints and announces its local SINGLE destination:

Local SINGLE destination: 2f6c...
TX ANNOUNCE: Amy
RX ANNOUNCE: label=Bob hash=91a4...

After AMY learns BOB's announce, AMY opens the Reticulum Link:

TX LINKREQUEST: opening link to Bob

BOB should report the inbound link, and AMY should report active status:

RX LINK: inbound link established
LINK ACTIVE: initiator link established

Once active, both nodes send and receive packets over the negotiated Link:

TX LINK BLE: Amy -> Bob iter=0
RX LINK BLE: Bob -> Amy iter=0

Notes

  • This exercise uses the same ESP32 BLE interface introduced in Exercise 301.
  • Once the Reticulum Link is active, the sketch stops periodic announces so the console focuses on link traffic.
  • The identity is generated on each boot. Destination hashes can change after reset.
  • This is the first 300-series exercise that proves Reticulum negotiated Link establishment over the ESP32/T-Beam BLE interface.