1 from __future__
import division, absolute_import
3 from tcc.msg import formatDisabledProc
9 "brdtelpos": (
"doBrdTelPos",
"brdTelPosTimer",
"brdTelPos"),
10 "collimate": (
"doCollimate",
"collimateTimer",
"updateCollimation"),
11 "status": (
"doStatus",
"statusTimer",
"showStatus"),
17 """Implement the process command
19 @param[in,out] tccActor tcc actor
21 writes tccActor.inst and triggers a collimation update
22 @param[in,out] userCmd user command
26 for tuneAttr, timerName, methodName
in _ProcNameAttrsDict.itervalues():
27 assert hasattr(tccActor.tune, tuneAttr)
28 assert hasattr(tccActor, timerName)
29 assert hasattr(tccActor, methodName)
33 cmdStr = userCmd.parsedCmd.paramDict[
"command"].valueList[0].keyword.lower()
34 if cmdStr !=
"status":
35 procNameList = [val.keyword
for val
in userCmd.parsedCmd.paramDict[
"procnames"].valueList]
36 doEnable = bool(cmdStr ==
"enable")
37 for procName
in procNameList:
38 (tuneAttr, timerName, methodName) = _ProcNameAttrsDict.get(procName.lower())
39 setattr(tccActor.tune, tuneAttr, doEnable)
40 timer = getattr(tccActor, timerName)
42 method = getattr(tccActor, methodName)
43 timer.start(0, method)
46 if procName ==
"collimate":
48 tccActor.collimateSlewEndTimer.cancel()
51 tccActor.writeToUsers(msgCode, msgStr, cmd=userCmd)
53 userCmd.setState(userCmd.Done)