ComponentInformation.parse constructor

ComponentInformation.parse(
  1. ByteData data_
)

Implementation

factory ComponentInformation.parse(ByteData data_) {
  if (data_.lengthInBytes < ComponentInformation.mavlinkEncodedLength) {
    var len = ComponentInformation.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 generalMetadataFileCrc = data_.getUint32(4, Endian.little);
  var peripheralsMetadataFileCrc = data_.getUint32(8, Endian.little);
  var generalMetadataUri = MavlinkMessage.asInt8List(data_, 12, 100);
  var peripheralsMetadataUri = MavlinkMessage.asInt8List(data_, 112, 100);

  return ComponentInformation(
      timeBootMs: timeBootMs,
      generalMetadataFileCrc: generalMetadataFileCrc,
      peripheralsMetadataFileCrc: peripheralsMetadataFileCrc,
      generalMetadataUri: generalMetadataUri,
      peripheralsMetadataUri: peripheralsMetadataUri);
}