Only convert 16-bit UUIDs to bytes. Reuse the 128-bit value.

This commit is contained in:
Scott Shawcroft 2020-02-14 10:13:31 -08:00
parent a741c93797
commit 9b5b53392f
No known key found for this signature in database
GPG key ID: 9349BC7E64B1921E

View file

@ -50,7 +50,9 @@ class UUID:
return str(self.bleio_uuid)
def __bytes__(self):
b = bytearray(self.bleio_uuid.size // 8)
if self.bleio_uuid.size == 128:
return self.bleio_uuid.uuid128
b = bytearray(2)
self.bleio_uuid.pack_into(b)
return bytes(b)