public IRollerShutter RegisterRollerShutter(IArea area, Enum id, IBinaryOutput powerOutput, IBinaryOutput directionOutput) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (powerOutput == null) { throw new ArgumentNullException(nameof(powerOutput)); } if (directionOutput == null) { throw new ArgumentNullException(nameof(directionOutput)); } var rollerShutter = new RollerShutter( ComponentIdGenerator.Generate(area.Id, id), new PortBasedRollerShutterEndpoint(powerOutput, directionOutput), _timerService, _schedulerService, _settingsService); area.AddComponent(rollerShutter); return(rollerShutter); }
public IRollerShutter RegisterRollerShutter(IArea area, Enum id, IBinaryOutput powerOutput, IBinaryOutput directionOutput) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (powerOutput == null) { throw new ArgumentNullException(nameof(powerOutput)); } if (directionOutput == null) { throw new ArgumentNullException(nameof(directionOutput)); } var rollerShutter = new RollerShutter( $"{area.Id}.{id}", new PortBasedRollerShutterAdapter(powerOutput, directionOutput), _timerService, _settingsService); area.RegisterComponent(rollerShutter); return(rollerShutter); }
public static IArea WithRollerShutter(this IArea area, Enum id, IBinaryOutput powerOutput, IBinaryOutput directionOutput) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (powerOutput == null) { throw new ArgumentNullException(nameof(powerOutput)); } if (directionOutput == null) { throw new ArgumentNullException(nameof(directionOutput)); } var rollerShutter = new RollerShutter(ActuatorIdFactory.Create(area, id), powerOutput, directionOutput, area.Controller.HttpApiController, area.Controller.Logger, area.Controller.Timer); area.AddActuator(rollerShutter); return(area); }