Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions inc/osvr/Server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ namespace server {
/// @brief Load all auto-loadable plugins.
OSVR_SERVER_EXPORT void loadAutoPlugins();

/// @brief 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.
OSVR_SERVER_EXPORT void setHardwareDetectOnConnection();

/// @brief Instantiate the named driver with parameters.
/// @param plugin The name of a plugin.
/// @param driver The name of a driver registered by the plugin for
Expand Down
5 changes: 4 additions & 1 deletion src/osvr/Server/ConfigureServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ namespace server {
m_server = Server::create(connPtr);
}

if (sleepTime > 0.0)
if (sleepTime > 0.0) {
m_server->setSleepTime(sleepTime);
}

m_server->setHardwareDetectOnConnection();

return m_server;
}
Expand Down
4 changes: 4 additions & 0 deletions src/osvr/Server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ namespace server {

void Server::loadAutoPlugins() { m_impl->loadAutoPlugins(); }

void Server::setHardwareDetectOnConnection() {
m_impl->setHardwareDetectOnConnection();
}

void Server::instantiateDriver(std::string const &plugin,
std::string const &driver,
std::string const &params) {
Expand Down
8 changes: 6 additions & 2 deletions src/osvr/Server/ServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ namespace server {
&ServerImpl::m_handleUpdatedRoute, this);

// Things to do when we get a new incoming connection
// No longer doing hardware detect unconditionally here - see triggerHardwareDetect()
m_commonComponent =
m_systemDevice->addComponent(common::CommonComponent::create());
m_commonComponent->registerPingHandler(
[&] { triggerHardwareDetect(); });
m_commonComponent->registerPingHandler([&] { m_sendTree(); });

// Set up the default display descriptor.
Expand Down Expand Up @@ -157,6 +156,11 @@ namespace server {

void ServerImpl::loadAutoPlugins() { m_ctx->loadPlugins(); }

void ServerImpl::setHardwareDetectOnConnection() {
m_commonComponent->registerPingHandler(
[&] { triggerHardwareDetect(); });
}

void ServerImpl::instantiateDriver(std::string const &plugin,
std::string const &driver,
std::string const &params) {
Expand Down
3 changes: 3 additions & 0 deletions src/osvr/Server/ServerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ namespace server {
/// @brief Load all auto-loadable plugins.
void loadAutoPlugins();

/// @copydoc Server::setHardwareDetectOnConnection()
void setHardwareDetectOnConnection();

/// @copydoc Server::triggerHardwareDetect()
void triggerHardwareDetect();

Expand Down