예제 #1
0
파일: Overlay.php 프로젝트: cwcw/cms
 /**
  * Arm the internal timer
  *
  * @param integer $delay
  * @return boolean
  */
 protected function _armTimer($delay)
 {
     $this->_timer->reset();
     $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $delay));
     $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'deactivate'), 'options' => array('autoRemove' => 'before')));
     return $this->_timer->arm();
 }
예제 #2
0
파일: Decorator.php 프로젝트: cwcw/cms
 /**
  * Arm the timer
  *
  * @return void
  */
 protected function _armTimer()
 {
     $this->_timer->reset();
     $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $this->_ringDuration));
     $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'onTimeout'), 'options' => array('autoRemove' => 'before')));
     $this->_timer->arm();
 }
예제 #3
0
파일: Menu.php 프로젝트: cwcw/cms
 /**
  * Arms the menu timer
  *
  * @return boolean
  */
 protected function _armTimer()
 {
     $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'onMenuTimeout'), 'options' => array('autoRemove' => 'before')));
     $armed = $this->_timer->arm();
     if (!$armed) {
         $this->_timer->flushEventListeners();
     }
     return $armed;
 }
예제 #4
0
파일: Reader.php 프로젝트: cwcw/cms
 /**
  * Rearm the timer
  *
  * @return boolean
  */
 protected function _rearmTimer()
 {
     $delay = $this->_options[self::OPT_INTER_DIGIT_TIMEOUT];
     $this->_timer->setContextParams(array('timeoutType' => self::TIMEOUT_INTERDIGIT));
     if ($this->_timer->isArmed()) {
         return $this->_timer->rearm($delay);
     } else {
         $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $delay));
         $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'onTimeout'), 'options' => array('autoRemove' => 'before')));
         return $this->_timer->arm();
     }
 }
예제 #5
0
파일: Interval.php 프로젝트: cwcw/cms
 /**
  * Handle the TIMER_TIMEOUT event
  *
  * @param Streamwide_Engine_Events_Event $event
  * @return void
  */
 public function onTimeout(Streamwide_Engine_Events_Event $event)
 {
     $count = $this->_options[self::OPT_COUNT];
     if (null === $this->_currentCount) {
         $this->_currentCount = $count;
     }
     if (0 === $count || --$this->_currentCount > 0) {
         $this->_timeoutTimer->arm();
         $this->dispatchEvent(new Streamwide_Engine_Events_Event(Streamwide_Engine_Events_Event::STEP));
     } else {
         $this->stop();
     }
 }
예제 #6
0
파일: Detector.php 프로젝트: cwcw/cms
 /**
  * @param float|integer $detectionDuration
  * @param string $callback
  * @return boolean
  */
 protected function _armDetectionDurationTimer($detectionDuration, $callback = 'onTimeout')
 {
     if (isset($this->_timer) && $detectionDuration > 0) {
         $this->_timer->reset();
         $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $detectionDuration));
         $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, $callback), 'options' => array('autoRemove' => 'before')));
         $armed = $this->_timer->arm();
         if (!$armed) {
             $this->_timer->flushEventListeners();
             return false;
         }
     }
     return true;
 }
예제 #7
0
파일: Recorder.php 프로젝트: cwcw/cms
 /**
  * Handle the delaying of the RECORDER_STOPPED event (if it's the case). This is a workaround for a problem
  * in SW Engine where the recorded file is not immediately available after sending the RECORDSTOP signal
  *
  * @return void
  * @throws RuntimeException
  */
 protected function _delayRecorderStoppedEventDispatch()
 {
     $event = new Streamwide_Engine_Events_Event(Streamwide_Engine_Events_Event::STOPPED);
     $event->setParam('recordStartTime', $this->_recordingStartTime);
     $event->setParam('recordStopTime', $this->_recordingStopTime);
     $delay = $this->_options[self::OPT_RECORDER_STOPPED_EVENT_DISPATCH_DELAY];
     if (0 === $delay) {
         $this->dispatchEvent($event);
         return true;
     }
     if (null === $this->_timer) {
         throw new RuntimeException('Timer object not set');
     }
     $this->_timer->reset();
     $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $delay));
     $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'dispatchEvent'), 'args' => $event, 'options' => array('autoRemove' => 'before')));
     $armed = $this->_timer->arm();
     if (!$armed) {
         $this->_timer->flushEventListeners();
         return false;
     }
     return true;
 }
예제 #8
0
파일: Sender.php 프로젝트: cwcw/cms
 /**
  * Time the playing of the fax tone. When this timer expires we need to create the
  * fax environment manually (if it has not been created automatically for us)
  *
  * @return void
  */
 protected function _timeFaxTonePlaying()
 {
     $this->_timer->reset();
     $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => self::FAX_TONE_PLAY_TIMEOUT));
     $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'onFaxPlayingTimeout'), 'options' => array('autoRemove' => 'before')));
     $this->_timer->arm();
 }
예제 #9
0
파일: Forwarder.php 프로젝트: cwcw/cms
 /**
  * @return boolean
  */
 protected function _armTimer()
 {
     $listeningDelay = $this->_options[self::OPT_LISTENING_DELAY];
     if (isset($this->_timer) && $listeningDelay > 0) {
         $this->_timer->reset();
         $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $listeningDelay));
         $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'onListeningTimeout'), 'options' => array('autoRemove' => 'before')));
         if (!$this->_timer->arm()) {
             $this->_timer->reset();
             $this->dispatchErrorEvent(self::TIMER_ARM_ERR_CODE);
             return false;
         }
     }
     return true;
 }