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

Method WriteXML

cpp/src/command_classes/CommandClass.cpp:443–512  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Save the static node configuration data -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

441// Save the static node configuration data
442//-----------------------------------------------------------------------------
443void CommandClass::WriteXML
444(
445 TiXmlElement* _ccElement
446)
447{
448 char str[32];
449
450 m_com.WriteXML(_ccElement);
451 m_dom.WriteXML(_ccElement);
452
453
454 snprintf( str, sizeof(str), "%d", GetCommandClassId() );
455 _ccElement->SetAttribute( "id", str );
456 _ccElement->SetAttribute( "name", GetCommandClassName().c_str() );
457
458
459
460
461 // Write out the instances
462 for( Bitfield::Iterator it = m_instances.Begin(); it != m_instances.End(); ++ it )
463 {
464 TiXmlElement* instanceElement = new TiXmlElement( "Instance" );
465 _ccElement->LinkEndChild( instanceElement );
466
467 snprintf( str, sizeof(str), "%d", *it );
468 instanceElement->SetAttribute( "index", str );
469
470 map<uint8,uint8>::iterator eit = m_endPointMap.find( *it );
471 if( eit != m_endPointMap.end() )
472 {
473 snprintf( str, sizeof(str), "%d", eit->second );
474 instanceElement->SetAttribute( "endpoint", str );
475 }
476 if ( m_instanceLabel.count(*it) > 0 )
477 instanceElement->SetAttribute( "label", GetInstanceLabel(*it).c_str());
478 }
479
480 // Write out the values for this command class
481 ValueStore* store = GetNodeUnsafe()->GetValueStore();
482 for( ValueStore::Iterator it = store->Begin(); it != store->End(); ++it )
483 {
484 Value* value = it->second;
485 if( value->GetID().GetCommandClassId() == GetCommandClassId() )
486 {
487 TiXmlElement* valueElement = new TiXmlElement( "Value" );
488 _ccElement->LinkEndChild( valueElement );
489 value->WriteXML( valueElement );
490 }
491 }
492 // Write out the TriggerRefreshValue if it exists
493 for (uint32 i = 0; i < m_RefreshClassValues.size(); i++)
494 {
495 RefreshValue *rcc = m_RefreshClassValues.at(i);
496 TiXmlElement* RefreshElement = new TiXmlElement("TriggerRefreshValue");
497 _ccElement->LinkEndChild( RefreshElement );
498 RefreshElement->SetAttribute("Genre", Value::GetGenreNameFromEnum((ValueID::ValueGenre)rcc->genre));
499 RefreshElement->SetAttribute("Instance", rcc->instance);
500 RefreshElement->SetAttribute("Index", rcc->index);

Callers

nothing calls this directly

Calls 11

GetCommandClassIdFunction · 0.85
SetAttributeMethod · 0.80
LinkEndChildMethod · 0.80
findMethod · 0.80
GetValueStoreMethod · 0.80
c_strMethod · 0.45
BeginMethod · 0.45
EndMethod · 0.45
endMethod · 0.45
GetCommandClassIdMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected