From 66096b876b00c5def967b823b49b7e49c0eb91ff Mon Sep 17 00:00:00 2001 From: rmlearney-digicatapult <39194639+rmlearney-digicatapult@users.noreply.github.com> Date: Tue, 7 Apr 2020 23:25:50 +0100 Subject: [PATCH] Add callback handling on disconnection to ATTClass::disconnect() Copying method from ATTClass::removeConnection --- src/utility/ATT.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utility/ATT.cpp b/src/utility/ATT.cpp index 2696960e..ef92f52f 100644 --- a/src/utility/ATT.cpp +++ b/src/utility/ATT.cpp @@ -481,6 +481,12 @@ bool ATTClass::disconnect() } numDisconnects++; + + BLEDevice bleDevice(_peers[i].addressType, _peers[i].address); + + if (_eventHandlers[BLEDisconnected]) { + _eventHandlers[BLEDisconnected](bleDevice); + } _peers[i].connectionHandle = 0xffff; _peers[i].role = 0x00;