public static async Task <List <Locationwp> > download(MAVLinkInterface port, byte sysid, byte compid, MAVLink.MAV_MISSION_TYPE type, Action <int, string> progress = null)
        {
            List <Locationwp> commandlist = new List <Locationwp>();

            try
            {
                if (!port.BaseStream.IsOpen)
                {
                    throw new Exception("Please Connect First!");
                }

                bool use_supportfence = (port.MAVlist[sysid, compid].cs.capabilities & (uint)MAVLink.MAV_PROTOCOL_CAPABILITY.MISSION_FENCE) > 0;

                bool use_int = (port.MAVlist[sysid, compid].cs.capabilities & (uint)MAVLink.MAV_PROTOCOL_CAPABILITY.MISSION_INT) > 0;

                if (!use_supportfence && type == MAVLink.MAV_MISSION_TYPE.FENCE)
                {
                    throw new Exception("Fence mission items not supported, please use legacy geofence");
                }

                if (!use_supportfence && !port.MAVlist[sysid, compid].mavlinkv2 && type != MAVLink.MAV_MISSION_TYPE.MISSION)
                {
                    throw new Exception("Mission type only supported under mavlink2");
                }

                progress?.Invoke(0, "Getting WP count");

                log.Info("Getting WP # " + type);

                int cmdcount = await port.getWPCountAsync(sysid, compid, type).ConfigureAwait(false);

                for (ushort a = 0; a < cmdcount; a++)
                {
                    log.Info("Getting WP" + a);
                    progress?.Invoke((a * 100) / cmdcount, "Getting WP " + a);
                    commandlist.Add(await port.getWPAsync(sysid, compid, a, type).ConfigureAwait(false));
                }

                port.setWPACK(sysid, compid, type);

                progress?.Invoke(100, "Done");

                log.Info("Done " + type);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw;
            }

            return(commandlist);
        }