private bool IsInRange(SupportedFirmwareVersion supportedFirmwareVersion)
        {
            VersionBetweenAttribute versionRange = GetVersionRange(supportedFirmwareVersion);

            if (versionRange == null)
            {
                return false;
            }

            if (versionRange.MinVersionState == VersionState.Exclusive && this <= versionRange.MinVersion)
            {
                return false;
            }
            if (versionRange.MinVersionState == VersionState.Inclusive && this < versionRange.MinVersion)
            {
                return false;
            }

            if (versionRange.MaxVersionState == VersionState.Exclusive && this >= versionRange.MaxVersion)
            {
                return false;
            }
            if (versionRange.MaxVersionState == VersionState.Inclusive && this > versionRange.MaxVersion)
            {
                return false;
            }

            return true;
        }
        public DroneConfig()
        {
            serializationUtils = new SerializationUtils();

            droneConfigInitialized = false;

            standardOwnIpAddress = "192.168.1.2";
            droneIpAddress = "192.168.1.1";
            droneNetworkIdentifierStart = "ardrone_";

            videoPort = 5555;
            navigationPort = 5554;
            commandPort = 5556;
            controlInfoPort = 5559;

            firmwareVersion = SupportedFirmwareVersion.Firmware_133;

            timeoutValue = int.MaxValue;
            defaultCameraMode = DroneCameraMode.FrontCamera;

            applicationId = ".NET SDK/1.7.4";
            userId = ".NET SDK USER";
            sessionId = Guid.NewGuid().ToString();

            initialSettings = new List<DroneSetting>();
        }
        public DroneConfig()
        {
            serializationUtils = new SerializationUtils();

            droneConfigInitialized = false;

            standardOwnIpAddress        = "192.168.1.2";
            droneIpAddress              = "192.168.1.1";
            droneNetworkIdentifierStart = "ardrone_";

            videoPort       = 5555;
            navigationPort  = 5554;
            commandPort     = 5556;
            controlInfoPort = 5559;

            firmwareVersion = SupportedFirmwareVersion.Firmware_133;

            timeoutValue      = int.MaxValue;
            defaultCameraMode = DroneCameraMode.FrontCamera;

            applicationId = ".NET SDK/1.7.4";
            userId        = ".NET SDK USER";
            sessionId     = Guid.NewGuid().ToString();

            initialSettings = new List <DroneSetting>();
        }
        public ControlInfoRetriever(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue, SupportedFirmwareVersion firmwareVersion)
            : base(networkConnector, remoteIpAddress, port, timeoutValue)
        {
            this.firmwareVersion = firmwareVersion;

            ResetVariables();
        }
        public ControlInfoRetriever(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue, SupportedFirmwareVersion firmwareVersion)
            : base(networkConnector, remoteIpAddress, port, timeoutValue)
        {
            this.firmwareVersion = firmwareVersion;

            ResetVariables();
        }
示例#6
0
        public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
        {
            CheckSequenceNumber();

            int flightModeValue = GetFlightModeValue();
            return String.Format("AT*REF={0},{1}\r", sequenceNumber, flightModeValue);
        }
示例#7
0
        private bool IsInRange(SupportedFirmwareVersion supportedFirmwareVersion)
        {
            VersionBetweenAttribute versionRange = GetVersionRange(supportedFirmwareVersion);

            if (versionRange == null)
            {
                return(false);
            }

            if (versionRange.MinVersionState == VersionState.Exclusive && this <= versionRange.MinVersion)
            {
                return(false);
            }
            if (versionRange.MinVersionState == VersionState.Inclusive && this < versionRange.MinVersion)
            {
                return(false);
            }

            if (versionRange.MaxVersionState == VersionState.Exclusive && this >= versionRange.MaxVersion)
            {
                return(false);
            }
            if (versionRange.MaxVersionState == VersionState.Inclusive && this > versionRange.MaxVersion)
            {
                return(false);
            }

            return(true);
        }
 private void SetVariables(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue)
 {
     this.networkConnector = networkConnector;
     this.remoteIpAddress = remoteIpAddress;
     this.port = port;
     this.timeoutValue = timeoutValue;
     this.firmwareVersion = DroneConfig.DefaultSupportedFirmwareVersion;
 }
