This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Content of the BLE_GATTC_EVT_WRITE_RSP event parameter structure

Hello everybody,

sometimes, I find it pretty hard to work with the documentation provided by Nordic Semiconductor. For example, there is no straightforward documentation on the events that may be triggered by a specific Bluetooth operation, and which parameters provided by the event API have to be evaluated.

My current problem is that, when I invoke a GATTC write request, I do not know how to evaluate the data received within the BLE_GATTC_EVT_WRITE_RSP event (that should acknowledge the write operation on the GATT server):

typedef struct
{
  uint16_t            handle;           /**< Attribute Handle. */
  uint8_t             write_op;         /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */
  uint16_t            offset;           /**< Data Offset. */
  uint16_t            len;              /**< Data length. */
  uint8_t             data[1];          /**< Data, variable length. */
} ble_gattc_evt_write_rsp_t;

I write 18 bytes to an attribute at offset 0. When I receive the BLE_GATTC_EVT_WRITE_RSP event, the handle seems to be the same as in the write request. But offset is set to 15 and len is set to 0. I do not know how to interpret this data. What does it tell me? Is there any place in the documentation giving a straightforward description on how to use the data within the ble_gattc_evt_write_rsp_t structure? Or which fields are valid under which conditions?

How can I find out if the write operation was successful or if there was an error (e.g. the data length exceeds the attribute length)?

What I also find suspicious is that the Bluetooth data for the ATT Write Response packet only contains a single byte with the opcode (0x13), no other data is transferred from the GATT server. How can there be any information about offsets and lengths in the software API? Why are these fields included in the parameter structure?

Update (Feb 27, 2015):

Here is a snapshot from the Bluetooth communication: write_req.png

Parents Reply Children
No Data
Related