MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / addExternalDevice

Method addExternalDevice

src/osvr/Server/ServerImpl.cpp:247–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245 }
246
247 void ServerImpl::addExternalDevice(std::string const &path,
248 std::string const &deviceName,
249 std::string const &server,
250 std::string const &descriptor) {
251 Json::Value descriptorVal;
252 Json::Reader reader;
253 if (!reader.parse(descriptor, descriptorVal)) {
254 BOOST_ASSERT_MSG(0, "Should never get here - string descriptor "
255 "handed to us should have been generated from "
256 "a JSON value.");
257 return;
258 }
259 m_callControlled([&] {
260 /// Get the node
261 auto &node = m_tree.getNodeByPath(path);
262
263 /// Create the DeviceElement and set it as the node value
264 auto elt = common::elements::DeviceElement{deviceName, server};
265 elt.getDescriptor() = descriptorVal;
266 node.value() = elt;
267 m_treeDirty.set();
268
269 /// Process device descriptor
270 common::processDeviceDescriptorFromExistingDevice(node, elt);
271 });
272 }
273
274 bool ServerImpl::addString(std::string const &path,
275 std::string const &value) {

Callers

nothing calls this directly

Calls 4

valueMethod · 0.80
parseMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected