Coverage for src / bluetooth_sig / gatt / characteristics / database_hash.py: 100%
9 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 16:41 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 16:41 +0000
1"""Database Hash characteristic (0x2B2A)."""
3from __future__ import annotations
5from ..context import CharacteristicContext
6from .base import BaseCharacteristic
9class DatabaseHashCharacteristic(BaseCharacteristic[bytes]):
10 """Database Hash characteristic (0x2B2A).
12 org.bluetooth.characteristic.database_hash
14 128-bit (16-byte) hash of the GATT database.
15 """
17 expected_length: int = 16
19 def _decode_value(
20 self, data: bytearray, ctx: CharacteristicContext | None = None, *, validate: bool = True
21 ) -> bytes:
22 return bytes(data[:16])
24 def _encode_value(self, data: bytes) -> bytearray:
25 return bytearray(data[:16].ljust(16, b"\x00"))