private void CreateDroneWorkers() { networkConnector = new NetworkConnector(droneConfig.DroneNetworkIdentifierStart, droneConfig.StandardOwnIpAddress, droneConfig.DroneIpAddress); networkConnector.ConnectionStateChanged += networkConnector_ConnectionStateChanged; networkConnector.Error += networkWorker_Error; videoDataRetriever = new VideoDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.VideoPort, droneConfig.TimeoutValue); videoDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged; videoDataRetriever.Error += networkWorker_Error; navigationDataRetriever = new NavigationDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.NavigationPort, droneConfig.TimeoutValue); navigationDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged; navigationDataRetriever.Error += networkWorker_Error; commandSender = new CommandSender(networkConnector, droneConfig.DroneIpAddress, droneConfig.CommandPort, droneConfig.TimeoutValue, droneConfig.DefaultCameraMode); commandSender.ConnectionStateChanged += networkWorker_ConnectionStateChanged; commandSender.Error += networkWorker_Error; controlInfoRetriever = new ControlInfoRetriever(droneConfig.DroneIpAddress); // Interop between the different threads commandSender.DataRetriever = navigationDataRetriever; networkSanityChecker = new NetworkSanityChecker(videoDataRetriever, navigationDataRetriever, commandSender, droneConfig.FirmwareVersion); networkSanityChecker.SanityCheckComplete += networkSanityChecker_SanityChecked; }
private void CreateDroneWorkers() { if (MessageBox.Show("Please turn on your AR Drone. Make sure the LED's are green.\n\nMake sure your wireless adapter is turned on.\nYou do not have to be connected to the drone yet.\n\nAre you using an Parrot AR Drone 2.0?", "AR Drone 2.0?", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.setDroneVersion(2); } else { this.setDroneVersion(1); } networkConnector = new NetworkConnector(droneConfig.DroneNetworkIdentifierStart, droneConfig.StandardOwnIpAddress, droneConfig.DroneIpAddress); networkConnector.ConnectionStateChanged += networkConnector_ConnectionStateChanged; networkConnector.Error += networkWorker_Error; videoDataRetriever = new VideoDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.VideoPort, droneConfig.TimeoutValue); videoDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged; videoDataRetriever.Error += networkWorker_Error; navigationDataRetriever = new NavigationDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.NavigationPort, droneConfig.TimeoutValue); navigationDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged; navigationDataRetriever.Error += networkWorker_Error; commandSender = new CommandSender(networkConnector, droneConfig.DroneIpAddress, droneConfig.CommandPort, droneConfig.TimeoutValue, droneConfig.DefaultCameraMode); commandSender.ConnectionStateChanged += networkWorker_ConnectionStateChanged; commandSender.Error += networkWorker_Error; controlInfoRetriever = new ControlInfoRetriever(droneConfig.DroneIpAddress); // Interop between the different threads commandSender.DataRetriever = navigationDataRetriever; networkSanityChecker = new NetworkSanityChecker(videoDataRetriever, navigationDataRetriever, commandSender, droneConfig.FirmwareVersion); networkSanityChecker.SanityCheckComplete += networkSanityChecker_SanityChecked; }