V2Extension.parse constructor

V2Extension.parse(
  1. ByteData data_
)

Implementation

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

  return V2Extension(
      messageType: messageType,
      targetNetwork: targetNetwork,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      payload: payload);
}