Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9f7d347

Browse files
authored
Merge pull request #376 from fabik111/fix-disconnection
Clear characteristic cccd value when disconnect
2 parents 87913ee + 80036ba commit 9f7d347

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎src/utility/ATT.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,22 @@ bool ATTClass::disconnect()
553553

554554
numDisconnects++;
555555

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+
556572
_peers[i].connectionHandle = 0xffff;
557573
_peers[i].role = 0x00;
558574
_peers[i].addressType = 0x00;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /