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

Method ReadXML

cpp/src/command_classes/CommandClass.cpp:242–316  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Read the saved command class data -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

240// Read the saved command class data
241//-----------------------------------------------------------------------------
242void CommandClass::ReadXML
243(
244 TiXmlElement const* _ccElement
245)
246{
247 int32 intVal;
248 char const* str;
249
250 m_com.ReadXML(_ccElement);
251 m_dom.ReadXML(_ccElement);
252
253 // Apply any differences from the saved XML to the values
254 TiXmlElement const* child = _ccElement->FirstChildElement();
255 while( child )
256 {
257 str = child->Value();
258 if( str )
259 {
260 if( !strcmp( str, "Instance" ) )
261 {
262 uint8 instance = 0;
263 // Add an instance to the command class
264 if( TIXML_SUCCESS == child->QueryIntAttribute( "index", &intVal ) )
265 {
266 instance = (uint8)intVal;
267 SetInstance( instance );
268 }
269 // See if its associated endpoint is present
270 if( TIXML_SUCCESS == child->QueryIntAttribute( "endpoint", &intVal ) )
271 {
272 uint8 endpoint = (uint8)intVal;
273 SetEndPoint( instance, endpoint );
274 }
275 str = child->Attribute( "label");
276 if ( str )
277 {
278 SetInstanceLabel(instance, (char *)str);
279 Localization::Get()->SetGlobalLabel(str, str, "");
280 TiXmlElement const *labellang = child->FirstChildElement();
281 while ( labellang )
282 {
283 char const* str2 = labellang->Value();
284 if ( str2 && !strcmp( str2, "Label" ) )
285 {
286 char const *lang = labellang->Attribute("lang");
287 Localization::Get()->SetGlobalLabel(str, labellang->GetText(), lang);
288 }
289 labellang = labellang->NextSiblingElement();
290 }
291 }
292 }
293 else if( !strcmp( str, "Value" ) )
294 {
295 // Apply any differences from the saved XML to the value
296 GetNodeUnsafe()->ReadValueFromXML( GetCommandClassId(), child );
297 }
298 else if (!strcmp( str, "TriggerRefreshValue" ) )
299 {

Callers

nothing calls this directly

Calls 14

SetEndPointFunction · 0.85
GetCommandClassIdFunction · 0.85
QueryIntAttributeMethod · 0.80
AttributeMethod · 0.80
SetGlobalLabelMethod · 0.80
GetTextMethod · 0.80
ReadValueFromXMLMethod · 0.80
GetFlagBoolMethod · 0.80
GetValueStoreMethod · 0.80
GetFunction · 0.50
FirstChildElementMethod · 0.45

Tested by

no test coverage detected