Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions
GpsDaemonApplication Class Reference

Brief description of class still missing. More...

#include <GpsDaemonApplication.h>

Inheritance diagram for GpsDaemonApplication:
GpCoreTools::DaemonApplication GpCoreTools::CoreApplication

List of all members.

Public Member Functions

virtual void close ()
 GpsDaemonApplication (int &argc, char **argv, ApplicationHelp *(*help)(), bool reportBugs=true)

Static Public Member Functions

static UbxDevicegpsThread ()
static PPSDeviceppsThread ()
static void setGPSThread (UbxDevice *s)
static void setPPSThread (PPSDevice *s)

Protected Member Functions

virtual void installInterruptSignals ()
virtual void parentProcessWait ()

Static Protected Member Functions

static void childInterrupted (int signum)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

GpsDaemonApplication::GpsDaemonApplication ( int &  argc,
char **  argv,
ApplicationHelp *(*)()  help,
bool  reportBugs = true 
)

Description of constructor still missing

  : DaemonApplication(argc, argv, help, reportBugs)
{
  _gpsThread=0;
  _ppsThread=0;
}

Member Function Documentation

void GpsDaemonApplication::childInterrupted ( int  signum) [static, protected]

Reimplemented from GpCoreTools::DaemonApplication.

References GpCoreTools::PThread::stop().

Referenced by installInterruptSignals().

{
  // Do not use TRACE here because it uses a mutex which can be locked while this function
  // is called inside a signal exception.
  if(_gpsThread) {
    _gpsThread->stop();
  }
  if(_ppsThread) {
    _ppsThread->stop();
  }
  DaemonApplication::childInterrupted(signum);
}
void GpsDaemonApplication::close ( ) [virtual]

Description of destructor still missing

Reimplemented from GpCoreTools::DaemonApplication.

References GpCoreTools::PThread::wait().

Referenced by main().

{
  if(_gpsThread) {
    _gpsThread->wait();
    delete _gpsThread;
    _gpsThread=0;
  }
  if(_ppsThread) {
    _ppsThread->wait();
    delete _ppsThread;
    _ppsThread=0;
  }
  DaemonApplication::close();
}
static UbxDevice* GpsDaemonApplication::gpsThread ( ) [inline, static]

Referenced by main().

{return _gpsThread;}
void GpsDaemonApplication::installInterruptSignals ( ) [protected, virtual]

Reimplemented from GpCoreTools::DaemonApplication.

References childInterrupted().

{
  signal(SIGTERM, childInterrupted);
  signal(SIGINT, childInterrupted);
}
void GpsDaemonApplication::parentProcessWait ( ) [protected, virtual]

Reimplemented from GpCoreTools::DaemonApplication.

References GpCoreTools::CoreApplication::exit().

{
  struct stat sInfo;
  remove("/tmp/system_clock_set");
  Leds::timer(0, 1000, 1000);
  printf("\nWaiting for time: ");
  fflush(stdout);
  int i=2;
  int sErr;
  do {
    sleep(2);
    if(i%10==0) {
      printf(":");
    } else {
      printf(".");
    }
    i+=2;
    fflush(stdout);
    sErr=stat("/var/run/warangpsd.pid", &sInfo);
    if(sErr!=0) { // Pid file for child process removed, stop waiting.
      sErr=stat("/tmp/system_clock_set", &sInfo);
      if(sErr==0) {
        break;
      } else {
        printf("\n");
        exit(2); // finished without getting correct time
      }
    }
    sErr=stat("/tmp/system_clock_set", &sInfo);
  } while(sErr!=0);
  printf("\n");
  Leds::power(0, true);
}
static PPSDevice* GpsDaemonApplication::ppsThread ( ) [inline, static]

Referenced by main().

{return _ppsThread;}
static void GpsDaemonApplication::setGPSThread ( UbxDevice s) [inline, static]

Referenced by main().

{_gpsThread=s;}
static void GpsDaemonApplication::setPPSThread ( PPSDevice s) [inline, static]

Referenced by main().

{_ppsThread=s;}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines