protected void readEcho ( int len ) throws IOException { byte echoBuf [ ] = new byte [ len ] ; int echoLen = commPort . readBytes ( echoBuf , len ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Echo: {}" , ModbusUtil . toHex ( echoBuf , 0 , echoLen ) ) ; } if ( echoLen != len ) { logger . debug ( "Error: Transmit echo not received" ) ; throw new IOException ( "Echo not received" ) ; } }
Reads the own message echo produced in RS485 Echo Mode within the given time frame .