##// END OF EJS Templates
imanay -
r51:52
parent child
Show More
@@ -469,7 +469,7
469 469 filename = "experimento1.abs"
470 470
471 471 absObj = ABSClient()
472 # absObj.sendFile(filename)
472 absObj.sendFile(filename)
473 473 # absObj.changeBeam("0")
474 474 # absObj.changeBeam("1")
475 475 # absObj.changeBeam("2")
@@ -478,4 +478,4
478 478 # absObj.changeBeam("5")
479 479 # absObj.changeBeam("6")
480 480 # absObj.changeBeam("7")
481 absObj.getStatus(5) No newline at end of file
481 # absObj.getStatus(5) No newline at end of file
@@ -73,18 +73,6
73 73 self.experiment_name = experiment_name
74 74
75 75
76 def sendAnswer(self, cmd):
77
78 data = "OK"
79
80 if cmd == "SNDF":
81 self.commServerObj.sendData2(cmd="SNDF", data=data)
82 if cmd == "CHGB":
83 self.commServerObj.sendData2(cmd="CHGB", data=data)
84 if cmd == "ANST":
85 data = self.tx_buffer
86 self.commServerObj.sendData2(cmd="ANST", data=data)
87
88 76 def waitRequest(self):
89 77
90 78 ipSource, ipDestino, cmd, self.datarx = self.commServerObj.waitData()
@@ -102,8 +90,7
102 90 datarpta = self.tx_buffer
103 91
104 92 self.commServerObj.sendData2(cmd=cmd, data=datarpta)
105
106 return cmd
93
107 94
108 95 def __writeReport(self, enaModules):
109 96
@@ -247,7 +234,7
247 234 # Give 5 seconds to the control modules
248 235 time.sleep(seconds)
249 236 # Checking the module connection
250 module_list = self.connection_status(10)
237 enaModules = self.checkAntenna()
251 238 #Generating the complete report
252 239 module = 1
253 240 number_of_modules = 16
@@ -255,27 +242,25
255 242 line1 = "Verification_file\n"
256 243 line2 = "-----------------\n"
257 244 report_list = [line1, line2]
258 while module <= number_of_modules:
259 if module_list[module -1] == "1":
260 #Preparing and doing the tftp command
261 cmd = "tftp -m binary 192.168.1."+ str(base + module) +" 69 -c get " + filename1
262 print cmd
263 os.system(cmd)
264 #Sub_header
265 if base == 10:
266 report_list.append("S" + str(module) + "\n")
267 else:
268 report_list.append("N" + str(module) + "\n")
269 # Content
270 fobj1 = open(filename1,"r")
271 file_list_1 = fobj1.readlines()
272 fobj1.close()
273 content = ''.join(file_list_1[2:-1])
274 # content = "010101\n"
275 report_list.append(content)
276 #Ending
277 report_list.append("------\n")
278 module = module + 1
245
246 for address in range(1,65):
247
248 if address not in enaModules:
249 continue
250 #Preparing and doing the tftp command
251 cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c get " + filename1
252 print cmd
253 os.system(cmd)
254 #Sub_header
255 report_list.append("ABS_" + str(address) + "\n")
256 # Content
257 fobj1 = open(filename1,"r")
258 file_list_1 = fobj1.readlines()
259 fobj1.close()
260 content = ''.join(file_list_1[2:-1])
261 report_list.append(content)
262 #Ending
263 report_list.append("------\n")
279 264 #print "\nFinalizado"
280 265 self.tx_buffer = ''.join(report_list)
281 266
@@ -332,5 +317,4
332 317 absObj = ABSServer()
333 318
334 319 while 1:
335 cmd = absObj.waitRequest()
336 absObj.sendAnswer(cmd) No newline at end of file
320 absObj.waitRequest() No newline at end of file
@@ -7,8 +7,9
7 7 class Server:
8 8
9 9 # Set the socket parameters
10 host = "localhost"
11 port = 5140
10 #host = "localhost"
11 host = '192.168.1.255'
12 port = 5500
12 13 buf = 1024
13 14 addr = (host,port)
14 15
@@ -91,9 +92,9
91 92
92 93 print "Sending message '",data,"'....."
93 94
94 #data_rx, server_rx = self.socket_c.recvfrom(16)
95 data_rx, server_rx = self.socket_c.recvfrom(16)
95 96
96 #print "Data received ", data_rx, server_rx
97 print "Data received ", data_rx, server_rx
97 98
98 99 # Close socket
99 100 self.socket_c.close()
General Comments 0
You need to be logged in to leave comments. Login now