Oakrey.DBC.Values 2.1.4

dotnet add package Oakrey.DBC.Values --version 2.1.4
                    
NuGet\Install-Package Oakrey.DBC.Values -Version 2.1.4
                    
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.DBC.Values" Version="2.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.DBC.Values" Version="2.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.DBC.Values" />
                    
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.DBC.Values --version 2.1.4
                    
#r "nuget: Oakrey.DBC.Values, 2.1.4"
                    
#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.DBC.Values@2.1.4
                    
#: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.DBC.Values&version=2.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.DBC.Values&version=2.1.4
                    
Install as a Cake Tool

Oakrey.DBC.Values

Overview

Oakrey.DBC.Values is a .NET 10 class library that adds live signal value handling on top of Oakrey.DBC. It wraps parsed DBC signal and message templates with mutable, data-binding-ready value containers backed by NumericBitArray. The library is designed for automotive, industrial, and IoT applications that need to read, compose, and validate CAN message payloads at runtime.

Main Features

SignalValue

  • Wraps a Signal template from Oakrey.DBC together with a NumericBitArray payload.
  • Exposes a scaled double Value property (applies Scale and Offset from the DBC template).
  • Exposes raw byte[] / NumericBitArray access via RawValue and SignalContent.
  • Implements INotifyPropertyChanged so it integrates directly with WPF or MAUI bindings.
  • Computes DecimalPlaces automatically from the signal scale.
  • Provides MaxBinValue derived from signal size, scale, and offset.

TaskMessage

  • Composes a full CAN message payload from all its SignalValue instances.
  • Accepts a Message template and builds the signal list automatically.
  • Supports multiplexed signals (MUX indicator M / mN):
    • SetValues(byte[]) dispatches incoming bytes to the correct mux group.
    • UpdateGetMessage() packs only the active mux group into the outgoing payload.
    • IncreaseMUXCount() and SetMUXPosition(byte) control the active mux index.
  • ValidateValues(bool zerosCheck) checks all signal values against DBC min/max and scale.
  • Maintains a rolling receive history (FixedSizedQueue<string>, last 50 entries).
  • Copy constructor enables deep-cloning of a live TaskMessage.

Architecture

graph TD
    DBC["Oakrey.DBC<br>(Signal, Message)"]
    BitArray["Oakrey.BitArray<br>(NumericBitArray)"]
    Collections["Oakrey.Collections<br>(FixedSizedQueue, ForEach)"]
    Values["Oakrey.DBC.Values<br>(SignalValue, TaskMessage)"]

    DBC --> Values
    BitArray --> Values
    Collections --> Values
Type Responsibility
SignalValue Single signal with scaled value, raw bits, and change notification
TaskMessage Full CAN message with signal set, mux dispatch, and payload encoding

Requirements

  • .NET 10 or higher
  • Oakrey.DBC (project reference or matching NuGet package)
  • Oakrey.BitArray >= 3.0.0
  • Oakrey.Collections >= 2.0.0

Installation

.NET CLI

dotnet add package Oakrey.DBC.Values

Package Manager Console

Install-Package Oakrey.DBC.Values

NuGet Package Manager

  1. Open Visual Studio.
  2. Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
  3. Search for Oakrey.DBC.Values and click Install.

Example Usage

Create a SignalValue from a DBC Signal template

// Parse a DBC file using Oakrey.DBC
DbcMatrix matrix = DbcReader.Read("vehicle.dbc");
Signal template = matrix.Messages[0].Signals[0];

// Wrap it with a live value container
SignalValue signalValue = new SignalValue(template, initialValue: 12.5);

// Read the scaled value
double current = signalValue.Value;

// Write a new value (fires INotifyPropertyChanged)
signalValue.Value = 13.0;

// Access raw bytes
byte[] raw = signalValue.RawValue;

Build and encode a CAN message

Message messageTemplate = matrix.Messages[0];
TaskMessage taskMessage = new TaskMessage(messageTemplate);

// Set individual signal values
taskMessage.Signals.First(s => s.Name == "EngineSpeed").Value = 3000.0;

// Encode all signals into a CAN payload
byte[] payload = taskMessage.UpdateGetMessage();

Decode a received CAN frame

byte[] receivedBytes = /* bytes from CAN bus */;
taskMessage.SetValues(receivedBytes);

// MUX signals are dispatched automatically
double decoded = taskMessage.Signals.First(s => s.Name == "EngineSpeed").Value;

Validate signal values

bool valid = taskMessage.ValidateValues(zerosCheck: true);

Development Notes

  • SignalValue.ValueSource is typed as object? and reserved for a future IValueSource abstraction.
  • UpdateGetMessage uses Trace.TraceError for encoding exceptions; consider wiring up structured logging in production hosts.
  • MUX part count is inferred from the mN multiplex identifiers in the DBC template.
  • Payload length mismatches in SetValues are handled gracefully: excess bytes are trimmed and short arrays are zero-padded.

Project Information

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET 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. 
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
2.1.4 0 5/22/2026
2.1.3 79 5/15/2026
2.1.2 131 2/25/2026
2.1.1 107 2/25/2026
2.1.0 116 2/25/2026
2.0.0 122 2/2/2026
1.0.0 300 4/22/2025