Create TCPInterface
class as base class for TCP based interfaces to devices
#769
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the
TCPInterface
class, extracted from the Cryomech agent'sPTC
class, mostly unmodified. I did rename a bit of the API to more closely match thesocket
API, which developers might already be familiar with.While extracting this I wrote a docstring for the
PTC
class, which was missing that.Motivation and Context
Good error handling for any interface is tricky. This class should allow all TCP based agents to use the same error handling logic. I plan to use this next on the Lakeshore 372 agent, so this is one step towards that, and ultimately a step towards #721.
How Has This Been Tested?
This has been tested within the Cryomech agent, testing unplugging the network connection between the agent and compressor. I also tested a power cycle, which triggers the reset path that 72f5a00 modifies. Here are the logs from testing. The first "Connection re-established" was after unplugging and replugging. The second is from the power cycle:
Types of changes
Checklist: