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(¶ms, 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, ¶ms);
}
return err_code;