dart_dbc_parser 1.0.1 dart_dbc_parser: ^1.0.1 copied to clipboard
A package to decode CAN messages with the use of a DBC file.
example/dart_dbc_parser_example.dart
// ignore_for_file: unused_local_variable
import 'dart:io';
import 'dart:typed_data';
import 'package:dart_dbc_parser/dart_dbc_parser.dart';
void main() async {
File file = File("Path to DBC file");
DBCDatabase can = await DBCDatabase.loadFromFile([file]);
Uint8List bytes = Uint8List(10);
bytes.buffer.asByteData().setUint16(0, 849);
bytes.buffer.asByteData().setUint16(2, 0xFFFF);
bytes.buffer.asByteData().setUint16(4, 0xFFFF);
bytes.buffer.asByteData().setUint16(6, 0xFFFF);
bytes.buffer.asByteData().setUint16(8, 0xFFFF);
Map<String, num> decoded = can.decode(bytes);
}