Пример #1
0
    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);
        });
    }
Пример #2
0
    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;
    }
Пример #3
0
 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;
 }
Пример #4
0
 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;
 }
Пример #5
0
 bool ServerImpl::addAliases(Json::Value const &aliases,
                             common::AliasPriority priority) {
     bool wasChanged;
     m_callControlled([&] { wasChanged = m_addAliases(aliases, priority); });
     return wasChanged;
 }
Пример #6
0
 bool ServerImpl::addRoute(std::string const &routingDirective) {
     bool wasNew;
     m_callControlled([&] { wasNew = m_addRoute(routingDirective); });
     return wasNew;
 }
Пример #7
0
 void ServerImpl::registerMainloopMethod(MainloopMethod f) {
     if (f) {
         m_callControlled([&] { m_mainloopMethods.push_back(f); });
     }
 }
Пример #8
0
 void ServerImpl::triggerHardwareDetect() {
     OSVR_DEV_VERBOSE("Performing hardware auto-detection.");
     m_callControlled([&] { m_ctx->triggerHardwareDetect(); });
 }
Пример #9
0
 void ServerImpl::loadPlugin(std::string const &pluginName) {
     m_callControlled([&, pluginName] { m_ctx->loadPlugin(pluginName); });
 }
Пример #10
0
 void ServerImpl::m_queueTreeSend() {
     m_callControlled([&] { m_treeDirty += true; });
 }
Пример #11
0
 void ServerImpl::triggerHardwareDetect() {
     m_callControlled([&] { m_triggeredDetect = true; });
 }