From 00e956325429f342db0942a9a1437040f651b71d Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Mon, 15 May 2023 18:12:44 +0800 Subject: [PATCH] use event handling for disconnect event --- src/platform/Ameba/BLEManagerImpl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/Ameba/BLEManagerImpl.cpp b/src/platform/Ameba/BLEManagerImpl.cpp index 2cb77beb3e9c7e..4dba91c2db26f0 100644 --- a/src/platform/Ameba/BLEManagerImpl.cpp +++ b/src/platform/Ameba/BLEManagerImpl.cpp @@ -292,7 +292,12 @@ CHIP_ERROR BLEManagerImpl::HandleGAPDisconnect(uint16_t conn_id, uint16_t disc_c disconReason = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT; break; } - HandleConnectionError(conn_id, disconReason); + + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoBLEConnectionError; + event.CHIPoBLEConnectionError.ConId = conn_id; + event.CHIPoBLEConnectionError.Reason = disconReason; + PlatformMgr().PostEventOrDie(&event); // Force a reconfiguration of advertising in case we switched to non-connectable mode when // the BLE connection was established.