public void AddBackToQueue(WakeUp wakeup) { if (wakeup != null) { _wakeUpRequests.Enqueue(wakeup); } }
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); } } }
public WakeUp GetNextCallRequest() { if (_wakeUpRequests == null) { return(null); } if (_wakeUpRequests.Count == 0) { return(null); } _currentWakeUp = _wakeUpRequests.Dequeue(); return(_currentWakeUp); }