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

Gatt message for multiple notifications on multiple characteristics

Hello!

I would like to know if it is possible to send an unique Gatt message that contains notification enable for multiple characteristics.

For example,

buf[0] = BLE_GATT_HVX_NOTIFICATION;
buf[1] = 0; 
write_params.write_op = BLE_GATT_OP_WRITE_REQ; 
write_params.handle = p_ble_lbs_c->bl_cccd_handle; 
write_params.offset = 0; 
write_params.len = sizeof(buf); 
write_params.p_value = buf;

err_code = sd_ble_gattc_write(p_ble_lbs->conn_handle, write_params);

This will enable notification for 1 characteristic. What I want to do is to write one message that contains notification enable for all my chars.

Parents
  • Hi,

    The way you state your question, the answer is no - this is not possible. Each individual write can only address a single handle at a time, which means it is impossible to do this in a single request.

    However, if you are not after saving time, but to just make sure you are enabling/disabling all notifications at the same time, you can use long writes (prepare writes). This sends individual prepare write requests to the peer, and instantaneously writes all of them once you send the execute write request.

    MSC example and Write API documentation.

Reply
  • Hi,

    The way you state your question, the answer is no - this is not possible. Each individual write can only address a single handle at a time, which means it is impossible to do this in a single request.

    However, if you are not after saving time, but to just make sure you are enabling/disabling all notifications at the same time, you can use long writes (prepare writes). This sends individual prepare write requests to the peer, and instantaneously writes all of them once you send the execute write request.

    MSC example and Write API documentation.

Children
No Data
Related