Skip to content

Add a BLE GATT peripheral for mobile pairing#122

Open
johnragonhall wants to merge 3 commits into
jewbetcha:mainfrom
johnragonhall:pr/ble-server
Open

Add a BLE GATT peripheral for mobile pairing#122
johnragonhall wants to merge 3 commits into
jewbetcha:mainfrom
johnragonhall:pr/ble-server

Conversation

@johnragonhall

@johnragonhall johnragonhall commented Jun 17, 2026

Copy link
Copy Markdown

What does this PR do?

Adds the BLE GATT peripheral that lets the mobile app pair with the Pi over Bluetooth (no Wi-Fi needed):

  • ble_server.py: advertises the OpenFlight GATT service via BlueZ, notifies shots and session events, handles club/session/prefs commands, and authenticates each session with a rotating-nonce HMAC-SHA256 challenge (constant-time)
  • wires the BLE server into startup behind the --ble flag and serves the pairing payload via the localhost /api/pair-qr endpoint
  • BLE wire-protocol reference doc

How was this tested?

  • uv run pylint src/openflight/ble_server.py rated 10.00/10
  • uv run ruff check clean
  • No automated test (BlueZ/hardware dependent); verified against the mobile app's BLE client

Checklist

  • Python tests pass (no test; BlueZ/hardware dependent)
  • Pylint passes (10.00/10 for ble_server.py)
  • Ruff passes
  • Updated docs (BLE protocol + CHANGELOG)
  • No unrelated changes mixed in

Note: the /api/pair-qr wiring touches the 2851-line server.py module, which carries a pre-existing pylint module-size cap unrelated to this change.

@jewbetcha

Copy link
Copy Markdown
Owner

What is BlueZ? There is no mobile app for OpenFlight...

- advertise an OpenFlight GATT service via BlueZ so the mobile app connects without Wi-Fi
- notify shots and session events, and handle club/session/prefs commands
- authenticate with a rotating nonce and constant-time HMAC-SHA256 over a pairing key
- wire the BLE server into startup behind the --ble flag
- load the pairing secret and serve it via the localhost /api/pair-qr endpoint
- add the BLE wire-protocol reference for the GATT server
- note the BLE GATT peripheral in the changelog
@jewbetcha

Copy link
Copy Markdown
Owner

@johnragonhall have you tested this? Does it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants