This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

error using the sd_ble_gatts_hvx()

I want to use the sd_ble_gatts_hvx() to send the notification with a packet, and the length of packet is 12 bytes, but the return value is "0x000C". I tested the length and I found the max_len is 4 bytes, when I set the length is 5, the error appears. For my understanding, the max_length of p.value is 20 bytes? Am I wrong?

uint32_t err_code = NRF_SUCCESS;
uint16_t len = 12;  // 4
ble_gatts_hvx_params_t params;

if (p_footsensor->conn_handle != BLE_CONN_HANDLE_INVALID)
{
    memset(&params, 0, sizeof(params));
    params.type     = BLE_GATT_HVX_NOTIFICATION;
    params.offset   = 0;
    params.handle   = p_footsensor->mpu6050_data_handles.value_handle;
    params.p_data   = packet->data;
    params.p_len    = &len;

    err_code = sd_ble_gatts_hvx(p_footsensor->conn_handle, &params);
}

return err_code;
Related