seCmdCountMon.py

Go to the documentation of this file.
00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2005
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
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     # Setup a telemetry handler for the "CmdCnt0" telemetry.
00036     # We need to keep a command count when the ScriptEngine starts
00037     # so that when a script runs it knows the starting count and can
00038     # find out the number of commands executed during the run as reported
00039     # by the housekeeping telemetry.
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

Generated on Thu Apr 27 20:52:43 2006 for LICOS L02-01-00 by doxygen 1.4.6-NO