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

Method HandleErrorResponse

cpp/src/Driver.cpp:1562–1614  ·  view source on GitHub ↗

----------------------------------------------------------------------------- For messages that return a ZW_SEND_DATA response, process the results here If it is a non-listeing (sleeping) node return true. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1560// If it is a non-listeing (sleeping) node return true.
1561//-----------------------------------------------------------------------------
1562bool Driver::HandleErrorResponse
1563(
1564 uint8 const _error,
1565 uint8 const _nodeId,
1566 char const* _funcStr,
1567 bool _sleepCheck // = 0
1568)
1569{
1570 // Only called with a ZW_SEND_DATA error response. We count and output the message here.
1571 if( _error == TRANSMIT_COMPLETE_NOROUTE )
1572 {
1573 m_badroutes++;
1574 Log::Write( LogLevel_Info, _nodeId, "ERROR: %s failed. No route available.", _funcStr );
1575 }
1576 else if( _error == TRANSMIT_COMPLETE_NO_ACK )
1577 {
1578 m_noack++;
1579 Log::Write( LogLevel_Info, _nodeId, "WARNING: %s failed. No ACK received - device may be asleep.", _funcStr );
1580 if( m_currentMsg )
1581 {
1582 // In case the failure is due to the target being a sleeping node, we
1583 // first try to move its pending messages to its wake-up queue.
1584 if( MoveMessagesToWakeUpQueue( m_currentMsg->GetTargetNodeId(), _sleepCheck ) )
1585 {
1586 return true;
1587 }
1588 Log::Write( LogLevel_Warning, _nodeId, "WARNING: Device is not a sleeping node." );
1589 }
1590 }
1591 else if( _error == TRANSMIT_COMPLETE_FAIL )
1592 {
1593 m_netbusy++;
1594 Log::Write( LogLevel_Info, _nodeId, "ERROR: %s failed. Network is busy.", _funcStr );
1595 }
1596 else if( _error == TRANSMIT_COMPLETE_NOT_IDLE )
1597 {
1598 m_notidle++;
1599 Log::Write( LogLevel_Info, _nodeId, "ERROR: %s failed. Network is busy.", _funcStr );
1600 }
1601 else if ( _error == TRANSMIT_COMPLETE_VERIFIED )
1602 {
1603 m_txverified++;
1604 Log::Write( LogLevel_Info, _nodeId, "ERROR: %s failed. Transmit Verified.", _funcStr );
1605 }
1606 if( Node* node = GetNodeUnsafe( _nodeId ) )
1607 {
1608 if( ++node->m_errors >= 3 )
1609 {
1610 node->SetNodeAlive( false );
1611 }
1612 }
1613 return false;
1614}
1615
1616//-----------------------------------------------------------------------------
1617// <Driver::CheckCompletedNodeQueries>

Callers

nothing calls this directly

Calls 2

WriteFunction · 0.85
SetNodeAliveMethod · 0.80

Tested by

no test coverage detected