|
@@
-1,280
+1,281
|
|
1
|
import os
No newline at end of file
|
|
1
|
import os
|
|
2
|
import library
No newline at end of file
|
|
2
|
import library
|
|
3
|
import time
No newline at end of file
|
|
3
|
import time
|
|
4
|
No newline at end of file
|
|
4
|
|
|
5
|
class ABSServer:
No newline at end of file
|
|
5
|
class ABSServer:
|
|
6
|
|
|
6
|
|
|
|
No newline at end of file
|
|
7
|
def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000, ipDestino2="192.168.1.255", portDestino2=5500, ftpPortDestino=None):
No newline at end of file
|
|
7
|
def __init__(self,ipSource="localhost", ipDestino="192.168.1.255", portDestino=7000, ipDestino2="192.168.1.255", portDestino2=5500, ftpPortDestino=None):
No newline at end of file
|
|
|
|
|
8
|
No newline at end of file
|
|
8
|
|
|
9
|
self.ipSource = ipSource
No newline at end of file
|
|
9
|
self.ipSource = ipSource
|
|
10
|
self.ipDestino = ipDestino
No newline at end of file
|
|
10
|
self.ipDestino = ipDestino
|
|
11
|
self.portDestino = portDestino
No newline at end of file
|
|
11
|
self.portDestino = portDestino
|
|
12
|
No newline at end of file
|
|
12
|
|
|
13
|
self.ipDestino2 = ipDestino2
No newline at end of file
|
|
13
|
self.ipDestino2 = ipDestino2
|
|
14
|
self.portDestino2 = portDestino2
No newline at end of file
|
|
14
|
self.portDestino2 = portDestino2
|
|
15
|
No newline at end of file
|
|
15
|
|
|
16
|
self.ftpPortDestino = ftpPortDestino
No newline at end of file
|
|
16
|
self.ftpPortDestino = ftpPortDestino
|
|
17
|
self.experiment_name = "default"
No newline at end of file
|
|
17
|
self.experiment_name = "default"
|
|
18
|
self.tx_buffer = "default"
No newline at end of file
|
|
18
|
self.tx_buffer = "default"
|
|
19
|
No newline at end of file
|
|
19
|
|
|
20
|
self.createObjects()
No newline at end of file
|
|
20
|
self.createObjects()
|
|
21
|
No newline at end of file
|
|
21
|
|
|
22
|
def createObjects(self):
No newline at end of file
|
|
22
|
def createObjects(self):
|
|
23
|
No newline at end of file
|
|
23
|
|
|
24
|
asServer = True
No newline at end of file
|
|
24
|
asServer = True
|
|
25
|
self.commServerObj = library.UDPComm(self.ipSource, self.ipDestino, self.portDestino, asServer)
No newline at end of file
|
|
25
|
self.commServerObj = library.UDPComm(self.ipSource, self.ipDestino, self.portDestino, asServer)
|
|
26
|
self.commClientObj = library.UDPComm(self.ipSource, self.ipDestino2, self.portDestino2)
No newline at end of file
|
|
26
|
self.commClientObj = library.UDPComm(self.ipSource, self.ipDestino2, self.portDestino2)
|
|
27
|
#self.ftpCommObj = library.FTPComm(self.ipSource, self.ipDestino, self.ftpPortDestino)
No newline at end of file
|
|
27
|
#self.ftpCommObj = library.FTPComm(self.ipSource, self.ipDestino, self.ftpPortDestino)
|
|
28
|
No newline at end of file
|
|
28
|
|
|
29
|
No newline at end of file
|
|
29
|
|
|
30
|
def waitRequest(self):
No newline at end of file
|
|
30
|
def waitRequest(self):
|
|
31
|
No newline at end of file
|
|
31
|
|
|
32
|
ipSource, ipDestino, cmd, self.datarx = self.commServerObj.waitData()
No newline at end of file
|
|
32
|
ipSource, ipDestino, cmd, self.datarx = self.commServerObj.waitData()
|
|
33
|
No newline at end of file
|
|
33
|
|
|
34
|
datarpta = "OK"
No newline at end of file
|
|
34
|
datarpta = "OK"
|
|
35
|
No newline at end of file
|
|
35
|
|
|
36
|
if cmd == "SNDF":
No newline at end of file
|
|
36
|
if cmd == "SNDF":
|
|
37
|
self.sendFile2Modules()
No newline at end of file
|
|
37
|
self.sendFile2Modules()
|
|
|
|
|
38
|
pass
No newline at end of file
|
|
38
|
No newline at end of file
|
|
39
|
|
|
39
|
if cmd == "CHGB":
No newline at end of file
|
|
40
|
if cmd == "CHGB":
|
|
40
|
self.changeBeam()
No newline at end of file
|
|
41
|
self.changeBeam()
|
|
41
|
No newline at end of file
|
|
42
|
|
|
42
|
if cmd == "ANST":
No newline at end of file
|
|
43
|
if cmd == "ANST":
|
|
43
|
self.getStatus(mode=3)
No newline at end of file
|
|
44
|
self.getStatus(mode=3)
|
|
44
|
datarpta = self.tx_buffer
No newline at end of file
|
|
45
|
datarpta = self.tx_buffer
|
|
45
|
No newline at end of file
|
|
46
|
|
|
46
|
self.commServerObj.sendData(cmd=cmd, data=datarpta)
No newline at end of file
|
|
47
|
self.commServerObj.sendData(cmd=cmd, data=datarpta)
|
|
47
|
No newline at end of file
|
|
48
|
|
|
48
|
def checkModule(self, address):
No newline at end of file
|
|
49
|
def checkModule(self, address):
|
|
49
|
No newline at end of file
|
|
50
|
|
|
50
|
cmd = "ping -c 1 -w 1 192.168.1."+ str(address) + " >> /dev/null"
No newline at end of file
|
|
51
|
cmd = "ping -c 1 -w 1 192.168.1."+ str(address) + " >> /dev/null"
|
|
51
|
status = os.system(cmd)
No newline at end of file
|
|
52
|
status = os.system(cmd)
|
|
52
|
No newline at end of file
|
|
53
|
|
|
53
|
if status == 256:
No newline at end of file
|
|
54
|
if status == 256:
|
|
54
|
return False
No newline at end of file
|
|
55
|
return False
|
|
55
|
No newline at end of file
|
|
56
|
|
|
56
|
return True
No newline at end of file
|
|
57
|
return True
|
|
57
|
No newline at end of file
|
|
58
|
|
|
58
|
def __writeReport(self, enaModules):
No newline at end of file
|
|
59
|
def __writeReport(self, enaModules):
|
|
59
|
No newline at end of file
|
|
60
|
|
|
60
|
status_array = ["Status of modules\n"]
No newline at end of file
|
|
61
|
status_array = ["Status of modules\n"]
|
|
61
|
status_array.append("----------------\n")
No newline at end of file
|
|
62
|
status_array.append("----------------\n")
|
|
62
|
No newline at end of file
|
|
63
|
|
|
63
|
for address in range(1,65):
No newline at end of file
|
|
64
|
for address in range(1,65):
|
|
64
|
if address in enaModules:
No newline at end of file
|
|
65
|
if address in enaModules:
|
|
65
|
# status_array.append("192.168.1." + str(base + i + 1) + " [1 1]\n")
No newline at end of file
|
|
66
|
# status_array.append("192.168.1." + str(base + i + 1) + " [1 1]\n")
|
|
66
|
status_array.append("192.168.1." + str(address) + " [1 1]\n")
No newline at end of file
|
|
67
|
status_array.append("192.168.1." + str(address) + " [1 1]\n")
|
|
67
|
else:
No newline at end of file
|
|
68
|
else:
|
|
68
|
status_array.append("192.168.1." + str(address) + " [0 0]\n")
No newline at end of file
|
|
69
|
status_array.append("192.168.1." + str(address) + " [0 0]\n")
|
|
69
|
No newline at end of file
|
|
70
|
|
|
70
|
f = open("module_status.txt","w")
No newline at end of file
|
|
71
|
f = open("module_status.txt","w")
|
|
71
|
f.writelines(status_array)
No newline at end of file
|
|
72
|
f.writelines(status_array)
|
|
72
|
f.close()
No newline at end of file
|
|
73
|
f.close()
|
|
73
|
No newline at end of file
|
|
74
|
|
|
74
|
def checkAntenna(self):
No newline at end of file
|
|
75
|
def checkAntenna(self):
|
|
75
|
No newline at end of file
|
|
76
|
|
|
76
|
"""
No newline at end of file
|
|
77
|
"""
|
|
77
|
Direccion de los modulos de las antenas:
No newline at end of file
|
|
78
|
Direccion de los modulos de las antenas:
|
|
78
|
No newline at end of file
|
|
79
|
|
|
79
|
Norte : 01-16
No newline at end of file
|
|
80
|
Norte : 01-16
|
|
80
|
Este : 17-32
No newline at end of file
|
|
81
|
Este : 17-32
|
|
81
|
Oeste: : 33-48
No newline at end of file
|
|
82
|
Oeste: : 33-48
|
|
82
|
Sur : 49-64
No newline at end of file
|
|
83
|
Sur : 49-64
|
|
83
|
No newline at end of file
|
|
84
|
|
|
84
|
"""
No newline at end of file
|
|
85
|
"""
|
|
85
|
No newline at end of file
|
|
86
|
|
|
86
|
enaModules = []
No newline at end of file
|
|
87
|
enaModules = []
|
|
87
|
No newline at end of file
|
|
88
|
|
|
88
|
for address in range(1,65):
No newline at end of file
|
|
89
|
for address in range(1,65):
|
|
89
|
if self.checkModule(address):
No newline at end of file
|
|
90
|
if self.checkModule(address):
|
|
90
|
enaModules.append(address)
No newline at end of file
|
|
91
|
enaModules.append(address)
|
|
91
|
No newline at end of file
|
|
92
|
|
|
92
|
self.__writeReport(enaModules)
No newline at end of file
|
|
93
|
self.__writeReport(enaModules)
|
|
93
|
return enaModules
No newline at end of file
|
|
94
|
return enaModules
|
|
94
|
No newline at end of file
|
|
95
|
|
|
95
|
def sendFile2Modules(self):
No newline at end of file
|
|
96
|
def sendFile2Modules(self):
|
|
96
|
No newline at end of file
|
|
97
|
|
|
97
|
#Needed for the loop
No newline at end of file
|
|
98
|
#Needed for the loop
|
|
98
|
rx_frame_list = self.datarx.split('\n',2)
No newline at end of file
|
|
99
|
rx_frame_list = self.datarx.split('\n',2)
|
|
99
|
No newline at end of file
|
|
100
|
|
|
100
|
self.experiment_name = rx_frame_list[0]
No newline at end of file
|
|
101
|
self.experiment_name = rx_frame_list[0]
|
|
101
|
experiment_number = rx_frame_list[1]
No newline at end of file
|
|
102
|
experiment_number = rx_frame_list[1]
|
|
102
|
str_control_modules = rx_frame_list[2]
No newline at end of file
|
|
103
|
str_control_modules = rx_frame_list[2]
|
|
103
|
No newline at end of file
|
|
104
|
|
|
104
|
lst_control_modules = str_control_modules.split("------\n")
No newline at end of file
|
|
105
|
lst_control_modules = str_control_modules.split("------\n")
|
|
105
|
No newline at end of file
|
|
106
|
|
|
106
|
enaModules = self.checkAntenna()
No newline at end of file
|
|
107
|
enaModules = self.checkAntenna()
|
|
107
|
No newline at end of file
|
|
108
|
|
|
108
|
for address in range(1,65):
No newline at end of file
|
|
109
|
for address in range(1,65):
|
|
109
|
No newline at end of file
|
|
110
|
|
|
110
|
if address not in enaModules:
No newline at end of file
|
|
111
|
if address not in enaModules:
|
|
111
|
continue
No newline at end of file
|
|
112
|
continue
|
|
112
|
No newline at end of file
|
|
113
|
|
|
113
|
self.__writeModuleFile(self.experiment_name, lst_control_modules[address-1])
No newline at end of file
|
|
114
|
self.__writeModuleFile(self.experiment_name, lst_control_modules[address-1])
|
|
114
|
No newline at end of file
|
|
115
|
|
|
115
|
cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c put " + self.experiment_name
No newline at end of file
|
|
116
|
cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c put " + self.experiment_name
|
|
116
|
print cmd
No newline at end of file
|
|
117
|
print cmd
|
|
117
|
os.system(cmd)
No newline at end of file
|
|
118
|
os.system(cmd)
|
|
118
|
No newline at end of file
|
|
119
|
|
|
119
|
self.__loadFile()
No newline at end of file
|
|
120
|
self.__loadFile()
|
|
120
|
No newline at end of file
|
|
121
|
|
|
121
|
def __writeModuleFile(self, filename, str):
No newline at end of file
|
|
122
|
def __writeModuleFile(self, filename, str):
|
|
122
|
No newline at end of file
|
|
123
|
|
|
123
|
fobj = open(filename,"w")
No newline at end of file
|
|
124
|
fobj = open(filename,"w")
|
|
124
|
fobj.write(filename + "\n")
No newline at end of file
|
|
125
|
fobj.write(filename + "\n")
|
|
125
|
fobj.write("------\n")
No newline at end of file
|
|
126
|
fobj.write("------\n")
|
|
126
|
fobj.write(str)
No newline at end of file
|
|
127
|
fobj.write(str)
|
|
127
|
fobj.write("------\n")
No newline at end of file
|
|
128
|
fobj.write("------\n")
|
|
128
|
fobj.close()
No newline at end of file
|
|
129
|
fobj.close()
|
|
129
|
No newline at end of file
|
|
130
|
|
|
130
|
def __readModuleFile(self, filename):
No newline at end of file
|
|
131
|
def __readModuleFile(self, filename):
|
|
131
|
No newline at end of file
|
|
132
|
|
|
132
|
fobj1 = open(filename,"r")
No newline at end of file
|
|
133
|
fobj1 = open(filename,"r")
|
|
133
|
file_list_1 = fobj1.readlines()
No newline at end of file
|
|
134
|
file_list_1 = fobj1.readlines()
|
|
134
|
fobj1.close()
No newline at end of file
|
|
135
|
fobj1.close()
|
|
135
|
content_str = ''.join(file_list_1[2:-1])
No newline at end of file
|
|
136
|
content_str = ''.join(file_list_1[2:-1])
|
|
136
|
No newline at end of file
|
|
137
|
|
|
137
|
return content_str
No newline at end of file
|
|
138
|
return content_str
|
|
138
|
No newline at end of file
|
|
139
|
|
|
139
|
def __loadFile(self):
No newline at end of file
|
|
140
|
def __loadFile(self):
|
|
140
|
No newline at end of file
|
|
141
|
|
|
141
|
#Working with the UDP socket
No newline at end of file
|
|
142
|
#Working with the UDP socket
|
|
142
|
self.commClientObj.sendData("none", "CARGA:" + self.experiment_name + ":")
No newline at end of file
|
|
143
|
self.commClientObj.sendData("none", "CARGA:" + self.experiment_name + ":")
|
|
143
|
self.commClientObj.sendData("none", "CAMBIA:0:")
No newline at end of file
|
|
144
|
self.commClientObj.sendData("none", "CAMBIA:0:")
|
|
144
|
No newline at end of file
|
|
145
|
|
|
145
|
def changeBeam(self):
No newline at end of file
|
|
146
|
def changeBeam(self):
|
|
146
|
No newline at end of file
|
|
147
|
|
|
147
|
#rpta = self.commClientObj.sendTxRxCommand(cmd='CAMBIA', data="0")
No newline at end of file
|
|
148
|
#rpta = self.commClientObj.sendTxRxCommand(cmd='CAMBIA', data="0")
|
|
148
|
self.commClientObj.sendData("none", "CAMBIA:" + self.datarx + ":")
No newline at end of file
|
|
149
|
self.commClientObj.sendData("none", "CAMBIA:" + self.datarx + ":")
|
|
149
|
No newline at end of file
|
|
150
|
|
|
150
|
def getStatus(self,mode):
No newline at end of file
|
|
151
|
def getStatus(self,mode):
|
|
151
|
No newline at end of file
|
|
152
|
|
|
152
|
if mode == 1:
No newline at end of file
|
|
153
|
if mode == 1:
|
|
153
|
self.__getStsMode1()
No newline at end of file
|
|
154
|
self.__getStsMode1()
|
|
154
|
elif mode == 2:
No newline at end of file
|
|
155
|
elif mode == 2:
|
|
155
|
self.__getStsMode2()
No newline at end of file
|
|
156
|
self.__getStsMode2()
|
|
156
|
else:
No newline at end of file
|
|
157
|
else:
|
|
157
|
self.__getStsMode3()
No newline at end of file
|
|
158
|
self.__getStsMode3()
|
|
158
|
No newline at end of file
|
|
159
|
|
|
159
|
No newline at end of file
|
|
160
|
|
|
160
|
def __getStsMode1(self):
No newline at end of file
|
|
161
|
def __getStsMode1(self):
|
|
161
|
#rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0")
No newline at end of file
|
|
162
|
#rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0")
|
|
162
|
self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":")
No newline at end of file
|
|
163
|
self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":")
|
|
163
|
seconds = int (self.datarx)
No newline at end of file
|
|
164
|
seconds = int (self.datarx)
|
|
164
|
# Give 5 seconds to the control modules
No newline at end of file
|
|
165
|
# Give 5 seconds to the control modules
|
|
165
|
time.sleep(seconds)
No newline at end of file
|
|
166
|
time.sleep(seconds)
|
|
166
|
# Checking the module connection
No newline at end of file
|
|
167
|
# Checking the module connection
|
|
167
|
module_list = self.connection_status(10)
No newline at end of file
|
|
168
|
module_list = self.connection_status(10)
|
|
168
|
#Generating the complete report
No newline at end of file
|
|
169
|
#Generating the complete report
|
|
169
|
module = 1
No newline at end of file
|
|
170
|
module = 1
|
|
170
|
number_of_modules = 16
No newline at end of file
|
|
171
|
number_of_modules = 16
|
|
171
|
filename1 = "Verificacion"
No newline at end of file
|
|
172
|
filename1 = "Verificacion"
|
|
172
|
filename2 = "report.txt"
No newline at end of file
|
|
173
|
filename2 = "report.txt"
|
|
173
|
fobj2 = open(filename2,"w")
No newline at end of file
|
|
174
|
fobj2 = open(filename2,"w")
|
|
174
|
fobj2.write("Verification_file\n")
No newline at end of file
|
|
175
|
fobj2.write("Verification_file\n")
|
|
175
|
fobj2.write("-----------------\n")
No newline at end of file
|
|
176
|
fobj2.write("-----------------\n")
|
|
176
|
fobj2.close()
No newline at end of file
|
|
177
|
fobj2.close()
|
|
177
|
while module <= number_of_modules:
No newline at end of file
|
|
178
|
while module <= number_of_modules:
|
|
178
|
if module_list[module -1] == "1":
No newline at end of file
|
|
179
|
if module_list[module -1] == "1":
|
|
179
|
#Preparing and doing the tftp command
No newline at end of file
|
|
180
|
#Preparing and doing the tftp command
|
|
180
|
cmd = "tftp -m binary 192.168.1."+ str(base + module) +" 69 -c get " + filename1
No newline at end of file
|
|
181
|
cmd = "tftp -m binary 192.168.1."+ str(base + module) +" 69 -c get " + filename1
|
|
181
|
print cmd
No newline at end of file
|
|
182
|
print cmd
|
|
182
|
os.system(cmd)
No newline at end of file
|
|
183
|
os.system(cmd)
|
|
183
|
# Getting data from the control module file
No newline at end of file
|
|
184
|
# Getting data from the control module file
|
|
184
|
fobj1 = open(filename1,"r")
No newline at end of file
|
|
185
|
fobj1 = open(filename1,"r")
|
|
185
|
file_list_1 = fobj1.readlines()
No newline at end of file
|
|
186
|
file_list_1 = fobj1.readlines()
|
|
186
|
fobj1.close()
No newline at end of file
|
|
187
|
fobj1.close()
|
|
187
|
content = file_list_1[2:-1]
No newline at end of file
|
|
188
|
content = file_list_1[2:-1]
|
|
188
|
#
No newline at end of file
|
|
189
|
#
|
|
189
|
fobj2 = open(filename2,"a")
No newline at end of file
|
|
190
|
fobj2 = open(filename2,"a")
|
|
190
|
if base == 10:
No newline at end of file
|
|
191
|
if base == 10:
|
|
191
|
fobj2.write("S" + str(module) + "\n")
No newline at end of file
|
|
192
|
fobj2.write("S" + str(module) + "\n")
|
|
192
|
else:
No newline at end of file
|
|
193
|
else:
|
|
193
|
fobj2.write("N" + str(module) + "\n")
No newline at end of file
|
|
194
|
fobj2.write("N" + str(module) + "\n")
|
|
194
|
fobj2.writelines(content)
No newline at end of file
|
|
195
|
fobj2.writelines(content)
|
|
195
|
fobj2.write("------\n")
No newline at end of file
|
|
196
|
fobj2.write("------\n")
|
|
196
|
fobj2.close()
No newline at end of file
|
|
197
|
fobj2.close()
|
|
197
|
module = module + 1
No newline at end of file
|
|
198
|
module = module + 1
|
|
198
|
No newline at end of file
|
|
199
|
|
|
199
|
def __getStsMode2(self):
No newline at end of file
|
|
200
|
def __getStsMode2(self):
|
|
200
|
No newline at end of file
|
|
201
|
|
|
201
|
#rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0")
No newline at end of file
|
|
202
|
#rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0")
|
|
202
|
self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":")
No newline at end of file
|
|
203
|
self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":")
|
|
203
|
seconds = int (self.datarx)
No newline at end of file
|
|
204
|
seconds = int (self.datarx)
|
|
204
|
# Give 5 seconds to the control modules
No newline at end of file
|
|
205
|
# Give 5 seconds to the control modules
|
|
205
|
time.sleep(seconds)
No newline at end of file
|
|
206
|
time.sleep(seconds)
|
|
206
|
# Checking the module connection
No newline at end of file
|
|
207
|
# Checking the module connection
|
|
207
|
enaModules = self.checkAntenna()
No newline at end of file
|
|
208
|
enaModules = self.checkAntenna()
|
|
208
|
#Generating the complete report
No newline at end of file
|
|
209
|
#Generating the complete report
|
|
209
|
filename1 = "Verificacion"
No newline at end of file
|
|
210
|
filename1 = "Verificacion"
|
|
210
|
line1 = "Verification_file\n"
No newline at end of file
|
|
211
|
line1 = "Verification_file\n"
|
|
211
|
line2 = "-----------------\n"
No newline at end of file
|
|
212
|
line2 = "-----------------\n"
|
|
212
|
report_list = [line1, line2]
No newline at end of file
|
|
213
|
report_list = [line1, line2]
|
|
213
|
No newline at end of file
|
|
214
|
|
|
214
|
for address in range(1,65):
No newline at end of file
|
|
215
|
for address in range(1,65):
|
|
215
|
No newline at end of file
|
|
216
|
|
|
216
|
if address not in enaModules:
No newline at end of file
|
|
217
|
if address not in enaModules:
|
|
217
|
continue
No newline at end of file
|
|
218
|
continue
|
|
218
|
#Preparing and doing the tftp command
No newline at end of file
|
|
219
|
#Preparing and doing the tftp command
|
|
219
|
cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c get " + filename1
No newline at end of file
|
|
220
|
cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c get " + filename1
|
|
220
|
print cmd
No newline at end of file
|
|
221
|
print cmd
|
|
221
|
os.system(cmd)
No newline at end of file
|
|
222
|
os.system(cmd)
|
|
222
|
#Sub_header
No newline at end of file
|
|
223
|
#Sub_header
|
|
223
|
report_list.append("ABS_" + str(address) + "\n")
No newline at end of file
|
|
224
|
report_list.append("ABS_" + str(address) + "\n")
|
|
224
|
# Content
No newline at end of file
|
|
225
|
# Content
|
|
225
|
fobj1 = open(filename1,"r")
No newline at end of file
|
|
226
|
fobj1 = open(filename1,"r")
|
|
226
|
file_list_1 = fobj1.readlines()
No newline at end of file
|
|
227
|
file_list_1 = fobj1.readlines()
|
|
227
|
fobj1.close()
No newline at end of file
|
|
228
|
fobj1.close()
|
|
228
|
content = ''.join(file_list_1[2:-1])
No newline at end of file
|
|
229
|
content = ''.join(file_list_1[2:-1])
|
|
229
|
report_list.append(content)
No newline at end of file
|
|
230
|
report_list.append(content)
|
|
230
|
#Ending
No newline at end of file
|
|
231
|
#Ending
|
|
231
|
report_list.append("------\n")
No newline at end of file
|
|
232
|
report_list.append("------\n")
|
|
232
|
#print "\nFinalizado"
No newline at end of file
|
|
233
|
#print "\nFinalizado"
|
|
233
|
self.tx_buffer = ''.join(report_list)
No newline at end of file
|
|
234
|
self.tx_buffer = ''.join(report_list)
|
|
234
|
No newline at end of file
|
|
235
|
|
|
235
|
def __AddingHeader(self,content_list, title):
No newline at end of file
|
|
236
|
def __AddingHeader(self,content_list, title):
|
|
236
|
No newline at end of file
|
|
237
|
|
|
237
|
line1 = title + "\n"
No newline at end of file
|
|
238
|
line1 = title + "\n"
|
|
238
|
line2 = "-----------------\n"
No newline at end of file
|
|
239
|
line2 = "-----------------\n"
|
|
239
|
header_list = [line1, line2]
No newline at end of file
|
|
240
|
header_list = [line1, line2]
|
|
240
|
verification_list = header_list + content_list
No newline at end of file
|
|
241
|
verification_list = header_list + content_list
|
|
241
|
# Arming the frame
No newline at end of file
|
|
242
|
# Arming the frame
|
|
242
|
self.tx_buffer = ''.join(verification_list)
No newline at end of file
|
|
243
|
self.tx_buffer = ''.join(verification_list)
|
|
243
|
No newline at end of file
|
|
244
|
|
|
244
|
def __getModuleFile(self, filename):
No newline at end of file
|
|
245
|
def __getModuleFile(self, filename):
|
|
245
|
No newline at end of file
|
|
246
|
|
|
246
|
enaModules = self.checkAntenna()
No newline at end of file
|
|
247
|
enaModules = self.checkAntenna()
|
|
247
|
content_list = []
No newline at end of file
|
|
248
|
content_list = []
|
|
248
|
for address in range(1,65):
No newline at end of file
|
|
249
|
for address in range(1,65):
|
|
249
|
No newline at end of file
|
|
250
|
|
|
250
|
if address not in enaModules:
No newline at end of file
|
|
251
|
if address not in enaModules:
|
|
251
|
continue
No newline at end of file
|
|
252
|
continue
|
|
252
|
#Preparing and doing the tftp command
No newline at end of file
|
|
253
|
#Preparing and doing the tftp command
|
|
253
|
cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c get " + filename
No newline at end of file
|
|
254
|
cmd = "tftp -m binary 192.168.1."+ str(address) +" 69 -c get " + filename
|
|
254
|
print cmd
No newline at end of file
|
|
255
|
print cmd
|
|
255
|
os.system(cmd)
No newline at end of file
|
|
256
|
os.system(cmd)
|
|
256
|
#Sub_header
No newline at end of file
|
|
257
|
#Sub_header
|
|
257
|
content_list.append("ABS_" + str(address) + "\n")
No newline at end of file
|
|
258
|
content_list.append("ABS_" + str(address) + "\n")
|
|
258
|
# From module file to list
No newline at end of file
|
|
259
|
# From module file to list
|
|
259
|
content_str = self.__readModuleFile(filename)
No newline at end of file
|
|
260
|
content_str = self.__readModuleFile(filename)
|
|
260
|
content_list.append(content_str)
No newline at end of file
|
|
261
|
content_list.append(content_str)
|
|
261
|
content_list.append("------\n")
No newline at end of file
|
|
262
|
content_list.append("------\n")
|
|
262
|
No newline at end of file
|
|
263
|
|
|
263
|
self.__AddingHeader(content_list, title = "Verification_file")
No newline at end of file
|
|
264
|
self.__AddingHeader(content_list, title = "Verification_file")
|
|
264
|
No newline at end of file
|
|
265
|
|
|
265
|
def __getStsMode3(self):
No newline at end of file
|
|
266
|
def __getStsMode3(self):
|
|
266
|
No newline at end of file
|
|
267
|
|
|
267
|
self.commClientObj.sendData("none", "CHEQUEO:" + self.datarx + ":")
No newline at end of file
|
|
268
|
self.commClientObj.sendData("none", "CHEQUEO:" + self.datarx + ":")
|
|
268
|
seconds = int (self.datarx)
No newline at end of file
|
|
269
|
seconds = int (self.datarx)
|
|
269
|
# Give 5 seconds to the control modules
No newline at end of file
|
|
270
|
# Give 5 seconds to the control modules
|
|
270
|
time.sleep(seconds)
No newline at end of file
|
|
271
|
time.sleep(seconds)
|
|
271
|
No newline at end of file
|
|
272
|
|
|
272
|
self.__getModuleFile(filename = "Verificacion")
No newline at end of file
|
|
273
|
self.__getModuleFile(filename = "Verificacion")
|
|
273
|
No newline at end of file
|
|
274
|
|
|
274
|
No newline at end of file
|
|
275
|
|
|
275
|
if __name__ == '__main__':
No newline at end of file
|
|
276
|
if __name__ == '__main__':
|
|
276
|
No newline at end of file
|
|
277
|
|
|
277
|
absObj = ABSServer()
No newline at end of file
|
|
278
|
absObj = ABSServer()
|
|
278
|
No newline at end of file
|
|
279
|
|
|
279
|
while 1:
No newline at end of file
|
|
280
|
while 1:
|
|
280
|
absObj.waitRequest()
No newline at end of file
|
|
281
|
absObj.waitRequest()
|