public RollerShutter( string id, IBinaryOutput powerOutput, IBinaryOutput directionOutput, TimeSpan autoOffTimeout, int maxPosition, IHttpRequestController httpApiController, INotificationHandler notificationHandler, IHomeAutomationTimer timer) : base(id, httpApiController, notificationHandler) { if (id == null) throw new ArgumentNullException(nameof(id)); if (powerOutput == null) throw new ArgumentNullException(nameof(powerOutput)); if (directionOutput == null) throw new ArgumentNullException(nameof(directionOutput)); _powerGpioPin = powerOutput; _directionGpioPin = directionOutput; _autoOffTimeout = autoOffTimeout; _positionMax = maxPosition; _timer = timer; //TODO: StartMoveUp(); timer.Tick += (s, e) => UpdatePosition(e); }
public LogicalBinaryOutput WithOutput(IBinaryOutput output) { if (output == null) throw new ArgumentNullException(nameof(output)); _outputs.Add(output); return this; }
public HealthService( ControllerOptions controllerOptions, IPi2GpioService pi2GpioService, ITimerService timerService, ISystemInformationService systemInformationService) { if (controllerOptions == null) { throw new ArgumentNullException(nameof(controllerOptions)); } if (timerService == null) { throw new ArgumentNullException(nameof(timerService)); } if (systemInformationService == null) { throw new ArgumentNullException(nameof(systemInformationService)); } _systemInformationService = systemInformationService; if (controllerOptions.StatusLedNumber.HasValue) { _led = pi2GpioService.GetOutput(controllerOptions.StatusLedNumber.Value); _ledTimeout.Start(TimeSpan.FromMilliseconds(1)); } timerService.Tick += Tick; }
public BinaryOutputWithState(IBinaryOutput output, BinaryState state) { if (output == null) throw new ArgumentNullException(nameof(output)); Output = output; State = state; }
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 RollerShutter( ActuatorId id, IBinaryOutput powerOutput, IBinaryOutput directionOutput, IHttpRequestController httpApiController, ILogger logger, IHomeAutomationTimer timer) : base(id, httpApiController, logger) { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (powerOutput == null) { throw new ArgumentNullException(nameof(powerOutput)); } if (directionOutput == null) { throw new ArgumentNullException(nameof(directionOutput)); } _powerGpioPin = powerOutput; _directionGpioPin = directionOutput; _timer = timer; timer.Tick += (s, e) => UpdatePosition(e); base.Settings = new RollerShutterSettings(id, logger); }
public StateMachineState WithPort(IBinaryOutput output, BinaryState state) { if (output == null) throw new ArgumentNullException(nameof(output)); _outputs.Add(new Tuple<IBinaryOutput, BinaryState>(output, state)); return this; }
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 BinaryStateOutputActuator(string id, IBinaryOutput output, IHttpRequestController httpRequestController, INotificationHandler notificationHandler) : base(id, httpRequestController, notificationHandler) { if (output == null) throw new ArgumentNullException(nameof(output)); _output = output; SetStateInternal(BinaryActuatorState.Off, new ForceUpdateStateParameter()); }
private IComponent ParseCustomBinaryStateOutputActuator(XElement element) { IBinaryOutput output = Parser.ParseBinaryOutput(element.GetMandatorySingleChildElementOrFromContainer("Output")); return(new CustomBinaryStateActuator( new ComponentId(element.GetMandatoryStringFromAttribute("id")), new PortBasedBinaryStateEndpoint(output))); }
public PortBasedRollerShutterEndpoint(IBinaryOutput powerOutput, IBinaryOutput directionOutput) { if (powerOutput == null) throw new ArgumentNullException(nameof(powerOutput)); if (directionOutput == null) throw new ArgumentNullException(nameof(directionOutput)); _powerOutput = powerOutput; _directionOutput = directionOutput; }
public StateMachineState WithHighOutput(IBinaryOutput output) { if (output == null) { throw new ArgumentNullException(nameof(output)); } return(WithOutput(output, BinaryState.High)); }
public PortBasedBinaryStateEndpoint(IBinaryOutput output) { if (output == null) { throw new ArgumentNullException(nameof(output)); } _output = output; }
/// <summary> /// Default ctor /// </summary> public BinaryOutputItem(IBinaryOutput entity, IBinaryOutputState state, ItemContext context, bool interactive) : base(entity, false, context) { this.state = state; if (interactive) { MouseHandler = new ClickHandler(null, state); } }
public static IBinaryOutput WithInvertedState(this IBinaryOutput binaryOutput) { if (binaryOutput == null) { throw new ArgumentNullException(nameof(binaryOutput)); } return(new InvertedBinarOutput(binaryOutput)); }
public BinaryOutputWithState(IBinaryOutput output, BinaryState state) { if (output == null) { throw new ArgumentNullException(nameof(output)); } Output = output; State = state; }
public ISocket RegisterSocket(IArea area, Enum id, IBinaryOutput output) { if (area == null) throw new ArgumentNullException(nameof(area)); if (output == null) throw new ArgumentNullException(nameof(output)); var socket = new Socket(ComponentIdGenerator.Generate(area.Id, id), new PortBasedBinaryStateEndpoint(output)); area.AddComponent(socket); return socket; }
protected BinaryStateOutputActuator(ActuatorId id, IBinaryOutput output, IHttpRequestController httpApiController, ILogger logger) : base(id, httpApiController, logger) { if (output == null) { throw new ArgumentNullException(nameof(output)); } _output = output; }
private IActuator ParseCustomBinaryStateOutputActuator(XElement element) { IBinaryOutput output = Parser.ParseBinaryOutput(element.GetMandatorySingleChildElementOrFromContainer("Output")); return(new CustomBinaryStateOutputActuator( new ActuatorId(element.GetMandatoryStringFromAttribute("id")), output, Controller.HttpApiController, Controller.Logger)); }
public ILamp RegisterLamp(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(ComponentIdGenerator.Generate(area.Id, id), new PortBasedBinaryStateEndpoint(output)); area.AddComponent(lamp); return lamp; }
private IComponent ParseRollerShutter(XElement element) { IBinaryOutput powerOutput = Parser.ParseBinaryOutput(element.GetMandatorySingleChildFromContainer("Power")); IBinaryOutput directionOutput = Parser.ParseBinaryOutput(element.GetMandatorySingleChildFromContainer("Direction")); return(new RollerShutter( new ComponentId(element.GetMandatoryStringFromAttribute("id")), new PortBasedRollerShutterEndpoint(powerOutput, directionOutput), Controller.Timer)); }
public StateMachineState WithOutput(IBinaryOutput output, BinaryState state) { if (output == null) { throw new ArgumentNullException(nameof(output)); } _pendingBinaryOutputStates.Add(new Tuple <IBinaryOutput, BinaryState>(output, state)); return(this); }
public LogicalBinaryOutput WithOutput(IBinaryOutput output) { if (output == null) { throw new ArgumentNullException(nameof(output)); } _outputs.Add(output); return(this); }
public StateMachineState WithBinaryOutput(IBinaryOutput output, BinaryState state) { if (output == null) { throw new ArgumentNullException(nameof(output)); } _binaryOutputs.Add(new PendingBinaryOutputState { BinaryOutput = output, State = state }); return(this); }
private void InitializeHealthMonitor() { IBinaryOutput ledPin = null; if (_statusLedNumber.HasValue) { var pi2PortController = new Pi2PortController(); ledPin = pi2PortController.GetOutput(_statusLedNumber.Value); } ServiceLocator.RegisterService(typeof(HealthService), new HealthService(ledPin, Timer, ServiceLocator.GetService <ISystemInformationService>())); }
private IActuator ParseRollerShutter(XElement element) { IBinaryOutput powerOutput = Parser.ParseBinaryOutput(element.GetMandatorySingleChildFromContainer("Power")); IBinaryOutput directionOutput = Parser.ParseBinaryOutput(element.GetMandatorySingleChildFromContainer("Direction")); return(new RollerShutter( new ActuatorId(element.GetMandatoryStringFromAttribute("id")), powerOutput, directionOutput, Controller.HttpApiController, Controller.Logger, Controller.Timer)); }
public ILamp RegisterLamp(IArea area, Enum id, IBinaryOutput output) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } return(RegisterLamp(area, id, new PortBasedBinaryOutputAdapter(output))); }
public PortBasedRollerShutterEndpoint(IBinaryOutput powerOutput, IBinaryOutput directionOutput) { if (powerOutput == null) { throw new ArgumentNullException(nameof(powerOutput)); } if (directionOutput == null) { throw new ArgumentNullException(nameof(directionOutput)); } _powerOutput = powerOutput; _directionOutput = directionOutput; }
private void SetupHumidityDependingOutput(IHumiditySensor sensor, IBinaryOutput output) { sensor.ValueChanged += (s, e) => { if (e.NewValue > 80.0F) { output.Write(BinaryState.High); } else { output.Write(BinaryState.Low); } }; }
public ILamp RegisterLamp(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(ComponentIdGenerator.Generate(area.Id, id), new PortBasedBinaryStateEndpoint(output)); area.AddComponent(lamp); return(lamp); }
public ISocket RegisterSocket(IArea area, Enum id, IBinaryOutput output) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } var socket = new Socket($"{area.Id}.{id}", new PortBasedBinaryOutputAdapter(output)); area.RegisterComponent(socket); return(socket); }
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 ISocket RegisterSocket(IArea area, Enum id, IBinaryOutput output) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (output == null) { throw new ArgumentNullException(nameof(output)); } var socket = new Socket(ComponentIdGenerator.Generate(area.Id, id), new PortBasedBinaryStateEndpoint(output)); area.AddComponent(socket); return(socket); }
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 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 HealthService( ControllerOptions controllerOptions, IPi2GpioService pi2GpioService, ITimerService timerService, ISystemInformationService systemInformationService) { if (controllerOptions == null) throw new ArgumentNullException(nameof(controllerOptions)); if (timerService == null) throw new ArgumentNullException(nameof(timerService)); if (systemInformationService == null) throw new ArgumentNullException(nameof(systemInformationService)); _systemInformationService = systemInformationService; if (controllerOptions.StatusLedNumber.HasValue) { _led = pi2GpioService.GetOutput(controllerOptions.StatusLedNumber.Value); _ledTimeout.Start(TimeSpan.FromMilliseconds(1)); } timerService.Tick += Tick; }
public HealthService(IBinaryOutput statusLed, IHomeAutomationTimer timer, ISystemInformationService systemInformationService) { if (timer == null) { throw new ArgumentNullException(nameof(timer)); } if (systemInformationService == null) { throw new ArgumentNullException(nameof(systemInformationService)); } _statusLed = statusLed; _systemInformationService = systemInformationService; if (statusLed != null) { _ledTimeout.Start(TimeSpan.FromMilliseconds(1)); } timer.Tick += Tick; }
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); }
public HealthMonitor(IBinaryOutput statusLed, IHomeAutomationTimer timer, IApiController apiController) { if (timer == null) { throw new ArgumentNullException(nameof(timer)); } if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } _statusLed = statusLed; _timer = timer; _startedDate = _timer.CurrentDateTime; if (statusLed != null) { _ledTimeout.Start(TimeSpan.FromMilliseconds(1)); } timer.Tick += Tick; apiController.RouteRequest("health", HandleApiGet); apiController.RouteCommand("health/reset", c => ResetStatistics()); }
public StateMachineState WithLowPort(IBinaryOutput output) { return WithPort(output, BinaryState.Low); }
public StateMachineState WithHighPort(IBinaryOutput output) { return WithPort(output, BinaryState.High); }
public StateMachineState WithLowOutput(IBinaryOutput output) { if (output == null) throw new ArgumentNullException(nameof(output)); return WithOutput(output, BinaryState.Low); }
public Lamp(string id, IBinaryOutput output, IHttpRequestController httpRequestController, INotificationHandler notificationHandler) : base(id, output, httpRequestController, notificationHandler) { }
public PortBasedBinaryStateEndpoint(IBinaryOutput output) { if (output == null) throw new ArgumentNullException(nameof(output)); _output = output; }