dart_dbc_parser 2.0.0 copy "dart_dbc_parser: ^2.0.0" to clipboard
dart_dbc_parser: ^2.0.0 copied to clipboard

A package can be used to decode and encode 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 a dbc file");
  DBCDatabase can = await DBCDatabase.loadFromFile([file]);

  Uint8List bytes = Uint8List(10);
  bytes.buffer.asByteData().setUint16(0, 15);
  bytes.buffer.asByteData().setUint16(2, 0x9999);
  bytes.buffer.asByteData().setUint16(4, 0x9999);
  bytes.buffer.asByteData().setUint16(6, 0x9999);
  bytes.buffer.asByteData().setUint16(8, 0x9999);

  List<MapEntry<int, Map<String, num>>> decoded = can.decode(bytes);
  Uint8List encoded = can.encode(decoded);
  List<MapEntry<int, Map<String, num>>> decoded2 = can.decode(encoded);

  assert(decoded == decoded2);
}
3
likes
160
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

A package can be used to decode and encode CAN messages with the use of a DBC file.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on dart_dbc_parser