Exemple #1
0
        private void Stop()
        {
            var oldState = GetState();

            _adapter.SetState(AdapterRollerShutterState.Stop);

            _powerState          = PowerStateValue.Off;
            _verticalMovingState = VerticalMovingStateValue.Stopped;
            _autoOffTimeout.Stop();

            OnStateChanged(oldState);
        }
Exemple #2
0
        private void MoveDown()
        {
            var oldState = GetState();

            _adapter.SetState(AdapterRollerShutterState.MoveDown);

            _powerState          = PowerStateValue.On;
            _verticalMovingState = VerticalMovingStateValue.MovingDown;
            _autoOffTimeout.Start(Settings.AutoOffTimeout);

            OnStateChanged(oldState);
        }
Exemple #3
0
        private void MoveUp(bool forceUpdate = false)
        {
            var oldState = GetState();

            if (forceUpdate)
            {
                _adapter.SetState(AdapterRollerShutterState.MoveUp, HardwareParameter.ForceUpdateState);
            }
            else
            {
                _adapter.SetState(AdapterRollerShutterState.MoveUp);
            }

            _powerState          = PowerStateValue.On;
            _verticalMovingState = VerticalMovingStateValue.MovingUp;
            _autoOffTimeout.Start(Settings.AutoOffTimeout);

            OnStateChanged(oldState);
        }
 private static void HandleBlindButtonPressedEvent(IRollerShutter rollerShutter, VerticalMovingStateValue verticalMovingState)
 {
     if (verticalMovingState == VerticalMovingStateValue.MovingUp && rollerShutter.GetState().Has(VerticalMovingState.MovingUp))
     {
         rollerShutter.ExecuteCommand(new TurnOffCommand());
     }
     else if (verticalMovingState == VerticalMovingStateValue.MovingDown && rollerShutter.GetState().Has(VerticalMovingState.MovingDown))
     {
         rollerShutter.ExecuteCommand(new TurnOffCommand());
     }
     else if (verticalMovingState == VerticalMovingStateValue.MovingDown)
     {
         rollerShutter.ExecuteCommand(new MoveDownCommand());
     }
     else if (verticalMovingState == VerticalMovingStateValue.MovingUp)
     {
         rollerShutter.ExecuteCommand(new MoveUpCommand());
     }
     else
     {
         throw new InvalidOperationException();
     }
 }