void ServerImpl::addExternalDevice(std::string const &path, std::string const &deviceName, std::string const &server, std::string const &descriptor) { Json::Value descriptorVal; Json::Reader reader; if (!reader.parse(descriptor, descriptorVal)) { BOOST_ASSERT_MSG(0, "Should never get here - string descriptor " "handed to us should have been generated from " "a JSON value."); return; } m_callControlled([&] { /// Get the node auto &node = m_tree.getNodeByPath(path); /// Create the DeviceElement and set it as the node value auto elt = common::elements::DeviceElement{deviceName, server}; elt.getDescriptor() = descriptorVal; node.value() = elt; m_treeDirty.set(); /// Process device descriptor common::processDeviceDescriptorFromExistingDevice(node, elt); }); }
bool ServerImpl::addAlias(std::string const &path, std::string const &source, common::AliasPriority priority) { bool wasChanged; m_callControlled( [&] { wasChanged = m_addAlias(path, source, priority); }); return wasChanged; }
bool ServerImpl::addString(std::string const &path, std::string const &value) { bool wasChanged = false; auto newElement = common::PathElement{common::elements::StringElement{value}}; m_callControlled([&] { auto &node = m_tree.getNodeByPath(path); if (!(newElement == node.value())) { m_treeDirty.set(); wasChanged = true; node.value() = newElement; } }); return wasChanged; }
std::string ServerImpl::getSource(std::string const &destination) const { /// @todo needs removal/replacement post path tree std::string ret; m_callControlled([&] { ret = m_routes.getSource(destination); }); return ret; }
bool ServerImpl::addAliases(Json::Value const &aliases, common::AliasPriority priority) { bool wasChanged; m_callControlled([&] { wasChanged = m_addAliases(aliases, priority); }); return wasChanged; }
bool ServerImpl::addRoute(std::string const &routingDirective) { bool wasNew; m_callControlled([&] { wasNew = m_addRoute(routingDirective); }); return wasNew; }
void ServerImpl::registerMainloopMethod(MainloopMethod f) { if (f) { m_callControlled([&] { m_mainloopMethods.push_back(f); }); } }
void ServerImpl::triggerHardwareDetect() { OSVR_DEV_VERBOSE("Performing hardware auto-detection."); m_callControlled([&] { m_ctx->triggerHardwareDetect(); }); }
void ServerImpl::loadPlugin(std::string const &pluginName) { m_callControlled([&, pluginName] { m_ctx->loadPlugin(pluginName); }); }
void ServerImpl::m_queueTreeSend() { m_callControlled([&] { m_treeDirty += true; }); }
void ServerImpl::triggerHardwareDetect() { m_callControlled([&] { m_triggeredDetect = true; }); }