Builder API for EtherCAT.Simulator.Transport.Raw.inject_fault/1.
Raw transport faults model behavior at the raw-wire endpoint boundary, not at the simulator core. They are mode-aware: single-link raw only exposes the primary endpoint, while redundant raw can target both primary and secondary endpoints independently.
Typical usage:
alias EtherCAT.Simulator.Transport.Raw
alias EtherCAT.Simulator.Transport.Raw.Fault
Raw.inject_fault(Fault.delay_response(200))
Raw.inject_fault(Fault.delay_response(200, endpoint: :secondary, from_ingress: :primary))
Fault.describe(Fault.delay_response(50, endpoint: :primary, from_ingress: :secondary))
Summary
Types
@type endpoint_selector() :: :primary | :secondary | :all
@type from_ingress() :: :primary | :secondary | :all
@type t() :: %EtherCAT.Simulator.Transport.Raw.Fault{ delay_ms: non_neg_integer(), endpoint: endpoint_selector(), from_ingress: from_ingress(), kind: :delay_response }
Functions
@spec delay_response( non_neg_integer(), keyword() ) :: t()
@spec describe(t() | EtherCAT.Simulator.Transport.Raw.fault()) :: String.t()
@spec normalize(t() | EtherCAT.Simulator.Transport.Raw.fault()) :: {:ok, EtherCAT.Simulator.Transport.Raw.fault()} | :error