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

12 statements  

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

1"""Mesh Provisioning Data Out 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 MeshProvisioningDataOutCharacteristic(BaseCharacteristic[bytes]): 

11 """Mesh Provisioning Data Out characteristic (0x2ADC). 

12 

13 org.bluetooth.characteristic.mesh_provisioning_data_out 

14 

15 Notify-only characteristic for Mesh Provisioning PDU passthrough. 

16 Variable-length raw bytes sent by the device being provisioned. 

17 """ 

18 

19 _manual_role = CharacteristicRole.STATUS 

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 provisioning 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 provisioning PDU bytes. 

45 

46 Args: 

47 data: Raw PDU bytes. 

48 

49 Returns: 

50 Encoded bytearray. 

51 

52 """ 

53 return bytearray(data)