ComponentMetadata.parse constructor

ComponentMetadata.parse(
  1. ByteData data_
)

Implementation

factory ComponentMetadata.parse(ByteData data_) {
  if (data_.lengthInBytes < ComponentMetadata.mavlinkEncodedLength) {
    var len = ComponentMetadata.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var fileCrc = data_.getUint32(4, Endian.little);
  var uri = MavlinkMessage.asInt8List(data_, 8, 100);

  return ComponentMetadata(
      timeBootMs: timeBootMs, fileCrc: fileCrc, uri: uri);
}