Event.parse constructor

Event.parse(
  1. ByteData data_
)

Implementation

factory Event.parse(ByteData data_) {
  if (data_.lengthInBytes < Event.mavlinkEncodedLength) {
    var len = Event.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var id = data_.getUint32(0, Endian.little);
  var eventTimeBootMs = data_.getUint32(4, Endian.little);
  var sequence = data_.getUint16(8, Endian.little);
  var destinationComponent = data_.getUint8(10);
  var destinationSystem = data_.getUint8(11);
  var logLevels = data_.getUint8(12);
  var arguments = MavlinkMessage.asUint8List(data_, 13, 40);

  return Event(
      id: id,
      eventTimeBootMs: eventTimeBootMs,
      sequence: sequence,
      destinationComponent: destinationComponent,
      destinationSystem: destinationSystem,
      logLevels: logLevels,
      arguments: arguments);
}