def set_write_attribute(self, attr, w_value): try: attr.set_write_value(w_value) except DevFailed as df: df0 = df[0] reason = df0.reason # if outside limit prefix the description with the device name if reason == PyTango.constants.API_WAttrOutsideLimit: desc = self.alias + ": " + df0.desc _df = DevFailed(*df[1:]) PyTango.Except.re_throw_exception(_df, df0.reason, desc, df0.origin) raise df
def __pollResult(self, attrs, ts, result, error=False): if error: for attr in attrs.values(): attr.poll(single=False, value=None, error=result, time=ts) return for da in result: if da.has_failed: v, err = None, DevFailed(*da.get_err_stack()) else: v, err = da, None attr = attrs[da.name] attr.poll(single=False, value=v, error=err, time=ts)
def from_deviceattribute(da): if da.has_failed: exc_info = DevFailed(*da.get_err_stack()) value = None else: exc_info = None value = from_deviceattribute_value(da.value) dtype, dformat = from_tango_type_format(da.type, da.data_format) ret = SardanaValue(value=value, exc_info=exc_info, timestamp=da.time.totime(), dtype=dtype, dformat=dformat) return ret
def refreshAttributes(self): attrs = [] try: dev = self.getDeviceProxy() if dev is None: raise DevFailed() # @todo: check if this is the right exception to throw attr_info_list = dev.attribute_list_query_ex() for attr_info in attr_info_list: full_name = "%s/%s" % (self.fullName(), attr_info.name) attr_obj = TangoAttrInfo(self.container(), name=attr_info.name.lower(), full_name=full_name.lower(), device=self, info=attr_info) attrs.append(attr_obj) attrs = sorted(attrs, key=lambda attr: attr.name()) except DevFailed as df: self._state = TaurusDevState.NotReady self.setAttributes(attrs)