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

12 statements  

« prev     ^ index     » next       coverage.py v7.14.3, created at 2026-06-28 01:26 +0000

1"""Cookware Sensor Aggregate characteristic (0x2C2D).""" 

2 

3from __future__ import annotations 

4 

5import msgspec 

6 

7from ..context import CharacteristicContext 

8from .base import BaseCharacteristic 

9 

10 

11class CookwareSensorAggregateValue(msgspec.Struct, frozen=True, kw_only=True): 

12 """Decoded Cookware Sensor Aggregate payload. 

13 

14 CWS defines this value as the concatenation of participating Cookware 

15 Sensor Data characteristic values. Segment boundaries are described by the 

16 Cooking Sensor Info descriptor Aggregate Offset fields. 

17 """ 

18 

19 aggregate_data: bytes = b"" 

20 

21 

22class CookwareSensorAggregateCharacteristic(BaseCharacteristic[CookwareSensorAggregateValue]): 

23 """Cookware Sensor Aggregate characteristic (0x2C2D). 

24 

25 org.bluetooth.characteristic.cookware_sensor_aggregate 

26 """ 

27 

28 allow_variable_length = True 

29 

30 def _decode_value( 

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

32 ) -> CookwareSensorAggregateValue: 

33 return CookwareSensorAggregateValue(aggregate_data=bytes(data)) 

34 

35 def _encode_value(self, data: CookwareSensorAggregateValue) -> bytearray: 

36 return bytearray(data.aggregate_data)