MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / LoadConfigXML

Method LoadConfigXML

cpp/src/command_classes/ManufacturerSpecific.cpp:295–333  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Try to find and load an XML file describing the device's config params -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

293// Try to find and load an XML file describing the device's config params
294//-----------------------------------------------------------------------------
295bool 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>

Callers 1

AdvanceQueriesMethod · 0.80

Calls 14

WriteFunction · 0.85
getConfigPathMethod · 0.80
GetOptionAsStringMethod · 0.80
SetUserDataMethod · 0.80
GetCurrentQueryStageMethod · 0.80
ReadDeviceProtocolXMLMethod · 0.80
RootElementMethod · 0.80
ReadCommandClassesXMLMethod · 0.80
ReadMetaDataFromXMLMethod · 0.80
GetNodeIdFunction · 0.70
GetFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected