ComponentInformationBasic.parse constructor

ComponentInformationBasic.parse(
  1. ByteData data_
)

Implementation

factory ComponentInformationBasic.parse(ByteData data_) {
  if (data_.lengthInBytes < ComponentInformationBasic.mavlinkEncodedLength) {
    var len =
        ComponentInformationBasic.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var capabilities = data_.getUint64(0, Endian.little);
  var timeBootMs = data_.getUint32(8, Endian.little);
  var timeManufactureS = data_.getUint32(12, Endian.little);
  var vendorName = MavlinkMessage.asInt8List(data_, 16, 32);
  var modelName = MavlinkMessage.asInt8List(data_, 48, 32);
  var softwareVersion = MavlinkMessage.asInt8List(data_, 80, 24);
  var hardwareVersion = MavlinkMessage.asInt8List(data_, 104, 24);
  var serialNumber = MavlinkMessage.asInt8List(data_, 128, 32);

  return ComponentInformationBasic(
      capabilities: capabilities,
      timeBootMs: timeBootMs,
      timeManufactureS: timeManufactureS,
      vendorName: vendorName,
      modelName: modelName,
      softwareVersion: softwareVersion,
      hardwareVersion: hardwareVersion,
      serialNumber: serialNumber);
}