INNER CODE UNIT · Python
BusManager
Chanchaldhiman/CANviz · backend/canviz/bus.py:42
class BusManager:
def __init__(self) -> None:
self._bus: Optional[can.BusABC] = None
self._reader_task: Optional[asyncio.Task] = None
self._connected: bool = False
self._error: Optional[str] = None
self._frame_callbacks: list[Callable[[Message], None]] = []
self._open_time: float = 0.0
# Track what the current open bus was configured with
self._open_interface: Optional[str] = None
self._open_channel: str = ""
self._open_bitrate: int = 0
self._open_index: int = 0
self._open_serial_baudrate: int = 0
# Whether the hardware echoes sent frames back through recv() automatically.
# gs_usb (Candlelight) and virtual do. slcan and seeedstudio do not.
# When False, send() manually dispatches the frame through callbacks
# so sent frames appear in the UI message table.