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

p_hvx_params:: uint16_t *p_len

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

Parents Reply
  • I did the relevant tests and found NRF_ERROR_RESOURCES happen, my tmp_len sometimes not been modified, sometimes changed to 1 or 2, what does this mean?Then I ignore the value of tmp_len, if NRF_ERROR_RESOURCE happened to resend all the data before, and then found in the peer device still able to receive the complete data, as if NRF_ERROR_RESOURCE modified tmp_len, but did not buffer any data to sd

Children
No Data
Related