Exemple #1
0
 def read_attr(self, attr):
     attr_name = attr.get_name()
     self.debug_stream('[read_attr] attribute %s' % attr_name)
     try:
         epics.ca.use_initial_context()
         ch_id = self.pv[attr_name][0]
         # reading was requested on read_attr_hardware(): now get the data
         value = epics.ca.get_complete(ch_id)
         if value is None:  # reading failed
             attr.set_quality(PyTango.AttrQuality.ATTR_INVALID)
             msg = 'Error reading attribute %s' % attr_name
             self.error_stream(msg)
             self._set_state(PyTango.DevState.ALARM, msg)
         attr.set_value(value)
         if self.PreserveTimestamp:
             attr.set_date(PyTango.TimeVal(epics.ca.get_timestamp(ch_id)))
     except Exception as e:
         msg = 'Error reading attribute %s' % attr_name
         self.error_stream('%s: %s' % (msg, str(e)))
         self._set_state(PyTango.DevState.ALARM, msg)
         PyTango.Except.throw_exception(
             'Read error',
             msg,
             '%s.read_%s()' % (self.__class__.__name__, attr_name))
Exemple #2
0
 def set_date(self,timestamp):
     if not isinstance(timestamp,PyTango.TimeVal): 
         timestamp=PyTango.TimeVal(timestamp)
     self.time=timestamp
Exemple #3
0
 def __init__(self, date, value):
     self.value = value
     self.time = PyTango.TimeVal(date) if not isinstance(
         date, PyTango.TimeVal) else date