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

How to send 20 bytes using sd_ble_gatts_hvx

I've read in several other posts that it's possible to send up to 20 bytes per notification packet using sd_ble_gatts_hvx(). I've also read that we should not edit the file ble_gatts.h or any other header files that have a "ble_" prefix.

In ble_gatts.h, the definition for the ble_gatts_hvx_params_t struct has p_data set to uint8_t, which is equal to 1 byte. Rather than sending 1 byte though, I'm interested in sending 20 bytes, yet I'm not supposed to edit this value. So how do I send more data per packet without editing that value?

From some reading that i've done on other posts, I also see that the max_len attribute can be increased to a value that indicates 20 bytes. That seems like what needs to happen, and I've experimented with changing it. However I'm still limited to a single byte (uint8_t) for the p_data value, so setting max_len to 20 seems to have no impact.

Is there any sample code for calling sd_ble_gatts_hvx() with more than a single byte of data?

Related