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 SendConfirmedAsync(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 members of the published CanKitErrorCode. Declaring them as constants of the enum type gives them a stable numeric contract: should CanKit define these codes with the same numbers, ErrorCode == CanKitErrorCode.ProtocolTimeout starts being true for already-compiled callers, with nothing to change but removing this file. The trade-off is that ErrorCode.ToString() renders the number rather than a name. 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). docs/upstream-candidates.md lists these codes as a candidate for CanKit itself. 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(). |
| SubscriptionFrame | A buffered frame and its subscription-local enqueue number (FR-RAW-016). See ILossAwareSubscription for continuity and competing-reader semantics. |
| TxConfirmation | Result of SendConfirmedAsync(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). |
| ILossAwareSubscription | Optional subscription-local capture continuity information (FR-RAW-016). Subscriptions created by CanBusService implement this interface; existing implementations of ISubscription need not do so. |
| 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). |