can_dbc_parser 1.0.0 copy "can_dbc_parser: ^1.0.0" to clipboard
can_dbc_parser: ^1.0.0 copied to clipboard

CAN DBC parser for dart

Dart DBC Parser for web #

The package helps to parse the CAN DBC file for web.

Features #

DBC parsing, CAN decoding

Usage #

Web natively doesn't support File (dart:io is not supported in Web). You can make use of this package to create CAN Database and decode CAN messages.

You can upload the file using file_picker to web application and create bytes from the file selected

FilePickerResult? result = await FilePicker.platform.pickFiles();
Uint8List bytes = result.files.first.bytes as Uint8List;
DBCDatabase can = await DBCDatabase.loadFromBytes(bytes);

When the signals are loaded, by default the min value is assigned to the signal.

To decode the CAN Message use

DBCDatabase can = await DBCDatabase.loadFromBytes(bytes);

Uint8List messageBytes = Uint8List(10);
messageBytes.buffer.asByteData().setUint16(0, 849);
messageBytes.buffer.asByteData().setUint16(2, 0xFFFF);
messageBytes.buffer.asByteData().setUint16(4, 0xFFFF);
messageBytes.buffer.asByteData().setUint16(6, 0xFFFF);
messageBytes.buffer.asByteData().setUint16(8, 0xFFFF);
Map<String, num> decoded = can.decode(messageBytes);

To encode the CAN Message, update the signal value and use encodeMessage(canID). Currently, it does not support for Multiplexed signals.

can.can.database[849]?[signal_name]?.value = new_signal_value;
Uint8List encoded = can.encodeMessage(849);

Thanks to #

This package was made using

0
likes
0
points
49
downloads

Publisher

verified publisherakhilsuthapalli.com

Weekly Downloads

CAN DBC parser for dart

Homepage

License

unknown (license)

More

Packages that depend on can_dbc_parser