DiamondLightSource / tickit

Event-based hardware simulation framework
Apache License 2.0
7 stars 0 forks source link

Added optional separator argument to TcpIo constructor #209

Open LeeHudsonDLS opened 1 month ago

LeeHudsonDLS commented 1 month ago

When communicating with a simulated device using an ascii protocol I found that the StreamReader.read() method returns inconsistent number of bytes. Even the documentation alludes to this inconsistency:

If n is positive, this function try to read n bytes, and may return less or equal bytes than requested, but at least one byte. If EOF was received before any byte is read, this function returns empty byte object.

As the majority of devices that communicate using an ascii based protocol rely on a termination character to determine the end of a message I have added this as an optional parameter in the tickit.adapters.io.TcpIo class.

abbiemery commented 1 month ago

Have you run the pre-commit linters and checkers on this?

LeeHudsonDLS commented 1 month ago

Sorry no I forgot to do the pre-checks, I have tested you changes though and it all seems to work thanks

LeeHudsonDLS commented 2 weeks ago

@abbiemery Are you OK to approve this so it can be merged and released?

callumforrester commented 6 days ago

Power cycling CI

callumforrester commented 6 days ago

@LeeHudsonDLS Apologies, some of the CI was not running before

image

I have now fixed it.