示例#9
0
        private void SetFirmwareVersionAccordingToDroneConfiguration()
        {
            SupportedFirmwareVersion firmwareVersionToUse = GetFirmwareVersionToUse();

            commandSender.FirmwareVersion           = firmwareVersionToUse;
            navigationDataRetriever.FirmwareVersion = firmwareVersionToUse;
            videoDataRetriever.FirmwareVersion      = firmwareVersionToUse;
        }
示例#10
0
        public CommandSender(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue, SupportedFirmwareVersion firmwareVersion, DroneCameraMode defaultCameraMode)
            : base(networkConnector, remoteIpAddress, port, timeoutValue)
        {
            this.firmwareVersion = firmwareVersion;
            this.defaultCameraMode = defaultCameraMode;

            ResetVariables();
        }
示例#11
0
        public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
        {
            CheckSequenceNumber();

            int flightModeValue = GetFlightModeValue();

            return(String.Format("AT*REF={0},{1}\r", sequenceNumber, flightModeValue));
        }
        public CommandSender(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue, SupportedFirmwareVersion firmwareVersion, DroneCameraMode defaultCameraMode)
            : base(networkConnector, remoteIpAddress, port, timeoutValue)
        {
            this.firmwareVersion   = firmwareVersion;
            this.defaultCameraMode = defaultCameraMode;

            ResetVariables();
        }
示例#13
0
 private void SetVariables(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue)
 {
     this.networkConnector = networkConnector;
     this.remoteIpAddress  = remoteIpAddress;
     this.port             = port;
     this.timeoutValue     = timeoutValue;
     this.firmwareVersion  = DroneConfig.DefaultSupportedFirmwareVersion;
 }
        public VideoDataRetriever(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue, SupportedFirmwareVersion firmwareVersion)
            : base(networkConnector, remoteIpAddress, port, timeoutValue)
        {
            this.firmwareVersion = firmwareVersion;

            bitmapUtils = new BitmapUtils();

            ResetVariables();
        }
示例#15
0
        public NetworkConnector(String droneNetworkIdentifierStart, String standardOwnIpAddress, String droneIpAddress, SupportedFirmwareVersion firmwareVersion)
        {
            Initialize();

            this.droneNetworkIdentifierStart = droneNetworkIdentifierStart;
            this.standardOwnIpAddress = standardOwnIpAddress;
            this.droneIpAddress = droneIpAddress;
            this.firmwareVersion = firmwareVersion;
        }
示例#16
0
        public VideoDataRetriever(NetworkConnector networkConnector, String remoteIpAddress, int port, int timeoutValue, SupportedFirmwareVersion firmwareVersion)
            : base(networkConnector, remoteIpAddress, port, timeoutValue)
        {
            this.firmwareVersion = firmwareVersion;

            bitmapUtils = new BitmapUtils();

            ResetVariables();
        }
示例#17
0
        public NetworkConnector(String droneNetworkIdentifierStart, String standardOwnIpAddress, String droneIpAddress, SupportedFirmwareVersion firmwareVersion)
        {
            Initialize();

            this.droneNetworkIdentifierStart = droneNetworkIdentifierStart;
            this.standardOwnIpAddress        = standardOwnIpAddress;
            this.droneIpAddress  = droneIpAddress;
            this.firmwareVersion = firmwareVersion;
        }
示例#18
0
        public NetworkSanityChecker(VideoDataRetriever videoDataRetriever,
                                    NavigationDataRetriever navigationDataRetriever,
                                    CommandSender commandSender,
                                    SupportedFirmwareVersion firmwareVersion)
        {
            this.videoDataRetriever      = videoDataRetriever;
            this.navigationDataRetriever = navigationDataRetriever;
            this.commandSender           = commandSender;

            this.firmwareVersion = firmwareVersion;
        }
        public NetworkSanityChecker(VideoDataRetriever videoDataRetriever,
                                    NavigationDataRetriever navigationDataRetriever,
                                    CommandSender commandSender,
                                    SupportedFirmwareVersion firmwareVersion)
        {
            this.videoDataRetriever = videoDataRetriever;
            this.navigationDataRetriever = navigationDataRetriever;
            this.commandSender = commandSender;

            this.firmwareVersion = firmwareVersion;
        }
