bluez_peripheral.uuid16 module

class bluez_peripheral.uuid16.UUID16(hex=None, bytes=None, int=None, uuid=None)[source]

Bases: object

A container for BLE uuid16 values.

Parameters:
  • hex (str | None) – A hexadecimal representation of a uuid16 or compatible uuid128.

  • bytes (bytes | None) – A 16-bit or 128-bit value representing a uuid16 or compatible uuid128.

  • int (int | None) – A numeric value representing a uuid16 (if < 2^16) or compatible uuid128.

  • uuid (UUID | None) – A compatible uuid128.

property bytes: bytes

Returns a two byte value corresponding to this uuid16.

property hex: str

Returns a 4 character hex string representing this uuid16.

property int: int

Returns the 16-bit integer value corresponding to this uuid16.

classmethod is_in_range(uuid)[source]

Determines if a supplied uuid128 is in the allowed uuid16 range.

Returns:

True if the uuid is in range, False otherwise.

Parameters:

uuid (UUID)

Return type:

bool

classmethod parse_uuid(uuid)[source]

Attempts to parse a supplied UUID representation to a UUID16. If the resulting value is out of range a UUID128 will be returned instead.

Parameters:

uuid (str | bytes | UUID | UUID16 | int)

Return type:

UUID | UUID16

property uuid: UUID

Returns the full uuid128 corresponding to this uuid16.