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:
11
frappy/io.py
11
frappy/io.py
@@ -218,11 +218,20 @@ class IOBase(Communicator):
|
|||||||
def communicate(self, command):
|
def communicate(self, command):
|
||||||
return NotImplementedError
|
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):
|
class StringIO(IOBase):
|
||||||
"""line oriented communicator
|
"""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(),
|
end_of_line = Property('end_of_line character', datatype=ValueType(),
|
||||||
default='\n', settable=True)
|
default='\n', settable=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user