Coverage for src / bluetooth_sig / gatt / characteristics / aggregate.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-03 16:41 +0000

1"""Aggregate characteristic (0x2A5A).""" 

2 

3from __future__ import annotations 

4 

5from ..context import CharacteristicContext 

6from .base import BaseCharacteristic 

7 

8 

9class AggregateCharacteristic(BaseCharacteristic[bytes]): 

10 """Aggregate characteristic (0x2A5A). 

11 

12 org.bluetooth.characteristic.aggregate 

13 

14 Concatenation of all characteristic values referenced by the 

15 Aggregate format descriptor. Treated as raw bytes passthrough. 

16 """ 

17 

18 min_length = 0 

19 allow_variable_length = True 

20 

21 def _decode_value( 

22 self, data: bytearray, ctx: CharacteristicContext | None = None, *, validate: bool = True 

23 ) -> bytes: 

24 return bytes(data) 

25 

26 def _encode_value(self, data: bytes) -> bytearray: 

27 return bytearray(data)