示例#20
0
        private VersionBetweenAttribute GetVersionRange(SupportedFirmwareVersion supportedFirmwareVersion)
        {
            MemberInfo memberInfo = typeof(SupportedFirmwareVersion).GetMember(supportedFirmwareVersion.ToString()).FirstOrDefault();

            if (memberInfo != null)
            {
                VersionBetweenAttribute attribute = (VersionBetweenAttribute)memberInfo.GetCustomAttributes(typeof(VersionBetweenAttribute), false).FirstOrDefault();
                return(attribute);
            }

            return(null);
        }
        public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
        {
            CheckSequenceNumber();

            switch (firmwareVersion)
            {
            case SupportedFirmwareVersion.Firmware_151:
                return(String.Format("AT*CONFIG={0},\"{1}\",\"{2}\"\r", sequenceNumber, "video:video_channel", (int)cameraMode));

            default:
                return(String.Format("AT*ZAP={0},{1}\r", sequenceNumber, (int)cameraMode));
            }
        }
        private void TakeOverDroneConfigSettings(DroneConfig droneConfig)
        {
            DroneNetworkSSID = droneConfig.DroneNetworkIdentifierStart;

            DroneIpAddress = droneConfig.DroneIpAddress;
            OwnIpAddress   = droneConfig.StandardOwnIpAddress;

            VideoPortText      = droneConfig.VideoPort.ToString();
            CommandPortText    = droneConfig.CommandPort.ToString();
            NavigationPortText = droneConfig.NavigationPort.ToString();
            ControlPortText    = droneConfig.ControlInfoPort.ToString();

            firmwareVersion = droneConfig.FirmwareVersion;
        }
示例#23
0
        public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
        {
            CheckSequenceNumber();

            switch (firmwareVersion)
            {
                case SupportedFirmwareVersion.Firmware_Between_15x_And_164:
                case SupportedFirmwareVersion.Firmware_164_Or_Above:
                    return String.Format("AT*CONFIG={0},\"{1}\",\"{2}\"\r", sequenceNumber, "video:video_channel", (int)cameraMode);

                default:
                    return String.Format("AT*ZAP={0},{1}\r", sequenceNumber, (int)cameraMode);
            }
        }
        private void TakeOverDroneConfigSettings(DroneConfig droneConfig)
        {
            DroneNetworkSSID = droneConfig.DroneNetworkIdentifierStart;

            DroneIpAddress = droneConfig.DroneIpAddress;
            OwnIpAddress = droneConfig.StandardOwnIpAddress;

            VideoPortText = droneConfig.VideoPort.ToString();
            CommandPortText = droneConfig.CommandPort.ToString();
            NavigationPortText = droneConfig.NavigationPort.ToString();
            ControlPortText = droneConfig.ControlInfoPort.ToString();

            firmwareVersion = droneConfig.FirmwareVersion;
        }
        private void TakeOverDroneConfigSettings(DroneConfig droneConfig)
        {
            DroneNetworkSSID = droneConfig.DroneNetworkIdentifierStart;

            DroneIpAddress = droneConfig.DroneIpAddress;
            OwnIpAddress   = droneConfig.StandardOwnIpAddress;

            VideoPortText      = droneConfig.VideoPort.ToString();
            CommandPortText    = droneConfig.CommandPort.ToString();
            NavigationPortText = droneConfig.NavigationPort.ToString();
            ControlPortText    = droneConfig.ControlInfoPort.ToString();

            firmwareVersion = droneConfig.FirmwareVersion;

            UseP264 = droneConfig.InitialSettings.Any(x => x.Key == videoCodec && x.Value == VideoCodecs.P264);
        }
        private void TakeOverDroneConfigSettings(DroneConfig droneConfig)
        {
            DroneNetworkSSID = droneConfig.DroneNetworkIdentifierStart;

            DroneIpAddress = droneConfig.DroneIpAddress;
            OwnIpAddress = droneConfig.StandardOwnIpAddress;

            VideoPortText = droneConfig.VideoPort.ToString();
            CommandPortText = droneConfig.CommandPort.ToString();
            NavigationPortText = droneConfig.NavigationPort.ToString();
            ControlPortText = droneConfig.ControlInfoPort.ToString();

            firmwareVersion = droneConfig.FirmwareVersion;

            UseP264 = droneConfig.InitialSettings.Any(x => x.Key == videoCodec && x.Value == VideoCodecs.P264);
        }
        public override String CreateCommand(SupportedFirmwareVersion firmwareVersion, DroneConfig droneConfig, Func <uint> additionalSequenceNumber)
        {
            CheckSequenceNumber();
            if (!multiConfig)
            {
                return(String.Format("AT*CONFIG={0},\"{1}\",\"{2}\"\r", sequenceNumber, configurationKey, configurationValue));
            }

            string cmd = String.Format("AT*CONFIG_IDS={0},\"{1}\",\"{2}\",\"{3}\"\r", sequenceNumber, GetCrc32(droneConfig.SessionId), GetCrc32(droneConfig.UserId), GetCrc32(droneConfig.ApplicationId));

            if (configurationKey == null)
            {
                return(cmd);
            }

            return(string.Format("{0}AT*CONFIG={1},\"{2}\",\"{3}\"\r", cmd, additionalSequenceNumber(), configurationKey, configurationValue));
        }
