/* * Handle the universe info * @param response the HTTPResponse that is associated with the request. * @param universe the OlaUniverse object * @param error an error string. */ void OladHTTPServer::HandleUniverseInfo(HTTPResponse *response, OlaUniverse &universe, const string &error) { if (!error.empty()) { m_server.ServeError(response, error); return; } JsonObject *json = new JsonObject(); // fire off the device/port request now. the main server is running in a // separate thread. bool ok = m_client.FetchDeviceInfo( ola::OLA_PLUGIN_ALL, NewSingleCallback(this, &OladHTTPServer::HandlePortsForUniverse, response, json, universe.Id())); if (!ok) { m_server.ServeError(response, K_BACKEND_DISCONNECTED_ERROR); delete json; return; } json->Add("id", universe.Id()); json->Add("name", universe.Name()); json->Add("merge_mode", (universe.MergeMode() == OlaUniverse::MERGE_HTP ? "HTP" : "LTP")); }
/* * Handle the universe info * @param response the HTTPResponse that is associated with the request. * @param universe the OlaUniverse object * @param error an error string. */ void OladHTTPServer::HandleUniverseInfo(HTTPResponse *response, const client::Result &result, const OlaUniverse &universe) { if (!result.Success()) { m_server.ServeError(response, result.Error()); return; } JsonObject *json = new JsonObject(); // fire off the device/port request now. the main server is running in a // separate thread. m_client.FetchDeviceInfo( ola::OLA_PLUGIN_ALL, NewSingleCallback(this, &OladHTTPServer::HandlePortsForUniverse, response, json, universe.Id())); json->Add("id", universe.Id()); json->Add("name", universe.Name()); json->Add("merge_mode", (universe.MergeMode() == OlaUniverse::MERGE_HTP ? "HTP" : "LTP")); }
/* * Handle the universe info * @param response the HttpResponse that is associated with the request. * @param universe the OlaUniverse object * @param error an error string. */ void OlaHttpServer::HandleUniverseInfo(HttpResponse *response, OlaUniverse &universe, const string &error) { if (!error.empty()) { m_server.ServeError(response, error); return; } // fire off the device/port request now. the main server is running in a // separate thread. bool ok = m_client.FetchDeviceInfo( ola::OLA_PLUGIN_ALL, NewSingleCallback(this, &OlaHttpServer::HandlePortsForUniverse, response, universe.Id())); if (!ok) { m_server.ServeError(response, K_BACKEND_DISCONNECTED_ERROR); return; } stringstream str; str << "{" << endl; str << " \"id\": " << universe.Id() << "," << endl; str << " \"name\": \"" << EscapeString(universe.Name()) << "\"," << endl; str << " \"merge_mode\": \"" << (universe.MergeMode() == OlaUniverse::MERGE_HTP ? "HTP" : "LTP") << "\"," << endl; response->Append(str.str()); }
void OlaCallbackClient::HandleUniverseInfo( SingleUseCallback2<void, OlaUniverse&, const string&> *callback, const client::Result &result, const OlaUniverse &universe) { // There was a bug in the API and universe isn't const. OlaUniverse new_universe( universe.Id(), universe.MergeMode(), universe.Name(), universe.InputPorts(), universe.OutputPorts(), universe.RDMDeviceCount()); callback->Run(new_universe, result.Error()); }