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

Method IsExpectedReply

cpp/src/Driver.cpp:1696–1728  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Determine if the reply is from the node we are expecting. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1694// Determine if the reply is from the node we are expecting.
1695//-----------------------------------------------------------------------------
1696bool Driver::IsExpectedReply
1697(
1698 const uint8 _nodeId
1699)
1700{
1701 // Accept all controller commands or where the protocol doesn't identify the actual node
1702 if( m_expectedNodeId == 255 || _nodeId == 0 )
1703 {
1704 return true;
1705 }
1706 // Accept all messages that do not convey source node identification.
1707 if( m_expectedReply == FUNC_ID_ZW_GET_NODE_PROTOCOL_INFO ||
1708 m_expectedReply == FUNC_ID_ZW_REQUEST_NODE_INFO ||
1709 m_expectedReply == FUNC_ID_ZW_GET_ROUTING_INFO ||
1710 m_expectedReply == FUNC_ID_ZW_ASSIGN_RETURN_ROUTE ||
1711 m_expectedReply == FUNC_ID_ZW_DELETE_RETURN_ROUTE ||
1712 m_expectedReply == FUNC_ID_ZW_SEND_DATA ||
1713 m_expectedReply == FUNC_ID_ZW_SEND_NODE_INFORMATION ||
1714 m_expectedReply == FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE ||
1715 m_expectedReply == FUNC_ID_ZW_ENABLE_SUC ||
1716 m_expectedReply == FUNC_ID_ZW_SET_SUC_NODE_ID ||
1717 m_expectedReply == FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE_OPTIONS )
1718 {
1719 return true;
1720 }
1721 // Accept if source message contains node info and it is from the one we are expecting
1722 if( m_expectedNodeId == _nodeId )
1723 {
1724 return true;
1725 }
1726 Log::Write( LogLevel_Detail, "IsExpectedReply: m_expectedNodeId = %d m_expectedReply = %02x", m_expectedNodeId, m_expectedReply );
1727 return false;
1728}
1729//-----------------------------------------------------------------------------
1730// Receiving Z-Wave messages
1731//-----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

WriteFunction · 0.85

Tested by

no test coverage detected