fix(ble): Fix address types in Bluedroid#12347
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 91 files 91 suites 33m 27s ⏱️ Results for commit 424ebd1. ♻️ This comment has been updated with latest results. |
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 refactors how BLE address types are managed throughout the codebase, making address type handling more consistent and encapsulated within the
BLEAddressclass. The changes eliminate redundant storage of address type in multiple classes and ensure that address type is always associated with the address itself. This improves maintainability and reduces the risk of mismatched address/type pairs.Key changes include:
BLEAddress class improvements
getType()andsetType()methods toBLEAddress, and updated all constructors to accept an optional address type parameter, defaulting to 0 orBLE_ADDR_PUBLICas appropriate. This centralizes address type management inBLEAddress. [1] [2] [3] [4] [5]m_addrTypeis now always present inBLEAddress, simplifying the class and making type handling consistent regardless of BLE stack. [1] [2] [3] [4]BLEAdvertisedDevice class refactor
m_addressTypemember fromBLEAdvertisedDevice; all address type logic now uses the encapsulated type inBLEAddress. Updated getter and setter to delegate toBLEAddress. [1] [2] [3] [4] [5]BLEClient connection improvements
BLEClient::connectmethod signature to usetype = 0xFFas a sentinel value. Iftypeis0xFF, the method falls back to the address's stored type, ensuring correct and flexible type handling during connection. [1] [2] [3]General codebase consistency
BLEAddressobjects to provide the address type where available, ensuring that the type is always set correctly at construction.These changes make address type management more robust, reduce the chance of bugs from mismatched address/type pairs, and simplify the codebase.
Test Scenarios
Tested locally with ESP32
Related links
Closes #11939