def set_push_events(filein, period=3000, diff=1e-5): print('set_push_events(%s,%s,%s)' % (filein, period, diff)) devs = fandango.get_matching_devices(filein) if devs: devs = dict( (d, fandango.Struct( {'attrs': fandango.get_device(d).get_attribute_list()})) for d in devs) else: devs = pickle.load(open(filein)) for d, t in sorted(devs.items()): print('Setting events (%s,%s) for %s' % (period, diff, d)) dp = PyTango.DeviceProxy(d) for a in t.attrs: dp.poll_attribute(a, int(period)) if period > 0: ac = dp.get_attribute_config(a) cei = PyTango.ChangeEventInfo() cei.rel_change = str(diff) ac.events.ch_event = cei try: dp.set_attribute_config(ac) except: pass print('done')
def set_push_events(filein, period=3000, diff=1e-5): print('set_push_events(%s,%s,%s)' % (filein, period, diff)) devs = fd.get_matching_devices(filein) for d in devs[:]: if not check_device(d): q = raw_input('Unable to configure events for %s, ' 'do you wish to continue?' % d).lower() if 'y' not in q: return devs.remove(d) if devs: devs = dict( (d, fd.Struct({'attrs': fd.get_device(d).get_attribute_list()})) for d in devs) else: devs = pickle.load(open(filein)) for d, t in sorted(devs.items()): print('Setting events (%s,%s) for %s' % (period, diff, d)) try: dp = PyTango.DeviceProxy(d) for a in t.attrs: dp.poll_attribute(a, int(period)) if period > 0: ac = dp.get_attribute_config(a) cei = PyTango.ChangeEventInfo() cei.rel_change = str(diff) ac.events.ch_event = cei try: dp.set_attribute_config(ac) except: pass except: q = raw_input('Unable to configure events for %s, ' 'do you wish to continue?' % d) if 'y' not in q.lower(): break print('done')