public Controller(DroneClient client, AnalyzerOutput output, Config configuration, IoTHubController hubController) { analyzer = output; analyzer.PropertyChanged += Analyzer_PropertyChanged; droneClient = client; this.hubController = hubController; autoPilot = new Autopilot(client); config = configuration; }
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); }