EncapsulatedData.parse constructor

EncapsulatedData.parse(
  1. ByteData data_
)

Implementation

factory EncapsulatedData.parse(ByteData data_) {
  if (data_.lengthInBytes < EncapsulatedData.mavlinkEncodedLength) {
    var len = EncapsulatedData.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var seqnr = data_.getUint16(0, Endian.little);
  var data = MavlinkMessage.asUint8List(data_, 2, 253);

  return EncapsulatedData(seqnr: seqnr, data: data);
}