BusStateExtensions Class¶
Small, pure classification helpers over BusState (SRS FR-RAW-051), so protocol instances can express "may I still transmit?" / "is the bus degraded?" without repeating the same enum comparisons at every call site.
Inheritance Object → BusStateExtensions
Methods¶
BusStateExtensions.IsDegraded(this BusState) Method¶
True for BusState.ErrWarning, BusState.ErrPassive, BusState.BusOff and BusState.Unknown: the bus is not known to be in the healthy BusState.ErrActive range, and a protocol may want to pause/slow down or surface a warning (FR-RAW-051), even where transmission is still technically possible.
Parameters¶
state BusState
Returns¶
Remarks¶
BusState.Unknown counts as degraded on purpose. It means "we could not determine the controller state", and answering a health question with "healthy" on the strength of no information is the one answer that can never be justified: a caller that treats degraded as "warn / slow down / do not start a long block transfer yet" is merely cautious when the state is unknown, whereas a caller told "healthy" proceeds as if a bus that may already be off were fine. BusState.None stays healthy — it is the "no error condition" reading, not an absence of information.
BusStateExtensions.IsTransmitBlocked(this BusState) Method¶
True only for BusState.BusOff: the controller has removed itself from the bus and cannot transmit at all until it recovers, so a controlled TX must be aborted (FR-RAW-051). Error-warning/passive states still allow transmission (the controller is merely degraded), so they are deliberately <i>not</i> treated as transmit-blocking here.
public static bool IsTransmitBlocked(this CanKit.Abstractions.API.Common.Definitions.BusState state);
Parameters¶
state BusState
Returns¶
Remarks¶
BusState.Unknown is deliberately <i>not</i> transmit-blocking, unlike in IsDegraded(this BusState): plenty of adapters never report a controller state at all, and refusing to transmit on every one of them would break working setups to guard against a bus-off we have no evidence for. Blocking TX needs proof; flagging degradation does not.