From afeb696d01c843564a407c0aa04a4f4ba96fd7c5 Mon Sep 17 00:00:00 2001 From: Paul Szczepanek Date: Wed, 9 Jun 2021 18:45:41 +0100 Subject: [PATCH] fix CORDIO not passing the conn id in param for adv stop event the hci handle is different from host handle, this is how it's done in conn open event, we carry the conn id in the hdr.param --- .../cordio_stack/ble-host/sources/stack/dm/dm_adv_ae.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/stack/dm/dm_adv_ae.c b/connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/stack/dm/dm_adv_ae.c index ab0c21be5b..ea32b7118d 100644 --- a/connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/stack/dm/dm_adv_ae.c +++ b/connectivity/FEATURE_BLE/libraries/cordio_stack/ble-host/sources/stack/dm/dm_adv_ae.c @@ -31,6 +31,7 @@ #include "dm_adv.h" #include "dm_dev.h" #include "dm_main.h" +#include "dm_conn.h" /************************************************************************************************** Macros @@ -1374,6 +1375,13 @@ void dmExtAdvHciHandler(hciEvt_t *pEvent) if (!DM_ADV_CONN_DIRECTED(advType)) { pEvent->hdr.event = DM_ADV_SET_STOP_IND; + if (pEvent->leAdvSetTerm.status == HCI_SUCCESS) { + /* translate the handle to conn id */ + dmConnCcb_t* ccb = dmConnCcbByHandle(pEvent->leAdvSetTerm.handle); + if (ccb) { + pEvent->hdr.param = ccb->connId; + } + } (*dmCb.cback)((dmEvt_t *) pEvent); } /* else if low duty cycle directed advertising failed to create connection */