ScaledImu.parse constructor

ScaledImu.parse(
  1. ByteData data_
)

Implementation

factory ScaledImu.parse(ByteData data_) {
  if (data_.lengthInBytes < ScaledImu.mavlinkEncodedLength) {
    var len = ScaledImu.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 xacc = data_.getInt16(4, Endian.little);
  var yacc = data_.getInt16(6, Endian.little);
  var zacc = data_.getInt16(8, Endian.little);
  var xgyro = data_.getInt16(10, Endian.little);
  var ygyro = data_.getInt16(12, Endian.little);
  var zgyro = data_.getInt16(14, Endian.little);
  var xmag = data_.getInt16(16, Endian.little);
  var ymag = data_.getInt16(18, Endian.little);
  var zmag = data_.getInt16(20, Endian.little);
  var temperature = data_.getInt16(22, Endian.little);

  return ScaledImu(
      timeBootMs: timeBootMs,
      xacc: xacc,
      yacc: yacc,
      zacc: zacc,
      xgyro: xgyro,
      ygyro: ygyro,
      zgyro: zgyro,
      xmag: xmag,
      ymag: ymag,
      zmag: zmag,
      temperature: temperature);
}