In the following example, the virtual counter is directly coupled to another counter.
In addition it is demonstrated how a device property is accessed.
#!/bin/env python
import PyTango
import inspect
import HasyUtils
class VC:
def __init__(self):
print " VC.init"
self.proxies = []
self.proxies.append( PyTango.DeviceProxy( "p09/counter/exp.01"))
#
# demo for accessing the VcCode property
#
self.parent = inspect.currentframe().f_back.f_locals['self']
self.parentProxy = PyTango.DeviceProxy( self.parent.get_name())
VcCode = HasyUtils.getDeviceProperty( self.parent.get_name(), "VcCode")[0]
#print "VcCode", VcCode
#
# dev_state
#
def dev_state( self):
argout = self.proxies[0].State()
return argout
#
# Counts
#
def read_Counts( self):
print "vc1:: read-counts "
return self.proxies[0].Counts
def write_Counts( self, argin):
print "vc1:: write-counts "
self.proxies[0].Counts = argin
return 1
#
# reset
#
def Reset(self):
print "vc1:: resetting ", self.proxies[0].name()
# dev.proxies[0].inout( "Reset")
self.proxies[0].Reset()
print "vc1:: reset DONE"
return True