47 ServerPtr configureServerFromString(std::string
const &json) {
49 ::osvr::util::log::make_logger(::osvr::util::log::OSVR_SERVER_LOG);
53 log->info() <<
"Constructing server as configured...";
58 catch (std::exception &e) {
60 <<
"Caught exception constructing server from JSON config "
67 log->info() <<
"Loading auto-loadable plugins...";
72 log->info() <<
"Loading plugins...";
74 if (!srvConfig.getSuccessfulPlugins().empty()) {
75 log->info() <<
"Successfully loaded the following plugins:";
76 for (
auto const &plugin : srvConfig.getSuccessfulPlugins()) {
77 log->info() <<
" - " << plugin;
81 log->warn() <<
"Failed to load the following plugins:";
83 log->warn() <<
" - " << pluginError.first <<
"\t"
84 << pluginError.second;
90 log->info() <<
"Instantiating configured drivers...";
92 if (!srvConfig.getSuccessfulInstantiations().empty()) {
93 log->info() <<
"Successes:";
94 for (
auto const &driver :
95 srvConfig.getSuccessfulInstantiations()) {
96 log->info() <<
" - " << driver;
100 log->error() <<
"Errors:";
102 log->error() <<
" - " << error.first <<
"\t"
110 <<
"External devices found and parsed from config file.";
113 if (srvConfig.processRoutes()) {
114 log->info() <<
"Routes found and parsed from config file.";
117 if (srvConfig.processAliases()) {
118 log->info() <<
"Aliases found and parsed from config file.";
123 <<
"Display descriptor found and parsed from config file.";
126 <<
"Using OSVR HDK for display configuration. "
127 "Did not find an alternate valid 'display' object in config "
132 log->info() <<
"RenderManager config found and parsed from the "
136 log->info() <<
"Triggering automatic hardware detection...";
137 ret->triggerHardwareDetect();
144 ::osvr::util::log::make_logger(::osvr::util::log::OSVR_SERVER_LOG);
147 log->info() <<
"Attempting to load config file '" << configName <<
"'.";
148 std::ifstream config(configName);
149 if (!config.good()) {
150 log->error() <<
"Config file '" << configName <<
"' not found";
154 std::stringstream sstr;
155 sstr << config.rdbuf();
156 return configureServerFromString(sstr.str());
160 std::vector<std::string>
const &configNames) {
162 ::osvr::util::log::make_logger(::osvr::util::log::OSVR_SERVER_LOG);
164 for (
const auto name : configNames) {
165 std::ifstream config(name);
170 log->error() <<
"Could not find a valid config file!";
OSVR_SERVER_EXPORT ServerPtr configureServerFromFile(std::string const &configName)
This uses a file name to attempt to configure the server with that config file. Pass an empty string ...
Header declaring osvr::server::Server.
Platform specific search paths for osvr server config files.
OSVR_SERVER_EXPORT ServerPtr configureServerFromFirstFileInList(std::vector< std::string > const &configNames)
This iterates over a vector that contains a list of potential config files, and uses the first workin...
shared_ptr< Server > ServerPtr
How one should hold a Server.
Header to include for OSVR-internal usage of the logging mechanism: provides the needed definition of...