Skip to content

Conversation

lucasssvaz
Copy link
Member

Description of Change

Add fixes for BLE:

  • Double callbacks
  • IO capabilities in examples (with readme updates to explain)
  • Security reset on disconnect

Test Scenarios

Tested locally

Related links

Closes #11805

@lucasssvaz lucasssvaz self-assigned this Sep 10, 2025
@lucasssvaz lucasssvaz added the Area: BLE Issues related to BLE label Sep 10, 2025
Copy link
Contributor

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "fix(BLE): Fix double callback and secure examples":
    • 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).

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

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
ESP32C5💚 -24⚠️ +7380.00⚠️ +0.09000.000.00
ESP32S3💚 -20⚠️ +4840.00⚠️ +0.08000.000.00
ESP32C3💚 -24⚠️ +7380.00⚠️ +0.12000.000.00
ESP32C6💚 -24⚠️ +7380.00⚠️ +0.10000.000.00
ESP32H2💚 -24⚠️ +8340.00⚠️ +0.11000.000.00
ESP320⚠️ +5720.00⚠️ +0.05000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32S3ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/BLE/examples/Beacon_Scanner💚 -240💚 -200💚 -240💚 -240💚 -240⚠️ +120
libraries/BLE/examples/Client⚠️ +200⚠️ +240⚠️ +200⚠️ +200⚠️ +200⚠️ +520
libraries/BLE/examples/Client_secure_static_passkey⚠️ +6980⚠️ +4680⚠️ +6980⚠️ +6980⚠️ +7940⚠️ +5400
libraries/BLE/examples/EddystoneTLM_Beacon⚠️ +160⚠️ +160⚠️ +160⚠️ +160⚠️ +160⚠️ +520
libraries/BLE/examples/EddystoneURL_Beacon⚠️ +160⚠️ +160⚠️ +160⚠️ +160⚠️ +160⚠️ +560
libraries/BLE/examples/Notify⚠️ +180⚠️ +160⚠️ +180⚠️ +180⚠️ +180⚠️ +520
libraries/BLE/examples/Scan⚠️ +160⚠️ +160⚠️ +160⚠️ +160⚠️ +160⚠️ +520
libraries/BLE/examples/Server⚠️ +180⚠️ +160⚠️ +180⚠️ +180⚠️ +180⚠️ +640
libraries/BLE/examples/Server_multiconnect⚠️ +180⚠️ +160⚠️ +180⚠️ +180⚠️ +180⚠️ +520
libraries/BLE/examples/Server_secure_authorization------------
libraries/BLE/examples/Server_secure_static_passkey⚠️ +7380⚠️ +4840⚠️ +7380⚠️ +7380⚠️ +8340⚠️ +5720
libraries/BLE/examples/UART⚠️ +180⚠️ +160⚠️ +180⚠️ +180⚠️ +180⚠️ +520
libraries/BLE/examples/Write⚠️ +180⚠️ +160⚠️ +180⚠️ +180⚠️ +180⚠️ +520
libraries/BLE/examples/iBeacon⚠️ +180⚠️ +160⚠️ +180⚠️ +180⚠️ +180⚠️ +520

Copy link
Contributor

Test Results

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

Results for commit 118996d.

@SuGlider SuGlider requested a review from Copilot September 10, 2025 17:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes BLE double callback issues and improves secure examples with IO capabilities and security reset functionality. It addresses authentication, security state management, and provides better documentation for BLE security implementation.

  • Fixes double callback invocations in BLE characteristic operations
  • Adds security reset functionality on disconnect events
  • Updates secure examples with proper IO capabilities and MITM configuration
  • Adds comprehensive BLE security documentation with pairing methods and troubleshooting

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
BLEUtils.cpp Adds missing BLE_GAP_EVENT_AUTHORIZE case for debug text
BLEServer.cpp Adds security reset calls on disconnect for both Bluedroid and NimBLE
BLESecurity.h Adds resetSecurity() method declaration
BLESecurity.cpp Implements security reset functionality and fixes default IO capability
BLEClient.cpp Adds security reset calls on disconnect for both stacks
BLECharacteristic.cpp Removes duplicate callback invocations to fix double callback issue
Server_secure_static_passkey.ino Updates with proper IO capabilities, MITM settings, and NVS clearing
Server_secure_authorization/ New authorization example with proper security configuration
Client_secure_static_passkey.ino Updates with matching security settings and NVS clearing
README.md Comprehensive BLE security documentation with pairing methods and troubleshooting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BLEServer double callback on WRITE and WRITE_NR
2 participants