1
votes

I'm reading data from a hardware through the serial port and I'm using readString() method of jssc.

I have used a Timer to get data continuously. Because of this, whenever I changed the command, the received data is a combination relevant to previous and current commands.

While using C# I have solved this with the help of SerialPort.DiscardInBuffer() method.

Are there any methods in jssc equal to SerialPort.DiscardInBuffer() and SerialPort.DiscardOutBuffer()?

1

1 Answers

2
votes

Finally,

SerialPort.purgePort(int flags) 

is what I've been looking for.