Closed Beta-Tester-AF closed 1 year ago
Hi there! If you are still monitoring this thread, could you please test the following beta JAR version of this library:
https://www.dropbox.com/t/nUibOse3aweB1ZOw
I've implemented a new method, flushDataListener()
which you should be able to call to delete any received data in an event/data listener prior to it being passed to the user callback. Thanks!
This was fully implemented in the latest release of v2.10.1. Thanks!
I am using your library for master<->slave communication. Master sends a command, slave sends a response. Reception on the master side is done in event-driven byte-delimited message callback mode.
Before the master sends a command, he wants to reset the reception so that only bytes received from that moment on count as a response. How can I do this?
See the code below which illustrates this. It is intended to run in loopback mode, i.e. by connecting the Rx and Tx lines together so that the same PC simulates master and slave.
Desired output:
Rx: [4, 5, 6, 127]
Actual output:Rx: [1, 2, 3, 4, 5, 6, 127]
NOTE: I found a "solution" to add the
SerialPortMessageListener
before sending each command and remove it after receiving a response (or after a timeout if no response). The drawback is that callingcomPort.removeDataListener()
takes 500ms which reduces the throughput unacceptably.