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

Function createYEI

plugins/multiserver/DevicesWithParameters.cpp:120–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void createYEI(VRPNMultiserverData &data, OSVR_PluginRegContext ctx,
121 const char *params) {
122 Json::Reader reader;
123 Json::Value root;
124 if (!reader.parse(params, root)) {
125 throw std::runtime_error("Could not parse configuration: " +
126 reader.getFormattedErrorMessages());
127 }
128 auto port = root.get("port", "").asString();
129#ifdef OSVR_HAVE_USBSERIALENUM
130 // Have usb serial enum: specifying a port means you just want that one,
131 // not specifying means you want it to auto-configure all.
132 if (!port.empty()) {
133 createYEIImpl(data, ctx, root, port);
134 } else {
135 static const uint16_t vID = 0x9AC;
136 static const uint16_t pID = 0x3F2;
137 for (auto dev : osvr::usbserial::Enumerator(vID, pID)) {
138 createYEIImpl(data, ctx, root, dev->getPort());
139 }
140 }
141#else // !OSVR_HAVE_USBSERIALENUM
142 // No usb serial enum: must unconditionally specify a port.
143 createYEIImpl(data, ctx, root, port);
144#endif // OSVR_HAVE_USBSERIALENUM
145}

Callers

nothing calls this directly

Calls 6

createYEIImplFunction · 0.85
EnumeratorClass · 0.85
getPortMethod · 0.80
parseMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected