Beispiel #1
0
 public void AddBackToQueue(WakeUp wakeup)
 {
     if (wakeup != null)
     {
         _wakeUpRequests.Enqueue(wakeup);
     }
 }
Beispiel #2
0
        public void ProcessWakeUpCalls()
        {
            WakeUp wakeup = null;

            while (true)
            {
                wakeup = _alarmSystem.GetNextCallRequest();
                if (wakeup == null)
                {
                    continue;
                }

                if (wakeup != null && wakeup.WakeUpTime.ToDateTimeFromEpoch() == DateTime.MinValue)
                {
                    continue;
                }

                if (Math.Abs(_alarmSystem.GetCurrentTime() - wakeup.WakeUpTime) <= 30)
                {
                    _alarmSystem.SendAlarmCall(wakeup.RoomNumber);
                }
                else
                {
                    _alarmSystem.AddBackToQueue(wakeup);
                }
            }
        }
Beispiel #3
0
        public WakeUp GetNextCallRequest()
        {
            if (_wakeUpRequests == null)
            {
                return(null);
            }

            if (_wakeUpRequests.Count == 0)
            {
                return(null);
            }

            _currentWakeUp = _wakeUpRequests.Dequeue();
            return(_currentWakeUp);
        }