Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(ble): Fix descriptor loading and add client multiconnect example#11978

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@lucasssvaz
Copy link
Member

Description of Change

This pull request introduces a new example for connecting to multiple BLE servers simultaneously and refactors how BLE characteristic descriptors are managed in the NimBLE client implementation. The main improvements include lazy-loading of descriptors to avoid deadlocks, on-demand retrieval for notifications, and a new example demonstrating multi-server client logic.

New Example: Multi-Server BLE Client

  • AddedClient_multiconnect.ino example, which demonstrates how to scan for, connect to, and interact with up to three BLE servers at once, including handling notifications and reconnections.
  • Added a correspondingci.yml configuration for the new example, specifying build requirements for BLE support.

Descriptor Management Refactor (NimBLE Client):

  • ChangedBLERemoteCharacteristic to lazily retrieve descriptors only when needed (e.g., for notifications or explicit requests), instead of during construction. This avoids potential deadlocks with NimBLE and improves reliability.[1][2]
  • UpdatedgetDescriptors(),getDescriptor(), andsetNotify() to automatically retrieve descriptors on-demand if they have not been loaded yet. This ensures correct behavior for notification registration and descriptor access.[1][2][3]
  • Fixed the descriptor discovery range inretrieveDescriptors() to use the remote service's end handle, ensuring all relevant descriptors are found.

Test Scenarios

Tested Locally

Related links

Closes#11796
Closes#11811

@lucasssvazlucasssvaz self-assigned thisNov 3, 2025
@lucasssvazlucasssvaz added the Area: BLEIssues related to BLE labelNov 3, 2025
@github-actions
Copy link
Contributor

github-actionsbot commentedNov 3, 2025
edited
Loading

Messages
📖🎉 Good Job! All checks are passing!

👋Hello lucasssvaz, we appreciate your contribution to this project!


📘 Please review the project'sContributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you haveread and signed theContributor License Agreement for this project.

Click to see more instructions ...


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

DangerJS is triggered with eachpush 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 isnot a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manuallyretry these Danger checks, please navigate to theActions 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 againstb062cc8

@github-actions
Copy link
Contributor

github-actionsbot commentedNov 3, 2025
edited
Loading

Test Results

 76 files   76 suites   14m 19s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commitb062cc8.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actionsbot commentedNov 3, 2025
edited
Loading

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
ESP32C50⚠️ +7600.00⚠️ +0.09000.000.00
ESP32P40⚠️ +10300.00⚠️ +0.12💚 -16⚠️ +56💚 -0.05⚠️ +0.17
ESP32S30⚠️ +3640.00⚠️ +0.06💚 -160💚 -0.050.00
ESP32C30⚠️ +2780.00⚠️ +0.04000.000.00
ESP32C60⚠️ +7100.00⚠️ +0.100⚠️ +160.00⚠️ +0.07
ESP32H20⚠️ +7440.00⚠️ +0.10000.000.00
ESP320⚠️ +13920.00⚠️ +0.130⚠️ +160.00⚠️ +0.04
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32P4ESP32S3ESP32C3ESP32C6ESP32H2ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/BLE/examples/Beacon_Scanner⚠️ +7100⚠️ +9040⚠️ +3160⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +1352⚠️ +16
libraries/BLE/examples/Client⚠️ +7600⚠️ +1026⚠️ +48⚠️ +3480⚠️ +2780⚠️ +710⚠️ +16⚠️ +7440⚠️ +13680
libraries/BLE/examples/Client_multiconnect--------------
libraries/BLE/examples/Client_secure_static_passkey⚠️ +7560⚠️ +1030⚠️ +56⚠️ +3640⚠️ +2740⚠️ +706⚠️ +16⚠️ +7400⚠️ +1392⚠️ +16
libraries/BLE/examples/EddystoneTLM_Beacon⚠️ +7100⚠️ +920💚 -16⚠️ +3160⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13800
libraries/BLE/examples/EddystoneURL_Beacon⚠️ +7100⚠️ +9200⚠️ +3160⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13520
libraries/BLE/examples/Notify⚠️ +7100⚠️ +9100⚠️ +284💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13360
libraries/BLE/examples/Scan⚠️ +7100⚠️ +9120⚠️ +3040⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +1356⚠️ +16
libraries/BLE/examples/Server⚠️ +7100⚠️ +910💚 -16⚠️ +300💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13360
libraries/BLE/examples/Server_multiconnect⚠️ +7100⚠️ +9180⚠️ +300💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13520
libraries/BLE/examples/Server_secure_authorization⚠️ +7100--⚠️ +3000⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940--
libraries/BLE/examples/Server_secure_static_passkey⚠️ +7100⚠️ +9180⚠️ +300💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +1360⚠️ +16
libraries/BLE/examples/UART⚠️ +7100⚠️ +9180⚠️ +300💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13560
libraries/BLE/examples/Write⚠️ +7100⚠️ +918💚 -16⚠️ +300💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13400
libraries/BLE/examples/iBeacon⚠️ +7100⚠️ +9180⚠️ +300💚 -16⚠️ +2280⚠️ +660⚠️ +16⚠️ +6940⚠️ +13360

Copy link
Collaborator

@SuGliderSuGlider left a comment

Choose a reason for hiding this comment

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

All good! Thanks@lucasssvaz

Copy link
Contributor

CopilotAI 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 implements lazy loading of BLE descriptors for NimBLE to avoid deadlock issues during characteristic construction and adds a new multi-connection client example.

Key changes:

  • Removedm_endHandle fromBLERemoteCharacteristic and replaced withgetRemoteService()->getEndHandle() calls
  • Implemented lazy loading of descriptors ingetDescriptors(),getDescriptor(), andsetNotify() methods
  • Added a newClient_multiconnect example demonstrating simultaneous connections to multiple BLE servers

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

FileDescription
libraries/BLE/src/BLERemoteCharacteristic.hRemoved unusedm_endHandle member variable from NimBLE implementation
libraries/BLE/src/BLERemoteCharacteristic.cppImplemented lazy descriptor loading and replacedm_endHandle with service's end handle
libraries/BLE/examples/Client_multiconnect/ci.ymlAdded CI configuration for the new multi-connection example
libraries/BLE/examples/Client_multiconnect/Client_multiconnect.inoAdded new example demonstrating multi-server BLE client connections

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

@me-no-devme-no-dev added the Status: Pending MergePull Request is ready to be merged labelNov 5, 2025
@me-no-devme-no-dev merged commit971c6ca intoespressif:masterNov 5, 2025
55 checks passed
@lucasssvazlucasssvaz deleted the feat/client_multiconnect branchNovember 5, 2025 12:40
@CHNEG8805
Copy link

how many server can connect?by c6

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@me-no-devme-no-devme-no-dev approved these changes

@SuGliderSuGliderSuGlider approved these changes

Assignees

@lucasssvazlucasssvaz

Labels

Area: BLEIssues related to BLEStatus: Pending MergePull Request is ready to be merged

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BLE multi-connect example Ble Client connect multi Server

4 participants

@lucasssvaz@CHNEG8805@me-no-dev@SuGlider

[8]ページ先頭

©2009-2025 Movatter.jp