Exemplo n.º 1
0
        public void SetAlarmMode(bool mode, ActionScopes scope)
        {
            if (mode)
            {
                if (state.DeviceAlarmMode == DeviceAlarmModes.Off)
                {
                    if (scope == ActionScopes.Home)
                    {
                        // turn alarm on activating mode, asume owners at home.
                        state.DeviceAlarmMode = DeviceAlarmModes.Activating;
                        state.OwnersHome      = true;
                        timeActivatedAlarm    = DateTime.Now.TimeOfDay;
                    }
                    else
                    {
                        // asume owners not at home.
                        state.DeviceAlarmMode = DeviceAlarmModes.On;
                        state.OwnersHome      = false;
                        timeAlarmIsOn         = DateTime.Now.TimeOfDay;
                    }
                }
            }
            else
            {
                if (state.DeviceAlarmMode != DeviceAlarmModes.Off)
                {
                    state.DeviceAlarmMode = DeviceAlarmModes.Off;
                    state.AlarmMode       = AlarmModes.Off;
                    state.Lighting        = preAlarmLightingState;
                }
            }

            Update();
        }
Exemplo n.º 2
0
 public void SetAlarmMode(bool mode, ActionScopes scope)
 {
     controller.SetAlarmMode(mode, scope);
 }