FACT++  1.0
int StateMachineSmartFACT::HandleGpsNema ( const EventImp d)
inlineprivate

Definition at line 1960 of file smartfact.cc.

References GPS::NEMA::count, GPS::NEMA::geosep, Time::GetAsStr(), EventImp::GetJavaDate(), GPS::NEMA::hdop, GPS::NEMA::height, HTML::kGreen, HTML::kRed, HTML::kWhite, GPS::NEMA::lat, GPS::NEMA::lng, GPS::NEMA::qos, EventImp::Ref(), and GPS::NEMA::time.

Referenced by StateMachineSmartFACT().

1961  {
1962  if (!CheckDataSize(d, "GpsControl:Nema", sizeof(GPS::NEMA)))
1963  return GetCurrentState();
1964 
1965  const GPS::NEMA &nema = d.Ref<GPS::NEMA>();
1966 
1967  ostringstream out;
1968 
1969  out << fixed;
1970  out << d.GetJavaDate() << '\n';
1971 
1972  switch (nema.qos)
1973  {
1974  case 1: out << HTML::kGreen << "\tGPS fix [1]\n"; break;
1975  case 2: out << HTML::kGreen << "\tDifferential fix [2]\n"; break;
1976  default: out << HTML::kRed << "\tinvalid [" << nema.qos << "]\n"; break;
1977  }
1978 
1979  out << HTML::kWhite << '\t' << nema.count << '\n';
1980  out << HTML::kWhite << '\t' << Time(floor(Time().Mjd())+nema.time).GetAsStr("%H:%M:%S") << '\n';
1981  out << HTML::kWhite << '\t' << setprecision(4) << nema.lat << '\n';
1982  out << HTML::kWhite << '\t' << setprecision(4) << nema.lng << '\n';
1983  out << HTML::kWhite << '\t' << setprecision(1) << nema.height << "\n";
1984  out << HTML::kWhite << '\t' << setprecision(1) << nema.hdop << "\n";
1985  out << HTML::kWhite << '\t' << setprecision(1) << nema.geosep << "\n";
1986 
1987  ofstream(fPath+"/gps.data") << out.str();
1988 
1989  return GetCurrentState();
1990  }
int GetCurrentState() const
return the current state of the machine
bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false)
Definition: smartfact.cc:669
float hdop
Definition: HeadersGPS.h:23
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
float time
Definition: HeadersGPS.h:20
float lng
Definition: HeadersGPS.h:22
static const string kWhite
Definition: smartfact.cc:74
float height
Definition: HeadersGPS.h:24
uint16_t qos
Definition: HeadersGPS.h:27
uint64_t GetJavaDate() const
Definition: EventImp.cc:303
float lat
Definition: HeadersGPS.h:21
static const string kGreen
Definition: smartfact.cc:77
float geosep
Definition: HeadersGPS.h:25
static const string kRed
Definition: smartfact.cc:76
std::string GetAsStr(const char *fmt="%Y-%m-%d %H:%M:%S") const
Definition: Time.cc:240
uint16_t count
Definition: HeadersGPS.h:26
const T & Ref(size_t offset=0) const
Definition: EventImp.h:82

+ Here is the call graph for this function:

+ Here is the caller graph for this function: