io: add reconnect command

sometimes reconnecting helps to heal a broken connection

Change-Id: I368ecb549ca346d7db3484f6a8be0a3a9a86aff1
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/37433
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Georg Brandl <g.brandl@fz-juelich.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2025-09-17 08:21:23 +02:00
parent 6600ec63fd
commit 6e10382d98

View File

@@ -218,11 +218,20 @@ class IOBase(Communicator):
def communicate(self, command):
return NotImplementedError
@Command
def reconnect(self):
"""close and open connection
sometimes a reconnect helps to heal a broken connection
"""
self.closeConnection()
self.read_is_connected() # this always tries to reconnect
class StringIO(IOBase):
"""line oriented communicator
self healing is assured by polling the parameter 'is_connected'
self-healing is assured by polling the parameter 'is_connected'
"""
end_of_line = Property('end_of_line character', datatype=ValueType(),
default='\n', settable=True)