Index: trunk/absroot/source/abspy/bin/server3.py =================================================================== diff --git a/trunk/absroot/source/abspy/bin/server3.py b/trunk/absroot/source/abspy/bin/server3.py --- a/trunk/absroot/source/abspy/bin/server3.py (revision 250) +++ b/trunk/absroot/source/abspy/bin/server3.py (revision 251) @@ -69,7 +69,7 @@ datarpta = self.__getConnectionStatus(cmd = cmd, rx_buffer = rx_buffer) if cmd == "MNTR": - datarpta = self.__getControlModuleStatus_new(cmd = cmd, rx_buffer = rx_buffer) + datarpta = self.__getControlModuleStatus_new(cmd = cmd, type = rx_buffer) self.commServerObj.sendData(cmd=cmd, data=datarpta, ipDestino = ipSource) @@ -286,40 +286,50 @@ return self.bits - def __getControlModuleStatus_new(self, cmd, rx_buffer): - - all_mnt = [] - for id in range(1,65): - if id not in self.enaModules: - continue - - mnt = self.__ConnectionWithControlModules(rx_buffer,cmd,id) - all_mnt.append(mnt) - - __function1(type = rx_buffer, in_lst = all_mnt) - #return "".join(all_mnt) - - def __function1(self, type, in_lst): - - if type == "0": - out_str = "".join(in_lst) - elif type == "1": - out_str = "".join(in_lst) - elif type == "2": - out_str = "".join(in_lst) + def __getControlModuleStatus_new(self, cmd, type): + + cm_lst = self.__gettingDataFromControlModules(self, cmd, rx_buffer = type) + out_lst = self.__processingCMdata(in_data = cm_lst, type = type) + + return "".join(lst_out) + + def __gettingDataFromControlModules(self, cmd, rx_buffer): + + for id in range(1,65): + if id not in self.enaModules: + continue + + cm = self.__ConnectionWithControlModules(rx_buffer,cmd,id) + del self.test[id-1] + self.test.insert(id-1, cm) + + return self.test + + def __processingCMdata(self,in_data, type): + + if (type == "0") or (type == "1") or (type == "2"): + out_str = "".join(in_data) elif type == "3": - TwoComparation(in_lst = in_lst) + out_str = TwoComparation(in_lst = in_data) else: - ThreeComparation(in_lst = in_lst) + out_str = ThreeComparation(in_lst = in_data) return out_str def __TwoComparation(self, in_lst): + cm_up =[] cm_dw =[] relay_up =[] relay_dw =[] + for i in in_lst: + if len(i) == 8: + relay_up.append("-") + relay_dw.append("-") + cm_up.append("-") + cm_dw.append("-") + continue relay_up.append(i[14:17]) relay_dw.append(i[17:20]) cm_up.append(i[21:24]) @@ -328,22 +338,25 @@ comp_up = [] comp_dw = [] - for i in range(len(relay_up)): - if cmp(relay_up[i], cm_up[i]) == 0: - comp_up.append(0) + for i in range(64): + if len(relay_up == 1): + comp_up.append('x') else: - comp_up.append(1) + if cmp(relay_up[i], cm_up[i]) == 0: + comp_up.append('0') + else: + comp_up.append('1') for i in range(len(relay_dw)): + comp_dw.append('x') if cmp(relay_dw[i], cm_dw[i]) == 0: - comp_dw.append(0) + comp_dw.append('0') else: - comp_dw.append(1) + comp_dw.append('1') print comp_up print comp_dw - - + def __ThreeComparation(self, in_lst): pass @@ -453,6 +466,7 @@ self.rxFile = list("------\n------\n------\n" for i in range(64)) self.bits = list("------\n------\n------\n" for i in range(64)) self.phase = list("----- -----\n----- -----\n----- -----\n" for i in range(64)) + self.test = list("------\n" for i in range(64)) def __AutomaticControlModules(self):