• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Alan-Jowett / sonde / 24640537270
82%

Build:
DEFAULT BRANCH: main
Ran 19 Apr 2026 10:24PM UTC
Jobs 1
Files 113
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

19 Apr 2026 10:20PM UTC coverage: 80.807% (+0.01%) from 80.797%
24640537270

push

github

web-flow
modem: fix Android LESC NC pairing via encryption-state polling fallback (#763)

* modem: fix Android LESC NC pairing via encryption-state polling fallback

When Android uses LESC Numeric Comparison, esp32-nimble's
BLE_GAP_EVENT_ENC_CHANGE handler silently drops the callback if
ble_gap_conn_find fails (returns BLE_HS_ENOTCONN due to a race in
the NimBLE host stack). This leaves on_authentication_complete
unfired and the pairing state machine stuck, causing the 30s timeout.

Fix with a polling fallback: each bridge poll cycle, query NimBLE
directly via esp_idf_sys::ble_gap_conn_find using the conn_handle
stored in BleState during on_connect. When the link is encrypted
and MTU >= BLE_MTU_MIN, complete the pairing state machine the same
way on_authentication_complete would have.

Key design decisions:
- Gate on confirm_sent_at.is_some() (NC pairing path only) to keep
  Windows Just Works on the original callback path.
- Skip (don't disconnect) when MTU < BLE_MTU_MIN: Android delays ATT
  MTU exchange until after SMP, so MTU 23 is expected immediately
  after encryption and updates to 247 before the GATT write.
- Add pairing_rejected flag so operator rejection prevents a late SMP
  completion (via fallback or on_authentication_complete) from
  promoting a rejected peer to authenticated.
- Add deferred_connected.is_none() and !authenticated guards in
  on_authentication_complete to prevent double Connected events if
  both the fallback and the callback fire.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* modem: address PR 763 review comments

- Fix doc comment on check_encryption_fallback to include pairing_rejected
  in the list of early-exit guard conditions.
- Log unexpected ble_gap_conn_find errors (non-BLE_HS_ENOTCONN) as warnings
  for field diagnostics; silently return only on ENOTCONN.
- Extract complete_pairing_under_lock helper to remove duplicated
  pairing state-machine logic between on_authentication_complete and
  ch... (continued)

15 of 15 new or added lines in 1 file covered. (100.0%)

24453 of 30261 relevant lines covered (80.81%)

203.59 hits per line

Jobs
ID Job ID Ran Files Coverage
1 24640537270.1 19 Apr 2026 10:24PM UTC 113
80.81
GitHub Action Run
Source Files on build 24640537270
  • Tree
  • List 113
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24640537270
  • 629c1cec on github
  • Prev Build on main (#24639942947)
  • Next Build on main (#24656046305)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc