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

Method processExternalDevices

src/osvr/Server/ConfigureServer.cpp:293–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291 static const char DEVICENAME_KEY[] = "deviceName";
292 static const char DESCRIPTOR_KEY[] = "descriptor";
293 bool ConfigureServer::processExternalDevices() {
294 bool success = false;
295 Json::Value const &devices = m_data->getMember(EXTERNALDEVICES_KEY);
296 if (devices.isNull()) {
297 return success;
298 }
299 for (auto const &devPath : devices.getMemberNames()) {
300 auto const &dev = devices[devPath];
301 auto const &devName = dev[DEVICENAME_KEY];
302 auto const &server = dev[SERVER_KEY];
303 auto descriptor = resolvePossibleRef(dev[DESCRIPTOR_KEY]);
304 if (devName.isNull()) {
305 OSVR_DEV_VERBOSE(
306 "Missing 'deviceName' for external device entry of "
307 << devPath << " : " << dev.toStyledString());
308 continue;
309 }
310 if (server.isNull()) {
311 OSVR_DEV_VERBOSE(
312 "Missing 'server' for external device entry of "
313 << devPath << " : " << dev.toStyledString());
314 continue;
315 }
316
317 if (descriptor.isNull()) {
318 OSVR_DEV_VERBOSE("Missing 'descriptor' file or object for "
319 "external device entry of "
320 << devPath << " : " << dev.toStyledString());
321 continue;
322 }
323
324 m_server->addExternalDevice(devPath, devName.asString(),
325 server.asString(),
326 descriptor.toStyledString());
327 success = true;
328 }
329 return success;
330 }
331
332 static const char DISPLAY_KEY[] = "display";
333 static const char DISPLAY_PATH[] = "/display";

Callers 1

configureServerFromFileFunction · 0.80

Calls 2

resolvePossibleRefFunction · 0.85
addExternalDeviceMethod · 0.45

Tested by

no test coverage detected