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

Method LoadConfigFileRevision

cpp/src/ManufacturerSpecificDB.cpp:99–135  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Load the Config File Revision from each config file specified in our ManufacturerSpecific.xml file -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

97// ManufacturerSpecific.xml file
98//-----------------------------------------------------------------------------
99void ManufacturerSpecificDB::LoadConfigFileRevision
100(
101 ProductDescriptor *product
102)
103{
104 // Parse the Z-Wave manufacturer and product XML file.
105 string configPath;
106 Options::Get()->GetOptionAsString( "ConfigPath", &configPath );
107
108 if (product->GetConfigPath().size() > 0) {
109 string path = configPath + product->GetConfigPath();
110
111 TiXmlDocument* pDoc = new TiXmlDocument();
112 if( !pDoc->LoadFile( path.c_str(), TIXML_ENCODING_UTF8 ) )
113 {
114 delete pDoc;
115 Log::Write( LogLevel_Info, "Unable to load config file %s", path.c_str() );
116 return;
117 }
118 pDoc->SetUserData((void *)path.c_str());
119 TiXmlElement const* root = pDoc->RootElement();
120 char const *str = root->Value();
121 if( str && !strcmp( str, "Product" ) )
122 {
123 // Read in the revision attributes
124 str = root->Attribute( "Revision" );
125 if( !str )
126 {
127 Log::Write( LogLevel_Info, "Error in Product Config file at line %d - missing Revision attribute", root->Row() );
128 delete pDoc;
129 return;
130 }
131 product->SetConfigRevision(atol(str));
132 }
133 delete pDoc;
134 }
135}
136
137
138//-----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 13

WriteFunction · 0.85
GetOptionAsStringMethod · 0.80
GetConfigPathMethod · 0.80
SetUserDataMethod · 0.80
RootElementMethod · 0.80
AttributeMethod · 0.80
RowMethod · 0.80
SetConfigRevisionMethod · 0.80
GetFunction · 0.70
sizeMethod · 0.45
LoadFileMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected