From 80036badba9f6b09df1be3409143d76a4122cd45 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Thu, 5 Dec 2024 17:54:51 +0100 Subject: [PATCH] clear characteristic cccd value when disconnect --- src/utility/ATT.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utility/ATT.cpp b/src/utility/ATT.cpp index 9367cfbf..5d920a32 100644 --- a/src/utility/ATT.cpp +++ b/src/utility/ATT.cpp @@ -553,6 +553,22 @@ bool ATTClass::disconnect() numDisconnects++; + BLEDevice bleDevice(_peers[i].addressType, _peers[i].address); + + // clear CCCD values on disconnect + for (uint16_t att = 0; att < GATT.attributeCount(); att++) { + BLELocalAttribute* attribute = GATT.attribute(att); + + if (attribute->type() == BLETypeCharacteristic) { + BLELocalCharacteristic* characteristic = (BLELocalCharacteristic*)attribute; + + characteristic->writeCccdValue(bleDevice, 0x0000); + } + } + + _longWriteHandle = 0x0000; + _longWriteValueLength = 0; + _peers[i].connectionHandle = 0xffff; _peers[i].role = 0x00; _peers[i].addressType = 0x00; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy