CanfdFrame.parse constructor

CanfdFrame.parse(
  1. ByteData data_
)

Implementation

factory CanfdFrame.parse(ByteData data_) {
  if (data_.lengthInBytes < CanfdFrame.mavlinkEncodedLength) {
    var len = CanfdFrame.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var id = data_.getUint32(0, Endian.little);
  var targetSystem = data_.getUint8(4);
  var targetComponent = data_.getUint8(5);
  var bus = data_.getUint8(6);
  var len = data_.getUint8(7);
  var data = MavlinkMessage.asUint8List(data_, 8, 64);

  return CanfdFrame(
      id: id,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      bus: bus,
      len: len,
      data: data);
}