Skip to content

bluetooth: add persistent HRM reconnect advertising#1492

Open
lesserevil wants to merge 7 commits into
coredevices:mainfrom
lesserevil:ble-hrm-reconnect-advertising
Open

bluetooth: add persistent HRM reconnect advertising#1492
lesserevil wants to merge 7 commits into
coredevices:mainfrom
lesserevil:ble-hrm-reconnect-advertising

Conversation

@lesserevil

@lesserevil lesserevil commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • Add gap_le_slave_reconnect_hrm_start() for HRM advertising that remains active until explicitly stopped.
  • Keep the existing gap_le_slave_reconnect_hrm_restart() timed reconnect behavior intact.
  • Keep HRM reconnect advertisements eligible while a slave connection is active, while normal discovery/reconnect jobs remain paused.
  • Cover the HRM advertising payload, flags, scan response, interval transition, connected advertising, and stop behavior with focused tests.

Split from

Stack / review order

Tested

  • git diff --check
  • ./pbl test -M 'test_gap_le_advert|test_gap_le_slave_reconnect'

@lesserevil lesserevil force-pushed the ble-hrm-reconnect-advertising branch 2 times, most recently from 1592d4b to 64854b6 Compare June 12, 2026 02:48
@lesserevil lesserevil force-pushed the ble-hrm-reconnect-advertising branch from 5ab6b1e to c15f212 Compare June 14, 2026 19:47
lesserevil and others added 7 commits June 14, 2026 21:34
Allow the phone gateway connection and one external BLE client to coexist
by increasing the NimBLE connection limit and tracking multiple slave links
in the firmware BLE connection state.

Classify new NimBLE pairings as gateway only after the Pebble pairing
service is used. Prune stale BLE gateway bonds without deleting
non-gateway client bonds.

Co-authored-by: GPT-5 Codex <codex@openai.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
Implement the standard Heart Rate Service on the NimBLE backend and route
subscription updates back to the firmware HRM sharing service.

Co-authored-by: GPT-5 Codex <codex@openai.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
test_nimble_hrm_service never linked: the NimBLE transport include path was
missing, and including the host headers pulls in the NPL + transport layer.
Add the transport include, link the dummy NPL backend (no FreeRTOS needed for
a host-only service test), and stub the unused transport impls.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
Advertising the HRM service makes the watch discoverable as a standard BLE
heart-rate sensor, which (with the original consent-based sharing) prompts the
user to share heart rate on every reconnect. That model is being replaced by
workout-gated sharing, so retire it here, alongside the advertising that
exposes the service:

- Remove the per-device consent prompt, permission model, and reminder popup.
- Delete the ble_hrm sharing/reminder/stop-sharing popup windows and the
  settings + timeline stop-sharing controls (the serialized
  TimelineItemActionTypeBLEHRMStopSharing value is kept, handled as a no-op).
- ble_hrm.c now exposes the HRM GATT service but shares nothing; workout-gated
  sharing is added in a later change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
Add an explicit HRM reconnect advertising start path that keeps the
Heart Rate Service UUID in the advertising payload until stopped.

Co-authored-by: GPT-5 Codex <codex@openai.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
Allow HRM reconnect advertising to keep running while a slave
connection is active, so cycle computers can discover the HRM service
without disconnecting the phone link.

Normal discovery and reconnect advertisements remain paused until all slave
connections disconnect.

Co-authored-by: GPT-5 Codex <codex@openai.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
test_gap_le_slave_reconnect never linked (missing new_timer/ble-syscall/
serial/task/rand stubs). Once linked, it and test_gap_le_advert's
hrm_reconnection_continues_after_slave_connection both failed: they drove the
1-second advertising cycle timer with regular_timer_fire_seconds(N), which
fires once (N is a modulus), not N times, so the job never advanced to its
Long-interval term. Add the missing stubs and loop regular_timer_fire_seconds(1)
to advance the term.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Shawn Edwards <lesser.evil@gmail.com>
@lesserevil lesserevil force-pushed the ble-hrm-reconnect-advertising branch from c15f212 to 825077d Compare June 14, 2026 21:47
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.

1 participant