Index: trigger/CommServer.py
===================================================================
--- trigger/CommServer.py	(revision 53)
+++ 	(revision )
@@ -1,148 +1,0 @@
-#!/usr/bin/python
-# First the server
-
-
-
-"""
-A basic, multiclient 'chat server' using Python's select module
-with interrupt handling.
-
-Entering any line of input at the terminal will exit the server.
-"""
-
-import select
-import socket
-import sys
-import signal
-from communication import send, receive
-import threading
-import GlobalVariables
-BUFSIZ = 1024
-
-
-class CommServer(threading.Thread):
-    """ Simple  server using select """
-    
-    def __init__(self, port=3490, backlog=5):
-        self.clients = 0
-        # Client map
-        self.clientmap = {}
-        # Output socket list
-        self.outputs = []
-        self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        self.server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-        self.server.bind(('',port))
-        print 'Listening to port',port,'...'
-        self.server.listen(backlog)
-        # Trap keyboard interrupts
-        #signal.signal(signal.SIGINT, self.sighandler)
-        
-    def sighandler(self, signum, frame):
-        # Close the server
-        print 'Shutting down server...'
-        # Close existing client sockets
-        for o in self.outputs:
-            o.close()
-            
-        self.server.close()
-
-    def getname(self, client):
-
-        # Return the printable name of the
-        # client, given its socket...
-        info = self.clientmap[client]
-        host, name = info[0][0], info[1]
-        return '@'.join((name, host))
-        
-    def serve(self):
-        
-        inputs = [self.server,sys.stdin]
-        self.outputs = []
-
-        running = 1
-
-        while running:
-
-            try:
-                inputready,outputready,exceptready = select.select(inputs, self.outputs, [])
-            except select.error, e:
-                break
-            except socket.error, e:
-                break
-
-            for s in inputready:
-
-                if s == self.server:
-                    # handle the server socket
-                    client, address = self.server.accept()
-                    print 'server: got connection %d from %s' % (client.fileno(), address)
-                    # Read the login name
-                    cname = receive(client).split('NAME: ')[1]
-                    
-                    # Compute client name and send back
-                    self.clients += 1
-                    send(client, 'CLIENT: ' + str(address[0]))
-                    inputs.append(client)
-
-                    self.clientmap[client] = (address, cname)
-                    # Send joining information to other clients
-                    msg = '\n(Connected: New client (%d) from %s)' % (self.clients, self.getname(client))
-                    for o in self.outputs:
-                        # o.send(msg)
-                        send(o, msg)
-                    
-                    self.outputs.append(client)
-
-                #elif s == sys.stdin:
-                    # handle standard input
-                #    junk = sys.stdin.readline()
-                #    if (junk[:-1]=='exit'):
-                #        running = 0
-                elif s!=sys.stdin:
-                    # handle all other sockets
-                    try:
-                        # data = s.recv(BUFSIZ)
-                        data = receive(s)
-                        if data:
-                            # Send as new client's message...
-                            msg = 'SERVER: You sent: >> ' + data
-                            GlobalVariables.UserInput=data
-                            if(GlobalVariables.UserInput=='exit' or GlobalVariables.UserInput=='EXIT'):
-                                running=0
-                                print 'Shutting down server...'
-                                # Close existing client sockets
-                                for o in self.outputs:
-                                    o.close()
-                                    
-                            # Send data to all except ourselves
-                            for o in self.outputs:
-                                #if o != s:
-                                # o.send(msg)
-                                send(o, msg)
-                        else:
-                            print 'server: %d hung up' % s.fileno()
-                            self.clients -= 1
-                            s.close()
-                            inputs.remove(s)
-                            self.outputs.remove(s)
-
-                            # Send client leaving information to others
-                            msg = '\n(Hung up: Client from %s)' % self.getname(s)
-                            for o in self.outputs:
-                                # o.send(msg)
-                                send(o, msg)
-                                
-                    except socket.error, e:
-                        # Remove
-                        inputs.remove(s)
-                        self.outputs.remove(s)
-                        
-
-
-        self.server.close()
-        def run(self):
-            self.serve()
-            
-if __name__ == "__main__":
-    commServer=CommServer()
-    commServer().start()
Index: trigger/CommSocket.py
===================================================================
--- trigger/CommSocket.py	(revision 53)
+++ trigger/CommSocket.py	(revision 77)
@@ -20,9 +20,30 @@
 import time
 BUFSIZ = 1024
-
-
+class Sender(threading.Thread):
+    """ Sends the messages """
+    outputs = []
+    oldmessage=''
+     
+    def run(self):
+        running = 1
+        while running:
+            time.sleep(0.001)
+            if(self.oldmessage!=GlobalVariables.ServerMessage):
+                self.oldmessage=GlobalVariables.ServerMessage
+             
+                for o in self.outputs:
+                    # o.send(msg)
+                    #print "sending (glob): ",GlobalVariables.ServerMessage,"\n"
+                    send(o,GlobalVariables.ServerMessage )
+                if(GlobalVariables.UserInput[1:]=='exit' or GlobalVariables.UserInput[1:]=='EXIT'):
+                    running=0
+              
+
+
+         
 class CommServer(threading.Thread):
     """ Simple  server using select """
-    
+    oldmessage=''
+    sender=Sender()
     def __init__(self, port=3490, backlog=5):
         self.clients = 0
@@ -36,9 +57,10 @@
         print 'SERVER: Listening to port',port,'...'
         self.server.listen(backlog)
+        self.sender.start()
         # Trap keyboard interrupts
         #signal.signal(signal.SIGINT, self.sighandler)
         threading.Thread.__init__(self)
     #def sighandler(self, signum, frame):
-    #    if(GlobalVariables.UserInput=='exit' or GlobalVariables.UserInput=='EXIT'):
+    #    if(GlobalVariables.UserInput[1:]=='exit' or GlobalVariables.UserInput[1:]=='EXIT'):
     #        running=0
     #        for o in self.outputs:
@@ -71,6 +93,12 @@
 
         while running:
-            time.sleep(0.01)
-            if(GlobalVariables.UserInput=='exit' or GlobalVariables.UserInput=='EXIT'):
+            time.sleep(0.001)
+            #if(self.oldmessage!=GlobalVariables.ServerMessage):
+            #    self.oldmessage=GlobalVariables.ServerMessage
+            #    for o in self.outputs:
+            #        # o.send(msg)
+            #        #print "sending (glob): ",GlobalVariables.ServerMessage,"\n"
+            #        send(o,GlobalVariables.ServerMessage )
+            if(GlobalVariables.UserInput[1:]=='exit' or GlobalVariables.UserInput[1:]=='EXIT'):
                 running=0
             
@@ -87,11 +115,16 @@
                     # handle the server socket
                     client, address = self.server.accept()
-                    print 'SERVER: got connection %d from %s' % (client.fileno(), address)
+                    #print 'SERVER: got connection %d from %s' % (client.fileno(), address)
+                    GlobalVariables.ServerMessage = 'SERVER: got connection %d from %s' %( client.fileno(), address)+"\n"
                     # Read the login name
-                    cname = receive(client).split('NAME: ')[1]
-                    
+                    cname="TESTUSER"
+                    #cname = receive(client).split('NAME: ')[1]
+                    #print cname
                     # Compute client name and send back
                     self.clients += 1
-                    send(client, 'FROM SERVER: CLIENT: ' + str(address[0]))
+                    #send(client, 'FROM SERVER: CLIENT: ' + str(address[0]))
+                    #send(client,"test");
+                    #send(client,"test2");
+                    
                     inputs.append(client)
 
@@ -99,10 +132,9 @@
                     # Send joining information to other clients
                     msg = '\nFROM SERVER: (Connected: New client (%d) from %s)' % (self.clients, self.getname(client))
-                    for o in self.outputs:
-                        # o.send(msg)
-                        send(o, msg)
-                    
+                    GlobalVariables.ServerMessage=msg;
+                    time.sleep(0.001)
+                    #print "appending ", client
                     self.outputs.append(client)
-
+                    self.sender.outputs=self.outputs
                 #elif s == sys.stdin:
                     # handle standard input
@@ -119,29 +151,40 @@
                     # handle all other sockets
                     try:
-                        # data = s.recv(BUFSIZ)
-                        data = receive(s)
+                        data = s.recv(BUFSIZ)
+                        
+                        #data = receive(s)
+                        #print data
                         if data:
+                            GlobalVariables.counter += 1
+                            GlobalVariables.counter %= 10
+                            data = str(GlobalVariables.counter)+data
                             # Send as new client's message...
                             msg = 'SERVER: You sent: >> ' + data
+                            msg+="\n"
                             GlobalVariables.UserInput=data
-                            print "SERVER: recv data: "+data
-                            for o in self.outputs:
-                                send(o, msg)
-                            if(GlobalVariables.UserInput=='exit' or GlobalVariables.UserInput=='EXIT'):
+                            #print "SERVER: recv data: "+data
+                            #print "msg is: ",msg
+
+                            #for o in self.outputs:
+                                #msg="TSTSTS"
+                             #   print "sending ",msg," to ",o
+                                
+                              #  send(o, msg)
+                            if(GlobalVariables.UserInput[1:]=='exit' or GlobalVariables.UserInput[1:]=='EXIT'):
                                 running=0
                                 # Send data to all except ourselves
                                                             
                         else:
-                            print 'SERVER: %d hung up' % s.fileno()
+                            GlobalVariables.ServerMessage ='SERVER: %d hung up' % s.fileno()
                             self.clients -= 1
                             s.close()
                             inputs.remove(s)
                             self.outputs.remove(s)
-
+                            self.sender.outputs=self.outputs
                             # Send client leaving information to others
                             msg = 'SERVER: \n(Hung up: Client from %s)' % self.getname(s)
-                            for o in self.outputs:
+                            #for o in self.outputs:
                                 # o.send(msg)
-                                send(o, msg)
+                                # send(o, msg)
                                 
                     except socket.error, e:
