LinkNodeStatus.parse constructor

LinkNodeStatus.parse(
  1. ByteData data_
)

Implementation

factory LinkNodeStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < LinkNodeStatus.mavlinkEncodedLength) {
    var len = LinkNodeStatus.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 txRate = data_.getUint32(8, Endian.little);
  var rxRate = data_.getUint32(12, Endian.little);
  var messagesSent = data_.getUint32(16, Endian.little);
  var messagesReceived = data_.getUint32(20, Endian.little);
  var messagesLost = data_.getUint32(24, Endian.little);
  var rxParseErr = data_.getUint16(28, Endian.little);
  var txOverflows = data_.getUint16(30, Endian.little);
  var rxOverflows = data_.getUint16(32, Endian.little);
  var txBuf = data_.getUint8(34);
  var rxBuf = data_.getUint8(35);

  return LinkNodeStatus(
      timestamp: timestamp,
      txRate: txRate,
      rxRate: rxRate,
      messagesSent: messagesSent,
      messagesReceived: messagesReceived,
      messagesLost: messagesLost,
      rxParseErr: rxParseErr,
      txOverflows: txOverflows,
      rxOverflows: rxOverflows,
      txBuf: txBuf,
      rxBuf: rxBuf);
}