Open Lighting Architecture  Latest Git
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ola::OladHTTPServer Class Reference
Inheritance diagram for ola::OladHTTPServer:
Inheritance graph
[legend]
Collaboration diagram for ola::OladHTTPServer:
Collaboration graph
[legend]

Classes

struct  OladHTTPServerOptions
 

Public Member Functions

 OladHTTPServer (ExportMap *export_map, const OladHTTPServerOptions &options, ola::io::ConnectedDescriptor *client_socket, class OlaServer *ola_server, const ola::network::Interface &iface)
 Create a new OLA HTTP server. More...
 
bool Init ()
 Setup the OLA HTTP server. More...
 
void SetPidStore (const ola::rdm::RootPidStore *pid_store)
 Can be called while the HTTP server is running.
 
int JsonServerStats (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Print the server stats JSON. More...
 
int JsonUniversePluginList (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Print the list of universes / plugins as a json string. More...
 
int JsonPluginInfo (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Print the plugin info as a JSON string. More...
 
int SetPluginState (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Set plugin state. More...
 
int JsonUniverseInfo (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Return information about a universe. More...
 
int JsonAvailablePorts (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Return a list of unbound ports. More...
 
int CreateNewUniverse (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Create a new universe by binding one or more ports. More...
 
int ModifyUniverse (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Modify an existing universe. More...
 
int GetDmx (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Handle the get DMX command. More...
 
int HandleSetDmx (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Handle the set DMX command. More...
 
int DisplayQuit (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Cause the server to shutdown. More...
 
int ReloadPlugins (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Reload all plugins. More...
 
int ReloadPidStore (const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
 Reload the PID Store. More...
 
void HandlePluginList (ola::http::HTTPResponse *response, const client::Result &result, const std::vector< client::OlaPlugin > &plugins)
 Handle the plugin list callback. More...
 
void HandleUniverseList (ola::http::HTTPResponse *response, ola::web::JsonObject *json, const client::Result &result, const std::vector< client::OlaUniverse > &universes)
 Handle the universe list callback. More...
 
void HandlePartialPluginInfo (ola::http::HTTPResponse *response, int plugin_id, const client::Result &result, const std::string &description)
 Handle the plugin description response. More...
 
void HandlePluginInfo (ola::http::HTTPResponse *response, std::string description, const client::Result &result, const ola::client::PluginState &state)
 Handle the plugin description response. More...
 
void HandleUniverseInfo (ola::http::HTTPResponse *response, const client::Result &result, const client::OlaUniverse &universe)
 Handle the universe info. More...
 
void HandlePortsForUniverse (ola::http::HTTPResponse *response, ola::web::JsonObject *json, unsigned int universe_id, const client::Result &result, const std::vector< client::OlaDevice > &devices)
 
void HandleCandidatePorts (ola::http::HTTPResponse *response, const client::Result &result, const std::vector< client::OlaDevice > &devices)
 Handle the list of candidate ports. More...
 
void CreateUniverseComplete (ola::http::HTTPResponse *response, unsigned int universe_id, bool included_name, class ActionQueue *action_queue)
 
void SendCreateUniverseResponse (ola::http::HTTPResponse *response, unsigned int universe_id, bool included_name, class ActionQueue *action_queue)
 
void ModifyUniverseComplete (ola::http::HTTPResponse *response, class ActionQueue *action_queue)
 
void SendModifyUniverseResponse (ola::http::HTTPResponse *response, class ActionQueue *action_queue)
 
- Public Member Functions inherited from ola::http::OlaHTTPServer
 OlaHTTPServer (const HTTPServer::HTTPServerOptions &options, ola::ExportMap *export_map)
 
bool Start ()
 
void Stop ()
 

Static Public Member Functions

static int ServeHelpRedirect (ola::http::HTTPResponse *response)
 
static int ServeUsage (ola::http::HTTPResponse *response, const std::string &details)
 Serve usage information. More...
 

Static Public Attributes

static const char HELP_PARAMETER [] = "help"
 

Additional Inherited Members

- Protected Member Functions inherited from ola::http::OlaHTTPServer
void RegisterFile (const std::string &file, const std::string &content_type)
 
- Protected Attributes inherited from ola::http::OlaHTTPServer
Clock m_clock
 
ola::ExportMapm_export_map
 
HTTPServer m_server
 
TimeStamp m_start_time
 

Constructor & Destructor Documentation

◆ OladHTTPServer()

ola::OladHTTPServer::OladHTTPServer ( ExportMap export_map,
const OladHTTPServerOptions options,
ola::io::ConnectedDescriptor client_socket,
class OlaServer ola_server,
const ola::network::Interface iface 
)

Create a new OLA HTTP server.

Parameters
export_mapthe ExportMap to display when /debug is called
optionsthe OladHTTPServerOptions for the OLA HTTP server
client_socketA ConnectedDescriptor which is used to communicate with the server.
ola_serverthe OlaServer to use
ifacethe network interface to bind to

Member Function Documentation

◆ CreateNewUniverse()

int ola::OladHTTPServer::CreateNewUniverse ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Create a new universe by binding one or more ports.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ DisplayQuit()

int ola::OladHTTPServer::DisplayQuit ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Cause the server to shutdown.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ GetDmx()

int ola::OladHTTPServer::GetDmx ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Handle the get DMX command.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ HandleCandidatePorts()

void ola::OladHTTPServer::HandleCandidatePorts ( ola::http::HTTPResponse response,
const client::Result result,
const std::vector< client::OlaDevice > &  devices 
)

Handle the list of candidate ports.

Parameters
responsethe HTTPResponse that is associated with the request.
resultthe result of the API call
devicesthe possible devices & ports

◆ HandlePartialPluginInfo()

void ola::OladHTTPServer::HandlePartialPluginInfo ( ola::http::HTTPResponse response,
int  plugin_id,
const client::Result result,
const std::string &  description 
)

Handle the plugin description response.

Parameters
responsethe HTTPResponse that is associated with the request.
plugin_idthe plugin id.
resultthe result of the API call.
descriptionthe plugin description.

◆ HandlePluginInfo()

void ola::OladHTTPServer::HandlePluginInfo ( ola::http::HTTPResponse response,
std::string  description,
const client::Result result,
const ola::client::PluginState state 
)

Handle the plugin description response.

Parameters
responsethe HTTPResponse that is associated with the request.
descriptionthe plugin description
resultthe result of the API call.
statethe state of the plugin.

◆ HandlePluginList()

void ola::OladHTTPServer::HandlePluginList ( ola::http::HTTPResponse response,
const client::Result result,
const std::vector< client::OlaPlugin > &  plugins 
)

Handle the plugin list callback.

Parameters
responsethe HTTPResponse that is associated with the request.
resultthe result of the API call
pluginsa list of plugins

◆ HandleSetDmx()

int ola::OladHTTPServer::HandleSetDmx ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Handle the set DMX command.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ HandleUniverseInfo()

void ola::OladHTTPServer::HandleUniverseInfo ( ola::http::HTTPResponse response,
const client::Result result,
const client::OlaUniverse universe 
)

Handle the universe info.

Parameters
responsethe HTTPResponse that is associated with the request.
resultthe result of the API call
universethe OlaUniverse object

◆ HandleUniverseList()

void ola::OladHTTPServer::HandleUniverseList ( ola::http::HTTPResponse response,
ola::web::JsonObject json,
const client::Result result,
const std::vector< client::OlaUniverse > &  universes 
)

Handle the universe list callback.

Parameters
responsethe HTTPResponse that is associated with the request.
jsonthe JsonObject to add the data to
resultthe result of the API call
universesthe vector of OlaUniverse

◆ Init()

bool ola::OladHTTPServer::Init ( )
virtual

Setup the OLA HTTP server.

Returns
true if this worked, false otherwise.

Reimplemented from ola::http::OlaHTTPServer.

◆ JsonAvailablePorts()

int ola::OladHTTPServer::JsonAvailablePorts ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Return a list of unbound ports.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ JsonPluginInfo()

int ola::OladHTTPServer::JsonPluginInfo ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Print the plugin info as a JSON string.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ JsonServerStats()

int ola::OladHTTPServer::JsonServerStats ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Print the server stats JSON.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ JsonUniverseInfo()

int ola::OladHTTPServer::JsonUniverseInfo ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Return information about a universe.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ JsonUniversePluginList()

int ola::OladHTTPServer::JsonUniversePluginList ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Print the list of universes / plugins as a json string.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ ModifyUniverse()

int ola::OladHTTPServer::ModifyUniverse ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Modify an existing universe.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ ReloadPidStore()

int ola::OladHTTPServer::ReloadPidStore ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Reload the PID Store.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ ReloadPlugins()

int ola::OladHTTPServer::ReloadPlugins ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Reload all plugins.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

◆ ServeHelpRedirect()

static int ola::OladHTTPServer::ServeHelpRedirect ( ola::http::HTTPResponse response)
inlinestatic

Serve a help redirect

Parameters
responsethe response to use

◆ ServeUsage()

int ola::OladHTTPServer::ServeUsage ( ola::http::HTTPResponse response,
const std::string &  details 
)
static

Serve usage information.

Parameters
responsethe response to use.
detailsthe usage information

◆ SetPluginState()

int ola::OladHTTPServer::SetPluginState ( const ola::http::HTTPRequest request,
ola::http::HTTPResponse response 
)

Set plugin state.

Parameters
requestthe HTTPRequest
responsethe HTTPResponse
Returns
MHD_NO or MHD_YES

The documentation for this class was generated from the following files: