private void handleSerialApiGetInitDataResponse ( SerialMessage incomingMessage ) { logger . debug ( String . format ( "Got MessageSerialApiGetInitData response." ) ) ; this . isConnected = true ; int nodeBytes = incomingMessage . getMessagePayloadByte ( 2 ) ; if ( nodeBytes != NODE_BYTES ) { logger . error ( "Invalid number of node bytes = {}" , nodeBytes ) ; return ; } int nodeId = 1 ; // loop bytes for ( int i = 3 ; i < 3 + nodeBytes ; i ++ ) { int incomingByte = incomingMessage . getMessagePayloadByte ( i ) ; // loop bits in byte for ( int j = 0 ; j < 8 ; j ++ ) { int b1 = incomingByte & ( int ) Math . pow ( 2.0D , j ) ; int b2 = ( int ) Math . pow ( 2.0D , j ) ; if ( b1 == b2 ) { logger . info ( String . format ( "Found node id = %d" , nodeId ) ) ; // Place nodes in the local ZWave Controller this . zwaveNodes . put ( nodeId , new ZWaveNode ( this . homeId , nodeId , this ) ) ; this . getNode ( nodeId ) . advanceNodeStage ( ) ; } nodeId ++ ; } } logger . info ( "------------Number of Nodes Found Registered to ZWave Controller------------" ) ; logger . info ( String . format ( "# Nodes = %d" , this . zwaveNodes . size ( ) ) ) ; logger . info ( "----------------------------------------------------------------------------" ) ; // Advance node stage for the first node. }
Handles the response of the SerialApiGetInitData request .