Skip to content

Commit

Permalink
Merge pull request #244 from peplin/pr/242
Browse files Browse the repository at this point in the history
Patched version of #242
  • Loading branch information
peplin authored May 27, 2019
2 parents 35edf21 + e8e379f commit 8916795
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pygatt/backends/bgapi/bgapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,13 @@ def _scan_rsp_data(self, data):
# Field type specific formats
if (field_name == 'complete_local_name' or
field_name == 'shortened_local_name'):
dev_name = bytearray(field_value).decode("utf-8")
data_dict[field_name] = dev_name
try:
dev_name = bytearray(field_value).decode("utf-8")
except:
log.debug("Failed to decode data as UTF8, "
"returning verbatim")
else:
data_dict[field_name] = dev_name
elif (field_name ==
'complete_list_128-bit_service_class_uuids'):
if len(field_value) % 16 == 0: # 16 bytes
Expand Down

0 comments on commit 8916795

Please sign in to comment.