- event bus systen - all components are independent - preparation for web frontend
22 lines
589 B
Python
22 lines
589 B
Python
"""The seam between :class:`~musicmouse.devices.mouse.MusicMouseDevice` and the wire.
|
|
|
|
Kept free of any serial import so the simulator can substitute a transport without
|
|
pulling in ``pyserial-asyncio``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Protocol
|
|
|
|
__all__ = ["Transport"]
|
|
|
|
|
|
class Transport(Protocol):
|
|
def write(self, data: bytes) -> None:
|
|
"""Send bytes to the firmware. Dropping them while disconnected is fine:
|
|
the device re-applies its memorized state once the link is back."""
|
|
...
|
|
|
|
@property
|
|
def connected(self) -> bool: ...
|