StorageInformation.parse constructor

StorageInformation.parse(
  1. ByteData data_
)

Implementation

factory StorageInformation.parse(ByteData data_) {
  if (data_.lengthInBytes < StorageInformation.mavlinkEncodedLength) {
    var len = StorageInformation.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var totalCapacity = data_.getFloat32(4, Endian.little);
  var usedCapacity = data_.getFloat32(8, Endian.little);
  var availableCapacity = data_.getFloat32(12, Endian.little);
  var readSpeed = data_.getFloat32(16, Endian.little);
  var writeSpeed = data_.getFloat32(20, Endian.little);
  var storageId = data_.getUint8(24);
  var storageCount = data_.getUint8(25);
  var status = data_.getUint8(26);
  var type = data_.getUint8(27);
  var name = MavlinkMessage.asInt8List(data_, 28, 32);
  var storageUsage = data_.getUint8(60);

  return StorageInformation(
      timeBootMs: timeBootMs,
      totalCapacity: totalCapacity,
      usedCapacity: usedCapacity,
      availableCapacity: availableCapacity,
      readSpeed: readSpeed,
      writeSpeed: writeSpeed,
      storageId: storageId,
      storageCount: storageCount,
      status: status,
      type: type,
      name: name,
      storageUsage: storageUsage);
}