MavlinkFiles

public class MavlinkFiles

Utility class that provides methods to generate a MAVLink file from a list of MavlinkCommand, and conversely, parse a MAVLink file.

A MAVLink file contains a list of commands in a plain-text format, which forms a mission script. Note that supported MAVLink commands differ from official MAVLink common message set. For further information about supported MAVLink commands, please refer to Parrot FlightPlan MAVLink documentation.

  • Generates a MAVLink file from the given list of commands.

    Throws

    Declaration

    Swift

    public static func generate(filepath: String,
                                commands: [MavlinkCommand],
                                version: String = "QGC WPL 120") throws

    Parameters

    filepath

    local path of the file to write

    commands

    list of MAVLink commands

    version

    the MAVLink version header

  • Parses a MAVLink file into a list of commands.

    Any malformed command is simply ignored and removed from the resulting array. If the given file is not properly formatted, this method returns an empty list.

    Declaration

    Swift

    public static func parse(filepath: String) throws -> [MavlinkCommand]

    Parameters

    filepath

    local path of the file to read

    Return Value

    the command list extracted from the file

  • Parses a MAVLink string into a list of commands.

    Any malformed command is simply ignored. If the given string is not properly formatted, this method returns an empty list.

    Declaration

    Swift

    public static func parse(mavlinkString: String) throws -> [MavlinkCommand]

    Parameters

    mavlinkString

    MAVLing string to convert

    Return Value

    the command list extracted from the string