Heartbeat.parse constructor

Heartbeat.parse(
  1. ByteData data_
)

Implementation

factory Heartbeat.parse(ByteData data_) {
  if (data_.lengthInBytes < Heartbeat.mavlinkEncodedLength) {
    var len = Heartbeat.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var customMode = data_.getUint32(0, Endian.little);
  var type = data_.getUint8(4);
  var autopilot = data_.getUint8(5);
  var baseMode = data_.getUint8(6);
  var systemStatus = data_.getUint8(7);
  var mavlinkVersion = data_.getUint8(8);

  return Heartbeat(
      customMode: customMode,
      type: type,
      autopilot: autopilot,
      baseMode: baseMode,
      systemStatus: systemStatus,
      mavlinkVersion: mavlinkVersion);
}