src.bluetooth_sig.gatt.characteristics.utils.data_validator¶
Data validation and integrity checking utilities.
Classes¶
Name | Description |
|---|---|
Utility class for data validation and integrity checking. |
Module Contents¶
- class src.bluetooth_sig.gatt.characteristics.utils.data_validator.DataValidator¶
Utility class for data validation and integrity checking.
- static validate_concentration_range(value: float, max_ppm: float = MAX_CONCENTRATION_PPM) None¶
Validate concentration value is in acceptable range.
- static validate_data_length(data: bytearray, expected_min: int, expected_max: int | None = None) None¶
Validate data length against expected range.
- static validate_enum_value(value: int, enum_class: type[enum.IntEnum]) None¶
Validate that a value is a valid member of an IntEnum.
- static validate_percentage(value: int | float, allow_over_100: bool = False) None¶
Validate percentage value (0-100% or 0-200% for some characteristics).
- static validate_power_range(value: int | float, max_watts: float = MAX_POWER_WATTS) None¶
Validate power measurement range.