OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::server::ServerImpl Class Reference

Private implementation class for Server. More...

#include <osvr/Server/ServerImpl.h>

Inheritance diagram for osvr::server::ServerImpl:

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.
 
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.
 
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 &params)
 Instantiate the named driver with parameters. More...
 
void update ()
 The method to just do the update stuff, not in a thread.
 

Detailed Description

Private implementation class for Server.

Definition at line 60 of file ServerImpl.h.

Member Function Documentation

void osvr::server::ServerImpl::awaitShutdown ( )

Block until the server shuts down.

Do not call from within the server thread itself, of course.

Definition at line 158 of file ServerImpl.cpp.

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.

Definition at line 182 of file ServerImpl.cpp.

void osvr::server::ServerImpl::triggerHardwareDetect ( )

Run all hardware detect callbacks.

Safe to call from any thread, even when server is running.

Definition at line 195 of file ServerImpl.cpp.

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.

Definition at line 199 of file ServerImpl.cpp.

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.

Returns
true if the route was new, or false if it replaced an existing route for that destination.

Safe to call from any thread, even when server is running.

Definition at line 249 of file ServerImpl.cpp.

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.

Definition at line 255 of file ServerImpl.cpp.

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.

Definition at line 265 of file ServerImpl.cpp.

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

Definition at line 272 of file ServerImpl.cpp.

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.

Definition at line 301 of file ServerImpl.cpp.

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.

Definition at line 371 of file ServerImpl.cpp.

void osvr::server::ServerImpl::instantiateDriver ( std::string const &  plugin,
std::string const &  driver,
std::string const &  params 
)

Instantiate the named driver with parameters.

Parameters
pluginThe name of a plugin.
driverThe name of a driver registered by the plugin for creation in this way.
paramsA 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.

Definition at line 187 of file ServerImpl.cpp.


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