Skip to content

fix(ble): Fix default advertising name in NimBLE#12268

Merged
me-no-dev merged 1 commit intoespressif:masterfrom
lucasssvaz:fix/nimble_adv_name
Jan 21, 2026
Merged

fix(ble): Fix default advertising name in NimBLE#12268
me-no-dev merged 1 commit intoespressif:masterfrom
lucasssvaz:fix/nimble_adv_name

Conversation

@lucasssvaz
Copy link
Member

Description of Change

This pull request improves how the BLE device name is managed and advertised by ensuring consistent storage and retrieval across the BLE stack. The main focus is on reliably setting and using the device name for BLE advertising, addressing issues where the underlying GAP service did not always reflect the intended name.

Device Name Management Improvements:

  • Added a static member m_deviceName to BLEDevice to store the device name persistently, and provided a static getDeviceName() method for access (BLEDevice.cpp, BLEDevice.h). [1] [2] [3] [4]
  • Changed the initialization logic to store the device name in m_deviceName during BLEDevice::init instead of immediately setting it on the GAP service, deferring the actual GAP update until BLE stack synchronization (BLEDevice.cpp).
  • Updated BLEDevice::onSync to set the device name on the GAP service from m_deviceName after stack synchronization, improving reliability and ensuring the device name is always correctly set (BLEDevice.cpp).

Advertising Logic Enhancements:

  • Modified BLEAdvertising::start to retrieve the device name directly from BLEDevice::getDeviceName() if not already set, and ensure it is included in the advertising data, working around issues with the GAP service name getter (BLEAdvertising.cpp).

Test Scenarios

Tested locally

@lucasssvaz lucasssvaz requested a review from me-no-dev January 21, 2026 15:22
@lucasssvaz lucasssvaz self-assigned this Jan 21, 2026
@lucasssvaz lucasssvaz requested a review from SuGlider as a code owner January 21, 2026 15:22
@lucasssvaz lucasssvaz added the Area: BLE Issues related to BLE label Jan 21, 2026
@github-actions
Copy link
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 c704a6a

@me-no-dev me-no-dev added the Status: Pending Merge Pull Request is ready to be merged label Jan 21, 2026
@github-actions
Copy link
Contributor

Test Results

 90 files   90 suites   32m 15s ⏱️
 67 tests  67 ✅ 0 💤 0 ❌
683 runs  683 ✅ 0 💤 0 ❌

Results for commit c704a6a.

@me-no-dev me-no-dev merged commit 78e766d into espressif:master Jan 21, 2026
105 of 107 checks passed
@github-actions
Copy link
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
ESP32000.000.00000.000.00
ESP32C30⚠️ +3380.00⚠️ +0.050⚠️ +160.00⚠️ +0.10
ESP32C5000.000.00000.000.00
ESP32C6000.000.00000.000.00
ESP32H20⚠️ +3400.00⚠️ +0.050⚠️ +160.00⚠️ +0.10
ESP32P40⚠️ +3340.00⚠️ +0.040⚠️ +160.00⚠️ +0.06
ESP32S30⚠️ +3440.00⚠️ +0.050⚠️ +160.00⚠️ +0.06
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32ESP32C3ESP32C5ESP32C6ESP32H2ESP32P4ESP32S3
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/BLE/examples/Beacon_Scanner00⚠️ +338⚠️ +16----⚠️ +328⚠️ +16⚠️ +328⚠️ +16⚠️ +336⚠️ +16
libraries/BLE/examples/Client00⚠️ +334⚠️ +16----⚠️ +326⚠️ +16⚠️ +326⚠️ +16⚠️ +344⚠️ +16
libraries/BLE/examples/Client_Server00⚠️ +326⚠️ +16----⚠️ +326⚠️ +16⚠️ +326⚠️ +16--
libraries/BLE/examples/Client_multiconnect00⚠️ +334⚠️ +16----⚠️ +332⚠️ +16⚠️ +324⚠️ +16--
libraries/BLE/examples/Client_secure_static_passkey00⚠️ +324⚠️ +16----⚠️ +324⚠️ +16⚠️ +324⚠️ +16--
libraries/BLE/examples/EddystoneTLM_Beacon00⚠️ +330⚠️ +16----⚠️ +336⚠️ +16⚠️ +330⚠️ +16--
libraries/BLE/examples/EddystoneURL_Beacon00⚠️ +336⚠️ +16----⚠️ +328⚠️ +16⚠️ +330⚠️ +16--
libraries/BLE/examples/Notify00⚠️ +330⚠️ +16----⚠️ +338⚠️ +16⚠️ +330⚠️ +16--
libraries/BLE/examples/Scan00⚠️ +332⚠️ +16----⚠️ +340⚠️ +16⚠️ +330⚠️ +16--
libraries/BLE/examples/Server00⚠️ +330⚠️ +16----⚠️ +336⚠️ +16⚠️ +328⚠️ +16--
libraries/BLE/examples/Server_multiconnect00⚠️ +336⚠️ +16----⚠️ +328⚠️ +16⚠️ +328⚠️ +16--
libraries/BLE/examples/Server_secure_static_passkey00⚠️ +332⚠️ +16----⚠️ +334⚠️ +16⚠️ +334⚠️ +16--
libraries/BLE/examples/UART00⚠️ +338⚠️ +16----⚠️ +328⚠️ +16⚠️ +328⚠️ +16--
libraries/BLE/examples/Write00⚠️ +336⚠️ +16----⚠️ +330⚠️ +16⚠️ +330⚠️ +16--
libraries/BLE/examples/iBeacon00⚠️ +336⚠️ +16----⚠️ +326⚠️ +16⚠️ +326⚠️ +16--
libraries/BLE/examples/Server_secure_authorization--⚠️ +338⚠️ +16----⚠️ +336⚠️ +16----

@lucasssvaz lucasssvaz deleted the fix/nimble_adv_name branch January 21, 2026 20:06
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.

2 participants