Skip to content

Commit 9b5b533

Browse files
committed
Only convert 16-bit UUIDs to bytes. Reuse the 128-bit value.
1 parent a741c93 commit 9b5b533

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_ble/uuid/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def __str__(self):
5050
return str(self.bleio_uuid)
5151

5252
def __bytes__(self):
53-
b = bytearray(self.bleio_uuid.size // 8)
53+
if self.bleio_uuid.size == 128:
54+
return self.bleio_uuid.uuid128
55+
b = bytearray(2)
5456
self.bleio_uuid.pack_into(b)
5557
return bytes(b)
5658

0 commit comments

Comments
 (0)