| 47 | } |
| 48 | |
| 49 | int main(int argc, char *argv[]) { |
| 50 | if (argc < 2) { |
| 51 | cerr << "Must supply at least one plugin name to load." << endl; |
| 52 | return 1; |
| 53 | } |
| 54 | cout << "Creating server..." << endl; |
| 55 | |
| 56 | server = osvr::server::Server::createLocal(); |
| 57 | |
| 58 | cout << "Registering shutdown handler..." << endl; |
| 59 | osvr::server::registerShutdownHandler<&handleShutdown>(); |
| 60 | |
| 61 | cout << "Loading plugins..." << endl; |
| 62 | for (int i = 1; i < argc; ++i) { |
| 63 | try { |
| 64 | cout << "Loading plugin '" << argv[i] << "'..." << endl; |
| 65 | server->loadPlugin(argv[i]); |
| 66 | cout << "Plugin '" << argv[i] << "' loaded!\n" << endl; |
| 67 | } catch (std::exception &e) { |
| 68 | std::cerr << "Caught exception tring to load " << argv[i] << ": " |
| 69 | << e.what() << std::endl; |
| 70 | return 1; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | cout << "Triggering a hardware detection..." << endl; |
| 75 | server->triggerHardwareDetect(); |
| 76 | |
| 77 | cout << "Starting server mainloop..." << endl; |
| 78 | server->startAndAwaitShutdown(); |
| 79 | |
| 80 | cout << "Server mainloop exited." << endl; |
| 81 | |
| 82 | return 0; |
| 83 | } |
nothing calls this directly
no test coverage detected