def readall(self, is_sp=False): """Read all.""" values = dict() for prop, suf in self._all_props_suffix.items(): if _PVName.is_cmd_pv(suf) or (is_sp and not _PVName.is_rb_pv(suf)): continue value = self.read(prop, is_sp=is_sp) if value is None or not value: continue values[prop] = value return values
def _on_change_readpv(self, pvname, value, **kwargs): if value is None: return if self._locked: _Thread(target=self._lock_thread, args=(pvname, value)).start() _Thread(target=self._on_change_pv_thread, args=(pvname, value)).start() # at initialization load _config_ok_values prop = self._dict_convert_pv2prop.get(pvname) cond = prop is not None cond &= self._config_ok_values.get(prop) is None cond &= _PVName.is_rb_pv(pvname) cond &= not self._locked if cond: self._config_ok_values[prop] = value
def _update_pvs_thread(self): _time.sleep(1/10) # limit update in 10Hz for prop, suf in self._all_props_suffix.items(): if _PVName.is_cmd_pv(suf): continue value = self.read(prop) if value is None: return self.run_callbacks(self._get_pv_name(prop), **value) # Uncomment this if you want to update setpoint PVs as well # This is not recommended though, because it can create very # strange unusual behavior with widgets such as spinbox in PyDM # and CS-Studio. if not _PVName.is_rb_pv(suf): continue value = self.read(prop, is_sp=True) if value is None: return self.run_callbacks(self._get_pv_name(prop, is_sp=True), **value)