public MenuService(ILogger <MenuService> log, CommandService commandService, PoolStatusStore store) { _log = log; _commandService = commandService; _store = store; }
public SettingService(ILogger <SettingService> log, MenuService menuService, PoolStatusStore status, CommandService commandService) { _log = log; _menuService = menuService; _status = status; _commandService = commandService; }
protected override Key NextKey(PoolStatusStore state) { if (state.CurrentMenu.Current?.Menu?.Name?.Equals(ToSelect.Menu.Name) != true) { return(Key.MENU); } return(Key.RIGHT); }
public SwitchService(ILogger <SwitchService> log, IEnumerable <Switch> buttons, PoolStatusStore status, CommandService commandService) { _log = log; _status = status; _commandService = commandService; _buttons = buttons; }
public AquaLogicProtocolService(IAqualogicStream stream, PoolStatusStore store, ILogger <AquaLogicProtocolService> log, AqualogicMessageWriter writer, StatusUpdateService updateProcessor, CommandService commandService, SwitchService switchService) { _log = log; _updateProcessor = updateProcessor; _commandService = commandService; _stream = stream; }
protected override Key NextKey(PoolStatusStore state) { if (!base.IsComplete(state)) { return(base.NextKey(state)); } var value = CurrentValue(state); if (!value.HasValue) { return(Key.PLUS); } return(Value > value ? Key.PLUS : Key.MINUS); }
public bool HasNextKey(PoolStatusStore state, out Key key) { if (!Complete) { Complete = IsComplete(state); } if (Complete) { key = LastKey ?? Key.None; return(false); } LastKey = NextKey(state); key = LastKey ?? Key.None; return(key != Key.None); }
protected override Key NextKey(PoolStatusStore state) { if (!Enum.TryParse(typeof(Key), Switch.ToString(), true, out var k) || !(k is Key key)) { throw new ArgumentException($"Unable to find key corresponding to switch name {Switch}"); } state.PendingSwitches.AddOrUpdate(Switch, n => new SwitchValue() { Name = Switch, Value = Value, LastModified = DateTime.UtcNow }, (n, v) => { v.Value = Value; return(v); }); return(key); }
public StatusUpdateService( ILogger <StatusUpdateService> log, MenuService menuService, SensorService sensorService, SettingService settingService, SwitchService switchService, PoolStatusStore store) { _log = log; this._switchService = switchService; _processors = new IUpdateProcessor[] { menuService, sensorService, settingService }; _store = store; }
protected override bool IsComplete(PoolStatusStore state) { var current = state.ToggledSwitches.Contains(Switch); return(current == Value); }
protected abstract Key NextKey(PoolStatusStore state);
protected abstract bool IsComplete(PoolStatusStore state);
public SensorService(ILogger <SensorService> log, IEnumerable <Sensor> sensors, PoolStatusStore status) { _log = log; _status = status; _sensors = sensors; }
private int?CurrentValue(PoolStatusStore state) => state.Status.Settings.TryGetValue(_setting.Name, out var value) && Int32.TryParse(value.Value, out var intVal) ? intVal : null;
protected override bool IsComplete(PoolStatusStore state) => base.IsComplete(state) && CurrentValue(state) == Value;
protected override bool IsComplete(PoolStatusStore state) => state.CurrentMenu.Current == ToSelect;