Ping.parse constructor

Ping.parse(
  1. ByteData data_
)

Implementation

factory Ping.parse(ByteData data_) {
  if (data_.lengthInBytes < Ping.mavlinkEncodedLength) {
    var len = Ping.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var seq = data_.getUint32(8, Endian.little);
  var targetSystem = data_.getUint8(12);
  var targetComponent = data_.getUint8(13);

  return Ping(
      timeUsec: timeUsec,
      seq: seq,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}