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

How to send notification for a large custom attribute

I am using nRF52 S132 and latest SDK V11. I defined a custom service with a custom characteristic which is 509 bytes (based on your tutorial). Read operation is fine from a client. But when using sd_ble_gatts_hvx() to send notification, only the first 20 bytes are received. The return code of this function is 0x3401, which means BLE_ERROR_GATTS_SYS_ATTR_MISSING. But it does not make sense to me. So I reduce the size from 509 to 10. The notification is sent and received. But the error code is still 0x3401. How to send notification properly?

Parents
  • Well you can only send 20 bytes in a notification because there's only room for that amount of data in a notification (unless you negotiate a large MTU first).

    And why does it make no sense to you to get BLE_ERROR_GATTS_SYS_ATTR_MISSING? That's one of the documented return codes from that function

     * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
    

    and system attributes are required to be set for notifications/indications, so if you haven't set them, you get that error.

  • I added the call sd_ble_gatts_sys_attr_set() to get rid of the error. But still I need a way to send notification of a attribute value which is bigger than 20 bytes. Tried to send it in a loop (with increasing offset) to cover all the data but only 20 bytes are shown at receiver always. Is there an example to show how to send it? Or please describe how would I send a 30 bytes notification, so that it can be shown same as a read operation.

Reply
  • I added the call sd_ble_gatts_sys_attr_set() to get rid of the error. But still I need a way to send notification of a attribute value which is bigger than 20 bytes. Tried to send it in a loop (with increasing offset) to cover all the data but only 20 bytes are shown at receiver always. Is there an example to show how to send it? Or please describe how would I send a 30 bytes notification, so that it can be shown same as a read operation.

Children
No Data
Related