fix(ble): Fix onRead callback#12234
Conversation
👋 Hello lucasssvaz, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 90 files 90 suites 33m 8s ⏱️ For more details on these failures, see this check. Results for commit f8e0947. ♻️ This comment has been updated with latest results. |
|
LGTM, CI is failing due to unused variable. |
95595e3 to
f8e0947
Compare
Fixed, thanks! |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description of Change
This pull request updates the logic for handling GATT server read events in both
BLECharacteristicandBLEDescriptorto ensure that theonRead()callback is only called for the initial read request, and not for follow-up packets during long reads. This prevents unnecessary repeated callbacks and makes the behavior more robust.Improvements to GATT read event handling:
BLECharacteristic::handleGATTServerEventto callonRead()only if the buffer length is greater than 0 and the connection handle is valid, ensuring callbacks are not triggered for follow-up packets in long reads.BLEDescriptor::handleGATTServerEventto use the same logic, only callingonRead()for the initial read request and not for follow-up packets, by checking buffer length and connection handle validity.Test Scenarios
Tested locally
Related links
Fixes #12198