CanKit.Pro.RawCan
1.2.3
dotnet add package CanKit.Pro.RawCan --version 1.2.3
NuGet\Install-Package CanKit.Pro.RawCan -Version 1.2.3
<PackageReference Include="CanKit.Pro.RawCan" Version="1.2.3" />
<PackageVersion Include="CanKit.Pro.RawCan" Version="1.2.3" />
<PackageReference Include="CanKit.Pro.RawCan" />
paket add CanKit.Pro.RawCan --version 1.2.3
#r "nuget: CanKit.Pro.RawCan, 1.2.3"
#:package CanKit.Pro.RawCan@1.2.3
#addin nuget:?package=CanKit.Pro.RawCan&version=1.2.3
#tool nuget:?package=CanKit.Pro.RawCan&version=1.2.3
CanKit.Pro.RawCan
Raw-CAN service layer for CanKit: multi-protocol demultiplexing / subscriptions (arc42 §5.3, ADR-5; SRS FR-RAW-010..014) and a TX-confirm abstraction (arc42 §6.3, ADR-7; SRS FR-RAW-030..034).
One ICanBusService wraps one ICanBus and turns its single FrameObserved RX stream into
N independent, filtered, read-only ISubscriptions — so several protocol instances (ISO-TP,
J1939, CANopen, …) can each see their own view of the same bus without competing over
ReceiveAsync and without one slow consumer blocking the others.
using CanKit.Core;
using CanKit.Pro.RawCan;
using var bus = CanBus.Open("virtual://demo/0", cfg => cfg.SetProtocolMode(CanProtocolMode.Can20).Baud(500_000));
using var service = new CanBusService(bus);
// Fast path: one 11-bit ID range per protocol instance (no per-frame delegate).
using var isoTp = service.Subscribe(CanIdFilter.Range(0x700, 0x7FF));
// Generic predicate when a range/mask is not enough.
using var custom = service.Subscribe(view => view.IsExtendedFrame && view.Len == 8);
await foreach (var frame in isoTp.Frames.WithCancellation(token))
{
// frame is a read-only CanFrameView (no ownership/disposal concerns)
}
Each subscription owns its own bounded, drop-oldest buffer (FR-RAW-011). Disposing a
subscription deterministically deregisters it and completes its Frames stream; disposing the
service unwinds all subscriptions and detaches from the bus (FR-RAW-012). Call
subscription.Reconfigure(CanIdFilter) or Reconfigure(predicate) to change filter criteria at
runtime without recreating the subscription (FR-RAW-014); only frames observed after the call follow
the new criterion. This layer is built purely on the public ICanBus.FrameObserved surface, so it
works identically for every adapter.
TX-Confirm
SendConfirmed gives a uniform "was this frame actually sent" answer regardless of whether the
bus has hardware TX echo enabled:
// Bus opened with CanFeature.Echo + WorkMode = ChannelWorkMode.Echo -> real echo matching.
// Otherwise -> confirmed as soon as the driver accepts the frame (TxConfirmation.IsApproximated).
var result = await service.SendConfirmed(CanFrame.Classic(0x123, new byte[] { 1, 2, 3 }));
if (result.Confirmed)
{
// result.IsApproximated tells you whether this was a real echo or driver-acceptance only.
}
else
{
// result.FailureReason: Timeout, BusOff, or Rejected -- never an indefinite hang.
}
Concurrent, byte-identical sends are matched to their own confirmation in FIFO order, never
cross-matched (FR-RAW-031). The per-call timeout is configurable (FR-RAW-034); disposing the
service cancels any outstanding SendConfirmed calls rather than leaving them to time out.
Install
dotnet add package CanKit.Pro.RawCan
# plus a CanKit adapter for the hardware you actually talk to, e.g.
dotnet add package CanKit.Adapter.Virtual # loopback, no hardware
# dotnet add package CanKit.Adapter.PCAN # Kvaser, Vector, SocketCAN, ZLG, ... likewise
Dependencies: CanKit.Abstractions.
Part of CanKit.Pro — higher CAN protocol layers built on top of CanKit, which is consumed as a NuGet package rather than forked.
License
MIT — see LICENSE. CanKit itself is a separate project licensed under Apache-2.0; see THIRD-PARTY-NOTICES.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- CanKit.Abstractions (>= 0.5.6)
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.12)
- System.Memory (>= 4.6.3)
- System.Threading.Channels (>= 10.0.12)
-
net10.0
- CanKit.Abstractions (>= 0.5.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|