public static LogicalBinaryStateOutputActuator CombineActuators(this IArea room, Enum id)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }

            var actuator = new LogicalBinaryStateOutputActuator(ActuatorIdFactory.Create(room, id), room.Controller.HttpApiController, room.Controller.Logger, room.Controller.Timer);

            room.AddActuator(actuator);
            return(actuator);
        }
        public static IArea WithButton(this IArea room, Enum id, IBinaryInput input)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            room.AddActuator(new Button(ActuatorIdFactory.Create(room, id), input, room.Controller.HttpApiController, room.Controller.Logger, room.Controller.Timer));
            return(room);
        }
        public static IArea WithTemperatureSensor(this IArea room, Enum id, ISingleValueSensor sensor)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (sensor == null)
            {
                throw new ArgumentNullException(nameof(sensor));
            }

            room.AddActuator(new TemperatureSensor(ActuatorIdFactory.Create(room, id), sensor, room.Controller.HttpApiController, room.Controller.Logger));
            return(room);
        }
        public static IArea WithLamp(this IArea room, Enum id, IBinaryOutput output)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            var lamp = new Lamp(ActuatorIdFactory.Create(room, id), output, room.Controller.HttpApiController, room.Controller.Logger);

            lamp.SetInitialState();

            room.AddActuator(lamp);
            return(room);
        }
        public static IArea WithVirtualButtonGroup(this IArea room, Enum id, Action <VirtualButtonGroup> initializer)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (initializer == null)
            {
                throw new ArgumentNullException(nameof(initializer));
            }

            var virtualButtonGroup = new VirtualButtonGroup(ActuatorIdFactory.Create(room, id), room.Controller.HttpApiController, room.Controller.Logger);

            initializer.Invoke(virtualButtonGroup);

            room.AddActuator(virtualButtonGroup);
            return(room);
        }
        public static IArea WithWindow(this IArea room, Enum id, Action <Window> initializer)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (initializer == null)
            {
                throw new ArgumentNullException(nameof(initializer));
            }

            var window = new Window(ActuatorIdFactory.Create(room, id), room.Controller.HttpApiController, room.Controller.Logger);

            initializer(window);

            room.AddActuator(window);
            return(room);
        }
Exemplo n.º 7
0
        public static IArea WithStateMachine(this IArea room, Enum id, Action <StateMachine, IArea> initializer)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (initializer == null)
            {
                throw new ArgumentNullException(nameof(initializer));
            }

            var stateMachine = new StateMachine(ActuatorIdFactory.Create(room, id), room.Controller.HttpApiController, room.Controller.Logger);

            initializer(stateMachine, room);
            stateMachine.SetInitialState();

            room.AddActuator(stateMachine);
            return(room);
        }
        public static IArea WithRollerShutterButtons(this IArea room, Enum id, IBinaryInput upInput, IBinaryInput downInput)
        {
            if (room == null)
            {
                throw new ArgumentNullException(nameof(room));
            }
            if (upInput == null)
            {
                throw new ArgumentNullException(nameof(upInput));
            }
            if (downInput == null)
            {
                throw new ArgumentNullException(nameof(downInput));
            }

            var rollerShutterButtons = new RollerShutterButtons(ActuatorIdFactory.Create(room, id), upInput, downInput,
                                                                room.Controller.HttpApiController, room.Controller.Logger, room.Controller.Timer);

            room.AddActuator(rollerShutterButtons);
            return(room);
        }
Exemplo n.º 9
0
        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);
        }