Repository navigation
feat(ble_gatt_server): add is_initialized() and document one-server-per-boot - #914
Merged
Merged
Conversation
…er-boot is_initialized() returns whether this server currently owns the NimBLE stack (between a successful init() and deinit()), so an application that manages one BLE personality at a time can ask "is the radio up as this server?" without tracking it in parallel. It reports server_ != nullptr, the flag init()/deinit() already maintain. The class doc now states explicitly that NimBLE owns a single GATT server (NimBLEDevice::createServer() returns that one server) and that init()/deinit() bring the whole stack up and down, so a design switching between two GATT layouts must deinit() one before init()-ing the next rather than hold two initialized instances at once. Header-only and additive. Builds the ble_gatt_server example on esp32s3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
finger563
marked this pull request as ready for review
November 18, 2026 02:22
|
✅Static analysis result - no issues found! ✅ |
The @note claimed deinit() "should only be called after NimBLEDevice::deinit(true) has been called", but deinit() itself calls NimBLEDevice::deinit(true). Reword it to say so and warn against calling NimBLEDevice::deinit() separately. Found while reviewing the is_initialized() change in the same doc block. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
BleGattServer::is_initialized()and documents the one-server-per-boot constraint of the underlying NimBLE stack.is_initialized()returns whether this server currently owns the stack (between a successfulinit()anddeinit()), so an application that manages one BLE personality at a time can ask "is the radio up as this server?" without tracking it in parallel. It reportsserver_ != nullptr, the same flaginit()/deinit()already maintain.The class doc now states explicitly that NimBLE owns a single GATT server (
NimBLEDevice::createServer()returns that one server) and thatinit()/deinit()bring the whole stack up and down, so a design that switches between two GATT layouts mustdeinit()one beforeinit()-ing the next rather than hold two initialized instances at once.Why
Header-only, additive, no behavior change. It surfaces state the class already tracks, and writes down a constraint that is easy to trip over when a peripheral hosts more than one GATT personality across its lifetime.
Test
Builds the
ble_gatt_serverexample on esp32s3.