Oakrey.Applications.CANDecodingServices
1.0.0
dotnet add package Oakrey.Applications.CANDecodingServices --version 1.0.0
NuGet\Install-Package Oakrey.Applications.CANDecodingServices -Version 1.0.0
<PackageReference Include="Oakrey.Applications.CANDecodingServices" Version="1.0.0" />
<PackageVersion Include="Oakrey.Applications.CANDecodingServices" Version="1.0.0" />
<PackageReference Include="Oakrey.Applications.CANDecodingServices" />
paket add Oakrey.Applications.CANDecodingServices --version 1.0.0
#r "nuget: Oakrey.Applications.CANDecodingServices, 1.0.0"
#:package Oakrey.Applications.CANDecodingServices@1.0.0
#addin nuget:?package=Oakrey.Applications.CANDecodingServices&version=1.0.0
#tool nuget:?package=Oakrey.Applications.CANDecodingServices&version=1.0.0
Oakrey.Applications.CANDecodingServices
A .NET 10 Windows library that decodes received CAN frames using the messages and signals defined in a loaded DBC file. It connects Oakrey.Applications.Ohm.CAN reception with Oakrey.Applications.FileParsing.DBC and exposes decoded messages, signal samples, unknown frames, message history, and live decoder statistics.
Main features
- Automatically tracks the message definitions from the currently loaded DBC matrix.
- Decodes frames received through
ICanDeviceServiceinto DBC-backedTaskMessageinstances. - Keeps one live
ReceivedCanMessageper device, channel, and CAN message ID. - Publishes reactive streams for created and updated messages, every processed frame, unknown frames, and statistics.
- Exposes decoded signal name, unit, and value through
CanSignalSample. - Retains the latest 50 raw-value history entries for each received message.
- Reports decoded and unknown frame totals, unique counts, and per-second rates.
- Supports standard, extended-ID, and CAN FD frame metadata.
Architecture
flowchart LR
DBC[IDbcService] -->|DBC matrix| Decoder[CANDecodingService]
CAN[ICanDeviceService] -->|received CAN frames| Decoder
Decoder --> Messages[ReceivedMessages]
Decoder --> Events[Reactive event streams]
Decoder --> Statistics[Decoder statistics]
Key types
| Type | Description |
|---|---|
ICANDecodingService / CANDecodingService |
Main decoding service and consumer-facing contract. |
ReceivedCanMessage |
A decoded DBC message associated with its source device and channel, including receive rate and recent raw-value history. |
CompatibleMessage |
A message definition from the currently loaded DBC matrix. |
CanProcessedFrame |
Immutable result published for every processed frame, including decoded signal samples when available. |
UnknownCanFrame |
Metadata for a received frame whose ID is absent from the loaded DBC matrix. |
StatisticRecord<T> |
Snapshot of decoder totals, unique counts, unknown IDs, and per-second rates. |
Requirements
- .NET 10 for Windows
- A configured
IDbcServicefromOakrey.Applications.FileParsing.DBC - A configured
ICanDeviceServicefromOakrey.Applications.Ohm.CAN
Installation
.NET CLI
dotnet add package Oakrey.Applications.CANDecodingServices
Package Manager Console
Install-Package Oakrey.Applications.CANDecodingServices
NuGet Package Manager
Search for Oakrey.Applications.CANDecodingServices in Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
Registration
Register the service after configuring its DBC and CAN device dependencies:
services.AddSingleton<ICANDecodingService, CANDecodingService>();
The service subscribes to DBC-file and CAN-frame streams when it is created. Loading a new DBC matrix refreshes CompatibleMessages and clears messages decoded from the previous matrix.
Example usage
Observe newly discovered messages and subsequent updates:
IDisposable createdSubscription = decodingService.MessageCreated.Subscribe(received =>
{
Console.WriteLine($"New message: {received.Message.Name}");
});
IDisposable updatedSubscription = decodingService.MessageUpdated.Subscribe(received =>
{
Console.WriteLine($"{received.Message.Name}: {received.MessagesPerSecond:F1} msg/s");
});
Consume a normalized result for every frame, including unknown frames:
IDisposable frameSubscription = decodingService.FrameProcessed.Subscribe(frame =>
{
string name = frame.MessageName ?? "Unknown";
Console.WriteLine($"{name} (0x{frame.MessageId:X}): {frame.Signals.Count} signals");
});
IDisposable unknownSubscription = decodingService.UnknownFrameReceived.Subscribe(frame =>
{
Console.WriteLine($"Unknown CAN ID 0x{frame.MessageId:X} on channel {frame.Channel}");
});
Read the periodically published statistics:
IDisposable statisticsSubscription = decodingService.Statistic.Subscribe(statistics =>
{
Console.WriteLine(
$"Received: {statistics.TotalReceivedItems}, " +
$"decoded: {statistics.ItemDecodedCount}, " +
$"unknown: {statistics.UnknownItemsReceived}");
});
Dispose subscriptions when they are no longer needed. The decoding service itself is disposable and should normally have the same lifetime as its DBC and CAN device services.
Project information
| Field | Value |
|---|---|
| Author | Oakrey |
| License | MIT |
| Target framework | net10.0-windows |
| NuGet package | Oakrey.Applications.CANDecodingServices |
| Repository | https://dev.azure.com/oakrey/OpenPackages/_git/ApplicationServices |
License
This project is licensed under the MIT License. See the repository's LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Applications.FileParsing.DBC (>= 8.1.0)
- Oakrey.Applications.Ohm.CAN (>= 1.0.0)
- Oakrey.DBC.Values (>= 6.1.0)
- Oakrey.Disposables (>= 3.0.0)
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 |
|---|---|---|
| 1.0.0 | 35 | 9/3/2026 |
| 0.8.0-beta | 33 | 9/3/2026 |