src.bluetooth_sig.gatt.characteristics.utils.data_validator

Data validation and integrity checking utilities.

Classes

Name

Description

DataValidator

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.

static validate_range(value: int | float, min_val: int | float, max_val: int | float) None

Validate that a value is within the specified range.

static validate_temperature_range(value: float, min_celsius: float = ABSOLUTE_ZERO_CELSIUS, max_celsius: float = MAX_TEMPERATURE_CELSIUS) None

Validate temperature is in physically reasonable range.