src.bluetooth_sig.types.appearance

Appearance value types for Bluetooth device identification.

Classes

Name

Description

AppearanceData

Appearance characteristic data with human-readable info.

Module Contents

class src.bluetooth_sig.types.appearance.AppearanceData

Bases: msgspec.Struct

Appearance characteristic data with human-readable info.

raw_value

Raw 16-bit appearance code from BLE

info

Optional decoded appearance information from registry

classmethod from_category(category: str, subcategory: str | None = None) AppearanceData

Create AppearanceData from category and subcategory strings.

This helper validates the strings and finds the correct raw_value by searching the registry. Useful when creating appearance data from user-provided human-readable names.

Parameters:
  • category – Device category name (e.g., “Heart Rate Sensor”)

  • subcategory – Optional subcategory name (e.g., “Heart Rate Belt”)

Returns:

AppearanceData with validated info and correct raw_value

Raises:

ValueError – If category/subcategory combination is not found in registry

Example

>>> data = AppearanceData.from_category("Heart Rate Sensor", "Heart Rate Belt")
>>> data.raw_value
833
property category: str | None

Get device category name.

Returns:

Category name or None if info not available

property full_name: str | None

Get full human-readable name.

Returns:

Full device type name or None if info not available

info: bluetooth_sig.types.registry.appearance_info.AppearanceInfo | None = None
raw_value: int
property subcategory: str | None

Get device subcategory name.

Returns:

Subcategory name or None if not available