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

Method ReloadNode

cpp/src/Driver.cpp:7427–7474  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Queue an item on the query queue that indicates a stage is complete -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

7425// Queue an item on the query queue that indicates a stage is complete
7426//-----------------------------------------------------------------------------
7427void Driver::ReloadNode
7428(
7429 uint8 const _nodeId
7430)
7431{
7432 LockGuard LG(m_nodeMutex);
7433 Log::Write( LogLevel_Detail, _nodeId, "Reloading Node");
7434 /* delete any cached information about this node so we start from fresh */
7435 char str[32];
7436 int32 intVal;
7437
7438 string userPath;
7439 Options::Get()->GetOptionAsString( "UserPath", &userPath );
7440
7441 snprintf( str, sizeof(str), "ozwcache_0x%08x.xml", m_homeId );
7442 string filename = userPath + string(str);
7443
7444 TiXmlDocument doc;
7445 if( doc.LoadFile( filename.c_str(), TIXML_ENCODING_UTF8 ) )
7446 {
7447 doc.SetUserData((void *)filename.c_str());
7448 TiXmlElement * driverElement = doc.RootElement();
7449
7450 TiXmlNode * nodeElement = driverElement->FirstChild();
7451 while( nodeElement )
7452 {
7453 if (nodeElement->ToElement()) {
7454 char const* str2 = nodeElement->ToElement()->Value();
7455 if( str2 && !strcmp( str2, "Node" ) )
7456 {
7457 // Get the node Id from the XML
7458 if( TIXML_SUCCESS == nodeElement->ToElement()->QueryIntAttribute( "id", &intVal ) )
7459 {
7460 if (intVal == _nodeId) {
7461 driverElement->RemoveChild(nodeElement);
7462 break;
7463 }
7464 }
7465 }
7466 }
7467 nodeElement = nodeElement->NextSibling();
7468 }
7469 }
7470 doc.SaveFile(filename.c_str());
7471 LG.Unlock();
7472
7473 InitNode(_nodeId);
7474}
7475
7476
7477

Callers 2

RefreshNodeInfoMethod · 0.80
SendPendingMethod · 0.80

Calls 15

WriteFunction · 0.85
GetOptionAsStringMethod · 0.80
SetUserDataMethod · 0.80
RootElementMethod · 0.80
QueryIntAttributeMethod · 0.80
RemoveChildMethod · 0.80
GetFunction · 0.70
LoadFileMethod · 0.45
c_strMethod · 0.45
FirstChildMethod · 0.45
ToElementMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected