public IMotionDetector RegisterMotionDetector(IArea area, Enum id, IBinaryInput input) { if (area == null) throw new ArgumentNullException(nameof(area)); if (input == null) throw new ArgumentNullException(nameof(input)); var motionDetector = new MotionDetector( ComponentIdGenerator.Generate(area.Id, id), new PortBasedMotionDetectorEndpoint(input), _schedulerService, _settingsService); area.AddComponent(motionDetector); return motionDetector; }
public static IArea WithMotionDetector(this IArea area, Enum id, IBinaryInput input) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (input == null) { throw new ArgumentNullException(nameof(input)); } var motionDetector = new MotionDetector( ComponentIdFactory.Create(area.Id, id), new PortBasedMotionDetectorEndpoint(input), area.Controller.ServiceLocator.GetService <ISchedulerService>()); area.AddComponent(motionDetector); return(area); }