Skip to content

feat(NimBLE): Add support for NimBLE #11424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: release/v3.3.x
Choose a base branch
from

Conversation

lucasssvaz
Copy link
Collaborator

@lucasssvaz lucasssvaz commented Jun 3, 2025

Description of Change

This pull request introduces support (ExtAdv still not implemented) for the NimBLE Bluetooth stack alongside the existing Bluedroid stack in the ESP32 BLE library. It includes updates to ensure compatibility with both stacks, adds new functionality, and improves documentation. Below is a summary of the most important changes grouped by theme.

Compatibility with NimBLE and Bluedroid

  • Updated conditional compilation macros in cores/esp32/esp32-hal-bt.c to support both CONFIG_BLUEDROID_ENABLED and CONFIG_NIMBLE_ENABLED. This ensures the Bluetooth stack is selected dynamically based on the configuration.
  • Modified BLE2901, BLE2902, and BLE2904 classes to work with both NimBLE and Bluedroid, including adding new NimBLE-specific logic for notifications and indications.

New Features and Improvements

  • Enhanced the BLE2902 class with NimBLE-specific methods for getting and setting notifications and indications, while marking the class as deprecated for NimBLE users since such descriptors are automatically managed.
  • Added default values and improved initialization for the BLE2904 class to ensure consistency across both stacks.

Documentation Updates

  • Updated the README.md to clarify the origins of the library, acknowledge contributions from h2zero (also added as co-author) for NimBLE, and provide guidance on where to raise issues.
  • Added warnings and errors in BLE5 examples to notify users when features are unsupported by NimBLE.

Example and Configuration Changes

  • Updated BLE5 examples (ci.json files) to require CONFIG_BLUEDROID_ENABLED for compatibility with features not yet supported by NimBLE.
  • Adjusted error handling in BLE5 examples to provide clear guidance on stack limitations.

Maintenance and Metadata

  • Changed the library maintainer in library.properties to lucasssvaz, reflecting updated project ownership.

These changes collectively improve the flexibility and usability of the ESP32 BLE library by supporting multiple Bluetooth stacks while maintaining backward compatibility.

Parts of the NimBLE implementation are based on older versions of NimBLE-Arduino. In future versions where breaking API changes are allowed, NimBLE-Arduino can be used as a submodule if optimal.

Tests scenarios

Tested some examples like Scan.ino. More tests still needed, including checking if Bluedroid still works as expected for esp32 as some changes where made to common functions.

Related links

#9878
espressif/esp32-arduino-lib-builder#296

@lucasssvaz lucasssvaz self-assigned this Jun 3, 2025
@lucasssvaz lucasssvaz added Area: Libraries Issue is related to Library support. Area: BLE Issues related to BLE labels Jun 3, 2025
Copy link
Contributor

github-actions bot commented Jun 3, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "feat(NimBLE): Add support for NimBLE":
    • scope/component should be lowercase without whitespace, allowed special characters are _ / . , * - .

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️
	The **target branch** for this Pull Request **must be the default branch** of the project (`master`).

	If you would like to add this feature to a different branch, please state this in the PR description and we will consider it.
Messages
📖 This PR seems to be quite large (total lines of code: 12842), you might consider splitting it into smaller PRs

👋 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.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- Addressing info messages (📖) is strongly recommended; they're less critical but valuable.
- 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 4931b99

@lucasssvaz lucasssvaz added Status: In Progress ⚠️ Issue is in progress Status: Test needed Issue needs testing labels Jun 3, 2025
Copy link
Contributor

github-actions bot commented Jun 3, 2025

Test Results

 76 files   76 suites   12m 47s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit 4931b99.

♻️ This comment has been updated with latest results.

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 Area: Libraries Issue is related to Library support. Status: In Progress ⚠️ Issue is in progress Status: Test needed Issue needs testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant