ModbusResponse updateResponseWithHeader(ModbusResponse response, boolean ignoreFunctionCode) {

        // transfer header data
        response.setHeadless(isHeadless());
        if (!isHeadless()) {
            response.setTransactionID(getTransactionID());
            response.setProtocolID(getProtocolID());
        }
        else {
            response.setHeadless();
        }
        response.setUnitID(getUnitID());
        if (!ignoreFunctionCode) {
            response.setFunctionCode(getFunctionCode());
        }
        return response;
    }
ModbusResponse updateResponseWithHeader ( ModbusResponse response , boolean ignoreFunctionCode ) { response . setHeadless ( isHeadless ( ) ) ; if ( ! isHeadless ( ) ) { response . setTransactionID ( getTransactionID ( ) ) ; response . setProtocolID ( getProtocolID ( ) ) ; } else { response . setHeadless ( ) ; } response . setUnitID ( getUnitID ( ) ) ; if ( ! ignoreFunctionCode ) { response . setFunctionCode ( getFunctionCode ( ) ) ; } return response ; }
Updates the response with the header information to match the request

@param response Response to update
@param ignoreFunctionCode True if the function code should stay unmolested
@return Updated response