@startuml SoftwareArchitecture skinparam componentStyle rectangle skinparam defaultTextAlignment center skinparam component { BackgroundColor<> LightYellow BackgroundColor<> LightGray } title Leahi Real-time CDT — Component Architecture node "Leahi Device" { node "LeahiRt (process)" { component "LeahiRtController" as LRC component "Can::CanInterface" as CAN component "AgentInterface" as AI } node "MsgUtils (lib)" { component "Can::MessageDispatcher\n(per-CAN-id reassembly)" as MDISP component "Can::MessageBuilder\n(frame ↔ message)" as MB component "AgentMessage\n(framing + CRC)" as AM component "LeahiMsgDefs\n(generated C++)" as MD <> } node "Comms (lib)" { component "AgentInterface\nimpl" as AI_IMPL } interface "CAN Bus\n(SocketCAN)" as CANBUS interface "Unix Domain Socket\n(/tmp/leahi_rt.sock)" as UDS } node "CANDumpPlayer (tool)" { component "CAN dump replay\n(writeFrame → SocketCAN)" as CDP } node "AgentSim (tool / future Agent)" { component "AgentSimController" as ASC component "AgentMessage\n(framing + CRC)" as AM2 } cloud "Cloud Service\n(out of scope)" as CLOUD <> node "Build-time (scripts)" { component "MsgUtils Python\n(msgutils)" as PYUTILS <> component "Jinja2 Templates\n(MsgDefs_*.jinja)" as JINJA <> component "protoc" as PROTOC <> component "LeahiMsgDefs.proto\n(generated)" as PROTO <> component "LeahiMsgDefs.h/.cpp\n(generated)" as GENCPP <> component "Protobuf stubs\n(.pb.h/.pb.cc)" as PBSTUBS <> } CDP --> CANBUS : writeFrame (replay) CANBUS --> CAN CAN --> LRC : didFrameReceive LRC --> MDISP : onFrameReceive(canId, payload) MDISP --> MB : buildMessage() MB --> MDISP : Can::Message MDISP --> LRC : didActionReceive(Can::Message) LRC --> MD : canMessageToProtobufByteArray() MD --> AM : protobuf bytes LRC --> AI : send(MsgId, seq, payload) AI --> AI_IMPL AI_IMPL --> AM : build() AI_IMPL --> UDS : write frame UDS --> ASC : readyRead ASC --> AM2 : feed() ASC --> CLOUD : (future) forward payload PYUTILS --> JINJA : renders JINJA --> PROTO : generates JINJA --> GENCPP : generates PROTO --> PROTOC : input PROTOC --> PBSTUBS : generates GENCPP ..> MD : compiled into PBSTUBS ..> MD : compiled into @enduml