Closed MikeHart85 closed 6 years ago
Added to release notes.
Yes, implementing this wasn't nearly as bad as I thought it would be, especially since asynchat typically depends on terminators... for a while I thought I might have to rewrite the adapter with a different networking library.
I've had some time to do the manual tests you suggested, everything works as advertised. This opens up Lewis for a whole new set of typing exercise devices when the timeout is short enough ;)
I'd be happy to merge this if you think it's ready.
It's probably best to wait for @samueljackson92 to confirm that this does what he needs, and that it's now possible to implement the Eurotherm 2000 emulator he was trying to create.
Apart from that, I think it's ready to go as well.
@samueljackson92 is working on a different project now. I've tested this PR with his Eurotherm emulator and it's exactly what we needed. It would be great if this could be put into a minor release soon as we are about to upgrade our Lewis version anyway. Thank you.
Fixes #261.
Adds a
readtimeout
attribute toStreamInterface
. A ReadTimeout is triggered when the adapter has begun receiving data (IE, a partial command), but has not yet received an InTerminator, and no further data has arrived for the number of milliseconds specified by thereadtimeout
attribute.This behaviour is based on the description of ReadTimeout in the Protocol File documentation, which seems to indicate that a timeout can be used to separate commands instead of a terminator.
This ReadTimeout is the inverse of what is implemented here, since this is written from the IOC's perspective, but it seems reasonable that it should work the same way in both directions.
Testing
Run the supplied sample device:
To interact with this device, you must switch telnet into char mode, or use netcat with special tty settings:
The following commands are available:
hello
(with space): Reply with "world!"foo
: Reply with "bar!"P
: Returns the device parameterP=%d
: Set parameter to specified valueReadTimeout is set to 2.5 seconds here.