I want to connect to a device that connected to serial port (COM4) with initial baud rate 300, the device can change its baud rate to 9600 with a command, my Java code send this command to device and baud rate of the device changed, but i don't know how to change baud rate in my program without closing the connection. When connection has been closed, device comeback to the initial baud rate.
Is there any way to change baud rate in Java while the connection is open?
After I send the "change baud rate" command to device, when below code executed device lost the connection. I think this method is just for initializing, not for changing baud rate in the middle of communication.
port.setSerialPortParams(
9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);