00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Command Count Monitor class"
00012 __author__ = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__ = "2005/09/19 10:00:00"
00014 __updated__ = "$Date: 2006/01/26 00:37:56 $"
00015 __version__ = "$Revision: 1.2 $"
00016 __release__ = "$Name: HEAD $"
00017 __credits__ = "SLAC"
00018
00019 import LICOS.copyright_SLAC
00020
00021 from LICOS.lib.cmdTlmDb.TelemetryEvent import TelemetryEvent
00022
00023 import threading
00024
00025 class seCmdCountMon(object):
00026 """!\brief Command Count Monitor class
00027
00028 """
00029 def __init__(self, vsc):
00030 """!\brief seCmdCountMon constructor.
00031
00032 \param vsc ScriptEngineConnector instance
00033 """
00034 self.__vsc = vsc
00035
00036
00037
00038
00039
00040 self.__cmdCntTlm = TelemetryEvent(vsc.getTelemHandler(),
00041 [vsc.getTlmDb().getApidFromName('CmdCnt0')],
00042 self.__cmdCounter)
00043
00044 self.__lfsCmdSent = 0
00045 self.__limCmdSent = 0
00046 self.__lhkCmdSent = 0
00047 self.__lcmCmdSent = 0
00048 self.__lsmmCmdSent = 0
00049 self.__lsmsCmdSent = 0
00050
00051 def __cmdCounter(self, telem):
00052 """!\brief Callback method for processing the "CmdCnt0" telemetry.
00053
00054 \param telem Telemetry object
00055 """
00056 lcatTlm = self.__vsc.getTlmDb()
00057 pkt = lcatTlm.decodeTelemetry(telem)
00058 self.__lfsCmdSent = pkt.get_payload("LHKLFSCMDSENT")
00059 self.__limCmdSent = pkt.get_payload("LHKLIMCMDSENT")
00060 self.__lhkCmdSent = pkt.get_payload("LHKLHKCMDSENT")
00061 self.__lcmCmdSent = pkt.get_payload("LHKLCMCMDSENT")
00062 self.__lsmmCmdSent = pkt.get_payload("LHKLSMMCMDSENT")
00063 self.__lsmscmdSent = pkt.get_payload("LHKLSMSCMDSENT")
00064
00065 def startMonitor(self):
00066 """!\brief Enable the "CmdCnt0" telemetry handler.
00067
00068 """
00069 self.__cmdCntTlm.enable()
00070
00071 def stopMonitor(self):
00072 """!\brief Disable the "CmdCnt0" telemetry handler.
00073
00074 """
00075 self.__cmdCntTlm.disable()
00076
00077 def getLFScmdSent(self):
00078 """!\brief Retrieve the command count for LFS commands.
00079
00080 \return Command count
00081 """
00082 return self.__lfsCmdSent
00083
00084 def getLIMcmdSent(self):
00085 """!\brief Retrieve the command count for LFS commands.
00086
00087 \return Command count
00088 """
00089 return self.__limCmdSent
00090
00091 def getLHKcmdSent(self):
00092 """!\brief Retrieve the command count for LFS commands.
00093
00094 \return Command count
00095 """
00096 return self.__lhkCmdSent
00097
00098 def getLCMcmdSent(self):
00099 """!\brief Retrieve the command count for LFS commands.
00100
00101 \return Command count
00102 """
00103 return self.__lcmCmdSent
00104
00105 def getLSMMcmdSent(self):
00106 """!\brief Retrieve the command count for LFS commands.
00107
00108 \return Command count
00109 """
00110 return self.__lsmmCmdSent
00111
00112 def getLSMScmdSent(self):
00113 """!\brief Retrieve the command count for LFS commands.
00114
00115 \return Command count
00116 """
00117 return self.__lsmsCmdSent
00118
00119 def getAllCmdSent(self):
00120 """!\brief Retrieve the total command count.
00121
00122 \return Command count
00123 """
00124 return self.__lfsCmdSent + \
00125 self.__limCmdSent + \
00126 self.__lhkCmdSent + \
00127 self.__lcmCmdSent + \
00128 self.__lsmmCmdSent + \
00129 self.__lsmscmdSent