26 lines
537 B
Python
26 lines
537 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Protocol
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ModuleTx:
|
|
frame: bytes
|
|
label: str
|
|
delay: float = 0.0
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ModuleDecision:
|
|
tx: tuple[ModuleTx, ...] = ()
|
|
suppress_default_ack: bool = False
|
|
reason: str = ""
|
|
|
|
|
|
class CcuModule(Protocol):
|
|
name: str
|
|
|
|
def on_rx(self, frame: bytes, label: str = "") -> ModuleDecision | None:
|
|
"""Inspect an RCP frame and optionally provide CCU response frames."""
|