bluez_peripheral.uuid module
- class bluez_peripheral.uuid.BTUUID(hex=None, bytes=None, bytes_le=None, fields=None, int=None, version=None, *, is_safe=SafeUUID.unknown)
An extension of the built-in UUID class with some utility functions for converting Bluetooth UUID16s to and from UUID128s.
- classmethod from_uuid16(id: Union[str, int]) BTUUID
Converts an integer or 4 digit hex string to a Bluetooth compatible UUID16.
- Parameters
id (Union[str, int]) – The UUID representation to convert.
- Raises
ValueError – Raised if the supplied UUID16 is not valid.
- Returns
The resulting UUID.
- Return type
- classmethod from_uuid16_128(id: str) BTUUID
Converts a 4 or 32 digit hex string to a bluetooth compatible UUID16.
- Raises
ValueError – Raised if the supplied string is not a valid UUID.
- Returns
The resulting UUID.
- Return type
- property uuid16: Optional[str]
Converts the UUID16 to a 4 digit string representation.
- Returns
The UUID representation or None if self is not a valid UUID16.
- Return type
Union[str, None]