Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.apo.nmsu.edu/Telescopes/TCC/html/process_8py_source.html
Дата изменения: Tue Sep 15 02:25:37 2015
Дата индексирования: Sun Apr 10 01:05:14 2016
Кодировка:

Поисковые слова: arp 220
lsst.tcc: python/tcc/cmd/process.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
process.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 from tcc.msg import formatDisabledProc
4 
5 __all__ = ["process"]
6 
7 # dict of process name: tune attribute name, tccActor timer attribute name, tccActor method
8 _ProcNameAttrsDict = {
9  "brdtelpos": ("doBrdTelPos", "brdTelPosTimer", "brdTelPos"),
10  "collimate": ("doCollimate", "collimateTimer", "updateCollimation"),
11  "status": ("doStatus", "statusTimer", "showStatus"),
12 }
13 
14 _DidCheck = False
15 
16 def process(tccActor, userCmd):
17  """Implement the process command
18 
19  @param[in,out] tccActor tcc actor
20  reads tccActor.inst
21  writes tccActor.inst and triggers a collimation update
22  @param[in,out] userCmd user command
23  """
24  global _DidCheck
25  if not _DidCheck:
26  for tuneAttr, timerName, methodName in _ProcNameAttrsDict.itervalues():
27  assert hasattr(tccActor.tune, tuneAttr)
28  assert hasattr(tccActor, timerName)
29  assert hasattr(tccActor, methodName)
30  _DidCheck = True
31 
32  try:
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)
41  if doEnable:
42  method = getattr(tccActor, methodName)
43  timer.start(0, method)
44  else:
45  timer.cancel()
46  if procName == "collimate":
47  # cancel the extra collimate timer
48  tccActor.collimateSlewEndTimer.cancel()
49  finally:
50  msgCode, msgStr = formatDisabledProc(tccActor.tune)
51  tccActor.writeToUsers(msgCode, msgStr, cmd=userCmd)
52 
53  userCmd.setState(userCmd.Done)
def formatDisabledProc
Format the DisabledProc keyword.