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

Definition at line 1475 of file smartfact.cc.

References EventImp::GetJavaDate(), i, HTML::kGreen, HTML::kRed, HTML::kWhite, HTML::kYellow, and EventImp::Ptr().

Referenced by StateMachineSmartFACT().

1476  {
1477  if (!CheckDataSize(d, "FadControl:Connections", 41))
1478  {
1479  //fStatusEventBuilderLabel->setText("Offline");
1480  return GetCurrentState();
1481  }
1482 
1483  string rc(40, '-'); // orange/red [45]
1484 
1485  const uint8_t *ptr = d.Ptr<uint8_t>();
1486 
1487  int c[4] = { '.', '.', '.', '.' };
1488 
1489  for (int i=0; i<40; i++)
1490  {
1491  const uint8_t stat1 = ptr[i]&3;
1492  const uint8_t stat2 = ptr[i]>>3;
1493 
1494  if (stat1==0 && stat2==0)
1495  rc[i] = '.'; // gray [46]
1496  else
1497  if (stat1>=2 && stat2==8)
1498  rc[i] = stat1==2?'+':'*'; // green [43] : check [42]
1499 
1500  if (rc[i]<c[i/10])
1501  c[i/10] = rc[i];
1502  }
1503 
1504  string col[4];
1505  for (int i=0; i<4; i++)
1506  switch (c[i])
1507  {
1508  case '.': col[i]=HTML::kWhite; break;
1509  case '-': col[i]=HTML::kRed; break;
1510  case '+': col[i]=HTML::kYellow; break;
1511  case '*': col[i]=HTML::kGreen; break;
1512  }
1513 
1514  ostringstream out;
1515  out << setprecision(3);
1516  out << d.GetJavaDate() << '\n';
1517  out << col[0] << '\t' << rc.substr( 0, 10) << '\n';
1518  out << col[1] << '\t' << rc.substr(10, 10) << '\n';
1519  out << col[2] << '\t' << rc.substr(20, 10) << '\n';
1520  out << col[3] << '\t' << rc.substr(30, 10) << '\n';
1521  ofstream(fPath+"/fad.data") << out.str();
1522 
1523  return GetCurrentState();
1524  }
int GetCurrentState() const
return the current state of the machine
static const string kYellow
Definition: smartfact.cc:75
bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false)
Definition: smartfact.cc:669
int i
Definition: db_dim_client.c:21
static const string kWhite
Definition: smartfact.cc:74
uint64_t GetJavaDate() const
Definition: EventImp.cc:303
static const string kGreen
Definition: smartfact.cc:77
static const string kRed
Definition: smartfact.cc:76
const T * Ptr(size_t offset=0) const
Definition: EventImp.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function: