Pure helpers for redundant exchange interpretation.
Given sent datagrams and the replies from primary and secondary ports, classifies the rx pattern and merges both replies into a best-effort result with combined WKC.
All functions are deterministic and side-effect free — the hardest redundant-path logic is testable without a live bus or transports.
Summary
Functions
Merge two bounced replies from a broken ring.
Types
@type interpretation_t() :: %{ status: :ok | :partial | :timeout, redundancy: :full | :degraded | :none, path_shape: path_shape_t(), primary_rx_kind: rx_kind_t(), secondary_rx_kind: rx_kind_t(), datagrams: [EtherCAT.Bus.Datagram.t()] | nil }
@type path_shape_t() ::
:single
| :full_redundancy
| :primary_only
| :secondary_only
| :complementary_partials
| :no_valid_return
| :invalid
@type rx_kind_t() :: :processed | :passthrough | :partial | :none | :invalid
Functions
@spec interpret( [EtherCAT.Bus.Datagram.t()], [EtherCAT.Bus.Datagram.t()] | nil, [EtherCAT.Bus.Datagram.t()] | nil ) :: interpretation_t()
@spec merge_bounces([EtherCAT.Bus.Datagram.t()], [EtherCAT.Bus.Datagram.t()], [ EtherCAT.Bus.Datagram.t() ]) :: [EtherCAT.Bus.Datagram.t()]
Merge two bounced replies from a broken ring.
When both ports receive their own frame back (bounce-back), each side only processed the slaves reachable from that port. This function merges the complementary data using byte-level logical merge for commands 10/11/12.