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

Function createYEIImpl

plugins/multiserver/DevicesWithParameters.cpp:84–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82} // namespace
83
84static void createYEIImpl(VRPNMultiserverData &data, OSVR_PluginRegContext ctx,
85 Json::Value const &root, std::string port) {
86 if (port.empty()) {
87 throw std::runtime_error(
88 "Could not create a YEI device: no port specified!.");
89 }
90 port = normalizeAndVerifySerialPort(port);
91
92 bool calibrate_gyros_on_setup =
93 root.get("calibrateGyrosOnSetup", false).asBool();
94 bool tare_on_setup = root.get("tareOnSetup", false).asBool();
95 double frames_per_second = root.get("framesPerSecond", 250).asFloat();
96
97 Json::Value commands = root.get("resetCommands", Json::arrayValue);
98 CStringArray reset_commands;
99
100 if (commands.empty()) {
101 // Enable Q-COMP filtering by default
102 reset_commands.push_back("123,2");
103 } else {
104 for (Json::ArrayIndex i = 0, e = commands.size(); i < e; ++i) {
105 reset_commands.push_back(commands[i].asString());
106 }
107 }
108
109 osvr::vrpnserver::VRPNDeviceRegistration reg(ctx);
110
111 reg.registerDevice(new vrpn_YEI_3Space_Sensor(
112 reg.useDecoratedName(data.getName("YEI_3Space_Sensor")).c_str(),
113 reg.getVRPNConnection(), port.c_str(), 115200, calibrate_gyros_on_setup,
114 tare_on_setup, frames_per_second, 0, 0, 1, 0,
115 reset_commands.get_array()));
116 reg.setDeviceDescriptor(
117 osvr::util::makeString(com_osvr_Multiserver_YEI_3Space_Sensor_json));
118}
119
120void createYEI(VRPNMultiserverData &data, OSVR_PluginRegContext ctx,
121 const char *params) {

Callers 1

createYEIFunction · 0.85

Calls 12

makeStringFunction · 0.85
getNameMethod · 0.80
getVRPNConnectionMethod · 0.80
get_arrayMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
registerDeviceMethod · 0.45
useDecoratedNameMethod · 0.45
setDeviceDescriptorMethod · 0.45

Tested by

no test coverage detected