Skip to content

host: document GATT error status encoding#2252

Open
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:codex/gatt-error-status-doc
Open

host: document GATT error status encoding#2252
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:codex/gatt-error-status-doc

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • Clarify that ble_gatt_error.status uses NimBLE host return-code ranges, not raw ATT error values.
  • Document ATT error encoding with BLE_HS_ATT_ERR(code), including 0x0181 = 0x100 + 0x81.
  • Note that application-specific ATT errors are defined by the relevant service or profile specification after removing the ATT base.

Closes #1827

Testing

  • git diff --check origin/master...HEAD
  • Not run: python .github/check_doxygen.py HEAD origin/master (doxygen is not installed locally)
  • Not run: local clang-format check (clang-format is not installed locally)

@Old-Ding Old-Ding marked this pull request as ready for review July 1, 2026 05:38
Comment thread nimble/host/include/host/ble_gatt.h Outdated
* reported as BLE_HS_ATT_ERR(code), so status 0x0181 is ATT error 0x81
* (0x100 + 0x81). Application-specific ATT errors must be decoded by
* subtracting the ATT base and consulting the service or profile
* specification that defines the ATT error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi,

This is not valid comment. It just exposes current implementation specific details (mask 0x100).
In Nimble error mask is used for specifying which layer trigger error and application shall not assume
any specific layer when decoding.

So I'd suggest to comment here that status is following NimBLE error codes convention described in
https://mynewt.apache.org/latest/network/ble_hs/ble_hs_return_codes.html

Document that ble_gatt_error.status follows the NimBLE host return-code convention and point readers to the return-code documentation instead of describing implementation-specific ATT encoding details.

Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
@Old-Ding Old-Ding force-pushed the codex/gatt-error-status-doc branch from 90fd053 to 687997e Compare July 8, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error status 0x0181 sent back in BLE write call-back. What does it mean?

3 participants