Пример #1
0
CFileUpLoad::~CFileUpLoad(void)
{
	UnInit();
	std::string strLog = "CFileUpLoad exit.";
	g_pLogger->information(strLog);
	TRACE(strLog.c_str());
#ifndef TEST_MULTI_SENDER
	g_eFileUpLoadThreadExit.set();
#endif
}
Пример #2
0
// Shutdown Live Tracker
void LiveTrackerShutdown()
{
  if (_Thread.isRunning()) {
    _t_end = false;
    _t_run = false;
    NewDataEvent.set();
    _Thread.join();
    StartupStore(TEXT(". LiveTracker closed.%s"),NEWLINE);
  }
#ifdef WIN32
  if (_ws_inited) {
    WSACleanup();
  }
#endif
}
Пример #3
0
// Update live tracker data, non blocking
void LiveTrackerUpdate(NMEA_INFO *Basic, DERIVED_INFO *Calculated)
{
  if (!_inited) return;               // Do nothing if not inited
  if (LiveTrackerInterval==0) return; // Disabled
  if (Basic->NAVWarning) return;      // Do not log if no gps fix

  livetracker_point_t newpoint;
  static int logtime = 0;

  
  ScopeLock guard(_t_mutex);

  //Check if sending needed (time interval)
  if (Basic->Time >= logtime) { 
    logtime = (int)Basic->Time + LiveTrackerInterval;
    if (logtime>=86400) logtime-=86400;
  } else return;

  // Half hour FIFO must be enough
  if (_t_points.size() > (unsigned int)(1800 / LiveTrackerInterval)) {
    // points in queue are full, drop oldest point 
    _t_points.pop_front();
  }
  
  struct tm t;
  time_t t_of_day;
  t.tm_year = Basic->Year - 1900;
  t.tm_mon = Basic->Month - 1; // Month, 0 - jan
  t.tm_mday = Basic->Day;
  t.tm_hour = Basic->Hour;
  t.tm_min = Basic->Minute;
  t.tm_sec = Basic->Second;
  t.tm_isdst = 0; // Is DST on? 1 = yes, 0 = no, -1 = unknown
  t_of_day = mkgmtime(&t);
  
  newpoint.unix_timestamp = t_of_day;
  newpoint.flying = Calculated->Flying;
  newpoint.latitude = Basic->Latitude;
  newpoint.longitude = Basic->Longitude;
  newpoint.alt = Calculated->NavAltitude;
  newpoint.ground_speed = Basic->Speed;
  newpoint.course_over_ground = Calculated->Heading;
  
  _t_points.push_back(newpoint);
  NewDataEvent.set();
}