ServoOutputRaw.parse constructor

ServoOutputRaw.parse(
  1. ByteData data_
)

Implementation

factory ServoOutputRaw.parse(ByteData data_) {
  if (data_.lengthInBytes < ServoOutputRaw.mavlinkEncodedLength) {
    var len = ServoOutputRaw.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint32(0, Endian.little);
  var servo1Raw = data_.getUint16(4, Endian.little);
  var servo2Raw = data_.getUint16(6, Endian.little);
  var servo3Raw = data_.getUint16(8, Endian.little);
  var servo4Raw = data_.getUint16(10, Endian.little);
  var servo5Raw = data_.getUint16(12, Endian.little);
  var servo6Raw = data_.getUint16(14, Endian.little);
  var servo7Raw = data_.getUint16(16, Endian.little);
  var servo8Raw = data_.getUint16(18, Endian.little);
  var port = data_.getUint8(20);
  var servo9Raw = data_.getUint16(21, Endian.little);
  var servo10Raw = data_.getUint16(23, Endian.little);
  var servo11Raw = data_.getUint16(25, Endian.little);
  var servo12Raw = data_.getUint16(27, Endian.little);
  var servo13Raw = data_.getUint16(29, Endian.little);
  var servo14Raw = data_.getUint16(31, Endian.little);
  var servo15Raw = data_.getUint16(33, Endian.little);
  var servo16Raw = data_.getUint16(35, Endian.little);

  return ServoOutputRaw(
      timeUsec: timeUsec,
      servo1Raw: servo1Raw,
      servo2Raw: servo2Raw,
      servo3Raw: servo3Raw,
      servo4Raw: servo4Raw,
      servo5Raw: servo5Raw,
      servo6Raw: servo6Raw,
      servo7Raw: servo7Raw,
      servo8Raw: servo8Raw,
      port: port,
      servo9Raw: servo9Raw,
      servo10Raw: servo10Raw,
      servo11Raw: servo11Raw,
      servo12Raw: servo12Raw,
      servo13Raw: servo13Raw,
      servo14Raw: servo14Raw,
      servo15Raw: servo15Raw,
      servo16Raw: servo16Raw);
}