----------------------------------------------------------------------------- Process a request from the Z-Wave PC interface -----------------------------------------------------------------------------
| 3974 | // Process a request from the Z-Wave PC interface |
| 3975 | //----------------------------------------------------------------------------- |
| 3976 | bool Driver::HandleApplicationUpdateRequest |
| 3977 | ( |
| 3978 | uint8* _data |
| 3979 | ) |
| 3980 | { |
| 3981 | bool messageRemoved = false; |
| 3982 | uint8 nodeId = _data[3]; |
| 3983 | Node* node = GetNodeUnsafe( nodeId ); |
| 3984 | |
| 3985 | // If node is not alive, mark it alive now |
| 3986 | if( node != NULL && !node->IsNodeAlive() ) |
| 3987 | { |
| 3988 | node->SetNodeAlive( true ); |
| 3989 | } |
| 3990 | |
| 3991 | switch( _data[2] ) |
| 3992 | { |
| 3993 | case UPDATE_STATE_SUC_ID: |
| 3994 | { |
| 3995 | Log::Write( LogLevel_Info, nodeId, "UPDATE_STATE_SUC_ID from node %d", nodeId ); |
| 3996 | m_SUCNodeId = nodeId; // need to confirm real data here |
| 3997 | break; |
| 3998 | } |
| 3999 | case UPDATE_STATE_DELETE_DONE: |
| 4000 | { |
| 4001 | Log::Write( LogLevel_Info, nodeId, "** Network change **: Z-Wave node %d was removed", nodeId ); |
| 4002 | { |
| 4003 | LockGuard LG(m_nodeMutex); |
| 4004 | delete m_nodes[nodeId]; |
| 4005 | m_nodes[nodeId] = NULL; |
| 4006 | } |
| 4007 | Notification* notification = new Notification( Notification::Type_NodeRemoved ); |
| 4008 | notification->SetHomeAndNodeIds( m_homeId, nodeId ); |
| 4009 | QueueNotification( notification ); |
| 4010 | break; |
| 4011 | } |
| 4012 | case UPDATE_STATE_NEW_ID_ASSIGNED: |
| 4013 | { |
| 4014 | Log::Write( LogLevel_Info, nodeId, "** Network change **: ID %d was assigned to a new Z-Wave node", nodeId ); |
| 4015 | // Check if the new node id is equal to the current one.... if so no operation is needed, thus no remove and add is necessary |
| 4016 | if ( _data[3] != _data[6] ) |
| 4017 | { |
| 4018 | // Request the node protocol info (also removes any existing node and creates a new one) |
| 4019 | InitNode( nodeId ); |
| 4020 | } |
| 4021 | else |
| 4022 | { |
| 4023 | Log::Write(LogLevel_Info, nodeId, "Not Re-assigning NodeID as old and new NodeID match"); |
| 4024 | } |
| 4025 | |
| 4026 | break; |
| 4027 | } |
| 4028 | case UPDATE_STATE_ROUTING_PENDING: |
| 4029 | { |
| 4030 | Log::Write( LogLevel_Info, nodeId, "UPDATE_STATE_ROUTING_PENDING from node %d", nodeId ); |
| 4031 | break; |
| 4032 | } |
| 4033 | case UPDATE_STATE_NODE_INFO_REQ_FAILED: |
nothing calls this directly
no test coverage detected