IsbdLinkStatus.parse constructor

IsbdLinkStatus.parse(
  1. ByteData data_
)

Implementation

factory IsbdLinkStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < IsbdLinkStatus.mavlinkEncodedLength) {
    var len = IsbdLinkStatus.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timestamp = data_.getUint64(0, Endian.little);
  var lastHeartbeat = data_.getUint64(8, Endian.little);
  var failedSessions = data_.getUint16(16, Endian.little);
  var successfulSessions = data_.getUint16(18, Endian.little);
  var signalQuality = data_.getUint8(20);
  var ringPending = data_.getUint8(21);
  var txSessionPending = data_.getUint8(22);
  var rxSessionPending = data_.getUint8(23);

  return IsbdLinkStatus(
      timestamp: timestamp,
      lastHeartbeat: lastHeartbeat,
      failedSessions: failedSessions,
      successfulSessions: successfulSessions,
      signalQuality: signalQuality,
      ringPending: ringPending,
      txSessionPending: txSessionPending,
      rxSessionPending: rxSessionPending);
}