import queue import EntranceIO as EIO rabbitmq_parameter={"ip":"192.168.1.233","port":5672,"user":"zx","password":"zx123456"} #[单元号,入口号,单片机ip,port] mcpu_paramters=[ [1,1,"192.168.1.120",40002], [1,2,"192.168.1.121",40002], [2,3,"192.168.1.122",40002], [2,4,"192.168.1.123",40002]#, # [3,5,"192.168.1.124",40002], # [3,6,"192.168.1.125",40002] ] ''' ''' g_entrances={} g_close_door_cmd_queue=queue.Queue() if __name__=="__main__": for parameter in mcpu_paramters: id=parameter[1] if not g_entrances.get(id)==None: raise("单片机id重复") g_entrances[id]=EIO.EntranceIO(parameter,rabbitmq_parameter) for _,entrance in g_entrances.items(): entrance.start() for _,entrance in g_entrances.items(): entrance.join()