ResponseEventError.parse constructor

ResponseEventError.parse(
  1. ByteData data_
)

Implementation

factory ResponseEventError.parse(ByteData data_) {
  if (data_.lengthInBytes < ResponseEventError.mavlinkEncodedLength) {
    var len = ResponseEventError.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 sequenceOldestAvailable = data_.getUint16(2, Endian.little);
  var targetSystem = data_.getUint8(4);
  var targetComponent = data_.getUint8(5);
  var reason = data_.getUint8(6);

  return ResponseEventError(
      sequence: sequence,
      sequenceOldestAvailable: sequenceOldestAvailable,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      reason: reason);
}