// Called if the gameobject is destroyed void OnDestroy() { droneClient.Land(); droneClient.Stop(); droneClient.Dispose(); videoPacketDecoderWorker.Stop(); videoPacketDecoderWorker.Dispose(); }
/// <summary> /// Stop video processing /// </summary> private void StopVideo() { timerVideoUpdate.Enabled = false; videoPacketDecoderWorker.Stop(); videoPacketDecoderWorker.Join(); frame = null; frameBitmap = null; }
private async void MainWindow_Closed(object sender, EventArgs e) { if (frameTimer != null) { frameTimer.Stop(); } if (droneClient != null) { droneClient.Stop(); droneClient.Dispose(); } if (videoPacketDecoderWorker != null) { videoPacketDecoderWorker.Stop(); videoPacketDecoderWorker.Dispose(); } await closeSource(); }
void configDrone() { if (droneClient != null) { droneClient.VideoPacketAcquired -= OnVideoPacketAcquired; } droneClient?.Stop(); droneClient?.Dispose(); iotController = null; autoPilot?.Stop(); autoPilot = null; videoPacketDecoderWorker?.Stop(); videoPacketDecoderWorker?.Dispose(); Logger.LogInfo($"Configuring Drone at {config.DroneIP}"); droneClient = new DroneClient(config.DroneIP); droneClient.VideoPacketAcquired += OnVideoPacketAcquired; videoPacketDecoderWorker = new VideoPacketDecoderWorker(AR.Drone.Video.PixelFormat.BGR24, true, OnVideoPacketDecoded); videoPacketDecoderWorker.Start(); iotController = new IoTHubController(droneClient, analyzerOutput, bitmaps); autoPilot = new Pilot.Controller(droneClient, analyzerOutput, config, iotController); }