public RollerShutter( ComponentId id, IRollerShutterEndpoint endpoint, ITimerService timerService, ISchedulerService schedulerService, ISettingsService settingsService) : base(id) { if (id == null) throw new ArgumentNullException(nameof(id)); if (endpoint == null) throw new ArgumentNullException(nameof(endpoint)); if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService)); if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); _endpoint = endpoint; _schedulerService = schedulerService; settingsService.CreateSettingsMonitor<RollerShutterSettings>(Id, s => Settings = s); timerService.Tick += (s, e) => UpdatePosition(e); _startMoveUpAction = new Action(() => SetState(RollerShutterStateId.MovingUp)); _turnOffAction = new Action(() => SetState(RollerShutterStateId.Off)); _startMoveDownAction = new Action(() => SetState(RollerShutterStateId.MovingDown)); endpoint.Stop(HardwareParameter.ForceUpdateState); }
public RollerShutter( ComponentId id, IRollerShutterEndpoint endpoint, IHomeAutomationTimer timer, ISchedulerService schedulerService) : base(id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } _endpoint = endpoint; _timer = timer; _schedulerService = schedulerService; timer.Tick += (s, e) => UpdatePosition(e); _settings = new RollerShutterSettingsWrapper(Settings); _startMoveUpAction = new Action(() => SetState(RollerShutterStateId.MovingUp)); _turnOffAction = new Action(() => SetState(RollerShutterStateId.Off)); _startMoveDownAction = new Action(() => SetState(RollerShutterStateId.MovingDown)); endpoint.Stop(HardwareParameter.ForceUpdateState); }
public RollerShutter( ComponentId id, IRollerShutterEndpoint endpoint, ITimerService timerService, ISchedulerService schedulerService, ISettingsService settingsService) : base(id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } _endpoint = endpoint; _schedulerService = schedulerService; settingsService.CreateSettingsMonitor <RollerShutterSettings>(Id, s => Settings = s); timerService.Tick += (s, e) => UpdatePosition(e); _startMoveUpAction = new Action(() => SetState(RollerShutterStateId.MovingUp)); _turnOffAction = new Action(() => SetState(RollerShutterStateId.Off)); _startMoveDownAction = new Action(() => SetState(RollerShutterStateId.MovingDown)); endpoint.Stop(HardwareParameter.ForceUpdateState); }