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

Method CheckCompletedNodeQueries

cpp/src/Driver.cpp:1620–1690  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Identify controller (as opposed to node) commands...especially blocking ones -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1618// Identify controller (as opposed to node) commands...especially blocking ones
1619//-----------------------------------------------------------------------------
1620void Driver::CheckCompletedNodeQueries
1621(
1622)
1623{
1624 Log::Write( LogLevel_Warning, "CheckCompletedNodeQueries m_allNodesQueried=%d m_awakeNodesQueried=%d", m_allNodesQueried, m_awakeNodesQueried );
1625 if( !m_allNodesQueried )
1626 {
1627 bool all = true;
1628 bool sleepingOnly = true;
1629 bool deadFound = false;
1630
1631 {
1632 LockGuard LG(m_nodeMutex);
1633 for( int i=0; i<256; ++i )
1634 {
1635 if( m_nodes[i] )
1636 {
1637 if ( m_nodes[i]->GetCurrentQueryStage() != Node::QueryStage_Complete )
1638 {
1639 if( !m_nodes[i]->IsNodeAlive() )
1640 {
1641 deadFound = true;
1642 continue;
1643 }
1644 all = false;
1645 if( m_nodes[i]->IsListeningDevice() )
1646 {
1647 sleepingOnly = false;
1648 }
1649 }
1650 }
1651 }
1652 }
1653
1654 Log::Write( LogLevel_Warning, "CheckCompletedNodeQueries all=%d, deadFound=%d sleepingOnly=%d", all, deadFound, sleepingOnly );
1655 if( all )
1656 {
1657 if( deadFound )
1658 {
1659 // only dead nodes left to query
1660 Log::Write( LogLevel_Info, " Node query processing complete except for dead nodes." );
1661 Notification* notification = new Notification( Notification::Type_AllNodesQueriedSomeDead );
1662 notification->SetHomeAndNodeIds( m_homeId, 0xff );
1663 QueueNotification( notification );
1664 }
1665 else
1666 {
1667 // no sleeping nodes, no dead nodes and no more nodes in the queue, so...All done
1668 Log::Write( LogLevel_Info, " Node query processing complete." );
1669 Notification* notification = new Notification( Notification::Type_AllNodesQueried );
1670 notification->SetHomeAndNodeIds( m_homeId, 0xff );
1671 QueueNotification( notification );
1672 }
1673 m_awakeNodesQueried = true;
1674 m_allNodesQueried = true;
1675 }
1676 else if( sleepingOnly )
1677 {

Callers 2

AdvanceQueriesMethod · 0.80
SetNodeAliveMethod · 0.80

Calls 4

WriteFunction · 0.85
GetCurrentQueryStageMethod · 0.80
IsNodeAliveMethod · 0.80
IsListeningDeviceMethod · 0.80

Tested by

no test coverage detected