Skip to content

Commit b136108

Browse files
committed
aioble/security: Add support for CCCD bonding.
1 parent c8a0f4c commit b136108

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

micropython/bluetooth/aioble/aioble/security.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
limit_peers = None
3636

3737
SEC_TYPES_SELF = (10, )
38-
SEC_TYPES_PEER = (1, 2, 3, 4)
39-
38+
SEC_TYPES_PEER = (1, 2, 4)
39+
SEC_TYPES_CCCD = (3, )
4040

4141
# Must call this before stack startup.
4242
def load_secrets(path=None):
@@ -124,7 +124,7 @@ def _log_peers(heading=""):
124124
if core.log_level <= 2:
125125
return
126126
log_info("secrets:", heading)
127-
for sec_type in SEC_TYPES_PEER:
127+
for sec_type in SEC_TYPES_PEER + SEC_TYPES_CCCD:
128128
log_info("-", sec_type)
129129

130130
if sec_type not in _secrets:
@@ -216,6 +216,9 @@ def _security_irq(event, data):
216216

217217
for k, v in secrets:
218218
if k == key:
219+
if index:
220+
index -= 1
221+
continue
219222
return v
220223
return None
221224

0 commit comments

Comments
 (0)