def connectShow(self): # 显示图像队列 self.connectedCamShow = True #server_addr = '0.0.0.0' server_addr = self.server_addr # 检测结果队列 self.show_queue = Queue() QueueManager.register('show', callable=lambda: self.show_queue) cambar_manager = QueueManager(address=(server_addr, 9111), authkey=b'dihuge') try: cambar_manager.start() except Exception as e: print(e) cambar_manager.connect() self.show = cambar_manager.show()
def connectRet(self): # 结果队列 self.connectedRet = True #server_addr = '0.0.0.0' server_addr = self.server_addr # 检测结果队列 self.ret_queue = Queue() QueueManager.register('result', callable=lambda: self.ret_queue) camcolor_manager = QueueManager(address=(server_addr, 9113), authkey=b'dihuge') try: camcolor_manager.start() except Exception as e: print(e) camcolor_manager.connect() self.ret_sender = camcolor_manager.result()
def connectCapture(self): # capture queue, for plc control self.connectedCapture = True #server_addr = '0.0.0.0' server_addr = self.server_addr # 检测结果队列 self.capture_queue = Queue() QueueManager.register('capture', callable=lambda: self.capture_queue) cambar_manager = QueueManager(address=(server_addr, 9110), authkey=b'dihuge') try: cambar_manager.start() except Exception as e: print(e) cambar_manager.connect() self.capture = cambar_manager.capture()
def connectButton(self): # 操作信息 self.connectedButton = True #server_addr = '0.0.0.0' server_addr = self.server_addr # 检测结果队列 self.button_queue = Queue() QueueManager.register('button_type', callable=lambda: self.button_queue) button_manager = QueueManager(address=(server_addr, 9114), authkey=b'dihuge') try: button_manager.start() except Exception as e: print(e) button_manager.connect() self.button_type_sender = button_manager.button_type()
def connectRet(self): while self.connectedRet == False: try: QueueManager.register('result') manager = QueueManager(address=(self.server_addr, 9113), authkey=b'dihuge') manager.connect() self.ret_sender = manager.result() self.connectedRet = True except Exception as e: print('Ret_ConnectRefuseRec', e) time.sleep(1)
def connectCapture(self): while self.connectedCapture == False: try: # color result queue QueueManager.register('capture') manager = QueueManager(address=(self.server_addr, 9110), authkey=b'dihuge') manager.connect() self.capture_sender = manager.capture() self.connectedCapture = True except Exception as e: print('Capture_ConnectRefuseRec', e) time.sleep(1)
def connectShow(self): while self.connectedShow == False: try: QueueManager.register('show') manager = QueueManager(address=(self.server_addr, 9111), authkey=b'dihuge') manager.connect() self.show_sender = manager.show() self.connectedShow = True except Exception as e: print('show_ConnectRefuseRec', e) time.sleep(1)
def connectObj(self): # 显示图像队列 self.connectedObj = True #server_addr = '0.0.0.0' server_addr = self.server_addr # 检测结果队列 self.obj_queue_0 = Queue() self.obj_queue_1 = Queue() self.obj_queue_2 = Queue() self.obj_queue_3 = Queue() self.obj_queue_4 = Queue() self.obj_queue_5 = Queue() QueueManager.register('obj_0', callable=lambda: self.obj_queue_0) QueueManager.register('obj_1', callable=lambda: self.obj_queue_1) QueueManager.register('obj_2', callable=lambda: self.obj_queue_2) QueueManager.register('obj_3', callable=lambda: self.obj_queue_3) QueueManager.register('obj_4', callable=lambda: self.obj_queue_4) QueueManager.register('obj_5', callable=lambda: self.obj_queue_5) cambar_manager = QueueManager(address=(server_addr, 9112), authkey=b'dihuge') try: cambar_manager.start() except Exception as e: print(e) cambar_manager.connect() self.obj_0 = cambar_manager.obj_0() self.obj_1 = cambar_manager.obj_1() self.obj_2 = cambar_manager.obj_2() self.obj_3 = cambar_manager.obj_3() self.obj_4 = cambar_manager.obj_4() self.obj_5 = cambar_manager.obj_5()
def connectObj(self): while self.connectedObj == False: try: # color result queue QueueManager.register('obj_%d' % self.camId) manager = QueueManager(address=(self.server_addr, 9112), authkey=b'dihuge') manager.connect() # camNum = config['cameras']['camNum'] # for i in range(camNum): # if self.camId == i: # self.obj_sender = eval("manager.obj_%s"%(i)()) if self.camId == 0: self.obj_sender = manager.obj_0() elif self.camId == 1: self.obj_sender = manager.obj_1() elif self.camId == 2: self.obj_sender = manager.obj_2() elif self.camId == 3: self.obj_sender = manager.obj_3() elif self.camId == 4: self.obj_sender = manager.obj_4() elif self.camId == 5: self.obj_sender = manager.obj_5() self.connectedObj = True except Exception as e: print('Obj_ConnectRefuseRec', e) time.sleep(1)