OpenDroneIdSystemUpdate.parse constructor

OpenDroneIdSystemUpdate.parse(
  1. ByteData data_
)

Implementation

factory OpenDroneIdSystemUpdate.parse(ByteData data_) {
  if (data_.lengthInBytes < OpenDroneIdSystemUpdate.mavlinkEncodedLength) {
    var len =
        OpenDroneIdSystemUpdate.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var operatorLatitude = data_.getInt32(0, Endian.little);
  var operatorLongitude = data_.getInt32(4, Endian.little);
  var operatorAltitudeGeo = data_.getFloat32(8, Endian.little);
  var timestamp = data_.getUint32(12, Endian.little);
  var targetSystem = data_.getUint8(16);
  var targetComponent = data_.getUint8(17);

  return OpenDroneIdSystemUpdate(
      operatorLatitude: operatorLatitude,
      operatorLongitude: operatorLongitude,
      operatorAltitudeGeo: operatorAltitudeGeo,
      timestamp: timestamp,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}