@ Override public void channelRead ( ChannelHandlerContext ctx , Object msg ) { if ( msg instanceof Frame ) { Frame frame = ( Frame ) msg ; if ( hasCurrentTransaction ( ) ) { String tid = currentDataFrameTransaction . getId ( ) ; logger . trace ( "Received frame within transaction ({}) context: {}" , tid , frame ) ; // give new frame to current transaction NettyZWaveChannelContext zctx = new NettyZWaveChannelContext ( ) ; if ( currentDataFrameTransaction . addFrame ( zctx , frame ) ) { if ( currentDataFrameTransaction . isComplete ( ) ) { logger . trace ( "*** Data frame transaction ({}) completed" , tid ) ; logger . trace ( "" ) ; cancelTimeoutCallback ( ) ; } zctx . process ( ctx ) ; // if transaction didn't consume frame, then pass it down the pipeline } else { logger . trace ( "Transaction ignored frame so passing it along" ) ; ctx . fireChannelRead ( msg ) ; } } else if ( msg instanceof AddNodeToNetwork ) { logger . trace ( "Received ADD_NODE_STATUS_NODE_FOUND; starting transaction" ) ; NettyZWaveChannelContext zctx = new NettyZWaveChannelContext ( ) ; currentDataFrameTransaction = new NodeInclusionTransaction ( zctx , ( DataFrame ) msg ) ; zctx . process ( ctx ) ; } else { logger . trace ( "Received frame outside of transaction context so passing it along: {}" , frame ) ; ctx . fireChannelRead ( msg ) ; } } }
Called when data is read from the Z - Wave network .