Skip to content

Commit 4918c64

Browse files
committed
fix scan filtering for cases like (Advertisement, SubclassOfAdvertisement)
1 parent 7dcb774 commit 4918c64

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adafruit_ble/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,13 @@ def start_scan(
231231
"""
232232
if not advertisement_types:
233233
advertisement_types = (Advertisement,)
234-
prefixes = b"".join(adv.get_prefix_bytes() for adv in advertisement_types)
234+
235+
all_prefix_bytes = tuple(adv.get_prefix_bytes() for adv in advertisement_types)
236+
237+
# If one of the advertisement_types has no prefix restrictions, then
238+
# no prefixes should be specified at all, so we match everything.
239+
prefixes = b"" if b"" in all_prefix_bytes else b"".join(all_prefix_bytes)
240+
235241
for entry in self._adapter.start_scan(
236242
prefixes=prefixes,
237243
buffer_size=buffer_size,

0 commit comments

Comments
 (0)