WinchStatus.parse constructor

WinchStatus.parse(
  1. ByteData data_
)

Implementation

factory WinchStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < WinchStatus.mavlinkEncodedLength) {
    var len = WinchStatus.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 lineLength = data_.getFloat32(8, Endian.little);
  var speed = data_.getFloat32(12, Endian.little);
  var tension = data_.getFloat32(16, Endian.little);
  var voltage = data_.getFloat32(20, Endian.little);
  var current = data_.getFloat32(24, Endian.little);
  var status = data_.getUint32(28, Endian.little);
  var temperature = data_.getInt16(32, Endian.little);

  return WinchStatus(
      timeUsec: timeUsec,
      lineLength: lineLength,
      speed: speed,
      tension: tension,
      voltage: voltage,
      current: current,
      status: status,
      temperature: temperature);
}