Esempio n. 1
0
 public MenuService(ILogger <MenuService> log, CommandService commandService,
                    PoolStatusStore store)
 {
     _log            = log;
     _commandService = commandService;
     _store          = store;
 }
Esempio n. 2
0
 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);
 }
Esempio n. 4
0
 public SwitchService(ILogger <SwitchService> log, IEnumerable <Switch> buttons,
                      PoolStatusStore status, CommandService commandService)
 {
     _log            = log;
     _status         = status;
     _commandService = commandService;
     _buttons        = buttons;
 }
Esempio n. 5
0
 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);
        }
Esempio n. 11
0
 protected abstract Key NextKey(PoolStatusStore state);
Esempio n. 12
0
 protected abstract bool IsComplete(PoolStatusStore state);
Esempio n. 13
0
 public SensorService(ILogger <SensorService> log, IEnumerable <Sensor> sensors, PoolStatusStore status)
 {
     _log     = log;
     _status  = status;
     _sensors = sensors;
 }
Esempio n. 14
0
 private int?CurrentValue(PoolStatusStore state) =>
 state.Status.Settings.TryGetValue(_setting.Name, out var value) &&
 Int32.TryParse(value.Value, out var intVal) ? intVal : null;
Esempio n. 15
0
 protected override bool IsComplete(PoolStatusStore state) =>
 base.IsComplete(state) && CurrentValue(state) == Value;
Esempio n. 16
0
 protected override bool IsComplete(PoolStatusStore state) =>
 state.CurrentMenu.Current == ToSelect;