From 90fd053f293c88df3cfeb70c27510f80c7b13297 Mon Sep 17 00:00:00 2001 From: aineoae86-sys Date: Wed, 1 Jul 2026 11:34:44 +0800 Subject: [PATCH] host: document GATT error status encoding Clarify that ble_gatt_error.status uses NimBLE host return-code ranges instead of raw ATT error values. This helps callers decode application-specific ATT errors such as 0x0181 by first removing the ATT base. --- nimble/host/include/host/ble_gatt.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nimble/host/include/host/ble_gatt.h b/nimble/host/include/host/ble_gatt.h index e74ba9e1a1..a6b2854146 100644 --- a/nimble/host/include/host/ble_gatt.h +++ b/nimble/host/include/host/ble_gatt.h @@ -204,7 +204,15 @@ struct ble_hs_cfg; /*** @client. */ /** Represents a GATT error. */ struct ble_gatt_error { - /** The GATT status code indicating the type of error. */ + /** + * The NimBLE host status code indicating the type of error. + * + * This value uses the NimBLE host return-code ranges. ATT errors are + * 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. + */ uint16_t status; /** The attribute handle associated with the error. */