Пример #1
0
 public MenuService(ILogger <MenuService> log, CommandService commandService,
                    PoolStatusStore store)
 {
     _log            = log;
     _commandService = commandService;
     _store          = store;
 }
Пример #2
0
 public SettingService(ILogger <SettingService> log, MenuService menuService, PoolStatusStore status,
                       CommandService commandService)
 {
     _log            = log;
     _menuService    = menuService;
     _status         = status;
     _commandService = commandService;
 }
Пример #3
0
 protected override Key NextKey(PoolStatusStore state)
 {
     if (state.CurrentMenu.Current?.Menu?.Name?.Equals(ToSelect.Menu.Name) != true)
     {
         return(Key.MENU);
     }
     return(Key.RIGHT);
 }
Пример #4
0
 public SwitchService(ILogger <SwitchService> log, IEnumerable <Switch> buttons,
                      PoolStatusStore status, CommandService commandService)
 {
     _log            = log;
     _status         = status;
     _commandService = commandService;
     _buttons        = buttons;
 }
Пример #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;
 }
Пример #6
0
        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);
        }
Пример #7
0
 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;
 }
Пример #10
0
        protected override bool IsComplete(PoolStatusStore state)
        {
            var current = state.ToggledSwitches.Contains(Switch);

            return(current == Value);
        }
Пример #11
0
 protected abstract Key NextKey(PoolStatusStore state);
Пример #12
0
 protected abstract bool IsComplete(PoolStatusStore state);
Пример #13
0
 public SensorService(ILogger <SensorService> log, IEnumerable <Sensor> sensors, PoolStatusStore status)
 {
     _log     = log;
     _status  = status;
     _sensors = sensors;
 }
Пример #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;
Пример #15
0
 protected override bool IsComplete(PoolStatusStore state) =>
 base.IsComplete(state) && CurrentValue(state) == Value;
Пример #16
0
 protected override bool IsComplete(PoolStatusStore state) =>
 state.CurrentMenu.Current == ToSelect;