Fix ATT descriptor discovery handle range and response parsing - #435
Fix ATT descriptor discovery handle range and response parsing#435thematrix999 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #435 +/- ##
==========================================
- Coverage 15.25% 15.24% -0.02%
==========================================
Files 29 29
Lines 3684 3687 +3
==========================================
Hits 562 562
- Misses 3122 3125 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3a5b7a8 to
0aeeb27
Compare
|
Memory usage change @ 0aeeb27
Click for full report table
Click for full report CSV |
|
For context, the four failing compile jobs also fail on the latest scheduled workflow run from the current https://github.com/arduino-libraries/ArduinoBLE/actions/runs/30351039055 The failing targets are the same:
The Nano 33 BLE compilation, unit tests, and spell check pass. Codecov reports no patch coverage because the existing unit test suite does not currently exercise |
Problem
ATTClass::discoverDescriptors()currently has two issues.First, the descriptor discovery range ends at the value handle of the next characteristic. This includes the next characteristic declaration and value in the descriptor range of the current characteristic.
Second, byte 1 of an ATT Find Information Response is a Format field, not a length multiplier. Format
0x01contains 4-byte entries (2-byte handle + 2-byte UUID), while format0x02contains 18-byte entries (2-byte handle + 16-byte UUID).The current implementation calculates an 8-byte entry length for format
0x02and always parses UUIDs as 16-bit.This can cause
discoverAttributes()to fail or time out when a service contains multiple 128-bit characteristics.Related to #277.
Changes
Hardware test
Tested using two Arduino Nano 33 BLE boards, one configured as central and the other as peripheral, with ArduinoBLE 1.5.0.
The peripheral exposes a 128-bit service containing multiple 128-bit characteristics, including a notify characteristic with a CCCD.
Before the change:
discoverAttributes()does not complete.After the change: