This is virtual counter that returns the value of an attribute:
#!/usr/bin/env python import PyTango class VC: def __init__(self): print( " VC.init") self.proxies = [] # self.proxies.append( PyTango.DeviceProxy( "haso107klx:10000/p09/counter/exp.01")) self.proxies.append( PyTango.DeviceProxy( "p09/counter/exp.01")) # # dev_state # def dev_state( self): return self.proxies[0].State() # # Counts # def read_Counts( self): print( "vc_attribute:: read-counts ") return self.proxies[0].Counts def write_Counts( self, argin): return 1 # # reset # def Reset(self): #print( "vc_attribute:: resetting %s " % self.proxies[0].name()) #self.proxies[0].Reset() return True
The corresponding entry in online.xml is:
<device> <name>exp_xattr</name> <tags>expert,user</tags> <type>counter</type> <module>counter_tango</module> <device>p09/vcexecutor/attribute.01</device> <control>tango</control> <hostname>haso107klx:10000</hostname> </device>
Notice that this device was named 'exp_xattr' because it should appear in the list of counters behind, e.g., exp_c32.