from static method

List<int> from(
  1. Uint8List bytes
)

Returns a List as the bit level representation of the payload

CAN decoding requires this bit level representation to be mirrored byte by byte

Implementation

static List<int> from(Uint8List bytes) {
  List<int> data = List.filled(64, 0);
  int byteCnt = 0;
  for (int byte in bytes) {
    int mask = 1 << (byteLen - 1);
    for (int bit = 0; bit < byteLen; bit++, mask >>= 1) {
      data[byteCnt * byteLen + byteLen - bit - 1] =
          (byte & mask != 0 ? 1 : 0);
    }
    byteCnt++;
  }
  return data;
}