feat(03-01): UDP sender and device stub completion

- UDPSender: single shared asyncio DatagramTransport, start/stop lifecycle, fire-and-forget send()
- _NullProtocol: swallows OS send errors (UDP delivery is best-effort for LEDs)
- SK6812Device.encode_animation_cmd: replaces b'' stub with real 16-byte 0xAC packet
- WS2801Device.encode_animation_cmd: replaces b'' stub with real 16-byte 0xAC packet
- Both devices delegate to encode_animation_cmd from lightsync.protocol.animation_cmd
This commit is contained in:
Claude
2026-04-06 21:42:29 +00:00
parent 5e13da3967
commit f17e77f7bb
3 changed files with 69 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
from lightsync.devices.base import BaseDevice
from lightsync.models.device import DeviceConfig
from lightsync.protocol.animation_cmd import encode_animation_cmd as _encode_cmd
class WS2801Device(BaseDevice):
@@ -23,5 +24,5 @@ class WS2801Device(BaseDevice):
return bytes(buf)
def encode_animation_cmd(self, animation: str, params: dict) -> bytes:
"""Stub — Phase 3 implements real animation command encoding."""
return b""
"""Encode animation command as 16-byte 0xAC LightSync packet."""
return _encode_cmd(animation, params)