void checkValidity ( ) throws ModbusException { if ( request != null && response != null ) { if ( request . getUnitID ( ) != response . getUnitID ( ) ) { throw new ModbusIOException ( "Unit ID mismatch - Request [%s] Response [%s]" , request . getHexMessage ( ) , response . getHexMessage ( ) ) ; } if ( request . getFunctionCode ( ) != response . getFunctionCode ( ) ) { throw new ModbusIOException ( "Function code mismatch - Request [%s] Response [%s]" , request . getHexMessage ( ) , response . getHexMessage ( ) ) ; } } }
Checks the validity of the transaction by checking if the values of the response correspond to the values of the request .