| 241 | } |
| 242 | |
| 243 | XnStatus XnModuleLoader::LoadAllModules() |
| 244 | { |
| 245 | XnStatus nRetVal = XN_STATUS_OK; |
| 246 | |
| 247 | // first load OpenNI itself |
| 248 | nRetVal = AddOpenNIGenerators(); |
| 249 | XN_IS_STATUS_OK(nRetVal); |
| 250 | |
| 251 | // now load modules |
| 252 | TiXmlDocument doc; |
| 253 | nRetVal = loadModulesFile(doc); |
| 254 | XN_IS_STATUS_OK(nRetVal); |
| 255 | |
| 256 | // try to load each |
| 257 | TiXmlElement* pModule = doc.RootElement()->FirstChildElement(XN_MODULE_ELEMENT_NAME); |
| 258 | while (pModule != NULL) |
| 259 | { |
| 260 | const XnChar* strModulePath = NULL; |
| 261 | nRetVal = xnXmlReadStringAttribute(pModule, "path", &strModulePath); |
| 262 | XN_IS_STATUS_OK(nRetVal); |
| 263 | |
| 264 | const XnChar* strConfigDir = pModule->Attribute("configDir"); |
| 265 | #if XN_PLATFORM == XN_PLATFORM_ANDROID_ARM |
| 266 | if (strConfigDir != NULL) |
| 267 | { |
| 268 | // In Android we treat the provided config dir as relative to the app root dir |
| 269 | // so we have to append a suffix |
| 270 | XnChar strActualConfigDir[1024]; |
| 271 | xnOSGetApplicationFilesDir(strActualConfigDir, sizeof(strActualConfigDir)); |
| 272 | strncat(strActualConfigDir, strConfigDir, sizeof(strActualConfigDir)); |
| 273 | strConfigDir = strActualConfigDir; |
| 274 | } |
| 275 | #endif |
| 276 | nRetVal = LoadModule(strModulePath, strConfigDir); |
| 277 | XN_IS_STATUS_OK(nRetVal); |
| 278 | |
| 279 | pModule = pModule->NextSiblingElement(XN_MODULE_ELEMENT_NAME); |
| 280 | } |
| 281 | |
| 282 | if (m_loadingMode == LOADING_MODE_LOAD && m_AllGenerators.Size() == 0) |
| 283 | { |
| 284 | return (XN_STATUS_NO_MODULES_FOUND); |
| 285 | } |
| 286 | |
| 287 | return (XN_STATUS_OK); |
| 288 | } |
| 289 | |
| 290 | XnStatus XnModuleLoader::LoadModule(const XnChar* strFileName, const XnChar* strConfigDir) |
| 291 | { |
nothing calls this directly
no test coverage detected