src.bluetooth_sig.advertising.sig_characteristic_interpreter

SIG characteristic interpreter for standard service data.

Built-in interpreter that uses CharacteristicRegistry to parse SIG-standard service data from BLE advertisements. Automatically handles any UUID registered in CharacteristicRegistry.

Based on Bluetooth SIG GATT Specification Supplement for characteristic data formats.

Attributes

Name

Description

logger

Classes

Name

Description

SIGCharacteristicData

Parsed SIG characteristic data from service data advertisement.

SIGCharacteristicInterpreter

Interprets service data using SIG characteristic definitions.

Module Contents

class src.bluetooth_sig.advertising.sig_characteristic_interpreter.SIGCharacteristicData

Bases: msgspec.Struct

Parsed SIG characteristic data from service data advertisement.

uuid

The characteristic UUID that was parsed.

characteristic_name

Human-readable characteristic name.

parsed_value

The parsed characteristic value (type varies by characteristic).

characteristic_name: str
parsed_value: Any
uuid: bluetooth_sig.types.uuid.BluetoothUUID
class src.bluetooth_sig.advertising.sig_characteristic_interpreter.SIGCharacteristicInterpreter(mac_address: str)

Bases: bluetooth_sig.advertising.base.PayloadInterpreter[SIGCharacteristicData]

Interprets service data using SIG characteristic definitions.

Automatically handles any UUID registered in CharacteristicRegistry. No encryption support (SIG characteristics are not encrypted in service data).

This interpreter checks service data UUIDs against the CharacteristicRegistry and parses the payload using the corresponding characteristic class.

Example

from bluetooth_sig.advertising.base import AdvertisingData

interpreter = SIGCharacteristicInterpreter(“AA:BB:CC:DD:EE:FF”) state = DeviceAdvertisingState(address=”AA:BB:CC:DD:EE:FF”)

# Create advertising data from BLE packet ad_data = AdvertisingData(

service_data={BluetoothUUID(“0000180f-0000-1000-8000-00805f9b34fb”): bytes([75])}, rssi=-60,

)

try:

data = interpreter.interpret(ad_data, state) print(f”Parsed: {data.parsed_value}”)

except AdvertisingParseError as e:

print(f”Parse failed: {e}”)

interpret(advertising_data: bluetooth_sig.advertising.base.AdvertisingData, state: bluetooth_sig.advertising.state.DeviceAdvertisingState) SIGCharacteristicData

Interpret service data using SIG characteristic definitions.

Finds the first service data UUID that matches a registered characteristic and parses the payload using that characteristic class.

Parameters:
  • advertising_data – Complete advertising data from BLE packet.

  • state – Current device advertising state (unused, no encryption).

Returns:

SIGCharacteristicData with parsed characteristic value.

Raises:

AdvertisingParseError – If no matching characteristic or parsing fails.

classmethod supports(advertising_data: bluetooth_sig.advertising.base.AdvertisingData) bool

Check if any service data UUID matches a registered characteristic.

Parameters:

advertising_data – Complete advertising data from BLE packet.

Returns:

True if at least one service data UUID has a registered characteristic.

src.bluetooth_sig.advertising.sig_characteristic_interpreter.logger