LimitsStatus.parse constructor

LimitsStatus.parse(
  1. ByteData data_
)

Implementation

factory LimitsStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < LimitsStatus.mavlinkEncodedLength) {
    var len = LimitsStatus.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var lastTrigger = data_.getUint32(0, Endian.little);
  var lastAction = data_.getUint32(4, Endian.little);
  var lastRecovery = data_.getUint32(8, Endian.little);
  var lastClear = data_.getUint32(12, Endian.little);
  var breachCount = data_.getUint16(16, Endian.little);
  var limitsState = data_.getUint8(18);
  var modsEnabled = data_.getUint8(19);
  var modsRequired = data_.getUint8(20);
  var modsTriggered = data_.getUint8(21);

  return LimitsStatus(
      lastTrigger: lastTrigger,
      lastAction: lastAction,
      lastRecovery: lastRecovery,
      lastClear: lastClear,
      breachCount: breachCount,
      limitsState: limitsState,
      modsEnabled: modsEnabled,
      modsRequired: modsRequired,
      modsTriggered: modsTriggered);
}