HilSensor.parse constructor

HilSensor.parse(
  1. ByteData data_
)

Implementation

factory HilSensor.parse(ByteData data_) {
  if (data_.lengthInBytes < HilSensor.mavlinkEncodedLength) {
    var len = HilSensor.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 xacc = data_.getFloat32(8, Endian.little);
  var yacc = data_.getFloat32(12, Endian.little);
  var zacc = data_.getFloat32(16, Endian.little);
  var xgyro = data_.getFloat32(20, Endian.little);
  var ygyro = data_.getFloat32(24, Endian.little);
  var zgyro = data_.getFloat32(28, Endian.little);
  var xmag = data_.getFloat32(32, Endian.little);
  var ymag = data_.getFloat32(36, Endian.little);
  var zmag = data_.getFloat32(40, Endian.little);
  var absPressure = data_.getFloat32(44, Endian.little);
  var diffPressure = data_.getFloat32(48, Endian.little);
  var pressureAlt = data_.getFloat32(52, Endian.little);
  var temperature = data_.getFloat32(56, Endian.little);
  var fieldsUpdated = data_.getUint32(60, Endian.little);
  var id = data_.getUint8(64);

  return HilSensor(
      timeUsec: timeUsec,
      xacc: xacc,
      yacc: yacc,
      zacc: zacc,
      xgyro: xgyro,
      ygyro: ygyro,
      zgyro: zgyro,
      xmag: xmag,
      ymag: ymag,
      zmag: zmag,
      absPressure: absPressure,
      diffPressure: diffPressure,
      pressureAlt: pressureAlt,
      temperature: temperature,
      fieldsUpdated: fieldsUpdated,
      id: id);
}