Example #1
0
bool
getVal(PropertyList& p, const ObjectURI& k, as_value& val, as_object& obj)
{
    if (Property* prop = p.getProperty(k)) {
        val = prop->getValue(obj);
        return true;
    }
    return false;
}
uHTTP::HTTP::StatusCode ControlPoint::httpRequestRecieved(HTTPRequest *httpReq) {
  if (Debug::isOn() == true)
    httpReq->print();
    
  // Thanks for Giordano Sassaroli <*****@*****.**> (09/08/03)
  if (httpReq->isNotifyRequest() == true) {
    NotifyRequest notifyReq(httpReq);
    string uuidBuf;
    const char *uuid = notifyReq.getSID(uuidBuf);
    long seq = notifyReq.getSEQ();
    PropertyList *props = notifyReq.getPropertyList();
    int propCnt = props->size();
    for (int n = 0; n < propCnt; n++) {
      Property *prop = props->getProperty(n);
      const char *varName = prop->getName();
      const char *varValue = prop->getValue();
      performEventListener(uuid, seq, varName, varValue);
    }
    return httpReq->returnOK();
  }
    
  return httpReq->returnBadRequest();
}