src.bluetooth_sig.gatt.characteristics.utils.debug_utils¶
Debug utility methods for characteristic parsing.
Classes¶
Name | Description |
|---|---|
Utility class for debugging and testing support. |
Module Contents¶
- class src.bluetooth_sig.gatt.characteristics.utils.debug_utils.DebugUtils¶
Utility class for debugging and testing support.
- static format_binary_flags(value: int, bit_names: list[str]) str¶
Format integer as binary flags with names.
- static format_field_error(error: bluetooth_sig.types.data_types.ParseFieldError, data: bytes | bytearray) str¶
Format a field-level parsing error with context.
- Parameters:
error – The ParseFieldError to format
data – Complete raw data for context
- Returns:
Formatted error message with hex dump and field context
- static format_field_errors(errors: list[Any], data: bytes | bytearray) str¶
Format multiple field errors into a readable message.
- Parameters:
errors – List of ParseFieldError objects
data – Complete raw data for context
- Returns:
Formatted string with all field errors and context
- static format_hex_data(data: bytes | bytearray, separator: str = ' ') str¶
Format binary data as hex string.
- static format_measurement_value(value: int | float | str | None, unit: str | None = None, precision: int = 2) str¶
Format measurement value with unit for display.
- static format_parse_trace(trace: list[str]) str¶
Format parse trace as readable steps.
- Parameters:
trace – List of parse trace entries
- Returns:
Formatted trace string
- static validate_round_trip(characteristic: bluetooth_sig.types.protocols.CharacteristicProtocol, original_data: bytearray) bool¶
Validate that parse/encode operations preserve data integrity.
- static validate_struct_format(data: bytes | bytearray, format_string: str) None¶
Validate data length matches struct format requirements.
- DEFAULT_PRECISION = 2¶
- HEX_FORMAT_WIDTH = 2¶