Skip to content
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

fix(ble_gatt_server): Deinit services before device deinit #325

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

finger563
Copy link
Contributor

@finger563 finger563 commented Sep 6, 2024

Description

  • Ensure BleGattServer::client_ connection info is cleared, so that it does not improperly think that it is still connected when it may not be.
  • Update order of calls in BleGattServer::deinit to deinit the services before the stack
  • Update esp-nimble-cpp submodule to fix bug in NimBLEDevice::deinit(true).
  • Update ble_gatt_server/example to run BleGattServer::deinit
  • Update BleGattServer so that init() and deinit() can be called multiple times in a row without causing a crash
  • Update ble_gatt_server/example to test calling deinit multiple times (once manually and once via destructor)

Motivation and Context

Ensures deinit works properly and does not cause any crashes.

How has this been tested?

Building and running the updated example, showing no crash.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

After the change (fixed):

no clients were ever connected, then deinit:
CleanShot 2024-09-06 at 09 32 24
client was connected, then deinit:
CleanShot 2024-09-06 at 09 21 49

Before the change:

CleanShot 2024-09-06 at 09 09 06
CleanShot 2024-09-06 at 09 25 35

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Copy link

github-actions bot commented Sep 6, 2024

✅Static analysis result - no issues found! ✅

…at least one device has connected). added additional logging
…ater cleanup doesnt think its still connected when its not
… times in a row; update example to test calling deinit() multiple times in a row via manual call and destructor
@finger563 finger563 merged commit da91527 into main Sep 6, 2024
69 checks passed
@finger563 finger563 deleted the fix/ble-gatt-server-deinit branch September 6, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant