Vibration.parse constructor

Vibration.parse(
  1. ByteData data_
)

Implementation

factory Vibration.parse(ByteData data_) {
  if (data_.lengthInBytes < Vibration.mavlinkEncodedLength) {
    var len = Vibration.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 vibrationX = data_.getFloat32(8, Endian.little);
  var vibrationY = data_.getFloat32(12, Endian.little);
  var vibrationZ = data_.getFloat32(16, Endian.little);
  var clipping0 = data_.getUint32(20, Endian.little);
  var clipping1 = data_.getUint32(24, Endian.little);
  var clipping2 = data_.getUint32(28, Endian.little);

  return Vibration(
      timeUsec: timeUsec,
      vibrationX: vibrationX,
      vibrationY: vibrationY,
      vibrationZ: vibrationZ,
      clipping0: clipping0,
      clipping1: clipping1,
      clipping2: clipping2);
}