public async Task DoCameraAndMotionMagic( ICollector <IMqttMessage> outMessages, CloudBlockBlob outputBlob, ILogger log, ExecutionContext context) { var motionConfiguration = new MotionConfiguration(context); var cameraService = new CameraService(motionConfiguration, log); var cameraStill = await cameraService.GetCameraStill(); try { var motionService = new MotionService(motionConfiguration, log); var motionDetectionResult = await motionService.DetectMotionAsync(cameraStill); foreach (var mqttMessage in motionDetectionResult.MqttMessages) { outMessages.Add(mqttMessage); } } catch (Exception ex) { log.LogError(ex, "Error doing the AI stuff"); } await outputBlob.UploadFromByteArrayAsync(cameraStill, 0, cameraStill.Length); }
public CameraService(MotionConfiguration config, ILogger log) { _config = config; _log = log; }