----------------------------------------------------------------------------- Try to find and load an XML file describing the device's config params -----------------------------------------------------------------------------
| 293 | // Try to find and load an XML file describing the device's config params |
| 294 | //----------------------------------------------------------------------------- |
| 295 | bool ManufacturerSpecific::LoadConfigXML |
| 296 | ( |
| 297 | ) |
| 298 | { |
| 299 | if (GetNodeUnsafe()->getConfigPath().size() == 0) |
| 300 | return false; |
| 301 | |
| 302 | |
| 303 | string configPath; |
| 304 | Options::Get()->GetOptionAsString( "ConfigPath", &configPath ); |
| 305 | |
| 306 | string filename = configPath + GetNodeUnsafe()->getConfigPath(); |
| 307 | |
| 308 | TiXmlDocument* doc = new TiXmlDocument(); |
| 309 | Log::Write( LogLevel_Info, GetNodeId(), " Opening config param file %s", filename.c_str() ); |
| 310 | if( !doc->LoadFile( filename.c_str(), TIXML_ENCODING_UTF8 ) ) |
| 311 | { |
| 312 | delete doc; |
| 313 | Log::Write( LogLevel_Info, GetNodeId(), "Unable to find or load Config Param file %s", filename.c_str() ); |
| 314 | return false; |
| 315 | } |
| 316 | doc->SetUserData((void *)filename.c_str()); |
| 317 | Node::QueryStage qs = GetNodeUnsafe()->GetCurrentQueryStage(); |
| 318 | if( qs == Node::QueryStage_ManufacturerSpecific1 ) |
| 319 | { |
| 320 | GetNodeUnsafe()->ReadDeviceProtocolXML( doc->RootElement() ); |
| 321 | } |
| 322 | else |
| 323 | { |
| 324 | if( ! GetNodeUnsafe()->m_manufacturerSpecificClassReceived ) |
| 325 | { |
| 326 | GetNodeUnsafe()->ReadDeviceProtocolXML( doc->RootElement() ); |
| 327 | } |
| 328 | } |
| 329 | GetNodeUnsafe()->ReadCommandClassesXML( doc->RootElement() ); |
| 330 | GetNodeUnsafe()->ReadMetaDataFromXML( doc->RootElement() ); |
| 331 | delete doc; |
| 332 | return true; |
| 333 | } |
| 334 | |
| 335 | //----------------------------------------------------------------------------- |
| 336 | // <ManufacturerSpecific::ReLoadConfigXML> |
no test coverage detected