The description of p_hvx_params :: uint16_t * p_len in ble_gatts.h is:
"Lnegth in bytes to be written, length in bytes written after successful return"
uint16_t len = 10;
uint32_t err_code;
uint8_t buffer [10];
func()
{
err_code = sd_ble_gatts_hvx (buffer, &len)
if (err_code = NRF_SUCCESS) {
len =?
/ * case 1: len = 10 * /
/ * case 2: len = 0 * /
/ * case 3: len = 8 * /
}
}
My current test can get case1 every time, but case2 and case3 may appear? Because if not, I feel there is no need to pass a pointer when calling sd_ble_gatts_hvx