WaterDepth.parse constructor

WaterDepth.parse(
  1. ByteData data_
)

Implementation

factory WaterDepth.parse(ByteData data_) {
  if (data_.lengthInBytes < WaterDepth.mavlinkEncodedLength) {
    var len = WaterDepth.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 lat = data_.getInt32(4, Endian.little);
  var lng = data_.getInt32(8, Endian.little);
  var alt = data_.getFloat32(12, Endian.little);
  var roll = data_.getFloat32(16, Endian.little);
  var pitch = data_.getFloat32(20, Endian.little);
  var yaw = data_.getFloat32(24, Endian.little);
  var distance = data_.getFloat32(28, Endian.little);
  var temperature = data_.getFloat32(32, Endian.little);
  var id = data_.getUint8(36);
  var healthy = data_.getUint8(37);

  return WaterDepth(
      timeBootMs: timeBootMs,
      lat: lat,
      lng: lng,
      alt: alt,
      roll: roll,
      pitch: pitch,
      yaw: yaw,
      distance: distance,
      temperature: temperature,
      id: id,
      healthy: healthy);
}