@@ -151,5 +194,6 @@
                         
 
-        print 'SERVER: Shutting down server...'
+        GlobalVariables.ServerMessage ='SERVER: Shutting down server...'
+        
         # Close existing client sockets
         for o in self.outputs:
Index: trigger/CommunicateWithVME.py
===================================================================
--- trigger/CommunicateWithVME.py	(revision 53)
+++ trigger/CommunicateWithVME.py	(revision 77)
@@ -18,5 +18,5 @@
     _VME.V560_Clear_Scales( module)
     beginCounter=_VME. V560_Read_Counter( module,  channel)
-    print "Evaluating rates (2 seconds)..."
+    GlobalVariables.ServerMessage = "Evaluating rates (2 seconds)..."
     time.sleep(2)
     endCounter = _VME. V560_Read_Counter( module,  channel)
@@ -33,5 +33,6 @@
                    0,0,0,0,
                    0,0,0,0]
-    rates      =  [0,0,0,0,
+    rates      =  ["rates",
+                   0,0,0,0,
                    0,0,0,0,
                    0,0,0,0,
@@ -40,16 +41,32 @@
     for i in range(0,16):
         beginCounter[i]=_VME. V560_Read_Counter( module,  i)
-        print beginCounter[i]
-    print "Evaluating rates..."
+        #GlobalVariables.ServerMessage = str(beginCounter[i])
+    #GlobalVariables.ServerMessage = "Evaluating rates..."
     time.sleep(2)
     for i in range(0,16):
         endCounter[i] = _VME. V560_Read_Counter( module,  i)
-        print endCounter[i]
-        rates[i] =(endCounter[i]-beginCounter[i])/2000.
+        #GlobalVariables.ServerMessage = str(endCounter[i])
+        rates[i+1] =(endCounter[i]-beginCounter[i])/2000.
     return rates
-    
+
+class GimmeRates(threading.Thread):
+    rates=["rates",
+        0,0,0,0,
+           0,0,0,0,
+           0,0,0,0,
+           0,0,0,0]
+    module = 1
+    def run(self):
+        oldcommand=GlobalVariables.UserInput
+        while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
+            time.sleep(0.001)
+            newrates = GetRates(self.module)
+            self.rates=newrates
+
 class ParseUserInput(threading.Thread):
+    gimmeRates=GimmeRates()
     def Parse(self,Command):
-        print "PARSING: ",Command
+        Command = Command[1:]
+        #GlobalVariables.ServerMessage = "PARSING: " + Command
         sCommand=Command.split()
         error_code=0
@@ -57,5 +74,7 @@
         try:
             VMEModule=sCommand[0]
-            if(VMEModule == "help"): print "please use \'<V812|V560|Triggerboard> help\' "
+            if(VMEModule == "help"):
+                GlobalVariables.ServerMessage = "please use \'<V812|V560|Triggerboard> help\' "
+                #GlobalVariables.ServerMessage="please use \'<V812|V560|Triggerboard> help\' "
             
             # now do the stuff for the V560:
@@ -63,26 +82,44 @@
                 V560Command=sCommand[1]
                 if(V560Command=="help"):
-                    print "available functions are: "
-                    print "V560 GetRate <module#> <channel#>"
-                    print "V560 GetRates <module#> "
+                    GlobalVariables.ServerMessage = "available functions are: \n"
+                    GlobalVariables.ServerMessage += "V560 GetRate <module#> <channel#>\n"
+                    GlobalVariables.ServerMessage += "V560 GetRates <module#\n "
+                    time.sleep(0.05)
                     
                 if(V560Command=="GetRate"):
-                    print "trying to get rate"
-                    try:
-                        module = sCommand[2]
-                        channel= sCommand[3]
-                        print GetRate(int(module),int(channel))
-                    except:
-                        print "Syntax Error (GetRate)"
+                    #GlobalVariables.ServerMessage = "trying to get rate"
+                    #time.sleep(0.05)
+                    
+
+                    try:
+                        module = int(sCommand[2])
+                        channel= int(sCommand[3])
+                        if(module!= self.gimmeRates.module):
+                            self.gimmeRates.module=module
+                            GlobalVariables.ServerMessage = "please wait... (5sec)"
+                            time.sleep(5)
+                        
+                        GlobalVariables.ServerMessage = str(self.gimmeRates.rates[channel])
+                        time.sleep(0.01)
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax Error (GetRate)"
+                        time.sleep(0.01)
                     #GlobalVariables.Rates[int(channel)] = GetRates(int(module),int(channel))
 
-                if(V560Command=="GetRates"):
-                    print "trying to get rates"
-                    try:
-                        module = sCommand[2]
-
-                        print GetRates(int(module))
-                    except:
-                        print "Syntax Error (GetRates)"
+                if(V560Command=="GetRates" or V560Command=="GR"):
+                    GlobalVariables.ServerMessage = "trying to get rates"
+                    time.sleep(0.01)
+                    try:
+                        module = int(sCommand[2])
+                        if(module!= self.gimmeRates.module):
+                            self.gimmeRates.module=module
+                            GlobalVariables.ServerMessage = "please wait... (5sec)"
+                            time.sleep(5)
+                        #GlobalVariables.ServerMessage = "RATES:"
+                        GlobalVariables.ServerMessage = str(self.gimmeRates.rates)
+                        time.sleep(0.01)
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax Error (GetRates)"
+                        time.sleep(0.05)
                     #GlobalVariables.Rates[int(channel)] = GetRates(int(module),int(channel))
         
@@ -92,76 +129,111 @@
                 V812Command=sCommand[1]
                 if(V812Command=="help"):
-                    print "available functions are: "
-                    print "V812 SetHexPat <module#[1-10]> <HexPattern[0x0000-0xFFFF>"
-                    print "V812 SetThresh <module#[1-10]> <channel#[0-15]> <thresh[0-255]>"
-                    print "V812 SetMajLevel <module#[1-10]> <MajLev[1-20]>"
-                    print "V812 SetMajThresh <module#[1-10]> <MajThr[0-255]>"
-                    print "V812 SetDeadTime <module#[1-10]> <Block [0-1]> <DeadTime[0-255]>"
-
+                    GlobalVariables.ServerMessage  = "available functions are: \n"
+                    GlobalVariables.ServerMessage += "V812 SetHexPat <module#[1-10]> <HexPattern[0x0000-0xFFFF>\n"
+                    GlobalVariables.ServerMessage += "V812 SetThresh <module#[1-10]> <channel#[0-15]> <thresh[0-255]>\n"
+                    GlobalVariables.ServerMessage += "V812 SetAllThresh <module#[1-10]>  <thresh[0-255]>\n"
+                    GlobalVariables.ServerMessage += "V812 SetMajLevel <module#[1-10]> <MajLev[1-20]>\n"
+                    GlobalVariables.ServerMessage += "V812 SetMajThresh <module#[1-10]> <MajThr[0-255]>\n"
+                    GlobalVariables.ServerMessage += "V812 SetDeadTime <module#[1-10]> <Block [0-1]> <DeadTime[0-255]>\n"
+                    time.sleep(0.05)
                 #set the hexpattern:
                 elif(V812Command=="SetHexPat"):
-                    print "trying to set the hexpattern:"
+                    GlobalVariables.ServerMessage = "trying to set the hexpattern:"
+                    time.sleep(0.05)
                     try:
                         module = int(sCommand[2])
                         hexpat = int(sCommand[3],16)
-                        #hexpat="ddd"
-                        print "setting module ",module," to hexpat: ",hex(hexpat)
+                        #print hexpat
+                        # hexpat="ddd"
+                        GlobalVariables.ServerMessage = "setting module "+str(module)+" to hexpat: "+str(hex(hexpat))
+                        time.sleep(0.05)
                         try:
+                            print "setting it now..."
                             error_code=_VME.V812_Set_Pattern_Inhibit_Hex(module, hexpat)
-                            print "success! "
+                            GlobalVariables.ServerMessage = "success! "
+                            time.sleep(0.05)
                             
                         except:
                             VME_ErrorPrint(error_code)
-                    except:
-                        print "Syntax error (SetHexPat)"
-
-
+                            print "FAILED"
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax error (SetHexPat)"
+
+                        
+                        time.sleep(0.05)
+                elif(V812Command=="SetAllThresh"):
+                    print "trying to set all the threshold:"
+                    try:
+                        module  = int(sCommand[2])
+                        thresh  = int(sCommand[3])
+                        GlobalVariables.ServerMessage="Setting all thresholds...\n"
+                        for channel in range(0,16):
+                            GlobalVariables.ServerMessage += "setting threshold of channel: "+str(channel)+ " in module "+str(module)+" to: "+str(thresh)+"\n"
+                            GlobalVariables.ServerMessage += "success: "+str(_VME.V812_Set_Threshold(module, channel,  thresh))+"\n"
+                        time.sleep(0.05)
+                            
+                            
+                    except:
+                        print "Syntax error (SetAllThresh) "
                 elif(V812Command=="SetThresh"):
-                    print "trying to set the threshold:"
+                    GlobalVariables.ServerMessage = "trying to set the threshold:"
+                    time.sleep(0.05)
                     try:
                         module  = int(sCommand[2])
                         channel = int(sCommand[3])
                         thresh  = int(sCommand[4])
-                        print "setting threshold of channel: ",channel, " in module ",module," to: ",thresh
-                        print "success: ",_VME.V812_Set_Threshold(module, channel,  thresh)
-                    except:
-                        print "Syntax error (SetThresh) "
-                        
+                        GlobalVariables.ServerMessage = "setting threshold of channel: "+str(channel)+ " in module "+str(module)+" to: "+str(thresh)
+                        GlobalVariables.ServerMessage += "success: "+str(_VME.V812_Set_Threshold(module, channel,  thresh))
+                        time.sleep(0.05)
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax error (SetThresh) "
+                        time.sleep(0.05)
                 elif(V812Command=="SetMajLevel"):
-                    print "trying to set the majority level:"
+                    GlobalVariables.ServerMessage = "trying to set the majority level:"
+                    time.sleep(0.05)
                     try:
                         module  = int(sCommand[2])
                         level   = int(sCommand[3])
-                        print "setting maj. level of module ",module," to: ",level
-                        print "success: ",_VME.V812_Set_Majority_Level(module,level)
-                    except:
-                        print "Syntax error (SetMajLevel)"
+                        GlobalVariables.ServerMessage = "setting maj. level of module "+str(module)+" to: "+str(level)
+                        GlobalVariables.ServerMessage += "success: "+str(_VME.V812_Set_Majority_Level(module,level))
+                        time.sleep(0.05)
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax error (SetMajLevel)"
+                        time.sleep(0.05)
 
                 elif(V812Command=="SetMajThresh"):
-                    print "trying to set the majority threshold:"
+                    GlobalVariables.ServerMessage = "trying to set the majority threshold:"
+                    time.sleep(0.05)
                     try:
                         module  = int(sCommand[2])
                         thresh  = int(sCommand[3])
-                        print "setting maj. level of module ",module," to: ",thresh
-                        print "success: ",_VME.V812_Set_Majority_Threshold(module,  thresh)
-                    except:
-                        print "Syntax error (SetMajThresh)"
+                        GlobalVariables.ServerMessage = "setting maj. level of module "+str(module)+" to: "+str(thresh)
+                        GlobalVariables.ServerMessage += "success: "+str(_VME.V812_Set_Majority_Threshold(module,  thresh))
+                        time.sleep(0.05)
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax error (SetMajThresh)"
+                        time.sleep(0.05)
 
                 elif(V812Command=="SetDeadTime"):
-                    print "trying to set the majority threshold:"
+                    GlobalVariables.ServerMessage = "trying to set the majority threshold:"
+                    time.sleep(0.05)
                     try:
                         module  = int(sCommand[2])
                         block  = int(sCommand[3])
                         deadtime= int(sCommand[4])
-                        print "setting deadtime of module ",module," block: ",block, " to: ",deadtime
-                        print "success: ",_VME.V812_Set_Dead_Time(module, block, deadtime);
-                    except:
-                        print "Syntax error (SetMajThresh)"
+                        GlobalVariables.ServerMessage = "setting deadtime of module "+str(module)+" block: "+str(block)+ " to: "+str(deadtime)
+                        GlobalVariables.ServerMessage += "success: "+str(_VME.V812_Set_Dead_Time(module, block, deadtime))
+                        time.sleep(0.05)
+                    except:
+                        GlobalVariables.ServerMessage = "Syntax error (SetMajThresh)"
+                        time.sleep(0.05)
 
                 else:
-                    print "Syntax Error (V812)"
+                    GlobalVariables.ServerMessage = "Syntax Error (V812)"
+                    time.sleep(0.05)
                         
         except:
-            print "syntax error"
+            GlobalVariables.ServerMessage = "syntax error"
+            time.sleep(0.05)
         #_VME.V812_Set_Threshold(1, 0,  255)
     
@@ -169,6 +241,7 @@
         threading.Thread.__init__(self)
     def run(self):
+        self.gimmeRates.start()
         oldcommand=GlobalVariables.UserInput
-        while(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"):
+        while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
             CommandToParse=GlobalVariables.UserInput
             if(oldcommand!=CommandToParse):
@@ -179,4 +252,5 @@
 
             
-        print "EXITING PARSER...press <enter> to exit"
+        GlobalVariables.ServerMessage = "EXITING PARSER...press <enter> to exit"
+        time.sleep(0.05)
             
Index: trigger/GlobalVariables.py
===================================================================
--- trigger/GlobalVariables.py	(revision 53)
+++ trigger/GlobalVariables.py	(revision 77)
@@ -7,2 +7,5 @@
 UserInput =''
 Rates = [16]
+ServerMessage=''
+Flag=1
+counter = 0
Index: trigger/ListenToArduino.py
===================================================================
--- trigger/ListenToArduino.py	(revision 77)
+++ trigger/ListenToArduino.py	(revision 77)
@@ -0,0 +1,39 @@
+import threading
+import GlobalVariables
+import serial
+import time
+import datetime
+class ListenToArduino(threading.Thread):
+    ser = serial.Serial('/dev/myArduino', 9600)
+    year = datetime.date.today().year
+    month = datetime.date.today().month
+    day = datetime.date.today().day
+    date=str(year)
+    date+="0"
+    date+=str(month)
+    date+=str(day)
+    filename="Arduino_testing_"+date+".txt"
+    fileHandle = open ( filename, 'w' )
+    fileHandle.close()
+    
+    def run(self):
+        time.sleep(0.01)
+        while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
+            ArduinoMessage = self.ser.readline()
+            GlobalVariables.ServerMessage   = ArduinoMessage
+            #GlobalVariables.ServerMessage   = "[Temp ,28,10]"
+            time.sleep(0.05)
+
+            self.fileHandle = open ( self.filename, 'a' ) 
+            t = datetime.datetime.now()
+            EpochSeconds=time.mktime(t.timetuple())
+            now = datetime.datetime.fromtimestamp(EpochSeconds)
+            
+            if ArduinoMessage[0]=='[':
+                self.fileHandle.write(now.ctime())
+                self.fileHandle.write(" ")
+                self.fileHandle.write(str(EpochSeconds))
+                self.fileHandle.write(" ")
+                self.fileHandle.write(ArduinoMessage)
+            self.fileHandle.close()
+
Index: trigger/Main.py
===================================================================
--- trigger/Main.py	(revision 53)
+++ trigger/Main.py	(revision 77)
@@ -19,4 +19,5 @@
 import GlobalVariables
 import CommunicateWithVME
+import ListenToArduino
 import time
 #connecting to the crates:
@@ -47,5 +48,8 @@
 parseUserInput.start()
 
-while(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"):
+print "listening to Arduino..."
+listenToArduino = ListenToArduino.ListenToArduino()
+listenToArduino.start()
+while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
     time.sleep(0.1)
     #do something
Index: trigger/PythonShell.py
===================================================================
--- trigger/PythonShell.py	(revision 53)
+++ trigger/PythonShell.py	(revision 77)
@@ -12,11 +12,14 @@
 
     def run (self):
-        #outputShell= OutputShell()
-        #OutputShell.start(outputShell)
+        outputShell= OutputShell()
+        OutputShell.start(outputShell)
         
-        while(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"):
+        while(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
             dummy=raw_input("SHELL>>> ")
-            if(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"):
-                GlobalVariables.UserInput = dummy
+            if(GlobalVariables.UserInput[1:]!="exit" and GlobalVariables.UserInput[1:] != "EXIT"):
+                GlobalVariables.counter +=1
+                GlobalVariables.counter%=10
+                GlobalVariables.UserInput = str(GlobalVariables.counter)+dummy
+
             else:
                 break
@@ -31,8 +34,11 @@
     def run (self):
         while(GlobalVariables.UserInput!="exit" and GlobalVariables.UserInput != "EXIT"):
-            if(GlobalVariables.UserInput!=self.lastvar):
-                print "\n(SHELL) You entered:",GlobalVariables.UserInput
+            time.sleep(0.001)
+            if(GlobalVariables.ServerMessage!=self.lastvar):
+                #print "\n(SHELL) You entered:",GlobalVariables.ServerMessage
                 #sys.stdout.write( "SHELL2 >>>")
-                self.lastvar=GlobalVariables.UserInput
+                print GlobalVariables.ServerMessage
+                self.lastvar=GlobalVariables.ServerMessage
+              
         print "EXITING OUTPUTSHELL...press <enter> to exit "
         #sys.exit(0)
Index: trigger/TestClient3.py
===================================================================
--- trigger/TestClient3.py	(revision 53)
+++ trigger/TestClient3.py	(revision 77)
@@ -37,4 +37,5 @@
             send(self.sock,'NAME: ' + self.name) 
             data = receive(self.sock)
+            print data
             # Contains client address, set it
             addr = data.split('CLIENT: ')[1]
Index: trigger/VME.i
===================================================================
--- trigger/VME.i	(revision 53)
+++ trigger/VME.i	(revision 77)
@@ -28,5 +28,5 @@
 int V812_Set_Threshold(short module, short channel, short threshold);
 int V812_Set_Pattern_Inhibit(short module, char channel[16]); 
-int V812_Set_Pattern_Inhibit_Hex(short module, short pattern);
+int V812_Set_Pattern_Inhibit_Hex(short module, int  pattern);
 int V812_Set_Output_Width(short module, char channel_block, short width);
 int V812_Set_Dead_Time(short module, short channel_block, short dead_time);
Index: trigger/VME_wrap.c
===================================================================
--- trigger/VME_wrap.c	(revision 53)
+++ trigger/VME_wrap.c	(revision 77)
@@ -991,8 +991,8 @@
     PyObject *resultobj;
     short arg1 ;
-    short arg2 ;
-    int result;
-    
-    if(!PyArg_ParseTuple(args,(char *)"hh:V812_Set_Pattern_Inhibit_Hex",&arg1,&arg2)) goto fail;
+    int arg2 ;
+    int result;
+    
+    if(!PyArg_ParseTuple(args,(char *)"hi:V812_Set_Pattern_Inhibit_Hex",&arg1,&arg2)) goto fail;
     result = (int)V812_Set_Pattern_Inhibit_Hex(arg1,arg2);
     
Index: trigger/communication.py
===================================================================
--- trigger/communication.py	(revision 53)
+++ trigger/communication.py	(revision 77)
@@ -9,17 +9,26 @@
 unmarshall = cPickle.loads
 
-def send(channel, *args):
-    buf = marshall(args)
-    value = socket.htonl(len(buf))
-    size = struct.pack("L",value)
-    channel.send(size)
+def send(channel, args):
+    #print "will send: ", args
+    args+="\n"
+    buf = args #marshall(args)
+    #value = socket.htonl(len(buf))
+    value = str(len(buf))
+    #size = struct.pack("i",value)
+    print "length: ",len(buf)
+    #print "SIZE: ",repr(size)
+    #channel.send(value)
+    buf+="\0"
     channel.send(buf)
-
+    #print 'sending: ',buf
+    #print 'sent'
 def receive(channel):
 
     size = struct.calcsize("L")
     size = channel.recv(size)
+    print "rec size: ",size
     try:
-        size = socket.ntohl(struct.unpack("L", size)[0])
+        size = socket.ntohl(struct.unpack("i", size)[0])
+        #print "unpacked: ",size
     except struct.error, e:
         return ''
Index: trigger/gui/t72/Makefile
===================================================================
--- trigger/gui/t72/Makefile	(revision 77)
+++ trigger/gui/t72/Makefile	(revision 77)
@@ -0,0 +1,248 @@
+#############################################################################
+# Makefile for building: t72
+# Generated by qmake (2.01a) (Qt 4.4.3) on: Tue Jun 30 09:10:50 2009
+# Project:  t72.pro
+# Template: app
+# Command: /usr/local/Trolltech/Qt-4.4.3/bin/qmake -unix -o Makefile t72.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC            = gcc
+CXX           = g++
+DEFINES       = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS      = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH       = -I/usr/local/Trolltech/Qt-4.4.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtNetwork -I/usr/local/Trolltech/Qt-4.4.3/include/QtNetwork -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include -I. -I. -I.
+LINK          = g++
+LFLAGS        = -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib
+LIBS          = $(SUBLIBS)  -L/usr/local/Trolltech/Qt-4.4.3/lib -lQtGui -L/usr/local/Trolltech/Qt-4.4.3/lib -L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread
+AR            = ar cqs
+RANLIB        = 
+QMAKE         = /usr/local/Trolltech/Qt-4.4.3/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+INSTALL_FILE  = install -m 644 -p
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE      = rm -f
+SYMLINK       = ln -sf
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR   = ./
+
+####### Files
+
+SOURCES       = humidity.cpp \
+		main.cpp \
+		tempsens.cpp \
+		tpixel.cpp moc_humidity.cpp \
+		moc_main.cpp \
+		moc_tempsens.cpp \
+		moc_tpixel.cpp
+OBJECTS       = humidity.o \
+		main.o \
+		tempsens.o \
+		tpixel.o \
+		moc_humidity.o \
+		moc_main.o \
+		moc_tempsens.o \
+		moc_tpixel.o
+DIST          = /usr/local/Trolltech/Qt-4.4.3/mkspecs/common/g++.conf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/unix.conf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/linux.conf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/qconfig.pri \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt_functions.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt_config.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/default_pre.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/release.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/default_post.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/warn_on.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/unix/thread.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/moc.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/resources.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/uic.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/yacc.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/lex.prf \
+		t72.pro
+QMAKE_TARGET  = t72
+DESTDIR       = 
+TARGET        = t72
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+	$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET):  $(OBJECTS)  
+	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: t72.pro  /usr/local/Trolltech/Qt-4.4.3/mkspecs/linux-g++/qmake.conf /usr/local/Trolltech/Qt-4.4.3/mkspecs/common/g++.conf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/unix.conf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/linux.conf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/qconfig.pri \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt_functions.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt_config.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/default_pre.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/release.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/default_post.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/warn_on.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/unix/thread.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/moc.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/resources.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/uic.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/yacc.prf \
+		/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/lex.prf \
+		/usr/local/Trolltech/Qt-4.4.3/lib/libQtGui.prl \
+		/usr/local/Trolltech/Qt-4.4.3/lib/libQtCore.prl \
+		/usr/local/Trolltech/Qt-4.4.3/lib/libQtNetwork.prl
+	$(QMAKE) -unix -o Makefile t72.pro
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/g++.conf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/unix.conf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/common/linux.conf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/qconfig.pri:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt_functions.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt_config.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/exclusive_builds.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/default_pre.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/release.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/default_post.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/warn_on.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/qt.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/unix/thread.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/moc.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/resources.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/uic.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/yacc.prf:
+/usr/local/Trolltech/Qt-4.4.3/mkspecs/features/lex.prf:
+/usr/local/Trolltech/Qt-4.4.3/lib/libQtGui.prl:
+/usr/local/Trolltech/Qt-4.4.3/lib/libQtCore.prl:
+/usr/local/Trolltech/Qt-4.4.3/lib/libQtNetwork.prl:
+qmake:  FORCE
+	@$(QMAKE) -unix -o Makefile t72.pro
+
+dist: 
+	@$(CHK_DIR_EXISTS) .tmp/t721.0.0 || $(MKDIR) .tmp/t721.0.0 
+	$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/t721.0.0/ && $(COPY_FILE) --parents humidity.h main.h tempsens.h tpixel.h .tmp/t721.0.0/ && $(COPY_FILE) --parents humidity.cpp main.cpp tempsens.cpp tpixel.cpp .tmp/t721.0.0/ && (cd `dirname .tmp/t721.0.0` && $(TAR) t721.0.0.tar t721.0.0 && $(COMPRESS) t721.0.0.tar) && $(MOVE) `dirname .tmp/t721.0.0`/t721.0.0.tar.gz . && $(DEL_FILE) -r .tmp/t721.0.0
+
+
+clean:compiler_clean 
+	-$(DEL_FILE) $(OBJECTS)
+	-$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+	-$(DEL_FILE) $(TARGET) 
+	-$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_humidity.cpp moc_main.cpp moc_tempsens.cpp moc_tpixel.cpp
+compiler_moc_header_clean:
+	-$(DEL_FILE) moc_humidity.cpp moc_main.cpp moc_tempsens.cpp moc_tpixel.cpp
+moc_humidity.cpp: humidity.h
+	/usr/local/Trolltech/Qt-4.4.3/bin/moc $(DEFINES) $(INCPATH) humidity.h -o moc_humidity.cpp
+
+moc_main.cpp: tpixel.h \
+		tempsens.h \
+		humidity.h \
+		main.h
+	/usr/local/Trolltech/Qt-4.4.3/bin/moc $(DEFINES) $(INCPATH) main.h -o moc_main.cpp
+
+moc_tempsens.cpp: tempsens.h
+	/usr/local/Trolltech/Qt-4.4.3/bin/moc $(DEFINES) $(INCPATH) tempsens.h -o moc_tempsens.cpp
+
+moc_tpixel.cpp: tpixel.h
+	/usr/local/Trolltech/Qt-4.4.3/bin/moc $(DEFINES) $(INCPATH) tpixel.h -o moc_tpixel.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+	-$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean 
+
+####### Compile
+
+humidity.o: humidity.cpp humidity.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o humidity.o humidity.cpp
+
+main.o: main.cpp main.h \
+		tpixel.h \
+		tempsens.h \
+		humidity.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+tempsens.o: tempsens.cpp tempsens.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tempsens.o tempsens.cpp
+
+tpixel.o: tpixel.cpp tpixel.h
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o tpixel.o tpixel.cpp
+
+moc_humidity.o: moc_humidity.cpp 
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_humidity.o moc_humidity.cpp
+
+moc_main.o: moc_main.cpp 
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_main.o moc_main.cpp
+
+moc_tempsens.o: moc_tempsens.cpp 
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_tempsens.o moc_tempsens.cpp
+
+moc_tpixel.o: moc_tpixel.cpp 
+	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_tpixel.o moc_tpixel.cpp
+
+####### Install
+
+install:   FORCE
+
+uninstall:   FORCE
+
+FORCE:
+
Index: trigger/gui/t72/humidity.cpp
===================================================================
--- trigger/gui/t72/humidity.cpp	(revision 77)
+++ trigger/gui/t72/humidity.cpp	(revision 77)
@@ -0,0 +1,51 @@
+#include <QColor>
+
+#include <QVBoxLayout>
+#include <QPainter>
+#include "humidity.h"
+
+ 
+Humidity::Humidity( QWidget *parent )  : QWidget( parent)
+{
+  //setPalette( QPalette( QColor( 250, 250, 200) ) );
+  //this->setPalette( QPalette( QColor( 250, 250, 200) ) );
+  bgColor= new QColor(200,200,200);
+  this->setAutoFillBackground (1);
+}  
+float Humidity::value() 
+{
+  return val;
+
+}
+void Humidity::paintEvent( QPaintEvent * )
+{
+  QString s = QString( "%1\%" ).arg((double)(val));
+  QFont sansFont( "Helvetica [Cronyx]", 12 );
+  
+    QPainter p( this );
+    p.setFont(sansFont);
+    p.setPen(Qt::white);
+    int width=this->width();
+    int height=this->height();
+    p.drawText(width/3 , height/2, s );
+}
+
+void Humidity::setValue( float vall )
+{
+  val=vall;
+  int bblue= (int)(((float)(val-MinVal)/(float)(MaxVal-MinVal))*255.);
+
+  //int bblue=255-(int)(((float)(val-MinVal)/(float)(MaxVal-MinVal))*255.);
+  //printf("%i %i\n",rred,bblue);
+  bgColor->setRgb(0,0,bblue);
+   //QPalette::ColorRole
+   QPalette *mypalette=new QPalette();
+   //   mypalette->setColor ( mypalette->Base, *bgColor );
+   mypalette->setColor ( mypalette->Base, Qt::red);
+   //this->setBackgroundRole (mypalette->Shadow);
+   //this->setBackgroundColor(*bgColor);
+   repaint();
+   this->setPalette( QPalette( *bgColor ) );
+  emit valueChanged(val);
+
+}
Index: trigger/gui/t72/humidity.h
===================================================================
--- trigger/gui/t72/humidity.h	(revision 77)
+++ trigger/gui/t72/humidity.h	(revision 77)
@@ -0,0 +1,41 @@
+#ifndef HUMIDITY_H
+#define HUMIDITY_H
+
+
+#include <QWidget>
+#include <QVBoxLayout>
+
+class Humidity : public QWidget
+{
+  float MaxVal;
+  float MinVal;
+    Q_OBJECT
+public:
+    Humidity( QWidget *parent=0 );
+    float value();
+    void setMaxVal(float val){MaxVal=val;};
+    void setMinVal(float val){MinVal=val;};
+    float getMaxVal(){return MaxVal;};
+    float getMinVal(){return MinVal;};
+ private:
+    float val;
+    
+    QVBoxLayout*  ColorWidg;
+ public slots:
+    void setValue( float );
+ 
+
+    
+ signals:
+    void valueChanged( float );
+
+ protected:
+    void paintEvent( QPaintEvent * );   
+ private:
+    QColor *bgColor;
+    //QSlider *slider;
+};
+
+
+#endif // HUMIDITY_H
+
Index: trigger/gui/t72/main.cpp
===================================================================
--- trigger/gui/t72/main.cpp	(revision 77)
+++ trigger/gui/t72/main.cpp	(revision 77)
@@ -0,0 +1,519 @@
+#include <QApplication>
+#include <QFont>
+#include <QGridLayout>
+
+#include <QPushButton>
+
+#include "main.h"
+#include <QThread>
+#include <QTimer>
+#include <time.h>
+
+
+
+void sleep_now(unsigned int mseconds)
+{
+  printf("in  %i\n",clock());
+  clock_t goal = mseconds + clock();
+
+  while (goal > clock());
+  printf("out %i\n",goal);
+}
+
+
+
+ MyWidget::MyWidget(QWidget *parent)
+     : QWidget(parent)
+ {
+   //PixelToTriggerPixel=new int[16];
+   
+
+   PixelToTriggerPixel=new int[16];
+   /* PixelToTriggerPixel[0]= 25;
+   PixelToTriggerPixel[1]= 26;
+   PixelToTriggerPixel[2]= 27;
+   PixelToTriggerPixel[3]= 28;
+   PixelToTriggerPixel[4]= 19;
+   PixelToTriggerPixel[5]= 20;
+   PixelToTriggerPixel[6]= 21;
+   PixelToTriggerPixel[7]= 22;
+   PixelToTriggerPixel[8]= 13;
+   PixelToTriggerPixel[9]= 14;
+   PixelToTriggerPixel[10]= 15;
+   PixelToTriggerPixel[11]= 16;
+   PixelToTriggerPixel[12]= 7;
+   PixelToTriggerPixel[13]= 8;
+   PixelToTriggerPixel[14]= 9;
+   PixelToTriggerPixel[15]= 10;*/
+   
+   PixelToTriggerPixel[0]= 25;
+   PixelToTriggerPixel[1]= 26;
+   PixelToTriggerPixel[2]= 27;
+   PixelToTriggerPixel[3]= 28;
+   PixelToTriggerPixel[4]= 19;
+   PixelToTriggerPixel[5]= 20;
+   PixelToTriggerPixel[6]= 21;
+   PixelToTriggerPixel[7]= 22;
+   PixelToTriggerPixel[8]= 13;
+   PixelToTriggerPixel[9]= 14;
+   PixelToTriggerPixel[10]= 15;
+   PixelToTriggerPixel[11]= 16;
+   PixelToTriggerPixel[12]= 7;
+   PixelToTriggerPixel[13]= 8;
+   PixelToTriggerPixel[14]= 9;
+   PixelToTriggerPixel[15]= 10;
+   ListToTemperaturePixel = new int[7];
+   ListToTemperaturePixel[0] = 5;
+   ListToTemperaturePixel[1] = 1;
+   ListToTemperaturePixel[2] = 0;
+   ListToTemperaturePixel[3] = 2;
+   ListToTemperaturePixel[4] = 3;
+   ListToTemperaturePixel[5] = 4;
+   ListToTemperaturePixel[6] = 6;
+    SocketWindow = new QWidget();
+   SocketWindow->setWindowTitle("trigger - Socket Interface");
+   Socket = new QTcpSocket(SocketWindow);
+   connect(Socket, SIGNAL(readyRead()), this, SLOT(ReadFromSocket()));
+   //connect(Socket, SIGNAL(disconnected()), this, SLOT(GotDisconnected()));
+   WaitForData=false;
+   ManualDisconnect=false;
+  
+   IPAddress = new QLineEdit(SocketWindow);
+   IPAddress->setText("eth-vme02");
+   IPAddress->setToolTip("Address of socket server");
+   AddressLayout = new QFormLayout;
+   AddressLayout->addRow("&Remote Address", IPAddress);
+   
+   Port = new QSpinBox(SocketWindow);
+   Port->setRange(0,65535);
+   Port->setValue(3492);
+   Port->setToolTip("Port number of socket server");
+   PortLayout = new QFormLayout;  
+   PortLayout->addRow("&Port", Port);
+  
+
+    // Button to make connection
+  Connect = new QPushButton("Connect", SocketWindow);
+  Connect->setFont(QFont("Times", 10, QFont::Bold));
+  connect(Connect, SIGNAL(clicked()), this, SLOT(MakeConnection()));
+  Connect->setToolTip("Connect to server");
+  SocketButton = new QPushButton("Socke&t\nInterface",this);
+  SocketButton->setFont(QFont("Times", 10, QFont::Bold));
+  connect(SocketButton, SIGNAL(clicked()), this, SLOT(OpenSocketWindow()));
+  SocketButton->setToolTip("Open window for socket communication");
+
+
+  connect(SocketButton, SIGNAL(clicked()), this, SLOT(OpenSocketWindow()));
+  QPushButton *quit = new QPushButton(tr("Quit"));
+  quit->setFont(QFont("Times", 18, QFont::Bold));
+  Command = new QLineEdit(SocketWindow);
+  CommandLayout = new QFormLayout;  
+  CommandLayout->addRow("&Command", Command);
+  Command->setEnabled(false);
+  connect(Command, SIGNAL(returnPressed()), this, SLOT(SendToSocket()));
+  Command->setToolTip("Command to send to socket server");
+
+   // Text box for socket output
+  SocketOutput= new QPlainTextEdit(SocketWindow);
+  SocketOutput->setReadOnly(true);
+  SocketOutput->setMaximumBlockCount(MAX_OUTPUT_LINES);
+  SocketOutput->setToolTip("Output of socket server");
+
+ // Layout of all widgets
+  SocketLayout = new QGridLayout(SocketWindow);
+  SocketLayout->addLayout(AddressLayout, 0, 0, 0, 1);
+  SocketLayout->addLayout(PortLayout, 0, 2);
+  SocketLayout->addWidget(Connect, 0, 3);
+  SocketLayout->addLayout(CommandLayout, 1, 0, 1, 4);
+  SocketLayout->addWidget(SocketOutput, 2, 0, 4, 4);  
+
+  connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
+
+      QGridLayout *grid = new QGridLayout;
+
+    
+     pixels = new Tpixel*[36];
+     
+     int i=0;
+     for( int row = 0 ; row <6 ; row++ ) 
+       {
+	 for( int col = 0 ; col < 6 ; col++) 
+	   {
+
+	   
+	     //int i=row+6*col;
+	     pixels[i] = new Tpixel;
+	     grid->addWidget(pixels[i], row+1, col+1);
+	     
+	     //pixels[i]->setValue((int)((i)*255./36.));
+	     pixels[i]->setValue((int)(0));
+	     pixels[i]->setMaxVal(1000);
+	     pixels[i]->setMinimumSize ( 50, 50 );	 
+	     pixels[i]->setMaximumSize ( 50, 50 );	 
+	     i++;
+	   }
+	 
+       }
+
+     humidity = new Humidity*[1];
+     humidity[0] = new Humidity;
+     
+     humidity[0]->setMaxVal(100);
+     humidity[0]->setMinVal(0);
+     humidity[0]->setValue((int)(50));
+     humidity[0]->setMinimumSize ( 70, 40 );	 
+     humidity[0]->setMaximumSize ( 70, 40 );
+     tempsens=new Tempsens*[7];
+     for(int j=0;j<7;j++)
+       {
+	 tempsens[j]=new Tempsens;
+	 tempsens[j]->setMaxVal(35);
+	 tempsens[j]->setMinVal(5);
+	 tempsens[j]->setValue((int)(5+j));
+	 tempsens[j]->setMinimumSize ( 70, 70 );	 
+	 tempsens[j]->setMaximumSize ( 70, 70 );
+       }
+     QHBoxLayout *hlay = new QHBoxLayout;
+     //hlay->addWidget(tempsens[0]);
+     hlay->addWidget(SocketButton);
+     hlay->addWidget(quit);
+     //hlay->addWidget(tempsens[1]);
+     grid->addWidget(tempsens[0],0,0);
+     grid->addWidget(tempsens[1],0,7);
+     grid->addWidget(tempsens[2],7,0);
+     grid->addWidget(tempsens[3],7,7);
+     tempsens[4]->setMinimumSize ( 70, 50 );	 
+     tempsens[5]->setMinimumSize ( 70, 50 );	 
+     grid->addWidget(tempsens[4],1,8);
+     grid->addWidget(tempsens[5],5,8);
+
+     QVBoxLayout *humlay = new QVBoxLayout;
+  
+     tempsens[6]->setMinimumSize ( 70, 40 );	 
+     tempsens[6]->setMaximumSize ( 70, 40 );
+     humlay->addWidget(humidity[0]);
+     humlay->addWidget(tempsens[6]);
+     humlay->setSpacing (0); 
+     //humlay->setVerticalSpacing(0) ;
+     grid->addLayout(humlay,2,8,3,1);
+ 
+     //grid->addWidget(tempsens[6],4,8);
+
+     QVBoxLayout *layout = new QVBoxLayout;
+     layout->addLayout(hlay);
+     //layout->addWidget(SocketButton);
+     layout->addLayout(grid);
+
+     //layout->setColumnStretch(1, 10);
+
+     setLayout(layout);
+
+     //a time to update the pixel rates every 5 seconds:
+     QTimer *timer = new QTimer(this);
+     connect(timer, SIGNAL(timeout()),this , SLOT(updateRates()));
+     
+     timer->start(7000);
+
+
+
+
+ }
+void MyWidget::updateRates()
+{
+  if(Socket->state() == QAbstractSocket::ConnectedState)
+    {
+      char command[]= "V560 GetRates 1 \n\0";
+      SocketOutput->insertPlainText(command);
+      Socket->write(command);
+      //QByteArray   bytes  = command.toAscii();
+      //const char * ptr    = bytes.data();
+      printf(command);
+
+      //usleep(3000000);
+      //SleeperThread::msleep(1000);
+
+      /*const char tmp[]="V560 GetRate 1 5 \n\0";
+      printf(tmp);
+      Socket->write(tmp);
+      SocketOutput->insertPlainText(tmp);*/
+	
+	      
+    }
+}
+// +++ Open sub window handling the socket interface +++
+void MyWidget::OpenSocketWindow() {
+  SocketWindow->show();
+
+  //  if(SocketWindow->isVisible()) SocketWindow->hide();
+  //else SocketWindow->show();
+}
+
+// +++ Acquire data through socket (acquire botton only available if socket exists) +++
+void MyWidget::GetSignalFromSocket() {
+  char Command[MAX_COM_SIZE];
+
+  GetButton->setEnabled(false);
+  WaitForData = true;
+  sprintf(Command, "test");//, BoardNo->value(), ChannelNo->value()/10, ChannelNo->value()%10);
+  Socket->write(Command);
+}
+
+// Quit application when clicking close button on window
+
+
+// +++ Connecting or disconnecting from client +++
+void MyWidget::MakeConnection() {
+  printf("Connecting...\n");
+  if(Socket->state() == QAbstractSocket::ConnectedState) {
+    ManualDisconnect = true;
+    Socket->disconnectFromHost();
+    Connect->setText("Connect");
+  }
+  else {
+     
+    Socket->connectToHost(IPAddress->text(),Port->value());
+
+
+    
+    Connect->setEnabled(false);  // While waiting for connection, button not available
+    Socket->waitForConnected(SOCKET_TIMEOUT);
+    Connect->setEnabled(true);
+    if(Socket->state() != QAbstractSocket::ConnectedState)
+      QMessageBox::warning(this, "MyWidget Message","Could not connect to host.",QMessageBox::Ok);
+    else {
+      //Connect->setText("Disconnect");
+      //ConnectAction->setText("Disconnect");
+      Port->setEnabled(false);
+      IPAddress->setEnabled(false);
+      Command->setEnabled(true);
+      //GetButton->setEnabled(true);
+      ManualDisconnect = false;
+      Connect->setText("Disconnect");
+
+      /*      OpenAction->setEnabled(false);      
+      FilenameBox->setEnabled(false);
+      LoadButton->setEnabled(false);
+      FilenameBox->clear();
+      CloseDatafile();*/
+
+      /*      ChannelNo->setEnabled(true);
+      BoardNo->setEnabled(true);
+      PixelID->setEnabled(true);
+      ChannelNo->setRange(0, 65535);
+      BoardNo->setRange(0, 65535);
+      
+      TabWidget->setTabEnabled(1,false);
+      TabWidget->setTabEnabled(2,false);
+
+      RunHeaderDisplay->clear();
+      EventHeaderDisplay->clear();
+      Signal->hide();*/
+    }
+  }
+}
+
+// +++ Send command to socket (command button available only if socket existing) +++
+void MyWidget::SendToSocket() {
+  // QMessageBox::warning(this, "sdfsdf","sending to socket...",QMessageBox::Ok);
+  //QString
+  /*int length = strlen(Command->text().toAscii());
+  printf("send length: %i\n", length);
+  char buf[4];
+
+  buf[0] = (char) length;
+  buf[1] = (char) length >> 8;
+  buf[2] = (char) length >> 16;
+  buf[3] = (char) length >> 24;
+
+
+  Socket->write(buf);*/
+  Socket->write(Command->text().toAscii());
+  Command->clear();
+}
+
+// +++ Read data from socket and display +++
+void MyWidget::ParseData(QString data)
+{
+  data = data.remove(QChar('['));
+  data = data.remove(QChar(']'));
+data = data.remove(QChar('\ '));
+  data = data.trimmed();
+  QStringList list1 = data.split(",",QString::SkipEmptyParts);
+  int numberofelements = list1.count();
+  printf("%i\n",numberofelements);
+  numberofelements--;
+  
+  if(list1[0]=="Temp")
+    {
+      printf("updating temp...\n");
+      list1.removeAt(0);
+      float temperature[numberofelements];
+      if (numberofelements>7) numberofelements = 7;
+      for(int i =0;i<numberofelements;i++)
+	{ 
+	  temperature[i]= list1[i].toFloat();
+	  QString stri;
+	  stri=QString("%1").arg(ListToTemperaturePixel[i]);
+	  
+	  QString output = "Setting temperature of sensor  "+stri + " to " + list1[i]+"c\n";
+	  SocketOutput->insertPlainText(output);
+	  tempsens[ListToTemperaturePixel[i]]->setValue((int)(temperature[i]));
+	}
+      temperature[7]= list1[7].toFloat();
+      humidity[0]->setValue(temperature[7]);
+      //printf("hum: %i\n",temperature[7]);
+    }
+  if(list1[0]=="\'rates\'")
+    {
+      list1.removeAt(0);
+      float rates[numberofelements];
+      for(int j =0;j<numberofelements;j++)
+	{
+	  // pixels[j]->setMaxVal(1);
+	}
+      for(int i =0;i<numberofelements;i++)
+	{ 
+	  
+	  rates[i]= list1[i].toFloat();
+	  QString stri;
+	  stri=QString("%1").arg(PixelToTriggerPixel[i]);
+	  
+	  QString output = "Setting rates of trigger pixel "+stri + " to " + list1[i]+"\n";
+	  SocketOutput->insertPlainText(output);
+	  pixels[PixelToTriggerPixel[i]]->setValue((int)(rates[i]));
+	  /*if(rates[i]>pixels[i]->getMaxVal())
+	    {
+	    for(int j =0;j<numberofelements;j++)
+	    {
+	    pixels[j]->setMaxVal(rates[i]);
+	    }
+	    
+	    }*/
+	  // pixels[i]->setMaxVal(255);
+	}
+    }
+
+
+}
+void MyWidget::ReadFromSocket() {
+  // Check if channel data expected and error message arrived
+  /*char Data[1024];
+  printf("size of int: %i\n",sizeof(int));
+  char cSize[sizeof(int)];
+  int Size;
+  
+  int numBytes=Socket->read(cSize,sizeof(int));
+  Size=(int)(cSize);
+  printf ("numbytes: %i\n",numBytes);
+  printf("csize: %x\n",cSize);
+  printf("size: %i\n",Size);
+  
+  numBytes+http://www.google.ch/firefox?client=firefox-a&rls=org.mozilla:en-US:official=Socket->read(Data,Size);
+  printf("Data:%s\n",Data);/**/
+
+  //QByteArray command;
+  char command[1024];
+  Socket->read(command,1023);
+  printf("cc: %s\n",command);
+  QString temp(command);
+  //SocketOutput->insertPlainText(command);
+  if(temp[0]!=QChar('['))
+    SocketOutput->insertPlainText(temp);
+  else
+    ParseData(temp);
+
+
+
+   //QString qData(Data);
+
+  //char * cData = Data.constData ();
+  
+  //if (WaitForData && Data.contains("Error")) {
+  // WaitForData = false;
+    //GetButton->setEnabled(true);
+  // QMessageBox::warning(this, "MyWidget Message","Could not read waveform data from socket.",QMessageBox::Ok);
+  // return;
+  // }
+
+  // Check if channel data were transmitted, if yes and waiting for data, extract and plot them
+  /*printf("num bytes: %i",numBytes);
+   QString temp(numBytes);
+   SocketOutput->insertPlainText(temp);
+   SocketOutput->insertPlainText(Data);
+   SocketOutput->insertPlainText("TTT");
+  printf("Data\n");
+  printf("%s",Data);*/
+  //QString Text = SocketOutput->document()->toPlainText().trimmed();
+  /*usleep(100000);	// Wait to limit maximum update rate
+  GetSignalFromSocket();*/
+  /*if (WaitForData && Text.endsWith(QLatin1String("==END=="))) {
+    // Extract text between ==START== and ==END==
+    QByteArray Data=Text.mid(Text.lastIndexOf("==START==")+9,Text.length()-Text.lastIndexOf("==START==")-16).toAscii();
+
+    char *NextNumber = strtok(Data.data()," ");  // Number of entries that follow
+    int Count=0, NumberOfEntries = atoi(NextNumber);
+    double *x = new double [NumberOfEntries];
+    double *y = new double [NumberOfEntries];
+
+    // Convert all entries (separated by a whitespace) to numbers
+    while((NextNumber=strtok(NULL, " "))!=NULL && Count<NumberOfEntries)
+      *(y+Count++) = atof(NextNumber);
+    if (Count==NumberOfEntries && NextNumber!=0)
+      QMessageBox::warning(this, "MyWidget Message","Found too many numbers in data block, truncated.",QMessageBox::Ok);
+    // Apply sampling frequency and scaling factor 
+    for(int i=2; i<Count; i++) {
+      x[i] = (i-2) / y[0];
+      y[i] = y[i] * y[1];
+    }
+    if(NumberOfEntries>2) {
+      Signal->setData(x+2, y+2, NumberOfEntries-2); // Copies data, arrays can be deleted afterwards
+      Signal->show();
+      Zoomer->setZoomBase(Signal->boundingRect());
+    }  
+    delete[] x;   delete[] y;
+
+    if(ContinuousBox->isChecked()) {
+      usleep(100000);	// Wait to limit maximum update rate
+      GetSignalFromSocket();
+    }
+    else {
+      WaitForData = false;
+      GetButton->setEnabled(true);
+    }
+    }*/
+}
+
+// +++ Disconnect from socket +++
+void MyWidget::GotDisconnected() {
+  Connect->setText("Connect");
+  //ConnectAction->setText("Connect");
+  Port->setEnabled(true);
+  IPAddress->setEnabled(true);
+  Command->setEnabled(false);
+
+  GetButton->setEnabled(false);
+  /*FilenameBox->setEnabled(true);
+  OpenAction->setEnabled(true);    
+  LoadButton->setEnabled(true);
+  ChannelNo->setEnabled(false);
+  BoardNo->setEnabled(false);
+  PixelID->setEnabled(false);
+  Signal->hide();
+  TabWidget->setTabEnabled(1, true);
+  TabWidget->setTabEnabled(2, true);*/
+  
+  SocketOutput->clear();
+  if(!ManualDisconnect) QMessageBox::warning(this, "MyWidget Message","Socket disconnected, maybe host gone.",QMessageBox::Ok);
+}
+
+
+
+ int main(int argc, char *argv[])
+ {
+     QApplication app(argc, argv);
+     MyWidget widget;
+     widget.resize(400,400);
+     widget.show();
+     return app.exec();
+ }
+
Index: trigger/gui/t72/main.h
===================================================================
--- trigger/gui/t72/main.h	(revision 77)
+++ trigger/gui/t72/main.h	(revision 77)
@@ -0,0 +1,48 @@
+#include <QtNetwork/QTcpSocket>
+#include <QtNetwork/QAbstractSocket>
+#include <QWidget>
+#include <QtGui>
+#include "tpixel.h"
+#include "tempsens.h"
+#include "humidity.h"
+#include <QString>
+#define SOCKET_TIMEOUT 10000	// Milliseconds to wait for socket connection
+#define MAX_OUTPUT_LINES 200	// Maximum number of lines in socket output window
+#define MAX_COM_SIZE 10000
+#define INITIAL_DIRECTORY ""
+
+ class MyWidget : public QWidget
+ {
+
+   Q_OBJECT
+     Tpixel **pixels;
+   Tempsens **tempsens;
+   Humidity **humidity;
+ public:
+   int* PixelToTriggerPixel;
+   int* ListToTemperaturePixel;
+  MyWidget( QWidget *parent=0 );
+   QTcpSocket *Socket;
+   QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput;
+   QSpinBox *Port;
+   QLineEdit *IPAddress,*Command;
+   QWidget *SocketWindow;
+   QFormLayout *CommandLayout, *PortLayout, *AddressLayout;
+   QPushButton *GetButton, *SocketButton, *Connect;
+   QGridLayout *SocketLayout;
+   QAction *ConnectAction;
+ private:
+   void ParseData(QString data);
+   bool WaitForData,ManualDisconnect;
+   private slots:
+     void OpenSocketWindow();
+   void GetSignalFromSocket();
+   void MakeConnection();
+   void SendToSocket();
+   void ReadFromSocket();
+    void GotDisconnected();
+    void updateRates();
+    /*  void MenuAbout();*/
+};
+
+
Index: trigger/gui/t72/moc_humidity.cpp
===================================================================
--- trigger/gui/t72/moc_humidity.cpp	(revision 77)
+++ trigger/gui/t72/moc_humidity.cpp	(revision 77)
@@ -0,0 +1,83 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'humidity.h'
+**
+** Created: Tue Jun 30 09:13:29 2009
+**      by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "humidity.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'humidity.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 59
+#error "This file was generated using the moc from 4.4.3. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_Humidity[] = {
+
+ // content:
+       1,       // revision
+       0,       // classname
+       0,    0, // classinfo
+       2,   10, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+
+ // signals: signature, parameters, type, tag, flags
+      10,    9,    9,    9, 0x05,
+
+ // slots: signature, parameters, type, tag, flags
+      30,    9,    9,    9, 0x0a,
+
+       0        // eod
+};
+
+static const char qt_meta_stringdata_Humidity[] = {
+    "Humidity\0\0valueChanged(float)\0"
+    "setValue(float)\0"
+};
+
+const QMetaObject Humidity::staticMetaObject = {
+    { &QWidget::staticMetaObject, qt_meta_stringdata_Humidity,
+      qt_meta_data_Humidity, 0 }
+};
+
+const QMetaObject *Humidity::metaObject() const
+{
+    return &staticMetaObject;
+}
+
+void *Humidity::qt_metacast(const char *_clname)
+{
+    if (!_clname) return 0;
+    if (!strcmp(_clname, qt_meta_stringdata_Humidity))
+        return static_cast<void*>(const_cast< Humidity*>(this));
+    return QWidget::qt_metacast(_clname);
+}
+
+int Humidity::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QWidget::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        switch (_id) {
+        case 0: valueChanged((*reinterpret_cast< float(*)>(_a[1]))); break;
+        case 1: setValue((*reinterpret_cast< float(*)>(_a[1]))); break;
+        }
+        _id -= 2;
+    }
+    return _id;
+}
+
+// SIGNAL 0
+void Humidity::valueChanged(float _t1)
+{
+    void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
+    QMetaObject::activate(this, &staticMetaObject, 0, _a);
+}
+QT_END_MOC_NAMESPACE
Index: trigger/gui/t72/moc_main.cpp
===================================================================
--- trigger/gui/t72/moc_main.cpp	(revision 77)
+++ trigger/gui/t72/moc_main.cpp	(revision 77)
@@ -0,0 +1,86 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'main.h'
+**
+** Created: Tue Jun 30 09:13:30 2009
+**      by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "main.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'main.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 59
+#error "This file was generated using the moc from 4.4.3. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_MyWidget[] = {
+
+ // content:
+       1,       // revision
+       0,       // classname
+       0,    0, // classinfo
+       7,   10, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+
+ // slots: signature, parameters, type, tag, flags
+      10,    9,    9,    9, 0x08,
+      29,    9,    9,    9, 0x08,
+      51,    9,    9,    9, 0x08,
+      68,    9,    9,    9, 0x08,
+      83,    9,    9,    9, 0x08,
+     100,    9,    9,    9, 0x08,
+     118,    9,    9,    9, 0x08,
+
+       0        // eod
+};
+
+static const char qt_meta_stringdata_MyWidget[] = {
+    "MyWidget\0\0OpenSocketWindow()\0"
+    "GetSignalFromSocket()\0MakeConnection()\0"
+    "SendToSocket()\0ReadFromSocket()\0"
+    "GotDisconnected()\0updateRates()\0"
+};
+
+const QMetaObject MyWidget::staticMetaObject = {
+    { &QWidget::staticMetaObject, qt_meta_stringdata_MyWidget,
+      qt_meta_data_MyWidget, 0 }
+};
+
+const QMetaObject *MyWidget::metaObject() const
+{
+    return &staticMetaObject;
+}
+
+void *MyWidget::qt_metacast(const char *_clname)
+{
+    if (!_clname) return 0;
+    if (!strcmp(_clname, qt_meta_stringdata_MyWidget))
+        return static_cast<void*>(const_cast< MyWidget*>(this));
+    return QWidget::qt_metacast(_clname);
+}
+
+int MyWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QWidget::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        switch (_id) {
+        case 0: OpenSocketWindow(); break;
+        case 1: GetSignalFromSocket(); break;
+        case 2: MakeConnection(); break;
+        case 3: SendToSocket(); break;
+        case 4: ReadFromSocket(); break;
+        case 5: GotDisconnected(); break;
+        case 6: updateRates(); break;
+        }
+        _id -= 7;
+    }
+    return _id;
+}
+QT_END_MOC_NAMESPACE
Index: trigger/gui/t72/moc_tempsens.cpp
===================================================================
--- trigger/gui/t72/moc_tempsens.cpp	(revision 77)
+++ trigger/gui/t72/moc_tempsens.cpp	(revision 77)
@@ -0,0 +1,83 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'tempsens.h'
+**
+** Created: Mon Jun 29 16:21:16 2009
+**      by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "tempsens.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'tempsens.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 59
+#error "This file was generated using the moc from 4.4.3. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_Tempsens[] = {
+
+ // content:
+       1,       // revision
+       0,       // classname
+       0,    0, // classinfo
+       2,   10, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+
+ // signals: signature, parameters, type, tag, flags
+      10,    9,    9,    9, 0x05,
+
+ // slots: signature, parameters, type, tag, flags
+      30,    9,    9,    9, 0x0a,
+
+       0        // eod
+};
+
+static const char qt_meta_stringdata_Tempsens[] = {
+    "Tempsens\0\0valueChanged(float)\0"
+    "setValue(float)\0"
+};
+
+const QMetaObject Tempsens::staticMetaObject = {
+    { &QWidget::staticMetaObject, qt_meta_stringdata_Tempsens,
+      qt_meta_data_Tempsens, 0 }
+};
+
+const QMetaObject *Tempsens::metaObject() const
+{
+    return &staticMetaObject;
+}
+
+void *Tempsens::qt_metacast(const char *_clname)
+{
+    if (!_clname) return 0;
+    if (!strcmp(_clname, qt_meta_stringdata_Tempsens))
+        return static_cast<void*>(const_cast< Tempsens*>(this));
+    return QWidget::qt_metacast(_clname);
+}
+
+int Tempsens::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QWidget::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        switch (_id) {
+        case 0: valueChanged((*reinterpret_cast< float(*)>(_a[1]))); break;
+        case 1: setValue((*reinterpret_cast< float(*)>(_a[1]))); break;
+        }
+        _id -= 2;
+    }
+    return _id;
+}
+
+// SIGNAL 0
+void Tempsens::valueChanged(float _t1)
+{
+    void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
+    QMetaObject::activate(this, &staticMetaObject, 0, _a);
+}
+QT_END_MOC_NAMESPACE
Index: trigger/gui/t72/moc_tpixel.cpp
===================================================================
--- trigger/gui/t72/moc_tpixel.cpp	(revision 77)
+++ trigger/gui/t72/moc_tpixel.cpp	(revision 77)
@@ -0,0 +1,82 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'tpixel.h'
+**
+** Created: Mon Jun 29 16:21:17 2009
+**      by: The Qt Meta Object Compiler version 59 (Qt 4.4.3)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#include "tpixel.h"
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#error "The header file 'tpixel.h' doesn't include <QObject>."
+#elif Q_MOC_OUTPUT_REVISION != 59
+#error "This file was generated using the moc from 4.4.3. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_Tpixel[] = {
+
+ // content:
+       1,       // revision
+       0,       // classname
+       0,    0, // classinfo
+       2,   10, // methods
+       0,    0, // properties
+       0,    0, // enums/sets
+
+ // signals: signature, parameters, type, tag, flags
+       8,    7,    7,    7, 0x05,
+
+ // slots: signature, parameters, type, tag, flags
+      26,    7,    7,    7, 0x0a,
+
+       0        // eod
+};
+
+static const char qt_meta_stringdata_Tpixel[] = {
+    "Tpixel\0\0valueChanged(int)\0setValue(int)\0"
+};
+
+const QMetaObject Tpixel::staticMetaObject = {
+    { &QWidget::staticMetaObject, qt_meta_stringdata_Tpixel,
+      qt_meta_data_Tpixel, 0 }
+};
+
+const QMetaObject *Tpixel::metaObject() const
+{
+    return &staticMetaObject;
+}
+
+void *Tpixel::qt_metacast(const char *_clname)
+{
+    if (!_clname) return 0;
+    if (!strcmp(_clname, qt_meta_stringdata_Tpixel))
+        return static_cast<void*>(const_cast< Tpixel*>(this));
+    return QWidget::qt_metacast(_clname);
+}
+
+int Tpixel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+    _id = QWidget::qt_metacall(_c, _id, _a);
+    if (_id < 0)
+        return _id;
+    if (_c == QMetaObject::InvokeMetaMethod) {
+        switch (_id) {
+        case 0: valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
+        case 1: setValue((*reinterpret_cast< int(*)>(_a[1]))); break;
+        }
+        _id -= 2;
+    }
+    return _id;
+}
+
+// SIGNAL 0
+void Tpixel::valueChanged(int _t1)
+{
+    void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
+    QMetaObject::activate(this, &staticMetaObject, 0, _a);
+}
+QT_END_MOC_NAMESPACE
Index: trigger/gui/t72/t72.pro
===================================================================
--- trigger/gui/t72/t72.pro	(revision 77)
+++ trigger/gui/t72/t72.pro	(revision 77)
@@ -0,0 +1,13 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Jun 30 09:10:38 2009
+######################################################################
+
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += humidity.h main.h tempsens.h tpixel.h
+SOURCES += humidity.cpp main.cpp tempsens.cpp tpixel.cpp
+QT += network
Index: trigger/gui/t72/tempsens.cpp
===================================================================
--- trigger/gui/t72/tempsens.cpp	(revision 77)
+++ trigger/gui/t72/tempsens.cpp	(revision 77)
@@ -0,0 +1,51 @@
+#include <QColor>
+
+#include <QVBoxLayout>
+#include <QPainter>
+ #include "tempsens.h"
+
+ 
+Tempsens::Tempsens( QWidget *parent )  : QWidget( parent)
+{
+  //setPalette( QPalette( QColor( 250, 250, 200) ) );
+  //this->setPalette( QPalette( QColor( 250, 250, 200) ) );
+  bgColor= new QColor(200,200,200);
+  this->setAutoFillBackground (1);
+}  
+float Tempsens::value() 
+{
+  return val;
+
+}
+void Tempsens::paintEvent( QPaintEvent * )
+{
+  QString s = QString( "%1c" ).arg((double)(val));
+  QFont sansFont( "Helvetica [Cronyx]", 12 );
+  
+    QPainter p( this );
+    p.setFont(sansFont);
+    p.setPen(Qt::white);
+    int width=this->width();
+    int height=this->height();
+    p.drawText(width/3 , height/2, s );
+}
+
+void Tempsens::setValue( float vall )
+{
+  val=vall;
+  int rred= (int)(((float)(val-MinVal)/(float)(MaxVal-MinVal))*255.);
+
+  int bblue=255-(int)(((float)(val-MinVal)/(float)(MaxVal-MinVal))*255.);
+  //printf("%d \n",val);
+  bgColor->setRgb(rred,0,bblue);
+   //QPalette::ColorRole
+   QPalette *mypalette=new QPalette();
+   //   mypalette->setColor ( mypalette->Base, *bgColor );
+   mypalette->setColor ( mypalette->Base, Qt::red);
+   //this->setBackgroundRole (mypalette->Shadow);
+   //this->setBackgroundColor(*bgColor);
+   repaint();
+   this->setPalette( QPalette( *bgColor ) );
+  emit valueChanged(val);
+
+}
Index: trigger/gui/t72/tempsens.h
===================================================================
--- trigger/gui/t72/tempsens.h	(revision 77)
+++ trigger/gui/t72/tempsens.h	(revision 77)
@@ -0,0 +1,40 @@
+#ifndef TEMPSENS_H
+#define TEMPSENS_H
+
+
+#include <QWidget>
+#include <QVBoxLayout>
+
+class Tempsens : public QWidget
+{
+  float MaxVal;
+  float MinVal;
+    Q_OBJECT
+public:
+    Tempsens( QWidget *parent=0 );
+    float value();
+    void setMaxVal(float val){MaxVal=val;};
+    void setMinVal(float val){MinVal=val;};
+    float getMaxVal(){return MaxVal;};
+    float getMinVal(){return MinVal;};
+ private:
+    float val;
+    
+    QVBoxLayout*  ColorWidg;
+ public slots:
+    void setValue( float );
+ 
+
+    
+ signals:
+    void valueChanged( float );
+ protected:
+    void paintEvent( QPaintEvent * );   
+ private:
+    QColor *bgColor;
+    //QSlider *slider;
+};
+
+
+#endif // TEMPSENS_H
+
Index: trigger/gui/t72/tpixel.cpp
===================================================================
--- trigger/gui/t72/tpixel.cpp	(revision 77)
+++ trigger/gui/t72/tpixel.cpp	(revision 77)
@@ -0,0 +1,55 @@
+#include <QColor>
+
+#include <QVBoxLayout>
+#include <QPainter>
+ #include "tpixel.h"
+
+ 
+Tpixel::Tpixel( QWidget *parent )  : QWidget( parent)
+{
+  //setPalette( QPalette( QColor( 250, 250, 200) ) );
+  //this->setPalette( QPalette( QColor( 250, 250, 200) ) );
+  bgColor= new QColor(200,200,200);
+  this->setAutoFillBackground (1);
+  MaxVal=255;
+}  
+int Tpixel::value() 
+{
+  return val;
+
+}
+void Tpixel::paintEvent( QPaintEvent * )
+{
+  QString s = QString( "%1" ).arg((double)(val));
+  if(val==0)
+    s= QString("n/c");
+  QFont sansFont( "Helvetica [Cronyx]", 12 );
+  
+    QPainter p( this );
+    p.setFont(sansFont);
+    p.setPen(Qt::white);
+    int width=this->width();
+    int height=this->height();
+    p.drawText(width/3 , height/2, s );
+}
+
+void Tpixel::setValue( int vall )
+{
+  val=vall;
+  
+   bgColor->setRgb((int)(((float)(val)/(float)(MaxVal))*255.),0,0);
+   if(val>=MaxVal)
+     bgColor->setRgb(0,255,255);
+   //printf("%f\n",(((float)(val)/(float)(MaxVal))));
+   //QPalette::ColorRole
+   QPalette *mypalette=new QPalette();
+   //   mypalette->setColor ( mypalette->Base, *bgColor );
+   mypalette->setColor ( mypalette->Base, Qt::red);
+   //this->setBackgroundRole (mypalette->Shadow);
+   //this->setBackgroundColor(*bgColor);
+   repaint();
+   this->setPalette( QPalette( *bgColor ) );
+  emit valueChanged(val);
+
+}
+
Index: trigger/gui/t72/tpixel.h
===================================================================
--- trigger/gui/t72/tpixel.h	(revision 77)
+++ trigger/gui/t72/tpixel.h	(revision 77)
@@ -0,0 +1,36 @@
+#ifndef TPIXEL_H
+#define TPIXEL_H
+
+
+#include <QWidget>
+#include <QVBoxLayout>
+
+class Tpixel : public QWidget
+{
+  int MaxVal;
+    Q_OBJECT
+public:
+    Tpixel( QWidget *parent=0 );
+    int value();
+    void setMaxVal(int val){MaxVal=val;};
+    int getMaxVal(){return MaxVal;};
+ private:
+    int val;
+    QVBoxLayout*  ColorWidg;
+ public slots:
+    void setValue( int );
+ 
+
+    
+ signals:
+    void valueChanged( int );
+ protected:
+    void paintEvent( QPaintEvent * );   
+ private:
+    QColor *bgColor;
+    //QSlider *slider;
+};
+
+
+#endif // TPIXEL_H
+
Index: trigger/v812.c
===================================================================
--- trigger/v812.c	(revision 53)
+++ trigger/v812.c	(revision 77)
@@ -162,5 +162,5 @@
 	return 0;
 }
-int V812_Set_Pattern_Inhibit_Hex(short module, short pattern)
+int V812_Set_Pattern_Inhibit_Hex(short module, int pattern)
 {
 	//return values
Index: trigger/v812.h
===================================================================
--- trigger/v812.h	(revision 53)
+++ trigger/v812.h	(revision 77)
@@ -66,5 +66,5 @@
 int V812_Test_Pulse(short module);
 int V812_Print_Info(void);
-int V812_Set_Pattern_Inhibit_Hex(short module, short pattern);
+int V812_Set_Pattern_Inhibit_Hex(short module, int pattern);
 VME_ErrorCode_t V812_Close(void);
 
