CanTools.Net
0.1.0
See the version list below for details.
dotnet add package CanTools.Net --version 0.1.0
NuGet\Install-Package CanTools.Net -Version 0.1.0
<PackageReference Include="CanTools.Net" Version="0.1.0" />
<PackageVersion Include="CanTools.Net" Version="0.1.0" />
<PackageReference Include="CanTools.Net" />
paket add CanTools.Net --version 0.1.0
#r "nuget: CanTools.Net, 0.1.0"
#:package CanTools.Net@0.1.0
#addin nuget:?package=CanTools.Net&version=0.1.0
#tool nuget:?package=CanTools.Net&version=0.1.0
CanTools.Net
A C#/.NET port of the excellent cantools Python library by Erik Moqvist and contributors.
What works today:
- DBC: read and write, including attributes, value tables, comments, signal groups, long-name resolution, J1939/CAN FD detection and relation attributes.
- KCD and SYM 6.0: read.
DatabaseLoader.LoadFilepicks the format from the file extension, or probes the content when the extension is unknown. - Encode/decode CAN messages with scaling, choices, floats, and simple and extended multiplexing — verified against the cantools test suite.
- J1939 frame id and PGN helpers.
- Log reading: candump (plain,
-tz,-l,-tA) and PCAN trace 1.0–2.1. - CANopen: read EDS/DCF object dictionaries (CiA 306,
$NODEIDexpressions, compact arrays — verified against python-canopen), project PDO mappings onto ordinary decodable messages, parse and build the CiA 301 frames (NMT, heartbeat, EMCY, SYNC, TIME, SDO), and fold a candump of a CANopen network into typed events with SDO reassembly — segmented and block transfers included. This goes beyond upstream cantools; seeCANOPEN.md.
using CanTools.Formats.Dbc;
var db = DbcReader.LoadFile("vehicle.dbc");
var data = db.EncodeMessage("ExampleMessage", new Dictionary<string, SignalValue>
{
["Temperature"] = 250.55,
["Enable"] = "Enabled",
});
var decoded = db.DecodeMessage("ExampleMessage", data);
More examples — loading databases, decoding log files, J1939, CANopen — in docs/examples.md.
This is an independent port and is not affiliated with the cantools maintainers.
CANopen is a registered trademark of CAN in Automation (CiA); this project is not
affiliated with or endorsed by CiA.
Behavior is verified against the upstream test suite and cross-checked against
the Python implementation; see PORTING.md for exactly what has been ported and
which deviations exist, and PLAN.md for the roadmap. Not yet ported: ARXML and
CDD parsing, KCD/SYM writing, container messages, and the CLI tools.
Work in progress — the API is not stable yet.
License
MIT. Portions derived from cantools, Copyright (c) 2015-2019 Erik Moqvist, also MIT —
see THIRD-PARTY-NOTICES.txt.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 was computed. 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. |
-
net8.0
- System.Text.Encoding.CodePages (>= 8.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.