示例#28
0
        public DroneConfig()
        {
            droneConfigInitialized = false;

            standardOwnIpAddress = "192.168.1.2";
            droneIpAddress = "192.168.1.1";
            droneNetworkIdentifierStart = "ardrone_";

            videoPort = 5555;
            navigationPort = 5554;
            commandPort = 5556;
            controlInfoPort = 5559;

            firmwareVersion = SupportedFirmwareVersion.Firmware_133;

            timeoutValue = 500;
            defaultCameraMode = DroneCameraMode.FrontCamera;
        }
示例#29
0
        public DroneConfig()
        {
            droneConfigInitialized = false;

            standardOwnIpAddress        = "192.168.1.2";
            droneIpAddress              = "192.168.1.1";
            droneNetworkIdentifierStart = "ardrone_";

            videoPort       = 5555;
            navigationPort  = 5554;
            commandPort     = 5556;
            controlInfoPort = 5559;

            firmwareVersion = SupportedFirmwareVersion.Firmware_133;

            timeoutValue      = 500;
            defaultCameraMode = DroneCameraMode.FrontCamera;
        }
        public DroneConfig()
        {
            serializationUtils = new SerializationUtils();

            droneConfigInitialized = false;

            standardOwnIpAddress = "192.168.1.2";
            droneIpAddress = "192.168.1.1";
            droneNetworkIdentifierStart = "ardrone2_";

            videoPort = 5555;
            navigationPort = 5554;
            commandPort = 5556;
            controlInfoPort = 5559;

            useSpecificFirmwareVersion = false;
            firmwareVersion = DroneConfig.DefaultSupportedFirmwareVersion;

            timeoutValue = 500;
            defaultCameraMode = DroneCameraMode.FrontCamera;
        }
示例#31
0
        public DroneConfig()
        {
            serializationUtils = new SerializationUtils();

            droneConfigInitialized = false;

            standardOwnIpAddress        = "192.168.1.2";
            droneIpAddress              = "192.168.1.1";
            droneNetworkIdentifierStart = "ardrone2_";

            videoPort       = 5555;
            navigationPort  = 5554;
            commandPort     = 5556;
            controlInfoPort = 5559;

            useSpecificFirmwareVersion = false;
            firmwareVersion            = DroneConfig.DefaultSupportedFirmwareVersion;

            timeoutValue      = 500;
            defaultCameraMode = DroneCameraMode.FrontCamera;
        }
示例#32
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*CTRL={0},{1},0\r", sequenceNumber, (int)mode));
 }
