GATT prepare/execute write with NCS

Hi

I'm using the nRF Connect SDK v2.7.0 in central/client role to write data into a characteristic on a peer device.

I've seen that the function bt_gatt_write() automatically uses the prepare-/execute-write-requests when an offset is used or the data-length is bigger than the MTU size.

Are there also a publicly available GATT functions to use prepare- and execute-write-requests on purpose?

I'm asking this because these requests would also allow to prepare-writes for different handles and execute them all at once (which seems not possible with bt_gatt_write()).

Many thanks in advance.

Best regards

Remo

Parents
  • I am sorry, I had to delete my previous reply and sorry for making your comment hang in there. I was wrong as the functions I mentioned were not publicly available to the application in the newer version of the sdk. the functions I mentioned aren’t available in the newer SDK version for direct use in applications. bt_gatt_write() does indeed handle cases where the data size exceeds the MTU by leveraging prepare and execute requests, but it doesn’t allow grouping multiple writes across different handles in a single transaction.

    If you need to work with multiple handles like this, One option is to set up your application to handle each bt_gatt_write() call in sequence—one per handle—and then wait for each write's callback to confirm completion before moving to the next. This would give you a managed sequence of writes, even though they’re individual transactions. This sounds like a compromise but an option nevertheless.

Reply
  • I am sorry, I had to delete my previous reply and sorry for making your comment hang in there. I was wrong as the functions I mentioned were not publicly available to the application in the newer version of the sdk. the functions I mentioned aren’t available in the newer SDK version for direct use in applications. bt_gatt_write() does indeed handle cases where the data size exceeds the MTU by leveraging prepare and execute requests, but it doesn’t allow grouping multiple writes across different handles in a single transaction.

    If you need to work with multiple handles like this, One option is to set up your application to handle each bt_gatt_write() call in sequence—one per handle—and then wait for each write's callback to confirm completion before moving to the next. This would give you a managed sequence of writes, even though they’re individual transactions. This sounds like a compromise but an option nevertheless.

Children
Related