# SVN changeset patch # User imanay # Date 2012-11-15 21:43:41.542729 # Revision 44 Implementacion funcion generacion de estado de modulos de control hacia control central Index: trunk/absroot/source/abspy/abscontrol/client.py =================================================================== diff --git a/trunk/absroot/source/abspy/abscontrol/client.py b/trunk/absroot/source/abspy/abscontrol/client.py --- a/trunk/absroot/source/abspy/abscontrol/client.py (revision 43) +++ b/trunk/absroot/source/abspy/abscontrol/client.py (revision 44) @@ -37,9 +37,9 @@ self.commObj.sendTxRxCommand(cmd="CHGB", data=newBeam) - def getStatus(self): - - self.commObj.sendTxRxCommand(cmd="ANST", data="ABS") + def getStatus(self, data): + + self.commObj.sendTxRxCommand(cmd="ANST", data = data) ########## @@ -199,7 +199,7 @@ ne=NumeroDeExperimentos(archivo) #nombre01 = file1(archivo,'1') - nombre02 = file1(archivo,'1') + nombre02 = file1(archivo,'2') fichero=open(CarpetaDeTrabajo+'FormatoControlCentral.txt','w') fichero.write(nombre02+'\n') fichero.write(str(ne)+'\n') @@ -253,7 +253,13 @@ filename = "experimento1.abs" absObj = ABSClient() - absObj.sendFile(filename) +# absObj.sendFile(filename) # absObj.changeBeam("0") +# absObj.changeBeam("1") # absObj.changeBeam("2") -# absObj.changeBeam("7") \ No newline at end of file +# absObj.changeBeam("3") +# absObj.changeBeam("4") +# absObj.changeBeam("5") +# absObj.changeBeam("6") +# absObj.changeBeam("7") + absObj.getStatus(5) \ No newline at end of file Index: trunk/absroot/source/abspy/abscontrol/experimento1.abs =================================================================== diff --git a/trunk/absroot/source/abspy/abscontrol/experimento1.abs b/trunk/absroot/source/abspy/abscontrol/experimento1.abs --- a/trunk/absroot/source/abspy/abscontrol/experimento1.abs (revision 43) +++ b/trunk/absroot/source/abspy/abscontrol/experimento1.abs (revision 44) @@ -7,10 +7,10 @@ [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ - [1.0,1.0,1.0,1.0,1.0,2.0,3.0,0.0],$ - [0.5,0.5,0.5,1.0,3.0,2.0,1.0,0.0],$ - [1.0,1.0,1.0,1.0,0.5,1.5,2.5,3.5],$ - [0.5,0.5,0.5,0.5,2.5,1.5,0.5,0.0]] + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,1.0,1.0,1.0,1.0,1.0],$ + [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ + [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0]] [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ Index: trunk/absroot/source/abspy/abscontrol/server.py =================================================================== diff --git a/trunk/absroot/source/abspy/abscontrol/server.py b/trunk/absroot/source/abspy/abscontrol/server.py --- a/trunk/absroot/source/abspy/abscontrol/server.py (revision 43) +++ b/trunk/absroot/source/abspy/abscontrol/server.py (revision 44) @@ -1,5 +1,6 @@ import os import library +import time class ABSServer: @@ -34,7 +35,13 @@ self.changeBeam() if cmd == "ANST": - self.getStatus() + self.getStatus(10) + + def sendAnswer(self,nbytes = 16384): + +# ipSource, ipDestino, cmd, self.datarx = self.commServerObj.sendData(nbytes) + + pass def EliminaSaltoDeLinea(cadena): i = 0 @@ -123,14 +130,54 @@ #rpta = self.commClientObj.sendTxRxCommand(cmd='CAMBIA', data="0") self.commClientObj.sendData("CAMBIA:" + self.datarx + ":") - def getStatus(self): + def getStatus(self, base): #rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0") self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":") + seconds = int (self.datarx) + # Give 5 seconds to the control modules + time.sleep(seconds) + # Checking the module connection + module_list = self.connection_status(10) + #Generating the complete report + module = 1 + number_of_modules = 16 + filename1 = "Verificacion" + filename2 = "report.txt" + fobj2 = open(filename2,"w") + fobj2.write("Verification_file\n") + fobj2.write("-----------------\n") + fobj2.close() + while module <= number_of_modules: + if module_list[module -1] == "1": + #Preparing and doing the tftp command + cmd = "tftp -m binary 192.168.1."+ str(base + module) +" 69 -c get " + filename1 + print cmd + os.system(cmd) + # Getting data from the control module file + fobj1 = open(filename1,"r") + file_list_1 = fobj1.readlines() + fobj1.close() + content = file_list_1[2:-1] + # + fobj2 = open(filename2,"a") + if base == 10: + fobj2.write("S" + str(module) + "\n") + else: + fobj2.write("N" + str(module) + "\n") + fobj2.writelines(content) + fobj2.write("------\n") + fobj2.close() + module = module + 1 +# print "\nFinalizado" + + + if __name__ == '__main__': absObj = ABSServer() while 1: - absObj.waitRequest() \ No newline at end of file + absObj.waitRequest() +# absObj.sendAnswer(nbytes) \ No newline at end of file