Ejemplo n.º 1
0
/*
 * Callback for m_client.FetchDmx called by GetDmx
 * @param response the HTTPResponse
 * @param buffer the DmxBuffer
 * @param error Error message
 */
void OladHTTPServer::HandleGetDmx(HTTPResponse *response,
                                 const DmxBuffer &buffer,
                                 const string &error) {
  // rather than adding 512 JsonValue we cheat and use raw here
  stringstream str;
  str << "[" << buffer.ToString() << "]";
  JsonObject json;
  json.AddRaw("dmx", str.str());
  json.Add("error", error);

  response->SetNoCache();
  response->SetContentType(HTTPServer::CONTENT_TYPE_PLAIN);
  response->SendJson(json);
  delete response;
}
Ejemplo n.º 2
0
void OladHTTPServer::HandleGetIntensity(HTTPResponse *response,
                                  const client::Result &result,
                                  const client::DMXMetadata &,
                                  const DmxBuffer &buffer) {
  // rather than adding 512 JsonValue we cheat and use raw here
  ostringstream str;
  str << "[" << buffer.ToString() << "]";
  JsonObject json;
  json.AddRaw("intensity", "50");
  json.Add("error", result.Error());

  response->SetNoCache();
  response->SetContentType(HTTPServer::CONTENT_TYPE_PLAIN);
  response->SendJson(json);
  delete response;
}