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

Method IsNodeAwake

cpp/src/Manager.cpp:1589–1614  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Helper method to return whether a node is awake or sleeping -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1587// Helper method to return whether a node is awake or sleeping
1588//-----------------------------------------------------------------------------
1589bool Manager::IsNodeAwake
1590(
1591 uint32 const _homeId,
1592 uint8 const _nodeId
1593)
1594{
1595 if( IsNodeListeningDevice( _homeId, _nodeId ) )
1596 {
1597 return true; // if listening then always awake
1598 }
1599 bool result = true;
1600 if( Driver* driver = GetDriver( _homeId ) )
1601 {
1602 // Need to lock and unlock nodes to check this information
1603 LockGuard LG(driver->m_nodeMutex);
1604
1605 if( Node* node = driver->GetNode( _nodeId ) )
1606 {
1607 if( WakeUp* wcc = static_cast<WakeUp*>( node->GetCommandClass( WakeUp::StaticGetCommandClassId() ) ) )
1608 {
1609 result = wcc->IsAwake();
1610 }
1611 }
1612 }
1613 return result;
1614}
1615
1616//-----------------------------------------------------------------------------
1617// <Manager::IsNodeFailed>

Callers

nothing calls this directly

Calls 3

GetNodeMethod · 0.80
GetCommandClassMethod · 0.80
IsAwakeMethod · 0.80

Tested by

no test coverage detected