From defe1abb88d310f38fc7d3e188ea660a6caefa57 Mon Sep 17 00:00:00 2001 From: Abhinav Kudnar Date: Fri, 7 Feb 2025 20:01:39 +0800 Subject: [PATCH] feat(nimble): Add offset in GATT server long read context --- nimble/host/include/host/ble_gatt.h | 6 ++++++ nimble/host/src/ble_gatts.c | 1 + 2 files changed, 7 insertions(+) diff --git a/nimble/host/include/host/ble_gatt.h b/nimble/host/include/host/ble_gatt.h index c1333ddd7..23edf28b9 100644 --- a/nimble/host/include/host/ble_gatt.h +++ b/nimble/host/include/host/ble_gatt.h @@ -988,6 +988,12 @@ struct ble_gatt_access_ctxt { */ const struct ble_gatt_dsc_def *dsc; }; + + /** + * An offset in case of BLE_ATT_OP_READ_BLOB_REQ. + * If the value is greater than zero it's an indication of a long attribute read. + */ + uint16_t offset; }; /** diff --git a/nimble/host/src/ble_gatts.c b/nimble/host/src/ble_gatts.c index 05096f52a..a25324d32 100644 --- a/nimble/host/src/ble_gatts.c +++ b/nimble/host/src/ble_gatts.c @@ -518,6 +518,7 @@ ble_gatts_chr_val_access(uint16_t conn_handle, uint16_t attr_handle, gatt_ctxt.op = ble_gatts_chr_op(att_op); gatt_ctxt.chr = chr_def; + gatt_ctxt.offset = offset; ble_gatts_chr_inc_val_stat(gatt_ctxt.op); rc = ble_gatts_val_access(conn_handle, attr_handle, offset, &gatt_ctxt, om,