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

12 statements  

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

1"""Mesh Proxy Data In characteristic implementation.""" 

2 

3from __future__ import annotations 

4 

5from ...types.gatt_enums import CharacteristicRole 

6from ..context import CharacteristicContext 

7from .base import BaseCharacteristic 

8 

9 

10class MeshProxyDataInCharacteristic(BaseCharacteristic[bytes]): 

11 """Mesh Proxy Data In characteristic (0x2ADD). 

12 

13 org.bluetooth.characteristic.mesh_proxy_data_in 

14 

15 Write-only characteristic for Mesh Proxy PDU passthrough. 

16 Variable-length raw bytes written by the proxy client. 

17 """ 

18 

19 _manual_role = CharacteristicRole.CONTROL 

20 min_length: int = 1 

21 allow_variable_length: bool = True 

22 

23 def _decode_value( 

24 self, 

25 data: bytearray, 

26 ctx: CharacteristicContext | None = None, 

27 *, 

28 validate: bool = True, 

29 ) -> bytes: 

30 """Pass through raw proxy PDU bytes. 

31 

32 Args: 

33 data: Raw bytes (variable length). 

34 ctx: Optional CharacteristicContext. 

35 validate: Whether to validate ranges (default True). 

36 

37 Returns: 

38 Raw PDU bytes. 

39 

40 """ 

41 return bytes(data) 

42 

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

44 """Encode raw proxy PDU bytes. 

45 

46 Args: 

47 data: Raw PDU bytes. 

48 

49 Returns: 

50 Encoded bytearray. 

51 

52 """ 

53 return bytearray(data)