Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

micropython/aioble: Place multiple UUIDs in single advertisement LTV. #787

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion micropython/bluetooth/aioble-peripheral/manifest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
metadata(version="0.2.0")
metadata(version="0.2.1")

require("aioble-core")

Expand Down
15 changes: 7 additions & 8 deletions micropython/bluetooth/aioble/aioble/peripheral.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ async def advertise(
# Services are prioritised to go in the advertising data because iOS supports
# filtering scan results by service only, so services must come first.
if services:
for uuid in services:
b = bytes(uuid)
if len(b) == 2:
resp_data = _append(adv_data, resp_data, _ADV_TYPE_UUID16_COMPLETE, b)
elif len(b) == 4:
resp_data = _append(adv_data, resp_data, _ADV_TYPE_UUID32_COMPLETE, b)
elif len(b) == 16:
resp_data = _append(adv_data, resp_data, _ADV_TYPE_UUID128_COMPLETE, b)
for uuid_len, code in (
(2, _ADV_TYPE_UUID16_COMPLETE),
(4, _ADV_TYPE_UUID32_COMPLETE),
(16, _ADV_TYPE_UUID128_COMPLETE),
):
if uuids := [bytes(uuid) for uuid in services if len(bytes(uuid)) == uuid_len]:
resp_data = _append(adv_data, resp_data, code, b"".join(uuids))

if name:
resp_data = _append(adv_data, resp_data, _ADV_TYPE_NAME, name)
Expand Down
2 changes: 1 addition & 1 deletion micropython/bluetooth/aioble/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# code. This allows (for development purposes) all the files to live in the
# one directory.

metadata(version="0.5.0")
metadata(version="0.5.1")

# Default installation gives you everything. Install the individual
# components (or a combination of them) if you want a more minimal install.
Expand Down