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

Method SetNodeAlive

cpp/src/Node.cpp:1902–1937  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Track alive state of a node for dead node detection. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1900// Track alive state of a node for dead node detection.
1901//-----------------------------------------------------------------------------
1902void Node::SetNodeAlive
1903(
1904 bool const _isAlive
1905)
1906{
1907 Notification* notification;
1908
1909 if( _isAlive )
1910 {
1911 Log::Write( LogLevel_Error, m_nodeId, "WARNING: node revived" );
1912 m_nodeAlive = true;
1913 m_errors = 0;
1914 if( m_queryStage != Node::QueryStage_Complete )
1915 {
1916 m_queryRetries = 0; // restart at last stage
1917 AdvanceQueries();
1918 }
1919 notification = new Notification( Notification::Type_Notification );
1920 notification->SetHomeAndNodeIds( m_homeId, m_nodeId );
1921 notification->SetNotification( Notification::Code_Alive );
1922 }
1923 else
1924 {
1925 Log::Write( LogLevel_Error, m_nodeId, "ERROR: node presumed dead" );
1926 m_nodeAlive = false;
1927 if( m_queryStage != Node::QueryStage_Complete )
1928 {
1929 // Check whether all nodes are now complete
1930 GetDriver()->CheckCompletedNodeQueries();
1931 }
1932 notification = new Notification( Notification::Type_Notification );
1933 notification->SetHomeAndNodeIds( m_homeId, m_nodeId );
1934 notification->SetNotification( Notification::Code_Dead );
1935 }
1936 GetDriver()->QueueNotification( notification );
1937}
1938
1939//-----------------------------------------------------------------------------
1940// <Node::SetStaticRequests>

Calls 3

WriteFunction · 0.85
QueueNotificationMethod · 0.80

Tested by

no test coverage detected