##// END OF EJS Templates
changes to integrate to the web interface
imanay -
r138:139
parent child
Show More
@@ -15,7 +15,7
15 15 def createObjects(self):
16 16
17 17 self.commObj = library3.TCPComm(self.ipSource, self.iDSource, self.ipDestino, self.iDDestino, self.portDestino)
18 self.wFiles = library3.FilesStuff()
18 # self.wFiles = library3.FilesStuff()
19 19
20 20 def __ConnectionWithCentralControl(self, cmd, data):
21 21
@@ -26,22 +26,22
26 26
27 27 return output
28 28
29 def abs2ControlModuleFormatFile(self, filename):
30
31 #From matriz to control module format
32 self.wFiles.toCentralControlFormat(filename)
33 FileName = "CentralControlFormat.txt"
34 F_Obj = open(FileName,"r")
35 FileList = F_Obj.readlines()
36 F_Obj.close()
37 FileStr = "".join(FileList)
38
39 return FileStr
29 # def abs2ControlModuleFormatFile(self, filename):
30 #
31 # #From matriz to control module format
32 # self.wFiles.toCentralControlFormat(filename)
33 # FileName = "CentralControlFormat.txt"
34 # F_Obj = open(FileName,"r")
35 # FileList = F_Obj.readlines()
36 # F_Obj.close()
37 # FileStr = "".join(FileList)
38 #
39 # return FileStr
40 40
41 41 def sendFile(self, filename):
42 42
43 data = self.abs2ControlModuleFormatFile(filename)
44
43 # data = self.abs2ControlModuleFormatFile(filename)
44 data = self.__readFile(filename)
45 45 self.__ConnectionWithCentralControl(cmd = "SNDF", data = data)
46 46
47 47 def changeBeam(self, newBeam):
@@ -53,6 +53,15
53 53 fobj = open(filename,"w")
54 54 fobj.writelines(data)
55 55 fobj.close()
56
57 def __readFile(self, filename):
58
59 fobj = open(filename,"r")
60 listData = fobj.readlines()
61 fobj.close()
62 data = "".join(listData)
63 return data
64
56 65
57 66 def getControlModuleStatus(self, data):
58 67
@@ -25,6 +25,7
25 25 asServer = True
26 26 self.commServerObj = library3.TCPComm("Central_Control", "CeCnMod", self.ipDestino, "CnMod01", self.portDestino, asServer)
27 27 self.commClientObj = library3.TCPComm("Central_Control", "CeCnMod", self.ipDestino2, "CnMod01", self.portDestino2)
28 self.wFiles = library3.FilesStuff()
28 29
29 30 def waitRequest(self):
30 31
@@ -74,10 +75,19
74 75 else:
75 76 status_array.append("192.168.1." + str(address) + " [0 0]\n")
76 77
77 f = open("module_status.txt","w")
78 f.writelines(status_array)
79 f.close()
80
78 filename = "module_status.txt"
79 self.__writeFile(filename,status_array)
80 # f = open("module_status.txt","w")
81 # f.writelines(status_array)
82 # f.close()
83
84
85 def __writeFile(self, filename, data):
86
87 fobj = open(filename,"w")
88 fobj.writelines(data)
89 fobj.close()
90
81 91 def checkAntenna(self):
82 92
83 93 """
@@ -107,7 +117,19
107 117 ipSource, ipDestino, cmd, tmp = self.commClientObj.waitData()
108 118 self.commClientObj.close_socket()
109 119
110 return tmp
120 return tmp
121
122 def abs2ControlModuleFormatFile(self, filename):
123
124 #From matriz to control module format
125 self.wFiles.toCentralControlFormat(filename)
126 FileName = "CentralControlFormat.txt"
127 F_Obj = open(FileName,"r")
128 FileList = F_Obj.readlines()
129 F_Obj.close()
130 FileStr = "".join(FileList)
131
132 return FileStr
111 133
112 134 def __All2Blocks(self,input):
113 135
@@ -121,9 +143,12
121 143
122 144
123 145 def __sendFile2Modules(self,cmd):
124
146
147 filename = "tmp.txt"
148 self.__writeFile(filename,self.rx_buffer)
149 data = self.abs2ControlModuleFormatFile(filename)
125 150 #Needed for the loop
126 header, control_modules_lst = self.__All2Blocks(self.rx_buffer)
151 header, control_modules_lst = self.__All2Blocks(data)
127 152 correct = 0
128 153
129 154 for id in range(1,65):
General Comments 0
You need to be logged in to leave comments. Login now