Coverage for src/bluetooth_sig/gatt/descriptors/observation_schedule.py: 87%
15 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-30 00:10 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-30 00:10 +0000
1"""Observation Schedule Descriptor implementation."""
3from __future__ import annotations
5import msgspec
7from .base import BaseDescriptor
10class ObservationScheduleData(msgspec.Struct, frozen=True, kw_only=True):
11 """Observation Schedule descriptor data."""
13 schedule: bytes # Variable format depending on sensor type
16class ObservationScheduleDescriptor(BaseDescriptor):
17 """Observation Schedule Descriptor (0x2910).
19 Defines the observation schedule for sensor measurements.
20 Format varies depending on the sensor type and requirements.
21 """
23 def _has_structured_data(self) -> bool:
24 return True
26 def _get_data_format(self) -> str:
27 return "bytes"
29 def _parse_descriptor_value(self, data: bytes) -> ObservationScheduleData:
30 """Parse Observation Schedule value.
32 Args:
33 data: Raw schedule data (variable length)
35 Returns:
36 ObservationScheduleData with schedule information
37 """
38 return ObservationScheduleData(schedule=data)
40 def get_schedule_data(self, data: bytes) -> bytes:
41 """Get the raw schedule data."""
42 parsed = self._parse_descriptor_value(data)
43 return parsed.schedule