from abc import ABC, abstractmethod from lightsync.models.device import DeviceConfig class BaseDevice(ABC): def __init__(self, config: DeviceConfig): self.config = config @property def id(self): return self.config.id @property def led_count(self) -> int: return self.config.led_count @abstractmethod def encode_frame(self, pixels: list[tuple]) -> bytes: """Encode a full pixel frame to UDP payload bytes. pixels: list of (R, G, B) or (R, G, B, W) tuples. """ ... @abstractmethod def encode_animation_cmd(self, animation: str, params: dict) -> bytes: """Encode an animation+params command packet.""" ... @property @abstractmethod def bytes_per_pixel(self) -> int: """Number of bytes per LED in frame mode (3 for RGB, 4 for RGBW).""" ...