LoggingData.parse constructor

LoggingData.parse(
  1. ByteData data_
)

Implementation

factory LoggingData.parse(ByteData data_) {
  if (data_.lengthInBytes < LoggingData.mavlinkEncodedLength) {
    var len = LoggingData.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var sequence = data_.getUint16(0, Endian.little);
  var targetSystem = data_.getUint8(2);
  var targetComponent = data_.getUint8(3);
  var length = data_.getUint8(4);
  var firstMessageOffset = data_.getUint8(5);
  var data = MavlinkMessage.asUint8List(data_, 6, 249);

  return LoggingData(
      sequence: sequence,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      length: length,
      firstMessageOffset: firstMessageOffset,
      data: data);
}