public void onApplicationUpdate ( ZWaveControllerContext context , ApplicationUpdate update ) { switch ( nodeState ) { case NodeInfo : // if the application update failed to send, re-send it if ( update . didInfoRequestFail ( ) ) { if ( stateRetries < 1 ) { logger . trace ( "Application update failed for node {}; will retry" , getNodeId ( ) ) ; sendDataFrame ( context , new RequestNodeInfo ( getNodeId ( ) ) ) ; stateRetries ++ ; } else { if ( isListeningNode ( ) ) { logger . trace ( "Node {} provided no node info after {} retries; should be listening so flagging as unavailable and started" , getNodeId ( ) , stateRetries ) ; available = false ; setState ( context , ZWaveNodeState . Started ) ; } else { logger . trace ( "Node {} provided no node info after {} retries; not flagged as listening so assuming it's asleep" , getNodeId ( ) , stateRetries ) ; available = true ; setState ( context , ZWaveNodeState . Started ) ; } } } else { // check if there are optional command classes byte [ ] commandClasses = update . getNodeInfo ( ) . getCommandClasses ( ) ; for ( byte commandClassId : commandClasses ) { if ( ! hasCommandClass ( commandClassId ) ) { CommandClass cc = CommandClassFactory . createCommandClass ( commandClassId ) ; if ( cc != null ) { addCommandClass ( commandClassId , cc ) ; } else { logger . trace ( "Ignoring optional command class: {}" , ByteUtil . createString ( commandClassId ) ) ; } } } // if this node has the Version command class, then we should retrieve version for information // for all command classes it supports if ( getCommandClass ( VersionCommandClass . ID ) != null ) { setState ( context , ZWaveNodeState . RetrieveVersionPending ) ; // otherwise, we assume all command classes are version 1 and move on } else { setState ( context , ZWaveNodeState . RetrieveStatePending ) ; } } break ; default : logger . trace ( "Unsolicited ApplicationUpdate received; refreshing node" ) ; refresh ( false ) ; break ; } }
Called when an application update message is received for this node .