OSVR-Core
|
Private implementation class for Server. More...
#include <ServerImpl.h>
Public Member Functions | |
ServerImpl (connection::ConnectionPtr const &conn, boost::optional< std::string > const &host, boost::optional< int > const &port) | |
Constructor. | |
~ServerImpl () | |
Destructor (stops the thread first) | |
void | start () |
Launch a thread running the server. | |
void | startAndAwaitShutdown () |
Launch a thread running the server, and block until the server shuts down. More... | |
void | awaitShutdown () |
Block until the server shuts down. More... | |
void | stop () |
Signal the server to stop, and block until it does so. | |
void | signalStop () |
Signal the server to stop (if it is running) but return immediately. More... | |
void | loadPlugin (std::string const &pluginName) |
Load named plugin. | |
void | loadAutoPlugins () |
Load all auto-loadable plugins. | |
void | setHardwareDetectOnConnection () |
Adds the behavior that hardware detection should take place on client connection. More... | |
void | triggerHardwareDetect () |
Run all hardware detect callbacks. More... | |
void | registerMainloopMethod (MainloopMethod f) |
Register a method to run during every time through the main loop. More... | |
bool | addRoute (std::string const &routingDirective) |
Register a JSON string as a routing directive. More... | |
bool | addAlias (std::string const &path, std::string const &source, common::AliasPriority priority) |
Add an alias entry to the tree. More... | |
bool | addAliases (Json::Value const &aliases, common::AliasPriority priority) |
Add alias entries to the tree from JSON. More... | |
void | addExternalDevice (std::string const &path, std::string const &deviceName, std::string const &server, std::string const &descriptor) |
Add an external device entry manually to the tree. More... | |
bool | addString (std::string const &path, std::string const &value) |
Add a string entry to the tree. More... | |
void | setSleepTime (int microseconds) |
Sets the amount of time (in microseconds) that the server loop will sleep each loop when a client is connected (0 means no sleep) More... | |
void | instantiateDriver (std::string const &plugin, std::string const &driver, std::string const ¶ms) |
Instantiate the named driver with parameters. More... | |
void | update () |
The method to just do the update stuff, not in a thread. | |
Private implementation class for Server.
bool osvr::server::ServerImpl::addAlias | ( | std::string const & | path, |
std::string const & | source, | ||
common::AliasPriority | priority | ||
) |
Add an alias entry to the tree.
If the server is running, this will trigger a re-transmission of the path tree to all clients.
Safe to call from any thread, even when server is running.
bool osvr::server::ServerImpl::addAliases | ( | Json::Value const & | aliases, |
common::AliasPriority | priority | ||
) |
Add alias entries to the tree from JSON.
If the server is running, this will trigger a re-transmission of the path tree to all clients.
Safe to call from any thread, even when server is running.
void osvr::server::ServerImpl::addExternalDevice | ( | std::string const & | path, |
std::string const & | deviceName, | ||
std::string const & | server, | ||
std::string const & | descriptor | ||
) |
Add an external device entry manually to the tree.
If the server is running, this will trigger a re-transmission of the path tree to all clients.
Safe to call from any thread, even when server is running.
Get the node
Create the DeviceElement and set it as the node value - assume it's a VRPN device by default.
Process device descriptor
bool osvr::server::ServerImpl::addRoute | ( | std::string const & | routingDirective | ) |
Register a JSON string as a routing directive.
If the server is running, this will trigger a re-transmission of the path tree to all clients.
Safe to call from any thread, even when server is running.
bool osvr::server::ServerImpl::addString | ( | std::string const & | path, |
std::string const & | value | ||
) |
Add a string entry to the tree.
If the server is running, this will trigger a re-transmission of the path tree to all clients.
Safe to call from any thread, even when server is running.
void osvr::server::ServerImpl::awaitShutdown | ( | ) |
Block until the server shuts down.
Do not call from within the server thread itself, of course.
void osvr::server::ServerImpl::instantiateDriver | ( | std::string const & | plugin, |
std::string const & | driver, | ||
std::string const & | params | ||
) |
Instantiate the named driver with parameters.
plugin | The name of a plugin. |
driver | The name of a driver registered by the plugin for creation in this way. |
params | A string containing parameters. Format is between you and the plugin, but JSON is recommended. |
Call only before starting the server or from within server thread.
void osvr::server::ServerImpl::registerMainloopMethod | ( | MainloopMethod | f | ) |
Register a method to run during every time through the main loop.
Safe to call from any thread, even when server is running.
void osvr::server::ServerImpl::setHardwareDetectOnConnection | ( | ) |
Adds the behavior that hardware detection should take place on client connection.
Safe to call from any thread, even when server is running, though it makes the most sense as a startup option.
void osvr::server::ServerImpl::setSleepTime | ( | int | microseconds | ) |
Sets the amount of time (in microseconds) that the server loop will sleep each loop when a client is connected (0 means no sleep)
Call only before starting the server or from within server thread.
void osvr::server::ServerImpl::signalStop | ( | ) |
Signal the server to stop (if it is running) but return immediately.
void osvr::server::ServerImpl::startAndAwaitShutdown | ( | ) |
Launch a thread running the server, and block until the server shuts down.
void osvr::server::ServerImpl::triggerHardwareDetect | ( | ) |
Run all hardware detect callbacks.
Safe to call from any thread, even when server is running.