Logo Search packages:      
Sourcecode: gaia version File versions  Download package

void * GPSLayer::StartEntityThread ( void *  pentity  )  [static, private]

Entry point for per-entity retrieval threads

Definition at line 45 of file GPSLayer.cc.

References GPSEntity::data, GPSEntity::datamutex, Timer::GetTime(), Timer::Instance(), GPSEntity::lastupdate, GPSData::latitude, GPSData::longitude, GPSSource::Poll(), and GPSEntity::source.

Referenced by AddEntity().

                                               {
      GPSEntity *e = (GPSEntity*)pentity;

      while(1) {
            GPSData     newdata;

            int res = e->source->Poll(&newdata);

            if (res) {
                  pthread_mutex_lock(&e->datamutex);
                  /* don't save point in save coordinates */
                  if (e->data.size() == 0 ||
                              fabs(e->data.back().longitude - newdata.longitude) > DATA_CONST_DIST ||
                              fabs(e->data.back().latitude - newdata.latitude) > DATA_CONST_DIST) {
                        e->data.push_back(newdata);
                  }
                  e->lastupdate = Timer::Instance()->GetTime();
                  pthread_mutex_unlock(&e->datamutex);
            }
      }

      return (void*)1;
}


Generated by  Doxygen 1.6.0   Back to index