Skip to content

[Breaking] Refactor GATT status codes for custom values - #455

Merged
h2zero merged 1 commit into
masterfrom
att-return-val-uint8
Oct 29, 2026
Merged

h2zero merged 1 commit into
masterfrom
att-return-val-uint8

Conversation

@h2zero

@h2zero h2zero commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner
  • Move named GATT status codes into the NimBLEGattStatus namespace.
  • Change GATT callback and event return types to uint8_t, allowing applications to return custom status values such as 0x80–0x9F.
  • Update the library, server implementation, and example callback signatures accordingly.

Summary by CodeRabbit

  • API Changes
    • Characteristic and descriptor read/write callbacks now return status codes as uint8_t. Existing status values remain available, and successful reads and writes continue to behave as before.
    • Applications that implement these callbacks may need to update their return types to match the revised API.

* Move named GATT status codes into the NimBLEGattStatus namespace.
* Change GATT callback and event return types to uint8_t, allowing applications to return custom status values such as 0x80–0x9F.
* Update the library, server implementation, and example callback signatures accordingly.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bab135e4-6ef6-46df-8b5c-69da41ca6945
Commits

Reviewing files that changed from the base of the PR and between 8fc7ed7 and 810f1a6.

Files selected for processing: 9
  • examples/NimBLE_Server/main/main.cpp
  • src/NimBLECharacteristic.cpp
  • src/NimBLECharacteristic.h
  • src/NimBLEDescriptor.cpp
  • src/NimBLEDescriptor.h
  • src/NimBLELocalValueAttribute.h
  • src/NimBLEServer.cpp
  • src/NimBLEStream.cpp
  • src/NimBLEStream.h

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

Arrr, GATT status constants now use an unscoped uint8_t enum. Characteristic and descriptor event methods and callbacks return uint8_t, with server, stream, and example code updated to match.

Changes: GATT status return types

Layer / File(s) Summary
Status type and attribute callbacks
src/NimBLELocalValueAttribute.h, src/NimBLECharacteristic.h, src/NimBLECharacteristic.cpp, src/NimBLEDescriptor.h, src/NimBLEDescriptor.cpp
NimBLEGattStatus now contains an unscoped uint8_t enum. Characteristic and descriptor event methods and callbacks return uint8_t. Write paths retain their existing success checks before updating values.
Server, stream, and example propagation
src/NimBLEServer.cpp, src/NimBLEStream.h, src/NimBLEStream.cpp, examples/NimBLE_Server/main/main.cpp
The server read path, stream callback, and example callbacks use uint8_t status results. Existing status checks and value-handling behavior remain.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

  • h2zero/esp-nimble-cpp#429: Arrr, this PR introduced the NimBLEGattStatus callback and event return chain that this change updates.
Merge Risk: Minimal · up to 810f1

No merge-blocking issue is established by the supplied review evidence.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: refactoring GATT status handling to support custom status values. It matches the changes to NimBLEGattStatus and the callback return types, matey.
Docstring Coverage Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 9 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Arrr, status bytes sail through the chain,
Callback returns now share the same domain.
Success checks keep their familiar place,
Values update at the same old pace.
The server and stream carry the code,
While example callbacks join the road.

Comment @coderabbitai help to get the list of available commands.

@h2zero
h2zero merged commit 861956a into master Oct 29, 2026
70 checks passed
@h2zero
h2zero deleted the att-return-val-uint8 branch October 29, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant