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

Definition at line 1926 of file smartfact.cc.

References data, EventImp::GetJavaDate(), PFmini::Data::hum, HTML::kGreen, EventImp::Ref(), and PFmini::Data::temp.

Referenced by StateMachineSmartFACT().

1927  {
1928  if (!CheckDataSize(d, "PfMini:Data", sizeof(PFmini::Data)))
1929  return GetCurrentState();
1930 
1931  const PFmini::Data &data = d.Ref<PFmini::Data>();
1932 
1933  ostringstream out;
1934 
1935  out << fixed << setprecision(1);
1936  out << d.GetJavaDate() << '\n';
1937 
1938  out << HTML::kGreen << '\t' << data.temp << '\n';
1939  out << HTML::kGreen << '\t' << data.hum << '\n';
1940 
1941  ofstream(fPath+"/pfmini.data") << out.str();
1942 
1943  fPfMiniTemperatureHist.push_back(data.temp);
1944  if (fPfMiniTemperatureHist.size()>60*4) // 1h
1945  fPfMiniTemperatureHist.pop_front();
1946 
1947  fPfMiniHumidityHist.push_back(data.hum);
1948  if (fPfMiniHumidityHist.size()>60*4) // 1h
1949  fPfMiniHumidityHist.pop_front();
1950 
1951  WriteHist(d, "hist-pfmini-temp",
1952  fPfMiniTemperatureHist, 45, 0);
1953 
1954  WriteHist(d, "hist-pfmini-hum",
1955  fPfMiniHumidityHist, 100, 0);
1956 
1957  return GetCurrentState();
1958  }
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
deque< float > fPfMiniHumidityHist
Definition: smartfact.cc:557
void WriteHist(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
Definition: smartfact.cc:752
uint64_t GetJavaDate() const
Definition: EventImp.cc:303
static const string kGreen
Definition: smartfact.cc:77
float data[4 *1440]
deque< float > fPfMiniTemperatureHist
Definition: smartfact.cc:558
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: