LogEntry.parse constructor

LogEntry.parse(
  1. ByteData data_
)

Implementation

factory LogEntry.parse(ByteData data_) {
  if (data_.lengthInBytes < LogEntry.mavlinkEncodedLength) {
    var len = LogEntry.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUtc = data_.getUint32(0, Endian.little);
  var size = data_.getUint32(4, Endian.little);
  var id = data_.getUint16(8, Endian.little);
  var numLogs = data_.getUint16(10, Endian.little);
  var lastLogNum = data_.getUint16(12, Endian.little);

  return LogEntry(
      timeUtc: timeUtc,
      size: size,
      id: id,
      numLogs: numLogs,
      lastLogNum: lastLogNum);
}