private void handleSendDataRequest ( SerialMessage incomingMessage ) { logger . trace ( "Handle Message Send Data Request" ) ; int callbackId = incomingMessage . getMessagePayloadByte ( 0 ) ; TransmissionState status = TransmissionState . getTransmissionState ( incomingMessage . getMessagePayloadByte ( 1 ) ) ; SerialMessage originalMessage = this . lastSentMessage ; if ( status == null ) { logger . warn ( "Transmission state not found, ignoring." ) ; return ; } logger . debug ( "CallBack ID = {}" , callbackId ) ; logger . debug ( String . format ( "Status = %s (0x%02x)" , status . getLabel ( ) , status . getKey ( ) ) ) ; if ( originalMessage == null || originalMessage . getCallbackId ( ) != callbackId ) { logger . warn ( "Already processed another send data request for this callback Id, ignoring." ) ; return ; } switch ( status ) { case COMPLETE_OK : ZWaveNode node = this . getNode ( originalMessage . getMessageNode ( ) ) ; node . resetResendCount ( ) ; // in case we received a ping response and the node is alive, we proceed with the next node stage for this node. if ( node != null && node . getNodeStage ( ) == NodeStage . NODEBUILDINFO_PING ) { node . advanceNodeStage ( ) ; } if ( incomingMessage . getMessageClass ( ) == originalMessage . getExpectedReply ( ) && ! incomingMessage . isTransActionCanceled ( ) ) { notifyEventListeners ( new ZWaveEvent ( ZWaveEventType . TRANSACTION_COMPLETED_EVENT , this . lastSentMessage . getMessageNode ( ) , 1 , this . lastSentMessage ) ) ; transactionCompleted . release ( ) ; logger . trace ( "Released. Transaction completed permit count -> {}" , transactionCompleted . availablePermits ( ) ) ; } return ; case COMPLETE_NO_ACK : case COMPLETE_FAIL : case COMPLETE_NOT_IDLE : case COMPLETE_NOROUTE : try { handleFailedSendDataRequest ( originalMessage ) ; } finally { transactionCompleted . release ( ) ; logger . trace ( "Released. Transaction completed permit count -> {}" , transactionCompleted . availablePermits ( ) ) ; } default : } }
Handles incoming Send Data Request . Send Data request are used to acknowledge or cancel failed messages .