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