| 162 | } |
| 163 | |
| 164 | OSVR_ClientContext osvrJointClientInit(const char applicationIdentifier[], |
| 165 | OSVR_JointClientOpts opts) { |
| 166 | try { |
| 167 | using OptionPtr = std::unique_ptr<OSVR_JointClientContextOptsObject>; |
| 168 | // Take ownership of options, if any |
| 169 | OptionPtr opt(opts); |
| 170 | |
| 171 | using JointContextPtr = |
| 172 | std::unique_ptr<osvr::client::JointClientContext>; |
| 173 | // Make the context. |
| 174 | auto ctx = JointContextPtr{ |
| 175 | osvr::common::makeContext<osvr::client::JointClientContext>( |
| 176 | applicationIdentifier)}; |
| 177 | |
| 178 | if (opt) { |
| 179 | opt->apply(ctx->getServer()); |
| 180 | } else { |
| 181 | // Default behavior when no options are passed. |
| 182 | ctx->getServer().loadAutoPlugins(); |
| 183 | ctx->getServer().triggerHardwareDetect(); |
| 184 | } |
| 185 | // Transfer ownership to the client app. |
| 186 | return ctx.release(); |
| 187 | } catch (std::exception const &e) { |
| 188 | OSVR_DEV_VERBOSE( |
| 189 | "Caught an exception in osvrJointClientInit: " << e.what()); |
| 190 | } catch (...) { |
| 191 | |
| 192 | OSVR_DEV_VERBOSE( |
| 193 | "Caught an unrecognized exception type in osvrJointClientInit."); |
| 194 | } |
| 195 | |
| 196 | return nullptr; |
| 197 | } |
no test coverage detected