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