#==============================================================================
# command action response
#==============================================================================
class CAR:
IDLE = 0
PAUSED = 1
BUSY = 2
ERROR = 3
def __init__ (self,pvname):
try:
self.val = pythonCA.new(pvname+'.VAL')
self.omss = pythonCA.new(pvname+'.OMSS')
self.omss.sync()
self.val.monitor(state)
except pythonCA.IOerror:
print "error creating CAR"
raise InitError
def state(self):
if self.val == CAR.IDLE:
pass
elif self.val == CAR.PAUSED:
print "paused"
elif self.val == CAR.BUSY:
print "busy"
elif self.val == CAR.ERROR:
print "error:",self.omss.get()
def busy(self):
if self.val == CAR.BUSY:
return 1
elif self.val == CAR.IDLE:
return 0
else
raise actionError