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

Method HandleIsFailedNodeResponse

cpp/src/Driver.cpp:3074–3111  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Process a response from the Z-Wave PC interface -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3072// Process a response from the Z-Wave PC interface
3073//-----------------------------------------------------------------------------
3074void Driver::HandleIsFailedNodeResponse
3075(
3076 uint8* _data
3077)
3078{
3079 ControllerState state;
3080 uint8 nodeId = m_currentControllerCommand ? m_currentControllerCommand->m_controllerCommandNode : GetNodeNumber( m_currentMsg );
3081 if( _data[2] )
3082 {
3083 Log::Write( LogLevel_Warning, nodeId, "WARNING: Received reply to FUNC_ID_ZW_IS_FAILED_NODE_ID - node %d failed", nodeId );
3084 state = ControllerState_NodeFailed;
3085 if( Node* node = GetNodeUnsafe( nodeId ) )
3086 {
3087 if (node->IsNodeReset()) {
3088 /* a DeviceReset has Occured. Remove the Node */
3089 if (!BeginControllerCommand(Driver::ControllerCommand_RemoveFailedNode, NULL, NULL, true, nodeId, 0))
3090 Log::Write(LogLevel_Warning, nodeId, "RemoveFailedNode for DeviceResetLocally Command Failed");
3091
3092 Notification* notification = new Notification( Notification::Type_NodeReset );
3093 notification->SetHomeAndNodeIds( m_homeId, nodeId );
3094 QueueNotification( notification );
3095 state = ControllerState_Completed;
3096 } else {
3097 node->SetNodeAlive( false );
3098 }
3099 }
3100 }
3101 else
3102 {
3103 Log::Write( LogLevel_Warning, nodeId, "Received reply to FUNC_ID_ZW_IS_FAILED_NODE_ID - node %d has not failed", nodeId );
3104 if( Node* node = GetNodeUnsafe( nodeId ) )
3105 {
3106 node->SetNodeAlive( true );
3107 }
3108 state = ControllerState_NodeOK;
3109 }
3110 UpdateControllerState( state );
3111}
3112
3113//-----------------------------------------------------------------------------
3114// <Driver::HandleReplaceFailedNodeResponse>

Callers

nothing calls this directly

Calls 3

WriteFunction · 0.85
IsNodeResetMethod · 0.80
SetNodeAliveMethod · 0.80

Tested by

no test coverage detected