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( ComponentIdFactory.Create(area.Id, id), new PortBasedRollerShutterEndpoint(powerOutput, directionOutput), area.Controller.Timer, area.Controller.ServiceLocator.GetService <ISchedulerService>()); area.AddComponent(rollerShutter); return(area); }
public static IActuator GetActuator(this IArea area, Enum id) { if (area == null) { throw new ArgumentNullException(nameof(area)); } return(area.GetComponent <IActuator>(ComponentIdFactory.Create(area.Id, id))); }
public static IRollerShutter GetRollerShutter(this IArea area, Enum id) { if (area == null) { throw new ArgumentNullException(nameof(area)); } return(area.GetComponent <RollerShutter>(ComponentIdFactory.Create(area.Id, id))); }
public static IStateMachine GetStateMachine(this IArea area, Enum id) { if (area == null) { throw new ArgumentNullException(nameof(area)); } return(area.GetComponent <IStateMachine>(ComponentIdFactory.Create(area.Id, id))); }
public static LogicalBinaryStateActuator CombineActuators(this IArea area, Enum id) { if (area == null) { throw new ArgumentNullException(nameof(area)); } var actuator = new LogicalBinaryStateActuator(ComponentIdFactory.Create(area.Id, id), area.Controller.Timer); area.AddComponent(actuator); return(actuator); }
public void AddSynonymsForComponent(AreaId areaId, Enum componentId, params string[] synonyms) { if (componentId == null) { throw new ArgumentNullException(nameof(componentId)); } if (synonyms == null) { throw new ArgumentNullException(nameof(synonyms)); } AddSynonymsForComponent(ComponentIdFactory.Create(areaId, componentId), synonyms); }
public static IArea WithVirtualButton(this IArea area, Enum id, Action <IButton> initializer = null) { if (area == null) { throw new ArgumentNullException(nameof(area)); } var virtualButton = new Button(ComponentIdFactory.Create(area.Id, id), new EmptyButtonEndpoint(), area.Controller.Timer); initializer?.Invoke(virtualButton); area.AddComponent(virtualButton); return(area); }
public static IArea WithTemperatureSensor(this IArea area, Enum id, INumericValueSensorEndpoint endpoint) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } area.AddComponent(new TemperatureSensor(ComponentIdFactory.Create(area.Id, id), endpoint)); return(area); }
public static IArea WithLamp(this IArea area, Enum id, IBinaryOutput output) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } var lamp = new Lamp(ComponentIdFactory.Create(area.Id, id), new PortBasedBinaryStateEndpoint(output)); area.AddComponent(lamp); return(area); }
public static IArea WithWindow(this IArea area, Enum id, Action <Window> initializer) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (initializer == null) { throw new ArgumentNullException(nameof(initializer)); } var window = new Window(ComponentIdFactory.Create(area.Id, id)); initializer(window); area.AddComponent(window); return(area); }
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); }
public static IArea WithStateMachine(this IArea area, Enum id, Action <StateMachine, IArea> initializer) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (initializer == null) { throw new ArgumentNullException(nameof(initializer)); } var stateMachine = new StateMachine( ComponentIdFactory.Create(area.Id, id)); initializer(stateMachine, area); stateMachine.SetInitialState(BinaryStateId.Off); area.AddComponent(stateMachine); return(area); }
public static IArea WithButton(this IArea area, Enum id, IBinaryInput input, Action <IButton> initializer = null) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (input == null) { throw new ArgumentNullException(nameof(input)); } var button = new Button( ComponentIdFactory.Create(area.Id, id), new PortBasedButtonEndpoint(input), area.Controller.Timer); initializer?.Invoke(button); area.AddComponent(button); return(area); }
public static IArea WithRollerShutterButtons( this IArea area, Enum upId, IBinaryInput upInput, Enum downId, IBinaryInput downInput) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (upInput == null) { throw new ArgumentNullException(nameof(upInput)); } if (downInput == null) { throw new ArgumentNullException(nameof(downInput)); } var upButton = new Button( ComponentIdFactory.Create(area.Id, upId), new PortBasedButtonEndpoint(upInput), area.Controller.Timer); area.AddComponent(upButton); var downButton = new Button( ComponentIdFactory.Create(area.Id, downId), new PortBasedButtonEndpoint(downInput), area.Controller.Timer); area.AddComponent(downButton); return(area); }