RequestEvent.parse constructor

RequestEvent.parse(
  1. ByteData data_
)

Implementation

factory RequestEvent.parse(ByteData data_) {
  if (data_.lengthInBytes < RequestEvent.mavlinkEncodedLength) {
    var len = RequestEvent.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var firstSequence = data_.getUint16(0, Endian.little);
  var lastSequence = data_.getUint16(2, Endian.little);
  var targetSystem = data_.getUint8(4);
  var targetComponent = data_.getUint8(5);

  return RequestEvent(
      firstSequence: firstSequence,
      lastSequence: lastSequence,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}