Skip to content

Commit 7b06c53

Browse files
authored
Merge pull request #93 from dhalbert/start_scan-prefix-fix
fix scan filtering for cases like (Advertisement, SubclassOfAdvertisment)
2 parents 7dcb774 + 8e32223 commit 7b06c53

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
awk -F '\/' '{ print tolower($2) }' |
1919
tr '_' '-'
2020
)
21-
- name: Set up Python 3.6
21+
- name: Set up Python 3.7
2222
uses: actions/setup-python@v1
2323
with:
24-
python-version: 3.6
24+
python-version: 3.7
2525
- name: Versions
2626
run: |
2727
python3 --version

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
awk -F '\/' '{ print tolower($2) }' |
2121
tr '_' '-'
2222
)
23-
- name: Set up Python 3.6
23+
- name: Set up Python 3.7
2424
uses: actions/setup-python@v1
2525
with:
26-
python-version: 3.6
26+
python-version: 3.7
2727
- name: Versions
2828
run: |
2929
python3 --version

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,

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Uncomment the below if you use native CircuitPython modules such as
2222
# digitalio, micropython and busio. List the modules you use. Without it, the
2323
# autodoc module docs will fail to generate with a warning.
24-
autodoc_mock_imports = ["board", "microcontroller"]
24+
autodoc_mock_imports = ["bleak", "board", "microcontroller"]
2525
autodoc_member_order = "bysource"
2626
add_module_names = False
2727

0 commit comments

Comments
 (0)