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

Поисковые слова: arp 220
lsst.tcc: python/tcc/cmd/broadcast.py Source File
lsst.tcc  1.2.2-3-g89ecb63
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
broadcast.py
Go to the documentation of this file.
1 from __future__ import division, absolute_import
2 
3 from collections import OrderedDict
4 from RO.StringUtil import quoteStr
5 import RO.KeyVariable
6 
7 __all__ = ["broadcast"]
8 
9 MsgTypeCodeDict = OrderedDict((
10  ("debug", "d"),
11  ("information", "i"),
12  ("warning", "w"),
13  ("error", "e"),
14  ("fatal", "f"),
15  ("done", ":"),
16  ("started", ">"),
17  ("superseded", "f"),
18 ))
19 
20 def broadcast(tccActor, userCmd):
21  """Implement the broadcast command
22 
23  @param[in] tccActor tcc actor
24  @param[in,out] userCmd a twistedActor BaseCommand with parseCmd attribute
25  """
26 
27  msgStr = userCmd.parsedCmd.paramDict["message"].valueList[0]
28  msgType = userCmd.parsedCmd.qualDict["type"].valueList[0]
29  msgCode = MsgTypeCodeDict[msgType]
30  hubMsg = "Broadcast=%s" % (quoteStr(msgStr,))
31  if msgCode in msgCode in RO.KeyVariable.DoneTypes:
32  # don't report the command as done
33  tccActor.writeToUsers(msgCode, hubMsg, userID=userCmd.userID)
34  else:
35  tccActor.writeToUsers(msgCode, hubMsg, cmd=userCmd)
36  if not userCmd.isDone:
37  userCmd.setState(userCmd.Done)