OnboardComputerStatus.parse constructor

OnboardComputerStatus.parse(
  1. ByteData data_
)

Implementation

factory OnboardComputerStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < OnboardComputerStatus.mavlinkEncodedLength) {
    var len =
        OnboardComputerStatus.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 uptime = data_.getUint32(8, Endian.little);
  var ramUsage = data_.getUint32(12, Endian.little);
  var ramTotal = data_.getUint32(16, Endian.little);
  var storageType = MavlinkMessage.asUint32List(data_, 20, 4);
  var storageUsage = MavlinkMessage.asUint32List(data_, 36, 4);
  var storageTotal = MavlinkMessage.asUint32List(data_, 52, 4);
  var linkType = MavlinkMessage.asUint32List(data_, 68, 6);
  var linkTxRate = MavlinkMessage.asUint32List(data_, 92, 6);
  var linkRxRate = MavlinkMessage.asUint32List(data_, 116, 6);
  var linkTxMax = MavlinkMessage.asUint32List(data_, 140, 6);
  var linkRxMax = MavlinkMessage.asUint32List(data_, 164, 6);
  var fanSpeed = MavlinkMessage.asInt16List(data_, 188, 4);
  var type = data_.getUint8(196);
  var cpuCores = MavlinkMessage.asUint8List(data_, 197, 8);
  var cpuCombined = MavlinkMessage.asUint8List(data_, 205, 10);
  var gpuCores = MavlinkMessage.asUint8List(data_, 215, 4);
  var gpuCombined = MavlinkMessage.asUint8List(data_, 219, 10);
  var temperatureBoard = data_.getInt8(229);
  var temperatureCore = MavlinkMessage.asInt8List(data_, 230, 8);

  return OnboardComputerStatus(
      timeUsec: timeUsec,
      uptime: uptime,
      ramUsage: ramUsage,
      ramTotal: ramTotal,
      storageType: storageType,
      storageUsage: storageUsage,
      storageTotal: storageTotal,
      linkType: linkType,
      linkTxRate: linkTxRate,
      linkRxRate: linkRxRate,
      linkTxMax: linkTxMax,
      linkRxMax: linkRxMax,
      fanSpeed: fanSpeed,
      type: type,
      cpuCores: cpuCores,
      cpuCombined: cpuCombined,
      gpuCores: gpuCores,
      gpuCombined: gpuCombined,
      temperatureBoard: temperatureBoard,
      temperatureCore: temperatureCore);
}