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

GATT improvements #90

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ async def get_peer_name(peer, mode):
if not services:
return None

values = await peer.read_characteristics_by_uuid(GATT_DEVICE_NAME_CHARACTERISTIC, services[0])
if values:
return values[0].decode('utf-8')
characteristics = await peer.read_characteristics_by_uuid(GATT_DEVICE_NAME_CHARACTERISTIC, services[0])
if characteristics:
return characteristics[0][1].decode('utf-8')


# -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion bumble/gatt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ async def read_characteristics_by_uuid(self, uuid, service):
logger.warning(f'bogus handle value: {attribute_handle}')
return []

characteristics_values.append(attribute_value)
characteristics_values.append((attribute_handle, attribute_value))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a comment /doc on the method to explain that what's returned is a list of (handle, value) pairs now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also add a type to function definition so mypy can catch any mismatched usage


# Move on to the next characteristics
starting_handle = response.attributes[-1][0] + 1
Expand Down