Oakrey.Applications.CANDecodingServices 0.8.0-beta

This is a prerelease version of Oakrey.Applications.CANDecodingServices.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Oakrey.Applications.CANDecodingServices --version 0.8.0-beta
                    
NuGet\Install-Package Oakrey.Applications.CANDecodingServices -Version 0.8.0-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.Applications.CANDecodingServices" Version="0.8.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.Applications.CANDecodingServices" Version="0.8.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.Applications.CANDecodingServices" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.Applications.CANDecodingServices --version 0.8.0-beta
                    
#r "nuget: Oakrey.Applications.CANDecodingServices, 0.8.0-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oakrey.Applications.CANDecodingServices@0.8.0-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oakrey.Applications.CANDecodingServices&version=0.8.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.Applications.CANDecodingServices&version=0.8.0-beta&prerelease
                    
Install as a Cake Tool

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 ICanDeviceService into DBC-backed TaskMessage instances.
  • Keeps one live ReceivedCanMessage per 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 IDbcService from Oakrey.Applications.FileParsing.DBC
  • A configured ICanDeviceService from Oakrey.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 Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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