示例#33
0
 public virtual string CreateCommand(SupportedFirmwareVersion firmwareVersion, DroneConfig config, Func <uint> additionalSequenceNumber)
 {
     return(CreateCommand(firmwareVersion));
 }
示例#34
0
 public virtual string CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     return(null);
 }
示例#35
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*CONFIG={0},\"control:flight_anim\",\"{1},{2}\"\r", sequenceNumber, (int)droneAnimation, duration));
     //return String.Format("AT*ANIM={0},{1},{2}\r", sequenceNumber, (int)droneAnimation, duration);
 }
示例#36
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*PCMD={0},{1},{2},{3},{4},{5}\r", sequenceNumber, 1, NormalizeValue(roll), NormalizeValue(pitch), NormalizeValue(gaz), NormalizeValue(yaw));
 }
示例#37
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*PCMD={0},{1},{2},{3},{4},{5}\r", sequenceNumber, (mode == DroneHoverMode.Hover) ? 0 : 1, 0, 0, 0, 0));
 }
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*LED={0},{1},{2},{3}\r", sequenceNumber, (int)ledAnimation, NormalizeValue(frequency), duration));
 }
        private VersionBetweenAttribute GetVersionRange(SupportedFirmwareVersion supportedFirmwareVersion)
        {
            MemberInfo memberInfo = typeof(SupportedFirmwareVersion).GetMember(supportedFirmwareVersion.ToString()).FirstOrDefault();

            if (memberInfo != null)
            {
                VersionBetweenAttribute attribute = (VersionBetweenAttribute)memberInfo.GetCustomAttributes(typeof(VersionBetweenAttribute), false).FirstOrDefault();
                return attribute;
            }

            return null;
        }
示例#40
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*PCMD={0},{1},{2},{3},{4},{5}\r", sequenceNumber, 1, NormalizeValue(roll), NormalizeValue(pitch), NormalizeValue(gaz), NormalizeValue(yaw)));
 }
示例#41
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*FTRIM={0}\r", sequenceNumber);
 }
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*LED={0},{1},{2},{3}\r", sequenceNumber, (int)ledAnimation, NormalizeValue(frequency), duration);
 }
示例#43
0
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*FTRIM={0}\r", sequenceNumber));
 }
示例#44
0
 public virtual string CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     return null;
 }
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*CONFIG={0},\"{1}\",\"{2}\"\r", sequenceNumber, configurationKey, configurationValue);
 }
示例#46
0
 public virtual string CreateCommand(SupportedFirmwareVersion firmwareVersion, DroneConfig config, Func<uint> additionalSequenceNumber)
 {
     return CreateCommand(firmwareVersion);
 }
示例#47
0
 public abstract String CreateCommand(SupportedFirmwareVersion firmwareVersion);
示例#48
0
 public override String CreateCommand( SupportedFirmwareVersion firmwareVersion )
 {
     CheckSequenceNumber();
     // unpairing is : "00:00:00:00:00:00"
     return String.Format( "AT*CONFIG={0},{1},{2}\r", sequenceNumber, "network:owner_mac", _mac );
 }
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*PCMD={0},{1},{2},{3},{4},{5}\r", sequenceNumber, (mode == DroneHoverMode.Hover) ? 0 : 1, 0, 0, 0, 0);
 }
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*CONFIG={0},\"control:flight_anim\",\"{1},{2}\"\r", sequenceNumber, (int)droneAnimation, duration);
     //return String.Format("AT*ANIM={0},{1},{2}\r", sequenceNumber, (int)droneAnimation, duration);
 }
示例#51
0
 public abstract String CreateCommand(SupportedFirmwareVersion firmwareVersion);
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return String.Format("AT*CTRL={0},{1},0\r", sequenceNumber, (int)mode);
 }
 public override String CreateCommand(SupportedFirmwareVersion firmwareVersion)
 {
     CheckSequenceNumber();
     return(String.Format("AT*CONFIG={0},\"{1}\",\"{2}\"\r", sequenceNumber, configurationKey, configurationValue));
 }