CallBackCVC.py

Go to the documentation of this file.
00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2004
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__ = "Current Value Table Client"
00012 __author__  = "Jim Panetta <panetta@slac.stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = ("$Date: 2005/09/29 00:23:18 $").split(' ')[1]
00014 __version__ = "$Revision: 1.2 $"
00015 __release__  = "$Name: HEAD $"
00016 __credits__ = "SLAC"
00017 
00018 import LICOS.copyright_SLAC
00019 
00020 import LICOS.util.gOptions as gOptions
00021 
00022 import threading, asyncore, socket
00023 import time
00024 import cPickle as pickle
00025 
00026 from LICOS.lib.currValTable.CurrValClient import CurrValClient
00027 
00028 class CallBackCVC(CurrValClient):
00029   def __init__(self, host, port, mnemList, callBack = None):
00030 
00031     self.update = callBack
00032 
00033     super(CallBackCVC, self).__init__(host, port, mnemList)
00034 
00035 class BlankClass(object):
00036   def myUpdate(self, cv):
00037     print "myUpdate recieved update of ", cv.name, " =", cv.rawValue()
00038     print "  with self = ", self
00039 
00040 if __name__ == '__main__':
00041 
00042   options = gOptions.Options(['cvtHost', 'cvtPort'])
00043   try:
00044     options.parse()
00045   except Exception, msg:
00046     options.usage(str(msg))
00047     exit
00048 
00049   cvtHost = options.cvtHost
00050   cvtPort = int(options.cvtPort)
00051 
00052 
00053   mnemList = []
00054   mnemList.append("LHKT5TKRC5T0")
00055 
00056   b = BlankClass()
00057   cvc = CallBackCVC( cvtHost, cvtPort, mnemList, b.myUpdate)
00058 
00059   asyncore.loop(1)
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 #eof

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