device.reset();
device.purgeReceiveBuffer();
device.purgeTransmitBuffer();
Port port = device.getPort();
port.setBaudRate(baudRate);
if(dataBits != null && stopBits != null && parity != null)
port.setDataCharacteristics(dataBits, stopBits, parity);
if(flowControl != null)
port.setFlowControl(flowControl);
}