Oakrey.DBC.Values
6.1.0
dotnet add package Oakrey.DBC.Values --version 6.1.0
NuGet\Install-Package Oakrey.DBC.Values -Version 6.1.0
<PackageReference Include="Oakrey.DBC.Values" Version="6.1.0" />
<PackageVersion Include="Oakrey.DBC.Values" Version="6.1.0" />
<PackageReference Include="Oakrey.DBC.Values" />
paket add Oakrey.DBC.Values --version 6.1.0
#r "nuget: Oakrey.DBC.Values, 6.1.0"
#:package Oakrey.DBC.Values@6.1.0
#addin nuget:?package=Oakrey.DBC.Values&version=6.1.0
#tool nuget:?package=Oakrey.DBC.Values&version=6.1.0
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
Signaltemplate fromOakrey.DBCtogether with aNumericBitArraypayload. - Exposes a scaled
doubleValueproperty (applies signed/unsigned decoding,Scale, andOffsetfrom the DBC template). - Exposes raw
byte[]/NumericBitArrayaccess viaRawValueandSignalContent. - Implements
INotifyPropertyChangedso it integrates directly with WPF or MAUI bindings. - Computes
DecimalPlacesautomatically from the signal scale. - Provides
MinBinValueandMaxBinValuederived from signedness, signal size, scale, and offset.
TaskMessage
- Composes a full CAN message payload from all its
SignalValueinstances. - Decodes and encodes both Intel (little-endian) and Motorola (big-endian/sawtooth) signal layouts.
- Accepts a
Messagetemplate 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()andSetMUXPosition(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.0Oakrey.Collections>= 2.0.0
Installation
.NET CLI
dotnet add package Oakrey.DBC.Values
Package Manager Console
Install-Package Oakrey.DBC.Values
NuGet Package Manager
- Open Visual Studio.
- Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
- Search for
Oakrey.DBC.Valuesand 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.ValueSourceis typed asobject?and reserved for a futureIValueSourceabstraction.UpdateGetMessageusesTrace.TraceErrorfor encoding exceptions; consider wiring up structured logging in production hosts.- MUX part count is inferred from the
mNmultiplex identifiers in the DBC template. - Payload length mismatches in
SetValuesare handled gracefully: excess bytes are trimmed and short arrays are zero-padded.
Project Information
- Author: Oakrey
- License: MIT
- Repository: Azure DevOps
- Package URL: nuget.org/packages/Oakrey.DBC.Values
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions 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. |
-
net10.0
- Oakrey.BitArray (>= 4.0.0)
- Oakrey.DBC (>= 6.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Oakrey.DBC.Values:
| Package | Downloads |
|---|---|
|
Oakrey.Applications.CANDecodingServices
DBC-based CAN frame decoding service for .NET applications. Connects CAN device reception with loaded DBC definitions and exposes decoded messages, signal samples, unknown frames, message history, and reactive decoder statistics. |
GitHub repositories
This package is not used by any popular GitHub repositories.