Skip to content
Snippets Groups Projects
Commit dc92ef3b authored by Roberto Borghes's avatar Roberto Borghes
Browse files

Bug fixes: timeout errors and CYCLIC DB option

parent a06b3bcd
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ import numpy as np
import socket
from select import select
import time
import traceback
#==================================================================
# BCS Class Description:
......@@ -137,15 +138,17 @@ class BCS(PyTango.Device_4Impl):
# Sockets from which we expect to read
timeout=2.5
readable = select([self.s],[],[],timeout)
if readable:
reply = str(self.s.recv(1024))
except Exception as e:
if not readable[0]:
PyTango.Except.throw_exception("BCS Communication error","Timeout error","WriteRead")
reply = str(self.s.recv(1024))
self.failures = 0
except:
self.failures += 1
if self.failures == 10:
self.connectionOk = False
self.s.close()
self.error_stream("BCS Communication error %s" % str(reply))
PyTango.Except.throw_exception("BCS Communication error",e.message.strip(),"WriteRead")
PyTango.Except.throw_exception("BCS Communication error",traceback.format_exc(),"WriteRead")
return reply.split("\r\n")[0]
......@@ -315,9 +318,8 @@ class BCS(PyTango.Device_4Impl):
def_prop.set_standard_unit(attrinfo[1])
def_prop.set_label(attrName);
dynAttr.set_default_properties(def_prop);
a = self.add_attribute(dynAttr,self.readFromBCS)
if (PyTango.__version_info__[0] == 8) and (attrinfo[-2] == "C"):
if (PyTango.__version_info__[0] > 7) and (attrinfo[-2] == "C"):
# "Easy" Attribute Polling available only with PyTango 8.x
self.poll_attribute(attrName,int(attrinfo[-1]))
#
......@@ -327,7 +329,7 @@ class BCS(PyTango.Device_4Impl):
self.BCS_cmds[attrName] = uespoint[1]
dynAttr = PyTango.Attr(attrName, attrtype, PyTango.AttrWriteType.READ_WRITE)
a = self.add_attribute(dynAttr,self.readUesFromBCS,self.writedUesToBCS)
if (PyTango.__version_info__[0] == 8) and (attrinfo[-2] == "C"):
if (PyTango.__version_info__[0] > 7) and (attrinfo[-2] == "C"):
# "Easy" Attribute Polling available only with PyTango 8.x
self.poll_attribute(attrName,int(attrinfo[-1]))
#
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment