#! /usr/env/python #-------------------------------------------------------------------------------- """ Application: Misc_Constants for DAQ_96_Gui application Miscellaneous constants for the Graphical User Interface to the DAQ_96 Control Program """ #-------------------------------------------------------------------------------- #-------------------------------------------------------------------------------- from StringIO import StringIO from Print_Utils import printLine import py_itc #-------------------------------------------------------------------------------- #-------------------------------------------------------------------------------- # tcp ports presented by the DAQ96 control application tcp_port_for_coor = 52345 # reply timeout coor_reply_timeout_sec = 3 # the DAQ_96_TCC application is expected to acknowledge within 3 sec. #-------------------------------------------------------------------------------- #-------------------------------------------------------------------------------- class Itc_Coor_Client : def __init__ ( self, TccNode = 'localhost', PortNum = tcp_port_for_coor ) : printLine ( "FakeCoor", "Opening Connection to <%s:%s>" % ( TccNode, PortNum ) ) # create ITC connection to DAQ_96 Control Application # for the simlated for GUI requests self.msgId = 0 self.coor_client = py_itc.new_client ( PortNum, TccNode ) def quit(self): printLine ( "FakeCoor", "Closing Connection" ) py_itc.del_client ( self.coor_client ) #-------------------------------------------------------------------------------- def sendCoorMsg ( self, CoorMsg, TimeOut_sec = coor_reply_timeout_sec ) : self.msgId = self.msgId+1 CoorMsg_str = "[Py_DAQ96_%4.4x] %s" % (self.msgId, CoorMsg ) status = py_itc.send_message ( self.coor_client, CoorMsg_str ) printLine ( "send_msg", "status = %d <%s>" % ( status, CoorMsg_str ) ) status, reply = py_itc.get_reply ( self.coor_client, TimeOut_sec ) printLine ( "get_reply", "status = %d <%s>" % ( status, reply ) ) return reply