EkfExt.parse constructor

EkfExt.parse(
  1. ByteData data_
)

Implementation

factory EkfExt.parse(ByteData data_) {
  if (data_.lengthInBytes < EkfExt.mavlinkEncodedLength) {
    var len = EkfExt.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timestamp = data_.getUint64(0, Endian.little);
  var windspeed = data_.getFloat32(8, Endian.little);
  var winddir = data_.getFloat32(12, Endian.little);
  var windz = data_.getFloat32(16, Endian.little);
  var airspeed = data_.getFloat32(20, Endian.little);
  var beta = data_.getFloat32(24, Endian.little);
  var alpha = data_.getFloat32(28, Endian.little);

  return EkfExt(
      timestamp: timestamp,
      windspeed: windspeed,
      winddir: winddir,
      windz: windz,
      airspeed: airspeed,
      beta: beta,
      alpha: alpha);
}