FACT++  1.0
void ConnectionInterlock::ProcessAnswer ( )
inlineprivate

Definition at line 54 of file pwrctrl.cc.

References i, Power::Status::Print(), and Power::Status::Set().

55  {
56  if (fDebugRx)
57  {
58  Out() << "------------------------------------------------------" << endl;
59  Out() << fRdfData << endl;
60  Out() << "------------------------------------------------------" << endl;
61  }
62 
63  const size_t p1 = fRdfData.find("\r\n\r\n");
64  if (p1==string::npos)
65  {
66  Warn("HTTP header not found.");
67  PostClose(false);
68  return;
69  }
70 
71  fRdfData.erase(0, p1+4);
72  fRdfData.insert(0, "<?xml version=\"1.0\"?>\n");
73 
74  QDomDocument doc;
75  if (!doc.setContent(QString(fRdfData.c_str()), false))
76  {
77  Warn("Parsing of html failed.");
78  PostClose(false);
79  return;
80  }
81 
82  if (fDebugRx)
83  Out() << "Parsed:\n-------\n" << doc.toString().toStdString() << endl;
84 
85  const QDomNodeList imageElems = doc.elementsByTagName("span");
86 
87  for (unsigned int i=0; i<imageElems.length(); i++)
88  {
89  const QDomElement e = imageElems.item(i).toElement();
90 
91  const QDomNamedNodeMap att = e.attributes();
92 
93  if (fStatus.Set(att))
94  fIsValid = true;
95  }
96 
97  if (fIsVerbose)
98  fStatus.Print(Out());
99 
100  Update(fStatus);
101 
102  fRdfData = "";
103 
104  fLastReport = Time();
105  PostClose(false);
106  }
void Print(std::ostream &out, const char *title, const bool &val, const char *t="enabled", const char *f="disabled")
Definition: HeadersPower.cc:56
int i
Definition: db_dim_client.c:21
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
Power::Status fStatus
Definition: pwrctrl.cc:47
bool Set(bool &rc, const QString &value)
Definition: HeadersPower.cc:15
virtual void Update(const Power::Status &)
Definition: pwrctrl.cc:49

+ Here is the call graph for this function: