'Set communication parameters on opened port.'

def _reconfigurePort(self):

    if (not self.sPort):
        raise SerialException('Can    only    operate    on    a    valid    port    handle')
    self.sPort.enableReceiveTimeout(30)
    if (self._bytesize == FIVEBITS):
        jdatabits = comm.SerialPort.DATABITS_5
    elif (self._bytesize == SIXBITS):
        jdatabits = comm.SerialPort.DATABITS_6
    elif (self._bytesize == SEVENBITS):
        jdatabits = comm.SerialPort.DATABITS_7
    elif (self._bytesize == EIGHTBITS):
        jdatabits = comm.SerialPort.DATABITS_8
    else:
        raise ValueError(('unsupported    bytesize:    %r' % self._bytesize))
    if (self._stopbits == STOPBITS_ONE):
        jstopbits = comm.SerialPort.STOPBITS_1
    elif (self._stopbits == STOPBITS_ONE_POINT_FIVE):
        jstopbits = comm.SerialPort.STOPBITS_1_5
    elif (self._stopbits == STOPBITS_TWO):
        jstopbits = comm.SerialPort.STOPBITS_2
    else:
        raise ValueError(('unsupported    number    of    stopbits:    %r' % self._stopbits))
    if (self._parity == PARITY_NONE):
        jparity = comm.SerialPort.PARITY_NONE
    elif (self._parity == PARITY_EVEN):
        jparity = comm.SerialPort.PARITY_EVEN
    elif (self._parity == PARITY_ODD):
        jparity = comm.SerialPort.PARITY_ODD
    elif (self._parity == PARITY_MARK):
        jparity = comm.SerialPort.PARITY_MARK
    elif (self._parity == PARITY_SPACE):
        jparity = comm.SerialPort.PARITY_SPACE
    else:
        raise ValueError(('unsupported    parity    type:    %r' % self._parity))
    jflowin = jflowout = 0
    if self._rtscts:
        jflowin |= comm.SerialPort.FLOWCONTROL_RTSCTS_IN
        jflowout |= comm.SerialPort.FLOWCONTROL_RTSCTS_OUT
    if self._xonxoff:
        jflowin |= comm.SerialPort.FLOWCONTROL_XONXOFF_IN
        jflowout |= comm.SerialPort.FLOWCONTROL_XONXOFF_OUT
    self.sPort.setSerialPortParams(self._baudrate, jdatabits, jstopbits, jparity)
    self.sPort.setFlowControlMode((jflowin | jflowout))
    if (self._timeout >= 0):
        self.sPort.enableReceiveTimeout(int((self._timeout * 1000)))
    else:
        self.sPort.disableReceiveTimeout()
