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

Avoid updating attribute value on Indications/Notifications

The documentation for the sd_ble_gatts_hvx() method states:

This function checks for the relevant Client Characteristic Configuration descriptor value to verify that the relevant operation (notification or indication) has been enabled by the client. It is also able to update the attribute value before issuing the PDU, so that the application can atomically perform a value update and a server initiated transaction with a single API call. If the application chooses to indicate an attribute value, a BLE_GATTS_EVT_HVC event will be issued as soon as the confirmation arrives from the peer.

What I am wondering is if there is a way to skip updating the attribute value in the database. In my case, doing so is a waste of time as I have no use for that value except to deliver it. This is especially true if I chose the approach to indicate or notify, wait for the appropriate event that states the task is finished, and then send the next. Maybe the cost of updating the internal database is trivial?

Parents
  • I am not quite sure I understand your question, but let me give it a go.

    Notifications vs indications is almost the same. The difference is the layer in which the payload is ACKed. Notifications are ACKedin the link layer (in the softdevice), while indications are ACKed in the application layer. If you are not interrested in updating the value at all, I would suggest you use notifications, as these are much more efficient.

    That being said, the value of a characteristic is updated whether you like it or not *. If it only supports notification, and not read, then strictly speaking, there is no value to update. It will just push the value to the device that has enabled notifications, sort of like a pipe.

    *If you use write with permission, then you will send a write request, which you can reject or accept, but if you do this to save time, then it is lost, because it generates a lot more messages back and forth, which takes a lot more time than actually updating the value.

    So why are you asking this? Do you see that the throughput is not high enough? Do you want to save power? Or do you simply "not need to store the value"?

    Best regards,

    Edvin

Reply
  • I am not quite sure I understand your question, but let me give it a go.

    Notifications vs indications is almost the same. The difference is the layer in which the payload is ACKed. Notifications are ACKedin the link layer (in the softdevice), while indications are ACKed in the application layer. If you are not interrested in updating the value at all, I would suggest you use notifications, as these are much more efficient.

    That being said, the value of a characteristic is updated whether you like it or not *. If it only supports notification, and not read, then strictly speaking, there is no value to update. It will just push the value to the device that has enabled notifications, sort of like a pipe.

    *If you use write with permission, then you will send a write request, which you can reject or accept, but if you do this to save time, then it is lost, because it generates a lot more messages back and forth, which takes a lot more time than actually updating the value.

    So why are you asking this? Do you see that the throughput is not high enough? Do you want to save power? Or do you simply "not need to store the value"?

    Best regards,

    Edvin

Children
No Data
Related