2022-10-31 06:37 AM
Hi! I have a peripheral that calls
aci_gap_terminate(BleApplicationContext.BleApplicationContext_legacy.connectionHandle, HCI_AUTHENTICATION_FAILURE_ERR_CODE)
aci_gap_terminate(BleApplicationContext.BleApplicationContext_legacy.connectionHandle, HCI_AUTHENTICATION_FAILURE_ERR_CODE)
itself it receives the HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST_ERR_CODE reason in disconnect which I guess makes sense.
But the central that it disconnects from will always receive the
HCI_REMOTE_USER_TERMINATED_CONNECTION_ERR_CODE 0x13
case HCI_DISCONNECTION_COMPLETE_EVT_CODE:
{
/* USER CODE BEGIN EVT_DISCONN_COMPLETE */
cc = (hci_disconnection_complete_event_rp0 *) event_pckt->data;
/* USER CODE END EVT_DISCONN_COMPLETE */
handleNotification.Reason = cc->Reason;
APP_DBG_MSG("\r\n\r** DISCONNECTION EVENT WITH SERVER reason: %x status: %x \n\r", cc->Reason, cc->Status);
}
Reason will always be 0x13 and status 0x00
The devices are flashed with the latest ble binaries
stm32wb1x_BLE_Stack_full_fw.bin
And are using the libs
STM32Cube_FW_WB_V1.14.0
Best regards Wallentin
2022-11-09 05:29 AM
Hello,
The behavior that you observe seems to be good. The peripheral send aci_gap_terminate command to terminate the connection so itself it receives the HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST_ERR_CODE reason and the central received HCI_REMOTE_USER_TERMINATED_CONNECTION_ERR_CODE reason because the disconnection is sent by the peripheral (e.g the remote device).
Best Regards
2022-11-09 05:55 AM
Hey,
I understand that the HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST_ERR_CODE should be the reason at the peripheral side but because I send the
HCI_AUTHENTICATION_FAILURE_ERR_CODE as the reason when using aci_gap_terminate
The central should receive that reason (0x05) as I understand? How else should the central know why the peripheral disconnected?
2023-03-30 07:31 AM
Hello,
Since STM32CubeWB v1.16.0, the disconnection reason used in aci_gap_terminate command is propagated on remote side.
The allowed remote reason values are:
Best Regards