File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -553,6 +553,22 @@ bool ATTClass::disconnect()
553
553
554
554
numDisconnects++;
555
555
556
+ BLEDevice bleDevice (_peers[i].addressType , _peers[i].address );
557
+
558
+ // clear CCCD values on disconnect
559
+ for (uint16_t att = 0 ; att < GATT.attributeCount (); att++) {
560
+ BLELocalAttribute* attribute = GATT.attribute (att);
561
+
562
+ if (attribute->type () == BLETypeCharacteristic) {
563
+ BLELocalCharacteristic* characteristic = (BLELocalCharacteristic*)attribute;
564
+
565
+ characteristic->writeCccdValue (bleDevice, 0x0000 );
566
+ }
567
+ }
568
+
569
+ _longWriteHandle = 0x0000 ;
570
+ _longWriteValueLength = 0 ;
571
+
556
572
_peers[i].connectionHandle = 0xffff ;
557
573
_peers[i].role = 0x00 ;
558
574
_peers[i].addressType = 0x00 ;
@@ -566,6 +582,7 @@ bool ATTClass::disconnect()
566
582
_peers[i].device = NULL ;
567
583
}
568
584
585
+
569
586
return (numDisconnects > 0 );
570
587
}
571
588
You can’t perform that action at this time.
0 commit comments