Skip to content

Monolithic Mixing of Network Routing and Protocol State Machines #34

Description

@RaulSMS

The parsing logic for J1939/21 Transport Protocols (including Broadcast Announce Messages [BAM] and Connection Management [TP.CM / TP.DT]) is tightly coupled within the same classes handling standard parameter group network distribution or ECU address configuration.

  • Spawning simultaneous multi-packet operations (e.g., concurrently receiving a multi-page diagnostic payload from one node while transmitting engine configuration parameters to another) leads to complex, fragile state tracking.
  • The lack of isolated protocol state machines makes it extremely difficult to track partial session failures, trace bit-level corruption, or test edge-case protocol failures independently.

Proposed Architecture Fix

Implement an explicit, decoupled, layered software architecture pattern:

+-------------------------------------------------------------+
|                     Application Layer                       |
|           (Controller Applications: DM1, DM2, etc.)          |
+-------------------------------------------------------------+
                              ^
                              | Fully assembled PGN/Payload
                              v
+-------------------------------------------------------------+
|                Transport / Network Layer                    |
|  (Stateful TP.CM/TP.DT Managers & Address Claim Managers)   |
+-------------------------------------------------------------+
                              ^
                              | Filtered J1939 Frames
                              v
+-------------------------------------------------------------+
|                     Data Link Layer                         |
|             (Async Bus IO & J1939 ID Router)                |
+-------------------------------------------------------------+

Note

See #33 for Data Link Layer

  1. Introduce dedicated, lifecycle-managed TransportSession state machine classes.
  2. When an RTS or BAM frame is intercepted by the Data Link Router, it instantiates an isolated TransportSession instance that manages its own packet offsets, timers, and byte reconstruction buffers.
  3. The parent class is notified only when assembly succeeds, or when an explicit timeout exception is raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions