UUID()
Create a UUID container.
ble.UUID(value)
<value>
The value parameter can be either:
- A 16-bit integer. For example 0x2893.
- A 128-bit UUID string. For example 'eb76d48b-a885-4059-b70e-adfc7f33d255'.
Return value
A UUID object containing the passed UUID.
To read the UUID value, convert the UUID object into a bytes or bytearray object:
uuid = ble.UUID(0x1010)
uuid_value = bytes(uuid)
# b'\x10\x10'
The size, in bytes, of the UUID value can be determined using the built-in len function:
assert len(ble.UUID(0x1234)) == 2 # 16 bits
assert len(ble.UUID('eb76d48b-a885-4059-b70e-adfc7f33d255')) == 16 # 128 bits