示例#1
0
// ######################################################################
void EyeTrackerUDP::start2()
{
  Timer itsTimer; //our timout period
  
  //wait for a code from host before we move on
  LINFO("Waiting for a UDP packet to complete start "
        "(timeout after 60 seconds)");
  
  while(true)
    {
      if (checkForData()) 
        {
          LINFO("Recieved start signal from host");
          break;
        }
      
      if (itsTimer.getSecs() > 60.0) 
        {
          LINFO("Timed out after 60 seconds. Finishing start without start "
                "signal from host");
          break;
        }
    }
  clearEyeStatus();
}
示例#2
0
bool
FBGui::run()
{
//  GNASH_REPORT_FUNCTION;

#ifdef USE_TSLIB
    int ts_loop_count = 0;
#endif

    VirtualClock& timer = getClock();
    int delay = 0;
    
    // let the GUI recompute the x/y scale factors to best fit the whole screen
    resize_view(_validbounds.width(), _validbounds.height());

    float fps = getFPS();
    
    // FIXME: this value is arbitrary, and will make any movie with
    // less than 12 frames eat up more of the cpu. It should probably
    // be a much lower value, like 2.
    if (fps > 12) {
        delay = static_cast<int>(100000/fps);
    } else {
        // 10ms per heart beat
        delay = 10000;
    }
    // log_debug(_("Movie Frame Rate is %d, adjusting delay to %dms"), fps,
    //           _interval * delay);
    
    // This loops endlessly at the frame rate
    while (!terminate_request) {  
        // wait the "heartbeat" inteval. _interval is in milliseconds,
        // but gnashSleep() wants nanoseconds, so adjust by 1000.
        gnashSleep(_interval * 1000);
        // TODO: Do we need to check the real time slept or is it OK when we woke
        // up early because of some Linux signal sent to our process (and thus
        // "advance" faster than the "heartbeat" interval)? - Udo

#ifdef USE_TSLIB
        ts_loop_count++; //increase loopcount
#endif
        
        // check input devices
        checkForData();

        // advance movie  
        Gui::advance_movie(this);

        // check if we've reached a timeout
        if (_timeout && timer.elapsed() >= _timeout ) {
            break;
        }
    }

    return true;
}
示例#3
0
// ######################################################################
bool EyeTrackerUDP::isSaccade()
{
//if true, a call by another state checking function set the isSac
//state and we don't need to check again. Just flip the state and
//return true. If false, check to see if any data is available and
//then check our state again.
  if (isSac)
    {
      isSac = false;
      return true;
    }
  else
    {
      checkForData();
      if (isSac)
        {
          isSac = false;
          return true;
        } 
    }
  return false;
}
示例#4
0
// ######################################################################
void EyeTrackerUDP::clearEyeStatus()
{
  while (checkForData()) ; //gobble up any data that has been sent
  resetEyeFlags(); //set all of our eye status flags to false
}