UavcanNodeInfo.parse constructor

UavcanNodeInfo.parse(
  1. ByteData data_
)

Implementation

factory UavcanNodeInfo.parse(ByteData data_) {
  if (data_.lengthInBytes < UavcanNodeInfo.mavlinkEncodedLength) {
    var len = UavcanNodeInfo.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 swVcsCommit = data_.getUint32(12, Endian.little);
  var name = MavlinkMessage.asInt8List(data_, 16, 80);
  var hwVersionMajor = data_.getUint8(96);
  var hwVersionMinor = data_.getUint8(97);
  var hwUniqueId = MavlinkMessage.asUint8List(data_, 98, 16);
  var swVersionMajor = data_.getUint8(114);
  var swVersionMinor = data_.getUint8(115);

  return UavcanNodeInfo(
      timeUsec: timeUsec,
      uptimeSec: uptimeSec,
      swVcsCommit: swVcsCommit,
      name: name,
      hwVersionMajor: hwVersionMajor,
      hwVersionMinor: hwVersionMinor,
      hwUniqueId: hwUniqueId,
      swVersionMajor: swVersionMajor,
      swVersionMinor: swVersionMinor);
}