##// END OF EJS Templates
Client changes to return answer to the web page.
Client changes to return answer to the web page.

File last commit:

r166:167
r166:167
Show More
client3.py
99 lines | 3.2 KiB | text/x-python | PythonLexer
jsalyrosas
- Las carpetas se han convertido en paquetes de Python para poder importar adecuadamente las clases....
r164 import library3
import os.path
Implementation of the client and library using TCP.
r75
jsalyrosas
- Las carpetas se han convertido en paquetes de Python para poder importar adecuadamente las clases....
r164 class ABSClient(object):
Implementation of the client and library using TCP.
r75
Trying frame without semicolon.
r101 def __init__(self,ipSource="192.168.1.117", iDSource="Clnt_01", ipDestino="192.168.1.117", iDDestino = "CeCnMod", portDestino=7000):
Implementation of the client and library using TCP.
r75
self.ipSource = ipSource
Trying frame without semicolon.
r101 self.iDSource = iDSource
Implementation of the client and library using TCP.
r75 self.ipDestino = ipDestino
Trying frame without semicolon.
r101 self.iDDestino = iDDestino
Implementation of the client and library using TCP.
r75 self.portDestino = portDestino
self.createObjects()
def createObjects(self):
Trying frame without semicolon.
r101 self.commObj = library3.TCPComm(self.ipSource, self.iDSource, self.ipDestino, self.iDDestino, self.portDestino)
jsalyrosas
- Las carpetas se han convertido en paquetes de Python para poder importar adecuadamente las clases....
r164 #self.wFiles = library3.FilesStuff()
Implementation of the client and library using TCP.
r75
improvement at the client3
r89 def __ConnectionWithCentralControl(self, cmd, data):
self.commObj.open_socket()
self.commObj.sendData(cmd = cmd, data = data, ipDestino = self.ipDestino)
ipSource, ipDestino, cmd, output = self.commObj.waitData()
self.commObj.close_socket()
return output
changes to integrate to the web interface
r138 # def abs2ControlModuleFormatFile(self, filename):
#
# #From matriz to control module format
# self.wFiles.toCentralControlFormat(filename)
# FileName = "CentralControlFormat.txt"
# F_Obj = open(FileName,"r")
# FileList = F_Obj.readlines()
# F_Obj.close()
# FileStr = "".join(FileList)
#
# return FileStr
improvement at the client3
r89
def sendFile(self, filename):
changes to integrate to the web interface
r141 data = self.__readFile(filename)
Client changes to return answer to the web page.
r166 answer = self.__ConnectionWithCentralControl(cmd = "SNDF", data = data)
return answer
Implementation of the client and library using TCP.
r75
def changeBeam(self, newBeam):
Client changes to return answer to the web page.
r166 answer = self.__ConnectionWithCentralControl(cmd = "CHGB", data = newBeam)
return answer
Implementation of the client and library using TCP.
r75
def __writeFile(self, filename, data):
fobj = open(filename,"w")
fobj.writelines(data)
fobj.close()
changes to integrate to the web interface
r138
def __readFile(self, filename):
fobj = open(filename,"r")
listData = fobj.readlines()
fobj.close()
changes to integrate to the web interface
r141 tmp = "".join(listData)
#Adding filename to the begining of the data
jsalyrosas
- Las carpetas se han convertido en paquetes de Python para poder importar adecuadamente las clases....
r164 newfilename = os.path.split(filename)[1]
#data = filename + '\n' + tmp
data = newfilename + '\n' + tmp
changes to integrate to the web interface
r138 return data
Implementation of the client and library using TCP.
r75
changes to integrate to the web interface
r138
getConnectionStatus function added.
r80 def getControlModuleStatus(self, data):
Implementation of the client and library using TCP.
r75
improvement at the client3
r89 data = self.__ConnectionWithCentralControl(cmd = "ANST", data = data)
Implementation of the client and library using TCP.
r75 self.__writeFile("report.txt", data)
r127
ABS Monitoring changes
r146 def getControlModulePhase(self, opt, u = "50", pw = "10"):
r127
ABS Monitoring changes
r146 if opt == '0':
data = self.__ConnectionWithCentralControl(cmd = "LWPH", data = u + '/' + pw + '/')
elif opt == '1':
data = self.__ConnectionWithCentralControl(cmd = "BGPH", data = u + '/' + pw + '/')
elif opt == '2':
data = self.__ConnectionWithCentralControl(cmd = "cBPH", data = u + '/' + pw + '/')
else:
data = self.__ConnectionWithCentralControl(cmd = "cLPH", data = u + '/' + pw + '/')
r127 # self.__writeFile("report.txt", data)
improvement at the client3
r89
getConnectionStatus function added.
r80 def getConnectionStatus(self):
improvement at the client3
r89 data = self.__ConnectionWithCentralControl(cmd = "NTST", data = "none")
getConnectionStatus function added.
r80 self.__writeFile("connection_status.txt", data)
improvement at the client3
r89
Implementation of the client and library using TCP.
r75 if __name__ == '__main__':
filename = "experimento1.abs"
absObj = ABSClient()
getConnectionStatus function added.
r80 absObj.sendFile(filename)