Skip to content

fix(ble): Fix address types in Bluedroid#12347

Merged
me-no-dev merged 1 commit into
espressif:masterfrom
lucasssvaz:fix/bluedroid_addr
Feb 11, 2026
Merged

fix(ble): Fix address types in Bluedroid#12347
me-no-dev merged 1 commit into
espressif:masterfrom
lucasssvaz:fix/bluedroid_addr

Conversation

@lucasssvaz
Copy link
Copy Markdown
Member

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 BLEAddress class. 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

  • Added getType() and setType() methods to BLEAddress, and updated all constructors to accept an optional address type parameter, defaulting to 0 or BLE_ADDR_PUBLIC as appropriate. This centralizes address type management in BLEAddress. [1] [2] [3] [4] [5]
  • Removed conditional compilation for address type storage—m_addrType is now always present in BLEAddress, simplifying the class and making type handling consistent regardless of BLE stack. [1] [2] [3] [4]

BLEAdvertisedDevice class refactor

  • Removed the redundant m_addressType member from BLEAdvertisedDevice; all address type logic now uses the encapsulated type in BLEAddress. Updated getter and setter to delegate to BLEAddress. [1] [2] [3] [4] [5]

BLEClient connection improvements

  • Changed the BLEClient::connect method signature to use type = 0xFF as a sentinel value. If type is 0xFF, the method falls back to the address's stored type, ensuring correct and flexible type handling during connection. [1] [2] [3]

General codebase consistency

  • Updated all code that creates BLEAddress objects 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

@lucasssvaz lucasssvaz self-assigned this Feb 10, 2026
@lucasssvaz lucasssvaz requested a review from SuGlider as a code owner February 10, 2026 20:34
@lucasssvaz lucasssvaz added Status: Review needed Issue or PR is awaiting review Area: BLE Issues related to BLE labels Feb 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Messages
📖 🎉 Good Job! All checks are passing!

👋 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 ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 424ebd1

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 10, 2026

Test Results

 91 files   91 suites   33m 27s ⏱️
 67 tests  67 ✅ 0 💤 0 ❌
684 runs  684 ✅ 0 💤 0 ❌

Results for commit 424ebd1.

♻️ This comment has been updated with latest results.

@me-no-dev me-no-dev added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Feb 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP320⚠️ +4480.00⚠️ +0.04000.000.00
ESP32C30⚠️ +540.00⚠️ +0.01000.000.00
ESP32C50⚠️ +540.00⚠️ +0.01000.000.00
ESP32C60⚠️ +520.00⚠️ +0.01000.000.00
ESP32H20⚠️ +540.00⚠️ +0.01000.000.00
ESP32P40⚠️ +540.00⚠️ +0.01000.000.00
ESP32S30⚠️ +1040.00⚠️ +0.02000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32ESP32C3ESP32C5ESP32C6ESP32H2ESP32P4ESP32S3
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/BLE/examples/Beacon_Scanner⚠️ +800⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +800
libraries/BLE/examples/Client⚠️ +2840⚠️ +540⚠️ +520⚠️ +520⚠️ +520⚠️ +520⚠️ +1040
libraries/BLE/examples/Client_Gamepad⚠️ +2840⚠️ +520⚠️ +520⚠️ +520⚠️ +520⚠️ +520⚠️ +1040
libraries/BLE/examples/Client_Server⚠️ +2720⚠️ +520⚠️ +540⚠️ +520⚠️ +540⚠️ +540⚠️ +1040
libraries/BLE/examples/Client_multiconnect⚠️ +3120⚠️ +540⚠️ +520⚠️ +520⚠️ +520⚠️ +520⚠️ +1040
libraries/BLE/examples/Client_secure_static_passkey⚠️ +4480⚠️ +520⚠️ +520⚠️ +520⚠️ +520⚠️ +520⚠️ +1040
libraries/BLE/examples/EddystoneTLM_Beacon⚠️ +800⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +800
libraries/BLE/examples/EddystoneURL_Beacon⚠️ +800⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +840
libraries/BLE/examples/Notify⚠️ +800⚠️ +380⚠️ +400⚠️ +380⚠️ +400⚠️ +380⚠️ +800
libraries/BLE/examples/Scan⚠️ +600⚠️ +380⚠️ +420⚠️ +380⚠️ +420⚠️ +380⚠️ +800
libraries/BLE/examples/Server⚠️ +800⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +400⚠️ +800
libraries/BLE/examples/Server_Gamepad⚠️ +840⚠️ +400⚠️ +400⚠️ +400⚠️ +400⚠️ +400⚠️ +800
libraries/BLE/examples/Server_multiconnect⚠️ +800⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +800
libraries/BLE/examples/Server_secure_static_passkey⚠️ +2480⚠️ +380⚠️ +400⚠️ +380⚠️ +400⚠️ +380⚠️ +800
libraries/BLE/examples/UART⚠️ +840⚠️ +400⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +800
libraries/BLE/examples/Write⚠️ +1000⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +380⚠️ +800
libraries/BLE/examples/iBeacon⚠️ +800⚠️ +380⚠️ +380⚠️ +400⚠️ +380⚠️ +380⚠️ +800
libraries/BLE/examples/Server_secure_authorization--⚠️ +400⚠️ +400⚠️ +400⚠️ +400--⚠️ +800

@me-no-dev me-no-dev merged commit c536094 into espressif:master Feb 11, 2026
111 of 123 checks passed
@lucasssvaz lucasssvaz deleted the fix/bluedroid_addr branch February 11, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: BLE Issues related to BLE Status: Pending Merge Pull Request is ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't connect to fsc-bt986

3 participants