The maximum data length of a characteristic is 9, and I use the follow function to send the notification to a client
uint32_t dxs_send(dr_ble_dxs_t * p_dxs, uint8_t * p_data, uint16_t length)
{
uint32_t ret_code;
ble_gatts_hvx_params_t hvx_params;
if (p_dxs == NULL)
{
return NRF_ERROR_NULL;
}
if ((p_dxs->conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_dxs->is_notification_enabled_ctrl))
{
return NRF_ERROR_INVALID_STATE;
}
memset(&hvx_params, 0, sizeof(hvx_params));
hvx_params.handle = p_dxs->ctrl_handles.value_handle;
hvx_params.p_data = p_data;
hvx_params.p_len = &length;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
ret_code = sd_ble_gatts_hvx(p_dxs->conn_handle, &hvx_params);
return ret_code;
}
The problem is I always get notification with length of 9 on the client side, even though the input argument "length" is smaller than 9. Is there a way to change the length of notification data?