Skip to content

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

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 uint8_t status values instead of NimBLEGattStatus. Existing success and error handling remains unchanged.
    • Applications that override these callbacks may need to update their return type. Callbacks can return standard or application-defined status values.

* 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: fcd1532c-1776-485b-a139-9c52de01c6ed
Commits

Reviewing files that changed from the base of the PR and between f2bd8b3 and 8f88471.

Files selected for processing: 9
  • examples/NimBLE_Server/NimBLE_Server.ino
  • 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 4 included reviews per hour; 3 remain after this review.

Walkthrough

Arr, the GATT status API now uses uint8_t for attribute events and callbacks. NimBLEGattStatus retains namespace-qualified status names as uint8_t values. Existing success checks and value-update behavior remain unchanged.

Changes: GATT Status Return-Type Update

Layer / File(s) Summary
Status and event contract
src/NimBLELocalValueAttribute.h
Arr, NimBLEGattStatus is now a namespace of uint8_t values, and local attribute event methods return uint8_t.
Characteristic and descriptor callbacks
src/NimBLECharacteristic.h, src/NimBLECharacteristic.cpp, src/NimBLEDescriptor.h, src/NimBLEDescriptor.cpp
Arr, characteristic and descriptor event methods and callbacks now return uint8_t. Existing write success checks and conditional value updates remain.
Server, stream, and example call sites
src/NimBLEServer.cpp, src/NimBLEStream.h, src/NimBLEStream.cpp, examples/NimBLE_Server/NimBLE_Server.ino
Arr, server status handling, stream callbacks, and example callbacks now use uint8_t results. Existing status checks and callback behavior remain.

Priority: Normal

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

Change: Feature

Possibly related PRs

  • h2zero/NimBLE-Arduino#1203: Arr, this PR introduces NimBLEGattStatus and updates characteristic and descriptor callbacks; this change follows by using uint8_t status returns.
Merge Risk: Minimal · up to 8f884

The status-code change is ready to merge after normal checks; no actionable issue was found.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Title check Passed Arr, the title be fair to middlin'. It names the main change, a refactor of GATT status codes so custom values can be returned, and it flags the breaking nature. The changeset moves named codes into t…
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.

Full details: Title check

Explanation

Arr, the title be fair to middlin'. It names the main change, a refactor of GATT status codes so custom values can be returned, and it flags the breaking nature. The changeset moves named codes into the NimBLEGattStatus namespace and switches the readEvent, writeEvent, and callback return types to uint8_t across the library, server, stream, and example files, so the title matches the core of the PR.

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

Arr, status values sail as bytes,
Callback signatures chart new routes.
Success checks keep their steady pace,
Descriptors answer in the same place.
Custom codes join the ship’s embrace.

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

@h2zero h2zero changed the title Refactor GATT status codes for custom values [Breaking] Refactor GATT status codes for custom values Oct 28, 2026
@h2zero
h2zero merged commit 0d7e2a8 into master Oct 29, 2026
44 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