UavcanNodeStatus.parse constructor

UavcanNodeStatus.parse(
  1. ByteData data_
)

Implementation

factory UavcanNodeStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < UavcanNodeStatus.mavlinkEncodedLength) {
    var len = UavcanNodeStatus.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 uptimeSec = data_.getUint32(8, Endian.little);
  var vendorSpecificStatusCode = data_.getUint16(12, Endian.little);
  var health = data_.getUint8(14);
  var mode = data_.getUint8(15);
  var subMode = data_.getUint8(16);

  return UavcanNodeStatus(
      timeUsec: timeUsec,
      uptimeSec: uptimeSec,
      vendorSpecificStatusCode: vendorSpecificStatusCode,
      health: health,
      mode: mode,
      subMode: subMode);
}