Sherantha
Sherantha

Reputation: 482

java-simple-serial-connector (jssc) discard buffer methods

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()?

Upvotes: 2

Views: 1038

Answers (1)

Sherantha
Sherantha

Reputation: 482

Finally,

SerialPort.purgePort(int flags) 

is what I've been looking for.

Upvotes: 3

Related Questions