HilOpticalFlow.parse constructor

HilOpticalFlow.parse(
  1. ByteData data_
)

Implementation

factory HilOpticalFlow.parse(ByteData data_) {
  if (data_.lengthInBytes < HilOpticalFlow.mavlinkEncodedLength) {
    var len = HilOpticalFlow.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 integrationTimeUs = data_.getUint32(8, Endian.little);
  var integratedX = data_.getFloat32(12, Endian.little);
  var integratedY = data_.getFloat32(16, Endian.little);
  var integratedXgyro = data_.getFloat32(20, Endian.little);
  var integratedYgyro = data_.getFloat32(24, Endian.little);
  var integratedZgyro = data_.getFloat32(28, Endian.little);
  var timeDeltaDistanceUs = data_.getUint32(32, Endian.little);
  var distance = data_.getFloat32(36, Endian.little);
  var temperature = data_.getInt16(40, Endian.little);
  var sensorId = data_.getUint8(42);
  var quality = data_.getUint8(43);

  return HilOpticalFlow(
      timeUsec: timeUsec,
      integrationTimeUs: integrationTimeUs,
      integratedX: integratedX,
      integratedY: integratedY,
      integratedXgyro: integratedXgyro,
      integratedYgyro: integratedYgyro,
      integratedZgyro: integratedZgyro,
      timeDeltaDistanceUs: timeDeltaDistanceUs,
      distance: distance,
      temperature: temperature,
      sensorId: sensorId,
      quality: quality);
}