/// <summary> /// Method run on timeOutTimer elapse event. /// Used to reset FixationDetection back to its initial waiting state if a user does not successfully fixate on the screen before the time specified by FixationTimeOutLength. /// it also signals to the State manager that con fixation completed by raising the SystemFlags.timeOut flag. /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void fixationTimeOut(object o, ElapsedEventArgs e) { customfixStream.ResetFixationDetectionState(); fixationTimer.Stop(); SystemFlags.timeOut = true; fixationState = EFixationState.WaitingForFixationRequest; }
/// <summary> /// Reset Fixation detection to waiting state and raise flag with state manager that the fixation detection has competed, once a fixation stream runs from a start state /// without being interrupted by a end state before the fixation timer completes. This is run by the FixationTomer elapsed event. /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void runActionWhenTimerReachesLimit(object o, ElapsedEventArgs e) { timeOutTimer.Stop(); //Once the fixation has run, set the state of fixation detection back to waiting. fixationState = EFixationState.WaitingForFixationRequest; SystemFlags.gaze = true; //Debug Console.WriteLine("Timer reached event, running required action"); }
/// <summary> //This method has the Action that will be run once a fixation is confirmed passed in and stored in SelectedFicationAction. It also sets the state to RunningFixationDetection, //which sets logic in RunSelectedActionAtFixation to run on fixationPointDataStream.Next events. /// </summary> public void StartDetectingFixation() { customfixStream.ResetFixationDetectionState(); pointSmootherWorker = new PointSmoother(pointSmootherBufferSize); Console.WriteLine("Start detection call"); fixationState = EFixationState.DetectingFixation; timeOutTimer.Start(); }