##// END OF EJS Templates
changes to integrate to the web interface
imanay -
r138:139
parent child
Show More
@@ -1,77 +1,86
1 import library3 No newline at end of file
1 import library3
2 No newline at end of file
2
3 class ABSClient: No newline at end of file
3 class ABSClient:
4 No newline at end of file
4
5 def __init__(self,ipSource="192.168.1.117", iDSource="Clnt_01", ipDestino="192.168.1.117", iDDestino = "CeCnMod", portDestino=7000): No newline at end of file
5 def __init__(self,ipSource="192.168.1.117", iDSource="Clnt_01", ipDestino="192.168.1.117", iDDestino = "CeCnMod", portDestino=7000):
6 No newline at end of file
6
7 self.ipSource = ipSource No newline at end of file
7 self.ipSource = ipSource
8 self.iDSource = iDSource No newline at end of file
8 self.iDSource = iDSource
9 self.ipDestino = ipDestino No newline at end of file
9 self.ipDestino = ipDestino
10 self.iDDestino = iDDestino No newline at end of file
10 self.iDDestino = iDDestino
11 self.portDestino = portDestino No newline at end of file
11 self.portDestino = portDestino
12 No newline at end of file
12
13 self.createObjects() No newline at end of file
13 self.createObjects()
14 No newline at end of file
14
15 def createObjects(self): No newline at end of file
15 def createObjects(self):
16 No newline at end of file
16
17 self.commObj = library3.TCPComm(self.ipSource, self.iDSource, self.ipDestino, self.iDDestino, self.portDestino)
17 self.commObj = library3.TCPComm(self.ipSource, self.iDSource, self.ipDestino, self.iDDestino, self.portDestino)
No newline at end of file
18 # self.wFiles = library3.FilesStuff() No newline at end of file
18 self.wFiles = library3.FilesStuff() No newline at end of file
19 No newline at end of file
19
20 def __ConnectionWithCentralControl(self, cmd, data): No newline at end of file
20 def __ConnectionWithCentralControl(self, cmd, data):
21 No newline at end of file
21
22 self.commObj.open_socket() No newline at end of file
22 self.commObj.open_socket()
23 self.commObj.sendData(cmd = cmd, data = data, ipDestino = self.ipDestino) No newline at end of file
23 self.commObj.sendData(cmd = cmd, data = data, ipDestino = self.ipDestino)
24 ipSource, ipDestino, cmd, output = self.commObj.waitData() No newline at end of file
24 ipSource, ipDestino, cmd, output = self.commObj.waitData()
25 self.commObj.close_socket() No newline at end of file
25 self.commObj.close_socket()
26 No newline at end of file
26
27 return output No newline at end of file
27 return output
28
28
No newline at end of file
29 # def abs2ControlModuleFormatFile(self, filename):
29 def abs2ControlModuleFormatFile(self, filename):
No newline at end of file
No newline at end of file
30 #
30
No newline at end of file
No newline at end of file
31 # #From matriz to control module format
31 #From matriz to control module format
No newline at end of file
No newline at end of file
32 # self.wFiles.toCentralControlFormat(filename)
32 self.wFiles.toCentralControlFormat(filename)
No newline at end of file
No newline at end of file
33 # FileName = "CentralControlFormat.txt"
33 FileName = "CentralControlFormat.txt"
No newline at end of file
No newline at end of file
34 # F_Obj = open(FileName,"r")
34 F_Obj = open(FileName,"r")
No newline at end of file
No newline at end of file
35 # FileList = F_Obj.readlines()
35 FileList = F_Obj.readlines()
No newline at end of file
No newline at end of file
36 # F_Obj.close()
36 F_Obj.close()
No newline at end of file
No newline at end of file
37 # FileStr = "".join(FileList)
37 FileStr = "".join(FileList)
No newline at end of file
No newline at end of file
38 #
38
No newline at end of file
No newline at end of file
39 # return FileStr No newline at end of file
39 return FileStr No newline at end of file
40 No newline at end of file
40
41 def sendFile(self, filename): No newline at end of file
41 def sendFile(self, filename):
42
42
No newline at end of file
43 # data = self.abs2ControlModuleFormatFile(filename)
43 data = self.abs2ControlModuleFormatFile(filename)
No newline at end of file
No newline at end of file
44 data = self.__readFile(filename) No newline at end of file
44 No newline at end of file
45 self.__ConnectionWithCentralControl(cmd = "SNDF", data = data) No newline at end of file
45 self.__ConnectionWithCentralControl(cmd = "SNDF", data = data)
46 No newline at end of file
46
47 def changeBeam(self, newBeam): No newline at end of file
47 def changeBeam(self, newBeam):
48 No newline at end of file
48
49 self.__ConnectionWithCentralControl(cmd = "CHGB", data = newBeam) No newline at end of file
49 self.__ConnectionWithCentralControl(cmd = "CHGB", data = newBeam)
50 No newline at end of file
50
51 def __writeFile(self, filename, data): No newline at end of file
51 def __writeFile(self, filename, data):
52 No newline at end of file
52
53 fobj = open(filename,"w") No newline at end of file
53 fobj = open(filename,"w")
54 fobj.writelines(data) No newline at end of file
54 fobj.writelines(data)
55 fobj.close() No newline at end of file
55 fobj.close()
56
No newline at end of file
57 def __readFile(self, filename):
No newline at end of file
58
No newline at end of file
59 fobj = open(filename,"r")
No newline at end of file
60 listData = fobj.readlines()
No newline at end of file
61 fobj.close()
No newline at end of file
62 data = "".join(listData)
No newline at end of file
63 return data
No newline at end of file
64 No newline at end of file
56 No newline at end of file
65
57 def getControlModuleStatus(self, data): No newline at end of file
66 def getControlModuleStatus(self, data):
58 No newline at end of file
67
59 data = self.__ConnectionWithCentralControl(cmd = "ANST", data = data) No newline at end of file
68 data = self.__ConnectionWithCentralControl(cmd = "ANST", data = data)
60 self.__writeFile("report.txt", data) No newline at end of file
69 self.__writeFile("report.txt", data)
61 No newline at end of file
70
62 def getControlModulePhase(self, data): No newline at end of file
71 def getControlModulePhase(self, data):
63 No newline at end of file
72
64 data = self.__ConnectionWithCentralControl(cmd = "ANPH", data = data) No newline at end of file
73 data = self.__ConnectionWithCentralControl(cmd = "ANPH", data = data)
65 # self.__writeFile("report.txt", data) No newline at end of file
74 # self.__writeFile("report.txt", data)
66 No newline at end of file
75
67 def getConnectionStatus(self): No newline at end of file
76 def getConnectionStatus(self):
68 No newline at end of file
77
69 data = self.__ConnectionWithCentralControl(cmd = "NTST", data = "none") No newline at end of file
78 data = self.__ConnectionWithCentralControl(cmd = "NTST", data = "none")
70 self.__writeFile("connection_status.txt", data) No newline at end of file
79 self.__writeFile("connection_status.txt", data)
71 No newline at end of file
80
72 if __name__ == '__main__': No newline at end of file
81 if __name__ == '__main__':
73 No newline at end of file
82
74 filename = "experimento1.abs" No newline at end of file
83 filename = "experimento1.abs"
75 No newline at end of file
84
76 absObj = ABSClient() No newline at end of file
85 absObj = ABSClient()
77 absObj.sendFile(filename) No newline at end of file
86 absObj.sendFile(filename)
@@ -1,262 +1,287
1 import os No newline at end of file
1 import os
2 import library3 No newline at end of file
2 import library3
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 No newline at end of file
6
7 def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000, ipDestino2="192.168.1.11", portDestino2=5500, rx_buffer = "default"): No newline at end of file
7 def __init__(self,ipSource="localhost", ipDestino="192.168.1.117", portDestino=7000, ipDestino2="192.168.1.11", portDestino2=5500, rx_buffer = "default"):
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.tx_buffer = "default" No newline at end of file
16 self.tx_buffer = "default"
17 # self.rx_buffer = "default" No newline at end of file
17 # self.rx_buffer = "default"
18 self.rx_buffer = rx_buffer No newline at end of file
18 self.rx_buffer = rx_buffer
19 self.enaModules = [] No newline at end of file
19 self.enaModules = []
20 No newline at end of file
20
21 self.createObjects() No newline at end of file
21 self.createObjects()
22 No newline at end of file
22
23 def createObjects(self): No newline at end of file
23 def createObjects(self):
24 No newline at end of file
24
25 asServer = True No newline at end of file
25 asServer = True
26 self.commServerObj = library3.TCPComm("Central_Control", "CeCnMod", self.ipDestino, "CnMod01", self.portDestino, asServer) No newline at end of file
26 self.commServerObj = library3.TCPComm("Central_Control", "CeCnMod", self.ipDestino, "CnMod01", self.portDestino, asServer)
27 self.commClientObj = library3.TCPComm("Central_Control", "CeCnMod", self.ipDestino2, "CnMod01", self.portDestino2) No newline at end of file
27 self.commClientObj = library3.TCPComm("Central_Control", "CeCnMod", self.ipDestino2, "CnMod01", self.portDestino2)
28 self.wFiles = library3.FilesStuff() No newline at end of file
28 No newline at end of file
29
29 def waitRequest(self): No newline at end of file
30 def waitRequest(self):
30 No newline at end of file
31
31 #Using rx buffer No newline at end of file
32 #Using rx buffer
32 ipSource, ipDestino, cmd, self.rx_buffer = self.commServerObj.waitData() No newline at end of file
33 ipSource, ipDestino, cmd, self.rx_buffer = self.commServerObj.waitData()
33 No newline at end of file
34
34 if cmd == "SNDF": No newline at end of file
35 if cmd == "SNDF":
35 datarpta = self.__sendFile2Modules(cmd = cmd) No newline at end of file
36 datarpta = self.__sendFile2Modules(cmd = cmd)
36 No newline at end of file
37
37 if cmd == "CHGB": No newline at end of file
38 if cmd == "CHGB":
38 datarpta = self.__changeBeam(cmd = cmd) No newline at end of file
39 datarpta = self.__changeBeam(cmd = cmd)
39 No newline at end of file
40
40 if cmd == "ANST": No newline at end of file
41 if cmd == "ANST":
41 self.__getControlModuleStatus(cmd = cmd) No newline at end of file
42 self.__getControlModuleStatus(cmd = cmd)
42 #Using tx buffer No newline at end of file
43 #Using tx buffer
43 datarpta = self.tx_buffer No newline at end of file
44 datarpta = self.tx_buffer
44 No newline at end of file
45
45 if cmd == "ANPH": No newline at end of file
46 if cmd == "ANPH":
46 self.__getControlModulePhase(cmd = cmd) No newline at end of file
47 self.__getControlModulePhase(cmd = cmd)
47 #Using tx buffer No newline at end of file
48 #Using tx buffer
48 datarpta = self.tx_buffer No newline at end of file
49 datarpta = self.tx_buffer
49 No newline at end of file
50
50 if cmd == "NTST": No newline at end of file
51 if cmd == "NTST":
51 #Using tx buffer No newline at end of file
52 #Using tx buffer
52 datarpta = self.__getConnectionStatus(cmd = cmd) No newline at end of file
53 datarpta = self.__getConnectionStatus(cmd = cmd)
53 No newline at end of file
54
54 self.commServerObj.sendData(cmd=cmd, data=datarpta, ipDestino = ipSource) No newline at end of file
55 self.commServerObj.sendData(cmd=cmd, data=datarpta, ipDestino = ipSource)
55 No newline at end of file
56
56 def checkModule(self, address): No newline at end of file
57 def checkModule(self, address):
57 No newline at end of file
58
58 cmd = "ping -c 1 -w 1 192.168.1."+ str(address) + " >> /dev/null" No newline at end of file
59 cmd = "ping -c 1 -w 1 192.168.1."+ str(address) + " >> /dev/null"
59 status = os.system(cmd) No newline at end of file
60 status = os.system(cmd)
60 No newline at end of file
61
61 if status == 256: No newline at end of file
62 if status == 256:
62 return False No newline at end of file
63 return False
63 No newline at end of file
64
64 return True No newline at end of file
65 return True
65 No newline at end of file
66
66 def __writeReport(self, enaModules): No newline at end of file
67 def __writeReport(self, enaModules):
67 No newline at end of file
68
68 status_array = ["Status of modules\n"] No newline at end of file
69 status_array = ["Status of modules\n"]
69 status_array.append("----------------\n") No newline at end of file
70 status_array.append("----------------\n")
70 No newline at end of file
71
71 for address in range(1,65): No newline at end of file
72 for address in range(1,65):
72 if address in enaModules: No newline at end of file
73 if address in enaModules:
73 status_array.append("192.168.1." + str(address) + " [1 1]\n") No newline at end of file
74 status_array.append("192.168.1." + str(address) + " [1 1]\n")
74 else: No newline at end of file
75 else:
75 status_array.append("192.168.1." + str(address) + " [0 0]\n") No newline at end of file
76 status_array.append("192.168.1." + str(address) + " [0 0]\n")
76
77
No newline at end of file
78 filename = "module_status.txt"
77 f = open("module_status.txt","w")
No newline at end of file
No newline at end of file
79 self.__writeFile(filename,status_array)
78 f.writelines(status_array)
No newline at end of file
No newline at end of file
80 # f = open("module_status.txt","w")
79 f.close() No newline at end of file
No newline at end of file
81 # f.writelines(status_array)
No newline at end of file
82 # f.close()
No newline at end of file
83
No newline at end of file
84
No newline at end of file
85 def __writeFile(self, filename, data):
No newline at end of file
86
No newline at end of file
87 fobj = open(filename,"w")
No newline at end of file
88 fobj.writelines(data)
No newline at end of file
89 fobj.close() No newline at end of file
80 No newline at end of file
90
81 def checkAntenna(self): No newline at end of file
91 def checkAntenna(self):
82 No newline at end of file
92
83 """ No newline at end of file
93 """
84 Direccion de los modulos de las antenas: No newline at end of file
94 Direccion de los modulos de las antenas:
85 No newline at end of file
95
86 Norte : 01-16 No newline at end of file
96 Norte : 01-16
87 Este : 17-32 No newline at end of file
97 Este : 17-32
88 Oeste: : 33-48 No newline at end of file
98 Oeste: : 33-48
89 Sur : 49-64 No newline at end of file
99 Sur : 49-64
90 No newline at end of file
100
91 """ No newline at end of file
101 """
92 No newline at end of file
102
93 enaModules2 = [] No newline at end of file
103 enaModules2 = []
94 No newline at end of file
104
95 for address in range(1,65): No newline at end of file
105 for address in range(1,65):
96 if self.checkModule(address): No newline at end of file
106 if self.checkModule(address):
97 enaModules2.append(address) No newline at end of file
107 enaModules2.append(address)
98 No newline at end of file
108
99 self.__writeReport(enaModules2) No newline at end of file
109 self.__writeReport(enaModules2)
100 return enaModules2 No newline at end of file
110 return enaModules2
101 No newline at end of file
111
102 def __ConnectionWithControlModules(self,data,cmd,id): No newline at end of file
112 def __ConnectionWithControlModules(self,data,cmd,id):
103 No newline at end of file
113
104 self.commClientObj.open_socket() No newline at end of file
114 self.commClientObj.open_socket()
105 ip = "192.168.1." + str(id) No newline at end of file
115 ip = "192.168.1." + str(id)
106 self.commClientObj.sendData(cmd, data, ip) No newline at end of file
116 self.commClientObj.sendData(cmd, data, ip)
107 ipSource, ipDestino, cmd, tmp = self.commClientObj.waitData() No newline at end of file
117 ipSource, ipDestino, cmd, tmp = self.commClientObj.waitData()
108 self.commClientObj.close_socket() No newline at end of file
118 self.commClientObj.close_socket()
109 No newline at end of file
119
110 return tmp No newline at end of file
120 return tmp
111 No newline at end of file
121
122 def abs2ControlModuleFormatFile(self, filename):
No newline at end of file
123
No newline at end of file
124 #From matriz to control module format
No newline at end of file
125 self.wFiles.toCentralControlFormat(filename)
No newline at end of file
126 FileName = "CentralControlFormat.txt"
No newline at end of file
127 F_Obj = open(FileName,"r")
No newline at end of file
128 FileList = F_Obj.readlines()
No newline at end of file
129 F_Obj.close()
No newline at end of file
130 FileStr = "".join(FileList)
No newline at end of file
131
No newline at end of file
132 return FileStr
No newline at end of file
133 No newline at end of file
112 def __All2Blocks(self,input): No newline at end of file
134 def __All2Blocks(self,input):
113 No newline at end of file
135
114 rx_frame_lst = input.split('\n',2) No newline at end of file
136 rx_frame_lst = input.split('\n',2)
115 No newline at end of file
137
116 header = rx_frame_lst[0] + "\n" No newline at end of file
138 header = rx_frame_lst[0] + "\n"
117 control_modules_str = rx_frame_lst[2] No newline at end of file
139 control_modules_str = rx_frame_lst[2]
118 control_modules_lst = control_modules_str.split("------\n") No newline at end of file
140 control_modules_lst = control_modules_str.split("------\n")
119 No newline at end of file
141
120 return header, control_modules_lst No newline at end of file
142 return header, control_modules_lst
121 No newline at end of file
143
122 No newline at end of file
144
123 def __sendFile2Modules(self,cmd): No newline at end of file
145 def __sendFile2Modules(self,cmd):
124 No newline at end of file
146
147 filename = "tmp.txt"
No newline at end of file
148 self.__writeFile(filename,self.rx_buffer)
No newline at end of file
149 data = self.abs2ControlModuleFormatFile(filename) No newline at end of file
125 #Needed for the loop
150 #Needed for the loop
No newline at end of file
151 header, control_modules_lst = self.__All2Blocks(data) No newline at end of file
126 header, control_modules_lst = self.__All2Blocks(self.rx_buffer) No newline at end of file
127 correct = 0 No newline at end of file
152 correct = 0
128 No newline at end of file
153
129 for id in range(1,65): No newline at end of file
154 for id in range(1,65):
130 No newline at end of file
155
131 if id not in self.enaModules: No newline at end of file
156 if id not in self.enaModules:
132 continue No newline at end of file
157 continue
133 No newline at end of file
158
134 if self.__ConnectionWithControlModules(header + control_modules_lst[id-1], cmd, id) == "OK": No newline at end of file
159 if self.__ConnectionWithControlModules(header + control_modules_lst[id-1], cmd, id) == "OK":
135 correct = correct + 1 No newline at end of file
160 correct = correct + 1
136 No newline at end of file
161
137 if correct == len(self.enaModules): No newline at end of file
162 if correct == len(self.enaModules):
138 rpta = "OK" No newline at end of file
163 rpta = "OK"
139 else: No newline at end of file
164 else:
140 rpta = "Failure" No newline at end of file
165 rpta = "Failure"
141 No newline at end of file
166
142 return rpta No newline at end of file
167 return rpta
143 No newline at end of file
168
144 def __changeBeam(self, cmd): No newline at end of file
169 def __changeBeam(self, cmd):
145 No newline at end of file
170
146 correct = 0 No newline at end of file
171 correct = 0
147 # enaModules = self.checkAntenna() No newline at end of file
172 # enaModules = self.checkAntenna()
148 # enaModules = [11,12,13,14] No newline at end of file
173 # enaModules = [11,12,13,14]
149 No newline at end of file
174
150 for id in range(1,65): No newline at end of file
175 for id in range(1,65):
151 if id not in self.enaModules: No newline at end of file
176 if id not in self.enaModules:
152 continue No newline at end of file
177 continue
153 No newline at end of file
178
154 if self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) == "OK": No newline at end of file
179 if self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) == "OK":
155 correct = correct + 1 No newline at end of file
180 correct = correct + 1
156 No newline at end of file
181
157 if correct == len(self.enaModules): No newline at end of file
182 if correct == len(self.enaModules):
158 rpta = "OK" No newline at end of file
183 rpta = "OK"
159 else: No newline at end of file
184 else:
160 rpta = "Failure" No newline at end of file
185 rpta = "Failure"
161 No newline at end of file
186
162 return rpta No newline at end of file
187 return rpta
163 No newline at end of file
188
164 def __getControlModuleStatus(self, cmd): No newline at end of file
189 def __getControlModuleStatus(self, cmd):
165 No newline at end of file
190
166 all_blocks = "" No newline at end of file
191 all_blocks = ""
167 # enaModules = self.checkAntenna() No newline at end of file
192 # enaModules = self.checkAntenna()
168 # enaModules = [11,12,13,14] No newline at end of file
193 # enaModules = [11,12,13,14]
169 No newline at end of file
194
170 for id in range(1,65): No newline at end of file
195 for id in range(1,65):
171 if id not in self.enaModules: No newline at end of file
196 if id not in self.enaModules:
172 continue No newline at end of file
197 continue
173 No newline at end of file
198
174 one_block = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) No newline at end of file
199 one_block = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id)
175 No newline at end of file
200
176 all_blocks = all_blocks + one_block No newline at end of file
201 all_blocks = all_blocks + one_block
177 #Using tx buffer No newline at end of file
202 #Using tx buffer
178 print all_blocks No newline at end of file
203 print all_blocks
179 self.tx_buffer = all_blocks No newline at end of file
204 self.tx_buffer = all_blocks
180 No newline at end of file
205
181 def __getControlModulePhase(self, cmd): No newline at end of file
206 def __getControlModulePhase(self, cmd):
182 No newline at end of file
207
183 all_blocks = "" No newline at end of file
208 all_blocks = ""
184 # enaModules = self.checkAntenna() No newline at end of file
209 # enaModules = self.checkAntenna()
185 # enaModules = [11,12,13,14] No newline at end of file
210 # enaModules = [11,12,13,14]
186 No newline at end of file
211
187 for id in range(1,65): No newline at end of file
212 for id in range(1,65):
188 if id not in self.enaModules: No newline at end of file
213 if id not in self.enaModules:
189 continue No newline at end of file
214 continue
190 No newline at end of file
215
191 one_block = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) No newline at end of file
216 one_block = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id)
192 No newline at end of file
217
193 all_blocks = all_blocks + one_block No newline at end of file
218 all_blocks = all_blocks + one_block
194 #Using tx buffer No newline at end of file
219 #Using tx buffer
195 print all_blocks No newline at end of file
220 print all_blocks
196 self.tx_buffer = all_blocks No newline at end of file
221 self.tx_buffer = all_blocks
197 No newline at end of file
222
198 def __getConnectionStatus(self, cmd): No newline at end of file
223 def __getConnectionStatus(self, cmd):
199 No newline at end of file
224
200 ena = self.checkAntenna() No newline at end of file
225 ena = self.checkAntenna()
201 print ena No newline at end of file
226 print ena
202 self.enaModules = ena No newline at end of file
227 self.enaModules = ena
203 No newline at end of file
228
204 blockLst = [] No newline at end of file
229 blockLst = []
205 No newline at end of file
230
206 for id in range(1,65): No newline at end of file
231 for id in range(1,65):
207 if id not in self.enaModules: No newline at end of file
232 if id not in self.enaModules:
208 continue No newline at end of file
233 continue
209 No newline at end of file
234
210 blockStr = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) No newline at end of file
235 blockStr = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id)
211 blockLst.append(blockStr + ", 192.168.1." + str(id) + "\n") No newline at end of file
236 blockLst.append(blockStr + ", 192.168.1." + str(id) + "\n")
212 #Using tx buffer No newline at end of file
237 #Using tx buffer
213 self.tx_buffer = "".join(blockLst) No newline at end of file
238 self.tx_buffer = "".join(blockLst)
214 print self.tx_buffer No newline at end of file
239 print self.tx_buffer
215 No newline at end of file
240
216 return self.tx_buffer No newline at end of file
241 return self.tx_buffer
217 No newline at end of file
242
218 def getConnectionStatus(self, cmd): No newline at end of file
243 def getConnectionStatus(self, cmd):
219 No newline at end of file
244
220 ena = self.checkAntenna() No newline at end of file
245 ena = self.checkAntenna()
221 self.enaModules = ena No newline at end of file
246 self.enaModules = ena
222 No newline at end of file
247
223 blockLst = [] No newline at end of file
248 blockLst = []
224 No newline at end of file
249
225 for id in range(1,65): No newline at end of file
250 for id in range(1,65):
226 if id not in self.enaModules: No newline at end of file
251 if id not in self.enaModules:
227 continue No newline at end of file
252 continue
228 No newline at end of file
253
229 blockStr = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) No newline at end of file
254 blockStr = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id)
230 blockLst.append(blockStr + ", 192.168.1." + str(id) + "\n") No newline at end of file
255 blockLst.append(blockStr + ", 192.168.1." + str(id) + "\n")
231 #Using tx buffer No newline at end of file
256 #Using tx buffer
232 self.tx_buffer = "".join(blockLst) No newline at end of file
257 self.tx_buffer = "".join(blockLst)
233 print self.tx_buffer No newline at end of file
258 print self.tx_buffer
234 No newline at end of file
259
235 return self.tx_buffer No newline at end of file
260 return self.tx_buffer
236 No newline at end of file
261
237 def getControlModuleStatus(self, cmd): No newline at end of file
262 def getControlModuleStatus(self, cmd):
238 No newline at end of file
263
239 all_blocks = "" No newline at end of file
264 all_blocks = ""
240 # enaModules = self.checkAntenna() No newline at end of file
265 # enaModules = self.checkAntenna()
241 # enaModules = [11,12,13,14] No newline at end of file
266 # enaModules = [11,12,13,14]
242 No newline at end of file
267
243 for id in range(1,65): No newline at end of file
268 for id in range(1,65):
244 if id not in self.enaModules: No newline at end of file
269 if id not in self.enaModules:
245 continue No newline at end of file
270 continue
246 No newline at end of file
271
247 one_block = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id) No newline at end of file
272 one_block = self.__ConnectionWithControlModules(self.rx_buffer,cmd,id)
248 No newline at end of file
273
249 all_blocks = all_blocks + one_block No newline at end of file
274 all_blocks = all_blocks + one_block
250 #Using tx buffer No newline at end of file
275 #Using tx buffer
251 print all_blocks No newline at end of file
276 print all_blocks
252 self.tx_buffer = all_blocks No newline at end of file
277 self.tx_buffer = all_blocks
253 No newline at end of file
278
254 return all_blocks No newline at end of file
279 return all_blocks
255 No newline at end of file
280
256 No newline at end of file
281
257 if __name__ == '__main__': No newline at end of file
282 if __name__ == '__main__':
258 No newline at end of file
283
259 absObj = ABSServer() No newline at end of file
284 absObj = ABSServer()
260 No newline at end of file
285
261 while 1: No newline at end of file
286 while 1:
262 absObj.waitRequest() No newline at end of file
287 absObj.waitRequest()
General Comments 0
You need to be logged in to leave comments. Login now