CanKit.Pro.RawCan Namespace¶
| Classes | |
|---|---|
| CanBusService | Default ICanBusService: attaches once to ICanBus.FrameObserved and fans each observed CanFrameView out to every registered Subscription (arc42 §5.3 "Multi-Protokoll-Demux", ADR-5), and implements SendConfirmed(CanFrame, Nullable<TimeSpan>, CancellationToken) (arc42 §6.3, ADR-7; FR-RAW-030..034) on the same single ICanBus.FrameObserved subscription. |
| CanBusServiceExtensions | Callback-style convenience layer over Subscribe(Func<CanFrameEvent,bool>, Nullable<int>, bool) for callers who want "filter + handler" instead of driving the async-enumerable Frames stream themselves. |
| ProtocolErrorCodes | The CanKitErrorCode values CanKit.Pro's protocol layers report (NFR-006, arc42 ADR-12): every L3/L4 failure is a CanKitException, and its CanKitException.ErrorCode says which *kind* of protocol failure it was, not merely that a transport operation failed. Why these are declared here rather than used from the enum. CanKit reserves the 6000 range for transport and protocol errors and defines TransportOperationFailed = 6001. The four values below continue that range, but they are not (yet) members of the published CanKitErrorCode — they were added inside the CanKit.Pro.legacy fork, and CanKit.Pro no longer forks CanKit. Declaring them as constants of the enum type keeps the numeric contract identical to what the fork produced and to what upstream would produce: should CanKit adopt these codes, ErrorCode == CanKitErrorCode.ProtocolTimeout starts being true for already-compiled callers, with nothing here to change but this file's removal. The trade-off is that ErrorCode.ToString() renders the number rather than a name until that happens. Callers who want a name have the exception type itself, which is always more specific than the code (IsoTpTimeoutException even names which ISO 15765-2 timer expired). Upstreaming these four members to CanKit is tracked as follow-up work; see docs/upstream-candidates.md. Why in CanKit.Pro.RawCan. These codes are shared by ISO-TP, J1939-TP, CANopen, J1939 and UDS, and RawCan is the one package all five already depend on — so putting them here adds no dependency edge. If CanKit.Pro grows more cross-cutting types, they belong together in a small foundation package instead. |
| Structs | |
|---|---|
| CanFrameEvent | One frame as a subscription saw it: the frame itself, whether it is this host's own transmit echo, and the timestamp the adapter recorded for it (FR-RAW-015). |
| CanIdFilter | Allocation-free ID-range/mask filter for a ISubscription (FR-RAW-013, "Should"). This is the fast path for the common case "one 11/29-bit CAN-ID range (or acceptance code/mask) per protocol instance": it is evaluated directly against the read-only CanFrameView that the demux layer carries, without allocating or invoking a generic System.Func<> delegate per frame. |
| FilterOverlap | Two registered CanIdFilter-based subscriptions whose ID spaces intersect, and the range of CAN IDs on which they do (FR-RAW-041) — the result of FindOverlappingFilterSubscriptions(). |
| TxConfirmation | Result of SendConfirmed(CanFrame, Nullable<TimeSpan>, CancellationToken): a uniform "was this frame actually sent" answer regardless of whether the underlying adapter supports hardware TX echo (arc42 §5.3/§6.3, ADR-7; FR-RAW-030..034). |
| Interfaces | |
|---|---|
| ICanBusService | One demultiplexing service instance per ICanBus: it turns the single RX stream exposed by ICanBus.FrameObserved into N independent, filtered read-only ISubscriptions, so multiple protocol instances (ISO-TP, J1939, CANopen, …) can each see their own view of the bus without competing over ICanBus.ReceiveAsync(Int32, Int32, CancellationToken) (arc42 §5.3, ADR-5; FR-RAW-010..013). |
| ISubscription | A single, independent, filtered view onto the frames of one ICanBusService (arc42 §5.3 "Multi-Protokoll-Demux"; FR-RAW-010..012, FR-RAW-015). |
| Enums | |
|---|---|
| TxConfirmFailureReason | Why a TxConfirmation did not confirm the send (only meaningful when Confirmed is false). |